The following examples show ways to use plc-mode to manage the operation modes of your PLCs in scripts:
#Put the PLC in STOP, install a loadable onto it, and put the PLC in RUN
"loadAndRun": plc-mode set stop -t 192.168.1.1 --yes --wait:5 && sld -t 192.168.1.1 -i bin/plcsim && plc-mode set run -t 192.168.1.1 --yes
#Ensure a PLC is in STOP before executing a command which requires a PLC in STOP
"installInterface": plc-mode check stop -t 192.168.1.1 && oscr interface install ./myYaml.yaml -t 192.168.1.1
#Request to RUN 3 PLCs and verify they all reached RUN
"runPlcs": |
plc-mode set run -t:192.168.2.1 --yes
plc-mode set run -t:192.168.2.2 --yes
plc-mode set run -t:192.168.2.3 --yes
(
plc-mode check run -t:192.168.2.1 --wait 5
plc-mode check run -t:192.168.2.2 --wait 5
plc-mode check run -t:192.168.2.3 --wait 5
) || ECHO One or more PLCs did not start
EXIT /B %ERRORLEVEL%