This class allows creation and modification of l5x Module.
XML data is stored in variablename.l5xdata (XMLDocument format).
Example 1:
Creating an empty l5x Module with default parameters:
const myNewModule = new kSDKv1.l5xModule();
New module is a complete (though empty) l5x module that can be modified with methods (see below). It can not be transformed into an l5x file as Studio5000 software does not allow import/export of modules.
Example 2:
Creating a module from custom XML (this will overwrite all default parameters):
const myNewCustomModule = new kSDKv1.l5xModule( '<Module Name="Kiptr" CatalogNumber="1756-MODULE" Vendor="1" ProductType="0" ProductCode="15" Major="1" Minor="1" ParentModule="Local" ParentModPortId="1" Inhibited="false" MajorFault="false">'+ '<SomeModuleInfo>'+ '</SomeModuleInfo>'+ '</Module>');
It is important to inject XML with the root node “Module”. An error is generated if this condition is not satisfied.
Due to the high number of available modules and the big variety of their properties Kiptr library only supports the following methods to manipulate modules: getName, setName, getRackPosition, setRackPosition and getProperty. You can still modify XML by using standard JS functions. Feel free to contact our tech support team if you have any questions.
METHODS | Click on Methods for further information | ||||
Category | get | set | add | delete | Special |
Name | getName() | setName() | |||
Rack Position | getRackPosition() | setRackPosition() | |||
Property | getProperty() | ||||
Files | toText() |
Name |
getName() | Parameters | Returns |
Returns a module name. | NA | Module name - (string) |
Example
var newModule = new kSDKv1.l5xModule(); newModule.setName("NewModule"); console.log(newModule.getName()); // -> "NewModule"
setName(newName) | Parameters | Returns |
Sets new module name. | newName – (string) New module name. | NA |
Example
var newModule = new kSDKv1.l5xModule(); newModule.setName("NewModule"); console.log(newModule.getName()); // -> "NewModule"
Rack Position |
getRackPosition() | Parameters | Returns |
Returns a module position in a rack. | NA | Module position in a rack - (string) |
Example
var newModule = new kSDKv1.l5xModule(); newModule.setRackPosition("3"); console.log(newModule.getRackPosition()); // -> "3"
setRackPosition(newRackPosition) | Parameters | Returns |
Sets new module position in a rack. | newRackPosition – (string or number) New module position in a rack. Must be a positive number. | NA |
Example
var newModule = new kSDKv1.l5xModule(); newModule.setRackPosition("3"); console.log(newModule.getRackPosition()); // -> "3"
Property |
getProperty(property) | Parameters | Returns |
Returns module’s catalog number. | property – (string) Property of module | Property value - (string) |
Example
var newModule = new kSDKv1.l5xModule(); console.log(newModule.getProperty("CatalogNumber")); // -> "1756-MODULE"