1.4. Disturbance description

The following options change how a pre-defined scenario is described and used. These should be added to a dst file and loaded to the simulation cases through pyramses.case.addDst. For instance:

import pyramses
case = pyramses.cfg()
case.addDst('short_circ.dst')

If you are looking how to put distrubance description in an interactive manner, please check pyramses.sim.Disturb.

time CONTINUE SOLVER disc_meth max_h min_h latency upd_over

Sets the parameters for the simulation.

Parameters
  • time (float (seconds)) – Time of the event

  • disc_meth (str) – Discretization method: TR: Trapezoidal, BE: Backward Euler, BD: BDF2

  • max_h (float (seconds)) – Maximum time-step

  • min_h (float (seconds)) – Minimum time-step

  • latency (float (per-unit)) – Latency tolerance (default: 0.0). Parameters for latency [AFC14].

  • upd_over (str) – Jacobian update override ALL: Update all injectors and network, NET: Update only network, ABL: Update only injectors, IBL: Update all injectors and network, NOT: Do not override

time STOP

Stops the simulation. It needs to be always the last command in a file.

Parameters

time (float (seconds)) – Time of the event

time BREAKER BRANCH name_of_line orig_break extrem_break

Trip a line or transformer.

Parameters
  • time (float (seconds)) – Time of the event

  • name_of_line (str) – Name of line or transformer.

  • orig_break (binary (0/1 for no/yes)) – Trip the origin of the line.

  • extrem_break (binary (0/1 for no/yes)) – Trip the extremity of the line.

time BREAKER SYNC_MACH name_of_synch_mach breaker

Trip a generator.

Parameters
  • time (float (seconds)) – Time of the event

  • name_of_synch_mach (str) – Name of generator.

  • breaker (binary (0/1 for no/yes)) – Trip the generator.

time BREAKER INJ name_of_inj breaker

Trip an injector.

Parameters
  • time (float (seconds)) – Time of the event

  • name_of_inj (str) – Name of injector.

  • breaker (binary (0/1 for no/yes)) – Trip the injector.

time FAULT BUS name_of_bus rfault xfault

Apply 3-phase short-circuit to bus. Applying a fault to a line requires to create a virtual bus splitting the line and apply the fault on that virtual bus.

It has to be followed by the command CLEAR BUS (see below).

Parameters
  • time (float (seconds)) – Time of the event

  • name_of_bus (str) – Name of bus.

  • rfault (float) – Resistance of fault in Ohms. 0 for solid short-circuit.

  • xfault (float) – Reactance of fault in Ohms. 0 for solid short-circuit.

time CLEAR BUS name_of_bus

Clears 3-phase short-circuit to bus. It has to be followed by the command FAULT BUS (see above).

Parameters
  • time (float (seconds)) – Time of the event

  • name_of_bus (str) – Name of bus.

time LFRESV name_of_filename

Export the power flow solution at a specific point in time.

Parameters
  • time (float (seconds)) – Time of the event

  • name_of_filename (str) – Name of output file.

time VFAULT BUS name_of_bus vmag

Apply a voltage-source fault at a bus (forces bus voltage to a fixed magnitude). Must be cleared with CLEAR BUS.

Parameters
  • time (float (seconds)) – Time of the event

  • name_of_bus (str) – Name of bus.

  • vmag (float) – Imposed voltage magnitude, in pu.

time CHGPRM comp_type comp_name param_name value mode

Change a component parameter at a specific time. Can apply a step change or a ramp.

Parameters
  • time (float (seconds)) – Time at which the change is applied.

  • comp_type (str) – Component type: SYNC_MACH, INJ, TWOP, EXC, TOR, or DCTL.

  • comp_name (str) – Name of the component.

  • param_name (str) – Name of the parameter to change.

  • value (float) – New value of the parameter (step change) or increment (ramp).

  • mode (int) – 0 = absolute step change to value; 1 = relative (adds value to current); 2 = ramp.

Example — decrease setpoint of LTC controller by 0.05 pu at t=100 s:

100.0 CHGPRM DCTL 1-1041 Vsetpt -0.05 1 ;
time JAC

Export the system Jacobian matrices in descriptor form at the specified time. Writes four files:

  • jac_val.dat — Non-zero values of E and A matrices

  • jac_eqs.dat — Equation names

  • jac_var.dat — Variable names

  • jac_struc.dat — Sparsity structure

Parameters

time (float (seconds)) – Time at which to export the Jacobian.

Note

Use $OMEGA_REF SYN ; in solver settings when exporting Jacobians for eigenanalysis.

1.4.1. Adding disturbances interactively

Disturbances can also be added programmatically while the simulation is paused using pyramses.sim.addDisturb(). This allows interactive scenario analysis:

import pyramses

case = pyramses.cfg('cmd.txt')
ram = pyramses.sim()
ram.execSim(case, 80.0)

# Add disturbances to be applied at t=100 s
ram.addDisturb(100.0, 'BREAKER SYNC_MACH g7 0')
ram.addDisturb(100.0, 'FAULT BUS 4032 0. 0.')
ram.addDisturb(100.1, 'CLEAR BUS 4032')
ram.addDisturb(100.1, 'BREAKER BRANCH 4032-4044 0 0')
ram.addDisturb(100.0, 'CHGPRM DCTL 1-1041 Vsetpt -0.05 1')

ram.contSim(ram.getInfTime())

The syntax for each disturbance string passed to addDisturb() is identical to the disturbance file format (omitting the leading time field, which is the first argument).