Support Forums
I want to do some conditional calculational ref. to analog tag. After calculating, answer store in other analog tag.

Dear Sir,

I want to do some conditional calculational ref. to analog tag.

After calculating, answer store in other analog tag.

I put a Advantech SCADA TCL: script Example below here: ( I want same like that in VTSCADA )

==================================================

A and B is local Script tag

B_N(0) and B_N(1) Analog SCADA Tag

Bv1 and Bv2 Analog SCADA Tag

if {[GETVAL B_N(0)]==1} then { set A [GETVAL Bv1]
} else { set A 0
}
if {[GETVAL B_N(1)]==1} then { set B [GETVAL Bv2]
} else { set B 0
}
SETVAL sum=[expr $A + $B]

}

please help… in VTCADA Scripting, I want same like that in VTSCADA

can I do it ?

Dear Sir, I want to do some conditional calculational ref. to analog tag. After calculating, answer store in other analog tag. I put a Advantech SCADA TCL: script Example below here: ( I want same like that in VTSCADA ) ================================================== # A and B is local Script tag # B_N(0) and B_N(1) Analog SCADA Tag # Bv1 and Bv2 Analog SCADA Tag if {[GETVAL B_N(0)]==1} then { set A [GETVAL Bv1] } else { set A 0 } if {[GETVAL B_N(1)]==1} then { set B [GETVAL Bv2] } else { set B 0 } SETVAL sum=[expr $A + $B] } ============================================== please help… in VTCADA Scripting, I want same like that in VTSCADA can I do it ?

create analog tags A and B and set each to be a calculation via the tag properties.

The conditional statements are written as ternary operators:

The expression for Tag A would be:

PickValid( [B_N(0)] == 1 ? [Bv1] : 0, 0 )

Note the pickvalid() isn't necessary but ensures that the tag won't get an invalid value.

Do the same for your expression for tag B

Finally, create another tag set to a calculation and set the expression to whatever you need. For example the expression might be:

[A] + [B]
create analog tags A and B and set each to be a calculation via the tag properties. The conditional statements are written as ternary operators: The expression for Tag A would be: ```` PickValid( [B_N(0)] == 1 ? [Bv1] : 0, 0 ) ```` Note the pickvalid() isn't necessary but ensures that the tag won't get an invalid value. Do the same for your expression for tag B Finally, create another tag set to a calculation and set the expression to whatever you need. For example the expression might be: ```` [A] + [B] ````

Trihedral Engineering Ltd.

35
1
2
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft