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.


METHODSClick on Methods for further information
Category
getsetadddeleteSpecial
Position
getPosition()setPosition()



LogicgetLogic()
setLogic()



Comment
getComment()
setComment()

Files



toText()

Position


getPosition()

ParametersReturns
Returns a rung position.
NARung position - (number)


Example

var newRung = new kSDKv1.l5xRung();
newRung.setPosition(5);
console.log(newRung.getPosition()); // -> "5"



setPosition(newPosition)

ParametersReturns

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()

ParametersReturns

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)

ParametersReturns

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()

ParametersReturns

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)

ParametersReturns

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"