power_loadflow

Perform positive-sequence load flow or unbalanced load flow. Initialize models containing three-phase machines and dynamic load blocks

Syntax

power_loadflow('-v2',sys)
power_loadflow('-v2',sys,'AddBuses')
LF = power_loadflow('-v2',sys)
LF = power_loadflow('-v2',sys,'solve')
LF = power_loadflow('-v2',sys,'noupdate')
LF = power_loadflow('-v2',sys,'solve','report')
LF = power_loadflow('-v2',sys,'solve','report',fname)
LF = power_loadflow('-v2',sys,'solve','ExcelReport',fname)
power_loadflow(sys)
Mparam = power_loadflow(sys)
MI = power_loadflow(sys,Mparam)

Description

The power_loadflow function contains two different tools for performing load flow and initializing three-phase models with machines.

Load Flow Tool

The Load Flow tool uses the Newton-Raphson method to provide a robust and fast convergence solution. It offers most of the functionality of other load flow software available in the power utility industry.

The -v2 option in power_loadflow function syntax allows you to access this tool from the command line.

power_loadflow('-v2',sys) opens a graphical user interface to edit and perform load flow of sys using the Newton Raphson algorithm.

power_loadflow('-v2',sys,'AddBuses') adds Load Flow Bus blocks to the model sys. The added blocks are single-connector Load Flow Bus blocks, which specify bus parameters for a positive-sequence load flow.

LF = power_loadflow('-v2',sys) returns the current load flow parameters of sys.

LF = power_loadflow('-v2',sys,'solve') computes the load flow of sys. The model is initialized with the load flow solution.

LF = power_loadflow('-v2',sys,'noupdate') computes the load flow but does not initialize the model with the load flow solution.

LF = power_loadflow('-v2',sys,'solve','report') computes the load flow and then opens the editor to save the load flow report.

LF = power_loadflow('-v2',sys,'solve','report',fname) computes the load flow and then saves detailed information in fname file.

LF = power_loadflow('-v2',sys,'solve','ExcelReport',fname) computes the load flow and then saves detailed information in the fname Excel® file. This capability is available only for the positive-sequence load flow.

Machine Initialization Tool

The Machine Initialization tool offers simplified load flow features to initialize the machine initial currents of your models.

power_loadflow(sys) opens the Machine Initialization tool dialog box to perform machine initialization.

Mparam = power_loadflow(sys) returns the machine initialization parameter values of sys. Use Mparam as a template variable to perform new machine initialization.

MI = power_loadflow(sys,Mparam) computes the machine initial conditions using the load flow parameters given in Mparam. Create an instance of Mparam using Mparam = power_loadflow(sys), and then edit the initialization parameter values based on this template.

Load Flow Tool GUI

Open this dialog box by entering the power_loadflow('-v2', sys) command, or from the Powergui block dialog box by selecting Load Flow.

Update

Click to get the latest changes in the model. Any previous load flow solution is cleared from the table.

Add bus blocks

Click to add load flow bus blocks to the model. The power_loadflow function determines the load flow bus required for your model and adds load flow bus blocks only in places where there is no load flow bus block already connected.

Compute

Click to solve the load flow. The solution is displayed in the V_LF, Vangle_LF, P_LF, and Q_LF columns of the Load Flow tool table. The load flow is performed at the frequency, base power, PQ tolerance, and max iterations specified in the Preference tab of the Powergui block.

Apply to Model

Click to apply the load flow solution to the model.

Report

Click to save in Excel or MATLAB® format a load flow report showing power flowing toward each bus.

Close

Close the Load Flow tool.

Load Flow Parameters

The Load flow parameters and solution are returned in a structure with the following fields.

