Actions and transition conditions

In the Action of the step ‘Init’ the variables are initialized, the STATUS of TRAFFICSIGNAL1 should be 1 (green). The state of TRAFFICSIGNAL2 should be 3 (red). The action Init then looks like in the following image:

../_images/efb51bd5cbba7a270a317d3105502cf4

Switch1 changes the sate of TRAFFICSIGNAL1 to 2 (yellow), and that of TRAFFICSIGNAL2 to 4 (yellow-red). In addition, a time delay of 2000 milliseconds is set. The action is now as follows:

../_images/67817e59cbba9ab10a317d313f48ee8d

With Green2 TRAFFICSIGNAL1 is red (STATUS:=3), TRAFFICSIGNAL2 green (STATUS:=1), and the delay time is 5000 milliseconds.

../_images/b5f74117cbbabcc20a317d310628ecbb

At Switch2 the STATUS of TRAFFICSIGNAL1 changes to 4 (yellow-red), that of TRAFFICSIGNAL2 to 2 (yellow). A time delay of 2000 milliseconds is now set.

../_images/cb7a53d7cbbae5e30a317d3176b199f9

With Green1 TRAFFICSIGNAL1 is green (STATUS:=1), TRAFFICSIGNAL2 is red (STATUS:=3), and the time delay is set to5000 milliseconds.

../_images/5520e901cbbb2e670a317d3118805794

The first expansion phase of our program is completed.

If you want to do a first test of POU ABLAUF in simulation mode, perform the following steps:

  1. Open POU PLC_PRG. Each project starts running with PLC_PRG. In order to be able to provisionally start POU ABLAUF, insert a box and replace “AND” by “ABLAUF”. Remain the inputs and outputs unassigned for the moment.

  2. Compile the project via ‘Project’ ‘Build’. In the message window you should get “0 Errors, 0 Warnings”. Now check if option ‘Online’ ‘Simulation’ is activated and use command ‘Online’ ‘Login’ to get into simulation mode. Start program with ‘Online’ ‘Start’. Open POU ABLAUF by a double-click on entry “ABLAUF” in the Object Organizer. The program is started now, but to get it run, variable START must be TRUE. Later this will be set by PLC_PRG but at the moment we have to set it manually within the POU. To do that, perform a double-click on the line in the declaration part, where START is defined (START=FALSE). This will set the option “<:=TRUE>” behind the variable in turquoise color. Now select command ‘Online’ ‘Write values’ to set this value. Thereupon START will be displayed in blue color in the sequence diagram and the processing of the steps will be indicated by a blue mark of the currently active step.

When you have finished this intermediate test use command ‘Online’ ‘Logout’ to leave the simulation mode and to continue programming.