text
stringlengths
1
4.74k
code
stringlengths
69
637k
Load model with voltage dependent P and Q.
within PowerGrids.Electrical.Loads; model LoadPQVoltageDependence "Load model with voltage dependent P and Q" extends PowerGrids.Electrical.BaseClasses.OnePortAC( final portVariablesPu=true, PStart = PRefConst, QStart = QRefConst); extends Icons.Load; parameter Types.PerUnit alpha = 0 "Exponential of voltage ratio for actual P calculation"; parameter Types.PerUnit beta = 0 "Exponential of voltage ratio for actual Q calculation"; parameter Types.ActivePower PRefConst = 0 "Constant active power entering the load at reference voltage"; parameter Types.ReactivePower QRefConst = 0 "Constant reactive power entering the load at reference voltage"; parameter Types.Voltage URef = UNom "Reference value of phase-to-phase voltage"; Types.ActivePower PRef(nominal = SNom) = PRefConst "Active power at reference voltage, the default binding can be changed when instantiating"; Types.ActivePower QRef(nominal = SNom) = QRefConst "Reactive power at reference voltage, the default binding can be changed when instantiating"; Types.PerUnit U_URef(start = UStart/UNom) "Ratio between voltage and reference voltage"; equation U_URef = port.U / URef; port.P = PRef*U_URef^alpha; port.Q = QRef*U_URef^ beta; </code> </p> in which case, the constant reference value PRefConst is ignored. Alternatively, one can use the <a href=\"modelica://PowerGrids.Electrical.Loads.LoadPQVoltageDependenceInputs\">LoadPQVoltageDependenceInputs</a> model that has input connectors for <code>PRef</code> and <code>QRef</code>.<p></p> <p>By default <code>alpha = beta = 0</code> so there is no voltage dependence.</p> </body></html>")); end LoadPQVoltageDependence;
Load model with voltage dependent P and Q specified by inputs.
within PowerGrids.Electrical.Loads; model LoadPQVoltageDependenceInputs "Load model with voltage dependent P and Q specified by inputs" extends LoadPQVoltageDependence( final PRef = PRefIn, final QRef = QRefIn, final PRefConst = 0, final QRefConst = 0, PStart = 0, QStart = 0); Modelica.Blocks.Interfaces.RealInput PRefIn(unit="W", displayUnit="MW") "Active reference power at VPu = 1, W" Modelica.Blocks.Interfaces.RealInput QRefIn(unit="var", displayUnit = "MVA") "Reactive reference power at VPu = 1, var" end LoadPQVoltageDependenceInputs;
Load models
within PowerGrids.Electrical; package Loads "Load models" extends Modelica.Icons.Package; end Loads;
Synchronous machine models
within PowerGrids.Electrical; package Machines "Synchronous machine models" extends Modelica.Icons.Package; end Machines;
Synchronous machine with four windings - external parameters.
within PowerGrids.Electrical.Machines; model SynchronousMachine4Windings "Synchronous machine with four windings - external parameters" // General-purpose start values are provided, to avoid division by zero errors. // These values don't need to be modified for specific machine instancces extends SynchronousMachine4WindingsInternalParameters( final LdPu(fixed = false, min = 1e-3, start = 0.1), final MdPu(fixed = false, min = 1e-3, start = 1), final rfPu(fixed = false, min = 1e-5, start = 0.001), final rDPu(fixed = false, min = 1e-4, start = 0.01), final LfPu(fixed = false, min = 1e-3, start = 0.1), final LDPu(fixed = false, min = 1e-3, start = 0.2), final mrcPu(fixed = false), final LqPu(fixed = false, min = 1e-3, start = 0.1), final MqPu(fixed = false, min = 1e-3, start = 1), final rQ1Pu(fixed = false, min = 1e-5, start = 0.01), final rQ2Pu(fixed = false, min = 1e-5, start = 0.001), final LQ1Pu(fixed = false, min = 1e-3, start = 0.5), final LQ2Pu(fixed = false, min = 1e-3, start = 0.1), final thetaStart = UPhaseStart + atan2(xqPu*IStartPu*cosPhiStart - raPu*IStartPu*sinPhiStart, VStartPu + raPu*IStartPu*cosPhiStart + xqPu*IStartPu*sinPhiStart)); // External parameters parameter Types.PerUnit xlPu "Stator leakage in p.u."; parameter Types.PerUnit xdPu "Direct axis reactance in p.u."; parameter Types.PerUnit xpdPu "Direct axis transient reactance in p.u."; parameter Types.PerUnit xppdPu "Direct axis sub-transient reactance p.u."; parameter Types.Time Tpd0 "Direct axis, open circuit transient time constant"; parameter Types.Time Tppd0 "Direct axis, open circuit sub-transient time constant"; parameter Types.PerUnit xqPu "Quadrature axis reactance in p.u."; parameter Types.PerUnit xpqPu "Quadrature axis transient reactance in p.u."; parameter Types.PerUnit xppqPu "Quadrature axis sub-transient reactance in p.u."; parameter Types.Time Tpq0 "Open circuit quadrature axis transient time constant"; parameter Types.Time Tppq0 "Open circuit quadrature axis sub-transient time constant"; parameter Types.Choices.TimeConstantsApproximation timeConstApprox = PowerGrids.Types.Choices.TimeConstantsApproximation.classicalDefinition "Approximation of time constants for internal parameter computation"; // Auxiliary parameters, direct and quadrature axis // Start values are good enough to achieve convergence for all realistic // values of the constants final parameter Types.PerUnit T1dPu(fixed = false, min = 0, start = 1000); final parameter Types.PerUnit T2dPu(fixed = false, min = 0, start = 100); final parameter Types.PerUnit T3dPu(fixed = false, min = 0, start = 10); final parameter Types.PerUnit T4dPu(fixed = false, min = 0, start = 1000); final parameter Types.PerUnit T5dPu(fixed = false, min = 0, start = 100); final parameter Types.PerUnit T6dPu(fixed = false, min = 0, start = 10); final parameter Types.PerUnit T1qPu(fixed = false, min = 0, start = 1000); final parameter Types.PerUnit T2qPu(fixed = false, min = 0, start = 100); final parameter Types.PerUnit T3qPu(fixed = false, min = 0, start = 10); final parameter Types.PerUnit T4qPu(fixed = false, min = 0, start = 100); final parameter Types.PerUnit T5qPu(fixed = false, min = 0, start = 100); final parameter Types.PerUnit T6qPu(fixed = false, min = 0, start = 10); final parameter Types.Time Tpd(fixed = false, min = 0, start = 10); final parameter Types.Time Tppd(fixed = false, min = 0,start = 0.1); final parameter Types.Time Tpq(fixed = false, min = 0, start = 1); final parameter Types.Time Tppq(fixed = false, min = 0, start = 0.1); // Start values final parameter Types.PerUnit cosPhiStart = abs(PStart)/sqrt(PStart^2+QStart^2+1e-9*SNom) "Start value of power factor cos(phi)"; final parameter Types.PerUnit sinPhiStart = sqrt(1 - cosPhiStart^2) "Start value of sin(phi)"; final parameter Types.PerUnit VStartPu = port.VStart/port.VBase "Start value of voltage modulus in p.u."; final parameter Types.PerUnit IStartPu = port.IStart/port.IBase "Start value of current modulus in p.u."; initial equation // Initial equations to determine the internal parameters as a function // of the external ones // // These equations, found in the Kundur textbook, would allow to compute the external parameters // explicitly, given the internal parameters. The Modelica tool figures out automatically // how to solve them backwards, using symbolic and numerical techniques // Modelling assumption taken by Kundur LqPu = xlPu; LdPu = xlPu; // Direct axis MdPu + LdPu = xdPu; T1dPu = (MdPu + LfPu)/rfPu; T2dPu = (MdPu + LDPu)/rDPu; T3dPu = (LDPu + MdPu * LfPu / (MdPu + LfPu)) / rDPu; T4dPu = (LfPu + MdPu * LdPu / (MdPu + LdPu)) / rfPu; T5dPu = (LDPu + MdPu * LdPu / (MdPu + LdPu)) / rDPu; T6dPu = (LDPu + MdPu * LdPu * LfPu / (MdPu * LdPu + MdPu * LfPu + LdPu * LfPu)) / rDPu; // For the accurate and exact case, the equations are first solved by the Modelica tool // using the approximate values, which are given by the second argument of the // homotopy() operator. Then, the solution to the accurate or exact equations is // computed by a continuation method, whereby the approximated expression is smoothly // transformed into the actual one if timeConstApprox == Types.Choices.TimeConstantsApproximation.classicalDefinition then Tpd0 * omegaBase = T1dPu; Tppd0 * omegaBase = T3dPu; Tpd * omegaBase = T4dPu; Tppd * omegaBase = T6dPu; elseif timeConstApprox == Types.Choices.TimeConstantsApproximation.accurateEstimation then Tpd0 * omegaBase = homotopy(T1dPu + T2dPu, T1dPu); Tppd0 * omegaBase = homotopy(T1dPu*T3dPu/(T1dPu + T2dPu), T3dPu); Tpd * omegaBase = homotopy(T4dPu + T5dPu, T4dPu); Tppd * omegaBase = homotopy(T4dPu*T6dPu/(T4dPu + T5dPu), T6dPu); else Tpd0 * omegaBase = homotopy( Functions.largerTimeConstant(T1dPu + T2dPu, T1dPu*T3dPu), T1dPu); Tppd0 * omegaBase = homotopy(Functions.smallerTimeConstant(T1dPu + T2dPu, T1dPu*T3dPu), T3dPu); Tpd * omegaBase = homotopy( Functions.largerTimeConstant(T4dPu + T5dPu, T4dPu*T6dPu), T4dPu); Tppd * omegaBase = homotopy(Functions.smallerTimeConstant(T4dPu + T5dPu, T4dPu*T6dPu), T6dPu); end if; xpdPu = xdPu *Tpd /Tpd0; xppdPu = xpdPu*Tppd/Tppd0; // Quadrature axis MqPu + LqPu = xqPu; T1qPu = (MqPu + LQ1Pu)/rQ1Pu; T2qPu = (MqPu + LQ2Pu)/rQ2Pu; T3qPu = (LQ2Pu + MqPu * LQ1Pu / (MqPu + LQ1Pu))/ rQ2Pu; T4qPu = (LQ1Pu + MqPu * LqPu / (MqPu + LqPu)) / rQ1Pu; T5qPu = (LQ2Pu + MqPu * LqPu / (MqPu + LqPu)) / rQ2Pu; T6qPu = (LQ2Pu + MqPu * LqPu * LQ1Pu / (MqPu * LqPu + MqPu * LQ1Pu + LqPu * LQ1Pu)) / rQ2Pu; if timeConstApprox == Types.Choices.TimeConstantsApproximation.classicalDefinition then Tpq0 *omegaBase = T1qPu; Tpq *omegaBase = T4qPu; Tppq0*omegaBase = T3qPu; Tppq *omegaBase = T6qPu; elseif timeConstApprox == Types.Choices.TimeConstantsApproximation.accurateEstimation then Tpq0 * omegaBase = homotopy(T1qPu + T2qPu, T1qPu); Tppq0 * omegaBase = homotopy(T1qPu*T3qPu/(T1qPu + T2qPu), T3qPu); Tpq * omegaBase = homotopy(T4qPu + T5qPu, T4qPu); Tppq * omegaBase = homotopy(T4qPu*T6qPu/(T4qPu + T5qPu), T6qPu); else Tpq0 * omegaBase = homotopy( Functions.largerTimeConstant(T1qPu + T2qPu, T1qPu*T3qPu), T1qPu); Tppq0 * omegaBase = homotopy(Functions.smallerTimeConstant(T1qPu + T2qPu, T1qPu*T3qPu), T3qPu); Tpq * omegaBase = homotopy( Functions.largerTimeConstant(T4qPu + T5qPu, T4qPu*T6qPu), T4qPu); Tppq * omegaBase = homotopy(Functions.smallerTimeConstant(T4qPu + T5qPu, T4qPu*T6qPu), T6qPu); end if; xpqPu = xqPu *Tpq /Tpq0; xppqPu = xpqPu*Tppq/Tppq0; mrcPu = 0; end SynchronousMachine4Windings;
Synchronous machine with 4 windings - internal parameters.
within PowerGrids.Electrical.Machines; model SynchronousMachine4WindingsInternalParameters "Synchronous machine with 4 windings - internal parameters" extends BaseClasses.OnePortACdqPU( final generatorConvention = true, localInit = if initOpt == InitializationOption.localSteadyStateFixedPowerFlow then LocalInitializationOption.PV else LocalInitializationOption.none); extends Icons.Machine; import PowerGrids.Types.Choices.InitializationOption; import PowerGrids.Types.Choices.LocalInitializationOption; parameter Types.ActivePower PNom = SNom "Nominal active (turbine) power"; parameter Types.PerUnit raPu "Armature resistance in p.u."; parameter Types.PerUnit LdPu "Direct axis stator leakage in p.u."; parameter Types.PerUnit MdPu "Direct axis mutual inductance in p.u."; parameter Types.PerUnit mrcPu "Canay's mutual inductance in p.u."; parameter Types.PerUnit LDPu "Direct axis damper leakage in p.u."; parameter Types.PerUnit rDPu "Resistance of the direct axis damper in p.u."; parameter Types.PerUnit LfPu "Excitation winding leakage in p.u."; parameter Types.PerUnit rfPu "Resistance of the excitation windings in p.u."; parameter Types.PerUnit LqPu "Quadrature axis stator leakage in p.u."; parameter Types.PerUnit MqPu "Quadrature axis mutual inductance in p.u."; parameter Types.PerUnit LQ1Pu "Quadrature axis 1st damper leakage in p.u."; parameter Types.PerUnit rQ1Pu "Quadrature axis 2nd damper leakage in p.u."; parameter Types.PerUnit LQ2Pu "Leakage of quadrature axis 2nd damper in p.u."; parameter Types.PerUnit rQ2Pu "Resistance of quadrature axis 2nd damper in p.u."; parameter Types.PerUnit DPu = 0 "Damping coefficient of the swing equation in p.u."; parameter Modelica.SIunits.Time H "Kinetic constant = kinetic energy / rated power"; parameter Types.Choices.ExcitationPuType excitationPuType = PowerGrids.Types.Choices.ExcitationPuType.nominalStatorVoltageNoLoad "Choice of excitation base voltage"; parameter Boolean neglectTransformerTerms = true "Neglect the transformer terms in the Park equations"; parameter Boolean referenceGenerator = false "True if reference generator in an isolated synchronous system"; parameter Types.Choices.InitializationOption initOpt = systemPowerGrids.initOpt "Initialization option"; final parameter SI.AngularVelocity omegaBase = systemPowerGrids.omegaNom "Base angular frequency value"; final parameter Types.PerUnit kuf(fixed = false) "Scaling factor for excitation p.u. voltage"; constant Types.PerUnit omegaNomPu = 1 "Nominal frequency in p.u."; final parameter Types.PerUnit lambdadPuStart(fixed = false) "Start value of lambdadPu"; final parameter Types.PerUnit lambdaqPuStart(fixed = false) "Start value of lambdaqPu"; final parameter Types.PerUnit ufPuStart(fixed = false) "Start value of exciter voltage in p.u. (Kundur base)"; final parameter Types.PerUnit ufPuInStart(fixed = false) "Start value of input exciter voltage in p.u. (user-selcted base"; final parameter Types.PerUnit ifPuStart(fixed = false) "Start value of ifPu"; // Input variables Modelica.Blocks.Interfaces.RealInput PmPu(unit = "1") "Input mechanical power in p.u. (base PNom)" Modelica.Blocks.Interfaces.RealInput ufPuIn(unit = "1", start = ufPuInStart) "Input voltage of exciter winding in p.u. (user-selected base voltage)" // Output variables Modelica.Blocks.Interfaces.RealOutput omega(unit = "rad/s") "Angular frequency in rad/s for system object" // Other per-unit variables Modelica.Blocks.Interfaces.RealOutput omegaPu(start = 1) "Angular frequency in p.u." Types.PerUnit iDPu(start = 0) "Current of direct axis damper in p.u"; Types.PerUnit ifPu(start = ifPuStart) "Current of excitation winding in p.u."; Types.PerUnit iQ1Pu(start = 0) "Current of quadrature axis 1st damper in p.u."; Types.PerUnit iQ2Pu(start = 0) "Current of quadrature axis 2nd damper in p.u."; Types.PerUnit ufPu(start = ufPuStart) "Voltage of exciter winding in p.u. (base voltage as per Kundur)"; Types.PerUnit lambdadPu(start = lambdadPuStart) "Flux of direct axis in p.u."; Types.PerUnit lambdaqPu(start = lambdaqPuStart) "Flux of quadrature axis in p.u."; Types.PerUnit lambdaDPu "Flux of direct axis damper in p.u"; Types.PerUnit lambdafPu "Flux of excitation winding in p.u."; Types.PerUnit lambdaQ1Pu "Flux of quadrature axis 1st damper in p.u."; Types.PerUnit lambdaQ2Pu "Flux of quadrature axis 1st damper in p.u."; Types.PerUnit omegaRefPu = systemPowerGrids.omegaRef/systemPowerGrids.omegaNom "Reference frequency in p.u."; Types.PerUnit CmPu(start = -PStart/SNom) "Mechanical torque in p.u. (base PNom/omegaBase)"; Types.PerUnit CePu(start = -PStart/SNom) "Electrical torque in p.u. (base SNom/omegaBase)"; Types.PerUnit PePu(start = -PStart/SNom) "Electrical power in p.u. (base SNom)"; Types.PerUnit PePuPNom = PePu*SNom/PNom "Electrical active power in p.u. (base PNom)"; // SI-unit variables Types.Frequency f = systemPowerGrids.fNom*omegaPu "Frequency of rotation of d-q axes"; Modelica.Blocks.Interfaces.RealOutput VPu "Port voltage magnitude [pu]" Modelica.Blocks.Interfaces.RealOutput PPu "Active Power Production [pu base PNom]" initial equation // Scaling factor for excitation p.u. voltage if excitationPuType == Types.Choices.ExcitationPuType.Kundur then kuf = 1 "Choice of per-unit as per Kundur textbook"; else kuf = rfPu / MdPu "Base voltage gives 1 p.u. air-gap stator voltage at no load"; end if; // Equations to compute start values // these equations are the same that involve the actual variables in the equation section // except that they involve the start values instead, and they do not contain terms which // are zero at steady state (e.g., all the damping winding currents) // the Modelica tool figures out automatically how to solve them for the unknown parameters udPuStart = raPu*idPuStart - omegaNomPu*lambdaqPuStart; uqPuStart = raPu*iqPuStart + omegaNomPu*lambdadPuStart; lambdadPuStart = (MdPu + LdPu)*idPuStart + MdPu*ifPuStart; ufPuStart = rfPu*ifPuStart; ufPuInStart = ufPuStart/kuf; // Equations to determine the initial state values if initOpt == InitializationOption.noInit then // No initial equations else omegaPu = omegaNomPu; der(omegaPu) = 0; if not neglectTransformerTerms then der(lambdadPu) = 0; der(lambdaqPu) = 0; end if; der(lambdafPu) = 0; der(lambdaDPu) = 0; der(lambdaQ1Pu) = 0; der(lambdaQ2Pu) = 0; end if; equation // Flux linkages lambdadPu = (MdPu + LdPu) * idPu + MdPu * ifPu + MdPu * iDPu; lambdafPu = MdPu *idPu + (MdPu + LfPu + mrcPu)*ifPu + (MdPu + mrcPu) *iDPu; lambdaDPu = MdPu *idPu + (MdPu + mrcPu) *ifPu + (MdPu + LDPu + mrcPu)*iDPu; lambdaqPu = (MqPu + LqPu) *iqPu + MqPu *iQ1Pu + MqPu *iQ2Pu; lambdaQ1Pu = MqPu *iqPu + (MqPu + LQ1Pu ) *iQ1Pu + MqPu *iQ2Pu; lambdaQ2Pu = MqPu *iqPu + MqPu *iQ1Pu + (MqPu + LQ2Pu) *iQ2Pu; // Equivalent circuit equations in Park's coordinates if neglectTransformerTerms then udPu = raPu * idPu - omegaPu * lambdaqPu; uqPu = raPu * iqPu + omegaPu * lambdadPu; else udPu = raPu * idPu - omegaPu * lambdaqPu + der(lambdadPu) / omegaBase; uqPu = raPu * iqPu + omegaPu * lambdadPu + der(lambdaqPu) / omegaBase; end if; ufPu = rfPu *ifPu + der(lambdafPu)/omegaBase; 0 = rDPu *iDPu + der(lambdaDPu)/omegaBase; 0 = rQ1Pu*iQ1Pu + der(lambdaQ1Pu)/omegaBase; 0 = rQ2Pu*iQ2Pu + der(lambdaQ2Pu)/omegaBase; // Mechanical equations der(theta) = (omegaPu - omegaRefPu) * omegaBase; 2*H*der(omegaPu) = (CmPu*PNom/SNom - CePu) - DPu*(omegaPu - omegaRefPu); CePu = lambdaqPu*idPu - lambdadPu*iqPu; PePu = CePu*omegaPu; PmPu = CmPu*omegaPu; omega = omegaPu*omegaBase; // Excitation voltage p.u. conversion ufPu = ufPuIn * kuf; // Output signal equations VPu = port.VPu; PPu = -port.P/PNom; end SynchronousMachine4WindingsInternalParameters;
Components for power flow calculations
within PowerGrids.Electrical; package PowerFlow "Components for power flow calculations" extends Modelica.Icons.Package; end PowerFlow;
PQ bus.
within PowerGrids.Electrical.PowerFlow; model PQBus "PQ bus" extends BaseClasses.OnePortAC(portVariablesPhases = true); extends Icons.Load; parameter Types.ActivePower P = SNom "Active power entering the bus"; parameter Types.ReactivePower Q = 0 "Reactive power entering the bus"; equation port.P = P; port.Q = Q; end PQBus;
PV bus.
within PowerGrids.Electrical.PowerFlow; model PVBus "PV bus" extends BaseClasses.OnePortAC(portVariablesPhases = true); extends Icons.Machine; parameter Types.ActivePower P = SNom "Active power entering the bus"; parameter Types.Voltage U = UNom "Absolute value of phase-to-phase voltage"; equation port.P = P; port.U = U; end PVBus;
Slack Bus.
within PowerGrids.Electrical.PowerFlow; model SlackBus "Slack Bus" extends BaseClasses.OnePortAC; extends Icons.Bus; parameter Types.Voltage U = UNom "Voltage magnitude, phase-to-phase"; parameter Types.Angle theta = 0 "Phase of voltage phasor"; equation port.u = CM.fromPolar(U, theta) "Voltage of ideal generator, phase-to-ground"; end SlackBus;
Load with constant impedance.
within PowerGrids.Electrical.PowerFlow; model ZLoad "Load with constant impedance" extends BaseClasses.OnePortAC; extends Icons.Load; parameter Types.ActivePower PNom = SNom "Nominal active power"; parameter Types.ActivePower QNom = 0 "Nominal reactive power"; parameter Types.ComplexImpedance Z = UNom^2/Complex(PNom, -QNom) "Constant impedance of the load"; equation port.v = Z*port.i; end ZLoad;
<html><head></head><body>Simple test case with one slack bus connected to a PQ bus.</body></html>.
within PowerGrids.Electrical.PowerFlow.Test; model OneSlackOneLoad extends Modelica.Icons.Example; inner PowerGrids.Electrical.System systemPowerGrids PowerGrids.Electrical.PowerFlow.SlackBus slack(SNom = 1e+08, UNom = 400000) PowerGrids.Electrical.PowerFlow.PQBus load(P = 3e+07, Q = 0, SNom = 3e+07, UNom = 400000) equation connect(load.terminal, slack.terminal)end OneSlackOneLoad;
<html><head></head><body>Simple test case with one slack bus and one PQ bus connected through a <a href=\.
within PowerGrids.Electrical.PowerFlow.Test; model OneSlackOneLoadWithOneLine extends Modelica.Icons.Example; inner PowerGrids.Electrical.System systemPowerGrids PowerGrids.Electrical.PowerFlow.SlackBus slack(SNom = 1e+08, UNom = 400000) PowerGrids.Electrical.PowerFlow.PQBus load(P = 3e+07, Q = 0, SNom = 3e+07, UNom = 400000) PowerGrids.Electrical.Branches.LineConstantImpedance line(R = 200, SNom = 3e+07, UNom = 400000, X = 2000) equation connect(line.terminalB, load.terminal) connect(line.terminalA, slack.terminal)end OneSlackOneLoadWithOneLine;
<html><head></head><body>Simple test case, similar to <a href=\.
within PowerGrids.Electrical.PowerFlow.Test; model OneSlackOnePVWithOneLine extends Modelica.Icons.Example; inner PowerGrids.Electrical.System systemPowerGrids PowerGrids.Electrical.PowerFlow.SlackBus slack(SNom = 1e+08, UNom = 400000) PowerGrids.Electrical.Branches.LineConstantImpedance line(R = 200, SNom = 3e+07, UNom = 400000, X = 2000) PowerGrids.Electrical.PowerFlow.PVBus node1(P = 3e+07, SNom = 3e+07, UNom = 400000) equation connect(line.terminalB, node1.terminal) connect(slack.terminal, line.terminalA) end OneSlackOnePVWithOneLine;
<html><head></head><body>Simple test system with one slack node and one <a href=\.
within PowerGrids.Electrical.PowerFlow.Test; model OneSlackOneZLoad extends Modelica.Icons.Example; inner PowerGrids.Electrical.System systemPowerGrids PowerGrids.Electrical.PowerFlow.SlackBus slack(SNom = 1e+08, UNom = 400000) PowerGrids.Electrical.PowerFlow.ZLoad load(PNom = 2e+07, QNom = 1e+07, SNom = 3e+07, UNom = 400000) equation connect(load.terminal, slack.terminal)end OneSlackOneZLoad;
<html><head></head><body>Small system with a few PQ buses, one PV bus and one slack bus connected through constant impedant lines.</body></html>.
within PowerGrids.Electrical.PowerFlow.Test; model SmallSystem extends Modelica.Icons.Example; inner PowerGrids.Electrical.System systemPowerGrids PowerGrids.Electrical.PowerFlow.PVBus bus2(P = -1e+08,SNom = 1e+08, UNom = 400000, portVariablesPu = true) PowerGrids.Electrical.Branches.LineConstantImpedance line1(R = 100, SNom = 1e+08, UNom = 400000, X = 1000, portVariablesPu = true) PowerGrids.Electrical.Branches.LineConstantImpedance line2(R = 100, SNom = 1e+08, UNom = 400000, X = 1000, portVariablesPu = true) PowerGrids.Electrical.Branches.LineConstantImpedance line3(R = 100, SNom = 1e+08, UNom = 400000, X = 1000, portVariablesPu = true) PowerGrids.Electrical.PowerFlow.PQBus load1(P = 3e+07, SNom = 3e+07, UNom = 400000, portVariablesPu = true) PowerGrids.Electrical.PowerFlow.PQBus load2(P = 2e+07, SNom = 4e+07, UNom = 400000, portVariablesPu = true) PowerGrids.Electrical.PowerFlow.PQBus load3(P = 2e+07, SNom = 2e+07, UNom = 400000, portVariablesPu = true) PowerGrids.Electrical.PowerFlow.PQBus load4(P = 3e+07, SNom = 3e+07, UNom = 400000, portVariablesPu = true) PowerGrids.Electrical.PowerFlow.SlackBus slack(SNom = 1e+08, UNom = 400000, portVariablesPu = true) Buses.Bus bus(SNom = 2e+07, UNom = 400000) equation connect(load1.terminal, line1.terminalA) connect(line3.terminalB, load4.terminal) connect(line2.terminalB, load2.terminal) connect(load1.terminal, slack.terminal) connect(line2.terminalB, bus2.terminal) connect(line1.terminalB, bus.terminal) connect(line2.terminalA, bus.terminal) connect(line3.terminalA, bus.terminal) connect(load3.terminal, bus.terminal)end SmallSystem;
info
within PowerGrids.Electrical.Test; package Info extends Modelica.Icons.Info; end Info;
Test case for LoadImpedancePQ.
within PowerGrids.Electrical.Test; model LoadImpedancePQ "Test case for LoadImpedancePQ" extends Modelica.Icons.Example; inner System systemPowerGrids PowerGrids.Electrical.Loads.LoadImpedancePQ load1(PRef = 8e+07, PRefConst = 40e6, QRef = 4e+07, QRefConst = 20e6, SNom = 1e+08, UNom = 380000, URef = 400000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Loads.LoadImpedancePQ load2(PRef = 8e+07 + (if time >= 1 then 1e7 else 0), PRefConst = 4e+07, QRef = 4e+7 + (if time >= 2 then 5e6 else 0), QRefConst = 2e+07, SNom = 1e+08, UNom = 380000, URef = 400000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Loads.LoadImpedancePQInputs load3(SNom = 5e+08, UNom = 380000, URef = 400000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Buses.InfiniteBus infiniteBus1(SNom = 1e+08, UNom = 380000, URef = 400000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Buses.InfiniteBus infiniteBus2(SNom = 1e+08, UNom = 380000, URef = 400000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Buses.InfiniteBus infiniteBus3(SNom = 1e+08, UNom = 380000, URef = 400000, portVariablesPhases = true, portVariablesPu = true) Modelica.Blocks.Sources.Step PRef(height = 10e6, offset = 80e6, startTime = 1) Modelica.Blocks.Sources.Step QRef(height = 10e6, offset = 40e6, startTime = 2) equation connect(QRef.y, load3.QRefIn) connect(PRef.y, load3.PRefIn) connect(infiniteBus3.terminal, load3.terminal) connect(infiniteBus2.terminal, load2.terminal) connect(infiniteBus1.terminal, load1.terminal) end LoadImpedancePQ;
<html> <p>This model is similar to <a href=\.
within PowerGrids.Electrical.Test; model OneBusImpedanceOneLoad extends OneBusOneLoad(infiniteBus.R = 0.3, infiniteBus.X = 1.5, infiniteBus.portVariablesPhases = true, infiniteBus.portVariablesPu = true, infiniteBus.generatorConvention = true); end OneBusImpedanceOneLoad;
<html><head></head><body><p>This model demonstrates both ways of implementing a time-varying load.</p> The model is similar to <a href=\.
within PowerGrids.Electrical.Test; model OneBusImpedanceOneVariableLoad extends Modelica.Icons.Example; PowerGrids.Electrical.Buses.InfiniteBus bus1(PStart = -1e+07,R = 0.04,SNom = 1e+08, UNom = 10000, X = 0.4, generatorConvention = true, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Loads.LoadPQVoltageDependence load1( PRef = if time < 1 then 10e6 else 20e6, PStart = 1e+07, QRef = if time < 2 then 0 else 30e6, QStart = 0, SNom = 1e+08, UNom = 10000, portVariablesPhases = true) inner System systemPowerGrids PowerGrids.Electrical.Buses.InfiniteBus bus2(PStart = -1e+07,R = 0.04, SNom = 1e+08, UNom = 10000, X = 0.4, generatorConvention = true, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Loads.LoadPQVoltageDependenceInputs load2(PStart = 1e+07, SNom = 1e+08, UNom = 10000, portVariablesPhases = true) Modelica.Blocks.Sources.Step PSignal(height = 10e6, offset = 10e6, startTime = 1) Modelica.Blocks.Sources.Step QSignal(height = 30e6, startTime = 2) equation connect(PSignal.y, load2.PRefIn) connect(QSignal.y, load2.QRefIn) connect(bus2.terminal, load2.terminal) connect(bus1.terminal, load1.terminal) end OneBusImpedanceOneVariableLoad;
<html><head></head><body><p>This model demonstrates the usage of a variable-voltage infinite bus.</p> <p>The model is similar to <a href=\.
within PowerGrids.Electrical.Test; model OneBusImpedanceVariableVoltageOneLoad extends Modelica.Icons.Example; PowerGrids.Electrical.Buses.InfiniteBusVariableVoltage bus1(PStart = -1e+07, R = 0.04, SNom = 1e+08, UNom = 10000, X = 0.4, generatorConvention = true, portVariablesPhases = true, portVariablesPu = true, useThetaIn = true, useUIn = true) PowerGrids.Electrical.Loads.LoadPQVoltageDependence load1(PRefConst = 1e+07,PStart = 1e+07, QRefConst = 0, QStart = 0, SNom = 1e+08, UNom = 10000, portVariablesPhases = true) inner System systemPowerGrids Modelica.Blocks.Sources.Step UMod(height = -2e3, offset = 10e3, startTime = 1) Modelica.Blocks.Sources.Step UPhase(height = 30 / 180 * Modelica.Constants.pi, startTime = 2) equation connect(UPhase.y, bus1.thetaIn) connect(UMod.y, bus1.UIn) connect(bus1.terminal, load1.terminal) end OneBusImpedanceVariableVoltageOneLoad;
<html> <p>An infinite bus with zero impedance, U_abs = 10 kV, theta = 30 deg, is connected to a PQ load with P = 10 MW and Q = 0 MW.</p> <p>As the nominal power is set to 10 MW and the nominal voltage to 10 kV on both components, all p.u. absolute values are one. Since the load is purely resistive, all phasors are rotated by 30 deg.</p> <p>For simplicity, the Start values are set assuming theta = 0; the nonlinear solver is able to converge on the correct solution from this initial guess.</p> <p>This model demonstrates the correct behaviour of the <a href=\.
within PowerGrids.Electrical.Test; model OneBusOneLoad extends Modelica.Icons.Example; PowerGrids.Electrical.Buses.InfiniteBus infiniteBus(SNom = 1e+07, UNom = 10000, portVariablesPu = true, theta = 0.523599) PowerGrids.Electrical.Loads.LoadPQVoltageDependence loadPQ(PRefConst = 1e+07, QRefConst = 0, SNom = 1e+07, UNom = 10000, portVariablesPhases = true) inner PowerGrids.Electrical.System systemPowerGrids equation connect(infiniteBus.terminal, loadPQ.terminal) end OneBusOneLoad;
<html><head></head><body><p>Same behaviour as <a href=\.
within PowerGrids.Electrical.Test; model OneBusTransmissionLineOneLoad extends Modelica.Icons.Example; PowerGrids.Electrical.Buses.InfiniteBus infiniteBus(SNom = 1e+07, UNom = 10000, portVariablesPu = true, theta = 0.523599) PowerGrids.Electrical.Loads.LoadPQVoltageDependence loadPQ(PRefConst = 1e+07, QRefConst = 0, SNom = 1e+07, UNom = 10000, alpha = 0, beta = 0, portVariablesPhases = true) inner PowerGrids.Electrical.System systemPowerGrids PowerGrids.Electrical.Branches.LineConstantImpedance transmissionLine(R = 0.3, SNom = 1e+07, UNom = 10000, X = 1.5, portVariablesPu = true) equation connect(infiniteBus.terminal, transmissionLine.terminalA) connect(transmissionLine.terminalB, loadPQ.terminal) end OneBusTransmissionLineOneLoad;
<html><head></head><body><p>This model is similar to<a href=\.
within PowerGrids.Electrical.Test; model OneBusTransmissionLineShuntOneLoad extends OneBusTransmissionLineOneLoad(transmissionLine.B = 0.02, transmissionLine.G = 0.01, transmissionLine.portVariablesPu = true); end OneBusTransmissionLineShuntOneLoad;
Component test models
within PowerGrids.Electrical; package Test "Component test models" extends Modelica.Icons.ExamplesPackage; end Test;
<html><head></head><body><p>Test case for the conversion of external parameter to internal parameters taken from Kundur, Power System Stability and Control, example 4.1. Note that the system frequency for this example is 60 Hz.</p> <p>The machine is directly connected to an ideal bus with UNom = 24 kV and phase = 0 and initialized in steady-state with PmPu = 0.9, ufPu = 0.000939, using the Kundur base excitation voltage.</p> <table> <tbody><tr> <th>Parameter</th><th>Meaning</th><th>Value</th><th>Unit</th></tr> <tr> <td>SNom</td><td>Rated power</td><td>550</td><td>MVA</td></tr> <tr> <td>UNom</td><td>Rated phase-to-phase voltage</td><td>24</td><td>kV</td></tr> <tr> <td>xlPu</td><td>Stator Leakage</td><td>0.15</td><td>pu</td></tr> <tr> <td>xdPu</td><td>Direct axis reactance</td><td>1.81</td><td>pu</td></tr> <tr> <td>xpdPu</td><td>Direct axis transient reactance</td><td>0.3</td><td>pu</td></tr> <tr> <td>xppdPu</td><td>Direct axis sub-transient reactance</td><td>0.23</td><td>pu</td></tr> <tr> <td>Tpd0</td><td>Direct axis open circuit transient time constant</td><td>8</td><td>s</td></tr> <tr> <td>Tppd0</td><td>Direct axis open circuit sub-transient time constant</td><td>0.03</td><td>s</td></tr> <tr> <td>xqPu</td><td>Quadrature axis reactance</td><td>1.76</td><td>pu</td></tr> <tr> <td>xpqPu</td><td>Quadrature axis transient reactance</td><td>0.65</td><td>pu</td></tr> <tr> <td>xppqPu</td><td>Quadrature axis sub-transient reactance</td><td>0.25</td><td>pu</td></tr> <tr> <td>Tpq0</td><td>Quadrature axis open circuit transient time constant</td><td>1</td><td>s</td></tr> <tr> <td>Tppq0</td><td>Quadrature axis open circuit sub-transient time constant</td><td>0.07</td><td>s</td></tr> <tr> <td>raPu</td><td>Armature resistance</td><td>0.003</td><td>pu</td></tr> <tr> <td>mrcPu</td><td>Canay's mutual inductance</td><td>0</td><td>pu</td></tr> </tbody></table> <p>The following internal parameter values are reported from Kundur and match the ones computed by the model with timeConstantApproximation=classicalDefinitions.</p> <table> <tbody><tr> <th>PowerGrids</th><th>Kundur</th><th>Meaning</th><th>Value</th><th>Unit</th></tr> <tr><td>LdPu</td><td>Ll</td><td>Direct axis stator leakage</td><td>0.15</td><td>pu</td></tr> <tr> <td>MdPu</td><td>Lad</td><td>Direct axis mutual inductance</td><td>1.66</td><td>pu</td></tr> <tr> <td>LDPu</td><td>L1d</td><td>Direct axis damper leakage</td><td>0.1713</td><td>pu</td></tr> <tr> <td>rDPu</td><td>R1d</td><td>Direct axis damper resistance</td><td>0.0284</td><td>pu</td></tr> <tr> <td>LfPu</td><td>Lfd</td><td>Excitation winding leakage</td><td>0.165</td><td>pu</td></tr> <tr> <td>rfPu</td><td>Rfd</td><td>Excitation windings resistance</td><td>0.000605</td><td>pu</td></tr> <tr> <td>LqPu</td><td>Ll</td><td>Quadrature axis stator leakage </td><td>0.15</td><td>pu</td></tr> <tr> <td>MqPu</td><td>Laq</td><td>Quadrature axis mutual inductance</td><td>1.61</td><td>pu</td></tr> <tr> <td>LQ1Pu</td><td>L1q</td><td>Quadrature axis 1st damper leakage</td><td>0.7252</td><td>pu</td></tr> <tr> <td>rQ1Pu</td><td>R1q</td><td>Quadrature axis 1st damper resistance</td><td>0.0062</td><td>pu</td></tr> <tr> <td>LQ2Pu</td><td>L2q</td><td>Quadrature axis 2nd damper leakage</td><td>0.125</td><td>pu</td></tr> <tr> <td>rQ2Pu</td><td>R2q</td><td>Quadrature axis 2nd damper resistance</td><td>0.02368</td><td>pu</td></tr> </tbody></table> <p>The following table reports the steady-state solution computed by Kundur in Example 3.2 and by the PowerGrids model. Note that the Kundur example unfortunately includes a the effect of an 83.5% magnetic saturation, which is not accounted for in the PowerGrids model, so the two sets of values do not match exactly, particularly as regards the reactive power and the quadrature current. However, the difference is compatible with the effect of the reduced inductances. Also note that the sign convention for id, iq is opposite to Kundur's.</p> <table> <tbody><tr> <th>Variable</th><th>Name</th><th>Value Kundur</th><th>Value PowerGrids</th><th>Unit</th></tr> <tr> <td>PGenPu</td><td>Generated active power</td><td>0.9</td><td>0.89667</td><td>pu</td></tr> <tr> <td>QGenPu</td><td>Generated reactive power</td><td>0.436</td><td>0.55206</td><td>pu</td></tr> <tr> <td>theta</td><td>Machine angle</td><td>39.1</td><td>38.61</td><td>deg</td></tr> <tr> <td>udPu</td><td>Direct axis voltage</td><td>0.631</td><td>0.6240</td><td>pu</td></tr> <tr> <td>uqPu</td><td>Quadrature axis voltage</td><td>0.776</td><td>0.7814</td><td>pu</td></tr> <tr> <td>idPu</td><td>Direct axis current</td><td>0.906</td><td>-0.9909</td><td>pu</td></tr> <tr> <td>iqPu</td><td>Quadrature axis current</td><td>0.423</td><td>-0.3562</td><td>pu</td></tr> </tbody></table> <p></p> </body></html>.
within PowerGrids.Electrical.Test; model SynchronousMachine4Windings extends Modelica.Icons.Example; PowerGrids.Electrical.Buses.InfiniteBus bus(SNom = 5.5e+08, UNom = 24000, UStart = 24000, X = 0, portVariablesPhases = true, portVariablesPu = true, theta = 0) PowerGrids.Electrical.Machines.SynchronousMachine4Windings machine(H = 6, PStart = -5.52e+08, QStart = -2.52e+08, SNom = 5.5e+08, Tpd0 = 8, Tppd0 = 0.03, Tppq0 = 0.07, Tpq0 = 1, UNom = 24000, UStart = 24000, excitationPuType = PowerGrids.Types.Choices.ExcitationPuType.Kundur, portVariablesPhases = true, raPu = 0.003, timeConstApprox = PowerGrids.Types.Choices.TimeConstantsApproximation.classicalDefinition, xdPu = 1.81, xlPu = 0.15, xpdPu = 0.3, xppdPu = 0.23, xppqPu = 0.25, xpqPu = 0.65, xqPu = 1.76) inner PowerGrids.Electrical.System systemPowerGrids(fNom = 60) Modelica.Blocks.Sources.Step PmPu(height = 0.0, offset = 0.9, startTime = 50) Modelica.Blocks.Sources.Step ufPu(height = 0, offset = 0.000939) equation connect(bus.terminal, machine.terminal) connect(ufPu.y, machine.ufPuIn) connect(PmPu.y, machine.PmPu) end SynchronousMachine4Windings;
().
within PowerGrids.Electrical.Test; model SynchronousMachine4WindingsAccurate extends Modelica.Icons.Example; PowerGrids.Electrical.Buses.InfiniteBus bus(SNom = 5.5e+08, UNom = 24000, UStart = 24000, X = 0, portVariablesPhases = true, portVariablesPu = true, theta = 0) PowerGrids.Electrical.Machines.SynchronousMachine4Windings machine(H = 6, PStart = -5.52e+08, QStart = -2.52e+08, SNom = 5.5e+08, Tpd0 = 8, Tppd0 = 0.03, Tppq0 = 0.07, Tpq0 = 1, UNom = 24000, UStart = 24000, excitationPuType = PowerGrids.Types.Choices.ExcitationPuType.Kundur, portVariablesPhases = true, raPu = 0.003, timeConstApprox = PowerGrids.Types.Choices.TimeConstantsApproximation.accurateEstimation, xdPu = 1.81, xlPu = 0.15, xpdPu = 0.3, xppdPu = 0.23, xppqPu = 0.25, xpqPu = 0.65, xqPu = 1.76) inner PowerGrids.Electrical.System systemPowerGrids(fNom = 60) Modelica.Blocks.Sources.Step PmPu(height = 0.0, offset = 0.9, startTime = 50) Modelica.Blocks.Sources.Step ufPu(height = 0, offset = 0.000939) equation connect(bus.terminal, machine.terminal) connect(ufPu.y, machine.ufPuIn) connect(PmPu.y, machine.PmPu) end SynchronousMachine4WindingsAccurate;
().
within PowerGrids.Electrical.Test; model SynchronousMachine4WindingsExact extends Modelica.Icons.Example; PowerGrids.Electrical.Buses.InfiniteBus bus(SNom = 5.5e+08, UNom = 24000, UStart = 24000, X = 0, portVariablesPhases = true, portVariablesPu = true, theta = 0) PowerGrids.Electrical.Machines.SynchronousMachine4Windings machine(H = 6, PStart = -5.52e+08, QStart = -2.52e+08, SNom = 5.5e+08, Tpd0 = 8, Tppd0 = 0.03, Tppq0 = 0.07, Tpq0 = 1, UNom = 24000, UStart = 24000, excitationPuType = PowerGrids.Types.Choices.ExcitationPuType.Kundur, portVariablesPhases = true, raPu = 0.003, timeConstApprox = PowerGrids.Types.Choices.TimeConstantsApproximation.exactComputation, xdPu = 1.81, xlPu = 0.15, xpdPu = 0.3, xppdPu = 0.23, xppqPu = 0.25, xpqPu = 0.65, xqPu = 1.76) inner PowerGrids.Electrical.System systemPowerGrids(fNom = 60) Modelica.Blocks.Sources.Step PmPu(height = 0.0, offset = 0.9, startTime = 50) Modelica.Blocks.Sources.Step ufPu(height = 0, offset = 0.000939) equation connect(bus.terminal, machine.terminal) connect(ufPu.y, machine.ufPuIn) connect(PmPu.y, machine.PmPu) end SynchronousMachine4WindingsExact;
<html><head></head><body><p>This test case validates the NoLoad choice of base excitation voltage of the SynchronousMachine4Windings model.</p> <p>By setting ufPuIn = 1 and PmPu = 0, one obtains machine.port.VPu = 1 and machine.port.IPu = 0, as &nbsp;required by the base voltage definition.</p><p>The extermal machine parameters are the same as in the <a href=\.
within PowerGrids.Electrical.Test; model SynchronousMachine4WindingsNoLoad extends Modelica.Icons.Example; PowerGrids.Electrical.Buses.InfiniteBus bus(PStart = 0,SNom = 5.5e+08, UNom = 24000, UStart = 24000, X = 0, portVariablesPhases = true, portVariablesPu = true, theta = 0) PowerGrids.Electrical.Machines.SynchronousMachine4Windings machine(H = 6, PStart = 0, QStart = 0, SNom = 5.5e+08, Tpd0 = 8, Tppd0 = 0.03, Tppq0 = 0.07, Tpq0 = 1, UNom = 24000, UStart = 24000, excitationPuType = PowerGrids.Types.Choices.ExcitationPuType.nominalStatorVoltageNoLoad, portVariablesPhases = true, raPu = 0.003, timeConstApprox = PowerGrids.Types.Choices.TimeConstantsApproximation.classicalDefinition, xdPu = 1.81, xlPu = 0.15, xpdPu = 0.3, xppdPu = 0.23, xppqPu = 0.25, xpqPu = 0.65, xqPu = 1.76) inner PowerGrids.Electrical.System systemPowerGrids(fNom = 50) Modelica.Blocks.Sources.Step PmPu(height = 0.0, offset = 0.0, startTime = 50) Modelica.Blocks.Sources.Step ufPu(height = 0, offset = 1) equation connect(bus.terminal, machine.terminal) connect(ufPu.y, machine.ufPuIn) connect(PmPu.y, machine.PmPu) end SynchronousMachine4WindingsNoLoad;
().
within PowerGrids.Electrical.Test; model SynchronousMachine4WindingsNoLoadAccurate extends Modelica.Icons.Example; PowerGrids.Electrical.Buses.InfiniteBus bus(PStart = 0, SNom = 5.5e+08, UNom = 24000, UStart = 24000, X = 0, portVariablesPhases = true, portVariablesPu = true, theta = 0) PowerGrids.Electrical.Machines.SynchronousMachine4Windings machine(H = 6, PStart = 0, QStart = 0, SNom = 5.5e+08, Tpd0 = 8, Tppd0 = 0.03, Tppq0 = 0.07, Tpq0 = 1, UNom = 24000, UStart = 24000, excitationPuType = PowerGrids.Types.Choices.ExcitationPuType.nominalStatorVoltageNoLoad, portVariablesPhases = true, raPu = 0.003, timeConstApprox = PowerGrids.Types.Choices.TimeConstantsApproximation.accurateEstimation, xdPu = 1.81, xlPu = 0.15, xpdPu = 0.3, xppdPu = 0.23, xppqPu = 0.25, xpqPu = 0.65, xqPu = 1.76) inner PowerGrids.Electrical.System systemPowerGrids(fNom = 50) Modelica.Blocks.Sources.Step PmPu(height = 0.0, offset = 0.0, startTime = 50) Modelica.Blocks.Sources.Step ufPu(height = 0, offset = 1) equation connect(bus.terminal, machine.terminal) connect(ufPu.y, machine.ufPuIn) connect(PmPu.y, machine.PmPu) end SynchronousMachine4WindingsNoLoadAccurate;
().
within PowerGrids.Electrical.Test; model SynchronousMachine4WindingsNoLoadExact extends Modelica.Icons.Example; PowerGrids.Electrical.Buses.InfiniteBus bus(PStart = 0, SNom = 5.5e+08, UNom = 24000, UStart = 24000, X = 0, portVariablesPhases = true, portVariablesPu = true, theta = 0) PowerGrids.Electrical.Machines.SynchronousMachine4Windings machine(H = 6, PStart = 0, QStart = 0, SNom = 5.5e+08, Tpd0 = 8, Tppd0 = 0.03, Tppq0 = 0.07, Tpq0 = 1, UNom = 24000, UStart = 24000, excitationPuType = PowerGrids.Types.Choices.ExcitationPuType.nominalStatorVoltageNoLoad, portVariablesPhases = true, raPu = 0.003, timeConstApprox = PowerGrids.Types.Choices.TimeConstantsApproximation.exactComputation, xdPu = 1.81, xlPu = 0.15, xpdPu = 0.3, xppdPu = 0.23, xppqPu = 0.25, xpqPu = 0.65, xqPu = 1.76) inner PowerGrids.Electrical.System systemPowerGrids(fNom = 50) Modelica.Blocks.Sources.Step PmPu(height = 0.0, offset = 0.0, startTime = 50) Modelica.Blocks.Sources.Step ufPu(height = 0, offset = 1) equation connect(bus.terminal, machine.terminal) connect(ufPu.y, machine.ufPuIn) connect(PmPu.y, machine.PmPu) end SynchronousMachine4WindingsNoLoadExact;
--daeMode -d=initialization,evaluateAllParameters.
within PowerGrids.Electrical.Test; model SynchronousMachine4WindingsPowerSwing extends Modelica.Icons.Example; PowerGrids.Electrical.Buses.InfiniteBus bus(SNom = 5.5e+08, UNom = 24000, UStart = 24000, X = 0, portVariablesPhases = true, portVariablesPu = true, theta = 0) PowerGrids.Electrical.Machines.SynchronousMachine4Windings machine(H = 6, PStart = -4.95e+08, QStart = -2.5e+08, SNom = 5.5e+08, Tpd0 = 8, Tppd0 = 0.03, Tppq0 = 0.07, Tpq0 = 1, UNom = 24000, UStart = 24000, excitationPuType = PowerGrids.Types.Choices.ExcitationPuType.nominalStatorVoltageNoLoad, portVariablesPhases = true, raPu = 0, timeConstApprox = PowerGrids.Types.Choices.TimeConstantsApproximation.exactComputation, xdPu = 1.81, xlPu = 0.15, xpdPu = 0.3, xppdPu = 0.23, xppqPu = 0.25, xpqPu = 0.65, xqPu = 1.76) inner PowerGrids.Electrical.System systemPowerGrids Modelica.Blocks.Sources.Step PmPu(height = 0.0, offset = 0.9, startTime = 0) Modelica.Blocks.Sources.Step ufPu(height = 0, offset = machine.ufPuInStart) PowerGrids.Electrical.Branches.LineConstantImpedance line(PStartA = 0, PStartB = 0, R = 0, SNom = 1e+08, UNom = 24000, X = 1, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Loads.LoadPQVoltageDependenceInputs load(PStart = 4.95e+08, QStart = 2.5e+08, SNom = 5.5e+08, UNom = 24000, UPhaseStart = 0.680678, portVariablesPhases = true) Modelica.Blocks.Sources.Step P(height = -10e6, offset = 495e6, startTime = 1) Modelica.Blocks.Sources.Step Q(height = 0, offset = 250e6) equation connect(ufPu.y, machine.ufPuIn) connect(machine.terminal, line.terminalA) connect(line.terminalB, bus.terminal) connect(Q.y, load.QRefIn) connect(PmPu.y, machine.PmPu) connect(load.terminal, machine.terminal) connect(P.y, load.PRefIn) end SynchronousMachine4WindingsPowerSwing;
Test case EquivalentGrid model.
within PowerGrids.Electrical.Test; model TestEquivalentGrid "Test case EquivalentGrid model" extends Modelica.Icons.Example; import Modelica.ComplexMath; inner PowerGrids.Electrical.System systemPowerGrids PowerGrids.Electrical.Buses.InfiniteBus voltageSource( SNom = 5e+08, UNom = 380000, URef = 380000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Branches.LineConstantImpedance equivalentLine(R = 6.32207, SNom = 5e+08, UNom = 380000, X = 63.2207, portVariablesPhases = true, portVariablesPu = true) Buses.EquivalentGrid equivalentGrid(R_X = 1 / 10, SNom = 5e+08, SSC = 2.5e+09, UNom = 380000, URef = 1.050 * 380e3, c = 1.1, portVariablesPhases = true, portVariablesPu = true) Buses.Ground ground Loads.LoadPQVoltageDependence load(PRefConst = 1e+07, QRefConst = 2e+07, SNom = 5e+08, UNom = 380000, portVariablesPhases = true) Modelica.Blocks.Sources.RealExpression shortCircuitCapacity(y = ComplexMath.'abs'(equivalentLine.portB.S) * equivalentGrid.c) equation connect(load.terminal, equivalentGrid.terminal) connect(ground.terminal, equivalentLine.terminalA) connect(equivalentLine.terminalB, voltageSource.terminal) end TestEquivalentGrid;
LOG_STATS.
within PowerGrids.Electrical.Test; model TestExciterRectifierRegulationCharacteristicIEEE extends Modelica.Icons.Example; PowerGrids.Electrical.Controls.ExcitationSystems.BaseClasses.ExciterRectifierRegulationCharacteristicEquationsIEEE exciterRectifierRegulationCharacteristicIEEE Modelica.Blocks.Sources.RealExpression realExpression(y = time) equation connect(realExpression.y, exciterRectifierRegulationCharacteristicIEEE.u) end TestExciterRectifierRegulationCharacteristicIEEE;
LOG_STATS.
within PowerGrids.Electrical.Test; model TestExciterVoltageTransducerIEEE extends Modelica.Icons.Example; Modelica.ComplexBlocks.Sources.ComplexConstant V(k.re = -1, k.im = 1) Modelica.ComplexBlocks.Sources.ComplexConstant I(k.re = 1, k.im = 1) PowerGrids.Electrical.VoltageTransducers.ExciterVoltageTransducerIEEE exciterVoltageTransducerIEEE(ki = 1,kp = sqrt(2), thetap = 0.785398, xl = 1) equation connect(I.y, exciterVoltageTransducerIEEE.It) connect(V.y, exciterVoltageTransducerIEEE.Vt) end TestExciterVoltageTransducerIEEE;
<html><head></head><body><p>Same behaviour as <a href=\.
within PowerGrids.Electrical.Test; model TestOneBusTransmissionLineWithBreakersOneLoad extends Modelica.Icons.Example; PowerGrids.Electrical.Buses.InfiniteBus infiniteBus(SNom = 1e+07, UNom = 10000, portVariablesPu = true, theta = 0.523599) PowerGrids.Electrical.Loads.LoadPQVoltageDependence loadPQ(PRefConst = 1e+07, QRefConst = 0, SNom = 1e+07, UNom = 10000, alpha = 0, beta = 0, portVariablesPhases = true) inner PowerGrids.Electrical.System systemPowerGrids PowerGrids.Electrical.Branches.LineConstantImpedanceWithBreakers transmissionLine(B = 0.02, G = 0.01,R = 0.3, SNom = 1e+07, UNom = 10000, X = 1.5, portVariablesPu = true) equation connect(infiniteBus.terminal, transmissionLine.terminalA) connect(transmissionLine.terminalB, loadPQ.terminal) end TestOneBusTransmissionLineWithBreakersOneLoad;
Time lag before changing the first tap.
within PowerGrids.Electrical.Test; model TestTapChangerLogicInterval extends Modelica.Icons.Example; extends PowerGrids.Electrical.Branches.BaseClasses.TapChangerPhaseShifterLogicInterval (t1st = 3 "Time lag before changing the first tap", tNext = 2 "Time lag before changing subsequent taps", tapMin = 1 "Minimum tap", tapMax = 20 "Maximum tap", Ntap = 20 "Number of taps", actionSel = ActionType.direct "Tap direct or reverse action selector", lockedStart = false "Wether the tap-changer/phase-shifter is initially locked", runningStart = true "Wether the tap-changer/phase-shifter is initially running", tapStart = 10 "Initial tap", stateStart = State.standard "Initial state", tToStandardState = 2 "Time lag before transition to standard state, in order to avoid chattering"); Real U = sin(2*Modelica.Constants.pi*time/40) "Monitored Value"; Real Umin = -0.5; Real Umax = 0.5; equation locked = time < 20; running = true; valueAboveMax = U > Umax; valueUnderMin = U < Umin; end TestTapChangerLogicInterval;
Time lag before changing the first tap.
within PowerGrids.Electrical.Test; model TestTapChangerLogicMax extends Modelica.Icons.Example; extends PowerGrids.Electrical.Branches.BaseClasses.TapChangerPhaseShifterLogicMax( t1st = 3 "Time lag before changing the first tap", tNext = 1 "Time lag before changing subsequent taps", Ntap = 10 "Number of taps", actionSel = ActionType.direct "Tap direct or reverse action selector", lockedStart = false "Wether the tap-changer/phase-shifter is initially locked", runningStart = true "Wether the tap-changer/phase-shifter is initially running", tapStart = 10 "Initial tap", stateStart = State.standard "Initial state"); equation locked = time >= 5 and time < 8; running = true; valueUnderStop = time >= 15.5; valueAboveMax = time >= 1 and time < 10; end TestTapChangerLogicMax;
LOG_STATS.
within PowerGrids.Electrical.Test; model TestTerminalVoltageTransducerIEEE extends Modelica.Icons.Example; PowerGrids.Electrical.VoltageTransducers.TerminalVoltageTransducerIEEE terminalVoltageTransducer(Rc = 1, Xc = 1, Tr = 1, initType = Modelica.Blocks.Types.Init.InitialOutput) Modelica.ComplexBlocks.Sources.ComplexConstant V(k.re = -1, k.im = 1) Modelica.ComplexBlocks.Sources.ComplexConstant I(k.re = 1, k.im = 1) equation connect(I.y, terminalVoltageTransducer.It) connect(V.y, terminalVoltageTransducer.Vt) end TestTerminalVoltageTransducerIEEE;
<html><head></head><body><p>Similar to <a href=\.
within PowerGrids.Electrical.Test; model TestTransformerFixedRatio extends Modelica.Icons.Example; PowerGrids.Electrical.Buses.InfiniteBus infiniteBus(SNom = 1e+07, UNom = 5000, portVariablesPu = true, theta = 0.523599) PowerGrids.Electrical.Loads.LoadPQVoltageDependence loadPQ(PRefConst = 1e+07, QRefConst = 0, SNom = 1e+07, UNom = 10000, alpha = 0, beta = 0, portVariablesPhases = true) inner PowerGrids.Electrical.System systemPowerGrids PowerGrids.Electrical.Branches.TransformerFixedRatio transformer(R = 0.3, SNom = 1e+07, UNomA = 5000, UNomB = 10000, X = 1.5, portVariablesPu = true, rFixed = 2) equation connect(infiniteBus.terminal, transformer.terminalA) connect(transformer.terminalB, loadPQ.terminal) end TestTransformerFixedRatio;
<html><head></head><body><p>Similar to <a href=\.
within PowerGrids.Electrical.Test; model TestTransformerFixedRatioWithBreaker extends Modelica.Icons.Example; PowerGrids.Electrical.Buses.InfiniteBus infiniteBus1(SNom = 1e+07, UNom = 5000, portVariablesPu = true, theta = 0.523599) PowerGrids.Electrical.Loads.LoadPQVoltageDependence loadPQ(PRefConst = 1e+07, QRefConst = 0, SNom = 1e+07, UNom = 10000, alpha = 0, beta = 0, portVariablesPhases = true) inner PowerGrids.Electrical.System systemPowerGrids PowerGrids.Electrical.Branches.TransformerFixedRatioWithBreaker transformer(B = 1e-6, G = 1e-6,R = 0.3, SNom = 1e+07, UNomA = 5000, UNomB = 10000, X = 1.5, portVariablesPu = true, rFixed = 2, useBreaker = true) Modelica.Blocks.Sources.BooleanExpression breakerState(y = time < 2) PowerGrids.Electrical.Buses.InfiniteBus infiniteBus2(SNom = 1e+07, UNom = 10000, portVariablesPu = true, theta = 0.523599) Branches.LineConstantImpedance line(R = 0.06, SNom = 1e+7, UNom = 10000, X = 1.5) equation connect(infiniteBus1.terminal, transformer.terminalA) connect(transformer.terminalB, loadPQ.terminal) connect(breakerState.y, transformer.breakerStatusIn) connect(loadPQ.terminal, line.terminalA) connect(line.terminalB, infiniteBus2.terminal) end TestTransformerFixedRatioWithBreaker;
LOG_STATS.
within PowerGrids.Electrical.Test; model TestTransformerWithTapChangerInterval extends Modelica.Icons.Example; PowerGrids.Electrical.Buses.InfiniteBusVariableVoltage infiniteBus(R = 0, SNom = 1e+06, UNom = 1000, X = 0, useUIn = true) PowerGrids.Electrical.Branches.TransformerWithTapChangerInterval trafo(B = 0, G = 0, K = {2, 3, 4, 5, 6}, Ntap = 5, R = 1, SNom = 1e+06, UMax = 4000, UMin = 2000, UNomA = 1000, UNomB = 1000, X = 1, actionSel = PowerGrids.Electrical.Branches.TransformerWithTapChangerInterval.ActionType.direct, portVariablesPu = true, t1st = 1, tNext = 0.1, tapStart = 2) PowerGrids.Electrical.Buses.InfiniteBus busLoad(R = 1000, SNom = 1e+06, UNom = 1000, X = 0, theta = 0) Modelica.Blocks.Sources.RealExpression Uset(y = 500 * (sin(6.28 * time / 40) + 2)) inner PowerGrids.Electrical.System systemPowerGrids equation connect(Uset.y, infiniteBus.UIn) connect(trafo.terminalB, busLoad.terminal) connect(infiniteBus.terminal, trafo.terminalA) end TestTransformerWithTapChangerInterval;
LOG_STATS.
within PowerGrids.Electrical.Test; model TestTransformerWithTapChangerMax extends Modelica.Icons.Example; PowerGrids.Electrical.Buses.InfiniteBusVariableVoltage infiniteBus(R = 0, SNom = 1e+06, UNom = 1000, X = 0, portVariablesPu = true, useUIn = true) PowerGrids.Electrical.Branches.TransformerWithTapChangerMax trafo(B = 0, G = 0, K = {1, 2, 3, 4, 5}, Ntap = 5, R = 1, SNom = 1e+06, UMax = 4500, UNomA = 1000, UNomB = 1000, UStop = 2600, X = 1, actionSel = PowerGrids.Electrical.Branches.TransformerWithTapChangerInterval.ActionType.direct, portVariablesPu = true, t1st = 1, tNext = 2, tapStart = 5) PowerGrids.Electrical.Buses.InfiniteBus busLoad(R = 1000, SNom = 1e+06, UNom = 1000, X = 0, portVariablesPu = true, theta = 0) Modelica.Blocks.Sources.RealExpression Uset(y = 500 * (sin(6.28 * time / 40) + 1)) inner PowerGrids.Electrical.System systemPowerGrids equation connect(Uset.y, infiniteBus.UIn) connect(trafo.terminalB, busLoad.terminal) connect(infiniteBus.terminal, trafo.terminalA) end TestTransformerWithTapChangerMax;
<html><head></head><body><p><span style=\.
within PowerGrids.Electrical.Test; model TestTwoBusesTwoLinesOneLoadOneBreakerOpenClosePortA extends TestTwoBusesTwoTransmLinesWithBreakersOneLoad(transmissionLine2.useBreakerA = true); Modelica.Blocks.Sources.BooleanExpression BreakerStatus(y = time < 1 or time >= 10) equation connect(BreakerStatus.y, transmissionLine2.breakerStatusA) end TestTwoBusesTwoLinesOneLoadOneBreakerOpenClosePortA;
<html><head></head><body><p style=\.
within PowerGrids.Electrical.Test; model TestTwoBusesTwoLinesOneLoadOneBreakerOpenClosePortB extends TestTwoBusesTwoTransmLinesWithBreakersOneLoad(transmissionLine1.useBreakerB = true); Modelica.Blocks.Sources.BooleanExpression BreakerStatus(y = time < 1 or time >= 10) equation connect(transmissionLine1.breakerStatusB, BreakerStatus.y) end TestTwoBusesTwoLinesOneLoadOneBreakerOpenClosePortB;
<html><head></head><body><p style=\.
within PowerGrids.Electrical.Test; model TestTwoBusesTwoLinesOneLoadOneBreakerOpenClosePortsAB extends TestTwoBusesTwoTransmLinesWithBreakersOneLoad(transmissionLine1.useBreakerB = true, transmissionLine1.portVariablesPu = true, transmissionLine1.useBreakerA = true, transmissionLine2.portVariablesPu = true, transmissionLine2.useBreakerA = true, transmissionLine2.useBreakerB = true); Modelica.Blocks.Sources.BooleanExpression BreakerStatusLine1AB(y = time < 1 or time >= 2) Modelica.Blocks.Sources.BooleanExpression BreakerStatusLine2A(y = time < 3 or time >= 5) Modelica.Blocks.Sources.BooleanExpression BreakerStatusLine2B(y = time < 4 or time >= 5) equation connect(BreakerStatusLine2B.y, transmissionLine2.breakerStatusB) connect(BreakerStatusLine2A.y, transmissionLine2.breakerStatusA) connect(BreakerStatusLine1AB.y, transmissionLine1.breakerStatusB) connect(BreakerStatusLine1AB.y, transmissionLine1.breakerStatusA) end TestTwoBusesTwoLinesOneLoadOneBreakerOpenClosePortsAB;
<html><head></head><body><p><span style=\.
within PowerGrids.Electrical.Test; model TestTwoBusesTwoTransmLinesWithBreakersOneLoad extends Modelica.Icons.Example; PowerGrids.Electrical.Buses.InfiniteBus infiniteBus1(SNom = 1e+07, UNom = 10000, portVariablesPu = true, theta = 0.523599) PowerGrids.Electrical.Loads.LoadPQVoltageDependence loadPQ(PRefConst = 1e+07, QRefConst = 0, SNom = 1e+07, UNom = 10000, alpha = 0, beta = 0, portVariablesPhases = true) inner PowerGrids.Electrical.System systemPowerGrids PowerGrids.Electrical.Branches.LineConstantImpedanceWithBreakers transmissionLine1(B = 0.02, G = 0.01,R = 0.3, SNom = 1e+07, UNom = 10000, X = 1.5, portVariablesPu = true) PowerGrids.Electrical.Branches.LineConstantImpedanceWithBreakers transmissionLine2(B = 0.02, G = 0.01,R = 0.3, SNom = 1e+07, UNom = 10000, X = 1.5, portVariablesPu = true) PowerGrids.Electrical.Buses.InfiniteBus infiniteBus2(SNom = 1e+07, UNom = 10000, portVariablesPu = true, theta = 0.523599) equation connect(transmissionLine2.terminalB, infiniteBus2.terminal) connect(loadPQ.terminal, transmissionLine2.terminalA) connect(transmissionLine1.terminalB, loadPQ.terminal) connect(infiniteBus1.terminal, transmissionLine1.terminalA) end TestTwoBusesTwoTransmLinesWithBreakersOneLoad;
<html><head></head><body><p>This model demonstrates the dissipation of reactive power of a purely inductive transmission line, connected to two infinite buses, one with a phase-to-phase voltage U = 10 kV, one with a phase-to-phase voltage U = 9 kV, both with a 30 deg phase. The reactance of each conductor is 1 Ohm.</p><p>As a consequence, the current flowing in each conductor is</p><p>I = (VA - VB)/X = ((UA-UB)/sqrt3)/X = 577.35 A.</p><p>The active power flow in the line is zero. The reactive power entering the line from portA is</p><p>3*VA*I' = UA*(UA - UB)*X = 10 MW</p><p>while the reactive power dissipated by the transmission line is</p><p>portA.P + portB.P = 3*(VA - VB)*I = (UA - UB)^2/R = 1 MW</p><p>By choosing a base power of 10 MW and a base voltage of 10 kV, the current flowing through the line is 1 p.u., the active power entering portA of the line is 1 p.u. and the active power leaving portB of the line is 0.9 p.u. All currents and voltages have 30 deg phase.</p> </body></html>.
within PowerGrids.Electrical.Test; model TwoBusesInductiveTransmissionLine extends Modelica.Icons.Example; PowerGrids.Electrical.Buses.InfiniteBus infiniteBusA(SNom = 1e+07, UNom = 10000, portVariablesPu = true, theta = 0.523599) inner PowerGrids.Electrical.System systemPowerGrids PowerGrids.Electrical.Branches.LineConstantImpedance transmissionLine(R = 0, SNom = 1e+07, UNom = 10000, X = 1, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Buses.InfiniteBus infiniteBusB(SNom = 1e+07, UNom = 9000, portVariablesPu = true, theta = 0.523599) equation connect(infiniteBusA.terminal, transmissionLine.terminalA) connect(transmissionLine.terminalB, infiniteBusB.terminal) end TwoBusesInductiveTransmissionLine;
<html><head></head><body><p>This model demonstrates the transmission of active power through a purely inductive transmission line, connected to two infinite buses with a phase-to-phase voltage of 10 kV. The generator at portA of the line has 30 deg phase, the other one has 0 deg phase. The reactance of each conductor is 1 Ohm.</p><p>The active power flow from portA to portB is</p><p>P = 3(VA*VB)/X*sin(delta)= UA*UB/X*sin(delta) = 50 MW.</p><p>By choosing a base power of 100 MW and a base voltage of 10 kV, the active power flow from portA to portB is 0.5 p.u.</p> </body></html>.
within PowerGrids.Electrical.Test; model TwoBusesPowerTransferTransmissionLine extends Modelica.Icons.Example; PowerGrids.Electrical.Buses.InfiniteBus infiniteBusA(SNom = 1e+08, UNom = 10000, portVariablesPhases = true, portVariablesPu = true, theta = 0.523599) inner PowerGrids.Electrical.System systemPowerGrids PowerGrids.Electrical.Branches.LineConstantImpedance transmissionLine(R = 0, SNom = 1e+08, UNom = 10000, X = 1, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Buses.InfiniteBus infiniteBusB(SNom = 1e+08, UNom = 10000, portVariablesPhases = true, portVariablesPu = true, theta = 0) equation connect(infiniteBusA.terminal, transmissionLine.terminalA) connect(transmissionLine.terminalB, infiniteBusB.terminal) end TwoBusesPowerTransferTransmissionLine;
<html><head></head><body><p>This model demonstrates the dissipation of active power of a purely resistive transmission line, connected to two infinite buses, one with a phase-to-phase voltage U = 10 kV, one with a phase-to-phase voltage U = 9 kV, both with a 30 deg phase. The resistance of each conductor is 1 Ohm. </p> <p>As a consequence, the current flowing in each conductor is</p> <p>I = (VA - VB)/R = ((UA-UB)/sqrt3)/R = 577.35 A.</p> <p>The reactive power flow in the line is zero. The active power entering the line from portA is</p> <p>3*VA*I = UA*(UA - UB)/R = 10 MW</p> <p>while the active power dissipated by the transmission line is</p> <p>portA.P + portB.P = 3*(VA - VB)*I = (UA - UB)^2/R = 1 kW</p> <p>By choosing a base power of 10 MW and a base voltage of 10 kV, the current flowing through the line is 1 p.u., the active power entering portA of the line is 1 p.u. and the active power leaving portB of the line is 0.9 p.u. All currents and voltages have 30 deg phase.</p> </body></html>.
within PowerGrids.Electrical.Test; model TwoBusesResistiveTransmissionLine extends Modelica.Icons.Example; PowerGrids.Electrical.Buses.InfiniteBus infiniteBusA(SNom = 1e+07, UNom = 10000, portVariablesPu = true, theta = 0.523599) inner PowerGrids.Electrical.System systemPowerGrids PowerGrids.Electrical.Branches.LineConstantImpedance transmissionLine(R = 1, SNom = 1e+07, UNom = 10000, X = 0, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Buses.InfiniteBus infiniteBusB(SNom = 1e+07, UNom = 9000, portVariablesPu = true, theta = 0.523599) equation connect(infiniteBusA.terminal, transmissionLine.terminalA) connect(transmissionLine.terminalB, infiniteBusB.terminal) end TwoBusesResistiveTransmissionLine;
<html><head></head><body><p>This model demonstrates the behaviour of a purely resistive transmission line with a purely resistive intermediate fault.</p> <p>At the beginning of the transient, a current flows from bus A (phase to phase voltage 10 kV) to bus B (phase-to-phase voltage 9 kV) through a resistance of 1 Ohm.</p> <p>As a consequence, the current flowing in each conductor is</p> <p>I = (VA - VB)/R = ((UA-UB)/sqrt3)/R = 577.35 A.</p> <p>When the fault is activated, the analytical computation of the current flowing into the fault yields a current of 10.5215 kA, which corresponds to the simulation result.</p> <p>At time = 0.6 the fault is cleared and the current through the line returns to the original value.</p> </body></html>.
within PowerGrids.Electrical.Test; model TwoBusesResistiveTransmissionLineFault extends Modelica.Icons.Example; PowerGrids.Electrical.Buses.InfiniteBus infiniteBusA(SNom = 1e+07, UNom = 10000, portVariablesPu = true, theta = 0.523599) inner PowerGrids.Electrical.System systemPowerGrids PowerGrids.Electrical.Branches.LineConstantImpedanceFault transmissionLine(R = 1, RFault = 0.3, SNom = 1e+07, UNom = 10000, X = 0, XFault = 0, faultLocationPu = 0.7, portVariablesPhases = true, portVariablesPu = true, startTime = 0.4, stopTime = 0.6) PowerGrids.Electrical.Buses.InfiniteBus infiniteBusB(SNom = 1e+07, UNom = 9000, portVariablesPu = true, theta = 0.523599) equation connect(infiniteBusA.terminal, transmissionLine.terminalA) connect(transmissionLine.terminalB, infiniteBusB.terminal) end TwoBusesResistiveTransmissionLineFault;
<html><head></head><body><p>This model demonstrates the effect of the shunt admittance of the transmission line, connected to two infinite buses, with phase-to-phase voltage U = 10 kV and 30 deg phase. The line resistance is very high, so there is practically no current flowing through. The shunt admittance and susceptance are both 0.01 Ohm.</p> <p>As a consequence, the two currents flowing into the line from each port are rotated by 45 deg with respect to the 30 deg voltage angle. The active power on each side is 0.5 MW and the reactive power is -0.5 MVA, which correspond to 0.05 and -0.05 pu with the chosen base quantities.</p> </body></html>.
within PowerGrids.Electrical.Test; model TwoBusesShuntTransmissionLine extends Modelica.Icons.Example; PowerGrids.Electrical.Buses.InfiniteBus infiniteBusA(SNom = 1e+07, UNom = 10000, portVariablesPu = true, theta = 0.523599) inner PowerGrids.Electrical.System systemPowerGrids PowerGrids.Electrical.Branches.LineConstantImpedance transmissionLine(B = 0.01, G = 0.01, R = 1e8, SNom = 1e+07, UNom = 10000, X = 0, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Buses.InfiniteBus infiniteBusB(SNom = 1e+07, UNom = 10000, portVariablesPu = true, theta = 0.523599) equation connect(infiniteBusA.terminal, transmissionLine.terminalA) connect(transmissionLine.terminalB, infiniteBusB.terminal) end TwoBusesShuntTransmissionLine;
Exciter voltage transducer.
within PowerGrids.Electrical.VoltageTransducers; model ExciterVoltageTransducerIEEE "Exciter voltage transducer" parameter SI.PerUnit kp = 9.3"First potential circuit gain"; parameter SI.Angle thetap = 0 "Potential circuit phase angle Thetap"; parameter SI.PerUnit ki = 0 "Second potential circuit gain coefficient"; parameter SI.PerUnit xl = 0.124 "Reactance associated with potential source"; Modelica.ComplexBlocks.Interfaces.ComplexInput Vt Modelica.ComplexBlocks.Interfaces.ComplexInput It Modelica.Blocks.Interfaces.RealOutput Ve Modelica.Blocks.Sources.Constant constKp(k = kp) Modelica.Blocks.Sources.Constant constThetap(k = thetap) Modelica.ComplexBlocks.ComplexMath.Add add1 Modelica.ComplexBlocks.ComplexMath.ComplexToPolar complexToPolar Modelica.ComplexBlocks.ComplexMath.PolarToComplex complexKp Modelica.ComplexBlocks.ComplexMath.Gain gainXl(k.re = 0, k.im = xl) Modelica.ComplexBlocks.ComplexMath.Gain J(k.re = 0, k.im = 1) Modelica.ComplexBlocks.ComplexMath.Product prod1 Modelica.ComplexBlocks.ComplexMath.Add add2 Modelica.ComplexBlocks.ComplexMath.Product prod2 Modelica.ComplexBlocks.Sources.ComplexConstant constKi(k.re = ki, k.im = 0) equation connect(constKi.y, add1.u2) connect(Vt, prod2.u1) connect(complexToPolar.len, Ve) connect(add2.y, complexToPolar.u) connect(prod1.y, add2.u2) connect(prod2.y, add2.u1) connect(complexKp.y, prod2.u2) connect(It, prod1.u2) connect(J.y, prod1.u1) connect(add1.y, J.u) connect(gainXl.y, add1.u1) connect(complexKp.y, gainXl.u) connect(constThetap.y, complexKp.phi) connect(constKp.y, complexKp.len) end ExciterVoltageTransducerIEEE;
Voltage transducer models
within PowerGrids.Electrical; package VoltageTransducers "Voltage transducer models" extends Modelica.Icons.Package; end VoltageTransducers;
Terminal voltage transducer IEEE.
within PowerGrids.Electrical.VoltageTransducers; model TerminalVoltageTransducerIEEE "Terminal voltage transducer IEEE" parameter Modelica.SIunits.Time Tr = 0 "Transducer time constant"; parameter Modelica.SIunits.PerUnit Rc = 0 "Load compensation resistance"; parameter Modelica.SIunits.PerUnit Xc = 0 "Load compensation reactance"; parameter Modelica.Blocks.Types.Init initType=Modelica.Blocks.Types.Init.NoInit "Type of initialization (1: no init, 2: steady state, 3/4: initial output)" parameter Real yStart=0 "Initial or guess value of output (= state)" Modelica.ComplexBlocks.Interfaces.ComplexInput Vt Modelica.ComplexBlocks.Interfaces.ComplexInput It Modelica.Blocks.Interfaces.RealOutput Vc Modelica.ComplexBlocks.ComplexMath.RealToComplex constZc Modelica.Blocks.Sources.Constant constRc(k = Rc) Modelica.Blocks.Sources.Constant constXc(k = Xc) Modelica.ComplexBlocks.ComplexMath.Add add1 Modelica.ComplexBlocks.ComplexMath.Product prod1 Modelica.ComplexBlocks.ComplexMath.ComplexToPolar complexToPolar Modelica.Blocks.Continuous.FirstOrder firstOrder(T = Tr, initType = initType, y_start = yStart) equation connect(firstOrder.y, Vc) connect(complexToPolar.len, firstOrder.u) connect(add1.y, complexToPolar.u) connect(Vt, add1.u1) connect(prod1.y, add1.u2) connect(It, prod1.u1) connect(constZc.y, prod1.u2) connect(constXc.y, constZc.im) connect(constRc.y, constZc.re) end TerminalVoltageTransducerIEEE;
info
within PowerGrids.Examples; package Overview extends Modelica.Icons.Information; end Overview;
Information
within PowerGrids.Examples.ENTSOE; package Info "Information" extends Modelica.Icons.Information; end Info;
Simple example from ENTSO-E document
within PowerGrids.Examples; package ENTSOE "Simple example from ENTSO-E document" extends Modelica.Icons.ExamplesPackage; end ENTSOE;
Reproduces the basic static power flow, see fig. 3-1 of the report.
within PowerGrids.Examples.ENTSOE; model SteadyState "Reproduces the basic static power flow, see fig. 3-1 of the report" extends Modelica.Icons.Example; inner PowerGrids.Electrical.System systemPowerGrids PowerGrids.Electrical.Machines.SynchronousMachine4Windings GEN(H = 4, PStart = -4.75e+08, QStart = -1.56e+08, SNom = 5e+08, Tpd0 = 5.143, Tppd0 = 0.042, Tppq0 = 0.083, Tpq0 = 2.16, UNom = 21000, UPhaseStart = 0.161146, UStart = 21e3 * 0.992, portVariablesPhases = true, raPu = 0, xdPu = 2, xlPu = 0.15, xpdPu = 0.35, xppdPu = 0.25, xppqPu = 0.3, xpqPu = 0.5, xqPu = 1.8) PowerGrids.Electrical.Buses.Bus NTLV(SNom = 5e+08, UNom = 21000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Buses.Bus NTHV(SNom = 5e+08, UNom = 380000, UPhaseStart = 0, UStart = 1.050 * 380e3,portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Branches.TransformerFixedRatio TGEN(PStartA = 4.75e+08, PStartB = -4.75e+08, QStartA = 1.56e+08, QStartB = -7.6e+07, R = 0.15e-2 * 419 ^ 2 / 500, SNom = 5e+08, UNomA = 21000, UNomB = 419000, UPhaseStartA = 0.161146, UPhaseStartB = 0, UStartA = 0.992 * 21e3, UStartB = 1.050 * 380e3, X = 16e-2 * 419 ^ 2 / 500, portVariablesPhases = true, portVariablesPu = true, rFixed = 419 / 21) PowerGrids.Electrical.Controls.TurbineGovernors.IEEE_TGOV1 TGOV(R = 0.05, T1 = 0.5, T2 = 3, T3 = 10, VMax = 1) PowerGrids.Electrical.Controls.ExcitationSystems.IEEE_AC4A AVR(Ka = 200, Ta = 0.05, Tb = 10, Tc = 3, VrMax = 4) PowerGrids.Electrical.Controls.PowerSystemStabilizers.IEEE_PSS2A PSS(Ks1 = 10, Ks2 = 0.1564, M = 0, N = 0, T1 = 0.25, T2 = 0.03, T3 = 0.15, T4 = 0.015, T7 = 2, T8 = 0.5, T9 = 0.1, Tw1 = 2, Tw2 = 2, Tw3 = 2, Tw4 = 0, VstMax = 0.1, VstMin = -0.1) Modelica.Blocks.Sources.RealExpression zero Modelica.Blocks.Sources.RealExpression VrefPu(y = 1.004552) Modelica.Blocks.Sources.RealExpression RefLPu(y = 475 / 500 * 0.05) PowerGrids.Electrical.Loads.LoadImpedancePQ GRIDL(PRefConst = 4.75e+08, PStart(displayUnit = "W"), QRefConst = 7.6e+07, SNom = 5e+08, UNom = 380000, URef(displayUnit = "V") = 1.05 * 380e3, UStart(displayUnit = "V"), portVariablesPhases = true, portVariablesPu = true) Types.PerUnit AA_01_NGEN_U = GEN.VPu; Types.PerUnit AA_02_NGRID_U = GRID.port.VPu; Types.Angle AA_03_NGRID_delta = GRID.port.UPhase; Types.Angle AA_04_NGEN_delta = GEN.port.UPhase; Types.ActivePower AA_05_PG = GEN.port.PGen; Types.ReactivePower AA_06_QG = GEN.port.QGen; Types.ActivePower AA_07_PGRID = -GRID.port.P; Types.ReactivePower AA_08_QGRID = -GRID.port.Q; Types.ActivePower AA_09_PGRIDL = GRIDL.port.P; Types.ReactivePower AA_10_QGRIDL = GRIDL.port.Q; Electrical.Buses.EquivalentGrid GRID(R_X = 1 / 10, SNom = 5e+08, SSC = 2.5e+09, UNom = 380000, URef = 1.05 * 380e3, c = 1.1, portVariablesPhases = true, portVariablesPu = true) equation connect(VrefPu.y, AVR.VrefPu) connect(GRID.terminal, NTHV.terminal) connect(TGEN.terminalB, NTHV.terminal) connect(NTHV.terminal, GRIDL.terminal) connect(GEN.PPu, PSS.Vsi2Pu) connect(GEN.VPu, AVR.VcPu) connect(RefLPu.y, TGOV.RefLPu) connect(zero.y, AVR.VuelPu) connect(GEN.omegaPu, PSS.Vsi1Pu) connect(PSS.VstPu, AVR.VsPu) connect(AVR.efdPu, GEN.ufPuIn) connect(GEN.omegaPu, TGOV.omegaPu) connect(TGOV.PMechPu, GEN.PmPu) connect(NTLV.terminal, TGEN.terminalA) connect(GEN.terminal, NTLV.terminal) end SteadyState;
Test Case 1, Section 5.1, focuses on the dynamic behavior of the model for the synchronous generator machine and its AVR.
within PowerGrids.Examples.ENTSOE; model TestCase1 "Test Case 1, Section 5.1, focuses on the dynamic behavior of the model for the synchronous generator machine and its AVR" extends Modelica.Icons.Example; inner PowerGrids.Electrical.System systemPowerGrids PowerGrids.Electrical.Machines.SynchronousMachine4Windings GEN(H = 4, PStart = 0, QStart = 0, SNom = 5e+08, Tpd0 = 5.143, Tppd0 = 0.042, Tppq0 = 0.083, Tpq0 = 2.16, UNom = 21000, UPhaseStart = 0, UStart = 21000, portVariablesPhases = true, raPu = 0, xdPu = 2, xlPu = 0.15, xpdPu = 0.35, xppdPu = 0.25, xppqPu = 0.3, xpqPu = 0.5, xqPu = 1.8) PowerGrids.Electrical.Buses.ReferenceBus NTLV(SNom = 5e+08, UNom = 21000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Controls.TurbineGovernors.IEEE_TGOV1 TGOV(R = 0.05, T1 = 0.5, T2 = 3, T3 = 10, VMax = 1) PowerGrids.Electrical.Controls.ExcitationSystems.IEEE_AC4A AVR(Ka = 200, Ta = 0.05, Tb = 10, Tc = 3, VrMax = 4) PowerGrids.Electrical.Controls.PowerSystemStabilizers.IEEE_PSS2A PSS(Ks1 = 10, Ks2 = 0.1564, M = 0, N = 0, T1 = 0.25, T2 = 0.03, T3 = 0.15, T4 = 0.015, T7 = 2, T8 = 0.5, T9 = 0.1, Tw1 = 2, Tw2 = 2, Tw3 = 2, Tw4 = 0, VstMax = 0.1, VstMin = -0.1) Modelica.Blocks.Sources.RealExpression zero Modelica.Blocks.Sources.RealExpression VrefPu(y = if time < 0.1 then 1.005 else 1.055) Modelica.Blocks.Sources.RealExpression RefLPu(y = 0) Types.PerUnit AA_01_GEN_Upu = GEN.port.VPu "Fig. 5.1, terminal voltage"; Types.PerUnit AA_02_GEN_efd = GEN.ufPuIn "Fig. 5.2, excitation voltage"; equation connect(GEN.PPu, PSS.Vsi2Pu) connect(GEN.VPu, AVR.VcPu) connect(RefLPu.y, TGOV.RefLPu) connect(VrefPu.y, AVR.VrefPu) connect(zero.y, AVR.VuelPu) connect(GEN.omegaPu, PSS.Vsi1Pu) connect(PSS.VstPu, AVR.VsPu) connect(AVR.efdPu, GEN.ufPuIn) connect(GEN.omegaPu, TGOV.omegaPu) connect(TGOV.PMechPu, GEN.PmPu) connect(GEN.terminal, NTLV.terminal) end TestCase1;
Test Case 2, Section 5.2, focuses on the dynamic behavior of the model for the synchronous generator and its governor.
within PowerGrids.Examples.ENTSOE; model TestCase2 "Test Case 2, Section 5.2, focuses on the dynamic behavior of the model for the synchronous generator and its governor" extends Modelica.Icons.Example; inner PowerGrids.Electrical.System systemPowerGrids PowerGrids.Electrical.Machines.SynchronousMachine4Windings GEN(H = 4, PStart = -3.8e+08, QStart = 0, SNom = 4.75e+08, Tpd0 = 5.143, Tppd0 = 0.042, Tppq0 = 0.083, Tpq0 = 2.16, UNom = 21000, UPhaseStart = 0, UStart = 21000, portVariablesPhases = true, raPu = 0, referenceGenerator = true, xdPu = 2, xlPu = 0.15, xpdPu = 0.35, xppdPu = 0.25, xppqPu = 0.3, xpqPu = 0.5, xqPu = 1.8) PowerGrids.Electrical.Buses.ReferenceBus NGEN(SNom = 5e+08, UNom = 21000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Controls.TurbineGovernors.IEEE_TGOV1 TGOV(R = 0.05, T1 = 0.5, T2 = 3, T3 = 10, VMax = 1) PowerGrids.Electrical.Controls.ExcitationSystems.IEEE_AC4A AVR(Ka = 200, Ta = 0.05, Tb = 10, Tc = 3, VrMax = 4) Modelica.Blocks.Sources.RealExpression zero Modelica.Blocks.Sources.RealExpression VrefPu(y = 1.00943) Modelica.Blocks.Sources.RealExpression RefLPu(y = 380 / 475 * 0.05) PowerGrids.Electrical.Loads.LoadImpedancePQInputs LOAD(PStart = 3.8e+08, SNom = 4.75e+08, UNom = 21000, portVariablesPhases = true, portVariablesPu = true) Modelica.Blocks.Sources.Step PLoad(height = 23.75e6, offset = 380e6, startTime = 0.1) Modelica.Blocks.Sources.RealExpression zero2 Types.PerUnit AA_01_GEN_UPu = GEN.port.VPu "Fig. 5-3, terminal voltage"; Types.PerUnit AA_02_GEN_PPu = GEN.port.PGenPu "Fig. 5-4, active power of the synchronous machine"; Types.PerUnit AA_03_GEN_PmechPu = GEN.PmPu "Fig. 5-5, mechanical power of the synchronous machine"; Types.PerUnit AA_04_GEN_omegaPu = GEN.omegaPu "Fig. 5-6, speed"; equation connect(GEN.VPu, AVR.VcPu) connect(zero2.y, LOAD.QRefIn) connect(zero.y, AVR.VuelPu) connect(zero.y, AVR.VsPu) connect(VrefPu.y, AVR.VrefPu) connect(PLoad.y, LOAD.PRefIn) connect(NGEN.terminal, LOAD.terminal) connect(RefLPu.y, TGOV.RefLPu) connect(AVR.efdPu, GEN.ufPuIn) connect(GEN.omegaPu, TGOV.omegaPu) connect(TGOV.PMechPu, GEN.PmPu) connect(GEN.terminal, NGEN.terminal) end TestCase2;
Test Case 3, Section 5.3, focuses on the dynamic behavior of the model for the synchronous machine with its whole control in response to a short-circuit.
within PowerGrids.Examples.ENTSOE; model TestCase3 "Test Case 3, Section 5.3, focuses on the dynamic behavior of the model for the synchronous machine with its whole control in response to a short-circuit" extends Modelica.Icons.Example; inner PowerGrids.Electrical.System systemPowerGrids PowerGrids.Electrical.Machines.SynchronousMachine4Windings GEN(H = 4, PStart = -4.75e+08, QStart = -1.56e+08, SNom = 5e+08, Tpd0 = 5.143, Tppd0 = 0.042, Tppq0 = 0.083, Tpq0 = 2.16, UNom = 21000, UPhaseStart = 0.161146, UStart = 21e3 * 0.992, portVariablesPhases = true, raPu = 0, xdPu = 2, xlPu = 0.15, xpdPu = 0.35, xppdPu = 0.25, xppqPu = 0.3, xpqPu = 0.5, xqPu = 1.8) PowerGrids.Electrical.Buses.Bus NTLV(SNom = 5e+08, UNom = 21000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Buses.BusFault NTHV(R = 0.05, SNom = 5e+08, UNom = 380000, UStart = 1.050 * 380e3, X = 0, portVariablesPhases = true, portVariablesPu = true, startTime = 0.1, stopTime = 0.2) PowerGrids.Electrical.Branches.TransformerFixedRatio TGEN(PStartA = 4.75e+08, PStartB = -4.75e+08, QStartA = 1.56e+08, QStartB = -7.6e+07, R = 0.15e-2 * 419 ^ 2 / 500, SNom = 5e+08, UNomA = 21000, UNomB = 419000, UPhaseStartA = 0.161146, UPhaseStartB = 0, UStartA = 0.992 * 21e3, UStartB = 1.050 * 380e3, X = 16e-2 * 419 ^ 2 / 500, portVariablesPhases = true, portVariablesPu = true, rFixed = 419 / 21) PowerGrids.Electrical.Controls.TurbineGovernors.IEEE_TGOV1 TGOV(R = 0.05, T1 = 0.5, T2 = 3, T3 = 10, VMax = 1) PowerGrids.Electrical.Controls.ExcitationSystems.IEEE_AC4A AVR(Ka = 200, Ta = 0.05, Tb = 10, Tc = 3, VrMax = 4) PowerGrids.Electrical.Controls.PowerSystemStabilizers.IEEE_PSS2A PSS(Ks1 = 10, Ks2 = 0.1564, M = 0, N = 0, T1 = 0.25, T2 = 0.03, T3 = 0.15, T4 = 0.015, T7 = 2, T8 = 0.5, T9 = 0.1, Tw1 = 2, Tw2 = 2, Tw3 = 2, Tw4 = 0, VstMax = 0.1, VstMin = -0.1) Modelica.Blocks.Sources.RealExpression zero Modelica.Blocks.Sources.RealExpression VrefPu(y = 1.004552) Modelica.Blocks.Sources.RealExpression RefLPu(y = 475 / 500 * 0.05) PowerGrids.Electrical.Loads.LoadImpedancePQ GRIDL(PRef = 4.75e+08, QRef = 7.6e+07, SNom = 5e+08, UNom = 380000, URef = 1.05 * 380e3, portVariablesPhases = true, portVariablesPu = true) Electrical.Buses.EquivalentGrid GRID(R_X = 1 / 10, SNom = 5e+08, SSC = 2.5e+09, UNom = 380000, URef = 1.050 * 380e3, c = 1.1, portVariablesPhases = true, portVariablesPu = true) Types.PerUnit AA_01_GEN_Upu = GEN.port.VPu "Fig. 5.7, terminal voltage"; Types.PerUnit AA_02_GEN_efd = GEN.ufPuIn "Fig. 5.8, excitation voltage"; Types.PerUnit AA_03_GEN_Ppu = GEN.port.PGenPu/0.95 "Fig. 5.9, active power of the synchronous machine"; Types.PerUnit AA_04_GEN_Qpu = GEN.port.QGenPu/0.314583 "Fig. 5.10, reactive power of the synchronous machine"; Types.PerUnit AA_05_GEN_omegapu = GEN.omegaPu "Fig. 5.11, speed"; Types.PerUnit AA_06_PSS_out = PSS.VstPu "Fig. 5.12, PSS output signal"; Types.PerUnit AA_07_GRIDL_Ppu = GRIDL.port.PPu/0.95 "Fig. 5.13, active power of the load"; Types.PerUnit AA_08_GRIDL_Qpu = GRIDL.port.QPu/0.1519 "Fig. 5.14, reactive power of the load"; equation connect(GRID.terminal, NTHV.terminal) connect(VrefPu.y, AVR.VrefPu) connect(TGEN.terminalB, NTHV.terminal) connect(NTHV.terminal, GRIDL.terminal) connect(GEN.PPu, PSS.Vsi2Pu) connect(GEN.VPu, AVR.VcPu) connect(RefLPu.y, TGOV.RefLPu) connect(zero.y, AVR.VuelPu) connect(GEN.omegaPu, PSS.Vsi1Pu) connect(PSS.VstPu, AVR.VsPu) connect(AVR.efdPu, GEN.ufPuIn) connect(GEN.omegaPu, TGOV.omegaPu) connect(TGOV.PMechPu, GEN.PmPu) connect(NTLV.terminal, TGEN.terminalA) connect(GEN.terminal, NTLV.terminal) end TestCase3;
Model of controlled generator for the IEEE 14-bus benchmark - synchronous machine with proportional regulations.
within PowerGrids.Examples.IEEE14bus; model ControlledGeneratorIEEE "Model of controlled generator for the IEEE 14-bus benchmark - synchronous machine with proportional regulations" extends Icons.Machine; PowerGrids.Electrical.Machines.SynchronousMachine4Windings GEN(portVariablesPhases = true) PowerGrids.Interfaces.TerminalAC terminal Electrical.Controls.ExcitationSystems.VRProportional AVR(Ka = 20, VcPuStart = GEN.UStart / GEN.UNom, VrMax = 5, VrMin = -5) Electrical.Controls.TurbineGovernors.GoverProportional GOV(KGover = 5, PMaxPu = 1, PMinPu = 0, PPuStart = -GEN.PStart / GEN.PNom) PowerGrids.Controls.FreeOffset PmRefPu(use_u = true) Controls.FreeOffset VrefPu(use_u = true) Modelica.Blocks.Sources.RealExpression VrefPuDef(y = 1) Modelica.Blocks.Sources.RealExpression PmRefPuDef(y = -GEN.PStart / GEN.PNom) Modelica.Blocks.Interfaces.RealOutput omega equation connect(GEN.terminal, terminal) connect(GOV.omegaPu, GEN.omegaPu) connect(AVR.VcPu, GEN.VPu) connect(AVR.efdPu, GEN.ufPuIn) connect(GOV.PMechPu, GEN.PmPu) connect(PmRefPu.y, GOV.PmRefPu) connect(VrefPu.y, AVR.VrefPu) connect(VrefPuDef.y, VrefPu.u) connect(GEN.PPu, GOV.PPu) connect(PmRefPuDef.y, PmRefPu.u) connect(GEN.omega, omega) end ControlledGeneratorIEEE;
Simulation of the disconnection of generator 2 at t = 1 s.
within PowerGrids.Examples.IEEE14bus; model IEEE14busGen2Disconnection "Simulation of the disconnection of generator 2 at t = 1 s" extends IEEE14busStaticNetwork(Tgen2(useBreaker = true)); Modelica.Blocks.Sources.BooleanExpression Gen2BreakerState(y = time < 1) equation connect(Gen2BreakerState.y, Tgen2.breakerStatusIn) end IEEE14busGen2Disconnection;
Simulation of the opening of line 1 to 5 at t = 1 s.
within PowerGrids.Examples.IEEE14bus; model IEEE14busLine1to5Opening "Simulation of the opening of line 1 to 5 at t = 1 s" extends IEEE14busStaticNetwork(L1to5(useBreakerB = true)); Modelica.Blocks.Sources.BooleanExpression L1to5BreakerState(y = time < 1) equation connect(L1to5BreakerState.y, L1to5.breakerStatusB) end IEEE14busLine1to5Opening;
Simulation of a load increase on load 2 at t = 1 s.
within PowerGrids.Examples.IEEE14bus; model IEEE14busLoad2Variation "Simulation of a load increase on load 2 at t = 1 s" extends IEEE14busStaticNetwork( Load2( PRef = Load2.PRefConst*(if time < 1 then 1 else 2) "Active power consumption at reference voltage", QRef = Load2.QRefConst*(if time < 1 then 1 else 2) "Reactive power consumption at reference voltage" )); equation end IEEE14busLoad2Variation;
Power flow model of the IEEE 14-bus benchmark.
within PowerGrids.Examples.IEEE14bus; model IEEE14busPowerFlow "Power flow model of the IEEE 14-bus benchmark" extends Modelica.Icons.Example; inner PowerGrids.Electrical.System systemPowerGrids // Buses PowerGrids.Electrical.PowerFlow.SlackBus bus1( SNom = 100e6, U = 69e3*1.0598, UNom = 69000 ) PowerGrids.Electrical.Buses.Bus bus2( SNom = 100e6, UNom = 69e3 ) PowerGrids.Electrical.Buses.Bus bus3( SNom = 100e6, UNom = 69e3 ) PowerGrids.Electrical.Buses.Bus bus4( SNom = 100e6, UNom = 69e3 ) PowerGrids.Electrical.Buses.Bus bus5( SNom = 100e6, UNom = 69e3 ) PowerGrids.Electrical.Buses.Bus bus6( SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Buses.Bus bus7( SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Buses.Bus bus8( SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Buses.Bus bus9( SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Buses.Bus bus10( SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Buses.Bus bus11( SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Buses.Bus bus12( SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Buses.Bus bus13( SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Buses.Bus bus14( SNom = 100e6, UNom = 13.8e3 ) // Lines PowerGrids.Electrical.Branches.LineConstantImpedance L1to2( portVariablesPhases = true, R = 0.922682, X = 2.81708, G = 0, B = 0.00110901, SNom = 100e6, UNom = 69e3 ) PowerGrids.Electrical.Branches.LineConstantImpedanceWithBreakers L1to5( portVariablesPhases = true, R = 2.57237, X = 10.6189, B = 0.0010334, G = 0, SNom = 100e6, UNom = 69e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L2to3( portVariablesPhases = true, R = 2.23719, X = 9.42535, G = 0, B = 0.000919975, SNom = 100e6, UNom = 69e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L2to4( portVariablesPhases = true, R = 2.76662, X = 8.3946, G = 0, B = 0.000714136, SNom = 100e6, UNom = 69e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L2to5( portVariablesPhases = true, R = 2.71139, X = 8.27843, G = 0, B = 0.000726738, SNom = 100e6, UNom = 69e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L3to4( portVariablesPhases = true, R = 3.19035, X = 8.14274, G = 0, B = 0.000268851, SNom = 100e6, UNom = 69e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L4to5( portVariablesPhases = true, R = 0.635593, X = 2.00486, G = 0, B = 0, SNom = 100e6, UNom = 69e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L6to11( portVariablesPhases = true, R = 0.18088, X = 0.378785, G = 0, B = 0, SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L6to12( portVariablesPhases = true, R = 0.23407, X = 0.487165, G = 0, B = 0, SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L6to13( portVariablesPhases = true, R = 0.125976, X = 0.248086, G = 0, B = 0, SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L7to8( portVariablesPhases = true, R = 0, X = 0.33546, G = 0, B = 0, SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L7to9( portVariablesPhases = true, R = 0, X = 0.209503, G = 0, B = 0, SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L9to10( portVariablesPhases = true, R = 0.060579, X = 0.160922, G = 0, B = 0, SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L9to14( portVariablesPhases = true, R = 0.242068, X = 0.514912, G = 0, B = 0, SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L10to11( portVariablesPhases = true, R = 0.156256, X = 0.365778, G = 0, B = 0, SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L12to13( portVariablesPhases = true, R = 0.42072, X = 0.380651, G = 0, B = 0, SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L13to14( portVariablesPhases = true, R = 0.325519, X = 0.662763, G = 0, B = 0, SNom = 100e6, UNom = 13.8e3 ) // LOADS PowerGrids.Electrical.PowerFlow.PQBus Load2( portVariablesPhases = true, P = 21.7e6, Q = 12.7e6, SNom = 100e6, UNom = 69e3 ) PowerGrids.Electrical.PowerFlow.PQBus Load3( portVariablesPhases = true, P = 94.2e6, Q = 19.1e6, SNom = 100e6, UNom = 69e3 ) PowerGrids.Electrical.PowerFlow.PQBus Load4( portVariablesPhases = true, P = 47.8e6, Q = -3.9e6, SNom = 100e6, UNom = 69e3 ) PowerGrids.Electrical.PowerFlow.PQBus Load5( portVariablesPhases = true, P = 7.6e6, Q = 1.6e6, SNom = 100e6, UNom = 69e3 ) PowerGrids.Electrical.PowerFlow.PQBus Load6( portVariablesPhases = true, P = 11.2e6, Q = 7.5e6, SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.PowerFlow.PQBus Load9( portVariablesPhases = true, P = 29.5e6, Q = 16.6e6, SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.PowerFlow.PQBus Load10( portVariablesPhases = true, P = 9e6, Q = 5.8e6, SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.PowerFlow.PQBus Load11( portVariablesPhases = true, P = 3.5e6, Q = 1.8e6, SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.PowerFlow.PQBus Load12( portVariablesPhases = true, P = 6.1e6, Q = 1.6e6, SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.PowerFlow.PQBus Load13( portVariablesPhases = true, P = 13.8e6, Q = 5.8e6, SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.PowerFlow.PQBus Load14( portVariablesPhases = true, P = 14.9e6, Q = 5e6, SNom = 100e6, UNom = 13.8e3 ) // Capacitor bank PowerGrids.Electrical.Banks.CapacitorBankFixed Cbank9( portVariablesPhases = true, B = 0.099769, SNom = 100e6, UNom = 13.8e3 ) // Transformers PowerGrids.Electrical.Branches.TransformerFixedRatio T4to7( portVariablesPhases = true, R = 0, X = 0.398248, B = 0, G = 0, rFixed = 0.204082, SNom = 100e6, UNomA = 69e3, UNomB = 13.8e3 ) PowerGrids.Electrical.Branches.TransformerFixedRatio T4to9( portVariablesPhases = true, R = 0, X = 1.05919, B = 0, G = 0, rFixed = 0.208333, SNom = 100e6, UNomA = 69.0e3, UNomB = 13.8e3 ) PowerGrids.Electrical.Branches.TransformerFixedRatio T5to6( portVariablesPhases = true, R = 0, X = 0.479948, B = 0, G = 0, rFixed = 0.212766, SNom = 100e6, UNomA = 69e3, UNomB = 13.8e3 ) PowerGrids.Electrical.Branches.TransformerFixedRatio Tgen1( portVariablesPhases = true, R = 0, X = 0.393146, B = 0, G = 0, rFixed = 2.875, SNom = 1211e6, UNomA = 24e3, UNomB = 69e3 ) PowerGrids.Electrical.Branches.TransformerFixedRatioWithBreaker Tgen2( portVariablesPhases = true, R = 0, X = 0.425089, B = 0, G = 0, rFixed = 2.875, SNom = 1120e6, UNomA = 24e3, UNomB = 69e3 ) PowerGrids.Electrical.Branches.TransformerFixedRatio Tgen3( portVariablesPhases = true, R = 0, X = 0.288545, B = 0, G = 0, rFixed = 3.45, SNom = 1650e6, UNomA = 20e3, UNomB = 69e3 ) PowerGrids.Electrical.Branches.TransformerFixedRatio Tgen8( portVariablesPhases = true, R = 0, X = 0.076176, B = 0, G = 0, rFixed = 0.766667, SNom = 250e6, UNomA = 18e3, UNomB = 13.8e3 ) // Generators PowerGrids.Electrical.PowerFlow.PVBus GEN1( portVariablesPhases = true, SNom = 1211e6, UNom = 24e3, P = -232.36955e6, U = 25.4068e3 ) PowerGrids.Electrical.PowerFlow.PVBus GEN2( portVariablesPhases = true, SNom = 1120e6, UNom = 24e3, U = 25.1608e3, P = -40e6 ) PowerGrids.Electrical.PowerFlow.PVBus GEN3( portVariablesPhases = true, SNom = 1650e6, UNom = 20e3, U = 20.229e3, P = 0.0 ) PowerGrids.Electrical.PowerFlow.PVBus GEN6( portVariablesPhases = true, SNom = 80.0e6, UNom = 13.8e3, U = 14.7347e3, P = 0 ) PowerGrids.Electrical.PowerFlow.PVBus GEN8( portVariablesPhases = true, SNom = 250e6, UNom = 18e3, U = 19.6461e3, P = 0 ) equation connect(bus12.terminal, L6to12.terminalB) connect(L12to13.terminalA, bus12.terminal) connect(L12to13.terminalB, bus13.terminal) connect(L6to12.terminalA, bus6.terminal) connect(L6to13.terminalA, bus6.terminal) connect(L6to13.terminalB, bus13.terminal) connect(bus13.terminal, L6to13.terminalB) connect(L6to11.terminalA, bus6.terminal) connect(L6to11.terminalB, bus11.terminal) connect(L13to14.terminalA, bus13.terminal) connect(L13to14.terminalB, bus14.terminal) connect(L9to14.terminalB, bus14.terminal) connect(L9to14.terminalA, bus9.terminal) connect(L10to11.terminalB, bus11.terminal) connect(L10to11.terminalA, bus10.terminal) connect(L9to10.terminalB, bus10.terminal) connect(L9to10.terminalA, bus9.terminal) connect(L7to8.terminalA, bus7.terminal) connect(L7to9.terminalA, bus7.terminal) connect(L7to9.terminalB, bus9.terminal) connect(L7to8.terminalB, bus8.terminal) connect(T4to9.terminalA, bus4.terminal) connect(T4to9.terminalB, bus9.terminal) connect(T5to6.terminalB, bus6.terminal) connect(T5to6.terminalA, bus5.terminal) connect(L1to2.terminalA, bus1.terminal) connect(L1to2.terminalB, bus2.terminal) connect(L1to5.terminalA, bus1.terminal) connect(L1to5.terminalB, bus5.terminal) connect(L2to5.terminalB, bus5.terminal) connect(L4to5.terminalB, bus5.terminal) connect(L2to5.terminalA, bus2.terminal) connect(L2to4.terminalA, bus2.terminal) connect(L3to4.terminalB, bus4.terminal) connect(L3to4.terminalA, bus3.terminal) connect(L2to4.terminalB, bus4.terminal) connect(L4to5.terminalA, bus4.terminal) connect(L2to3.terminalB, bus3.terminal) connect(Tgen8.terminalB, bus8.terminal) connect(Tgen3.terminalB, bus3.terminal) connect(Tgen2.terminalB, bus2.terminal) connect(Tgen1.terminalB, bus1.terminal) connect(Load12.terminal, bus12.terminal) connect(bus13.terminal, Load13.terminal) connect(Load14.terminal, bus14.terminal) connect(Load11.terminal, bus11.terminal) connect(Load10.terminal, bus10.terminal) connect(Cbank9.terminal, bus9.terminal) connect(Load9.terminal, bus9.terminal) connect(Load6.terminal, bus6.terminal) connect(Load5.terminal, bus5.terminal) connect(Load3.terminal, bus3.terminal) connect(Load2.terminal, bus2.terminal) connect(L2to3.terminalA, bus2.terminal) connect(Tgen1.terminalA, GEN1.terminal) connect(GEN2.terminal, Tgen2.terminalA) connect(Tgen3.terminalA, GEN3.terminal) connect(GEN8.terminal, Tgen8.terminalA) connect(Load4.terminal, bus4.terminal) connect(GEN6.terminal, bus6.terminal) connect(T4to7.terminalA, bus4.terminal) connect(T4to7.terminalB, bus7.terminal) end IEEE14busPowerFlow;
Dynamic model of the IEEE 14-bus system, operating in steady-state.
within PowerGrids.Examples.IEEE14bus; model IEEE14busStaticNetwork "Dynamic model of the IEEE 14-bus system, operating in steady-state" extends Modelica.Icons.Example; inner PowerGrids.Electrical.System systemPowerGrids(initOpt = PowerGrids.Types.Choices.InitializationOption.globalSteadyStateFixedPowerFlow, referenceFrequency = PowerGrids.Types.Choices.ReferenceFrequency.fixedReferenceGenerator) // Buses PowerGrids.Electrical.Buses.ReferenceBus bus1( SNom = 100e6, UNom = 69e3, UStart = 69e3*1.0598 ) PowerGrids.Electrical.Buses.Bus bus2( SNom = 100e6, UNom = 69e3 ) PowerGrids.Electrical.Buses.Bus bus3( SNom = 100e6, UNom = 69e3 ) PowerGrids.Electrical.Buses.Bus bus4( SNom = 100e6, UNom = 69e3 ) PowerGrids.Electrical.Buses.Bus bus5( SNom = 100e6, UNom = 69e3 ) PowerGrids.Electrical.Buses.Bus bus6( SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Buses.Bus bus7( SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Buses.Bus bus8( SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Buses.Bus bus9( SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Buses.Bus bus10( SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Buses.Bus bus11( SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Buses.Bus bus12( SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Buses.Bus bus13( SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Buses.Bus bus14( SNom = 100e6, UNom = 13.8e3 ) // Lines PowerGrids.Electrical.Branches.LineConstantImpedance L1to2( portVariablesPhases = true, R = 0.922682, X = 2.81708, G = 0, B = 0.00110901, SNom = 100e6, UNom = 69e3 ) PowerGrids.Electrical.Branches.LineConstantImpedanceWithBreakers L1to5( portVariablesPhases = true, R = 2.57237, X = 10.6189, G = 0, B = 0.0010334, SNom = 100e6, UNom = 69e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L2to3( portVariablesPhases = true, R = 2.23719, X = 9.42535, G = 0, B = 0.000919975, SNom = 100e6, UNom = 69e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L2to4( portVariablesPhases = true, R = 2.76662, X = 8.3946, G = 0, B = 0.000714136, SNom = 100e6, UNom = 69e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L2to5( portVariablesPhases = true, R = 2.71139, X = 8.27843, G = 0, B = 0.000726738, SNom = 100e6, UNom = 69e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L3to4( portVariablesPhases = true, R = 3.19035, X = 8.14274, G = 0, B = 0.000268851, SNom = 100e6, UNom = 69e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L4to5( portVariablesPhases = true, R = 0.635593, X = 2.00486, G = 0, B = 0, SNom = 100e6, UNom = 69e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L6to11( portVariablesPhases = true, R = 0.18088, X = 0.378785, G = 0, B = 0, SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L6to12( R = 0.23407, portVariablesPhases = true, X = 0.487165, G = 0, B = 0, SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L6to13( portVariablesPhases = true, R = 0.125976, X = 0.248086, G = 0, B = 0, SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L7to8( portVariablesPhases = true, R = 0, X = 0.33546, G = 0, B = 0, SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L7to9( portVariablesPhases = true, R = 0, X = 0.209503, G = 0, B = 0, SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L9to10( portVariablesPhases = true, R = 0.060579, X = 0.160922, G = 0, B = 0, SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L9to14( portVariablesPhases = true, R = 0.242068, X = 0.514912, G = 0, B = 0, SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L10to11( portVariablesPhases = true, R = 0.156256, X = 0.365778, G = 0, B = 0, SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L12to13( portVariablesPhases = true, R = 0.42072, X = 0.380651, G = 0, B = 0, SNom = 100e6, UNom = 13.8e3 ) PowerGrids.Electrical.Branches.LineConstantImpedance L13to14( portVariablesPhases = true, R = 0.325519, X = 0.662763, G = 0, B = 0, SNom = 100e6, UNom = 13.8e3 ) // Loads PowerGrids.Electrical.Loads.LoadPQVoltageDependence Load2( alpha = 1.5, beta = 2.5, PRefConst = 21.7e6, QRefConst = 12.7e6, SNom = 100e6, UNom = 69e3, URef = 72.105e3, UStart = 72.0866e3, UPhaseStart = -0.087 ) PowerGrids.Electrical.Loads.LoadPQVoltageDependence Load3( alpha = 1.5, beta = 2.5, PRefConst = 94.2e6, QRefConst = 19.1e6, SNom = 100e6, UNom = 69e3, URef = 69.69e3, UStart = 69.685e3, UPhaseStart = -0.22231 ) PowerGrids.Electrical.Loads.LoadPQVoltageDependence Load4( alpha = 1.5, beta = 2.5, PRefConst = 47.8e6, QRefConst = -3.9e6, SNom = 100e6, UNom = 69e3, URef = 70.2756e3, UStart = 70.2049e3, UPhaseStart = -0.180223 ) PowerGrids.Electrical.Loads.LoadPQVoltageDependence Load5( alpha = 1.5, beta = 2.5, PRefConst = 7.6e6, QRefConst = 1.6e6, SNom = 100e6, UNom = 69e3, URef = 70.4552e3, UStart = 70.3898e3, UPhaseStart = -0.153511 ) PowerGrids.Electrical.Loads.LoadPQVoltageDependence Load6( alpha = 1.5, beta = 2.5, PRefConst = 11.2e6, QRefConst = 7.5e6, SNom = 100e6, UNom = 13.8e3, URef = 14.766e3, UStart = 14.7347e3, UPhaseStart = -0.249364 ) PowerGrids.Electrical.Loads.LoadPQVoltageDependence Load9( alpha = 1.5, beta = 2.5, PRefConst = 29.5e6, QRefConst = 16.6e6, SNom = 100e6, UNom = 13.8e3, URef = 14.5966e3, UStart = 14.5624e3, UPhaseStart = -0.261599 ) PowerGrids.Electrical.Loads.LoadPQVoltageDependence Load10( alpha = 1.5, beta = 2.5, PRefConst = 9e6, QRefConst = 5.8e6, SNom = 100e6, UNom = 13.8e3, URef = 14.5241e3, UStart = 14.4903e3, UPhaseStart = -0.264445 ) PowerGrids.Electrical.Loads.LoadPQVoltageDependence Load11( alpha = 1.5, beta = 2.5, PRefConst = 3.5e6, QRefConst = 1.8e6, SNom = 100e6, UNom = 13.8e3, URef = 14.5959e3, UStart = 14.5633e3, UPhaseStart = -0.259223 ) PowerGrids.Electrical.Loads.LoadPQVoltageDependence Load12( alpha = 1.5, beta = 2.5, PRefConst = 6.1e6, QRefConst = 1.6e6, SNom = 100e6, UNom = 13.8e3, URef = 14.499e3, UStart = 14.5308e3, UPhaseStart = -0.264428 ) PowerGrids.Electrical.Loads.LoadPQVoltageDependence Load13( alpha = 1.5, beta = 2.5, PRefConst = 13.8e6, QRefConst = 5.8e6, SNom = 100e6, UNom = 13.8e3, URef = 14.5634e3, UStart = 14.4648e3, UPhaseStart = -0.265952 ) PowerGrids.Electrical.Loads.LoadPQVoltageDependence Load14( alpha = 1.5, beta = 2.5, PRefConst = 14.9e6, QRefConst = 5e6, SNom = 100e6, UNom = 13.8e3, URef = 14.3062e3, UStart = 14.2714e3, UPhaseStart = -0.281002 ) // Capacitor Bank PowerGrids.Electrical.Banks.CapacitorBankFixed Cbank9( B = 0.099769, SNom = 100e6, UNom = 13.8e3 ) // Transformers PowerGrids.Electrical.Branches.TransformerFixedRatio T4to7( R = 0, X = 0.398248, B = 0, G = 0, rFixed = 0.204082, SNom = 100e6, UNomA = 69e3, UNomB = 13.8e3 ) PowerGrids.Electrical.Branches.TransformerFixedRatio T4to9( R = 0, X = 1.05919, B = 0, G = 0, rFixed = 0.208333, SNom = 100e6, UNomA = 69.0e3, UNomB = 13.8e3 ) PowerGrids.Electrical.Branches.TransformerFixedRatio T5to6( R = 0, X = 0.479948, B = 0, G = 0, rFixed = 0.212766, SNom = 100e6, UNomA = 69e3, UNomB = 13.8e3 ) PowerGrids.Electrical.Branches.TransformerFixedRatio Tgen1( portVariablesPhases = true, R = 0, X = 0.393146, B = 0, G = 0, rFixed = 2.875, SNom = 1211e6, UNomA = 24e3, UNomB = 69e3 ) PowerGrids.Electrical.Branches.TransformerFixedRatioWithBreaker Tgen2( portVariablesPhases = true, R = 0, X = 0.425089, B = 0, G = 0, rFixed = 2.875, SNom = 1120e6, UNomA = 24e3, UNomB = 69e3 ) PowerGrids.Electrical.Branches.TransformerFixedRatio Tgen3( portVariablesPhases = true, R = 0, X = 0.288545, B = 0, G = 0, rFixed = 3.45, SNom = 1650e6, UNomA = 20e3, UNomB = 69e3 ) PowerGrids.Electrical.Branches.TransformerFixedRatio Tgen8( portVariablesPhases = true, R = 0, X = 0.076176, B = 0, G = 0, rFixed = 0.766667, SNom = 250e6, UNomA = 18e3, UNomB = 13.8e3 ) // Generators PowerGrids.Examples.IEEE14bus.ControlledGeneratorIEEE GEN1( GEN( DPu = 0.0, H = 5.4, Tppd0 = 0.08, xpdPu = 0.384, Tpd0 = 8.094, raPu = 0.002796, xpqPu = 0.393, Tppq0 = 0.084, Tpq0 = 1.572, xppdPu = 0.264, xdPu = 2.22, xlPu = 0.202, xppqPu = 0.262, xqPu = 2.22, PNom = 1090e6, SNom = 1211e6, UNom = 24e3, PStart = -232.37e6, QStart = 15.7473e6, UStart = 25.4068e3, UPhaseStart = 0.0171006 ) ) PowerGrids.Examples.IEEE14bus.ControlledGeneratorIEEE GEN2( GEN( DPu = 0.0, H = 5.4, Tppd0 = 0.058, xpdPu = 0.407, Tpd0 = 9.651, raPu = 0.00357, xpqPu = 0.454, Tppq0 = 0.06, Tpq0 = 1.009, xppdPu = 0.3, xdPu = 2.57, xlPu = 0.219, xppqPu = 0.301, xqPu = 2.57, PNom = 1008e6, SNom = 1120e6, UNom = 24e3, PStart = -40e6, QStart = -42.7306e6, UStart = 25.1608e3, UPhaseStart = -0.0837392 ) ) PowerGrids.Examples.IEEE14bus.SynchronousCondenser GEN3( GEN( DPu = 0.0, H = 5.625, Tppd0 = 0.065, xpdPu = 0.509, Tpd0 = 10.041, raPu = 0.00316, xpqPu = 0.601, Tppq0 = 0.094, Tpq0 = 1.22, xppdPu = 0.354, xdPu = 2.81, xlPu = 0.256, xppqPu = 0.377, xqPu = 2.62, PNom = 1485e6, SNom = 1650e6, UNom = 20e3, PStart = 0.0, QStart = -25.3998e6, UStart = 20.229e3, UPhaseStart = -0.22231 ) ) PowerGrids.Examples.IEEE14bus.SynchronousCondenser GEN6( GEN( xpqPu = 0.225, Tpq0 = 3.0, DPu = 0.0, H = 4.975, Tppd0 = 0.04, xpdPu = 0.225, Tpd0 = 3.0, raPu = 0.004, Tppq0 = 0.06, xppdPu = 0.154, xdPu = 0.75, xlPu = 0.102, xppqPu = 0.154, xqPu = 0.45, PNom = 71.8e6, SNom = 80.0e6, UNom = 13.8e3, PStart = 0, QStart = -15.0186e6, UStart = 14.7347e3, UPhaseStart = -0.249364 ) ) PowerGrids.Examples.IEEE14bus.SynchronousCondenser GEN8( GEN( xpqPu = 0.31, Tpq0 = 8.4, DPu = 0.0, H = 2.748, Tppd0 = 0.096, xpdPu = 0.31, Tpd0 = 8.4, raPu = 0.004, Tppq0 = 0.1, xppdPu = 0.275, xdPu = 1.53, xlPu = 0.11, xppqPu = 0.346, xqPu = 0.99, PNom = 242e6, SNom = 250e6, UNom = 18e3, PStart = 0, QStart = -16.2253e6, UStart = 19.6461e3, UPhaseStart = -0.233851 ) ) equation connect(bus12.terminal, L6to12.terminalB) connect(L12to13.terminalA, bus12.terminal) connect(L12to13.terminalB, bus13.terminal) connect(L6to12.terminalA, bus6.terminal) connect(L6to13.terminalA, bus6.terminal) connect(L6to13.terminalB, bus13.terminal) connect(bus13.terminal, L6to13.terminalB) connect(L6to11.terminalA, bus6.terminal) connect(L6to11.terminalB, bus11.terminal) connect(L13to14.terminalA, bus13.terminal) connect(L13to14.terminalB, bus14.terminal) connect(L9to14.terminalB, bus14.terminal) connect(L9to14.terminalA, bus9.terminal) connect(L10to11.terminalB, bus11.terminal) connect(L10to11.terminalA, bus10.terminal) connect(L9to10.terminalB, bus10.terminal) connect(L9to10.terminalA, bus9.terminal) connect(L7to8.terminalA, bus7.terminal) connect(L7to9.terminalA, bus7.terminal) connect(L7to9.terminalB, bus9.terminal) connect(L7to8.terminalB, bus8.terminal) connect(T4to9.terminalA, bus4.terminal) connect(T4to9.terminalB, bus9.terminal) connect(T5to6.terminalB, bus6.terminal) connect(T5to6.terminalA, bus5.terminal) connect(L1to2.terminalA, bus1.terminal) connect(L1to2.terminalB, bus2.terminal) connect(L1to5.terminalA, bus1.terminal) connect(L1to5.terminalB, bus5.terminal) connect(L2to5.terminalB, bus5.terminal) connect(L4to5.terminalB, bus5.terminal) connect(L2to5.terminalA, bus2.terminal) connect(L2to4.terminalA, bus2.terminal) connect(L3to4.terminalB, bus4.terminal) connect(L3to4.terminalA, bus3.terminal) connect(L2to4.terminalB, bus4.terminal) connect(L4to5.terminalA, bus4.terminal) connect(L2to3.terminalB, bus3.terminal) connect(Tgen8.terminalB, bus8.terminal) connect(Tgen3.terminalB, bus3.terminal) connect(Tgen2.terminalB, bus2.terminal) connect(Tgen1.terminalB, bus1.terminal) connect(Load12.terminal, bus12.terminal) connect(bus13.terminal, Load13.terminal) connect(Load14.terminal, bus14.terminal) connect(Load11.terminal, bus11.terminal) connect(Load10.terminal, bus10.terminal) connect(Cbank9.terminal, bus9.terminal) connect(Load9.terminal, bus9.terminal) connect(Load6.terminal, bus6.terminal) connect(Load5.terminal, bus5.terminal) connect(Load3.terminal, bus3.terminal) connect(Load2.terminal, bus2.terminal) connect(L2to3.terminalA, bus2.terminal) connect(Tgen1.terminalA, GEN1.terminal) connect(GEN2.terminal, Tgen2.terminalA) connect(Tgen3.terminalA, GEN3.terminal) connect(GEN8.terminal, Tgen8.terminalA) connect(Load4.terminal, bus4.terminal) connect(GEN6.terminal, bus6.terminal) connect(T4to7.terminalA, bus4.terminal) connect(T4to7.terminalB, bus7.terminal) connect(GEN1.omega, systemPowerGrids.omegaRefIn) end IEEE14busStaticNetwork;
Information
within PowerGrids.Examples.IEEE14bus; package Info "Information" extends Modelica.Icons.Information; end Info;
Classical IEEE14 bus network
within PowerGrids.Examples; package IEEE14bus "Classical IEEE14 bus network" extends Modelica.Icons.ExamplesPackage; end IEEE14bus;
Model of a synchronous condenser for the IEEE-14 bus system.
within PowerGrids.Examples.IEEE14bus; model SynchronousCondenser "Model of a synchronous condenser for the IEEE-14 bus system" extends Icons.Machine; PowerGrids.Electrical.Machines.SynchronousMachine4Windings GEN(portVariablesPhases = true) PowerGrids.Interfaces.TerminalAC terminal Electrical.Controls.ExcitationSystems.VRProportional AVR(Ka = 20, VcPuStart = GEN.UStart / GEN.UNom, VrMax = 5, VrMin = -5) Controls.FreeOffset VrefPu(use_u = true) Modelica.Blocks.Sources.RealExpression VrefPuDef(y = 1) Modelica.Blocks.Sources.RealExpression PmPu(y = 0) Modelica.Blocks.Interfaces.RealOutput omega equation connect(GEN.terminal, terminal) connect(AVR.VcPu, GEN.VPu) connect(AVR.efdPu, GEN.ufPuIn) connect(VrefPu.y, AVR.VrefPu) connect(VrefPuDef.y, VrefPu.u) connect(GEN.omega, omega) connect(PmPu.y, GEN.PmPu) end SynchronousCondenser;
Tutorial examples of increasing complexity
within PowerGrids.Examples; package Tutorial "Tutorial examples of increasing complexity" extends Modelica.Icons.ExamplesPackage; end Tutorial;
Examples of grid-connected systems
within PowerGrids.Examples.Tutorial; package GridOperation "Examples of grid-connected systems" extends Modelica.Icons.ExamplesPackage; end GridOperation;
Model of a synchronous generator with governor, AVR, and PSS.
within PowerGrids.Examples.Tutorial.GridOperation.Controlled; model ControlledGenerator "Model of a synchronous generator with governor, AVR, and PSS" extends Icons.Machine; PowerGrids.Electrical.Machines.SynchronousMachine4Windings GEN(H = 4, PStart = -4.75e+08, QStart = -1.56e+08,SNom = 5e+08, Tpd0 = 5.143, Tppd0 = 0.042, Tppq0 = 0.083, Tpq0 = 2.16, UNom = 21000, UPhaseStart = 0.161156, UStart = 21e3 * 0.9917, portVariablesPhases = true, raPu = 0, xdPu = 2, xlPu = 0.15, xpdPu = 0.35, xppdPu = 0.25, xppqPu = 0.3, xpqPu = 0.5, xqPu = 1.8) PowerGrids.Electrical.Controls.TurbineGovernors.IEEE_TGOV1 TGOV(PMechPuStart = -GEN.PStart / GEN.SNom,R = 0.05, T1 = 0.5, T2 = 3, T3 = 10, VMax = 1) PowerGrids.Electrical.Controls.ExcitationSystems.IEEE_AC4A AVR(Ka = 200, Ta = 0.05, Tb = 10, Tc = 3, VcPuStart = GEN.UStart / GEN.UNom, VrMax = 4) Modelica.Blocks.Sources.RealExpression zero PowerGrids.Electrical.Controls.PowerSystemStabilizers.IEEE_PSS2A PSS(Ks1 = 10, Ks2 = 0.1564, M = 0, N = 0, T1 = 0.25, T2 = 0.03, T3 = 0.15, T4 = 0.015, T7 = 2, T8 = 0.5, T9 = 0.1, Tw1 = 2, Tw2 = 2, Tw3 = 2, Tw4 = 0, VstMax = 0.1, VstMin = -0.1) PowerGrids.Interfaces.TerminalAC terminal PowerGrids.Controls.FreeOffset RefLPu PowerGrids.Controls.FreeOffset VrefPu Modelica.Blocks.Interfaces.RealOutput omega "Angular frequency / (rad/s)" equation connect(GEN.ufPuIn, AVR.efdPu) connect(TGOV.PMechPu, GEN.PmPu) connect(GEN.VPu, AVR.VcPu) connect(PSS.VstPu, AVR.VsPu) connect(PSS.Vsi2Pu, GEN.PPu) connect(GEN.terminal, terminal) connect(RefLPu.y, TGOV.RefLPu) connect(VrefPu.y, AVR.VrefPu) connect(GEN.omegaPu, TGOV.omegaPu) connect(AVR.VuelPu, zero.y) connect(GEN.omegaPu, PSS.Vsi1Pu) connect(GEN.omega, omega) end ControlledGenerator;
Variant of ControlledGridWithPSS.
within PowerGrids.Examples.Tutorial.GridOperation.Controlled; model ControlledGridParametersChange "Variant of ControlledGridWithPSS" extends Modelica.Icons.Example; extends Examples.Tutorial.GridOperation.Controlled.ControlledGridWithPSS( TGOV(T1 = 0.4 "Governor new time constant"), AVR(Ka = 210 "Overall new equivalent gain") ); end ControlledGridParametersChange;
System under automatic control with high-level controlled generator component.
within PowerGrids.Examples.Tutorial.GridOperation.Controlled; model ControlledGridWithControlledGen "System under automatic control with high-level controlled generator component" extends Modelica.Icons.Example; inner PowerGrids.Electrical.System systemPowerGrids(initOpt = PowerGrids.Types.Choices.InitializationOption.globalSteadyStateFixedPowerFlow) PowerGrids.Electrical.Buses.Bus NTLV(SNom = 5e+08, UNom = 21000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Branches.TransformerFixedRatio TGEN(PStartA = 4.75e+08, PStartB = -4.75e+08, QStartA = 1.56e+08, QStartB = -7.6e+07, R = 0.15e-2 * 419 ^ 2 / 500, SNom = 5e+08, UNomA = 21000, UNomB = 419000, UPhaseStartA = 0.161156, UPhaseStartB = 0, UStartA = 0.9917 * 21e3, UStartB = 0.95227 * 380e3, X = 16e-2 * 419 ^ 2 / 500, portVariablesPhases = true, portVariablesPu = true, rFixed = 419 / 21) PowerGrids.Electrical.Buses.EquivalentGrid GRID(R_X = 1 / 10, SNom = 5e+08, SSC = 2.5e+09, UNom = 380000, URef = 1.05 * 380e3, c = 1.1, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Loads.LoadImpedancePQ GRIDL(PRefConst = 4.75e+08, QRefConst = 7.6e+07, SNom = 5e+08, UNom = 380000, URef = 1.05 * 380e3, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Buses.BusFault NTHV(R = 0.05,SNom = 5e+08, UNom = 380000, UPhaseStart = 0, UStart = 1.050 * 380e3,portVariablesPhases = true, portVariablesPu = true, startTime = 2, stopTime = 2.1) PowerGrids.Examples.Tutorial.GridOperation.Controlled.ControlledGenerator ctrlGEN(AVR(Ka = 150)) equation connect(NTLV.terminal, TGEN.terminalA) connect(TGEN.terminalB, NTHV.terminal) connect(NTHV.terminal, GRID.terminal) connect(NTHV.terminal, GRIDL.terminal) connect(ctrlGEN.terminal, NTLV.terminal) end ControlledGridWithControlledGen;
System under automatic control without PSS.
within PowerGrids.Examples.Tutorial.GridOperation.Controlled; model ControlledGridWithoutPSS "System under automatic control without PSS" extends Modelica.Icons.Example; inner PowerGrids.Electrical.System systemPowerGrids PowerGrids.Electrical.Machines.SynchronousMachine4Windings GEN(H = 4, PStart = -4.75e+08, QStart = -1.56e+08,SNom = 5e+08, Tpd0 = 5.143, Tppd0 = 0.042, Tppq0 = 0.083, Tpq0 = 2.16, UNom = 21000, UPhaseStart = 0.161156, UStart = 21e3 * 0.9917, portVariablesPhases = true, raPu = 0, xdPu = 2, xlPu = 0.15, xpdPu = 0.35, xppdPu = 0.25, xppqPu = 0.3, xpqPu = 0.5, xqPu = 1.8) PowerGrids.Electrical.Buses.Bus NTLV(SNom = 5e+08, UNom = 21000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Branches.TransformerFixedRatio TGEN(PStartA = 4.75e+08, PStartB = -4.75e+08, QStartA = 1.56e+08, QStartB = -7.6e+07, R = 0.15e-2 * 419 ^ 2 / 500, SNom = 5e+08, UNomA = 21000, UNomB = 419000, UPhaseStartA = 0.161156, UPhaseStartB = 0, UStartA = 0.9917 * 21e3, UStartB = 0.95227 * 380e3, X = 16e-2 * 419 ^ 2 / 500, portVariablesPhases = true, portVariablesPu = true, rFixed = 419 / 21) PowerGrids.Electrical.Buses.EquivalentGrid GRID(R_X = 1 / 10, SNom = 5e+08, SSC = 2.5e+09, UNom = 380000, URef = 1.05 * 380e3, c = 1.1, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Loads.LoadImpedancePQ GRIDL(PRefConst = 4.75e+08, QRefConst = 7.6e+07, SNom = 5e+08, UNom = 380000, URef = 1.05 * 380e3, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Controls.TurbineGovernors.IEEE_TGOV1 TGOV(R = 0.05, T1 = 0.5, T2 = 3, T3 = 10, VMax = 1) PowerGrids.Electrical.Controls.ExcitationSystems.IEEE_AC4A AVR(Ka = 200, Ta = 0.05, Tb = 10, Tc = 3, VrMax = 4) Modelica.Blocks.Sources.RealExpression zero Modelica.Blocks.Sources.RealExpression VrefPu(y = 1.004552) Modelica.Blocks.Sources.RealExpression RefLPu(y = 475 / 500 * 0.05) PowerGrids.Electrical.Buses.BusFault NTHV(R = 0.05,SNom = 5e+08, UNom = 380000, UPhaseStart = 0, UStart = 1.050 * 380e3,portVariablesPhases = true, portVariablesPu = true, startTime = 2, stopTime = 2.1) equation connect(GEN.terminal, NTLV.terminal) connect(NTLV.terminal, TGEN.terminalA) connect(TGEN.terminalB, NTHV.terminal) connect(NTHV.terminal, GRID.terminal) connect(NTHV.terminal, GRIDL.terminal) connect(RefLPu.y, TGOV.RefLPu) connect(AVR.VrefPu, VrefPu.y) connect(AVR.VsPu, zero.y) connect(AVR.VuelPu, zero.y) connect(GEN.ufPuIn, AVR.efdPu) connect(TGOV.PMechPu, GEN.PmPu) connect(GEN.VPu, AVR.VcPu) connect(GEN.omegaPu, TGOV.omegaPu) end ControlledGridWithoutPSS;
System under automatic control including PSS.
within PowerGrids.Examples.Tutorial.GridOperation.Controlled; model ControlledGridWithPSS "System under automatic control including PSS" extends Modelica.Icons.Example; inner PowerGrids.Electrical.System systemPowerGrids PowerGrids.Electrical.Machines.SynchronousMachine4Windings GEN(H = 4, PStart = -4.75e+08, QStart = -1.56e+08,SNom = 5e+08, Tpd0 = 5.143, Tppd0 = 0.042, Tppq0 = 0.083, Tpq0 = 2.16, UNom = 21000, UPhaseStart = 0.161156, UStart = 21e3 * 0.9917, portVariablesPhases = true, raPu = 0, xdPu = 2, xlPu = 0.15, xpdPu = 0.35, xppdPu = 0.25, xppqPu = 0.3, xpqPu = 0.5, xqPu = 1.8) PowerGrids.Electrical.Buses.Bus NTLV(SNom = 5e+08, UNom = 21000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Branches.TransformerFixedRatio TGEN(PStartA = 4.75e+08, PStartB = -4.75e+08, QStartA = 1.56e+08, QStartB = -7.6e+07, R = 0.15e-2 * 419 ^ 2 / 500, SNom = 5e+08, UNomA = 21000, UNomB = 419000, UPhaseStartA = 0.161156, UPhaseStartB = 0, UStartA = 0.9917 * 21e3, UStartB = 0.95227 * 380e3, X = 16e-2 * 419 ^ 2 / 500, portVariablesPhases = true, portVariablesPu = true, rFixed = 419 / 21) PowerGrids.Electrical.Buses.EquivalentGrid GRID(R_X = 1 / 10, SNom = 5e+08, SSC = 2.5e+09, UNom = 380000, URef = 1.05 * 380e3, c = 1.1, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Loads.LoadImpedancePQ GRIDL(PRefConst = 4.75e+08, QRefConst = 7.6e+07, SNom = 5e+08, UNom = 380000, URef = 1.05 * 380e3, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Controls.TurbineGovernors.IEEE_TGOV1 TGOV(R = 0.05, T1 = 0.5, T2 = 3, T3 = 10, VMax = 1) PowerGrids.Electrical.Controls.ExcitationSystems.IEEE_AC4A AVR(Ka = 200, Ta = 0.05, Tb = 10, Tc = 3, VrMax = 4) Modelica.Blocks.Sources.RealExpression zero Modelica.Blocks.Sources.RealExpression VrefPu(y = 1.004552) Modelica.Blocks.Sources.RealExpression RefLPu(y = 475 / 500 * 0.05) PowerGrids.Electrical.Buses.BusFault NTHV(R = 0.05,SNom = 5e+08, UNom = 380000, UPhaseStart = 0, UStart = 1.050 * 380e3,portVariablesPhases = true, portVariablesPu = true, startTime = 2, stopTime = 2.1) PowerGrids.Electrical.Controls.PowerSystemStabilizers.IEEE_PSS2A PSS(Ks1 = 10, Ks2 = 0.1564, M = 0, N = 0, T1 = 0.25, T2 = 0.03, T3 = 0.15, T4 = 0.015, T7 = 2, T8 = 0.5, T9 = 0.1, Tw1 = 2, Tw2 = 2, Tw3 = 2, Tw4 = 0, VstMax = 0.1, VstMin = -0.1) equation connect(GEN.terminal, NTLV.terminal) connect(NTLV.terminal, TGEN.terminalA) connect(TGEN.terminalB, NTHV.terminal) connect(NTHV.terminal, GRID.terminal) connect(NTHV.terminal, GRIDL.terminal) connect(RefLPu.y, TGOV.RefLPu) connect(AVR.VrefPu, VrefPu.y) connect(AVR.VuelPu, zero.y) connect(GEN.ufPuIn, AVR.efdPu) connect(TGOV.PMechPu, GEN.PmPu) connect(GEN.VPu, AVR.VcPu) connect(GEN.omegaPu, TGOV.omegaPu) connect(PSS.VstPu, AVR.VsPu) connect(PSS.Vsi1Pu, GEN.omegaPu) connect(PSS.Vsi2Pu, GEN.PPu) end ControlledGridWithPSS;
System under automatic control with automatic computation of set point offsets.
within PowerGrids.Examples.Tutorial.GridOperation.Controlled; model ControlledGridWithReferenceCalculation "System under automatic control with automatic computation of set point offsets" extends Modelica.Icons.Example; inner PowerGrids.Electrical.System systemPowerGrids(initOpt = PowerGrids.Types.Choices.InitializationOption.globalSteadyStateFixedPowerFlow) PowerGrids.Electrical.Machines.SynchronousMachine4Windings GEN(H = 4, PStart = -4.75e+08, QStart = -1.56e+08,SNom = 5e+08, Tpd0 = 5.143, Tppd0 = 0.042, Tppq0 = 0.083, Tpq0 = 2.16, UNom = 21000, UPhaseStart = 0.161156, UStart = 21e3 * 0.9917, portVariablesPhases = true, raPu = 0, xdPu = 2, xlPu = 0.15, xpdPu = 0.35, xppdPu = 0.25, xppqPu = 0.3, xpqPu = 0.5, xqPu = 1.8) PowerGrids.Electrical.Buses.Bus NTLV(SNom = 5e+08, UNom = 21000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Branches.TransformerFixedRatio TGEN(PStartA = 4.75e+08, PStartB = -4.75e+08, QStartA = 1.56e+08, QStartB = -7.6e+07, R = 0.15e-2 * 419 ^ 2 / 500, SNom = 5e+08, UNomA = 21000, UNomB = 419000, UPhaseStartA = 0.161156, UPhaseStartB = 0, UStartA = 0.9917 * 21e3, UStartB = 0.95227 * 380e3, X = 16e-2 * 419 ^ 2 / 500, portVariablesPhases = true, portVariablesPu = true, rFixed = 419 / 21) PowerGrids.Electrical.Buses.EquivalentGrid GRID(R_X = 1 / 10, SNom = 5e+08, SSC = 2.5e+09, UNom = 380000, URef = 1.05 * 380e3, c = 1.1, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Loads.LoadImpedancePQ GRIDL(PRefConst = 4.75e+08, QRefConst = 7.6e+07, SNom = 5e+08, UNom = 380000, URef = 1.05 * 380e3, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Controls.TurbineGovernors.IEEE_TGOV1 TGOV(PMechPuStart = -GEN.PStart / GEN.SNom,R = 0.05, T1 = 0.5, T2 = 3, T3 = 10, VMax = 1) PowerGrids.Electrical.Controls.ExcitationSystems.IEEE_AC4A AVR(Ka = 200, Ta = 0.05, Tb = 10, Tc = 3, VcPuStart = GEN.UStart/GEN.UNom, VrMax = 4) Modelica.Blocks.Sources.RealExpression zero PowerGrids.Electrical.Buses.Bus NTHV(SNom = 5e+08, UNom = 380000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Controls.PowerSystemStabilizers.IEEE_PSS2A PSS(Ks1 = 10, Ks2 = 0.1564, M = 0, N = 0, T1 = 0.25, T2 = 0.03, T3 = 0.15, T4 = 0.015, T7 = 2, T8 = 0.5, T9 = 0.1, Tw1 = 2, Tw2 = 2, Tw3 = 2, Tw4 = 0, VstMax = 0.1, VstMin = -0.1) PowerGrids.Controls.FreeOffset RefLPu PowerGrids.Controls.FreeOffset VrefPu(use_u = true) Modelica.Blocks.Sources.RealExpression deltaVrefPu(y=if time >= 2 then 3e3*sin(2*Modelica.Constants.pi * 0.05 *(time-2))/GEN.UNom else 0) Real VrefPuTot = deltaVrefPu.y + GEN.VStartPu; equation connect(GEN.terminal, NTLV.terminal) connect(NTLV.terminal, TGEN.terminalA) connect(TGEN.terminalB, NTHV.terminal) connect(NTHV.terminal, GRID.terminal) connect(NTHV.terminal, GRIDL.terminal) connect(AVR.VuelPu, zero.y) connect(GEN.ufPuIn, AVR.efdPu) connect(TGOV.PMechPu, GEN.PmPu) connect(GEN.VPu, AVR.VcPu) connect(GEN.omegaPu, TGOV.omegaPu) connect(PSS.VstPu, AVR.VsPu) connect(PSS.Vsi1Pu, GEN.omegaPu) connect(PSS.Vsi2Pu, GEN.PPu) connect(VrefPu.y, AVR.VrefPu) connect(RefLPu.y, TGOV.RefLPu) connect(deltaVrefPu.y, VrefPu.u) end ControlledGridWithReferenceCalculation;
System under automatic control with automatic computation of set point offsets - saturation case.
within PowerGrids.Examples.Tutorial.GridOperation.Controlled; model ControlledGridWithReferenceCalculationSat "System under automatic control with automatic computation of set point offsets - saturation case" extends ControlledGridWithReferenceCalculation(AVR.VrMax = 0.5); end ControlledGridWithReferenceCalculationSat;
Models of grid-connected systems with generator controllers
within PowerGrids.Examples.Tutorial.GridOperation; package Controlled "Models of grid-connected systems with generator controllers" extends Modelica.Icons.ExamplesPackage; end Controlled;
Load step response specified by input signals.
within PowerGrids.Examples.Tutorial.GridOperation.LoadChange; model LoadChangeByInputSignals "Load step response specified by input signals" extends Modelica.Icons.Example; inner PowerGrids.Electrical.System systemPowerGrids PowerGrids.Electrical.Machines.SynchronousMachine4Windings GEN(H = 4, PStart = -4.75e+08, QStart = -1.56e+08,SNom = 5e+08, Tpd0 = 5.143, Tppd0 = 0.042, Tppq0 = 0.083, Tpq0 = 2.16, UNom = 21000, UPhaseStart = 0.161156, UStart = 21e3 * 0.9917, portVariablesPhases = true, raPu = 0, xdPu = 2, xlPu = 0.15, xpdPu = 0.35, xppdPu = 0.25, xppqPu = 0.3, xpqPu = 0.5, xqPu = 1.8) PowerGrids.Electrical.Buses.Bus NTLV(SNom = 5e+08, UNom = 21000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Buses.BusFault NTHV(R = 0.05,SNom = 5e+08, UNom = 380000, UPhaseStart = 0, UStart = 1.050 * 380e3,portVariablesPhases = true, portVariablesPu = true, startTime = 1e10, stopTime = 1e10) PowerGrids.Electrical.Branches.TransformerFixedRatio TGEN(PStartA = 4.75e+08, PStartB = -4.75e+08, QStartA = 1.56e+08, QStartB = -7.6e+07, R = 0.15e-2 * 419 ^ 2 / 500, SNom = 5e+08, UNomA = 21000, UNomB = 419000, UPhaseStartA = 0.161156, UPhaseStartB = 0, UStartA = 0.9917 * 21e3, UStartB = 0.95227 * 380e3, X = 16e-2 * 419 ^ 2 / 500, portVariablesPhases = true, portVariablesPu = true, rFixed = 419 / 21) PowerGrids.Electrical.Buses.EquivalentGrid GRID(R_X = 1 / 10, SNom = 5e+08, SSC = 2.5e+09, UNom = 380000, URef = 1.05 * 380e3, c = 1.1, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Loads.LoadImpedancePQInputs GRIDL(SNom = 5e+08, UNom = 380000, URef = 1.05 * 380e3, portVariablesPhases = true, portVariablesPu = true) Modelica.Blocks.Sources.RealExpression PmPu(y = -GEN.PStart / GEN.SNom) Modelica.Blocks.Sources.RealExpression ufPuIn(y = GEN.ufPuInStart) Modelica.Blocks.Sources.Step PRef(height = 475e6 * 0.05, offset = 475e6, startTime = 2) Modelica.Blocks.Sources.Step QRef(height = 76e6 * 0.04, offset = 76e6, startTime = 2) equation connect(PmPu.y, GEN.PmPu) connect(ufPuIn.y, GEN.ufPuIn) connect(GEN.terminal, NTLV.terminal) connect(NTLV.terminal, TGEN.terminalA) connect(TGEN.terminalB, NTHV.terminal) connect(NTHV.terminal, GRID.terminal) connect(NTHV.terminal, GRIDL.terminal) connect(PRef.y, GRIDL.PRefIn) connect(QRef.y, GRIDL.QRefIn) end LoadChangeByInputSignals;
Load step response specified by modifiers on a copy of the static system.
within PowerGrids.Examples.Tutorial.GridOperation.LoadChange; model LoadChangeByModifier "Load step response specified by modifiers on a copy of the static system" extends Modelica.Icons.Example; inner PowerGrids.Electrical.System systemPowerGrids PowerGrids.Electrical.Machines.SynchronousMachine4Windings GEN(H = 4, PStart = -4.75e+08, QStart = -1.56e+08,SNom = 5e+08, Tpd0 = 5.143, Tppd0 = 0.042, Tppq0 = 0.083, Tpq0 = 2.16, UNom = 21000, UPhaseStart = 0.161156, UStart = 21e3 * 0.9917, portVariablesPhases = true, raPu = 0, xdPu = 2, xlPu = 0.15, xpdPu = 0.35, xppdPu = 0.25, xppqPu = 0.3, xpqPu = 0.5, xqPu = 1.8) PowerGrids.Electrical.Buses.Bus NTLV(SNom = 5e+08, UNom = 21000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Buses.Bus NTHV(SNom = 5e+08, UNom = 380000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Branches.TransformerFixedRatio TGEN(PStartA = 4.75e+08, PStartB = -4.75e+08, QStartA = 1.56e+08, QStartB = -7.6e+07, R = 0.15e-2 * 419 ^ 2 / 500, SNom = 5e+08, UNomA = 21000, UNomB = 419000, UPhaseStartA = 0.161156, UPhaseStartB = 0, UStartA = 0.9917 * 21e3, UStartB = 0.95227 * 380e3, X = 16e-2 * 419 ^ 2 / 500, portVariablesPhases = true, portVariablesPu = true, rFixed = 419 / 21) PowerGrids.Electrical.Buses.EquivalentGrid GRID(R_X = 1 / 10, SNom = 5e+08, SSC = 2.5e+09, UNom = 380000, URef = 1.05 * 380e3, c = 1.1, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Loads.LoadImpedancePQ GRIDL( PRef = 4.75e+08*(if time < 2 then 1 else 1.05) "Active power consumption at reference voltage", QRef = 7.6e+07*(if time < 2 then 1 else 1.04) "Reactive power consumption at reference voltage", SNom = 5e+08, UNom = 380000, URef = 1.05 * 380e3, portVariablesPhases = true, portVariablesPu = true) Modelica.Blocks.Sources.RealExpression PmPu(y = -GEN.PStart / GEN.SNom) Modelica.Blocks.Sources.RealExpression ufPuIn(y = GEN.ufPuInStart) equation connect(PmPu.y, GEN.PmPu) connect(ufPuIn.y, GEN.ufPuIn) connect(GRIDL.terminal, NTHV.terminal) connect(GEN.terminal, NTLV.terminal) connect(NTLV.terminal, TGEN.terminalA) connect(TGEN.terminalB, NTHV.terminal) connect(NTHV.terminal, GRID.terminal) end LoadChangeByModifier;
Load step response specified by modifiers by inheritance from the static system.
within PowerGrids.Examples.Tutorial.GridOperation.LoadChange; model LoadChangeByModifierUsingExtends "Load step response specified by modifiers by inheritance from the static system" extends Examples.Tutorial.GridOperation.Static.StaticGridComputedParameters( GRIDL( PRef = GRIDL.PRefConst*(if time < 2 then 1 else 1.05) "Active power consumption at reference voltage", QRef = GRIDL.QRefConst*(if time < 2 then 1 else 1.04) "Reactive power consumption at reference voltage")); end LoadChangeByModifierUsingExtends;
Models of grid-connected systems subject to open-loop load changes
within PowerGrids.Examples.Tutorial.GridOperation; package LoadChange "Models of grid-connected systems subject to open-loop load changes" extends Modelica.Icons.ExamplesPackage; end LoadChange;
Models of grid-connected systems operating in steady-state
within PowerGrids.Examples.Tutorial.GridOperation; package Static "Models of grid-connected systems operating in steady-state" extends Modelica.Icons.ExamplesPackage; end Static;
Power flow for the basic grid used in the tutorial.
within PowerGrids.Examples.Tutorial.GridOperation.Static; model PowerFlow "Power flow for the basic grid used in the tutorial" extends Modelica.Icons.Example; PowerGrids.Electrical.PowerFlow.PVBus GEN(P = -4.75e+8, SNom = 5e+8, U = 20825.8, UNom = 21000, generatorConvention = false, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Buses.Bus NTLV(SNom = 5e+8, UNom = 21000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Branches.TransformerFixedRatio TGEN( R = 0.15e-2 * 419 ^ 2 / 500, SNom = 5e+8, UNomA = 21000, UNomB = 419000, X = 16e-2 * 419 ^ 2 / 500, portVariablesPhases = true, portVariablesPu = true, rFixed = 419 / 21) PowerGrids.Electrical.Buses.Bus NTHV(SNom = 5e+8, UNom = 380000, portVariablesPhases = true, portVariablesPu = true) inner PowerGrids.Electrical.System systemPowerGrids PowerGrids.Electrical.PowerFlow.PQBus GRIDL(P = 4.75e+8, Q = 7.6e+7, SNom = 5e+8, UNom = 380000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.PowerFlow.SlackBus GRID(SNom = 5e+8, U = 399000, UNom = 380000, portVariablesPhases = true, portVariablesPu = true) equation connect(GEN.terminal, NTLV.terminal) connect(NTLV.terminal, TGEN.terminalA) connect(TGEN.terminalB, NTHV.terminal) connect(NTHV.terminal, GRID.terminal) connect(GRIDL.terminal, NTHV.terminal) end PowerFlow;
System operating in steady-state with given inputs.
within PowerGrids.Examples.Tutorial.GridOperation.Static; model StaticGrid "System operating in steady-state with given inputs" extends Modelica.Icons.Example; inner PowerGrids.Electrical.System systemPowerGrids PowerGrids.Electrical.Machines.SynchronousMachine4Windings GEN(H = 4, PStart = -4.75e+08, QStart = -1.56e+08,SNom = 5e+08, Tpd0 = 5.143, Tppd0 = 0.042, Tppq0 = 0.083, Tpq0 = 2.16, UNom = 21000, UPhaseStart = 0.161156, UStart = 21e3 * 0.9917, portVariablesPhases = true, raPu = 0, xdPu = 2, xlPu = 0.15, xpdPu = 0.35, xppdPu = 0.25, xppqPu = 0.3, xpqPu = 0.5, xqPu = 1.8) PowerGrids.Electrical.Buses.Bus NTLV(SNom = 5e+08, UNom = 21000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Buses.Bus NTHV(SNom = 5e+08, UNom = 380000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Branches.TransformerFixedRatio TGEN( R = 0.15e-2 * 419 ^ 2 / 500, SNom = 5e+08, UNomA = 21000, UNomB = 419000, X = 16e-2 * 419 ^ 2 / 500, portVariablesPhases = true, portVariablesPu = true, rFixed = 419 / 21) PowerGrids.Electrical.Buses.EquivalentGrid GRID(R_X = 1 / 10, SNom = 5e+08, SSC = 2.5e+09, UNom = 380000, URef = 1.05 * 380e3, c = 1.1, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Loads.LoadImpedancePQ GRIDL(PRefConst = 4.75e+08, QRefConst = 7.6e+07, SNom = 5e+08, UNom = 380000, UPhaseStart = 0, URef = 1.05 * 380e3, UStart = 399000, portVariablesPhases = true, portVariablesPu = true) Modelica.Blocks.Sources.RealExpression PmPu(y = 0.95) Modelica.Blocks.Sources.RealExpression ufPuIn(y = 2.50826) equation connect(PmPu.y, GEN.PmPu) connect(ufPuIn.y, GEN.ufPuIn) connect(GRIDL.terminal, NTHV.terminal) connect(GEN.terminal, NTLV.terminal) connect(NTLV.terminal, TGEN.terminalA) connect(TGEN.terminalB, NTHV.terminal) connect(NTHV.terminal, GRID.terminal) end StaticGrid;
System operating in steady-state with computed inputs.
within PowerGrids.Examples.Tutorial.GridOperation.Static; model StaticGridComputedParameters "System operating in steady-state with computed inputs" extends StaticGrid( PmPu(y = -GEN.PStart / GEN.SNom), ufPuIn(y = GEN.ufPuInStart)); end StaticGridComputedParameters;
Systems operating in steady-state with different generator parameterss.
within PowerGrids.Examples.Tutorial.GridOperation.Static; model StaticGridDifferentGeneratorParam "Systems operating in steady-state with different generator parameterss" extends Modelica.Icons.Example; inner PowerGrids.Electrical.System systemPowerGrids // First Grid PowerGrids.Electrical.Machines.SynchronousMachine4Windings GEN_1(H = 4, PStart = -4.75e+08, QStart = -1.56e+08,SNom = 5e+08, Tpd0 = 5.143, Tppd0 = 0.042, Tppq0 = 0.083, Tpq0 = 2.16, UNom = 21000, UPhaseStart = 0.161156, UStart = 21e3 * 0.9917, portVariablesPhases = true, raPu = 0, xdPu = 2, xlPu = 0.15, xpdPu = 0.35, xppdPu = 0.25, xppqPu = 0.3, xpqPu = 0.5, xqPu = 1.8) PowerGrids.Electrical.Buses.Bus NTLV_1(SNom = 5e+08, UNom = 21000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Buses.Bus NTHV_1(SNom = 5e+08, UNom = 380000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Branches.TransformerFixedRatio TGEN_1(PStartA = 4.75e+08, PStartB = -4.75e+08, QStartA = 1.56e+08, QStartB = -7.6e+07, R = 0.15e-2 * 419 ^ 2 / 500, SNom = 5e+08, UNomA = 21000, UNomB = 419000, UPhaseStartA = 0.161156, UPhaseStartB = 0, UStartA = 0.9917 * 21e3, UStartB = 0.95227 * 380e3, X = 16e-2 * 419 ^ 2 / 500, portVariablesPhases = true, portVariablesPu = true, rFixed = 419 / 21) PowerGrids.Electrical.Buses.EquivalentGrid GRID_1(R_X = 1 / 10, SNom = 5e+08, SSC = 2.5e+09, UNom = 380000, URef = 1.05 * 380e3, c = 1.1, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Loads.LoadImpedancePQ GRIDL_1(PRefConst = 4.75e+08, QRefConst = 7.6e+07, SNom = 5e+08, UNom = 380000, URef = 1.05 * 380e3, portVariablesPhases = true, portVariablesPu = true) Modelica.Blocks.Sources.RealExpression PmPu_1(y = -GEN_1.PStart / GEN_1.SNom) Modelica.Blocks.Sources.RealExpression ufPuIn_1(y = GEN_1.ufPuInStart) // Second Grid - Transformer nominal voltage changed PowerGrids.Electrical.Machines.SynchronousMachine4Windings GEN_2(H = 4, PStart = -4.75e+08, QStart = -1.56e+08,SNom = 5e+08, Tpd0 = 5.143, Tppd0 = 0.042, Tppq0 = 0.083, Tpq0 = 2.16, UNom = 21000, UPhaseStart = 0.161156, UStart = 21e3 * 0.9917, excitationPuType = PowerGrids.Types.Choices.ExcitationPuType.Kundur, portVariablesPhases = true, raPu = 0, xdPu = 2, xlPu = 0.15, xpdPu = 0.35, xppdPu = 0.25, xppqPu = 0.3, xpqPu = 0.5, xqPu = 1.8) PowerGrids.Electrical.Buses.Bus NTLV_2(SNom = 5e+08, UNom = 21000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Buses.Bus NTHV_2(SNom = 5e+08, UNom = 380000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Branches.TransformerFixedRatio TGEN_2(PStartA = 4.75e+08, PStartB = -4.75e+08, QStartA = 1.56e+08, QStartB = -7.6e+07, R = 0.15e-2 * 419 ^ 2 / 500, SNom = 5e+08, UNomA = 21000, UNomB = 419000, UPhaseStartA = 0.161156, UPhaseStartB = 0, UStartA = 0.9917 * 21e3, UStartB = 0.95227 * 380e3, X = 16e-2 * 419 ^ 2 / 500, portVariablesPhases = true, portVariablesPu = true, rFixed = 419 / 21) PowerGrids.Electrical.Buses.EquivalentGrid GRID_2(R_X = 1 / 10, SNom = 5e+08, SSC = 2.5e+09, UNom = 380000, URef = 1.05 * 380e3, c = 1.1, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Loads.LoadImpedancePQ GRIDL_2(PRefConst = 4.75e+08, QRefConst = 7.6e+07, SNom = 5e+08, UNom = 380000, URef = 1.05 * 380e3, portVariablesPhases = true, portVariablesPu = true) Modelica.Blocks.Sources.RealExpression PmPu_2(y = -GEN_2.PStart / GEN_2.SNom) Modelica.Blocks.Sources.RealExpression ufPuIn_2(y = GEN_2.ufPuInStart) // Third Grid - Generator Nominal Voltage changed PowerGrids.Electrical.Machines.SynchronousMachine4WindingsInternalParameters GEN_3(H = 4, LDPu = 0.2, LQ1Pu = 0.444231, LQ2Pu = 0.2625, LdPu = 0.15, LfPu = 0.224242, LqPu = 0.15, MdPu = 1.85, MqPu = 1.65, PStart = -4.75e+08, QStart = -1.56e+08,SNom = 5e+08, UNom = 21000, UPhaseStart = 0.161156, UStart = 21e3 * 0.9917, mrcPu = 0, portVariablesPhases = true, rDPu = 0.0303152, rQ1Pu = 0.00308618, rQ2Pu = 0.0234897, raPu = 0, rfPu = 0.00128379) PowerGrids.Electrical.Buses.Bus NTLV_3(SNom = 5e+08, UNom = 21000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Buses.Bus NTHV_3(SNom = 5e+08, UNom = 380000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Branches.TransformerFixedRatio TGEN_3(PStartA = 4.75e+08, PStartB = -4.75e+08, QStartA = 1.56e+08, QStartB = -7.6e+07, R = 0.15e-2 * 419 ^ 2 / 500, SNom = 5e+08, UNomA = 21000, UNomB = 419000, UPhaseStartA = 0.161156, UPhaseStartB = 0, UStartA = 0.9917 * 21e3, UStartB = 0.95227 * 380e3, X = 16e-2 * 419 ^ 2 / 500, portVariablesPhases = true, portVariablesPu = true, rFixed = 419 / 21) PowerGrids.Electrical.Buses.EquivalentGrid GRID_3(R_X = 1 / 10, SNom = 5e+08, SSC = 2.5e+09, UNom = 380000, URef = 1.05 * 380e3, c = 1.1, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Loads.LoadImpedancePQ GRIDL_3(PRefConst = 4.75e+08, QRefConst = 7.6e+07, SNom = 5e+08, UNom = 380000, URef = 1.05 * 380e3, portVariablesPhases = true, portVariablesPu = true) Modelica.Blocks.Sources.RealExpression PmPu_3(y = 0.95) Modelica.Blocks.Sources.RealExpression ufPuIn_3(y = 2.50826) equation connect(PmPu_1.y, GEN_1.PmPu) connect(ufPuIn_1.y, GEN_1.ufPuIn) connect(PmPu_2.y, GEN_2.PmPu) connect(ufPuIn_2.y, GEN_2.ufPuIn) connect(PmPu_3.y, GEN_3.PmPu) connect(ufPuIn_3.y, GEN_3.ufPuIn) connect(GEN_1.terminal, NTLV_1.terminal) connect(NTLV_1.terminal, TGEN_1.terminalA) connect(TGEN_1.terminalB, NTHV_1.terminal) connect(NTHV_1.terminal, GRID_1.terminal) connect(NTHV_1.terminal, GRIDL_1.terminal) connect(GEN_2.terminal, NTLV_2.terminal) connect(NTLV_2.terminal, TGEN_2.terminalA) connect(TGEN_2.terminalB, NTHV_2.terminal) connect(NTHV_2.terminal, GRID_2.terminal) connect(GEN_3.terminal, NTLV_3.terminal) connect(NTLV_3.terminal, TGEN_3.terminalA) connect(TGEN_3.terminalB, NTHV_3.terminal) connect(NTHV_3.terminal, GRID_3.terminal) connect(GRIDL_2.terminal, NTHV_2.terminal) connect(GRIDL_3.terminal, NTHV_3.terminal) end StaticGridDifferentGeneratorParam;
Systems operating in steady-state with different nominal values.
within PowerGrids.Examples.Tutorial.GridOperation.Static; model StaticGridDifferentNominals "Systems operating in steady-state with different nominal values" extends Modelica.Icons.Example; inner PowerGrids.Electrical.System systemPowerGrids // First System PowerGrids.Electrical.Machines.SynchronousMachine4Windings GEN_1(H = 4, PStart = -4.75e+08, QStart = -1.56e+08,SNom = 5e+08, Tpd0 = 5.143, Tppd0 = 0.042, Tppq0 = 0.083, Tpq0 = 2.16, UNom = 21000, UPhaseStart = 0.161156, UStart = 21e3 * 0.9917, portVariablesPhases = true, raPu = 0, xdPu = 2, xlPu = 0.15, xpdPu = 0.35, xppdPu = 0.25, xppqPu = 0.3, xpqPu = 0.5, xqPu = 1.8) PowerGrids.Electrical.Buses.Bus NTLV_1(SNom = 5e+08, UNom = 21000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Buses.Bus NTHV_1(SNom = 5e+08, UNom = 380000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Branches.TransformerFixedRatio TGEN_1( R = 0.15e-2 * 419 ^ 2 / 500, SNom = 5e+08, UNomA = 21000, UNomB = 419000, X = 16e-2 * 419 ^ 2 / 500, portVariablesPhases = true, portVariablesPu = true, rFixed = 419 / 21) PowerGrids.Electrical.Buses.EquivalentGrid GRID_1(R_X = 1 / 10, SNom = 5e+08, SSC = 2.5e+09, UNom = 380000, URef = 1.05 * 380e3, c = 1.1, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Loads.LoadImpedancePQ GRIDL_1(PRefConst = 4.75e+08, QRefConst = 7.6e+07, SNom = 5e+08, UNom = 380000, UPhaseStart = 0, URef = 1.05 * 380e3, portVariablesPhases = true, portVariablesPu = true) Modelica.Blocks.Sources.RealExpression PmPu_1(y = -GEN_1.PStart / GEN_1.SNom) Modelica.Blocks.Sources.RealExpression ufPuIn_1(y = GEN_1.ufPuInStart) // Second System - Transformer nominal voltage changed PowerGrids.Electrical.Machines.SynchronousMachine4Windings GEN_2(H = 4, PStart = -4.75e+08, QStart = -1.56e+08,SNom = 5e+08, Tpd0 = 5.143, Tppd0 = 0.042, Tppq0 = 0.083, Tpq0 = 2.16, UNom = 21000, UPhaseStart = 0.161156, UStart = 21e3 * 0.9917, portVariablesPhases = true, raPu = 0, xdPu = 2, xlPu = 0.15, xpdPu = 0.35, xppdPu = 0.25, xppqPu = 0.3, xpqPu = 0.5, xqPu = 1.8) PowerGrids.Electrical.Buses.Bus NTLV_2(SNom = 5e+08, UNom = 21000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Buses.Bus NTHV_2(SNom = 5e+08, UNom = 380000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Branches.TransformerFixedRatio TGEN_2( R = 0.15e-2 * 419 ^ 2 / 500, SNom = 5e+08, UNomA = 21000, UNomB = 100000, X = 16e-2 * 419 ^ 2 / 500, portVariablesPhases = true, portVariablesPu = true, rFixed = 419 / 21) PowerGrids.Electrical.Buses.EquivalentGrid GRID_2(R_X = 1 / 10, SNom = 5e+08, SSC = 2.5e+09, UNom = 380000, URef = 1.05 * 380e3, c = 1.1, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Loads.LoadImpedancePQ GRIDL_2(PRefConst = 4.75e+08, QRefConst = 7.6e+07, SNom = 5e+08, UNom = 380000, UPhaseStart = 0, URef = 1.05 * 380e3, portVariablesPhases = true, portVariablesPu = true) Modelica.Blocks.Sources.RealExpression PmPu_2(y = -GEN_2.PStart / GEN_2.SNom) Modelica.Blocks.Sources.RealExpression ufPuIn_2(y = GEN_2.ufPuInStart) // Third System - Generator Nominal Voltage changed PowerGrids.Electrical.Machines.SynchronousMachine4Windings GEN_3(H = 4, PStart = -4.75e+08, QStart = -1.56e+08,SNom = 5e+08, Tpd0 = 5.143, Tppd0 = 0.042, Tppq0 = 0.083, Tpq0 = 2.16, UNom = 10000, UPhaseStart = 0.161156, UStart = 21e3 * 0.9917, portVariablesPhases = true, raPu = 0, xdPu = 2, xlPu = 0.15, xpdPu = 0.35, xppdPu = 0.25, xppqPu = 0.3, xpqPu = 0.5, xqPu = 1.8) PowerGrids.Electrical.Buses.Bus NTLV_3(SNom = 5e+08, UNom = 21000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Buses.Bus NTHV_3(SNom = 5e+08, UNom = 380000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Branches.TransformerFixedRatio TGEN_3( R = 0.15e-2 * 419 ^ 2 / 500, SNom = 5e+08, UNomA = 21000, UNomB = 419000, X = 16e-2 * 419 ^ 2 / 500, portVariablesPhases = true, portVariablesPu = true, rFixed = 419 / 21) PowerGrids.Electrical.Buses.EquivalentGrid GRID_3(R_X = 1 / 10, SNom = 5e+08, SSC = 2.5e+09, UNom = 380000, URef = 1.05 * 380e3, c = 1.1, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Loads.LoadImpedancePQ GRIDL_3(PRefConst = 4.75e+08, QRefConst = 7.6e+07, SNom = 5e+08, UNom = 380000, UPhaseStart = 0, URef = 1.05 * 380e3, portVariablesPhases = true, portVariablesPu = true) Modelica.Blocks.Sources.RealExpression PmPu_3(y = -GEN_3.PStart / GEN_3.SNom) Modelica.Blocks.Sources.RealExpression ufPuIn_3(y = GEN_3.ufPuInStart) equation connect(PmPu_1.y, GEN_1.PmPu) connect(ufPuIn_1.y, GEN_1.ufPuIn) connect(PmPu_2.y, GEN_2.PmPu) connect(PmPu_3.y, GEN_3.PmPu) connect(GEN_1.terminal, NTLV_1.terminal) connect(NTLV_1.terminal, TGEN_1.terminalA) connect(TGEN_1.terminalB, NTHV_1.terminal) connect(NTHV_1.terminal, GRID_1.terminal) connect(NTHV_1.terminal, GRIDL_1.terminal) connect(GEN_2.terminal, NTLV_2.terminal) connect(NTLV_2.terminal, TGEN_2.terminalA) connect(TGEN_2.terminalB, NTHV_2.terminal) connect(NTHV_2.terminal, GRID_2.terminal) connect(NTHV_2.terminal, GRIDL_2.terminal) connect(GEN_3.terminal, NTLV_3.terminal) connect(NTLV_3.terminal, TGEN_3.terminalA) connect(TGEN_3.terminalB, NTHV_3.terminal) connect(NTHV_3.terminal, GRID_3.terminal) connect(NTHV_3.terminal, GRIDL_3.terminal) connect(GEN_2.ufPuIn, ufPuIn_2.y) connect(GEN_3.ufPuIn, ufPuIn_3.y) end StaticGridDifferentNominals;
Examples of islanded systems
within PowerGrids.Examples.Tutorial; package IslandOperation "Examples of islanded systems" extends Modelica.Icons.ExamplesPackage; end IslandOperation;
LOG_STATS.
within PowerGrids.Examples.Tutorial.IslandOperation; model PowerFlow extends Modelica.Icons.Example; PowerGrids.Electrical.PowerFlow.PVBus GEN1(P = -4.5088e+08, SNom = 5e+08, U = 20825, UNom = 21000) PowerGrids.Electrical.PowerFlow.PVBus GEN2(P = -4.5088e+08, SNom = 5e+08, U = 20825, UNom = 21000) PowerGrids.Electrical.Loads.LoadPQVoltageDependence GRIDL1(PRefConst = 4.5e+08, QRefConst = 200e6, SNom = 5e+08, UNom = 380000, portVariablesPhases = true) PowerGrids.Electrical.Loads.LoadImpedancePQ GRIDL2(PRefConst = 4.5e+08, QRefConst = 200e6, SNom = 5e+08, UNom = 380000, portVariablesPhases = true) PowerGrids.Electrical.Buses.Bus NTLV1(SNom = 5e+08, UNom = 21000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Branches.TransformerFixedRatio TGEN1(R = 0.15e-2 * 419 ^ 2 / 500, SNom = 5e+08, UNomA = 21000, UNomB = 419000, X = 16e-2 * 419 ^ 2 / 500, portVariablesPhases = true, portVariablesPu = true, rFixed = 419 / 21) PowerGrids.Electrical.PowerFlow.SlackBus NTHV1(SNom = 5e+08, UNom = 380000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Branches.LineConstantImpedance LINE(R = 10, SNom = 5e+8, UNom = 380000, X = 100, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Buses.Bus NTHV2(SNom = 5e+08, UNom = 380000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Branches.TransformerFixedRatio TGEN2(R = 0.15e-2 * 419 ^ 2 / 500, SNom = 5e+08, UNomA = 21000, UNomB = 419000, X = 16e-2 * 419 ^ 2 / 500, portVariablesPhases = true, portVariablesPu = true, rFixed = 419 / 21) inner Electrical.System systemPowerGrids equation connect(NTLV1.terminal, TGEN1.terminalA) connect(TGEN1.terminalB, NTHV1.terminal) connect(NTHV1.terminal, GRIDL1.terminal) connect(GEN1.terminal, NTLV1.terminal) connect(LINE.terminalA, NTHV1.terminal) connect(LINE.terminalB, NTHV2.terminal) connect(NTHV2.terminal, GRIDL2.terminal) connect(NTHV2.terminal, TGEN2.terminalB) connect(TGEN2.terminalA, GEN2.terminal) end PowerFlow;
--tearingMethod=minimalTearing.
within PowerGrids.Examples.Tutorial.IslandOperation; model TwoGeneratorsFixedFrequencyReference extends TwoGeneratorsOneReferenceGenerator(systemPowerGrids.referenceFrequency = PowerGrids.Types.Choices.ReferenceFrequency.nominalFrequency); end TwoGeneratorsFixedFrequencyReference;
--tearingMethod=minimalTearing.
within PowerGrids.Examples.Tutorial.IslandOperation; model TwoGeneratorsLocalInitialization extends PowerGrids.Examples.Tutorial.IslandOperation.TwoGeneratorsOneReferenceGenerator(systemPowerGrids.initOpt = PowerGrids.Types.Choices.InitializationOption.localSteadyStateFixedPowerFlow); equation end TwoGeneratorsLocalInitialization;
--tearingMethod=minimalTearing.
within PowerGrids.Examples.Tutorial.IslandOperation; model TwoGeneratorsOneReferenceGenerator extends Modelica.Icons.Example; inner PowerGrids.Electrical.System systemPowerGrids(initOpt = PowerGrids.Types.Choices.InitializationOption.globalSteadyStateFixedPowerFlow, referenceFrequency = PowerGrids.Types.Choices.ReferenceFrequency.fixedReferenceGenerator) PowerGrids.Electrical.Buses.Bus NTLV1(SNom = 5e+08, UNom = 21000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Buses.ReferenceBus NTHV1(SNom = 5e+08, UNom = 380000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Branches.TransformerFixedRatio TGEN1(R = 0.15e-2 * 419 ^ 2 / 500, SNom = 5e+08, UNomA = 21000, UNomB = 419000, X = 16e-2 * 419 ^ 2 / 500, portVariablesPhases = true, portVariablesPu = true, rFixed = 419 / 21) PowerGrids.Electrical.Branches.TransformerFixedRatio TGEN2( R = 0.15e-2 * 419 ^ 2 / 500, SNom = 5e+08, UNomA = 21000, UNomB = 419000, X = 16e-2 * 419 ^ 2 / 500, portVariablesPhases = true, portVariablesPu = true, rFixed = 419 / 21) PowerGrids.Examples.Tutorial.GridOperation.Controlled.ControlledGenerator GEN1(GEN(UNom = 21e3, SNom = 500e6, UStart = 20.825e3, UPhaseStart = 9.1746/180*3.14159, PStart = -450.88e6, QStart = -294.351e6), TGOV(R = 0.05)) PowerGrids.Electrical.Branches.LineConstantImpedance LINE( R = 10, SNom = 5e+8, UNom = 380000, UPhaseStartA = 0, X = 100, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Examples.Tutorial.GridOperation.Controlled.ControlledGenerator GEN2(GEN(UNom = 21e3, SNom = 500e6, UStart = 20.825e3, UPhaseStart = 9.1746/180*3.14159, PStart = -450.88e6, QStart = -294.351e6), TGOV(R = 0.05)) PowerGrids.Electrical.Buses.Bus NTHV2(SNom = 5e+08, UNom = 380000, portVariablesPhases = true, portVariablesPu = true) PowerGrids.Electrical.Loads.LoadPQVoltageDependence GRIDL1(PRef = 450e6 + (if time < 1 then 0 else -100e6), PRefConst = 4.5e+08, QRefConst = 200e6, SNom = 500e6, UNom = 380000, portVariablesPhases = true) PowerGrids.Electrical.Loads.LoadPQVoltageDependence GRIDL2(PRefConst = 4.5e+08, QRefConst = 200e6, SNom = 500e6, UNom = 380000, portVariablesPhases = true) equation connect(NTLV1.terminal, TGEN1.terminalA) connect(TGEN1.terminalB, NTHV1.terminal) connect(NTHV1.terminal, GRIDL1.terminal) connect(GEN1.terminal, NTLV1.terminal) connect(LINE.terminalA, NTHV1.terminal) connect(LINE.terminalB, NTHV2.terminal) connect(NTHV2.terminal, GRIDL2.terminal) connect(NTHV2.terminal, TGEN2.terminalB) connect(TGEN2.terminalA, GEN2.terminal) connect(GEN2.omega, systemPowerGrids.omegaRefIn) end TwoGeneratorsOneReferenceGenerator;
Custom functions
within PowerGrids; package Functions "Custom functions" extends Modelica.Icons.UtilitiesPackage; end Functions;
<html><head></head><body>Computes the time constants of 1 + 8s + 15 = (1+3s)(1+5s) </body></html>
within PowerGrids.Functions; package Test extends Modelica.Icons.ExamplesPackage; model TestTimeConstants extends Modelica.Icons.Example; Real T1 = largerTimeConstant(8, 15); Real T2 = smallerTimeConstant(8, 15); end TestTimeConstants; end Test;
Interfaces package
within PowerGrids; package Interfaces "Interfaces package" extends Modelica.Icons.InterfacesPackage; connector TerminalAC "Terminal for phasor-based AC connections" Types.ComplexVoltage v "Phase-to-ground voltage phasor"; flow Types.ComplexCurrent i "Line current phasor"; end TerminalAC; end Interfaces;
Breakers
within PowerSystems.AC1ph_DC; package Breakers "Breakers " extends Modelica.Icons.VariantsPackage; model ForcedSwitch "Forced switch, 1-phase" extends Partials.SwitchBase; parameter SI.Time t_relax=10e-3 "switch relaxation time"; parameter Integer p_relax(min=2)=4 "power of relaxation exponent"; protected SI.Time t0(start=-Modelica.Constants.inf, fixed=true); Real[2] r(start={0,1}); Real s; /* Boolean open(start=not control)=not control; Boolean closed(start=control)=control; Start values not correct, since no parameter expressions. Removed start values and initalized the pre(..) values in the initial equation section. */ Boolean open = not control; Boolean closed = control; function relaxation=Utilities.Math.relaxation; initial equation pre(open) = not control; pre(closed) = control; equation when edge(open) or edge(closed) then t0 = time; end when; r = relaxation(time - t0, t_relax, p_relax); {v,i} = if closed then {(r[1]+r[2]*epsR)*s,(r[1]*epsG+r[2])*s} else {(r[1]*epsR+r[2])*s,(r[1]+r[2]*epsG)*s}; end ForcedSwitch; model ForcedCommSwitch "Forced commuting switch, 1-phase" extends Common.Nominal.NominalVI; extends Ports.PortBase; parameter Real[2] eps(final min={0,0}, each unit="1")={1e-4,1e-4} "{resistance 'closed', conductance 'open'}"; parameter SI.Time t_relax=10e-3 "switch relaxation time"; parameter Integer p_relax(min=2)=4 "power of relaxation exponent"; PS.Voltage[2] v_t; PS.Voltage[2] v_f; PS.Current[2] i_t; PS.Current[2] i_f; Ports.TwoPin_p term_p "positive terminal" Ports.TwoPin_n term_nt "negative terminal" Ports.TwoPin_n term_nf "negative terminal" Modelica.Blocks.Interfaces.BooleanInput control "true: p - nt closed, false: p - nf closed" protected final parameter SI.Resistance epsR=eps[1]*V_nom/I_nom; final parameter SI.Conductance epsG=eps[2]*I_nom/V_nom; SI.Time t0(start=-Modelica.Constants.inf, fixed=true); Real[2] r(start={0,1}); Real[2] s_t; Real[2] s_f; /* Boolean open_t(start=not control)=not control; Boolean closed_t(start=control)=control; Start values not correct, since no parameter expressions. Removed start values and initalized the pre(..) values in the initial equation section. */ Boolean open_t = not control; Boolean closed_t = control; function relaxation=Utilities.Math.relaxation; initial equation pre(open_t) = not control; pre(closed_t) = control; equation v_t = term_p.v - term_nt.v; v_f = term_p.v - term_nf.v; term_nt.i = - i_t; term_nf.i = - i_f; term_p.i + term_nt.i + term_nf.i = zeros(2); when edge(open_t) or edge(closed_t) then t0 = time; end when; r = relaxation(time - t0, t_relax, p_relax); {v_t,i_t} = if closed_t then {(r[1]+r[2]*epsR)*s_t,(r[1]*epsG+r[2])*s_t} else {(r[1]*epsR+r[2])*s_t,(r[1]+r[2]*epsG)*s_t}; {v_f,i_f} = if open_t then {(r[1]+r[2]*epsR)*s_f,(r[1]*epsG+r[2])*s_f} else {(r[1]*epsR+r[2])*s_f,(r[1]+r[2]*epsG)*s_f}; end ForcedCommSwitch; model Switch "Ideal switch, 1-phase" extends Partials.SwitchBase; protected Common.Switching.Switch switch_1( epsR=epsR, epsG=epsG) equation switch_1.v = v; switch_1.i = i; connect(control, switch_1.closed) end Switch; model Breaker "Breaker, 1-phase" extends Partials.SwitchBase; replaceable parameter Parameters.BreakerArc par "breaker parameter" protected Common.Switching.Breaker breaker_1( D=par.D, t_opening=par.t_opening, Earc=par.Earc, R0=par.R0, epsR=epsR, epsG=epsG) equation breaker_1.v = v; breaker_1.i = i; connect(control, breaker_1.closed) end Breaker; model ForcedDoubleSwitch "Forced double switch, 1-phase" extends Partials.DoubleSwitchBase; parameter SI.Time t_relax=10e-3 "switch relaxation time"; parameter Integer p_relax(min=2)=4 "power of relaxation exponent"; protected SI.Time[2] t0(start=-{Modelica.Constants.inf,Modelica.Constants.inf}, fixed=true); Real[2] r_1(start={0,1}); Real[2] r_2(start={0,1}); Real[2] s; /* Boolean[2] open(start={not control[1],not control[2]})={not control[1],not control[2]}; Boolean[2] closed(start={control[1],control[2]})={control[1],control[2]}; Start values not correct, since no parameter expressions. Removed start values and initalized the pre(..) values in the initial equation section. */ Boolean[2] open = {not control[1],not control[2]}; Boolean[2] closed = {control[1],control[2]}; function relaxation=Utilities.Math.relaxation; initial equation pre(open) = {not control[1],not control[2]}; pre(closed) = {control[1],control[2]}; equation when edge(open[1]) or edge(closed[1]) then t0[1] = time; end when; when edge(open[2]) or edge(closed[2]) then t0[2] = time; end when; r_1 = relaxation(time - t0[1], t_relax, p_relax); r_2 = relaxation(time - t0[2], t_relax, p_relax); {v[1],i[1]} = if closed[1] then {(r_1[1]+r_1[2]*epsR)*s[1],(r_1[1]*epsG+r_1[2])*s[1]} else {(r_1[1]*epsR+r_1[2])*s[1],(r_1[1]+r_1[2]*epsG)*s[1]}; {v[2],i[2]} = if closed[2] then {(r_2[1]+r_2[2]*epsR)*s[2],(r_2[1]*epsG+r_2[2])*s[2]} else {(r_2[1]*epsR+r_2[2])*s[2],(r_2[1]+r_2[2]*epsG)*s[2]}; end ForcedDoubleSwitch; model DoubleSwitch "Double switch, 1-phase" extends Partials.DoubleSwitchBase; protected Common.Switching.Switch switch_1( epsR=epsR, epsG=epsG) Common.Switching.Switch switch_2( epsR=epsR, epsG=epsG) equation switch_1.v = v[1]; switch_1.i = i[1]; switch_2.v = v[2]; switch_2.i = i[2]; connect(control[1], switch_1.closed) connect(control[2], switch_2.closed) end DoubleSwitch; model DoubleBreaker "Double breaker, 1-phase" extends Partials.DoubleSwitchBase; replaceable parameter Parameters.BreakerArc par "breaker parameter" protected replaceable Common.Switching.Breaker breaker_1( D=par.D, t_opening=par.t_opening, Earc=par.Earc, R0=par.R0, epsR=epsR, epsG=epsG) replaceable Common.Switching.Breaker breaker_2( D=par.D, t_opening=par.t_opening, Earc=par.Earc, R0=par.R0, epsR=epsR, epsG=epsG) equation breaker_1.v = v[1]; breaker_1.i = i[1]; breaker_2.v = v[2]; breaker_2.i = i[2]; connect(control[1], breaker_1.closed) connect(control[2], breaker_2.closed) end DoubleBreaker; package Partials "Partial models" extends Modelica.Icons.BasesPackage; partial model SwitchBase0 "Switch base, 1-phase" extends Ports.Port_pn; extends Common.Nominal.NominalVI; parameter Real[2] eps(final min={0,0}, each unit="1")={1e-4,1e-4} "{resistance 'closed', conductance 'open'}"; protected final parameter SI.Resistance epsR=eps[1]*V_nom/I_nom; final parameter SI.Conductance epsG=eps[2]*I_nom/V_nom; end SwitchBase0; partial model SwitchBase "Switch base, 1-phase" extends SwitchBase0; PS.Voltage v; PS.Current i; Modelica.Blocks.Interfaces.BooleanInput control "true:closed, false:open" equation v = term_p.v[1] - term_n.v[1]; i = term_p.i[1]; term_p.v[2] = term_n.v[2]; end SwitchBase; partial model DoubleSwitchBase "Double switch base, 1-phase" extends SwitchBase0; PS.Voltage[2] v; PS.Current[2] i; Modelica.Blocks.Interfaces.BooleanInput[2] control "true:closed, false:open" equation v = term_p.v - term_n.v; i = term_p.i; end DoubleSwitchBase; end Partials; package Parameters "Parameter data for interactive use" extends Modelica.Icons.MaterialPropertiesPackage; record BreakerArc "Breaker parameters, 3-phase" extends Modelica.Icons.Record; SI.Distance D=50e-3 "contact distance open" SI.Time t_opening=30e-3 "opening duration" SI.ElectricFieldStrength Earc=50e3 "electric field arc" Real R0=1 "small signal resistance arc" end BreakerArc; end Parameters; end Breakers;