FieldDescription
modelThe name of the model.
frequencyThe load flow frequency, in hertz. This value corresponds to the Load flow frequency parameter of the Powergui block.
basePowerThe base power used by the Load Flow tool. This value corresponds to the Base power Pbase parameter of the Powergui block.
toleranceThe tolerance used by the Load Flow tool. This value corresponds to the PQ Tolerance parameter of the Powergui block.
bus[1 x Nbus] structure with fields defining the bus parameters. For a positive-sequence load flow, Nbus is the number of three-phase buses in the model. For an unbalanced load flow, Nbus is the total number of single-phase buses in the model.
sm[1 x Nsm] structure with fields defining the load flow parameters of the Synchronous Machine blocks. Nsm is the number of Synchronous Machine blocks in the model.
asm[1 x Nasm] structure with fields defining the load flow parameters of the Asynchronous Machine blocks. Nasm is the number of Asynchronous Machine blocks in the model.
vsrc[1 x Nsrc] structure with fields defining the load flow parameters of the Three-Phase Source, Three-Phase Programmable Voltage Source, and AC Voltage Source blocks. Nsrc is the number of single-phase and three-phase voltage source blocks in the model.
pqload[1 x Npq] structure with fields defining the load flow parameters of the Three-Phase Dynamic Load blocks. Npq is the number of Three-Phase Dynamic Load blocks in the model.
rlcload[1 x Nrlc] structure with fields defining the load flow parameters of the Three-Phase Parallel RLC Load, Three-Phase Series RLC Load, Parallel RLC Load, and Series RLC Load blocks. Nrlc is the number of three-phase and single-phase blocks in the model.
Ybus1[Nbus x Nbus] positive-sequence complex admittance matrix in pu/Pbase used for positive-sequence load flow solution.
Ybus[Nbus x Nbus] complex admittance matrix in pu/Pbase used for unbalanced load flow solution.
NetworksLists the bus numbers of each independent network.
statusReturns 1 when a solution is found, and -1 when no solution is found.
iterationsThe number of iterations that the solver took to solve the load flow.
errorDisplays an error message when no solution is found.
LoadFlowSolverThe type of load flow solver: 'PositiveSequence' or 'Unbalanced'

Machine Initialization Tool Dialog Box

You can open this dialog box by entering the power_loadflow(sys) command, or from the Powergui block dialog box by selecting Machine Initialization.

Machines info

Displays the names of the Simplified Synchronous Machines, the Synchronous Machines, the Asynchronous Machine, and the Three-Phase Dynamic Load blocks of your model. Select a machine or a load in the list box to set its parameters.

Bus type

If Bus type is set to P&V Generator, you can set the terminal voltage and active power of the machine. If Bus type is set to PQ generator, you can set the active and reactive powers. If Bus type is set to Swing Bus, you can set the terminal voltage, enter an active power guess, and specify the phase of the UAN terminal voltage of the machine.

If you select an Asynchronous Machine block machine, you have to enter only the mechanical power delivered by the machine. If you select a Three-Phase Dynamic Load block, you must specify the active and reactive powers consumed by the load.

Terminal voltage UAB

Specify the terminal line-to-line voltage of the selected machine.

Active power

Specify the active power of the selected machine or load.

Active power guess

Specify an active power guess to start iterations when the specified machine bus type is Swing Bus.

Reactive power

Specify the reactive power of the selected machine or load.

Phase of UAN voltage

This parameter is activated only when the bus type is Swing Bus.

Specify the phase of the phase-to-neutral voltage of phase A of the selected machine.

Mechanical power

In motor mode, specify the mechanical power developed by the squirrel cage induction machine. In generator mode, specify the mechanical power absorbed by the machine as a negative number.

Machine initialization frequency

Specify the frequency to be used in the calculations (normally 60 Hz or 50 Hz).

Initial condition

Normally, you keep the default setting Auto to let the tool automatically adjust the initial conditions before starting iterations. If you select Start from previous solution, the tool starts with initial conditions corresponding to the previous solution. Try this option if the load flow fails to converge after a change has been made to the power and voltage settings of the machines or to the circuit parameters.

Update Machine list

Update the list of machines, voltage and current phasors, as well as the powers, if you have made a change in your model while the Machine Initialization tool is open. The new voltages and powers displayed are computed by using the machine currents obtained from the last computation (the three currents stored in the Initial conditions parameter of the machine blocks).

Compute and Apply

Executes the calculations for the given machine parameters.

Machine Initialization Parameters

