×

Newsletter


Netlist and Javascript

2 replies [Last post]
manzur_bd
manzur_bd's picture
Offline
Joined: Jan 1 1970

 

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
e.rutovic's picture
Offline
Joined: Jun 22 2012
Hi Manzur,[1] Can I set

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
Ashhar.Raza
Ashhar.Raza's picture
Offline
Joined: Jan 1 1970
ModelData PI Line

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