This guide is intended to show users how to:
If you already know of a parameter that has been made, creating an alarm based onthis parameter is fairly straightforward.
Creating a virtual parameter requires knowing mask script OnPing Script Language.
General virtual parameter tutorials can be found here Creating a new virtual parameter.
But there are some additional things to understand when making a Virtual Parameter for alarms.
For your virtual parameter to work correctly, it must be clear on zero. Any value other than zero is considered tripped.
Often this feature is very useful. In the example below, we will combine a comm loss from multiple locations into a single comm loss.
Here is a workflow that is useful for working on virtual parameter scripts.
We are going to build a two-device comm loss script from scratch and illustrate each point.
Here is an overview of the creation page:
All new scripts require at least one Virtual Parameter to be made. This helps prevent bad scripts from being created.
I like to program in a loop which I start by making every script the same.
6. Write this code…
output := 3.0;
Hit the test button.
When you see a success pop up, you know you have made a virtual parameter!
Now, to start editing find the VP you just created in the list and go to it.
Do this so you can hit the refresh button on the browser without it resetting your virtual parameter script.
We are going to write a script that will fail if either of the two inputs fails to return a value.
First, let’s bring inputs in and add a comment for other users.
Comment explaining what is happening…
/* This is multi-device comm fail alarm. It will return a status code indicating that the Nth device is in comm fail. The comm fail table reads as following0 all clear1 more than one device in comm fail2 device one in comm fail3 device two in comm fail ...n device n in comm failWe will code what each device is on display of alarm (HMI status button)*/
Bring in inputs
I like to name my input indexes for future reference.
onPingCommLossTimeIndex := 1;deviceOneIndex := 2;deviceTwoIndex := 3;
I like to hit test after each step in the coding process.
The animation below shows finding and fixing an error.
/* This is multi-device comm fail alarm. It will return a status code indicating that the Nth device is in comm fail.
The comm fail table reads as following
0 all clear
1 more than one device in comm fail
2 device one in comm fail
3 device two in comm fail ...
n device n in comm fail
We will code what each device is on display of alarm (HMI status button)
numberOfCommunicatingDevices := 2;
onPingCommLossTimeIndex := 1;
deviceTwoIndex := 3;
onPingCommLossTime := latestInput(onPingCommLossTimeIndex);
/* Guarded input for onpingCommLoss */
if (isUnit(onPingCommLossTime)) then
onPingCommLossTime := 30.0;
deviceOneAcc := 0;
deviceTwoAcc := 0;
WITH t FROM now - minutes(round(onPingCommLossTime)) TO now EVERY minutes(1) DO
a := input(deviceOneIndex,t);
b := input(deviceTwoIndex,t);
THEN deviceOneAcc := deviceOneAcc + 1;
THEN deviceTwoAcc := deviceTwoAcc + 1;
/* Alarm Preparation Construct
Each device corresponds to an output
0 means all clear!
You can reference these output in an HMI
output := 0;
/* Device two code is 2 */
IF deviceTwoAcc == 0 then
output := 2;
/* Device One Code is 1 */
IF deviceOneAcc == 0 then
output := 1;
There is a lot going on in this code and perhaps in a follow-up post, I will explain it all. However, notice that the indexes needed to be defined are written at the top.
Each should correspond to a real parameter that you want to reference.
If you have any thoughts, ideas, or questions, please feel free to leave a comment below or use the contact feature at www.onping.net
Powered by BetterDocs
PO BOX 851012 Yukon, OK 73085
© 2021 Plow Technologies. All rights reserved.