The Machine Initialization parameters of a model are organized in a structure with the following fields.

FieldDescription
nameCell array of character vectors, each of which contains the name of a machine block in the model.
typeCell array of character vectors ('Asynchronous Machine', 'Simplified Synchronous Machine', 'Synchronous Machine', 'Three Phase Dynamic Load') defining the mask type of the machine and load blocks.
setStructure with variable fields defining the parameters specific to each machine or dynamic load (Bus Type, Terminal Voltage, Active Power, Reactive Power, Mechanical Power).
LoadFlowFrequencyParameter defining the frequency used by the tool, in hertz. The frequency is specified only in the first element of the Machine Initialization parameters structure.
InitialConditionsCharacter vector that defines the initial condition type ('Auto','Start from previous solution'). The initial condition status is specified only in the first element of the Machine Initialization parameter structure.
DisplayWarningsCharacter vector ('on','off') controlling the display of warning messages during the Machine Initialization computation.

For example, you obtain the initialization parameters for the power_machines example by doing:

Mparam = power_loadflow('power_machines');
Mparam(1)

ans =
                 name: 'SM 3.125 MVA'
                 type: 'Synchronous Machine'
                  set: [1x1 struct]
    LoadFlowFrequency: 60
    InitialConditions: 'Auto'
      DisplayWarnings: 'on'
lfparam(2)
                 name: 'ASM 2250HP'
                 type: 'Asynchronous Machine'
                  set: [1x1 struct]
    LoadFlowFrequency: []
    InitialConditions: []
      DisplayWarnings: []

If you use the Mparam = power_loadflow(sys) command to create the initialization parameters structure, you do not need to edit or modify the name and type fields of lfparam. The set field is where you specify new parameter values, lfparam(1).LoadFlowFrequency is where you define the frequency. lfparam(1).Initialconditions is where you specify the initial conditions status.

If your model does not contain any Asynchronous, Simplified Synchronous, or Synchronous Machine blocks and no Three Phase Dynamic Load block, lfparam returns an empty variable.

Initialization Parameters of Asynchronous Machine Block

For the Asynchronous Machine blocks you can specify only the mechanical power of the machine. The set field is a structure with the following field.

FieldDescription
MechanicalPowerThe mechanical power, in watts, of the machine.

For example, the mechanical power of the Asynchronous Machine in the power_machines example is:

Mparam = power_loadflow('power_machines');
Mparam(2).set

ans = 
    MechanicalPower: 1492000

Initialization Parameters of Synchronous Machine Blocks

For the Simplified Synchronous Machine and Synchronous Machine blocks, the set field is a structure with these fields.

FieldDescription
BusTypeCharacter vector ('P & V generator', 'P & Q generator', 'Swing bus') defining the bus type of the machine.
TerminalVoltageParameter defining the terminal voltage, in volts rms.
ActivePowerParameter defining the active power, in watts.
ReactivePowerParameter defining the reactive power, in vars.
PhaseUanParameter defining the phase voltage, in degrees, of the Uan voltage.

For example, the initialization parameter values of the Synchronous Machine block in the power_machines example are:

Mparam = power_loadflow('power_machines');
Mparam(1).set

ans = 
            BusType: 'P & V generator'
    TerminalVoltage: 2400
        ActivePower: 0
      ReactivePower: 0
           PhaseUan: 0

Initialization Parameters of Three-Phase Dynamic Load Block

For the Three-Phase Dynamic Load block, the set field is a structure with the following fields.

FieldDescription
ActivePowerParameter defining the Active power, in watts.
ReactivePowerParameter defining the reactive power, in vars.

Machine Initialization Results

The results are organized in a structure with the following fields.

