Showing results 1 to 9 of 9

Thread: Issue launching script via REMA instant function

  1. #1
    Join Date
    17.03.2016
    Posts
    62

    Default Issue launching script via REMA instant function

    Afteroon all,

    I've come across an issue when using a REMA to fire off a script when limit value is reached using the 'instant' function.

    I've narrowed it down to the minimum required to replicate it.

    I am using an internal variable to use as a kind of command variable for switching primary / standby server. I use write set value (or do it remotely via process gateway) to write a '1'. I then use a rema to evaluate and if the value is a '1' then start script. The script just runs the 'Redundancy Switch', then also does a WSV to return the value back to 0.
    After various troubleshooting, even if I dont use the 2nd part of script to WSV = 0, the script doesnt run when the rema is evaluted.
    I know the rema is being evaluated, as the value I put in limit value is showing up in the CEL, so its just the function to call the script which is not firing.

    If I put the 'redundancy' switch function in to the REMA... it works.
    If I put a function to run a script (even if that script only has the 'redndancy swtich' funtction in it), then it doesnt work.


    Is there a reason why the rema shouldn't be able to fire off a script? Is there another way to 'reset' the value back to zero after running the function?

    I have tried using allocations so the function isnt being called by the REMA inside the same variable etc, but it seems that is not the issue anyway.. the issue is a REMA is not allowing any 'script' to be triggered by a function.

    Zenon 8.20 build 65486.

    Thanks,

    Dave

  2. #2
    Join Date
    01.07.2008
    Location
    Salzburg, AT
    Posts
    1,033

    Default Re: Issue launching script via REMA instant function

    How is the configuration of the property 'Execution' of function executing the script?
    Is shall be configured - like by 'redundancy switch' function - the "standby server". The script execution functions are overruling the execution place of containing functions. In your case probably to the default for script execution function "current computer". But the 'redundancy switch' function can work only on standby.

  3. #3
    Join Date
    17.03.2016
    Posts
    62

    Default Re: Issue launching script via REMA instant function

    Ursula,

    I checked & the function which executes the script was set to 'current computer'. I note that the actual redundancy swtich function has the execution option greyed out (and is set to standby server).

    I changed the function which executes script to be 'standby server'... however it strangely only seems to work when primary server = server 1. If server 2 is primary then it doesnt work. The problem is that my command will be coming in via redundant process gateways.. so it could be the gateway running on Primary or standby server at any given time which is changing the variable value.

    If I need to execute redundancy swtich from an actual HMI I can just use the built in function, but to do it remotely using PG I need to write a varaible so I can use a rema to trigger the function. Are REMAs evaluted on the primary server on all machines running the runtime? Presumably on the primary as they could bre required to perform a driver function.

    I will have to carry out more testing... I've been limited as I'm having to test everything on a single machine at the moment (with Server 2 running as  VM in demo mode).

    Thanks,

    Dave

  4. #4
    Join Date
    01.07.2008
    Location
    Salzburg, AT
    Posts
    1,033

    Default Re: Issue launching script via REMA instant function

    The evaluation place of the rema depends on variable - if variable is network or local for PC.
    By network variables - so process variables, intern with calculation 'network', MATHDRV, most (but not all) SYSDRV etc. the evaluation place is the current Process Server. Only for local variables evaluation is on particular computer. Thus, the rema by local variable triggers the script execution function on this local computer, not on places configured by functions in the script. Only if function executed by (local) rema has some fix defined place in the network - is executed there. Thus, the switch function linked directly executes on standby - its place, executed in the script - tries probably to execute on primary server - place of variable update.

    But why the remote control center is to send command to force the redundancy switch of zenon Network, and not only switches the connection used from zenon Process Gateway? What is the use case there?

    BTW, what protocol are using your zenon Process Gateways? For zenPG IEC870Slave I would recommend not to start on Server 1 and Server 2 (main threads on servers have already more things to do) but on a dedicated network client. And a client reconnects automatically to the current process server. On one client you can start many instances of Process Gateway.

      

  5. #5
    Join Date
    17.03.2016
    Posts
    62

    Default Re: Issue launching script via REMA instant function

    Quote Originally Posted by ursulak View Post

    But why the remote control center is to send command to force the redundancy switch of zenon Network, and not only switches the connection used from zenon Process Gateway? What is the use case there?

    BTW, what protocol are using your zenon Process Gateways? For zenPG IEC870Slave I would recommend not to start on Server 1 and Server 2 (main threads on servers have already more things to do) but on a dedicated network client. And a client reconnects automatically to the current process server. On one client you can start many instances of Process Gateway.

    Use case is that we are using Zenon as gateway device to take all 61850 IEDs and send onwards to control centre (so we're replacing RTU functionality). Using process gateways running on Server 1 & Server 2.. both PGs are DNP3. This architecture has been discussed with Copadata several times (as we have requested the clear events from event queue on redundant gateway etc).

    This is the first time anyone from CD has advised that process gateway should not be running on the servers so is news to me. Can you expand on why it is not a good idea please? Our situation is that the PG is running on the server machine which has the correct connections to control center network.. The client machines are not connected to this network as that would be poor from a cyber security standpoint. We would also require that there were then 2 network clients as we need to have redundancy to ensure we can withstand failure of the machine.

    Due to how the zenon system works it is possible that our DNP Master is connected to the process gateway on Server 1, but that Server 2 is actually currently running as the Zenon primary server.

    As Zenon will replace RTU functionality we need to ensure we have similar functions to remotely control the Zenon system in event something is not working correctly... so we can remotely start up process gateway if it is not running, and we can remotely force a changeover of primary servers as 1st step to avoid travel to remote sites. We do not want this to happen automatically (eg evaluating process gateway status and use that to force redundnacy change over) as that could lead to a situation where a poor SCADA connection would cause HMIs to failover repeatedly, causing problems for local operators.

    We dont expect to be using it often, however should there be any issues with the system - eg 1 server may have lost connection to IEDs but the other has not then we may need to force a changeover.

    Also WRT your comment ">switches the connection used from zenon Process Gateway".. as far as I know there no way to do this at the Zenon side without shutting down process gateway on that server so that the master is forced to connect to the other server.
    There is no option to force redundant PGs to switch over.
    The process gateway does not have an option to close it it without either clicking 'ok' via GUI to confirm the close (cannot use remotely), or to use a script to taskkill /force, which causes an 'unclean' shutdown of the PG which would cause loss of event buffer etc.
    Unfortunately our DNP3 master can only be switched over by forcing an off scan /on scan. Even then it will connect to the slaves in the order they have been set up as main IP, standby IP. Therefore if server 2 is primary server we still connect to server 1 PG as it comes 1st.
    Last edited by HMIdeveloper123 : 18th May 2020 at 09:33 Reason: clarification of redundancy of PG

  6. #6
    Join Date
    01.07.2008
    Location
    Salzburg, AT
    Posts
    1,033

    Default Re: Issue launching script via REMA instant function

    If it would be better to run zenPG on network server or on client depends on zenPG. In case of IEC870Slave, Modbus etc. I would recommend a dedicated client, in case of DNP3 - the server. On server works anyway.

    Do I understand correctly that one instance of zenPG runs on Server 1 and the second on Server 2? I have some idea for you: in this configuration, also if the criteria for redundancy switch is the connection to IEDs, then the solution you can have native in zenon - you can use the zenon Network redundancy mode 'Rated' configured to calculate ratings of server 1 and server 2 connections. In this rating you can include value(s) - variable(s) forced by the remote Control Center, having high 'weighting' - the strongest impact on the rating. Then zenon will do the redundancy switch according the command from CC - via redundancy evaluation table. Take care to use for it in zenPG the intern variables local on particular server.
    The gateways can publish to CC the current values of both SYSDRV variables with rating evaluation of server 1 and server 2, and when this rating differs (when only one zenon server has good connections to IEDs) - the CC can evaluate this and as reaction CC sends the command to the current zenPG changing its local variable - impacting the rating high enough to force the switch.

    Rated redundancy in Help: Manual > Network > Redundancy > Redundancy modes > Redundancy in a rated network > Example: Configuration for software redundancy with 2 controllers
    There is also short YouTube video (5 min.) about the rated redundancy: https://www.youtube.com/watch?v=JTuteoOPf8o 

  7. #7
    Join Date
    17.03.2016
    Posts
    62

    Default Re: Issue launching script via REMA instant function

    Quote Originally Posted by ursulak View Post
    you can use the zenon Network redundancy mode 'Rated' configured to calculate ratings of server 1 and server 2 connections. In this rating you can include value(s) - variable(s) forced by the remote Control Center, having high 'weighting'


    Ursula,

    Thanks, I had not thought about using a controlled variable to determine rating.

    I have managed to get it working my original way, with a fix to work around the issue (bug?). I can use the rema to directly launch the redundancy switch fucntion & it works, it only does not work if the rema launches a script (the script only works when primary = server 1 for some reason regardless of 'execution' setting for function).

    So instead of using a script to reset variable to 0 then do redundancy switch...

    I got it to work by having 2 internal variables. Both 'network'.
    Int_Var_1 - this is the variable I manipulate with WSV (+via process gateway). This variable has a rema which when the value is = 1 to run a funtion to set the value back to 0.
    Int_var_2 - this varaible is mapped to int_var_1 using allocation. It has a rema which does redundancy switch.

    This seems to work by manually writing set value on either server, or by process gateway connected to either server.

    Many thanks,

    Dave

  8. #8
    Join Date
    01.07.2008
    Location
    Salzburg, AT
    Posts
    1,033

    Default Re: Issue launching script via REMA instant function

    I suppose the origin of difficulties are that the zenon function 'redundancy switch' works only if executed on 'Server 2', whatever Server 2 currently is: process server or standby server. This function - if trigged by a screen button or rema - goes via network to 'Server 2' and is executed there. But if called by a script - then the execution rules for the scripts are overruling the execution place of included functions. Thus, if 'redundancy switch' function is in a script, then the function to execute this script should be configured to execute on as well process server as standby server (both check-boxes):
    Click image for larger version

Name:	X5bnQOvAXZ.png
Views:	4
Size:	56.4 KB
ID:	2884
    This assures that the 'Server 2' will perform the script - so the red. switch function - whatever its net role is. The 'Server 1' will then also execute the script, but not the red. switch function. So, there will be only one switch.

    Alternative solution in your case could be to reset the trigger variable by SYSDRV variable from theme Network: 'Primary Server <-> Standby Server in file alignment'. This BOOL variable becomes 1 when - shortly after servers are switching - the servers are exchanging the files to complete the setup of the new network configuration.

  9. #9
    Join Date
    17.03.2016
    Posts
    62

    Default Re: Issue launching script via REMA instant function

    Quote Originally Posted by ursulak View Post
    I suppose the origin of difficulties are that the zenon function 'redundancy switch' works only if executed on 'Server 2', whatever Server 2 currently is: process server or standby server. This function - if trigged by a screen button or rema - goes via network to 'Server 2' and is executed there. But if called by a script - then the execution rules for the scripts are overruling the execution place of included functions. Thus, if 'redundancy switch' function is in a script, then the function to execute this script should be configured to execute on as well process server as standby server (both check-boxes):





    This assures that the 'Server 2' will perform the script - so the red. switch function - whatever its net role is. The 'Server 1' will then also execute the script, but not the red. switch function. So, there will be only one switch.




    Ursula,

    I tried various configurations for the 'execution' paramater (not sure if I tried ticking both primary and standby at same time though to be fair). I will test to see if that works out of curiosity.


    Quote Originally Posted by ursulak View Post

    Alternative solution in your case could be to reset the trigger variable



    by SYSDRV variable from theme Network: 'Primary Server <->



    Standby Server in file alignment'. This BOOL variable becomes 1 when -



    shortly after servers are switching - the servers are exchanging the



    files to complete the setup of the new network configuration.
    Thanks, that is another way I had not considered.

    Anyway I have it working for now. Many thanks for your assistance

Similar Threads

  1. Function and script
    By utoole in forum Engineering Studio & Service Engine (former zenon Editor & Runtime)
    Replies: 1
    Last Post: 13th December 2019, 09:09
  2. Copy variable value to another in a script
    By EdgyUsername in forum Engineering Studio & Service Engine (former zenon Editor & Runtime)
    Replies: 7
    Last Post: 12th September 2016, 15:32
  3. VBA script on touch screen
    By arpi in forum VBA
    Replies: 2
    Last Post: 14th July 2014, 07:26
  4. Pass parameter value to the script
    By sabbonis in forum VBA
    Replies: 1
    Last Post: 10th March 2014, 02:02
  5. VB script bug on client
    By anemet in forum zenon Network
    Replies: 8
    Last Post: 23rd August 2012, 23:42

Tags for this Thread

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •