This class allows creation and modification of l5x Rung.
XML data is stored in variablename.l5xdata (XMLDocument format).
Example 1:
Creating an empty l5x Rung with default parameters:
const myRung = new kSDKv1.l5xRung();
New Rung is a complete (though empty) l5x Rung that can be modified with methods (see below).
Example 2:
Creating a Rung from custom XML (this will overwrite all default parameters):
const myNewCustomRung = new kSDKv1.l5xRung(`<Rung Number="0" Type="N"><Text><![CDATA[;]]></Text></Rung>`);
It is important to inject XML with the root node name = "Rung". An error is generated if this condition is not satisfied.
METHODS | Click on Methods for further information | ||||
Category | get | set | add | delete | Special |
Position | getPosition() | setPosition() | |||
Logic | getLogic() | setLogic() | |||
Comment | getComment() | setComment() | |||
Files | toText() |
Position |
getPosition() | Parameters | Returns |
Returns a rung position. | NA | Rung position - (number) |
Example
var newRung = new kSDKv1.l5xRung(); newRung.setPosition(5); console.log(newRung.getPosition()); // -> "5"
setPosition(newPosition) | Parameters | Returns |
Sets new rung position. | newPosition – (number) New rung position. | NA |
Example
var newRung = new kSDKv1.l5xRung(); newRung.setPosition(5); console.log(newRung.getPosition()); // -> "5"
Logic |
getLogic() | Parameters | Returns |
Returns a rung logic. | NA | Rung logic - (string) |
Example
var newRung = new kSDKv1.l5xRung(); newRung.setLogic("XIC(tag1)OTE(tag2);"); console.log(newRung.getLogic()); // -> "XIC(tag1)OTE(tag2);"
setLogic(newLogic) | Parameters | Returns |
Sets new rung logic. | newLogic – (string) New rung logic. | NA |
NOTE: It is not necessary to add a semicolon at the end of your logic expression. Kiptr will add it automatically if it is missing.
NOTE: Logic needs to be Neutral Text (not in ASCII text). To get the Neutral Text logic in Studio5000: double click on rung number; select “In Neutral Text”in a dropdown.
Example
var newRung = new kSDKv1.l5xRung(); newRung.setLogic("XIC(tag1)OTE(tag2);"); console.log(newRung.getLogic()); // -> "XIC(tag1)OTE(tag2);"
Comment |
getComment() | Parameters | Returns |
Returns a rung comment. | NA | Rung comment - (string) |
Example
var newRung = new kSDKv1.l5xRung(); newRung.setComment("New rung comment"); console.log(newRung.getComment()); // -> "New rung comment"
setComment(newComment) | Parameters | Returns |
Sets new rung comment. | newComment – (number) New rung comment. | NA |
Example
var newRung = new kSDKv1.l5xRung(); newRung.setComment("New rung comment"); console.log(newRung.getComment()); // -> "New rung comment"