Blog

Using a Script to "Multiplex" Boolean Tags in Siemens Portal

Using a Script to "Multiplex" Boolean Tags in Siemens Portal

After spending some time working with multiplexed tags in Siemens Portal, I found that I was unable to set boolean values through a multiplexed tag. Instead of using a multiplexed tag, a simple script can help achieve the same function. The function of the script is to take the input parameters and set the proper boolean tag based on those parameters.

Example: Controlling Multiple Motors with One Pop-up

In this example, multiple motors need to be controlled from an HMI. Without a script, each motor would need a separate, but identical, motor pop-up to turn on and off the motor. However, with a script, all motors can use the same pop-up, reducing the number of total screens and simplifying future screen updates.

1. Upon selecting a motor from the HMI, an integer (motor index) is set depending on the motor selected.

Motor Index Integer in Siemens Portal

2. On the motor control panel (set up using a pop-up screen), there are two buttons: one to turn the motor on, and one to turn the motor off. 

                                                                     Motor Pop-Up Example in Siemens Portal

3. For each button, call the script (MotorOnOff). In this case, the On button passes in iMotorIndex and bOn = 1. The Off button passes in iMotorIndex and bOn = 0.

Pop-up Event in Siemens Portal

4. Reading the motor index and the button pressed, the script can write to the proper boolean tag.

                         Boolean Tag in Siemens Portal

With this workaround, a tag can be set for each motor without having to use a separate pop-up for each one. It will greatly help keep the total number of screens to a minimum and simplify future updates. 

Learn more about DMC's PLC Programming services.

Comments

There are currently no comments, be the first to post one.

Post a comment

Name (required)

Email (required)

CAPTCHA image
Enter the code shown above:

Related Blog Posts