In PG2 ,How to use status variable to write a boolean varible in control builder
In PG2 ,How to use status variable to write a boolean varible in control builder?
i need to use network status of the one network card to write variable in CBM.
Voted best answer
1. I'm not clear what did you mean "write a boolean variable in control builder". Variables that visible in PG2 element explorer (control structure) are getting from the OPC (PLC). You must download project into controller prior you see application or program variable(s) in PG2 element explorer.
2. You must know that all PG2 graphic elements are dynamical. They are dymamically created and code executed only if PG2 screen has been called.
That means if graphic display PG2 is not opened somewhere all graphic elements on that display are "not exist". Thus, the value will not be written in the controller without opened PG2 display.
3. If you consider point 2 and still want to use PG2 for writing value using PG2 facilities then the simplest way to do this is to use element hosted input item "Property Writer" or "Property Writer Ex" (since 800xA 5.1 Rev.A).
For instance, right-click on free place of graphic display in PG2 editor, coose "Input Items"->"Element Hosted"->"Create" from context menu and select "Property Writer Ex". You need to write value into PLC each time when status is changed to the desired value, so you need to use "Trigger" property instead or mouse events: specify for "Trigger" condition when it needed to write "1" in PLC.
For example: $'Cross referencing server_Basic_SV51SNODE:S_STATUS' = 2
Now you need specify WriteSpecification property: for example SingleWrite($'ABB_TEST/Applications/Application_1:Srv_State', 1).
Repeat the same for "Property Writer Ex" that will write "0" (in case the status variable has been changed back).
For example: $'Cross referencing server_Basic_SV51SNODE:S_STATUS' != 2
and SingleWrite($'ABB_TEST/Applications/Application_1:Srv_State', 0).
Save and try when the PG2 display is opened in the plant explorer for view.
Then close PG2 display and try again.
Basically you need to
1) Define a variable in CBM,
2) get the property in workplace that you are interested in ( in this case network status) and
3) write the logic to link them both in PG2 graphic editor.
But, you need to remember that the status variables in workplace work only when they are called and do not continously monitor the status. So ensure that the property in workplace is continously active (called) in the system ( you need to keep the display/system status viewer open all the time somehow ).
If keeping the display open all the time is nt possible, is not possible, you can use the status of the network as display tool icon in a workplace so that it keeps active all the time and monitors the property you are interetsed in.