FieldDescription
statusStatus returns 1 when a solution is found, and returns 0 when no solution is found. The status is given only in the first element of Machine Initialization structure; it returns an empty value for the other elements.
MachineThe names of the machines or loads.
NominalThe nominal parameters [nominal power, nominal voltage] of the machines or loads.
BusTypeThe bus type of the machines or loads.
UanPhaseThe phase angles, in degrees, of the phase A-to-neutral voltage at machine or load terminals.
Uab,Ubc,UcaThe steady-state, phase-to-phase terminal voltages of the machines or loads. The voltages are returned in a 1-by-3 vector containing the voltage in volts, the voltage in p.u. based on the nominal power of the machine, and the phase in degrees.
Ia,Ib,IcThe steady-state phase currents of the machines or loads. The currents are returned in a 1-by-3 vector representing the current in amperes, the current in p.u. based on the nominal power of the machine, and the phase in degrees.
PThe active power of the machine is returned in a 1-by-2 vector, representing the power in watts and in p.u. based on the nominal power of the machine.
QThe reactive power of the machine is returned in a 1-by-2 vector, representing the power in vars and in p.u. based on the nominal power of the machine.
PmecThe mechanical power of the machine is returned in a 1-by-2 vector, representing the mechanical power in watts and in p.u. based on the nominal parameters of the machine.
TorqueThe mechanical torque of the machine is returned in a 1-by-2 vector, representing the torque in N.m and in p.u. based on the nominal power and speed of the machine.
VfThe computed field voltage of Synchronous Machine blocks. This parameter is set to an empty value for the other types of machines and loads.
SlipThe computed slip of Asynchronous Machine blocks. This parameter is set to an empty value for the other types of machines and loads.

Examples

collapse all

The power_machines example illustrates a rated 2250 HP, 2.4 kV asynchronous motor connected on a 25 kV distribution network. The motor develops a mechanical power of 2000 HP (1.492 MW). You change its mechanical power to −1.0 MW (generator mode) and initialize the machine initial currents to start the simulation in steady state.

In the Command Window, type:

power_machines

The model opens.

Obtain the initialization parameters for the model:

Mparam = power_loadflow('power_machines');
Mparam(2).set
ans = 
    MechanicalPower: 1492000

Change the mechanical power of the asynchronous motor to switch it to generator mode:

Mparam(2).set.MechanicalPower = -1e6;

Initialize the machine initial currents to start the simulation in steady state:

MI = power_loadflow('power_machines',Mparam);

View the Synchronous Machine block parameters:

MI(1)
ans = 
      status: 1
     Machine: 'SM 3.125 MVA'
     Nominal: [3125000 2400]
     BusType: 'P & V generator'
    UanPhase: -30.3047
         Uab: [2.4000e+003 1.0000 -0.3047]
         Ubc: [2.4000e+003 1.0000 -120.3047]
         Uca: [2.4000e+003 1.0000 119.6953]
          Ia: [140.1689 0.1865 -120.3047]
          Ib: [140.1689 0.1865 119.6953]
          Ic: [140.1689 0.1865 -0.3047]
           P: [-5.8208e-011 -1.8626e-017]
           Q: [5.8267e+005 0.1865]
        Pmec: [391.1104 1.2516e-004]
      Torque: [2.0749 1.2516e-004]
          Vf: 1.2909
        Slip: []

The MI(1).status is set to 1, meaning that the function has found a solution for the given parameters.

View the Asynchronous Machine block parameters:

MI(2)
ans = 
      status: []
     Machine: 'ASM 2250HP'
     Nominal: [1678500 2400]
     BusType: 'Asynchronous Machine'
    UanPhase: -30.3047
         Uab: [2.4000e+003 1.0000 -0.3047]
         Ubc: [2.4000e+003 1.0000 -120.3047]
         Uca: [2.4000e+003 1.0000 119.6953]
          Ia: [268.7636 0.6656 177.3268]
          Ib: [268.7636 0.6656 57.3268]
          Ic: [268.7636 0.6656 -62.6732]
           P: [-9.8981e+005 -0.5897]
           Q: [5.1815e+005 0.3087]
        Pmec: [-1000000 -0.5958]
      Torque: [-5.2844e+003 -0.5934]
          Vf: []
        Slip: -0.0039

The mechanical torque reference input for the Asynchronous Machine block is now set to –5284.43 watts and the slip is S = –0.0039, meaning that the machine now behaves as a generator instead of a motor. Run the simulation and verify that it starts in steady state.