THE reference for power system transients

Scripting

How to replace a device by another from a library using EMTP JavaScript

Required knowledge:     * How to trigger a script in EMTP * What are DWDevice, DWCircuit, DWSignal, DWPin, etc in EMTP JavaScript? This script replaces a device by another device type defined in a EMTP library (.clf). Applications: changing converter model from detailed to average value model changing control circuit based on

See more

How to connect signals and pins using EMTP JavaScript

Required knowledge:  * How to trigger a script in EMTP * What are DWDevice, DWCircuit, DWSignal, DWPin, etc in EMTP JavaScript? This script connects a device pin to different buses using virtual connection (signal naming) method or wire connection. Applications: changing automatically fault location Apply lightning strike at different locations Automatic circuit

See more

How to change a device name using EMTP JavaScript

Required knowledge: * How to trigger a script in EMTP * What are DWDevice, DWCircuit, DWSignal, DWPin, etc in EMTP JavaScript? * How to get devices in circuit with EMTP JavaScript This script gets a DWDevice from an EMTP DWCircuit and change its attribute Name. //* Description: This script gets

See more

How to get devices in circuit using EMTP JavaScript

Required knowledge: * How to trigger a script in EMTP * What are DWDevice, DWCircuit, DWSignal, DWPin, etc in EMTP JavaScript? This script gets a DWDevice from an EMTP DWCircuit. This script gets DEV1 in the main circuit, then gets all resistances inside the subcircuit of DEV1 //**Get the current (active) DWCircuit object. See Help & Support/4 – JavaScript based Scripting in EMTP/DWCircuit for methods and attributes var cCt = currentCircuit(); //Get all devices of the DWCircuit cCt into an array whose names are DEV1. var DWDevice_DEV1_array = cCt.devices(‘Name’, ‘DEV1’); //See Help & Support/4 – JavaScript based Scripting in EMTP/DWCircuit for more filtering options //DWDevice_DEV1_array is an array with one element, because only one device is named DEV1 in cCt. //Check if DEV1 was found if(DWDevice_DEV1_array==null || DWDevice_DEV1_array.length==0){ alert(‘The searched device does not exist!’); halt();  //Stop the script. See Help & Support/4 – JavaScript based Scripting in EMTP/SPScript } //** Get DEV1 out of DWDevice_DEV1_array var DWDevice_DEV1  = DWDevice_DEV1_array[0]             //DWDevice_DEV1 is the DWDevice of the first element (and only one) of DWDevice_DEV1_array alert(DWDevice_DEV1 + ‘ is defined.’)                   //alert, just for the exercises //** Get DEV1 subcircuit var DWCircuit_DEV1_subCct = DWDevice_DEV1.subCircuit()  //See subCirctuit method in Help & Support/4 – JavaScript based Scripting in EMTP/DWDevice //** Get all resistances in the DWCircuit DWCircuit_DEV1_subCct into an array. //The search is done using the LibType attribute (right click on a DWDevice/Attributes to see all attributes) //LibType is a DWDevice attribute which corresponds to the name appearing in the library (see RLC Branches library). //The libType of resistance is RLC: R var resistanceDevs_array  = DWCircuit_DEV1_subCct.devices(‘LibType’, ‘RLC: R’);     //See Help & Support/4 – JavaScript based Scripting in EMTP/DWCircuit for more filtering options

See more

How to trigger a script in EMTP

From the Script tab Create a new JavaScript document (ctrl + N) Click on run This method is good for small scripts. The EMTP code editor must be used. II. From the Design tab Click on Run a script This method calls script file (.dwj). Any JavaScript code editor can be

See more

How to trigger a script in EMTP

From the Script tab Create a new JavaScript document (ctrl + N) Click on run This method is good for small scripts. The EMTP code editor must be used. II. From the Design tab Click on Run a script This method calls script file (.dwj). Any JavaScript code editor can be

See more
If you can't find an answer, the support team is ready to help!
Follow us