Dynamic Bus Device

In transient stability simulation, you may want to define a dynamic source or load, where source/load injection current into the network is a function of bus voltage and time

I = f(V, t)

The function could be a set of differential and/or algebraic equations. Dynamic Bus Device will give you a generic way to script such a function. It could be used to model dynamic load including motors, SVC, FACTS or complex generation station dynamics.

In the above figure, a bus object and time t is passed to a generic function f to calculate bus injection current during the transient stability simulation process.


To script a Dynamic Bus Device, you need to implement the ScriptDynamicBusDevice (JavaAPI) interface. You can extend the ScriptDynamicBusDeviceImpl (JavaAPI) class, which provides some default implementations of the interface. Specifically, you need to override the following methods of the interface to tell InterPSS how your device behaves:

    • initStates(DStabBus abus, Network net, IPSSMsgHub msg) - During the initialization, this method will be called by the InterPSS core engine. You should implement your initialization logic here.
    • nextStep(double dt, DynamicSimuMethods method, Network net, IPSSMsgHub msg) - For each simulation step, this method will be called. You should implement your differnetial and algebraic solution to the device equations here.
    • getOutputObject() - InterPSS core engine will ask the device for injection current when solving the network equation. It should reture a Complex number object.
    • getStates(Object refMach) - When output results, InterPSS core engine will call this method for all outputs. You can out any number of state variables, as far as you follow the required format.
    • updateAttributes(boolean netChange) - When there is a network event, such as a fault, you may want to update some of the device states. This method will be called and netChange = true.

Scripting Samples

Load Scripting

In this example, load at a bus (2.0+j1.0) is modeled as Dynamic Bus Device injection current. Half of the load is modeled as a bus Z and the other half is modeled as an injection current.

public class <classname> extends ScriptDynamicBusDeviceImpl {

private Complex z1;

public boolean initStates(DStabBus abus, Network net, IPSSMsgHub msg) {

super.initStates(abus, net, msg);

// the total load on the bus is 2.0+j1.0 pu, half is treated as static load

// the other half is model as a Bus Device

Complex load = new Complex(1.0, 0.5);

Complex cload = load.conjugate();

this.z1 = ComplexFunc.div(abus.getVoltageMag()*abus.getVoltageMag(), cload);


return true;


public boolean nextStep(double dt, DynamicSimuMethods method, Network net, IPSSMsgHub msg) {

// do nothing

return true;


public Object getOutputObject() {

// half of the load is treated as an injection current

Complex i = getDStabBus().getVoltage().divide(this.z1);

return new Complex(-i.getReal(), -i.getImaginary());


public Hashtable getStates(Object refMach) {

DStabBus abus = getDStabBus();

Hashtable<String, Double> hashtable = new java.util.Hashtable<String, Double>();

hashtable.put("Bus Voltage Msg", new Double(abus.getVoltageMag()));

double refAngle = 0.0;

if (refMach != null) {

refAngle = ((Machine)refMach).getAngle();


hashtable.put("Bus Voltage Ang (deg)", new Double((abus.getVoltageAng()-refAngle)*Constants.RtoD));

return hashtable;


public boolean updateAttributes(boolean netChange) {

return true;



Please see the sample - workspace/Scripting/BusScripting-5Bus.ipss for more details. In real life, you may not want to model a constant-Z load in this way. This example is only for illustration purpose.

Machine Scripting

InterPSS has an implementation of IEEE standard machine models. For each machine, you can attach an exciter, a governor and a stabilizer. InterPSS exciter, governor and stabilizer are plugins. You can develop your own controllers. We think this will cover most common use cases.

However, there are situations that the One Bus <-> One Machine <-> One Exciter <-> One Governor <-> One stabilizer model may not be enough to solve certain very complex problem. You may need a generic composite model, as outline in the following diagram:

InterPSS scripting is one possible way to solve the complex problem.

Machine Scripting Examples

You can write you own machine models by scripting. In the InterPSS distribution, there are samples to write custom machine swing equations and Park's equations under the project folder MachineScripting in the Sample Workspace.

    • Sample Project MachScript-5Busw-V1 : A sample project to outline steps to implement a custom machine model.
    • Sample Project MachScript-5Busw-V2 : A sample to show how to custom implementation of machine swing equation.
    • Sample Project MachScript-5Busw-V3 : A sample to show how to custom implementation of machine Eq1 equation.