"Traffic Light" for LTPS

"Traffic Light" for LTPS

About the Application

In this tutorial, we are dealing with the interoperation of Process Control and LTPS, utilizing the Agent. We will use a shrink-wrap Application which implements a traffic light. The Application consists of two programs, a widget, and a model. The basic algorithm is written in SFC. The subprogram that is responsible for the interoperation with the model is written in ST. The model stores the variables of the traffic light which are necessary for the proper operation of the widget's traffic light. Let's modify the Application for the LEDs to toggle as per the traffic light's algorithm.

What you need

Hardware

Onboard Software

Application

Add the following code to "Execute":

The source code:

...
IF name = "green" THEN
    setVariable("users.admin.devices.TPSAgent", "valueS1A", NOT state);
ELSIF name = "yellow" THEN
    setVariable("users.admin.devices.TPSAgent", "valueS3A", NOT state);
ELSIF name = "red" THEN
    setVariable("users.admin.devices.TPSAgent", "valueS5A", NOT state);
END_IF

"Traffic Light" for LTPS