Hi every one,

I am trying to create a PE equation with else if loop. the requirement is as below

if tag1 and tag2 =1 then 1

else if tag1 and tag 2 =0 then 2

else if tag1=1 then 3

else 4

I tried to use sum of the tag values, but it will fail in one case. Could you let me know if this is possible?

Thank you

Hello Shibumon,

Performance Equations are not capable of loops.

But they are capable of the IF Then Else control structure:

The following expression should fullfill your needs:

if 'tag1'=1 And 'tag2' = 1 Then 1 Else if 'tag1'=1 And 'tag2' = 0 Then 2 Else if 'tag1'=1 Then 3 Else 4

Operator

Meaning

Returns

And

Conjunction

The and operator returns 1 if both operands are nonzero; otherwise it returns zero.

Or

Inclusive disjunction

The or operator returns 1 if either operand is nonzero; otherwise it returns zero.

Please also refer to the PE reference manual:

PI Server

Kind regards,

Moritz