Netlist and Javascript

Submitted by manzur_bd on Wed, 10/31/2012 - 07:26

I am inquiring following questions:

 

 

[1] Can I set simulation options and run the simulation (including setting simulation configuaration) from Javascript in EMTP?

 

[2] Can I link Javascript to Netlist file?

e.rutovic

Hi Manzur,

[1] Can I set simulation options and run the simulation (including setting simulation configuaration) from Javascript in EMTP?
Yes and it is quite easy. Here is a sample code that updates the simulation options :

  cct=currentCircuit();

  parseScriptFile('simoptions/object_creator.dwj');
  parseScriptFile('simoptions/open.dwj');
  parseScriptFile('simoptions/save.dwj');

  //Create Object from current circuit

  oSimoptions = new oDevice_(cct)

  oSimoptions.LoadFlow          = 0;

  oSimoptions.StartFromLoadFlow = 0;

  oSimoptions.steadystate       = 0;

  oSimoptions.timedomain        = 1;

  oSimoptions.fscan             = 0;

  oSimoptions.Dt               = 10;

  oSimoptions.tmax             = 1000;

  oSimoptions.SaveData();

  

You can find more examples here: http://emtp.com/site/file.php?id=59 .

 

[2] Can I link Javascript to Netlist file?

It is possible to run a netlist from a script by calling the method "run_emtp". You can look at the "Parametric" case of the EMTP-RV examples and to the associated documentation (parametric.pdf). 

 

Regards,

Emmanuel

Tue, 11/26/2013 - 16:31 Permalink
Ashhar.Raza

Hello Emanuel,

I am trying to learn how to use javascript to build circuit in emtp. I want to alter the parameters for a pi line 3 -phase. I was able to select the units, and sequence data for R, L and C. However, I am unable to change any values. This is what I am trying to do:

dev1=cct.addDevice(DWLibrary('RLC branches.clf').loadType('PI line 3-phase'),0,0,'s')

dev1.setAttribute('ParamsA','3,1M,1,1ohm,1,1uF,1,0,0,0,0,0,0')

array=SPArray('1 2 \n 3 4 \n 5 6 \n 0 0 0 \n 0 0 0 \n 0 0 0 \n');

dev1.setAttribute('ModelData',array)                          
 

I intend to put the sequence data therefore my array is 'R0 R1 \n L0 L1 \n C0 C1 \n all 0's for initial conditions'

By what i see in the .ecf while when i open the pi line is this: R0=1 R1=2, L0=1 L0=2 C0=1 and C1=1

and Initial condition matrix shown is

1 4 0

2 5 0

3 6 0

 

Can you please point out the mistake in this?

Thanks in advance!

Ashhar

Mon, 06/20/2016 - 22:13 Permalink
X