From 50dad5d30de22c11df9022ef4a41e1bbb9e6cedd Mon Sep 17 00:00:00 2001 From: Fernando Fachini Date: Thu, 15 Feb 2024 20:45:46 -0500 Subject: [PATCH] Update --- .../Electrical/Machines/ControlsMotors.mo | 17 +- OpenIPSL/Examples/ModelPredictiveControl.mo | 6914 ++++++++++++++++- OpenIPSL/Examples/TCL.mo | 65 +- 3 files changed, 6947 insertions(+), 49 deletions(-) diff --git a/OpenIPSL/Electrical/Machines/ControlsMotors.mo b/OpenIPSL/Electrical/Machines/ControlsMotors.mo index 76df24a60..6f15b5751 100644 --- a/OpenIPSL/Electrical/Machines/ControlsMotors.mo +++ b/OpenIPSL/Electrical/Machines/ControlsMotors.mo @@ -252,17 +252,14 @@ package ControlsMotors "Control models" Modelica.Blocks.Sources.BooleanExpression open_circuit_condition(y=if Resistor.i <= 0 then true else false) annotation (Placement(transformation(extent={{52,6},{32,26}}))); - Modelica.Blocks.Sources.RealExpression Pmotor(y=-(n.vr*n.ir + n.vi*n.ii) - *(nr_input/wb)) + Modelica.Blocks.Sources.RealExpression Pmotor(y=-(n.vr*n.ir + n.vi*n.ii)) annotation (Placement(transformation(extent={{24,70},{44,90}}))); - Modelica.Blocks.Sources.RealExpression Qmotor(y=(n.vr*n.ii - n.vi*n.ir) - *(nr_input/wb)) + Modelica.Blocks.Sources.RealExpression Qmotor(y=(n.vr*n.ii - n.vi*n.ir)) annotation (Placement(transformation(extent={{24,54},{44,74}}))); OpenIPSL.Types.PerUnit P; Modelica.Units.SI.ActivePower Pdc; OpenIPSL.Types.PerUnit Q; OpenIPSL.Types.PerUnit S; - Modelica.Units.SI.AngularVelocity rotor_speed; Modelica.Blocks.Sources.RealExpression Vmotor(y=Capacitor.v*m_input/(2*sqrt(2) *V_b)) @@ -304,14 +301,6 @@ package ControlsMotors "Control models" parameter Modelica.Units.SI.AngularVelocity wb = 2*pi*fn/N; Modelica.Blocks.Sources.RealExpression Smotor(y=sqrt(Pmotor.y^2 + Qmotor.y^2)) annotation (Placement(transformation(extent={{62,38},{82,58}}))); - Modelica.Blocks.Interfaces.RealInput nr_input annotation (Placement( - transformation( - extent={{-20,-20},{20,20}}, - rotation=180, - origin={120,-70}), iconTransformation( - extent={{-10,-10},{10,10}}, - rotation=180, - origin={130,-70}))); Modelica.Electrical.Analog.Sources.SignalVoltage voltage annotation ( Placement(transformation( extent={{-10,10},{10,-10}}, @@ -351,8 +340,6 @@ package ControlsMotors "Control models" P*S_b = Pdc; - rotor_speed = nr_input; - n.vr = vr_m.y; n.vi = vi_m.y; connect(ground.p, Capacitor.n) annotation (Line(points={{-4,-30},{-4,-28},{30, diff --git a/OpenIPSL/Examples/ModelPredictiveControl.mo b/OpenIPSL/Examples/ModelPredictiveControl.mo index c26d0a0cc..d7770b4dd 100644 --- a/OpenIPSL/Examples/ModelPredictiveControl.mo +++ b/OpenIPSL/Examples/ModelPredictiveControl.mo @@ -33208,8 +33208,8 @@ package ModelPredictiveControl connect(aC2DCandDC2AC_MPC.n,nMD_MotorTypeI. p) annotation (Line(points={{278,2},{298,2}}, color={0,0,255})); connect(voltsHertzController_MPC.m,aC2DCandDC2AC_MPC. m_input) - annotation (Line(points={{262.6,-26},{262.6,-18},{267.091,-18},{ - 267.091,-10}},color={0,0,127})); + annotation (Line(points={{262.6,-26},{262.6,-18},{267.091,-18},{267.091,-10}}, + color={0,0,127})); connect(voltsHertzController_MPC.Vc,aC2DCandDC2AC_MPC. Vc) annotation ( Line(points={{253.4,-26},{253.4,-18},{248.909,-18},{248.909,-10}}, color={0,0,127})); @@ -33274,6 +33274,6916 @@ package ModelPredictiveControl __Dymola_Algorithm="Dassl"), Icon(coordinateSystem(extent={{-240,-240},{340,140}}))); end MPC_LTC_VSD_Test2; + + model MPC_LTC_VSD_Test3 + "THIS ONE IS STABLE, CONTROLLABLE, OBSERVABLE!!!!!!!" + extends Modelica.Icons.Example; + + parameter Boolean equivalentGRID = true; + parameter Boolean equivalentsystem = false; + parameter Real set = 0; + + OpenIPSL.Electrical.Buses.Bus Bus1(v_0=powerFlow.powerflow.bus.V1, angle_0= + powerFlow.powerflow.bus.A1) if not equivalentGRID + annotation (Placement(transformation(extent={{-90,70},{-70,90}}))); + OpenIPSL.Electrical.Buses.Bus Bus2(v_0=powerFlow.powerflow.bus.V2, angle_0= + powerFlow.powerflow.bus.A1) if not equivalentGRID + annotation (Placement(transformation(extent={{-50,70},{-30,90}}))); + OpenIPSL.Electrical.Branches.PSSE.TwoWindingTransformer T1( + R=0.001, + X=0.2, + G=0, + B=0, + VNOM1=13800, + VB1=13800, + VNOM2=6000, + VB2=6000) if not equivalentGRID annotation (Placement(transformation( + extent={{-8,-8},{8,8}}, + rotation=180, + origin={-60,80}))); + OpenIPSL.Examples.OpenCPS.Generators.G1 G1( + enableV_b=true, + v_0=powerFlow.powerflow.bus.V1, + angle_0=powerFlow.powerflow.bus.A1, + P_0=powerFlow.powerflow.machines.PG1, + Q_0=powerFlow.powerflow.machines.QG1, + V_b=6000) if not equivalentGRID + annotation (Placement(transformation(extent={{-112,70},{-92,90}}))); + OpenIPSL.Electrical.Branches.PwLine L1( + R=0.001, + X=0.2, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{-26,76}, + {-14,84}}))); + OpenIPSL.Electrical.Buses.Bus Bus3(v_0=powerFlow.powerflow.bus.V3, angle_0= + powerFlow.powerflow.bus.A3) if not equivalentGRID + annotation (Placement(transformation(extent={{-10,70},{10,90}}))); + OpenIPSL.Electrical.Buses.Bus Bus4(v_0=powerFlow.powerflow.bus.V4, angle_0= + powerFlow.powerflow.bus.V4) if not equivalentGRID + annotation (Placement(transformation(extent={{50,70},{70,90}}))); + OpenIPSL.Electrical.Branches.PwLine L2_1( + R=0.0005, + X=0.1, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{24,86}, + {36,94}}))); + OpenIPSL.Electrical.Branches.PwLine L2_2( + R=0.0005, + X=0.1, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{24,66}, + {36,74}}))); + OpenIPSL.Electrical.Buses.Bus Bus5(angle_0=powerFlow.powerflow.bus.A5, v_0= + powerFlow.powerflow.bus.V5) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=90, + origin={80,16}))); + OpenIPSL.Electrical.Branches.PwLine L3( + R=0.001, + X=0.2, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation( + extent={{-6,-4},{6,4}}, + rotation=-90, + origin={80,60}))); + OpenIPSL.Electrical.Buses.Bus Bus6(v_0=powerFlow.powerflow.bus.V6, angle_0= + powerFlow.powerflow.bus.A6) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,10}))); + OpenIPSL.Electrical.Branches.PSSE.TwoWindingTransformer T2( + G=0, + B=0, + VNOM1=13800, + VB1=13800, + VNOM2=6000, + VB2=6000, + R=0.005, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={10,10}))); + GenerationUnits.PSSE.G2_16MVA G2( + enableV_b=true, + enableP_0=true, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V6, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A6, + V_b=6000, + P_0=powerFlow.powerflow.machines.PG2, + Q_0=powerFlow.powerflow.machines.QG2, + enableangle_0=true) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-30,10}))); + inner OpenIPSL.Electrical.SystemBase SysData(S_b=100000000, fn=60) + annotation (Placement(transformation(extent={{-128,104},{-74,124}}))); + OpenIPSL.Electrical.Loads.PSSE.Load Load1( + V_b=220000, + P_0=powerFlow.powerflow.loads.PL1, + Q_0=powerFlow.powerflow.loads.QL1, + v_0=powerFlow.powerflow.bus.V3, + angle_0=powerFlow.powerflow.bus.A3) if not equivalentGRID + annotation (Placement(transformation(extent={{-20,48},{0,68}}))); + Electrical.Events.Breaker circuitbreaker( + enableTrigger=false, + t_o=5, + rc_enabled=true, + t_rc=1000) if not equivalentGRID annotation (Placement(transformation( + extent={{-4,-4},{4,4}}, + rotation=90, + origin={80,26}))); + + Modelica.Blocks.Interfaces.RealInput IN1(start=0) + "Connector of Real input signal 2" annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-150,10}),iconTransformation(extent={{-10,-10},{10,10}}, origin={-150,10}))); + Modelica.Blocks.Sources.Constant IN11(k=0) + annotation (Placement(transformation(extent={{-108,-2},{-96,10}}))); + Modelica.Blocks.Math.Add AddU1 + annotation (Placement(transformation(extent={{-80,0},{-60,20}}))); + Modelica.Blocks.Sources.Constant IN22(k=0) + annotation (Placement(transformation(extent={{-108,-32},{-96,-20}}))); + Modelica.Blocks.Math.Add AddU2 + annotation (Placement(transformation(extent={{-80,-30},{-60,-10}}))); + Modelica.Blocks.Interfaces.RealInput IN2(start=0) + "Connector of Real input signal 2" + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-150,-12}), iconTransformation(extent={{-10,-10},{10,10}}, + origin={-150,-12}))); + + Modelica.Blocks.Interfaces.RealInput IN3(start = 0) "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-44},{-140,-24}}), + iconTransformation(extent={{-160,-44},{-140,-24}}))); + Modelica.Blocks.Interfaces.RealInput IN4(start = 0) "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-66},{-140,-46}}), + iconTransformation(extent={{-160,-66},{-140,-46}}))); + Modelica.Blocks.Interfaces.RealInput IN5(start = 0) "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-88},{-140,-68}}), + iconTransformation(extent={{-160,-88},{-140,-68}}))); + + PFData.PowerFlow powerFlow(redeclare record PowerFlow = + OpenIPSL.Examples.ModelPredictiveControl.PFData.PFVSD_TCL) + annotation (Placement(transformation(extent={{-68,104},{-48,124}}))); + Electrical.Machines.PSSE.GENCLS IB( + V_b=220000, + v_0=powerFlow.powerflow.bus.V4, + angle_0=powerFlow.powerflow.bus.A4, + P_0=powerFlow.powerflow.machines.Pinf, + Q_0=powerFlow.powerflow.machines.Qinf, + M_b=100000000, + X_d=1) if not equivalentGRID annotation (Placement(transformation(extent={{110,70}, + {100,90}}))); + Electrical.Loads.PSSE.Load_ExtInput Load2( + P_0=powerFlow.powerflow.loads.PL2, + Q_0=powerFlow.powerflow.loads.QL2, + v_0=powerFlow.powerflow.bus.V5, + angle_0=powerFlow.powerflow.bus.A5, + d_P=0, + t1=100, + d_t=1000) + annotation (Placement(transformation(extent={{100,-30},{120,-10}}))); + + inner Modelica.Blocks.Noise.GlobalSeed globalSeed(useAutomaticSeed=false, + fixedSeed=10000) + annotation (Placement(transformation(extent={{-42,102},{-22,122}}))); + + Electrical.Buses.Bus Bus10(v_0=powerFlow.powerflow.bus.V10, angle_0=powerFlow.powerflow.bus.A10) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,-90}))); + Electrical.Branches.PSSE.TwoWindingTransformer T4( + G=0, + B=0, + CW=1, + VNOM1=13800, + VB1=13800, + VNOM2=480, + VB2=480, + R=0.001, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={10,-90}))); + GenerationUnits.PSSE.Solar_Units.SolarMPCSysIdentification + PV( + V_b=480, + P_0=powerFlow.powerflow.machines.PPV, + enableP_0=true, + Q_0=powerFlow.powerflow.machines.QPV, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V8, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A8, + enableangle_0=true) + annotation (Placement(transformation(extent={{-40,-60},{-20,-40}}))); + Modelica.Blocks.Math.Add AddU3 + annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}))); + Modelica.Blocks.Sources.Constant IN33(k=0) + annotation (Placement(transformation(extent={{-108,-62},{-96,-50}}))); + + Modelica.Blocks.Math.Add AddU4 + annotation (Placement(transformation(extent={{-80,-90},{-60,-70}}))); + Modelica.Blocks.Math.Add AddU5 + annotation (Placement(transformation(extent={{-80,-116},{-60,-96}}))); + Modelica.Blocks.Sources.Constant IN44(k=0) + annotation (Placement(transformation(extent={{-108,-92},{-96,-80}}))); + Modelica.Blocks.Sources.Constant IN55(k=0) + annotation (Placement(transformation(extent={{-108,-118},{-96,-106}}))); + GenerationUnits.PSSE.Battery_Units.BESSMPCSysIdentification + BESS( + V_base=480, + V_b(displayUnit="kV") = 480, + enableV_b=true, + P_0=powerFlow.powerflow.machines.PBESS, + enableP_0=true, + Q_0=powerFlow.powerflow.machines.QBESS, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V10, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A10, + enableangle_0=true) + annotation (Placement(transformation(extent={{-40,-100},{-20,-80}}))); + Electrical.Buses.Bus Bus8(v_0=powerFlow.powerflow.bus.V8, angle_0=powerFlow.powerflow.bus.A8) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,-50}))); + Electrical.Branches.PSSE.TwoWindingTransformer T3( + G=0, + B=0, + CW=1, + VNOM1=13800, + VB1=13800, + VNOM2=480, + VB2=480, + R=0.001, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={12,-50}))); + Electrical.Buses.Bus Bus11(v_0=powerFlow.powerflow.bus.V11, angle_0=powerFlow.powerflow.bus.A11) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,-90}))); + Electrical.Buses.Bus Bus9(v_0=powerFlow.powerflow.bus.V9, angle_0=powerFlow.powerflow.bus.A9) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,-50}))); + Electrical.Buses.Bus Bus7(v_0=powerFlow.powerflow.bus.V7, angle_0=powerFlow.powerflow.bus.A7) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,10}))); + Electrical.Branches.PwLine L4( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,6},{ + 50,14}}))); + Electrical.Branches.PwLine L5( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,-54}, + {50,-46}}))); + Electrical.Branches.PwLine L6( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,-94}, + {50,-86}}))); + Modelica.Blocks.Sources.Sine sine( + amplitude=0, + f=1/260, + phase=3.1415926535898, + startTime=1000) + annotation (Placement(transformation(extent={{68,-36},{78,-26}}))); + Electrical.Loads.NoiseInjections.WhiteNoiseInjection whiteNoiseInjection( + active_sigma=0.000000000000001, + samplePeriod=0.01) + annotation (Placement(transformation(extent={{66,-18},{78,-6}}))); + Modelica.Blocks.Math.Add add + annotation (Placement(transformation(extent={{84,-18},{92,-10}}))); + + Modelica.Blocks.Interfaces.RealInput IN6(start=0) "Connector of Real input signal 2" + annotation (Placement(transformation(extent={{-160,-110},{-140,-90}}), + iconTransformation(extent={{-160,-110},{-140,-90}}))); + Modelica.Blocks.Sources.Constant IN77(k=0) + annotation (Placement(transformation(extent={{98,-176},{118,-156}}))); + Modelica.Blocks.Math.Add3 Add1 + annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + rotation=0, + origin={148,-160}))); + Electrical.Buses.Bus Bus13(angle_0=powerFlow.powerflow.bus.A13, v_0= + powerFlow.powerflow.bus.V13) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={164,-100}))); + Electrical.Branches.PwLine L7( + R=0.001, + X=0.01, + G=0, + B=0) annotation (Placement(transformation(extent={{142,-104},{154,-96}}))); + Electrical.Buses.Bus Bus14(V_b=120, angle_0=powerFlow.powerflow.bus.A14, v_0= + powerFlow.powerflow.bus.V14) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={208,-100}))); + Modelica.Blocks.Interfaces.RealInput IN7 "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-132},{-140,-112}}), + iconTransformation(extent={{-160,-132},{-140,-112}}))); + TCL.ULTC_VoltageControl uLTC_VoltageControl( + Vbus1=13800, + Vbus2(displayUnit="V") = 120, + Vn=13800, + v_0=1, + kT=13800/120, + m0=1, + m_max=1.05, + m_min=0.95) + annotation (Placement(transformation(extent={{174,-110},{194,-90}}))); + Modelica.Blocks.Sources.Constant Ratio_LTC(k=1) + annotation (Placement(transformation(extent={{98,-188},{118,-208}}))); + Modelica.Blocks.Sources.Constant IN66(k=0) + annotation (Placement(transformation(extent={{158,-68},{178,-48}}))); + Electrical.Branches.PwLine L2( + R=0.001, + X=0.01, + G=0, + B=0) annotation (Placement(transformation(extent={{200,-2},{212,6}}))); + Electrical.Buses.Bus Bus12(angle_0=powerFlow.powerflow.bus.A5, + v_0=powerFlow.powerflow.bus.V5) + annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={218,2}))); + Electrical.Machines.ControlsMotors.VariableSpeedDrive.PowerElectronics.AC2DCandDC2AC_MPC + aC2DCandDC2AC_MPC( + V_b=13800, + v_0=powerFlow.powerflow.bus.V5, + angle_0=powerFlow.powerflow.bus.A5, + Rdc=0.01, + Cdc=0.000001, + m0=0.9537) + annotation (Placement(transformation(extent={{238,-8},{278,12}}))); + Electrical.Machines.NonMultiDomain.Motors.ThreePhase.PSAT.NMD_MotorTypeI + nMD_MotorTypeI( + M_b=5000000, + V_b=13800, + Sup=false, + a=0, + b=0, + c=0.1) + annotation (Placement(transformation(extent={{318,-8},{298,12}}))); + Electrical.Machines.ControlsMotors.VariableSpeedDrive.ControllerLogic.VoltsHertzController_MPC + voltsHertzController_MPC( + V_b=13800, + f_max=60, + f_min=0, + m0=0.9537, + Kp=0.5, + Ki=0.2, + rotor_speed_initial=1.9*Modelica.Constants.pi*60) + annotation (Placement(transformation(extent={{248,-48},{266,-28}}))); + Modelica.Blocks.Math.Add add10 + annotation (Placement(transformation(extent={{204,-60},{212,-52}}))); + Electrical.Loads.PSSE.Load load(V_b=120, P_0=500000) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=90, + origin={250,-100}))); + equation + + // OUT1 = G2.gen.w; + // OUT2 = G2.gen.delta; + // OUT3 = G2.gen.Epq; + // OUT4 = G2.gen.PSIkd; + // OUT5 = G2.gen.PSIppq; + // OUT6 = G2.sEXSMPC.simpleLagLim.state; + // OUT7 = G2.sEXSMPC.leadLag.TF.x_scaled[1]; + // OUT8 = G2.gASTMPC.simpleLagLim.state; + // OUT9 = G2.gASTMPC.simpleLag.state; + // OUT10 = G2.gASTMPC.simpleLag1.state; + // OUT11 = Bus6.v; + // + // OUT12 =PV.rEGCA1_1.Pgen; + // OUT13 =PV.rEGCA1_1.Qgen; + // OUT14 =PV.rEGCA1_1.p.ir; + // OUT15 =PV.rEGCA1_1.p.ii; + // OUT16 = Bus8.v; + // + // OUT17 =BESS.rEGCA1_1.Pgen; + // OUT18 =BESS.rEGCA1_1.Qgen; + // OUT19 =BESS.rEGCA1_1.p.ir; + // OUT20 =BESS.rEGCA1_1.p.ii; + // OUT21 = Bus10.v; + // + // OUT22 = Load2.P; + // OUT23 = Load2.Q; + // + // OUT24= aC2DCandDC2AC_MPC.n.ir; + // OUT25= aC2DCandDC2AC_MPC.n.ii; + // OUT26= aC2DCandDC2AC_MPC.P; + // OUT27= aC2DCandDC2AC_MPC.Q; + // OUT28= nMD_MotorTypeI.wr; + // OUT29= voltsHertzController_MPC.we; + // OUT30= Bus12.v; + // + // OUT31 = Bus5.v; + // OUT32 = Bus5.angle; + + connect(T1.p, Bus2.p) + annotation (Line(points={{-51.2,80},{-40,80}}, color={0,0,255})); + connect(Bus1.p, T1.n) + annotation (Line(points={{-80,80},{-68.8,80}}, color={0,0,255})); + connect(G1.conn, Bus1.p) + annotation (Line(points={{-91,80},{-80,80}}, color={0,0,255})); + connect(L1.n, Bus3.p) + annotation (Line(points={{-14.6,80},{0,80}}, color={0,0,255})); + connect(L1.p, Bus2.p) + annotation (Line(points={{-25.4,80},{-40,80}}, color={0,0,255})); + connect(L2_2.n, Bus4.p) annotation (Line(points={{35.4,70},{44,70},{44,80},{60, + 80}}, color={0,0,255})); + connect(L2_1.n, Bus4.p) annotation (Line(points={{35.4,90},{44,90},{44,80},{60, + 80}}, color={0,0,255})); + connect(L2_1.p, Bus3.p) annotation (Line(points={{24.6,90},{16,90},{16,80},{0, + 80}}, color={0,0,255})); + connect(L2_2.p, Bus3.p) annotation (Line(points={{24.6,70},{16,70},{16,80},{0, + 80}}, color={0,0,255})); + connect(Load1.p, Bus3.p) + annotation (Line(points={{-10,68},{-10,80},{0,80}}, color={0,0,255})); + connect(L3.p, Bus4.p) + annotation (Line(points={{80,65.4},{80,80},{60,80}}, color={0,0,255})); + connect(circuitbreaker.s, Bus5.p) + annotation (Line(points={{80,22},{80,16}}, color={0,0,255})); + connect(circuitbreaker.r, L3.n) + annotation (Line(points={{80,30},{80,54.6}}, color={0,0,255})); + connect(IN11.y, AddU1.u2) annotation (Line(points={{-95.4,4},{-82,4}}, + color={0,0,127})); + connect(IN1, AddU1.u1) annotation (Line(points={{-150,10},{-116,10},{-116,16}, + {-82,16}}, + color={0,0,127})); + + connect(IN22.y,AddU2. u2) annotation (Line(points={{-95.4,-26},{-82,-26}}, + color={0,0,127})); + connect(IN2,AddU2. u1) annotation (Line(points={{-150,-12},{-118,-12},{-118,-14}, + {-82,-14}}, + color={0,0,127})); + connect(AddU2.y, G2.Efd_ref) + annotation (Line(points={{-59,-20},{-52,-20},{-52,4},{-42,4}}, + color={0,0,127})); + connect(AddU1.y, G2.P_ref1) annotation (Line(points={{-59,10},{-52,10},{-52,16}, + {-42,16}}, color={0,0,127})); + connect(IB.p, Bus4.p) + annotation (Line(points={{100,80},{60,80}}, color={0,0,255})); + connect(Load2.p, Bus5.p) annotation (Line(points={{110,-10},{110,10},{80,10},{ + 80,16}}, + color={0,0,255})); + connect(T4.n, Bus10.p) + annotation (Line(points={{-1,-90},{-10,-90}}, color={0,0,255})); + connect(Bus6.p, T2.n) + annotation (Line(points={{-10,10},{-1,10}}, + color={0,0,255})); + connect(IN33.y,AddU3. u2) + annotation (Line(points={{-95.4,-56},{-82,-56}}, color={0,0,127})); + connect(BESS.p1, Bus10.p) + annotation (Line(points={{-20,-90},{-10,-90}}, color={0,0,255})); + connect(BESS.Paux1, AddU4.y) annotation (Line(points={{-42,-84},{-54,-84},{-54, + -80},{-59,-80}}, color={0,0,127})); + connect(IN55.y, AddU5.u2) + annotation (Line(points={{-95.4,-112},{-82,-112}}, color={0,0,127})); + connect(AddU5.y, BESS.Qext1) annotation (Line(points={{-59,-106},{-52,-106},{-52, + -96},{-42,-96}}, color={0,0,127})); + connect(IN44.y, AddU4.u2) + annotation (Line(points={{-95.4,-86},{-82,-86}}, color={0,0,127})); + connect(AddU4.u1,IN4) annotation (Line(points={{-82,-74},{-100,-74},{-100,-70}, + {-116,-70},{-116,-56},{-150,-56}}, color={0,0,127})); + connect(AddU5.u1,IN5) annotation (Line(points={{-82,-100},{-116,-100},{-116,-78}, + {-150,-78}}, color={0,0,127})); + connect(G2.conn, Bus6.p) annotation (Line(points={{-19,10},{-10,10}}, + color={0,0,255})); + connect(AddU3.u1, IN3) annotation (Line(points={{-82,-44},{-118,-44},{-118,-34}, + {-150,-34}}, color={0,0,127})); + connect(PV.p1, Bus8.p) + annotation (Line(points={{-20,-50},{-10,-50}}, color={0,0,255})); + connect(Bus8.p, T3.n) + annotation (Line(points={{-10,-50},{1,-50}}, color={0,0,255})); + connect(T2.p, Bus7.p) annotation (Line(points={{21,10},{25.5,10},{25.5,10},{30, + 10}}, color={0,0,255})); + connect(T3.p, Bus9.p) + annotation (Line(points={{23,-50},{30,-50}}, color={0,0,255})); + connect(T4.p, Bus11.p) + annotation (Line(points={{21,-90},{30,-90}}, color={0,0,255})); + connect(L4.n, Bus5.p) annotation (Line(points={{49.4,10},{60,10},{60,10},{80,10}, + {80,16}}, color={0,0,255})); + connect(L5.n, Bus5.p) annotation (Line(points={{49.4,-50},{60,-50},{60,10},{80, + 10},{80,16}}, color={0,0,255})); + connect(Bus11.p, L6.p) + annotation (Line(points={{30,-90},{38.6,-90}}, color={0,0,255})); + connect(Bus9.p, L5.p) + annotation (Line(points={{30,-50},{38.6,-50}}, color={0,0,255})); + connect(L6.n, Bus5.p) annotation (Line(points={{49.4,-90},{60,-90},{60,10},{80, + 10},{80,16}}, color={0,0,255})); + connect(Bus7.p, L4.p) annotation (Line(points={{30,10},{34.3,10},{34.3,10},{38.6, + 10}}, color={0,0,255})); + connect(sine.y, add.u2) annotation (Line(points={{78.5,-31},{78.5,-16.4}, + {83.2,-16.4}}, color={0,0,127})); + connect(whiteNoiseInjection.y, add.u1) annotation (Line(points={{78.54, + -12.06},{80.87,-12.06},{80.87,-11.6},{83.2,-11.6}}, color={0,0, + 127})); + connect(add.y, Load2.u) annotation (Line(points={{92.4,-14},{97.15,-14}, + {97.15,-14.5},{101.9,-14.5}}, color={0,0,127})); + connect(PV.Qref, AddU3.y) annotation (Line(points={{-42,-56},{-54,-56},{-54,-50}, + {-59,-50}}, color={0,0,127})); + connect(L7.n, Bus13.p) + annotation (Line(points={{153.4,-100},{164,-100}}, color={0,0,255})); + connect(IN77.y, Add1.u2) + annotation (Line(points={{119,-166},{128,-166},{128,-160},{136,-160}}, + color={0,0,127})); + connect(L7.p, Bus5.p) annotation (Line(points={{142.6,-100},{62,-100},{62,2},{ + 80,2},{80,16}}, color={0,0,255})); + connect(Add1.u1, IN7) annotation (Line(points={{136,-152},{124,-152},{124,-146}, + {-128,-146},{-128,-122},{-150,-122}}, color={0,0,127})); + connect(Bus13.p, uLTC_VoltageControl.p) + annotation (Line(points={{164,-100},{173,-100}}, color={0,0,255})); + connect(uLTC_VoltageControl.n, Bus14.p) + annotation (Line(points={{195,-100},{208,-100}}, color={0,0,255})); + connect(Add1.y, uLTC_VoltageControl.v_ref) annotation (Line(points={{159,-160}, + {184,-160},{184,-112}}, color={0,0,127})); + connect(Ratio_LTC.y, Add1.u3) annotation (Line(points={{119,-198},{136, + -198},{136,-168}}, + color={0,0,127})); + connect(L2.n,Bus12. p) + annotation (Line(points={{211.4,2},{218,2}}, color={0,0,255})); + connect(L2.p, Bus5.p) + annotation (Line(points={{200.6,2},{110,2},{110,10},{80,10},{80,16}}, + color={0,0,255})); + connect(Bus12.p,aC2DCandDC2AC_MPC. p) + annotation (Line(points={{218,2},{238,2}}, color={0,0,255})); + connect(aC2DCandDC2AC_MPC.n,nMD_MotorTypeI. p) + annotation (Line(points={{278,2},{298,2}}, color={0,0,255})); + connect(voltsHertzController_MPC.m,aC2DCandDC2AC_MPC. m_input) + annotation (Line(points={{262.6,-26},{262.6,-18},{267.091,-18},{ + 267.091,-10}},color={0,0,127})); + connect(voltsHertzController_MPC.Vc,aC2DCandDC2AC_MPC. Vc) annotation ( + Line(points={{253.4,-26},{253.4,-18},{248.909,-18},{248.909,-10}}, + color={0,0,127})); + connect(nMD_MotorTypeI.wr,voltsHertzController_MPC. motor_speed) + annotation (Line(points={{302,-10},{302,-34},{270,-34}},color={0,0,127})); + connect(nMD_MotorTypeI.we,voltsHertzController_MPC. we) + annotation (Line(points={{314,-10},{314,-42},{270,-42}},color={0,0,127})); + connect(IN66.y,add10. u2) annotation (Line(points={{179,-58},{182,-58.4}, + {203.2,-58.4}}, + color={0,0,127})); + connect(IN6,add10. u1) annotation (Line(points={{-150,-100},{-118,-100}, + {-118,-132},{74,-132},{74,-42},{192,-42},{192,-53.6},{203.2, + -53.6}}, color={0,0,127})); + connect(add10.y,voltsHertzController_MPC. W_ref) annotation (Line(points={{212.4, + -56},{226,-56},{226,-38},{246,-38}}, color={0,0,127})); + connect(load.p, Bus14.p) + annotation (Line(points={{240,-100},{208,-100}}, color={0,0,255})); + annotation(Diagram(coordinateSystem(preserveAspectRatio=false, + extent={{-240,-240},{340,140}}), graphics={ + Rectangle( + extent={{-160,30},{-132,-152}}, + lineColor={0,140,72}, + lineThickness=0.5), + Rectangle( + extent={{-128,36},{124,-124}}, + lineColor={238,46,47}, + lineThickness=0.5), + Rectangle( + extent={{-128,98},{124,38}}, + lineColor={0,128,255}, + lineThickness=0.5), + Text( + extent={{78,-106},{114,-120}}, + textColor={238,46,47}, + textString="Microgrid"), + Text( + extent={{76,58},{128,34}}, + textColor={28,108,200}, + textString="Utility Grid"), + Text( + extent={{-30,-102},{34,-124}}, + textColor={0,140,72}, + textString="Linearization Unit"), + Text( + extent={{-164,50},{-132,30}}, + textColor={0,140,72}, + textString="Inputs")}), + Documentation(info=" +

This example system shows how the preparation for resynchronization of Generator 2 to the grid. Note that at 2 seconds, a signal is triggered so voltages between buses 3 and 4 should be equal.

+

Simulate the system for 10 seconds. Variables of interest are:

+ +

Note the behavior of those variables before and after the connection of generator G2 to the main grid.

+"),experiment( + StopTime=10, + __Dymola_NumberOfIntervals=1000, + __Dymola_Algorithm="Dassl"), + Icon(coordinateSystem(extent={{-240,-240},{340,140}}))); + end MPC_LTC_VSD_Test3; + + model MPC_LTC_VSD_Test4 + "THIS ONE IS STABLE, CONTROLLABLE, OBSERVABLE!!!!!!!" + extends Modelica.Icons.Example; + + parameter Boolean equivalentGRID = true; + parameter Boolean equivalentsystem = false; + parameter Real set = 0; + + OpenIPSL.Electrical.Buses.Bus Bus1(v_0=powerFlow.powerflow.bus.V1, angle_0= + powerFlow.powerflow.bus.A1) if not equivalentGRID + annotation (Placement(transformation(extent={{-90,70},{-70,90}}))); + OpenIPSL.Electrical.Buses.Bus Bus2(v_0=powerFlow.powerflow.bus.V2, angle_0= + powerFlow.powerflow.bus.A1) if not equivalentGRID + annotation (Placement(transformation(extent={{-50,70},{-30,90}}))); + OpenIPSL.Electrical.Branches.PSSE.TwoWindingTransformer T1( + R=0.001, + X=0.2, + G=0, + B=0, + VNOM1=13800, + VB1=13800, + VNOM2=6000, + VB2=6000) if not equivalentGRID annotation (Placement(transformation( + extent={{-8,-8},{8,8}}, + rotation=180, + origin={-60,80}))); + OpenIPSL.Examples.OpenCPS.Generators.G1 G1( + enableV_b=true, + v_0=powerFlow.powerflow.bus.V1, + angle_0=powerFlow.powerflow.bus.A1, + P_0=powerFlow.powerflow.machines.PG1, + Q_0=powerFlow.powerflow.machines.QG1, + V_b=6000) if not equivalentGRID + annotation (Placement(transformation(extent={{-112,70},{-92,90}}))); + OpenIPSL.Electrical.Branches.PwLine L1( + R=0.001, + X=0.2, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{-26,76}, + {-14,84}}))); + OpenIPSL.Electrical.Buses.Bus Bus3(v_0=powerFlow.powerflow.bus.V3, angle_0= + powerFlow.powerflow.bus.A3) if not equivalentGRID + annotation (Placement(transformation(extent={{-10,70},{10,90}}))); + OpenIPSL.Electrical.Buses.Bus Bus4(v_0=powerFlow.powerflow.bus.V4, angle_0= + powerFlow.powerflow.bus.V4) if not equivalentGRID + annotation (Placement(transformation(extent={{50,70},{70,90}}))); + OpenIPSL.Electrical.Branches.PwLine L2_1( + R=0.0005, + X=0.1, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{24,86}, + {36,94}}))); + OpenIPSL.Electrical.Branches.PwLine L2_2( + R=0.0005, + X=0.1, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{24,66}, + {36,74}}))); + OpenIPSL.Electrical.Buses.Bus Bus5(angle_0=powerFlow.powerflow.bus.A5, v_0= + powerFlow.powerflow.bus.V5) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=90, + origin={80,16}))); + OpenIPSL.Electrical.Branches.PwLine L3( + R=0.001, + X=0.2, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation( + extent={{-6,-4},{6,4}}, + rotation=-90, + origin={80,60}))); + OpenIPSL.Electrical.Buses.Bus Bus6(v_0=powerFlow.powerflow.bus.V6, angle_0= + powerFlow.powerflow.bus.A6) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,10}))); + OpenIPSL.Electrical.Branches.PSSE.TwoWindingTransformer T2( + G=0, + B=0, + VNOM1=13800, + VB1=13800, + VNOM2=6000, + VB2=6000, + R=0.005, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={10,10}))); + GenerationUnits.PSSE.G2_16MVA G2( + enableV_b=true, + enableP_0=true, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V6, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A6, + V_b=6000, + P_0=powerFlow.powerflow.machines.PG2, + Q_0=powerFlow.powerflow.machines.QG2, + enableangle_0=true) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-30,10}))); + inner OpenIPSL.Electrical.SystemBase SysData(S_b=100000000, fn=60) + annotation (Placement(transformation(extent={{-128,104},{-74,124}}))); + OpenIPSL.Electrical.Loads.PSSE.Load Load1( + V_b=220000, + P_0=powerFlow.powerflow.loads.PL1, + Q_0=powerFlow.powerflow.loads.QL1, + v_0=powerFlow.powerflow.bus.V3, + angle_0=powerFlow.powerflow.bus.A3) if not equivalentGRID + annotation (Placement(transformation(extent={{-20,48},{0,68}}))); + Electrical.Events.Breaker circuitbreaker( + enableTrigger=false, + t_o=5, + rc_enabled=true, + t_rc=1000) if not equivalentGRID annotation (Placement(transformation( + extent={{-4,-4},{4,4}}, + rotation=90, + origin={80,26}))); + + Modelica.Blocks.Interfaces.RealInput IN1(start=0) + "Connector of Real input signal 2" annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-150,10}),iconTransformation(extent={{-10,-10},{10,10}}, origin={-150,10}))); + Modelica.Blocks.Sources.Constant IN11(k=0) + annotation (Placement(transformation(extent={{-108,-2},{-96,10}}))); + Modelica.Blocks.Math.Add AddU1 + annotation (Placement(transformation(extent={{-80,0},{-60,20}}))); + Modelica.Blocks.Sources.Constant IN22(k=0) + annotation (Placement(transformation(extent={{-108,-32},{-96,-20}}))); + Modelica.Blocks.Math.Add AddU2 + annotation (Placement(transformation(extent={{-80,-30},{-60,-10}}))); + Modelica.Blocks.Interfaces.RealInput IN2(start=0) + "Connector of Real input signal 2" + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-150,-12}), iconTransformation(extent={{-10,-10},{10,10}}, + origin={-150,-12}))); + + Modelica.Blocks.Interfaces.RealInput IN3(start = 0) "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-44},{-140,-24}}), + iconTransformation(extent={{-160,-44},{-140,-24}}))); + Modelica.Blocks.Interfaces.RealInput IN4(start = 0) "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-66},{-140,-46}}), + iconTransformation(extent={{-160,-66},{-140,-46}}))); + Modelica.Blocks.Interfaces.RealInput IN5(start = 0) "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-88},{-140,-68}}), + iconTransformation(extent={{-160,-88},{-140,-68}}))); + + PFData.PowerFlow powerFlow(redeclare record PowerFlow = + OpenIPSL.Examples.ModelPredictiveControl.PFData.PFVSD_TCL) + annotation (Placement(transformation(extent={{-68,104},{-48,124}}))); + Electrical.Machines.PSSE.GENCLS IB( + V_b=220000, + v_0=powerFlow.powerflow.bus.V4, + angle_0=powerFlow.powerflow.bus.A4, + P_0=powerFlow.powerflow.machines.Pinf, + Q_0=powerFlow.powerflow.machines.Qinf, + M_b=100000000, + X_d=1) if not equivalentGRID annotation (Placement(transformation(extent={{110,70}, + {100,90}}))); + Electrical.Loads.PSSE.Load_ExtInput Load2( + P_0=powerFlow.powerflow.loads.PL2, + Q_0=powerFlow.powerflow.loads.QL2, + v_0=powerFlow.powerflow.bus.V5, + angle_0=powerFlow.powerflow.bus.A5, + d_P=0, + t1=100, + d_t=1000) + annotation (Placement(transformation(extent={{100,-30},{120,-10}}))); + + inner Modelica.Blocks.Noise.GlobalSeed globalSeed(useAutomaticSeed=false, + fixedSeed=10000) + annotation (Placement(transformation(extent={{-42,102},{-22,122}}))); + + Electrical.Buses.Bus Bus10(v_0=powerFlow.powerflow.bus.V10, angle_0=powerFlow.powerflow.bus.A10) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,-90}))); + Electrical.Branches.PSSE.TwoWindingTransformer T4( + G=0, + B=0, + CW=1, + VNOM1=13800, + VB1=13800, + VNOM2=480, + VB2=480, + R=0.001, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={10,-90}))); + GenerationUnits.PSSE.Solar_Units.SolarMPCSysIdentification + PV( + V_b=480, + P_0=powerFlow.powerflow.machines.PPV, + enableP_0=true, + Q_0=powerFlow.powerflow.machines.QPV, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V8, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A8, + enableangle_0=true) + annotation (Placement(transformation(extent={{-40,-60},{-20,-40}}))); + Modelica.Blocks.Math.Add AddU3 + annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}))); + Modelica.Blocks.Sources.Constant IN33(k=0) + annotation (Placement(transformation(extent={{-108,-62},{-96,-50}}))); + + Modelica.Blocks.Math.Add AddU4 + annotation (Placement(transformation(extent={{-80,-90},{-60,-70}}))); + Modelica.Blocks.Math.Add AddU5 + annotation (Placement(transformation(extent={{-80,-116},{-60,-96}}))); + Modelica.Blocks.Sources.Constant IN44(k=0) + annotation (Placement(transformation(extent={{-108,-92},{-96,-80}}))); + Modelica.Blocks.Sources.Constant IN55(k=0) + annotation (Placement(transformation(extent={{-108,-118},{-96,-106}}))); + GenerationUnits.PSSE.Battery_Units.BESSMPCSysIdentification + BESS( + V_base=480, + V_b(displayUnit="kV") = 480, + enableV_b=true, + P_0=powerFlow.powerflow.machines.PBESS, + enableP_0=true, + Q_0=powerFlow.powerflow.machines.QBESS, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V10, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A10, + enableangle_0=true) + annotation (Placement(transformation(extent={{-40,-100},{-20,-80}}))); + Electrical.Buses.Bus Bus8(v_0=powerFlow.powerflow.bus.V8, angle_0=powerFlow.powerflow.bus.A8) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,-50}))); + Electrical.Branches.PSSE.TwoWindingTransformer T3( + G=0, + B=0, + CW=1, + VNOM1=13800, + VB1=13800, + VNOM2=480, + VB2=480, + R=0.001, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={12,-50}))); + Electrical.Buses.Bus Bus11(v_0=powerFlow.powerflow.bus.V11, angle_0=powerFlow.powerflow.bus.A11) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,-90}))); + Electrical.Buses.Bus Bus9(v_0=powerFlow.powerflow.bus.V9, angle_0=powerFlow.powerflow.bus.A9) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,-50}))); + Electrical.Buses.Bus Bus7(v_0=powerFlow.powerflow.bus.V7, angle_0=powerFlow.powerflow.bus.A7) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,10}))); + Electrical.Branches.PwLine L4( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,6},{ + 50,14}}))); + Electrical.Branches.PwLine L5( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,-54}, + {50,-46}}))); + Electrical.Branches.PwLine L6( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,-94}, + {50,-86}}))); + Modelica.Blocks.Sources.Sine sine( + amplitude=0, + f=1/260, + phase=3.1415926535898, + startTime=1000) + annotation (Placement(transformation(extent={{68,-36},{78,-26}}))); + Electrical.Loads.NoiseInjections.WhiteNoiseInjection whiteNoiseInjection( + active_sigma=0.000000000000001, + samplePeriod=0.01) + annotation (Placement(transformation(extent={{66,-18},{78,-6}}))); + Modelica.Blocks.Math.Add add + annotation (Placement(transformation(extent={{84,-18},{92,-10}}))); + + Modelica.Blocks.Interfaces.RealInput IN6(start=0) "Connector of Real input signal 2" + annotation (Placement(transformation(extent={{-160,-110},{-140,-90}}), + iconTransformation(extent={{-160,-110},{-140,-90}}))); + Modelica.Blocks.Sources.Constant IN77(k=0) + annotation (Placement(transformation(extent={{98,-176},{118,-156}}))); + Modelica.Blocks.Math.Add3 Add1 + annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + rotation=0, + origin={148,-160}))); + Electrical.Buses.Bus Bus13(angle_0=powerFlow.powerflow.bus.A13, v_0= + powerFlow.powerflow.bus.V13) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={164,-100}))); + Electrical.Branches.PwLine L7( + R=0.001, + X=0.01, + G=0, + B=0) annotation (Placement(transformation(extent={{142,-104},{154,-96}}))); + Electrical.Buses.Bus Bus14(V_b=120, angle_0=powerFlow.powerflow.bus.A14, v_0= + powerFlow.powerflow.bus.V14) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={208,-100}))); + Modelica.Blocks.Interfaces.RealInput IN7 "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-132},{-140,-112}}), + iconTransformation(extent={{-160,-132},{-140,-112}}))); + TCL.ULTC_VoltageControl uLTC_VoltageControl( + Vbus1=13800, + Vbus2(displayUnit="V") = 120, + Vn=13800, + v_0=1, + kT=13800/120, + m0=1, + m_max=1.05, + m_min=0.95) + annotation (Placement(transformation(extent={{174,-110},{194,-90}}))); + Modelica.Blocks.Sources.Constant Ratio_LTC(k=1) + annotation (Placement(transformation(extent={{98,-188},{118,-208}}))); + Modelica.Blocks.Sources.Constant IN66(k=0) + annotation (Placement(transformation(extent={{158,-68},{178,-48}}))); + Electrical.Branches.PwLine L2( + R=0.001, + X=0.01, + G=0, + B=0) annotation (Placement(transformation(extent={{200,-2},{212,6}}))); + Electrical.Buses.Bus Bus12(angle_0=powerFlow.powerflow.bus.A5, + v_0=powerFlow.powerflow.bus.V5) + annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={218,2}))); + Electrical.Machines.ControlsMotors.VariableSpeedDrive.ControllerLogic.VoltsHertzController_MPC + voltsHertzController_MPC( + V_b=13800, + f_max=60, + f_min=0, + m0=0.9537, + Kp=0.5, + Ki=0.2, + rotor_speed_initial=1.9*Modelica.Constants.pi*60) + annotation (Placement(transformation(extent={{240,-66},{258,-46}}))); + Modelica.Blocks.Math.Add add10 + annotation (Placement(transformation(extent={{204,-60},{212,-52}}))); + Electrical.Loads.PSSE.Load load(V_b=120, P_0=500000) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=90, + origin={250,-100}))); + Modelica.Blocks.Sources.Constant Speed(k=356) + annotation (Placement(transformation(extent={{304,-42},{284,-62}}))); + Electrical.Machines.ControlsMotors.VariableSpeedDrive.PowerElectronics.AC2DCandDC2AC_MPC + aC2DCandDC2AC_MPC( + V_b=13800, + v_0=powerFlow.powerflow.bus.V5, + angle_0=powerFlow.powerflow.bus.A5, + Rdc=0.01, + Cdc=0.000001, + m0=0.9537) + annotation (Placement(transformation(extent={{230,-8},{270,12}}))); + Electrical.Loads.PSSE.Load load1(V_b=120, P_0=300000) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=90, + origin={298,2}))); + equation + + // OUT1 = G2.gen.w; + // OUT2 = G2.gen.delta; + // OUT3 = G2.gen.Epq; + // OUT4 = G2.gen.PSIkd; + // OUT5 = G2.gen.PSIppq; + // OUT6 = G2.sEXSMPC.simpleLagLim.state; + // OUT7 = G2.sEXSMPC.leadLag.TF.x_scaled[1]; + // OUT8 = G2.gASTMPC.simpleLagLim.state; + // OUT9 = G2.gASTMPC.simpleLag.state; + // OUT10 = G2.gASTMPC.simpleLag1.state; + // OUT11 = Bus6.v; + // + // OUT12 =PV.rEGCA1_1.Pgen; + // OUT13 =PV.rEGCA1_1.Qgen; + // OUT14 =PV.rEGCA1_1.p.ir; + // OUT15 =PV.rEGCA1_1.p.ii; + // OUT16 = Bus8.v; + // + // OUT17 =BESS.rEGCA1_1.Pgen; + // OUT18 =BESS.rEGCA1_1.Qgen; + // OUT19 =BESS.rEGCA1_1.p.ir; + // OUT20 =BESS.rEGCA1_1.p.ii; + // OUT21 = Bus10.v; + // + // OUT22 = Load2.P; + // OUT23 = Load2.Q; + // + // OUT24= aC2DCandDC2AC_MPC.n.ir; + // OUT25= aC2DCandDC2AC_MPC.n.ii; + // OUT26= aC2DCandDC2AC_MPC.P; + // OUT27= aC2DCandDC2AC_MPC.Q; + // OUT28= nMD_MotorTypeI.wr; + // OUT29= voltsHertzController_MPC.we; + // OUT30= Bus12.v; + // + // OUT31 = Bus5.v; + // OUT32 = Bus5.angle; + + connect(T1.p, Bus2.p) + annotation (Line(points={{-51.2,80},{-40,80}}, color={0,0,255})); + connect(Bus1.p, T1.n) + annotation (Line(points={{-80,80},{-68.8,80}}, color={0,0,255})); + connect(G1.conn, Bus1.p) + annotation (Line(points={{-91,80},{-80,80}}, color={0,0,255})); + connect(L1.n, Bus3.p) + annotation (Line(points={{-14.6,80},{0,80}}, color={0,0,255})); + connect(L1.p, Bus2.p) + annotation (Line(points={{-25.4,80},{-40,80}}, color={0,0,255})); + connect(L2_2.n, Bus4.p) annotation (Line(points={{35.4,70},{44,70},{44,80},{60, + 80}}, color={0,0,255})); + connect(L2_1.n, Bus4.p) annotation (Line(points={{35.4,90},{44,90},{44,80},{60, + 80}}, color={0,0,255})); + connect(L2_1.p, Bus3.p) annotation (Line(points={{24.6,90},{16,90},{16,80},{0, + 80}}, color={0,0,255})); + connect(L2_2.p, Bus3.p) annotation (Line(points={{24.6,70},{16,70},{16,80},{0, + 80}}, color={0,0,255})); + connect(Load1.p, Bus3.p) + annotation (Line(points={{-10,68},{-10,80},{0,80}}, color={0,0,255})); + connect(L3.p, Bus4.p) + annotation (Line(points={{80,65.4},{80,80},{60,80}}, color={0,0,255})); + connect(circuitbreaker.s, Bus5.p) + annotation (Line(points={{80,22},{80,16}}, color={0,0,255})); + connect(circuitbreaker.r, L3.n) + annotation (Line(points={{80,30},{80,54.6}}, color={0,0,255})); + connect(IN11.y, AddU1.u2) annotation (Line(points={{-95.4,4},{-82,4}}, + color={0,0,127})); + connect(IN1, AddU1.u1) annotation (Line(points={{-150,10},{-116,10},{-116,16}, + {-82,16}}, + color={0,0,127})); + + connect(IN22.y,AddU2. u2) annotation (Line(points={{-95.4,-26},{-82,-26}}, + color={0,0,127})); + connect(IN2,AddU2. u1) annotation (Line(points={{-150,-12},{-118,-12},{-118,-14}, + {-82,-14}}, + color={0,0,127})); + connect(AddU2.y, G2.Efd_ref) + annotation (Line(points={{-59,-20},{-52,-20},{-52,4},{-42,4}}, + color={0,0,127})); + connect(AddU1.y, G2.P_ref1) annotation (Line(points={{-59,10},{-52,10},{-52,16}, + {-42,16}}, color={0,0,127})); + connect(IB.p, Bus4.p) + annotation (Line(points={{100,80},{60,80}}, color={0,0,255})); + connect(Load2.p, Bus5.p) annotation (Line(points={{110,-10},{110,10},{80,10},{ + 80,16}}, + color={0,0,255})); + connect(T4.n, Bus10.p) + annotation (Line(points={{-1,-90},{-10,-90}}, color={0,0,255})); + connect(Bus6.p, T2.n) + annotation (Line(points={{-10,10},{-1,10}}, + color={0,0,255})); + connect(IN33.y,AddU3. u2) + annotation (Line(points={{-95.4,-56},{-82,-56}}, color={0,0,127})); + connect(BESS.p1, Bus10.p) + annotation (Line(points={{-20,-90},{-10,-90}}, color={0,0,255})); + connect(BESS.Paux1, AddU4.y) annotation (Line(points={{-42,-84},{-54,-84},{-54, + -80},{-59,-80}}, color={0,0,127})); + connect(IN55.y, AddU5.u2) + annotation (Line(points={{-95.4,-112},{-82,-112}}, color={0,0,127})); + connect(AddU5.y, BESS.Qext1) annotation (Line(points={{-59,-106},{-52,-106},{-52, + -96},{-42,-96}}, color={0,0,127})); + connect(IN44.y, AddU4.u2) + annotation (Line(points={{-95.4,-86},{-82,-86}}, color={0,0,127})); + connect(AddU4.u1,IN4) annotation (Line(points={{-82,-74},{-100,-74},{-100,-70}, + {-116,-70},{-116,-56},{-150,-56}}, color={0,0,127})); + connect(AddU5.u1,IN5) annotation (Line(points={{-82,-100},{-116,-100},{-116,-78}, + {-150,-78}}, color={0,0,127})); + connect(G2.conn, Bus6.p) annotation (Line(points={{-19,10},{-10,10}}, + color={0,0,255})); + connect(AddU3.u1, IN3) annotation (Line(points={{-82,-44},{-118,-44},{-118,-34}, + {-150,-34}}, color={0,0,127})); + connect(PV.p1, Bus8.p) + annotation (Line(points={{-20,-50},{-10,-50}}, color={0,0,255})); + connect(Bus8.p, T3.n) + annotation (Line(points={{-10,-50},{1,-50}}, color={0,0,255})); + connect(T2.p, Bus7.p) annotation (Line(points={{21,10},{25.5,10},{25.5,10},{30, + 10}}, color={0,0,255})); + connect(T3.p, Bus9.p) + annotation (Line(points={{23,-50},{30,-50}}, color={0,0,255})); + connect(T4.p, Bus11.p) + annotation (Line(points={{21,-90},{30,-90}}, color={0,0,255})); + connect(L4.n, Bus5.p) annotation (Line(points={{49.4,10},{60,10},{60,10},{80,10}, + {80,16}}, color={0,0,255})); + connect(L5.n, Bus5.p) annotation (Line(points={{49.4,-50},{60,-50},{60,10},{80, + 10},{80,16}}, color={0,0,255})); + connect(Bus11.p, L6.p) + annotation (Line(points={{30,-90},{38.6,-90}}, color={0,0,255})); + connect(Bus9.p, L5.p) + annotation (Line(points={{30,-50},{38.6,-50}}, color={0,0,255})); + connect(L6.n, Bus5.p) annotation (Line(points={{49.4,-90},{60,-90},{60,10},{80, + 10},{80,16}}, color={0,0,255})); + connect(Bus7.p, L4.p) annotation (Line(points={{30,10},{34.3,10},{34.3,10},{38.6, + 10}}, color={0,0,255})); + connect(sine.y, add.u2) annotation (Line(points={{78.5,-31},{78.5,-16.4}, + {83.2,-16.4}}, color={0,0,127})); + connect(whiteNoiseInjection.y, add.u1) annotation (Line(points={{78.54, + -12.06},{80.87,-12.06},{80.87,-11.6},{83.2,-11.6}}, color={0,0, + 127})); + connect(add.y, Load2.u) annotation (Line(points={{92.4,-14},{97.15,-14}, + {97.15,-14.5},{101.9,-14.5}}, color={0,0,127})); + connect(PV.Qref, AddU3.y) annotation (Line(points={{-42,-56},{-54,-56},{-54,-50}, + {-59,-50}}, color={0,0,127})); + connect(L7.n, Bus13.p) + annotation (Line(points={{153.4,-100},{164,-100}}, color={0,0,255})); + connect(IN77.y, Add1.u2) + annotation (Line(points={{119,-166},{128,-166},{128,-160},{136,-160}}, + color={0,0,127})); + connect(L7.p, Bus5.p) annotation (Line(points={{142.6,-100},{62,-100},{62,2},{ + 80,2},{80,16}}, color={0,0,255})); + connect(Add1.u1, IN7) annotation (Line(points={{136,-152},{124,-152},{124,-146}, + {-128,-146},{-128,-122},{-150,-122}}, color={0,0,127})); + connect(Bus13.p, uLTC_VoltageControl.p) + annotation (Line(points={{164,-100},{173,-100}}, color={0,0,255})); + connect(uLTC_VoltageControl.n, Bus14.p) + annotation (Line(points={{195,-100},{208,-100}}, color={0,0,255})); + connect(Add1.y, uLTC_VoltageControl.v_ref) annotation (Line(points={{159,-160}, + {184,-160},{184,-112}}, color={0,0,127})); + connect(Ratio_LTC.y, Add1.u3) annotation (Line(points={{119,-198},{136, + -198},{136,-168}}, + color={0,0,127})); + connect(L2.n,Bus12. p) + annotation (Line(points={{211.4,2},{218,2}}, color={0,0,255})); + connect(L2.p, Bus5.p) + annotation (Line(points={{200.6,2},{110,2},{110,10},{80,10},{80,16}}, + color={0,0,255})); + connect(IN66.y,add10. u2) annotation (Line(points={{179,-58},{182,-58.4}, + {203.2,-58.4}}, + color={0,0,127})); + connect(IN6,add10. u1) annotation (Line(points={{-150,-100},{-118,-100}, + {-118,-132},{74,-132},{74,-42},{192,-42},{192,-53.6},{203.2, + -53.6}}, color={0,0,127})); + connect(add10.y,voltsHertzController_MPC. W_ref) annotation (Line(points={{212.4, + -56},{238,-56}}, color={0,0,127})); + connect(load.p, Bus14.p) + annotation (Line(points={{240,-100},{208,-100}}, color={0,0,255})); + connect(voltsHertzController_MPC.motor_speed, Speed.y) + annotation (Line(points={{262,-52},{283,-52}}, color={0,0,127})); + connect(Bus12.p, aC2DCandDC2AC_MPC.p) + annotation (Line(points={{218,2},{230,2}}, color={0,0,255})); + connect(aC2DCandDC2AC_MPC.Vc, voltsHertzController_MPC.Vc) annotation ( + Line(points={{240.909,-10},{240.909,-36},{245.4,-36},{245.4,-44}}, + color={0,0,127})); + connect(voltsHertzController_MPC.m, aC2DCandDC2AC_MPC.m_input) + annotation (Line(points={{254.6,-44},{254.6,-18},{259.091,-18},{ + 259.091,-10}}, color={0,0,127})); + connect(aC2DCandDC2AC_MPC.n, load1.p) + annotation (Line(points={{270,2},{288,2}}, color={0,0,255})); + annotation(Diagram(coordinateSystem(preserveAspectRatio=false, + extent={{-240,-240},{340,140}}), graphics={ + Rectangle( + extent={{-160,30},{-132,-152}}, + lineColor={0,140,72}, + lineThickness=0.5), + Rectangle( + extent={{-128,36},{124,-124}}, + lineColor={238,46,47}, + lineThickness=0.5), + Rectangle( + extent={{-128,98},{124,38}}, + lineColor={0,128,255}, + lineThickness=0.5), + Text( + extent={{78,-106},{114,-120}}, + textColor={238,46,47}, + textString="Microgrid"), + Text( + extent={{76,58},{128,34}}, + textColor={28,108,200}, + textString="Utility Grid"), + Text( + extent={{-30,-102},{34,-124}}, + textColor={0,140,72}, + textString="Linearization Unit"), + Text( + extent={{-164,50},{-132,30}}, + textColor={0,140,72}, + textString="Inputs")}), + Documentation(info=" +

This example system shows how the preparation for resynchronization of Generator 2 to the grid. Note that at 2 seconds, a signal is triggered so voltages between buses 3 and 4 should be equal.

+

Simulate the system for 10 seconds. Variables of interest are:

+ +

Note the behavior of those variables before and after the connection of generator G2 to the main grid.

+"),experiment( + StopTime=10, + __Dymola_NumberOfIntervals=1000, + __Dymola_Algorithm="Dassl"), + Icon(coordinateSystem(extent={{-240,-240},{340,140}}))); + end MPC_LTC_VSD_Test4; + + model MPC_LTC_VSD_Linearized1 + "THIS ONE IS STABLE, CONTROLLABLE, OBSERVABLE!!!!!!!" + extends Modelica.Icons.Example; + + parameter Boolean equivalentGRID = true; + parameter Boolean equivalentsystem = false; + parameter Real set = 0; + + OpenIPSL.Electrical.Buses.Bus Bus1(v_0=powerFlow.powerflow.bus.V1, angle_0= + powerFlow.powerflow.bus.A1) if not equivalentGRID + annotation (Placement(transformation(extent={{-90,70},{-70,90}}))); + OpenIPSL.Electrical.Buses.Bus Bus2(v_0=powerFlow.powerflow.bus.V2, angle_0= + powerFlow.powerflow.bus.A1) if not equivalentGRID + annotation (Placement(transformation(extent={{-50,70},{-30,90}}))); + OpenIPSL.Electrical.Branches.PSSE.TwoWindingTransformer T1( + R=0.001, + X=0.2, + G=0, + B=0, + VNOM1=13800, + VB1=13800, + VNOM2=6000, + VB2=6000) if not equivalentGRID annotation (Placement(transformation( + extent={{-8,-8},{8,8}}, + rotation=180, + origin={-60,80}))); + OpenIPSL.Examples.OpenCPS.Generators.G1 G1( + enableV_b=true, + v_0=powerFlow.powerflow.bus.V1, + angle_0=powerFlow.powerflow.bus.A1, + P_0=powerFlow.powerflow.machines.PG1, + Q_0=powerFlow.powerflow.machines.QG1, + V_b=6000) if not equivalentGRID + annotation (Placement(transformation(extent={{-112,70},{-92,90}}))); + OpenIPSL.Electrical.Branches.PwLine L1( + R=0.001, + X=0.2, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{-26,76}, + {-14,84}}))); + OpenIPSL.Electrical.Buses.Bus Bus3(v_0=powerFlow.powerflow.bus.V3, angle_0= + powerFlow.powerflow.bus.A3) if not equivalentGRID + annotation (Placement(transformation(extent={{-10,70},{10,90}}))); + OpenIPSL.Electrical.Buses.Bus Bus4(v_0=powerFlow.powerflow.bus.V4, angle_0= + powerFlow.powerflow.bus.V4) if not equivalentGRID + annotation (Placement(transformation(extent={{50,70},{70,90}}))); + OpenIPSL.Electrical.Branches.PwLine L2_1( + R=0.0005, + X=0.1, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{24,86}, + {36,94}}))); + OpenIPSL.Electrical.Branches.PwLine L2_2( + R=0.0005, + X=0.1, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{24,66}, + {36,74}}))); + OpenIPSL.Electrical.Buses.Bus Bus5(angle_0=powerFlow.powerflow.bus.A5, v_0= + powerFlow.powerflow.bus.V5) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=90, + origin={80,16}))); + OpenIPSL.Electrical.Branches.PwLine L3( + R=0.001, + X=0.2, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation( + extent={{-6,-4},{6,4}}, + rotation=-90, + origin={80,60}))); + OpenIPSL.Electrical.Buses.Bus Bus6(v_0=powerFlow.powerflow.bus.V6, angle_0= + powerFlow.powerflow.bus.A6) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,10}))); + OpenIPSL.Electrical.Branches.PSSE.TwoWindingTransformer T2( + G=0, + B=0, + VNOM1=13800, + VB1=13800, + VNOM2=6000, + VB2=6000, + R=0.005, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={10,10}))); + GenerationUnits.PSSE.G2_16MVA G2( + enableV_b=true, + enableP_0=true, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V6, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A6, + V_b=6000, + P_0=powerFlow.powerflow.machines.PG2, + Q_0=powerFlow.powerflow.machines.QG2, + enableangle_0=true) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-30,10}))); + inner OpenIPSL.Electrical.SystemBase SysData(S_b=100000000, fn=60) + annotation (Placement(transformation(extent={{-128,104},{-74,124}}))); + OpenIPSL.Electrical.Loads.PSSE.Load Load1( + V_b=220000, + P_0=powerFlow.powerflow.loads.PL1, + Q_0=powerFlow.powerflow.loads.QL1, + v_0=powerFlow.powerflow.bus.V3, + angle_0=powerFlow.powerflow.bus.A3) if not equivalentGRID + annotation (Placement(transformation(extent={{-20,48},{0,68}}))); + Electrical.Events.Breaker circuitbreaker( + enableTrigger=false, + t_o=0.25, + rc_enabled=true, + t_rc=1000) if not equivalentGRID annotation (Placement(transformation( + extent={{-4,-4},{4,4}}, + rotation=90, + origin={80,26}))); + + Modelica.Blocks.Interfaces.RealInput IN1(start=0) + "Connector of Real input signal 2" annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-150,10}),iconTransformation(extent={{-10,-10},{10,10}}, origin={-150,10}))); + Modelica.Blocks.Sources.Constant IN11(k=0) + annotation (Placement(transformation(extent={{-108,-2},{-96,10}}))); + Modelica.Blocks.Math.Add AddU1 + annotation (Placement(transformation(extent={{-80,0},{-60,20}}))); + Modelica.Blocks.Sources.Constant IN22(k=0) + annotation (Placement(transformation(extent={{-108,-32},{-96,-20}}))); + Modelica.Blocks.Math.Add AddU2 + annotation (Placement(transformation(extent={{-80,-30},{-60,-10}}))); + Modelica.Blocks.Interfaces.RealInput IN2(start=0) + "Connector of Real input signal 2" + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-150,-12}), iconTransformation(extent={{-10,-10},{10,10}}, + origin={-150,-12}))); + + Modelica.Blocks.Interfaces.RealInput IN3(start = 0) "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-44},{-140,-24}}), + iconTransformation(extent={{-160,-44},{-140,-24}}))); + Modelica.Blocks.Interfaces.RealInput IN4(start = 0) "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-66},{-140,-46}}), + iconTransformation(extent={{-160,-66},{-140,-46}}))); + Modelica.Blocks.Interfaces.RealInput IN5(start = 0) "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-88},{-140,-68}}), + iconTransformation(extent={{-160,-88},{-140,-68}}))); + + PFData.PowerFlow powerFlow(redeclare record PowerFlow = + OpenIPSL.Examples.ModelPredictiveControl.PFData.PFVSD_TCL) + annotation (Placement(transformation(extent={{-68,104},{-48,124}}))); + Electrical.Machines.PSSE.GENCLS IB( + V_b=220000, + v_0=powerFlow.powerflow.bus.V4, + angle_0=powerFlow.powerflow.bus.A4, + P_0=powerFlow.powerflow.machines.Pinf, + Q_0=powerFlow.powerflow.machines.Qinf, + M_b=100000000, + X_d=1) if not equivalentGRID annotation (Placement(transformation(extent={{110,70}, + {100,90}}))); + Electrical.Loads.PSSE.Load_ExtInput Load2( + P_0=powerFlow.powerflow.loads.PL2, + Q_0=powerFlow.powerflow.loads.QL2, + v_0=powerFlow.powerflow.bus.V5, + angle_0=powerFlow.powerflow.bus.A5, + d_P=0, + t1=100, + d_t=1000) + annotation (Placement(transformation(extent={{100,-30},{120,-10}}))); + + inner Modelica.Blocks.Noise.GlobalSeed globalSeed(useAutomaticSeed=false, + fixedSeed=10000) + annotation (Placement(transformation(extent={{-42,102},{-22,122}}))); + + Electrical.Buses.Bus Bus10(v_0=powerFlow.powerflow.bus.V10, angle_0=powerFlow.powerflow.bus.A10) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,-90}))); + Electrical.Branches.PSSE.TwoWindingTransformer T4( + G=0, + B=0, + CW=1, + VNOM1=13800, + VB1=13800, + VNOM2=480, + VB2=480, + R=0.001, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={10,-90}))); + GenerationUnits.PSSE.Solar_Units.SolarMPCSysIdentification + PV( + V_b=480, + P_0=powerFlow.powerflow.machines.PPV, + enableP_0=true, + Q_0=powerFlow.powerflow.machines.QPV, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V8, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A8, + enableangle_0=true) + annotation (Placement(transformation(extent={{-40,-60},{-20,-40}}))); + Modelica.Blocks.Math.Add AddU3 + annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}))); + Modelica.Blocks.Sources.Constant IN33(k=0) + annotation (Placement(transformation(extent={{-108,-62},{-96,-50}}))); + + Modelica.Blocks.Math.Add AddU4 + annotation (Placement(transformation(extent={{-80,-90},{-60,-70}}))); + Modelica.Blocks.Math.Add AddU5 + annotation (Placement(transformation(extent={{-80,-116},{-60,-96}}))); + Modelica.Blocks.Sources.Constant IN44(k=0) + annotation (Placement(transformation(extent={{-108,-92},{-96,-80}}))); + Modelica.Blocks.Sources.Constant IN55(k=0) + annotation (Placement(transformation(extent={{-108,-118},{-96,-106}}))); + GenerationUnits.PSSE.Battery_Units.BESSMPCSysIdentification + BESS( + V_base=480, + V_b(displayUnit="kV") = 480, + enableV_b=true, + P_0=powerFlow.powerflow.machines.PBESS, + enableP_0=true, + Q_0=powerFlow.powerflow.machines.QBESS, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V10, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A10, + enableangle_0=true) + annotation (Placement(transformation(extent={{-40,-100},{-20,-80}}))); + Electrical.Buses.Bus Bus8(v_0=powerFlow.powerflow.bus.V8, angle_0=powerFlow.powerflow.bus.A8) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,-50}))); + Electrical.Branches.PSSE.TwoWindingTransformer T3( + G=0, + B=0, + CW=1, + VNOM1=13800, + VB1=13800, + VNOM2=480, + VB2=480, + R=0.001, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={12,-50}))); + Electrical.Buses.Bus Bus11(v_0=powerFlow.powerflow.bus.V11, angle_0=powerFlow.powerflow.bus.A11) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,-90}))); + Electrical.Buses.Bus Bus9(v_0=powerFlow.powerflow.bus.V9, angle_0=powerFlow.powerflow.bus.A9) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,-50}))); + Electrical.Buses.Bus Bus7(v_0=powerFlow.powerflow.bus.V7, angle_0=powerFlow.powerflow.bus.A7) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,10}))); + Electrical.Branches.PwLine L4( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,6},{ + 50,14}}))); + Electrical.Branches.PwLine L5( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,-54}, + {50,-46}}))); + Electrical.Branches.PwLine L6( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,-94}, + {50,-86}}))); + Modelica.Blocks.Sources.Sine sine( + amplitude=0, + f=1/260, + phase=3.1415926535898, + startTime=1000) + annotation (Placement(transformation(extent={{68,-36},{78,-26}}))); + Electrical.Loads.NoiseInjections.WhiteNoiseInjection whiteNoiseInjection( + active_sigma=0.000000000000001, + samplePeriod=0.01) + annotation (Placement(transformation(extent={{66,-18},{78,-6}}))); + Modelica.Blocks.Math.Add add + annotation (Placement(transformation(extent={{84,-18},{92,-10}}))); + + Modelica.Blocks.Sources.Constant IN66(k=0) + annotation (Placement(transformation(extent={{140,-60},{160,-40}}))); + Electrical.Branches.PwLine L2( + R=0.001, + X=0.01, + G=0, + B=0) annotation (Placement(transformation(extent={{182,6},{194,14}}))); + Electrical.Buses.Bus Bus12(angle_0=powerFlow.powerflow.bus.A5, v_0= + powerFlow.powerflow.bus.V5) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={200,10}))); + Electrical.Machines.ControlsMotors.VariableSpeedDrive.PowerElectronics.AC2DCandDC2AC_MPC + aC2DCandDC2AC_MPC( + V_b=13800, + v_0=powerFlow.powerflow.bus.V5, + angle_0=powerFlow.powerflow.bus.A5, + Rdc=0.01, + Cdc=0.000001, + m0=0.9537) + annotation (Placement(transformation(extent={{220,0},{260,20}}))); + Electrical.Machines.NonMultiDomain.Motors.ThreePhase.PSAT.NMD_MotorTypeI + nMD_MotorTypeI( + M_b=5000000, + V_b=13800, + Sup=false, + a=0, + b=0, + c=0.1) + annotation (Placement(transformation(extent={{300,0},{280,20}}))); + Electrical.Machines.ControlsMotors.VariableSpeedDrive.ControllerLogic.VoltsHertzController_MPC + voltsHertzController_MPC( + V_b=13800, + f_max=60, + f_min=0, + m0=0.9537, + Kp=0.5, + Ki=0.2, + rotor_speed_initial=1.9*Modelica.Constants.pi*60) + annotation (Placement(transformation(extent={{230,-40},{248,-20}}))); + Modelica.Blocks.Interfaces.RealInput IN6(start=0) "Connector of Real input signal 2" + annotation (Placement(transformation(extent={{-160,-110},{-140,-90}}), + iconTransformation(extent={{-160,-110},{-140,-90}}))); + Modelica.Blocks.Interfaces.RealOutput OUT1 + annotation (Placement(transformation(extent={{-264,68},{-244,88}}))); + Modelica.Blocks.Interfaces.RealOutput OUT2 + annotation (Placement(transformation(extent={{-264,48},{-244,68}}))); + Modelica.Blocks.Interfaces.RealOutput OUT3 + annotation (Placement(transformation(extent={{-264,28},{-244,48}}))); + Modelica.Blocks.Interfaces.RealOutput OUT4 + annotation (Placement(transformation(extent={{-264,8},{-244,28}}))); + Modelica.Blocks.Interfaces.RealOutput OUT5 + annotation (Placement(transformation(extent={{-264,-12},{-244,8}}))); + Modelica.Blocks.Interfaces.RealOutput OUT6 + annotation (Placement(transformation(extent={{-264,-32},{-244,-12}}))); + Modelica.Blocks.Interfaces.RealOutput OUT7 + annotation (Placement(transformation(extent={{-264,-52},{-244,-32}}))); + Modelica.Blocks.Interfaces.RealOutput OUT8 + annotation (Placement(transformation(extent={{-264,-72},{-244,-52}}))); + Modelica.Blocks.Interfaces.RealOutput OUT9 + annotation (Placement(transformation(extent={{-264,-92},{-244,-72}}))); + Modelica.Blocks.Interfaces.RealOutput OUT10 + annotation (Placement(transformation(extent={{-264,-112},{-244,-92}}))); + Modelica.Blocks.Interfaces.RealOutput OUT11 + annotation (Placement(transformation(extent={{-240,68},{-220,88}}))); + Modelica.Blocks.Interfaces.RealOutput OUT12 + annotation (Placement(transformation(extent={{-240,48},{-220,68}}))); + Modelica.Blocks.Interfaces.RealOutput OUT13 + annotation (Placement(transformation(extent={{-240,28},{-220,48}}))); + Modelica.Blocks.Interfaces.RealOutput OUT14 + annotation (Placement(transformation(extent={{-240,8},{-220,28}}))); + Modelica.Blocks.Interfaces.RealOutput OUT15 + annotation (Placement(transformation(extent={{-240,-12},{-220,8}}))); + Modelica.Blocks.Interfaces.RealOutput OUT16 + annotation (Placement(transformation(extent={{-240,-32},{-220,-12}}))); + Modelica.Blocks.Interfaces.RealOutput OUT17 + annotation (Placement(transformation(extent={{-240,-52},{-220,-32}}))); + Modelica.Blocks.Interfaces.RealOutput OUT18 + annotation (Placement(transformation(extent={{-240,-72},{-220,-52}}))); + Modelica.Blocks.Interfaces.RealOutput OUT19 + annotation (Placement(transformation(extent={{-240,-92},{-220,-72}}))); + Modelica.Blocks.Interfaces.RealOutput OUT20 + annotation (Placement(transformation(extent={{-240,-112},{-220,-92}}))); + Modelica.Blocks.Interfaces.RealOutput OUT21 + annotation (Placement(transformation(extent={{-220,68},{-200,88}}))); + Modelica.Blocks.Interfaces.RealOutput OUT22 + annotation (Placement(transformation(extent={{-220,48},{-200,68}}))); + Modelica.Blocks.Interfaces.RealOutput OUT23 + annotation (Placement(transformation(extent={{-220,28},{-200,48}}))); + Modelica.Blocks.Interfaces.RealOutput OUT24 + annotation (Placement(transformation(extent={{-220,8},{-200,28}}))); + Modelica.Blocks.Interfaces.RealOutput OUT25 + annotation (Placement(transformation(extent={{-220,-12},{-200,8}}))); + Modelica.Blocks.Interfaces.RealOutput OUT26 + annotation (Placement(transformation(extent={{-220,-32},{-200,-12}}))); + Modelica.Blocks.Interfaces.RealOutput OUT27 + annotation (Placement(transformation(extent={{-220,-52},{-200,-32}}))); + Modelica.Blocks.Interfaces.RealOutput OUT28 + annotation (Placement(transformation(extent={{-220,-72},{-200,-52}}))); + Modelica.Blocks.Interfaces.RealOutput OUT29 + annotation (Placement(transformation(extent={{-220,-92},{-200,-72}}))); + Modelica.Blocks.Interfaces.RealOutput OUT30 + annotation (Placement(transformation(extent={{-220,-112},{-200,-92}}))); + Modelica.Blocks.Interfaces.RealOutput OUT31 + annotation (Placement(transformation(extent={{-200,68},{-180,88}}))); + Modelica.Blocks.Math.Add add10 + annotation (Placement(transformation(extent={{186,-52},{194,-44}}))); + Modelica.Blocks.Interfaces.RealInput IN7 + "Connector of Real input signal 1" annotation (Placement( + transformation(extent={{-160,-160},{-140,-140}}), + iconTransformation(extent={{-160,-160},{-140,-140}}))); + Modelica.Blocks.Sources.Constant IN77(k=0) + annotation (Placement(transformation(extent={{142,-158},{162,-138}}))); + Modelica.Blocks.Math.Add3 Add1 + annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + rotation=0, + origin={192,-142}))); + Modelica.Blocks.Sources.Constant Ratio_LTC(k=1) + annotation (Placement(transformation(extent={{142,-170},{162,-190}}))); + Electrical.Buses.Bus Bus13(angle_0=powerFlow.powerflow.bus.A13, v_0= + powerFlow.powerflow.bus.V13) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={208,-82}))); + Electrical.Branches.PwLine L7( + R=0.001, + X=0.01, + G=0, + B=0) annotation (Placement(transformation(extent={{186,-86},{198,-78}}))); + Electrical.Buses.Bus Bus14( + V_b=120, + angle_0=powerFlow.powerflow.bus.A14, + v_0=powerFlow.powerflow.bus.V14) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={252,-82}))); + Electrical.Loads.PSAT.TCL_randominit tCL_randominit( + Sn=1e6, + v0=1, + p0=0.5, + R=100, + C=80, + start0=1) + annotation (Placement(transformation(extent={{302,-92},{322,-72}}))); + Modelica.Blocks.Sources.Constant const(k=0) + annotation (Placement(transformation(extent={{322,-64},{302,-44}}))); + TCL.ULTC_VoltageControl uLTC_VoltageControl( + Vbus1=13800, + Vbus2(displayUnit="V") = 120, + Vn=13800, + v_0=1, + kT=13800/120, + m0=1, + m_max=1.05, + m_min=0.95, + K=0.01) + annotation (Placement(transformation(extent={{218,-92},{238,-72}}))); + equation + + OUT1 = G2.gen.w; + OUT2 = G2.gen.delta; + OUT3 = G2.gen.Epq; + OUT4 = G2.gen.PSIkd; + OUT5 = G2.gen.PSIppq; + OUT6 = G2.sEXSMPC.simpleLagLim.state; + OUT7 = G2.sEXSMPC.leadLag.TF.x_scaled[1]; + OUT8 = G2.gASTMPC.simpleLagLim.state; + OUT9 = G2.gASTMPC.simpleLag.state; + OUT10 = G2.gASTMPC.simpleLag1.state; + OUT11 = Bus6.v; + + OUT12 =PV.rEGCA1_1.Pgen; + OUT13 =PV.rEGCA1_1.Qgen; + OUT14 =PV.rEGCA1_1.p.ir; + OUT15 =PV.rEGCA1_1.p.ii; + OUT16 = Bus8.v; + + OUT17 =BESS.rEGCA1_1.Pgen; + OUT18 =BESS.rEGCA1_1.Qgen; + OUT19 =BESS.rEGCA1_1.p.ir; + OUT20 =BESS.rEGCA1_1.p.ii; + OUT21 = Bus10.v; + + OUT22 = tCL_randominit.theta; + OUT23 = uLTC_VoltageControl.m; + + OUT24= aC2DCandDC2AC_MPC.n.ir; + OUT25= aC2DCandDC2AC_MPC.n.ii; + OUT26= aC2DCandDC2AC_MPC.P; + + OUT27= nMD_MotorTypeI.wr; + OUT28= voltsHertzController_MPC.we; + OUT29= Bus12.v; + + OUT30 = Bus5.v; + OUT31 = Bus5.angle; + + connect(T1.p, Bus2.p) + annotation (Line(points={{-51.2,80},{-40,80}}, color={0,0,255})); + connect(Bus1.p, T1.n) + annotation (Line(points={{-80,80},{-68.8,80}}, color={0,0,255})); + connect(G1.conn, Bus1.p) + annotation (Line(points={{-91,80},{-80,80}}, color={0,0,255})); + connect(L1.n, Bus3.p) + annotation (Line(points={{-14.6,80},{0,80}}, color={0,0,255})); + connect(L1.p, Bus2.p) + annotation (Line(points={{-25.4,80},{-40,80}}, color={0,0,255})); + connect(L2_2.n, Bus4.p) annotation (Line(points={{35.4,70},{44,70},{44,80},{60, + 80}}, color={0,0,255})); + connect(L2_1.n, Bus4.p) annotation (Line(points={{35.4,90},{44,90},{44,80},{60, + 80}}, color={0,0,255})); + connect(L2_1.p, Bus3.p) annotation (Line(points={{24.6,90},{16,90},{16,80},{0, + 80}}, color={0,0,255})); + connect(L2_2.p, Bus3.p) annotation (Line(points={{24.6,70},{16,70},{16,80},{0, + 80}}, color={0,0,255})); + connect(Load1.p, Bus3.p) + annotation (Line(points={{-10,68},{-10,80},{0,80}}, color={0,0,255})); + connect(L3.p, Bus4.p) + annotation (Line(points={{80,65.4},{80,80},{60,80}}, color={0,0,255})); + connect(circuitbreaker.s, Bus5.p) + annotation (Line(points={{80,22},{80,16}}, color={0,0,255})); + connect(circuitbreaker.r, L3.n) + annotation (Line(points={{80,30},{80,54.6}}, color={0,0,255})); + connect(IN11.y, AddU1.u2) annotation (Line(points={{-95.4,4},{-82,4}}, + color={0,0,127})); + connect(IN1, AddU1.u1) annotation (Line(points={{-150,10},{-116,10},{-116,16}, + {-82,16}}, + color={0,0,127})); + + connect(IN22.y,AddU2. u2) annotation (Line(points={{-95.4,-26},{-82,-26}}, + color={0,0,127})); + connect(IN2,AddU2. u1) annotation (Line(points={{-150,-12},{-118,-12},{-118,-14}, + {-82,-14}}, + color={0,0,127})); + connect(AddU2.y, G2.Efd_ref) + annotation (Line(points={{-59,-20},{-52,-20},{-52,4},{-42,4}}, + color={0,0,127})); + connect(AddU1.y, G2.P_ref1) annotation (Line(points={{-59,10},{-52,10},{-52,16}, + {-42,16}}, color={0,0,127})); + connect(IB.p, Bus4.p) + annotation (Line(points={{100,80},{60,80}}, color={0,0,255})); + connect(Load2.p, Bus5.p) annotation (Line(points={{110,-10},{110,10},{80,10},{ + 80,16}}, + color={0,0,255})); + connect(T4.n, Bus10.p) + annotation (Line(points={{-1,-90},{-10,-90}}, color={0,0,255})); + connect(Bus6.p, T2.n) + annotation (Line(points={{-10,10},{-1,10}}, + color={0,0,255})); + connect(IN33.y,AddU3. u2) + annotation (Line(points={{-95.4,-56},{-82,-56}}, color={0,0,127})); + connect(BESS.p1, Bus10.p) + annotation (Line(points={{-20,-90},{-10,-90}}, color={0,0,255})); + connect(BESS.Paux1, AddU4.y) annotation (Line(points={{-42,-84},{-54,-84},{-54, + -80},{-59,-80}}, color={0,0,127})); + connect(IN55.y, AddU5.u2) + annotation (Line(points={{-95.4,-112},{-82,-112}}, color={0,0,127})); + connect(AddU5.y, BESS.Qext1) annotation (Line(points={{-59,-106},{-52,-106},{-52, + -96},{-42,-96}}, color={0,0,127})); + connect(IN44.y, AddU4.u2) + annotation (Line(points={{-95.4,-86},{-82,-86}}, color={0,0,127})); + connect(AddU4.u1,IN4) annotation (Line(points={{-82,-74},{-100,-74},{-100,-70}, + {-116,-70},{-116,-56},{-150,-56}}, color={0,0,127})); + connect(AddU5.u1,IN5) annotation (Line(points={{-82,-100},{-116,-100},{-116,-78}, + {-150,-78}}, color={0,0,127})); + connect(G2.conn, Bus6.p) annotation (Line(points={{-19,10},{-10,10}}, + color={0,0,255})); + connect(AddU3.u1, IN3) annotation (Line(points={{-82,-44},{-118,-44},{-118,-34}, + {-150,-34}}, color={0,0,127})); + connect(PV.p1, Bus8.p) + annotation (Line(points={{-20,-50},{-10,-50}}, color={0,0,255})); + connect(Bus8.p, T3.n) + annotation (Line(points={{-10,-50},{1,-50}}, color={0,0,255})); + connect(T2.p, Bus7.p) annotation (Line(points={{21,10},{25.5,10},{25.5,10},{30, + 10}}, color={0,0,255})); + connect(T3.p, Bus9.p) + annotation (Line(points={{23,-50},{30,-50}}, color={0,0,255})); + connect(T4.p, Bus11.p) + annotation (Line(points={{21,-90},{30,-90}}, color={0,0,255})); + connect(L4.n, Bus5.p) annotation (Line(points={{49.4,10},{60,10},{60,10},{80,10}, + {80,16}}, color={0,0,255})); + connect(L5.n, Bus5.p) annotation (Line(points={{49.4,-50},{60,-50},{60,10},{80, + 10},{80,16}}, color={0,0,255})); + connect(Bus11.p, L6.p) + annotation (Line(points={{30,-90},{38.6,-90}}, color={0,0,255})); + connect(Bus9.p, L5.p) + annotation (Line(points={{30,-50},{38.6,-50}}, color={0,0,255})); + connect(L6.n, Bus5.p) annotation (Line(points={{49.4,-90},{60,-90},{60,10},{80, + 10},{80,16}}, color={0,0,255})); + connect(Bus7.p, L4.p) annotation (Line(points={{30,10},{34.3,10},{34.3,10},{38.6, + 10}}, color={0,0,255})); + connect(sine.y, add.u2) annotation (Line(points={{78.5,-31},{78.5,-16.4}, + {83.2,-16.4}}, color={0,0,127})); + connect(whiteNoiseInjection.y, add.u1) annotation (Line(points={{78.54, + -12.06},{80.87,-12.06},{80.87,-11.6},{83.2,-11.6}}, color={0,0, + 127})); + connect(add.y, Load2.u) annotation (Line(points={{92.4,-14},{97.15,-14}, + {97.15,-14.5},{101.9,-14.5}}, color={0,0,127})); + connect(PV.Qref, AddU3.y) annotation (Line(points={{-42,-56},{-54,-56},{-54,-50}, + {-59,-50}}, color={0,0,127})); + connect(L2.n,Bus12. p) + annotation (Line(points={{193.4,10},{200,10}}, color={0,0,255})); + connect(L2.p, Bus5.p) + annotation (Line(points={{182.6,10},{80,10},{80,16}}, color={0,0,255})); + connect(Bus12.p, aC2DCandDC2AC_MPC.p) + annotation (Line(points={{200,10},{220,10}}, color={0,0,255})); + connect(aC2DCandDC2AC_MPC.n, nMD_MotorTypeI.p) + annotation (Line(points={{260,10},{280,10}}, color={0,0,255})); + connect(voltsHertzController_MPC.m, aC2DCandDC2AC_MPC.m_input) + annotation (Line(points={{244.6,-18},{244.6,-10},{249.091,-10},{249.091,-2}}, + color={0,0,127})); + connect(voltsHertzController_MPC.Vc, aC2DCandDC2AC_MPC.Vc) annotation ( + Line(points={{235.4,-18},{235.4,-10},{230.909,-10},{230.909,-2}}, + color={0,0,127})); + connect(nMD_MotorTypeI.wr, voltsHertzController_MPC.motor_speed) + annotation (Line(points={{284,-2},{284,-26},{252,-26}}, color={0,0,127})); + connect(nMD_MotorTypeI.we, voltsHertzController_MPC.we) + annotation (Line(points={{296,-2},{296,-34},{252,-34}}, color={0,0,127})); + connect(aC2DCandDC2AC_MPC.nr_input, nMD_MotorTypeI.wr) annotation (Line( + points={{261.818,3},{268,3},{268,-2},{284,-2}}, color={0,0,127})); + connect(IN66.y, add10.u2) annotation (Line(points={{161,-50},{164,-50.4},{185.2, + -50.4}}, color={0,0,127})); + connect(IN6, add10.u1) annotation (Line(points={{-150,-100},{-120,-100},{-120, + -132},{132,-132},{132,-24},{185.2,-24},{185.2,-45.6}}, color={0,0,127})); + connect(add10.y, voltsHertzController_MPC.W_ref) annotation (Line(points={{194.4, + -48},{208,-48},{208,-30},{228,-30}}, color={0,0,127})); + connect(IN77.y,Add1. u2) + annotation (Line(points={{163,-148},{172,-148},{172,-142},{180,-142}}, + color={0,0,127})); + connect(Add1.u1, IN7) annotation (Line(points={{180,-134},{168,-134},{168,-132}, + {134,-132},{134,-150},{-150,-150}}, color={0,0,127})); + connect(Ratio_LTC.y,Add1. u3) annotation (Line(points={{163,-180},{180,-180},{ + 180,-150}}, color={0,0,127})); + connect(Bus14.p,tCL_randominit. p) + annotation (Line(points={{252,-82},{300.5,-82}}, color={0,0,255})); + connect(const.y,tCL_randominit. u) annotation (Line(points={{301,-54},{278,-54}, + {278,-77.4812},{300,-77.4812}}, color={0,0,127})); + connect(L7.n,Bus13. p) + annotation (Line(points={{197.4,-82},{208,-82}}, color={0,0,255})); + connect(L7.p, Bus5.p) annotation (Line(points={{186.6,-82},{128,-82},{128,10}, + {80,10},{80,16}}, + color={0,0,255})); + connect(Bus13.p,uLTC_VoltageControl. p) + annotation (Line(points={{208,-82},{217,-82}}, color={0,0,255})); + connect(uLTC_VoltageControl.n,Bus14. p) + annotation (Line(points={{239,-82},{252,-82}}, color={0,0,255})); + connect(Add1.y, uLTC_VoltageControl.v_ref) annotation (Line(points={{203,-142}, + {228,-142},{228,-94}}, color={0,0,127})); + annotation(Diagram(coordinateSystem(preserveAspectRatio=false, + extent={{-140,-200},{340,140}}), graphics={ + Rectangle( + extent={{-160,30},{-132,-168}}, + lineColor={0,140,72}, + lineThickness=0.5), + Rectangle( + extent={{-128,36},{124,-124}}, + lineColor={238,46,47}, + lineThickness=0.5), + Rectangle( + extent={{-128,98},{124,38}}, + lineColor={0,128,255}, + lineThickness=0.5), + Text( + extent={{78,-106},{114,-120}}, + textColor={238,46,47}, + textString="Microgrid"), + Text( + extent={{76,58},{128,34}}, + textColor={28,108,200}, + textString="Utility Grid"), + Text( + extent={{-30,-102},{34,-124}}, + textColor={0,140,72}, + textString="Linearization Unit"), + Text( + extent={{-164,50},{-132,30}}, + textColor={0,140,72}, + textString="Inputs")}), + Documentation(info=" +

This example system shows how the preparation for resynchronization of Generator 2 to the grid. Note that at 2 seconds, a signal is triggered so voltages between buses 3 and 4 should be equal.

+

Simulate the system for 10 seconds. Variables of interest are:

+ +

Note the behavior of those variables before and after the connection of generator G2 to the main grid.

+"),experiment( + StopTime=10, + __Dymola_NumberOfIntervals=1000, + __Dymola_Algorithm="Dassl"), + Icon(coordinateSystem(extent={{-140,-200},{340,140}}))); + end MPC_LTC_VSD_Linearized1; + + model MPC_LTC_VSD_Original1 + "THIS ONE IS STABLE, CONTROLLABLE, OBSERVABLE!!!!!!!" + extends Modelica.Icons.Example; + + parameter Boolean equivalentGRID = false; + parameter Boolean equivalentsystem = false; + parameter Real set = 0; + + OpenIPSL.Electrical.Buses.Bus Bus1(v_0=powerFlow.powerflow.bus.V1, angle_0= + powerFlow.powerflow.bus.A1) if not equivalentGRID + annotation (Placement(transformation(extent={{-90,70},{-70,90}}))); + OpenIPSL.Electrical.Buses.Bus Bus2(v_0=powerFlow.powerflow.bus.V2, angle_0= + powerFlow.powerflow.bus.A1) if not equivalentGRID + annotation (Placement(transformation(extent={{-50,70},{-30,90}}))); + OpenIPSL.Electrical.Branches.PSSE.TwoWindingTransformer T1( + R=0.001, + X=0.2, + G=0, + B=0, + VNOM1=13800, + VB1=13800, + VNOM2=6000, + VB2=6000) if not equivalentGRID annotation (Placement(transformation( + extent={{-8,-8},{8,8}}, + rotation=180, + origin={-60,80}))); + OpenIPSL.Examples.OpenCPS.Generators.G1 G1( + enableV_b=true, + v_0=powerFlow.powerflow.bus.V1, + angle_0=powerFlow.powerflow.bus.A1, + P_0=powerFlow.powerflow.machines.PG1, + Q_0=powerFlow.powerflow.machines.QG1, + V_b=6000) if not equivalentGRID + annotation (Placement(transformation(extent={{-112,70},{-92,90}}))); + OpenIPSL.Electrical.Branches.PwLine L1( + R=0.001, + X=0.2, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{-26,76}, + {-14,84}}))); + OpenIPSL.Electrical.Buses.Bus Bus3(v_0=powerFlow.powerflow.bus.V3, angle_0= + powerFlow.powerflow.bus.A3) if not equivalentGRID + annotation (Placement(transformation(extent={{-10,70},{10,90}}))); + OpenIPSL.Electrical.Buses.Bus Bus4(v_0=powerFlow.powerflow.bus.V4, angle_0= + powerFlow.powerflow.bus.V4) if not equivalentGRID + annotation (Placement(transformation(extent={{50,70},{70,90}}))); + OpenIPSL.Electrical.Branches.PwLine L2_1( + R=0.0005, + X=0.1, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{24,86}, + {36,94}}))); + OpenIPSL.Electrical.Branches.PwLine L2_2( + R=0.0005, + X=0.1, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{24,66}, + {36,74}}))); + OpenIPSL.Electrical.Buses.Bus Bus5(angle_0=powerFlow.powerflow.bus.A5, v_0= + powerFlow.powerflow.bus.V5) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=90, + origin={80,16}))); + OpenIPSL.Electrical.Branches.PwLine L3( + R=0.001, + X=0.2, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation( + extent={{-6,-4},{6,4}}, + rotation=-90, + origin={80,60}))); + OpenIPSL.Electrical.Buses.Bus Bus6(v_0=powerFlow.powerflow.bus.V6, angle_0= + powerFlow.powerflow.bus.A6) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,10}))); + OpenIPSL.Electrical.Branches.PSSE.TwoWindingTransformer T2( + G=0, + B=0, + VNOM1=13800, + VB1=13800, + VNOM2=6000, + VB2=6000, + R=0.005, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={10,10}))); + GenerationUnits.PSSE.G2_16MVA G2( + enableV_b=true, + enableP_0=true, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V6, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A6, + V_b=6000, + P_0=powerFlow.powerflow.machines.PG2, + Q_0=powerFlow.powerflow.machines.QG2, + enableangle_0=true) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-30,10}))); + inner OpenIPSL.Electrical.SystemBase SysData(S_b=100000000, fn=60) + annotation (Placement(transformation(extent={{-128,104},{-74,124}}))); + OpenIPSL.Electrical.Loads.PSSE.Load Load1( + V_b=220000, + P_0=powerFlow.powerflow.loads.PL1, + Q_0=powerFlow.powerflow.loads.QL1, + v_0=powerFlow.powerflow.bus.V3, + angle_0=powerFlow.powerflow.bus.A3) if not equivalentGRID + annotation (Placement(transformation(extent={{-20,48},{0,68}}))); + Electrical.Events.Breaker circuitbreaker( + enableTrigger=false, + t_o=0.25, + rc_enabled=true, + t_rc=1000) if not equivalentGRID annotation (Placement(transformation( + extent={{-4,-4},{4,4}}, + rotation=90, + origin={80,26}))); + + Modelica.Blocks.Interfaces.RealInput IN1(start=0) + "Connector of Real input signal 2" annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-150,10}),iconTransformation(extent={{-10,-10},{10,10}}, origin={-150,10}))); + Modelica.Blocks.Sources.Constant IN11(k=0) + annotation (Placement(transformation(extent={{-108,-2},{-96,10}}))); + Modelica.Blocks.Math.Add AddU1 + annotation (Placement(transformation(extent={{-80,0},{-60,20}}))); + Modelica.Blocks.Sources.Constant IN22(k=0) + annotation (Placement(transformation(extent={{-108,-32},{-96,-20}}))); + Modelica.Blocks.Math.Add AddU2 + annotation (Placement(transformation(extent={{-80,-30},{-60,-10}}))); + Modelica.Blocks.Interfaces.RealInput IN2(start=0) + "Connector of Real input signal 2" + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-150,-12}), iconTransformation(extent={{-10,-10},{10,10}}, + origin={-150,-12}))); + Modelica.Blocks.Interfaces.RealInput IN3 "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-44},{-140,-24}}), + iconTransformation(extent={{-160,-44},{-140,-24}}))); + Modelica.Blocks.Interfaces.RealInput IN4(start = 0) "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-66},{-140,-46}}), + iconTransformation(extent={{-160,-66},{-140,-46}}))); + Modelica.Blocks.Interfaces.RealInput IN5(start = 0) "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-88},{-140,-68}}), + iconTransformation(extent={{-160,-88},{-140,-68}}))); + + PFData.PowerFlow powerFlow(redeclare record PowerFlow = + OpenIPSL.Examples.ModelPredictiveControl.PFData.PFVSD_TCL) + annotation (Placement(transformation(extent={{-68,104},{-48,124}}))); + Electrical.Machines.PSSE.GENCLS IB( + V_b=220000, + v_0=powerFlow.powerflow.bus.V4, + angle_0=powerFlow.powerflow.bus.A4, + P_0=powerFlow.powerflow.machines.Pinf, + Q_0=powerFlow.powerflow.machines.Qinf, + M_b=100000000, + X_d=1) if not equivalentGRID annotation (Placement(transformation(extent={{110,70}, + {100,90}}))); + Electrical.Loads.PSSE.Load_ExtInput Load2( + P_0=powerFlow.powerflow.loads.PL2, + Q_0=powerFlow.powerflow.loads.QL2, + v_0=powerFlow.powerflow.bus.V5, + angle_0=powerFlow.powerflow.bus.A5, + d_P=0, + t1=100, + d_t=1000) + annotation (Placement(transformation(extent={{100,-30},{120,-10}}))); + + inner Modelica.Blocks.Noise.GlobalSeed globalSeed( + enableNoise=true, + useAutomaticSeed=false, + fixedSeed=10000) + annotation (Placement(transformation(extent={{-44,102},{-24,122}}))); + Modelica.Blocks.Sources.Sine sine( + amplitude=0.01, + f=1/260, + phase=3.1415926535898, + startTime=1000) + annotation (Placement(transformation(extent={{70,-36},{80,-26}}))); + + Electrical.Buses.Bus Bus10(v_0=powerFlow.powerflow.bus.V10, angle_0=powerFlow.powerflow.bus.A10) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,-90}))); + Electrical.Branches.PSSE.TwoWindingTransformer T4( + G=0, + B=0, + CW=1, + VNOM1=13800, + VB1=13800, + VNOM2=480, + VB2=480, + R=0.001, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={10,-90}))); + GenerationUnits.PSSE.Solar_Units.SolarMPCLocalVQControl_ADD_ON + PV( + V_b=480, + P_0=powerFlow.powerflow.machines.PPV, + enableP_0=true, + Q_0=powerFlow.powerflow.machines.QPV, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V8, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A8, + enableangle_0=true) + annotation (Placement(transformation(extent={{-40,-60},{-20,-40}}))); + Modelica.Blocks.Math.Add AddU3 + annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}))); + Modelica.Blocks.Sources.Constant IN33(k=0) + annotation (Placement(transformation(extent={{-108,-62},{-96,-50}}))); + + Modelica.Blocks.Math.Add AddU4 + annotation (Placement(transformation(extent={{-80,-90},{-60,-70}}))); + Modelica.Blocks.Math.Add AddU5 + annotation (Placement(transformation(extent={{-80,-116},{-60,-96}}))); + Modelica.Blocks.Sources.Constant IN44(k=0) + annotation (Placement(transformation(extent={{-108,-92},{-96,-80}}))); + Modelica.Blocks.Sources.Constant IN55(k=0) + annotation (Placement(transformation(extent={{-108,-118},{-96,-106}}))); + GenerationUnits.PSSE.Battery_Units.BESSMPCLocalVQControl BESS( + V_base=480, + V_b(displayUnit="kV") = 480, + enableV_b=true, + P_0=powerFlow.powerflow.machines.PBESS, + enableP_0=true, + Q_0=powerFlow.powerflow.machines.QBESS, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V10, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A10, + enableangle_0=true) + annotation (Placement(transformation(extent={{-40,-100},{-20,-80}}))); + Electrical.Buses.Bus Bus8(v_0=powerFlow.powerflow.bus.V8, angle_0=powerFlow.powerflow.bus.A8) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,-50}))); + Electrical.Branches.PSSE.TwoWindingTransformer T3( + G=0, + B=0, + CW=1, + VNOM1=13800, + VB1=13800, + VNOM2=480, + VB2=480, + R=0.001, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={12,-50}))); + Electrical.Buses.Bus Bus11(v_0=powerFlow.powerflow.bus.V11, angle_0=powerFlow.powerflow.bus.A11) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,-90}))); + Electrical.Buses.Bus Bus9(v_0=powerFlow.powerflow.bus.V9, angle_0=powerFlow.powerflow.bus.A9) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,-50}))); + Electrical.Buses.Bus Bus7(v_0=powerFlow.powerflow.bus.V7, angle_0=powerFlow.powerflow.bus.A7) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,10}))); + Electrical.Branches.PwLine L4( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,6},{ + 50,14}}))); + Electrical.Branches.PwLine L5( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,-54}, + {50,-46}}))); + Electrical.Branches.PwLine L6( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,-94}, + {50,-86}}))); + Electrical.Renewables.PSSE.AddOnBlocks.IrradianceToPower + irradianceToPower( + Ypv(displayUnit="MW") = 3000000, + Sb(displayUnit="MV.A") = 100000000, + Tcstc(displayUnit="K") = 298.15, + fpv=1, + ap=-0.48, + Gtstc=1000) + annotation (Placement(transformation(extent={{44,-20},{34,-10}}))); + Modelica.Blocks.Interfaces.RealInput IN6 "Connector of Real input signal 2" + annotation (Placement(transformation(extent={{-160,-108},{-140,-88}}), + iconTransformation(extent={{-160,-108},{-140,-88}}))); + Modelica.Blocks.Sources.Constant IN66(k=0) + annotation (Placement(transformation(extent={{140,-60},{160,-40}}))); + Electrical.Branches.PwLine L2( + R=0.001, + X=0.01, + G=0, + B=0) annotation (Placement(transformation(extent={{182,6},{194,14}}))); + Electrical.Buses.Bus Bus12(angle_0=powerFlow.powerflow.bus.A5, v_0= + powerFlow.powerflow.bus.V5) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={200,10}))); + Electrical.Machines.ControlsMotors.VariableSpeedDrive.PowerElectronics.AC2DCandDC2AC_MPC + aC2DCandDC2AC_MPC( + V_b=13800, + v_0=powerFlow.powerflow.bus.V5, + angle_0=powerFlow.powerflow.bus.A5, + Rdc=0.1, + Cdc=0.00001, + m0=0.9537) + annotation (Placement(transformation(extent={{220,0},{260,20}}))); + Electrical.Machines.NonMultiDomain.Motors.ThreePhase.PSAT.NMD_MotorTypeI + nMD_MotorTypeI( + M_b=5000000, + V_b=13800, + Sup=false, + a=0, + b=0, + c=0.1) + annotation (Placement(transformation(extent={{300,0},{280,20}}))); + Electrical.Machines.ControlsMotors.VariableSpeedDrive.ControllerLogic.VoltsHertzController_MPC + voltsHertzController_MPC( + V_b=13800, + f_max=60, + f_min=0, + m0=0.9537, + Kp=0.5, + Ki=0.2, + rotor_speed_initial=1.9*Modelica.Constants.pi*60) + annotation (Placement(transformation(extent={{230,-40},{248,-20}}))); + Modelica.Blocks.Interfaces.RealOutput OUT1 + annotation (Placement(transformation(extent={{-284,80},{-264,100}}))); + Modelica.Blocks.Interfaces.RealOutput OUT2 + annotation (Placement(transformation(extent={{-284,60},{-264,80}}))); + Modelica.Blocks.Interfaces.RealOutput OUT3 + annotation (Placement(transformation(extent={{-284,40},{-264,60}}))); + Modelica.Blocks.Interfaces.RealOutput OUT4 + annotation (Placement(transformation(extent={{-284,20},{-264,40}}))); + Modelica.Blocks.Interfaces.RealOutput OUT5 + annotation (Placement(transformation(extent={{-284,0},{-264,20}}))); + Modelica.Blocks.Interfaces.RealOutput OUT6 + annotation (Placement(transformation(extent={{-284,-20},{-264,0}}))); + Modelica.Blocks.Interfaces.RealOutput OUT7 + annotation (Placement(transformation(extent={{-284,-40},{-264,-20}}))); + Modelica.Blocks.Interfaces.RealOutput OUT8 + annotation (Placement(transformation(extent={{-284,-60},{-264,-40}}))); + Modelica.Blocks.Interfaces.RealOutput OUT9 + annotation (Placement(transformation(extent={{-284,-80},{-264,-60}}))); + Modelica.Blocks.Interfaces.RealOutput OUT10 + annotation (Placement(transformation(extent={{-284,-100},{-264,-80}}))); + Modelica.Blocks.Interfaces.RealOutput OUT11 + annotation (Placement(transformation(extent={{-260,80},{-240,100}}))); + Modelica.Blocks.Interfaces.RealOutput OUT12 + annotation (Placement(transformation(extent={{-260,60},{-240,80}}))); + Modelica.Blocks.Interfaces.RealOutput OUT13 + annotation (Placement(transformation(extent={{-260,40},{-240,60}}))); + Modelica.Blocks.Interfaces.RealOutput OUT14 + annotation (Placement(transformation(extent={{-260,20},{-240,40}}))); + Modelica.Blocks.Interfaces.RealOutput OUT15 + annotation (Placement(transformation(extent={{-260,0},{-240,20}}))); + Modelica.Blocks.Interfaces.RealOutput OUT16 + annotation (Placement(transformation(extent={{-260,-20},{-240,0}}))); + Modelica.Blocks.Interfaces.RealOutput OUT17 + annotation (Placement(transformation(extent={{-260,-40},{-240,-20}}))); + Modelica.Blocks.Interfaces.RealOutput OUT18 + annotation (Placement(transformation(extent={{-260,-60},{-240,-40}}))); + Modelica.Blocks.Interfaces.RealOutput OUT19 + annotation (Placement(transformation(extent={{-260,-80},{-240,-60}}))); + Modelica.Blocks.Interfaces.RealOutput OUT20 + annotation (Placement(transformation(extent={{-260,-100},{-240,-80}}))); + Modelica.Blocks.Interfaces.RealOutput OUT21 + annotation (Placement(transformation(extent={{-240,80},{-220,100}}))); + Modelica.Blocks.Interfaces.RealOutput OUT22 + annotation (Placement(transformation(extent={{-240,60},{-220,80}}))); + Modelica.Blocks.Interfaces.RealOutput OUT23 + annotation (Placement(transformation(extent={{-240,40},{-220,60}}))); + Modelica.Blocks.Interfaces.RealOutput OUT24 + annotation (Placement(transformation(extent={{-240,20},{-220,40}}))); + Modelica.Blocks.Interfaces.RealOutput OUT25 + annotation (Placement(transformation(extent={{-240,0},{-220,20}}))); + Modelica.Blocks.Interfaces.RealOutput OUT26 + annotation (Placement(transformation(extent={{-240,-20},{-220,0}}))); + Modelica.Blocks.Interfaces.RealOutput OUT27 + annotation (Placement(transformation(extent={{-240,-40},{-220,-20}}))); + Modelica.Blocks.Interfaces.RealOutput OUT28 + annotation (Placement(transformation(extent={{-240,-60},{-220,-40}}))); + Modelica.Blocks.Interfaces.RealOutput OUT29 + annotation (Placement(transformation(extent={{-240,-80},{-220,-60}}))); + Modelica.Blocks.Interfaces.RealOutput OUT30 + annotation (Placement(transformation(extent={{-240,-100},{-220,-80}}))); + Modelica.Blocks.Interfaces.RealOutput OUT31 + annotation (Placement(transformation(extent={{-220,80},{-200,100}}))); + Modelica.Blocks.Math.Add Add10 + annotation (Placement(transformation(extent={{192,-40},{212,-20}}))); + Modelica.Blocks.Interfaces.RealInput IN7 + "Connector of Real input signal 1" annotation (Placement( + transformation(extent={{-158,-152},{-138,-132}}), + iconTransformation(extent={{-160,-160},{-140,-140}}))); + Modelica.Blocks.Sources.Constant IN77(k=0) + annotation (Placement(transformation(extent={{130,-162},{150,-142}}))); + Modelica.Blocks.Math.Add3 Add1 + annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + rotation=0, + origin={180,-146}))); + Modelica.Blocks.Sources.Constant Ratio_LTC(k=1) + annotation (Placement(transformation(extent={{130,-174},{150,-194}}))); + Electrical.Buses.Bus Bus13(angle_0=powerFlow.powerflow.bus.A13, + v_0=powerFlow.powerflow.bus.V13) + annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={196,-86}))); + Electrical.Branches.PwLine L7( + R=0.001, + X=0.01, + G=0, + B=0) annotation (Placement(transformation(extent={{174,-90},{186,-82}}))); + Electrical.Buses.Bus Bus14( + V_b=120, + angle_0=powerFlow.powerflow.bus.A14, + v_0=powerFlow.powerflow.bus.V14) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={240,-86}))); + Electrical.Loads.PSAT.TCL_randominit tCL_randominit( + Sn=1e6, + v0=1, + p0=0.5, + R=100, + C=80, + start0=1) + annotation (Placement(transformation(extent={{290,-96},{310,-76}}))); + TCL.ULTC_VoltageControl uLTC_VoltageControl( + Vbus1=13800, + Vbus2(displayUnit="V") = 120, + Vn=13800, + v_0=1, + kT=13800/120, + m0=1, + m_max=1.05, + m_min=0.95, + K=0.01) + annotation (Placement(transformation(extent={{206,-96},{226,-76}}))); + Modelica.Blocks.Sources.Constant const(k=0) + annotation (Placement(transformation(extent={{310,-68},{290,-48}}))); + equation + + OUT1 = G2.gen.w; + OUT2 = G2.gen.delta; + OUT3 = G2.gen.Epq; + OUT4 = G2.gen.PSIkd; + OUT5 = G2.gen.PSIppq; + OUT6 = G2.sEXSMPC.simpleLagLim.state; + OUT7 = G2.sEXSMPC.leadLag.TF.x_scaled[1]; + OUT8 = G2.gASTMPC.simpleLagLim.state; + OUT9 = G2.gASTMPC.simpleLag.state; + OUT10 = G2.gASTMPC.simpleLag1.state; + OUT11 = Bus6.v; + + OUT12 =PV.rEGCA1_1.Pgen; + OUT13 =PV.rEGCA1_1.Qgen; + OUT14 =PV.rEGCA1_1.p.ir; + OUT15 =PV.rEGCA1_1.p.ii; + OUT16 = Bus8.v; + + OUT17 =BESS.rEGCA1_1.Pgen; + OUT18 =BESS.rEGCA1_1.Qgen; + OUT19 =BESS.rEGCA1_1.p.ir; + OUT20 =BESS.rEGCA1_1.p.ii; + OUT21 = Bus10.v; + + OUT22 = tCL_randominit.theta; + OUT23 = uLTC_VoltageControl.m; + + OUT24= aC2DCandDC2AC_MPC.n.ir; + OUT25= aC2DCandDC2AC_MPC.n.ii; + OUT26= aC2DCandDC2AC_MPC.P; + + OUT27= nMD_MotorTypeI.wr; + OUT28= voltsHertzController_MPC.we; + OUT29= Bus12.v; + + OUT30 = Bus5.v; + OUT31 = Bus5.angle; + + connect(T1.p, Bus2.p) + annotation (Line(points={{-51.2,80},{-40,80}}, color={0,0,255})); + connect(Bus1.p, T1.n) + annotation (Line(points={{-80,80},{-68.8,80}}, color={0,0,255})); + connect(G1.conn, Bus1.p) + annotation (Line(points={{-91,80},{-80,80}}, color={0,0,255})); + connect(L1.n, Bus3.p) + annotation (Line(points={{-14.6,80},{0,80}}, color={0,0,255})); + connect(L1.p, Bus2.p) + annotation (Line(points={{-25.4,80},{-40,80}}, color={0,0,255})); + connect(L2_2.n, Bus4.p) annotation (Line(points={{35.4,70},{44,70},{44,80},{60, + 80}}, color={0,0,255})); + connect(L2_1.n, Bus4.p) annotation (Line(points={{35.4,90},{44,90},{44,80},{60, + 80}}, color={0,0,255})); + connect(L2_1.p, Bus3.p) annotation (Line(points={{24.6,90},{16,90},{16,80},{0, + 80}}, color={0,0,255})); + connect(L2_2.p, Bus3.p) annotation (Line(points={{24.6,70},{16,70},{16,80},{0, + 80}}, color={0,0,255})); + connect(Load1.p, Bus3.p) + annotation (Line(points={{-10,68},{-10,80},{0,80}}, color={0,0,255})); + connect(L3.p, Bus4.p) + annotation (Line(points={{80,65.4},{80,80},{60,80}}, color={0,0,255})); + connect(circuitbreaker.s, Bus5.p) + annotation (Line(points={{80,22},{80,16}}, color={0,0,255})); + connect(circuitbreaker.r, L3.n) + annotation (Line(points={{80,30},{80,54.6}}, color={0,0,255})); + connect(IN11.y, AddU1.u2) annotation (Line(points={{-95.4,4},{-82,4}}, + color={0,0,127})); + connect(IN1, AddU1.u1) annotation (Line(points={{-150,10},{-116,10},{-116,16}, + {-82,16}}, + color={0,0,127})); + + connect(IN22.y,AddU2. u2) annotation (Line(points={{-95.4,-26},{-82,-26}}, + color={0,0,127})); + connect(IN2,AddU2. u1) annotation (Line(points={{-150,-12},{-118,-12},{-118,-14}, + {-82,-14}}, + color={0,0,127})); + connect(AddU2.y, G2.Efd_ref) + annotation (Line(points={{-59,-20},{-52,-20},{-52,4},{-42,4}}, + color={0,0,127})); + connect(AddU1.y, G2.P_ref1) annotation (Line(points={{-59,10},{-52,10},{-52,16}, + {-42,16}}, color={0,0,127})); + connect(IB.p, Bus4.p) + annotation (Line(points={{100,80},{60,80}}, color={0,0,255})); + connect(Load2.p, Bus5.p) annotation (Line(points={{110,-10},{110,10},{80,10},{ + 80,16}}, + color={0,0,255})); + connect(T4.n, Bus10.p) + annotation (Line(points={{-1,-90},{-10,-90}}, color={0,0,255})); + connect(Bus6.p, T2.n) + annotation (Line(points={{-10,10},{-1,10}}, + color={0,0,255})); + connect(AddU3.y, PV.QINPUT) annotation (Line(points={{-59,-50},{-42,-50}}, + color={0,0,127})); + connect(IN33.y,AddU3. u2) + annotation (Line(points={{-95.4,-56},{-82,-56}}, color={0,0,127})); + connect(BESS.p1, Bus10.p) + annotation (Line(points={{-20,-90},{-10,-90}}, color={0,0,255})); + connect(BESS.Paux1, AddU4.y) annotation (Line(points={{-42,-84},{-54,-84},{-54, + -80},{-59,-80}}, color={0,0,127})); + connect(IN55.y, AddU5.u2) + annotation (Line(points={{-95.4,-112},{-82,-112}}, color={0,0,127})); + connect(AddU5.y, BESS.Qext1) annotation (Line(points={{-59,-106},{-52,-106},{-52, + -96},{-42,-96}}, color={0,0,127})); + connect(IN44.y, AddU4.u2) + annotation (Line(points={{-95.4,-86},{-82,-86}}, color={0,0,127})); + connect(AddU4.u1,IN4) annotation (Line(points={{-82,-74},{-100,-74},{-100,-70}, + {-116,-70},{-116,-56},{-150,-56}}, color={0,0,127})); + connect(AddU5.u1,IN5) annotation (Line(points={{-82,-100},{-116,-100},{-116,-78}, + {-150,-78}}, color={0,0,127})); + connect(G2.conn, Bus6.p) annotation (Line(points={{-19,10},{-10,10}}, + color={0,0,255})); + connect(AddU3.u1, IN3) annotation (Line(points={{-82,-44},{-118,-44},{-118,-34}, + {-150,-34}}, color={0,0,127})); + connect(PV.p1, Bus8.p) + annotation (Line(points={{-20,-50},{-10,-50}}, color={0,0,255})); + connect(Bus8.p, T3.n) + annotation (Line(points={{-10,-50},{1,-50}}, color={0,0,255})); + connect(T2.p, Bus7.p) annotation (Line(points={{21,10},{25.5,10},{25.5,10},{30, + 10}}, color={0,0,255})); + connect(T3.p, Bus9.p) + annotation (Line(points={{23,-50},{30,-50}}, color={0,0,255})); + connect(T4.p, Bus11.p) + annotation (Line(points={{21,-90},{30,-90}}, color={0,0,255})); + connect(L4.n, Bus5.p) annotation (Line(points={{49.4,10},{60,10},{60,10},{80,10}, + {80,16}}, color={0,0,255})); + connect(L5.n, Bus5.p) annotation (Line(points={{49.4,-50},{60,-50},{60,10},{80, + 10},{80,16}}, color={0,0,255})); + connect(Bus11.p, L6.p) + annotation (Line(points={{30,-90},{38.6,-90}}, color={0,0,255})); + connect(Bus9.p, L5.p) + annotation (Line(points={{30,-50},{38.6,-50}}, color={0,0,255})); + connect(L6.n, Bus5.p) annotation (Line(points={{49.4,-90},{60,-90},{60,10},{80, + 10},{80,16}}, color={0,0,255})); + connect(Bus7.p, L4.p) annotation (Line(points={{30,10},{34.3,10},{34.3,10},{38.6, + 10}}, color={0,0,255})); + connect(L2.n, Bus12.p) + annotation (Line(points={{193.4,10},{200,10}}, color={0,0,255})); + connect(L2.p, Bus5.p) + annotation (Line(points={{182.6,10},{80,10},{80,16}}, color={0,0,255})); + connect(Bus12.p, aC2DCandDC2AC_MPC.p) annotation (Line(points={{200,10}, + {220,10}}, color={0,0,255})); + connect(aC2DCandDC2AC_MPC.n, nMD_MotorTypeI.p) annotation (Line(points={{260,10}, + {280,10}}, color={0,0,255})); + connect(voltsHertzController_MPC.m, aC2DCandDC2AC_MPC.m_input) + annotation (Line(points={{244.6,-18},{244.6,-10},{249.091,-10},{249.091,-2}}, + color={0,0,127})); + connect(voltsHertzController_MPC.Vc, aC2DCandDC2AC_MPC.Vc) annotation ( + Line(points={{235.4,-18},{235.4,-10},{230.909,-10},{230.909,-2}}, + color={0,0,127})); + connect(nMD_MotorTypeI.wr, voltsHertzController_MPC.motor_speed) + annotation (Line(points={{284,-2},{284,-26},{252,-26}}, color={0,0,127})); + connect(nMD_MotorTypeI.we, voltsHertzController_MPC.we) + annotation (Line(points={{296,-2},{296,-34},{252,-34}}, color={0,0,127})); + connect(aC2DCandDC2AC_MPC.nr_input, nMD_MotorTypeI.wr) annotation (Line( + points={{261.818,3},{268,3},{268,-2},{284,-2}}, color={0,0,127})); + connect(irradianceToPower.Ppv, PV.IRR2POW) annotation (Line(points={{ + 33.5,-15},{-42,-15},{-42,-43}}, color={0,0,127})); + connect(sine.y, Load2.u) annotation (Line(points={{80.5,-31},{80.5,-32}, + {94,-32},{94,-14.5},{101.9,-14.5}}, color={0,0,127})); + connect(IN66.y, Add10.u2) annotation (Line(points={{161,-50},{180,-50},{180,-36}, + {190,-36}}, color={0,0,127})); + connect(Add10.y, voltsHertzController_MPC.W_ref) + annotation (Line(points={{213,-30},{228,-30}}, color={0,0,127})); + connect(Add10.u1, IN6) annotation (Line(points={{190,-24},{126,-24},{126,-122}, + {-150,-122},{-150,-98}}, color={0,0,127})); + connect(IN77.y,Add1. u2) + annotation (Line(points={{151,-152},{160,-152},{160,-146},{168,-146}}, + color={0,0,127})); + connect(Add1.u1, IN7) annotation (Line(points={{168,-138},{156,-138},{ + 156,-136},{-132,-136},{-132,-142},{-148,-142}}, + color={0,0,127})); + connect(Ratio_LTC.y,Add1. u3) annotation (Line(points={{151,-184},{168, + -184},{168,-154}}, + color={0,0,127})); + connect(Bus14.p,tCL_randominit. p) + annotation (Line(points={{240,-86},{288.5,-86}}, color={0,0,255})); + connect(const.y,tCL_randominit. u) annotation (Line(points={{289,-58},{ + 266,-58},{266,-81.4812},{288,-81.4812}}, + color={0,0,127})); + connect(L7.n,Bus13. p) + annotation (Line(points={{185.4,-86},{196,-86}}, color={0,0,255})); + connect(L7.p, Bus5.p) annotation (Line(points={{174.6,-86},{64,-86},{64, + 0},{96,0},{96,10},{80,10},{80,16}}, + color={0,0,255})); + connect(Bus13.p,uLTC_VoltageControl. p) + annotation (Line(points={{196,-86},{205,-86}}, color={0,0,255})); + connect(uLTC_VoltageControl.n,Bus14. p) + annotation (Line(points={{227,-86},{240,-86}}, color={0,0,255})); + connect(Add1.y,uLTC_VoltageControl. v_ref) annotation (Line(points={{191, + -146},{216,-146},{216,-98}}, + color={0,0,127})); + annotation (Placement(transformation(extent={{140,-20},{160,0}})), + Placement(transformation(extent={{140,-40},{160,-20}})), + Placement(transformation(extent={{140,-60},{160,-40}})), + Placement(transformation(extent={{140,-80},{160,-60}})), + Diagram(coordinateSystem(preserveAspectRatio=false, + extent={{-140,-200},{320,140}}), graphics={ + Rectangle( + extent={{-160,30},{-134,-124}}, + lineColor={0,140,72}, + lineThickness=0.5), + Rectangle( + extent={{-128,36},{124,-124}}, + lineColor={238,46,47}, + lineThickness=0.5), + Rectangle( + extent={{-128,98},{124,38}}, + lineColor={0,128,255}, + lineThickness=0.5), + Text( + extent={{78,-106},{114,-120}}, + textColor={238,46,47}, + textString="Microgrid"), + Text( + extent={{76,58},{128,34}}, + textColor={28,108,200}, + textString="Utility Grid"), + Text( + extent={{-30,-102},{34,-124}}, + textColor={0,140,72}, + textString="Linearization Unit"), + Text( + extent={{-164,50},{-132,30}}, + textColor={0,140,72}, + textString="Inputs")}), + Documentation(info=" +

This example system shows how the preparation for resynchronization of Generator 2 to the grid. Note that at 2 seconds, a signal is triggered so voltages between buses 3 and 4 should be equal.

+

Simulate the system for 10 seconds. Variables of interest are:

+ +

Note the behavior of those variables before and after the connection of generator G2 to the main grid.

+"),experiment( + StopTime=10, + __Dymola_NumberOfIntervals=1000, + __Dymola_fixedstepsize=0.001, + __Dymola_Algorithm="Dassl"), + Icon(coordinateSystem(extent={{-140,-200},{320,140}}))); + end MPC_LTC_VSD_Original1; + + model MPC_LTC_VSD_Linearized2 + "THIS ONE IS STABLE, CONTROLLABLE, OBSERVABLE!!!!!!!" + extends Modelica.Icons.Example; + + parameter Boolean equivalentGRID = true; + parameter Boolean equivalentsystem = false; + parameter Real set = 0; + + OpenIPSL.Electrical.Buses.Bus Bus1(v_0=powerFlow.powerflow.bus.V1, angle_0= + powerFlow.powerflow.bus.A1) if not equivalentGRID + annotation (Placement(transformation(extent={{-90,70},{-70,90}}))); + OpenIPSL.Electrical.Buses.Bus Bus2(v_0=powerFlow.powerflow.bus.V2, angle_0= + powerFlow.powerflow.bus.A1) if not equivalentGRID + annotation (Placement(transformation(extent={{-50,70},{-30,90}}))); + OpenIPSL.Electrical.Branches.PSSE.TwoWindingTransformer T1( + R=0.001, + X=0.2, + G=0, + B=0, + VNOM1=13800, + VB1=13800, + VNOM2=6000, + VB2=6000) if not equivalentGRID annotation (Placement(transformation( + extent={{-8,-8},{8,8}}, + rotation=180, + origin={-60,80}))); + OpenIPSL.Examples.OpenCPS.Generators.G1 G1( + enableV_b=true, + v_0=powerFlow.powerflow.bus.V1, + angle_0=powerFlow.powerflow.bus.A1, + P_0=powerFlow.powerflow.machines.PG1, + Q_0=powerFlow.powerflow.machines.QG1, + V_b=6000) if not equivalentGRID + annotation (Placement(transformation(extent={{-112,70},{-92,90}}))); + OpenIPSL.Electrical.Branches.PwLine L1( + R=0.001, + X=0.2, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{-26,76}, + {-14,84}}))); + OpenIPSL.Electrical.Buses.Bus Bus3(v_0=powerFlow.powerflow.bus.V3, angle_0= + powerFlow.powerflow.bus.A3) if not equivalentGRID + annotation (Placement(transformation(extent={{-10,70},{10,90}}))); + OpenIPSL.Electrical.Buses.Bus Bus4(v_0=powerFlow.powerflow.bus.V4, angle_0= + powerFlow.powerflow.bus.V4) if not equivalentGRID + annotation (Placement(transformation(extent={{50,70},{70,90}}))); + OpenIPSL.Electrical.Branches.PwLine L2_1( + R=0.0005, + X=0.1, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{24,86}, + {36,94}}))); + OpenIPSL.Electrical.Branches.PwLine L2_2( + R=0.0005, + X=0.1, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{24,66}, + {36,74}}))); + OpenIPSL.Electrical.Buses.Bus Bus5(angle_0=powerFlow.powerflow.bus.A5, v_0= + powerFlow.powerflow.bus.V5) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=90, + origin={80,16}))); + OpenIPSL.Electrical.Branches.PwLine L3( + R=0.001, + X=0.2, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation( + extent={{-6,-4},{6,4}}, + rotation=-90, + origin={80,60}))); + OpenIPSL.Electrical.Buses.Bus Bus6(v_0=powerFlow.powerflow.bus.V6, angle_0= + powerFlow.powerflow.bus.A6) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,10}))); + OpenIPSL.Electrical.Branches.PSSE.TwoWindingTransformer T2( + G=0, + B=0, + VNOM1=13800, + VB1=13800, + VNOM2=6000, + VB2=6000, + R=0.005, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={10,10}))); + GenerationUnits.PSSE.G2_16MVA G2( + enableV_b=true, + enableP_0=true, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V6, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A6, + V_b=6000, + P_0=powerFlow.powerflow.machines.PG2, + Q_0=powerFlow.powerflow.machines.QG2, + enableangle_0=true) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-30,10}))); + inner OpenIPSL.Electrical.SystemBase SysData(S_b=100000000, fn=60) + annotation (Placement(transformation(extent={{-128,104},{-74,124}}))); + OpenIPSL.Electrical.Loads.PSSE.Load Load1( + V_b=220000, + P_0=powerFlow.powerflow.loads.PL1, + Q_0=powerFlow.powerflow.loads.QL1, + v_0=powerFlow.powerflow.bus.V3, + angle_0=powerFlow.powerflow.bus.A3) if not equivalentGRID + annotation (Placement(transformation(extent={{-20,48},{0,68}}))); + Electrical.Events.Breaker circuitbreaker( + enableTrigger=false, + t_o=0.25, + rc_enabled=true, + t_rc=1000) if not equivalentGRID annotation (Placement(transformation( + extent={{-4,-4},{4,4}}, + rotation=90, + origin={80,26}))); + + Modelica.Blocks.Interfaces.RealInput IN1(start=0) + "Connector of Real input signal 2" annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-150,10}),iconTransformation(extent={{-10,-10},{10,10}}, origin={-150,10}))); + Modelica.Blocks.Sources.Constant IN11(k=0) + annotation (Placement(transformation(extent={{-108,-2},{-96,10}}))); + Modelica.Blocks.Math.Add AddU1 + annotation (Placement(transformation(extent={{-80,0},{-60,20}}))); + Modelica.Blocks.Sources.Constant IN22(k=0) + annotation (Placement(transformation(extent={{-108,-32},{-96,-20}}))); + Modelica.Blocks.Math.Add AddU2 + annotation (Placement(transformation(extent={{-80,-30},{-60,-10}}))); + Modelica.Blocks.Interfaces.RealInput IN2(start=0) + "Connector of Real input signal 2" + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-150,-12}), iconTransformation(extent={{-10,-10},{10,10}}, + origin={-150,-12}))); + + Modelica.Blocks.Interfaces.RealInput IN3(start = 0) "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-44},{-140,-24}}), + iconTransformation(extent={{-160,-44},{-140,-24}}))); + Modelica.Blocks.Interfaces.RealInput IN4(start = 0) "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-66},{-140,-46}}), + iconTransformation(extent={{-160,-66},{-140,-46}}))); + Modelica.Blocks.Interfaces.RealInput IN5(start = 0) "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-88},{-140,-68}}), + iconTransformation(extent={{-160,-88},{-140,-68}}))); + + PFData.PowerFlow powerFlow(redeclare record PowerFlow = + OpenIPSL.Examples.ModelPredictiveControl.PFData.PFVSD_TCL) + annotation (Placement(transformation(extent={{-68,104},{-48,124}}))); + Electrical.Machines.PSSE.GENCLS IB( + V_b=220000, + v_0=powerFlow.powerflow.bus.V4, + angle_0=powerFlow.powerflow.bus.A4, + P_0=powerFlow.powerflow.machines.Pinf, + Q_0=powerFlow.powerflow.machines.Qinf, + M_b=100000000, + X_d=1) if not equivalentGRID annotation (Placement(transformation(extent={{110,70}, + {100,90}}))); + Electrical.Loads.PSSE.Load_ExtInput Load2( + P_0=powerFlow.powerflow.loads.PL2, + Q_0=powerFlow.powerflow.loads.QL2, + v_0=powerFlow.powerflow.bus.V5, + angle_0=powerFlow.powerflow.bus.A5, + d_P=0, + t1=100, + d_t=1000) + annotation (Placement(transformation(extent={{100,-30},{120,-10}}))); + + inner Modelica.Blocks.Noise.GlobalSeed globalSeed(useAutomaticSeed=false, + fixedSeed=10000) + annotation (Placement(transformation(extent={{-42,102},{-22,122}}))); + + Electrical.Buses.Bus Bus10(v_0=powerFlow.powerflow.bus.V10, angle_0=powerFlow.powerflow.bus.A10) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,-90}))); + Electrical.Branches.PSSE.TwoWindingTransformer T4( + G=0, + B=0, + CW=1, + VNOM1=13800, + VB1=13800, + VNOM2=480, + VB2=480, + R=0.001, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={10,-90}))); + GenerationUnits.PSSE.Solar_Units.SolarMPCSysIdentification + PV( + V_b=480, + P_0=powerFlow.powerflow.machines.PPV, + enableP_0=true, + Q_0=powerFlow.powerflow.machines.QPV, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V8, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A8, + enableangle_0=true) + annotation (Placement(transformation(extent={{-40,-60},{-20,-40}}))); + Modelica.Blocks.Math.Add AddU3 + annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}))); + Modelica.Blocks.Sources.Constant IN33(k=0) + annotation (Placement(transformation(extent={{-108,-62},{-96,-50}}))); + + Modelica.Blocks.Math.Add AddU4 + annotation (Placement(transformation(extent={{-80,-90},{-60,-70}}))); + Modelica.Blocks.Math.Add AddU5 + annotation (Placement(transformation(extent={{-80,-116},{-60,-96}}))); + Modelica.Blocks.Sources.Constant IN44(k=0) + annotation (Placement(transformation(extent={{-108,-92},{-96,-80}}))); + Modelica.Blocks.Sources.Constant IN55(k=0) + annotation (Placement(transformation(extent={{-108,-118},{-96,-106}}))); + GenerationUnits.PSSE.Battery_Units.BESSMPCSysIdentification + BESS( + V_base=480, + V_b(displayUnit="kV") = 480, + enableV_b=true, + P_0=powerFlow.powerflow.machines.PBESS, + enableP_0=true, + Q_0=powerFlow.powerflow.machines.QBESS, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V10, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A10, + enableangle_0=true) + annotation (Placement(transformation(extent={{-40,-100},{-20,-80}}))); + Electrical.Buses.Bus Bus8(v_0=powerFlow.powerflow.bus.V8, angle_0=powerFlow.powerflow.bus.A8) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,-50}))); + Electrical.Branches.PSSE.TwoWindingTransformer T3( + G=0, + B=0, + CW=1, + VNOM1=13800, + VB1=13800, + VNOM2=480, + VB2=480, + R=0.001, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={12,-50}))); + Electrical.Buses.Bus Bus11(v_0=powerFlow.powerflow.bus.V11, angle_0=powerFlow.powerflow.bus.A11) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,-90}))); + Electrical.Buses.Bus Bus9(v_0=powerFlow.powerflow.bus.V9, angle_0=powerFlow.powerflow.bus.A9) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,-50}))); + Electrical.Buses.Bus Bus7(v_0=powerFlow.powerflow.bus.V7, angle_0=powerFlow.powerflow.bus.A7) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,10}))); + Electrical.Branches.PwLine L4( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,6},{ + 50,14}}))); + Electrical.Branches.PwLine L5( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,-54}, + {50,-46}}))); + Electrical.Branches.PwLine L6( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,-94}, + {50,-86}}))); + Modelica.Blocks.Sources.Sine sine( + amplitude=0, + f=1/260, + phase=3.1415926535898, + startTime=1000) + annotation (Placement(transformation(extent={{68,-36},{78,-26}}))); + Electrical.Loads.NoiseInjections.WhiteNoiseInjection whiteNoiseInjection( + active_sigma=0.000000000000001, + samplePeriod=0.01) + annotation (Placement(transformation(extent={{66,-18},{78,-6}}))); + Modelica.Blocks.Math.Add add + annotation (Placement(transformation(extent={{84,-18},{92,-10}}))); + + Modelica.Blocks.Sources.Constant IN66(k=0) + annotation (Placement(transformation(extent={{140,-60},{160,-40}}))); + Electrical.Branches.PwLine L2( + R=0.001, + X=0.01, + G=0, + B=0) annotation (Placement(transformation(extent={{182,6},{194,14}}))); + Electrical.Buses.Bus Bus12(angle_0=powerFlow.powerflow.bus.A5, v_0= + powerFlow.powerflow.bus.V5) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={200,10}))); + Electrical.Machines.ControlsMotors.VariableSpeedDrive.PowerElectronics.AC2DCandDC2AC_MPC + aC2DCandDC2AC_MPC( + V_b=13800, + v_0=powerFlow.powerflow.bus.V5, + angle_0=powerFlow.powerflow.bus.A5, + Rdc=0.01, + Cdc=0.000001, + m0=0.9537) + annotation (Placement(transformation(extent={{220,0},{260,20}}))); + Electrical.Machines.NonMultiDomain.Motors.ThreePhase.PSAT.NMD_MotorTypeI + nMD_MotorTypeI( + M_b=5000000, + V_b=13800, + Sup=false, + a=0, + b=0, + c=0.1) + annotation (Placement(transformation(extent={{300,0},{280,20}}))); + Electrical.Machines.ControlsMotors.VariableSpeedDrive.ControllerLogic.VoltsHertzController_MPC + voltsHertzController_MPC( + V_b=13800, + f_max=60, + f_min=0, + m0=0.9537, + Kp=0.5, + Ki=0.2, + rotor_speed_initial=1.9*Modelica.Constants.pi*60) + annotation (Placement(transformation(extent={{230,-40},{248,-20}}))); + Modelica.Blocks.Interfaces.RealInput IN6(start=0) "Connector of Real input signal 2" + annotation (Placement(transformation(extent={{-160,-110},{-140,-90}}), + iconTransformation(extent={{-160,-110},{-140,-90}}))); + Modelica.Blocks.Interfaces.RealOutput OUT1 + annotation (Placement(transformation(extent={{-264,68},{-244,88}}))); + Modelica.Blocks.Interfaces.RealOutput OUT2 + annotation (Placement(transformation(extent={{-264,48},{-244,68}}))); + Modelica.Blocks.Interfaces.RealOutput OUT3 + annotation (Placement(transformation(extent={{-264,28},{-244,48}}))); + Modelica.Blocks.Interfaces.RealOutput OUT4 + annotation (Placement(transformation(extent={{-264,8},{-244,28}}))); + Modelica.Blocks.Interfaces.RealOutput OUT5 + annotation (Placement(transformation(extent={{-264,-12},{-244,8}}))); + Modelica.Blocks.Interfaces.RealOutput OUT6 + annotation (Placement(transformation(extent={{-264,-32},{-244,-12}}))); + Modelica.Blocks.Interfaces.RealOutput OUT7 + annotation (Placement(transformation(extent={{-264,-52},{-244,-32}}))); + Modelica.Blocks.Interfaces.RealOutput OUT8 + annotation (Placement(transformation(extent={{-264,-72},{-244,-52}}))); + Modelica.Blocks.Interfaces.RealOutput OUT9 + annotation (Placement(transformation(extent={{-264,-92},{-244,-72}}))); + Modelica.Blocks.Interfaces.RealOutput OUT10 + annotation (Placement(transformation(extent={{-264,-112},{-244,-92}}))); + Modelica.Blocks.Interfaces.RealOutput OUT11 + annotation (Placement(transformation(extent={{-240,68},{-220,88}}))); + Modelica.Blocks.Interfaces.RealOutput OUT12 + annotation (Placement(transformation(extent={{-240,48},{-220,68}}))); + Modelica.Blocks.Interfaces.RealOutput OUT13 + annotation (Placement(transformation(extent={{-240,28},{-220,48}}))); + Modelica.Blocks.Interfaces.RealOutput OUT14 + annotation (Placement(transformation(extent={{-240,8},{-220,28}}))); + Modelica.Blocks.Interfaces.RealOutput OUT15 + annotation (Placement(transformation(extent={{-240,-12},{-220,8}}))); + Modelica.Blocks.Interfaces.RealOutput OUT16 + annotation (Placement(transformation(extent={{-240,-32},{-220,-12}}))); + Modelica.Blocks.Interfaces.RealOutput OUT17 + annotation (Placement(transformation(extent={{-240,-52},{-220,-32}}))); + Modelica.Blocks.Interfaces.RealOutput OUT18 + annotation (Placement(transformation(extent={{-240,-72},{-220,-52}}))); + Modelica.Blocks.Interfaces.RealOutput OUT19 + annotation (Placement(transformation(extent={{-240,-92},{-220,-72}}))); + Modelica.Blocks.Interfaces.RealOutput OUT20 + annotation (Placement(transformation(extent={{-240,-112},{-220,-92}}))); + Modelica.Blocks.Interfaces.RealOutput OUT21 + annotation (Placement(transformation(extent={{-220,68},{-200,88}}))); + Modelica.Blocks.Interfaces.RealOutput OUT22 + annotation (Placement(transformation(extent={{-220,48},{-200,68}}))); + Modelica.Blocks.Interfaces.RealOutput OUT23 + annotation (Placement(transformation(extent={{-220,28},{-200,48}}))); + Modelica.Blocks.Interfaces.RealOutput OUT24 + annotation (Placement(transformation(extent={{-220,8},{-200,28}}))); + Modelica.Blocks.Interfaces.RealOutput OUT25 + annotation (Placement(transformation(extent={{-220,-12},{-200,8}}))); + Modelica.Blocks.Interfaces.RealOutput OUT26 + annotation (Placement(transformation(extent={{-220,-32},{-200,-12}}))); + Modelica.Blocks.Interfaces.RealOutput OUT27 + annotation (Placement(transformation(extent={{-220,-52},{-200,-32}}))); + Modelica.Blocks.Interfaces.RealOutput OUT28 + annotation (Placement(transformation(extent={{-220,-72},{-200,-52}}))); + Modelica.Blocks.Interfaces.RealOutput OUT29 + annotation (Placement(transformation(extent={{-220,-92},{-200,-72}}))); + Modelica.Blocks.Interfaces.RealOutput OUT30 + annotation (Placement(transformation(extent={{-220,-112},{-200,-92}}))); + Modelica.Blocks.Interfaces.RealOutput OUT31 + annotation (Placement(transformation(extent={{-200,68},{-180,88}}))); + Modelica.Blocks.Math.Add add10 + annotation (Placement(transformation(extent={{186,-52},{194,-44}}))); + Modelica.Blocks.Interfaces.RealInput IN7 + "Connector of Real input signal 1" annotation (Placement( + transformation(extent={{-160,-160},{-140,-140}}), + iconTransformation(extent={{-160,-160},{-140,-140}}))); + Modelica.Blocks.Sources.Constant IN77(k=0) + annotation (Placement(transformation(extent={{142,-158},{162,-138}}))); + Modelica.Blocks.Math.Add3 Add1 + annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + rotation=0, + origin={192,-142}))); + Modelica.Blocks.Sources.Constant Ratio_LTC(k=1) + annotation (Placement(transformation(extent={{142,-170},{162,-190}}))); + Electrical.Buses.Bus Bus13(angle_0=powerFlow.powerflow.bus.A13, v_0= + powerFlow.powerflow.bus.V13) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={208,-82}))); + Electrical.Branches.PwLine L7( + R=0.001, + X=0.01, + G=0, + B=0) annotation (Placement(transformation(extent={{186,-86},{198,-78}}))); + Electrical.Buses.Bus Bus14( + V_b=120, + angle_0=powerFlow.powerflow.bus.A14, + v_0=powerFlow.powerflow.bus.V14) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={252,-82}))); + TCL.ULTC_VoltageControl uLTC_VoltageControl( + Vbus1=13800, + Vbus2(displayUnit="V") = 120, + Vn=13800, + v_0=1, + kT=13800/120, + m0=1, + m_max=1.05, + m_min=0.95, + K=0.01) + annotation (Placement(transformation(extent={{218,-92},{238,-72}}))); + Electrical.Loads.PSSE.Load load(V_b=120, P_0=420000) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=90, + origin={276,-82}))); + Modelica.Blocks.Interfaces.RealOutput OUT32 + annotation (Placement(transformation(extent={{-200,48},{-180,68}}))); + equation + + OUT1 = G2.gen.w; + OUT2 = G2.gen.delta; + OUT3 = G2.gen.Epq; + OUT4 = G2.gen.PSIkd; + OUT5 = G2.gen.PSIppq; + OUT6 = G2.sEXSMPC.simpleLagLim.state; + OUT7 = G2.sEXSMPC.leadLag.TF.x_scaled[1]; + OUT8 = G2.gASTMPC.simpleLagLim.state; + OUT9 = G2.gASTMPC.simpleLag.state; + OUT10 = G2.gASTMPC.simpleLag1.state; + OUT11 = Bus6.v; + + OUT12 =PV.rEGCA1_1.Pgen; + OUT13 =PV.rEGCA1_1.Qgen; + OUT14 =PV.rEGCA1_1.p.ir; + OUT15 =PV.rEGCA1_1.p.ii; + OUT16 = Bus8.v; + + OUT17 =BESS.rEGCA1_1.Pgen; + OUT18 =BESS.rEGCA1_1.Qgen; + OUT19 =BESS.rEGCA1_1.p.ir; + OUT20 =BESS.rEGCA1_1.p.ii; + OUT21 = Bus10.v; + + OUT22 = uLTC_VoltageControl.m; + OUT23 = Bus14.p.vr; + OUT24 = Bus14.p.vi; + + + OUT25= aC2DCandDC2AC_MPC.n.ir; + OUT26= aC2DCandDC2AC_MPC.n.ii; + OUT27= aC2DCandDC2AC_MPC.P; + + OUT28= nMD_MotorTypeI.wr; + OUT29= voltsHertzController_MPC.we; + OUT30= Bus12.v; + + OUT31 = Bus5.v; + OUT32 = Bus5.angle; + + connect(T1.p, Bus2.p) + annotation (Line(points={{-51.2,80},{-40,80}}, color={0,0,255})); + connect(Bus1.p, T1.n) + annotation (Line(points={{-80,80},{-68.8,80}}, color={0,0,255})); + connect(G1.conn, Bus1.p) + annotation (Line(points={{-91,80},{-80,80}}, color={0,0,255})); + connect(L1.n, Bus3.p) + annotation (Line(points={{-14.6,80},{0,80}}, color={0,0,255})); + connect(L1.p, Bus2.p) + annotation (Line(points={{-25.4,80},{-40,80}}, color={0,0,255})); + connect(L2_2.n, Bus4.p) annotation (Line(points={{35.4,70},{44,70},{44,80},{60, + 80}}, color={0,0,255})); + connect(L2_1.n, Bus4.p) annotation (Line(points={{35.4,90},{44,90},{44,80},{60, + 80}}, color={0,0,255})); + connect(L2_1.p, Bus3.p) annotation (Line(points={{24.6,90},{16,90},{16,80},{0, + 80}}, color={0,0,255})); + connect(L2_2.p, Bus3.p) annotation (Line(points={{24.6,70},{16,70},{16,80},{0, + 80}}, color={0,0,255})); + connect(Load1.p, Bus3.p) + annotation (Line(points={{-10,68},{-10,80},{0,80}}, color={0,0,255})); + connect(L3.p, Bus4.p) + annotation (Line(points={{80,65.4},{80,80},{60,80}}, color={0,0,255})); + connect(circuitbreaker.s, Bus5.p) + annotation (Line(points={{80,22},{80,16}}, color={0,0,255})); + connect(circuitbreaker.r, L3.n) + annotation (Line(points={{80,30},{80,54.6}}, color={0,0,255})); + connect(IN11.y, AddU1.u2) annotation (Line(points={{-95.4,4},{-82,4}}, + color={0,0,127})); + connect(IN1, AddU1.u1) annotation (Line(points={{-150,10},{-116,10},{-116,16}, + {-82,16}}, + color={0,0,127})); + + connect(IN22.y,AddU2. u2) annotation (Line(points={{-95.4,-26},{-82,-26}}, + color={0,0,127})); + connect(IN2,AddU2. u1) annotation (Line(points={{-150,-12},{-118,-12},{-118,-14}, + {-82,-14}}, + color={0,0,127})); + connect(AddU2.y, G2.Efd_ref) + annotation (Line(points={{-59,-20},{-52,-20},{-52,4},{-42,4}}, + color={0,0,127})); + connect(AddU1.y, G2.P_ref1) annotation (Line(points={{-59,10},{-52,10},{-52,16}, + {-42,16}}, color={0,0,127})); + connect(IB.p, Bus4.p) + annotation (Line(points={{100,80},{60,80}}, color={0,0,255})); + connect(Load2.p, Bus5.p) annotation (Line(points={{110,-10},{110,10},{80,10},{ + 80,16}}, + color={0,0,255})); + connect(T4.n, Bus10.p) + annotation (Line(points={{-1,-90},{-10,-90}}, color={0,0,255})); + connect(Bus6.p, T2.n) + annotation (Line(points={{-10,10},{-1,10}}, + color={0,0,255})); + connect(IN33.y,AddU3. u2) + annotation (Line(points={{-95.4,-56},{-82,-56}}, color={0,0,127})); + connect(BESS.p1, Bus10.p) + annotation (Line(points={{-20,-90},{-10,-90}}, color={0,0,255})); + connect(BESS.Paux1, AddU4.y) annotation (Line(points={{-42,-84},{-54,-84},{-54, + -80},{-59,-80}}, color={0,0,127})); + connect(IN55.y, AddU5.u2) + annotation (Line(points={{-95.4,-112},{-82,-112}}, color={0,0,127})); + connect(AddU5.y, BESS.Qext1) annotation (Line(points={{-59,-106},{-52,-106},{-52, + -96},{-42,-96}}, color={0,0,127})); + connect(IN44.y, AddU4.u2) + annotation (Line(points={{-95.4,-86},{-82,-86}}, color={0,0,127})); + connect(AddU4.u1,IN4) annotation (Line(points={{-82,-74},{-100,-74},{-100,-70}, + {-116,-70},{-116,-56},{-150,-56}}, color={0,0,127})); + connect(AddU5.u1,IN5) annotation (Line(points={{-82,-100},{-116,-100},{-116,-78}, + {-150,-78}}, color={0,0,127})); + connect(G2.conn, Bus6.p) annotation (Line(points={{-19,10},{-10,10}}, + color={0,0,255})); + connect(AddU3.u1, IN3) annotation (Line(points={{-82,-44},{-118,-44},{-118,-34}, + {-150,-34}}, color={0,0,127})); + connect(PV.p1, Bus8.p) + annotation (Line(points={{-20,-50},{-10,-50}}, color={0,0,255})); + connect(Bus8.p, T3.n) + annotation (Line(points={{-10,-50},{1,-50}}, color={0,0,255})); + connect(T2.p, Bus7.p) annotation (Line(points={{21,10},{25.5,10},{25.5,10},{30, + 10}}, color={0,0,255})); + connect(T3.p, Bus9.p) + annotation (Line(points={{23,-50},{30,-50}}, color={0,0,255})); + connect(T4.p, Bus11.p) + annotation (Line(points={{21,-90},{30,-90}}, color={0,0,255})); + connect(L4.n, Bus5.p) annotation (Line(points={{49.4,10},{60,10},{60,10},{80,10}, + {80,16}}, color={0,0,255})); + connect(L5.n, Bus5.p) annotation (Line(points={{49.4,-50},{60,-50},{60,10},{80, + 10},{80,16}}, color={0,0,255})); + connect(Bus11.p, L6.p) + annotation (Line(points={{30,-90},{38.6,-90}}, color={0,0,255})); + connect(Bus9.p, L5.p) + annotation (Line(points={{30,-50},{38.6,-50}}, color={0,0,255})); + connect(L6.n, Bus5.p) annotation (Line(points={{49.4,-90},{60,-90},{60,10},{80, + 10},{80,16}}, color={0,0,255})); + connect(Bus7.p, L4.p) annotation (Line(points={{30,10},{34.3,10},{34.3,10},{38.6, + 10}}, color={0,0,255})); + connect(sine.y, add.u2) annotation (Line(points={{78.5,-31},{78.5,-16.4}, + {83.2,-16.4}}, color={0,0,127})); + connect(whiteNoiseInjection.y, add.u1) annotation (Line(points={{78.54, + -12.06},{80.87,-12.06},{80.87,-11.6},{83.2,-11.6}}, color={0,0, + 127})); + connect(add.y, Load2.u) annotation (Line(points={{92.4,-14},{97.15,-14}, + {97.15,-14.5},{101.9,-14.5}}, color={0,0,127})); + connect(PV.Qref, AddU3.y) annotation (Line(points={{-42,-56},{-54,-56},{-54,-50}, + {-59,-50}}, color={0,0,127})); + connect(L2.n,Bus12. p) + annotation (Line(points={{193.4,10},{200,10}}, color={0,0,255})); + connect(L2.p, Bus5.p) + annotation (Line(points={{182.6,10},{80,10},{80,16}}, color={0,0,255})); + connect(Bus12.p, aC2DCandDC2AC_MPC.p) + annotation (Line(points={{200,10},{220,10}}, color={0,0,255})); + connect(aC2DCandDC2AC_MPC.n, nMD_MotorTypeI.p) + annotation (Line(points={{260,10},{280,10}}, color={0,0,255})); + connect(voltsHertzController_MPC.m, aC2DCandDC2AC_MPC.m_input) + annotation (Line(points={{244.6,-18},{244.6,-10},{249.091,-10},{ + 249.091,-2}}, color={0,0,127})); + connect(voltsHertzController_MPC.Vc, aC2DCandDC2AC_MPC.Vc) annotation ( + Line(points={{235.4,-18},{235.4,-10},{230.909,-10},{230.909,-2}}, + color={0,0,127})); + connect(nMD_MotorTypeI.wr, voltsHertzController_MPC.motor_speed) + annotation (Line(points={{284,-2},{284,-26},{252,-26}}, color={0,0,127})); + connect(nMD_MotorTypeI.we, voltsHertzController_MPC.we) + annotation (Line(points={{296,-2},{296,-34},{252,-34}}, color={0,0,127})); + connect(aC2DCandDC2AC_MPC.nr_input, nMD_MotorTypeI.wr) annotation (Line( + points={{261.818,3},{268,3},{268,-2},{284,-2}}, color={0,0,127})); + connect(IN66.y, add10.u2) annotation (Line(points={{161,-50},{164,-50.4},{185.2, + -50.4}}, color={0,0,127})); + connect(IN6, add10.u1) annotation (Line(points={{-150,-100},{-120,-100},{-120, + -132},{132,-132},{132,-24},{185.2,-24},{185.2,-45.6}}, color={0,0,127})); + connect(add10.y, voltsHertzController_MPC.W_ref) annotation (Line(points={{194.4, + -48},{208,-48},{208,-30},{228,-30}}, color={0,0,127})); + connect(IN77.y,Add1. u2) + annotation (Line(points={{163,-148},{172,-148},{172,-142},{180,-142}}, + color={0,0,127})); + connect(Add1.u1, IN7) annotation (Line(points={{180,-134},{168,-134},{168,-132}, + {134,-132},{134,-150},{-150,-150}}, color={0,0,127})); + connect(Ratio_LTC.y,Add1. u3) annotation (Line(points={{163,-180},{180,-180},{ + 180,-150}}, color={0,0,127})); + connect(L7.n,Bus13. p) + annotation (Line(points={{197.4,-82},{208,-82}}, color={0,0,255})); + connect(L7.p, Bus5.p) annotation (Line(points={{186.6,-82},{128,-82},{128,10}, + {80,10},{80,16}}, + color={0,0,255})); + connect(Bus13.p,uLTC_VoltageControl. p) + annotation (Line(points={{208,-82},{217,-82}}, color={0,0,255})); + connect(uLTC_VoltageControl.n,Bus14. p) + annotation (Line(points={{239,-82},{252,-82}}, color={0,0,255})); + connect(Add1.y, uLTC_VoltageControl.v_ref) annotation (Line(points={{203,-142}, + {228,-142},{228,-94}}, color={0,0,127})); + connect(load.p, Bus14.p) + annotation (Line(points={{266,-82},{252,-82}}, color={0,0,255})); + annotation(Diagram(coordinateSystem(preserveAspectRatio=false, + extent={{-140,-200},{340,140}}), graphics={ + Rectangle( + extent={{-160,30},{-132,-168}}, + lineColor={0,140,72}, + lineThickness=0.5), + Rectangle( + extent={{-128,36},{124,-124}}, + lineColor={238,46,47}, + lineThickness=0.5), + Rectangle( + extent={{-128,98},{124,38}}, + lineColor={0,128,255}, + lineThickness=0.5), + Text( + extent={{78,-106},{114,-120}}, + textColor={238,46,47}, + textString="Microgrid"), + Text( + extent={{76,58},{128,34}}, + textColor={28,108,200}, + textString="Utility Grid"), + Text( + extent={{-30,-102},{34,-124}}, + textColor={0,140,72}, + textString="Linearization Unit"), + Text( + extent={{-164,50},{-132,30}}, + textColor={0,140,72}, + textString="Inputs")}), + Documentation(info=" +

This example system shows how the preparation for resynchronization of Generator 2 to the grid. Note that at 2 seconds, a signal is triggered so voltages between buses 3 and 4 should be equal.

+

Simulate the system for 10 seconds. Variables of interest are:

+ +

Note the behavior of those variables before and after the connection of generator G2 to the main grid.

+"),experiment( + StopTime=10, + __Dymola_NumberOfIntervals=1000, + __Dymola_Algorithm="Dassl"), + Icon(coordinateSystem(extent={{-140,-200},{340,140}}))); + end MPC_LTC_VSD_Linearized2; + + model MPC_LTC_VSD_Original2 + "THIS ONE IS STABLE, CONTROLLABLE, OBSERVABLE!!!!!!!" + extends Modelica.Icons.Example; + + parameter Boolean equivalentGRID = false; + parameter Boolean equivalentsystem = false; + parameter Real set = 0; + + OpenIPSL.Electrical.Buses.Bus Bus1(v_0=powerFlow.powerflow.bus.V1, angle_0= + powerFlow.powerflow.bus.A1) if not equivalentGRID + annotation (Placement(transformation(extent={{-90,70},{-70,90}}))); + OpenIPSL.Electrical.Buses.Bus Bus2(v_0=powerFlow.powerflow.bus.V2, angle_0= + powerFlow.powerflow.bus.A1) if not equivalentGRID + annotation (Placement(transformation(extent={{-50,70},{-30,90}}))); + OpenIPSL.Electrical.Branches.PSSE.TwoWindingTransformer T1( + R=0.001, + X=0.2, + G=0, + B=0, + VNOM1=13800, + VB1=13800, + VNOM2=6000, + VB2=6000) if not equivalentGRID annotation (Placement(transformation( + extent={{-8,-8},{8,8}}, + rotation=180, + origin={-60,80}))); + OpenIPSL.Examples.OpenCPS.Generators.G1 G1( + enableV_b=true, + v_0=powerFlow.powerflow.bus.V1, + angle_0=powerFlow.powerflow.bus.A1, + P_0=powerFlow.powerflow.machines.PG1, + Q_0=powerFlow.powerflow.machines.QG1, + V_b=6000) if not equivalentGRID + annotation (Placement(transformation(extent={{-112,70},{-92,90}}))); + OpenIPSL.Electrical.Branches.PwLine L1( + R=0.001, + X=0.2, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{-26,76}, + {-14,84}}))); + OpenIPSL.Electrical.Buses.Bus Bus3(v_0=powerFlow.powerflow.bus.V3, angle_0= + powerFlow.powerflow.bus.A3) if not equivalentGRID + annotation (Placement(transformation(extent={{-10,70},{10,90}}))); + OpenIPSL.Electrical.Buses.Bus Bus4(v_0=powerFlow.powerflow.bus.V4, angle_0= + powerFlow.powerflow.bus.V4) if not equivalentGRID + annotation (Placement(transformation(extent={{50,70},{70,90}}))); + OpenIPSL.Electrical.Branches.PwLine L2_1( + R=0.0005, + X=0.1, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{24,86}, + {36,94}}))); + OpenIPSL.Electrical.Branches.PwLine L2_2( + R=0.0005, + X=0.1, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{24,66}, + {36,74}}))); + OpenIPSL.Electrical.Buses.Bus Bus5(angle_0=powerFlow.powerflow.bus.A5, v_0= + powerFlow.powerflow.bus.V5) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=90, + origin={80,16}))); + OpenIPSL.Electrical.Branches.PwLine L3( + R=0.001, + X=0.2, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation( + extent={{-6,-4},{6,4}}, + rotation=-90, + origin={80,60}))); + OpenIPSL.Electrical.Buses.Bus Bus6(v_0=powerFlow.powerflow.bus.V6, angle_0= + powerFlow.powerflow.bus.A6) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,10}))); + OpenIPSL.Electrical.Branches.PSSE.TwoWindingTransformer T2( + G=0, + B=0, + VNOM1=13800, + VB1=13800, + VNOM2=6000, + VB2=6000, + R=0.005, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={10,10}))); + GenerationUnits.PSSE.G2_16MVA G2( + enableV_b=true, + enableP_0=true, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V6, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A6, + V_b=6000, + P_0=powerFlow.powerflow.machines.PG2, + Q_0=powerFlow.powerflow.machines.QG2, + enableangle_0=true) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-30,10}))); + inner OpenIPSL.Electrical.SystemBase SysData(S_b=100000000, fn=60) + annotation (Placement(transformation(extent={{-128,104},{-74,124}}))); + OpenIPSL.Electrical.Loads.PSSE.Load Load1( + V_b=220000, + P_0=powerFlow.powerflow.loads.PL1, + Q_0=powerFlow.powerflow.loads.QL1, + v_0=powerFlow.powerflow.bus.V3, + angle_0=powerFlow.powerflow.bus.A3) if not equivalentGRID + annotation (Placement(transformation(extent={{-20,48},{0,68}}))); + Electrical.Events.Breaker circuitbreaker( + enableTrigger=false, + t_o=0.25, + rc_enabled=true, + t_rc=1000) if not equivalentGRID annotation (Placement(transformation( + extent={{-4,-4},{4,4}}, + rotation=90, + origin={80,26}))); + + Modelica.Blocks.Interfaces.RealInput IN1(start=0) + "Connector of Real input signal 2" annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-150,10}),iconTransformation(extent={{-10,-10},{10,10}}, origin={-150,10}))); + Modelica.Blocks.Sources.Constant IN11(k=0) + annotation (Placement(transformation(extent={{-108,-2},{-96,10}}))); + Modelica.Blocks.Math.Add AddU1 + annotation (Placement(transformation(extent={{-80,0},{-60,20}}))); + Modelica.Blocks.Sources.Constant IN22(k=0) + annotation (Placement(transformation(extent={{-108,-32},{-96,-20}}))); + Modelica.Blocks.Math.Add AddU2 + annotation (Placement(transformation(extent={{-80,-30},{-60,-10}}))); + Modelica.Blocks.Interfaces.RealInput IN2(start=0) + "Connector of Real input signal 2" + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-150,-12}), iconTransformation(extent={{-10,-10},{10,10}}, + origin={-150,-12}))); + Modelica.Blocks.Interfaces.RealInput IN3 "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-44},{-140,-24}}), + iconTransformation(extent={{-160,-44},{-140,-24}}))); + Modelica.Blocks.Interfaces.RealInput IN4(start = 0) "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-66},{-140,-46}}), + iconTransformation(extent={{-160,-66},{-140,-46}}))); + Modelica.Blocks.Interfaces.RealInput IN5(start = 0) "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-88},{-140,-68}}), + iconTransformation(extent={{-160,-88},{-140,-68}}))); + + PFData.PowerFlow powerFlow(redeclare record PowerFlow = + OpenIPSL.Examples.ModelPredictiveControl.PFData.PFVSD_TCL) + annotation (Placement(transformation(extent={{-68,104},{-48,124}}))); + Electrical.Machines.PSSE.GENCLS IB( + V_b=220000, + v_0=powerFlow.powerflow.bus.V4, + angle_0=powerFlow.powerflow.bus.A4, + P_0=powerFlow.powerflow.machines.Pinf, + Q_0=powerFlow.powerflow.machines.Qinf, + M_b=100000000, + X_d=1) if not equivalentGRID annotation (Placement(transformation(extent={{110,70}, + {100,90}}))); + Electrical.Loads.PSSE.Load_ExtInput Load2( + P_0=powerFlow.powerflow.loads.PL2, + Q_0=powerFlow.powerflow.loads.QL2, + v_0=powerFlow.powerflow.bus.V5, + angle_0=powerFlow.powerflow.bus.A5, + d_P=0, + t1=100, + d_t=1000) + annotation (Placement(transformation(extent={{100,-30},{120,-10}}))); + + inner Modelica.Blocks.Noise.GlobalSeed globalSeed( + enableNoise=true, + useAutomaticSeed=false, + fixedSeed=10000) + annotation (Placement(transformation(extent={{-44,102},{-24,122}}))); + Modelica.Blocks.Sources.Sine sine( + amplitude=0.01, + f=1/260, + phase=3.1415926535898, + startTime=1000) + annotation (Placement(transformation(extent={{70,-36},{80,-26}}))); + + Electrical.Buses.Bus Bus10(v_0=powerFlow.powerflow.bus.V10, angle_0=powerFlow.powerflow.bus.A10) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,-90}))); + Electrical.Branches.PSSE.TwoWindingTransformer T4( + G=0, + B=0, + CW=1, + VNOM1=13800, + VB1=13800, + VNOM2=480, + VB2=480, + R=0.001, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={10,-90}))); + GenerationUnits.PSSE.Solar_Units.SolarMPCLocalVQControl_ADD_ON + PV( + V_b=480, + P_0=powerFlow.powerflow.machines.PPV, + enableP_0=true, + Q_0=powerFlow.powerflow.machines.QPV, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V8, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A8, + enableangle_0=true) + annotation (Placement(transformation(extent={{-40,-60},{-20,-40}}))); + Modelica.Blocks.Math.Add AddU3 + annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}))); + Modelica.Blocks.Sources.Constant IN33(k=0) + annotation (Placement(transformation(extent={{-108,-62},{-96,-50}}))); + + Modelica.Blocks.Math.Add AddU4 + annotation (Placement(transformation(extent={{-80,-90},{-60,-70}}))); + Modelica.Blocks.Math.Add AddU5 + annotation (Placement(transformation(extent={{-80,-116},{-60,-96}}))); + Modelica.Blocks.Sources.Constant IN44(k=0) + annotation (Placement(transformation(extent={{-108,-92},{-96,-80}}))); + Modelica.Blocks.Sources.Constant IN55(k=0) + annotation (Placement(transformation(extent={{-108,-118},{-96,-106}}))); + GenerationUnits.PSSE.Battery_Units.BESSMPCLocalVQControl BESS( + V_base=480, + V_b(displayUnit="kV") = 480, + enableV_b=true, + P_0=powerFlow.powerflow.machines.PBESS, + enableP_0=true, + Q_0=powerFlow.powerflow.machines.QBESS, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V10, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A10, + enableangle_0=true) + annotation (Placement(transformation(extent={{-40,-100},{-20,-80}}))); + Electrical.Buses.Bus Bus8(v_0=powerFlow.powerflow.bus.V8, angle_0=powerFlow.powerflow.bus.A8) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,-50}))); + Electrical.Branches.PSSE.TwoWindingTransformer T3( + G=0, + B=0, + CW=1, + VNOM1=13800, + VB1=13800, + VNOM2=480, + VB2=480, + R=0.001, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={12,-50}))); + Electrical.Buses.Bus Bus11(v_0=powerFlow.powerflow.bus.V11, angle_0=powerFlow.powerflow.bus.A11) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,-90}))); + Electrical.Buses.Bus Bus9(v_0=powerFlow.powerflow.bus.V9, angle_0=powerFlow.powerflow.bus.A9) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,-50}))); + Electrical.Buses.Bus Bus7(v_0=powerFlow.powerflow.bus.V7, angle_0=powerFlow.powerflow.bus.A7) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,10}))); + Electrical.Branches.PwLine L4( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,6},{ + 50,14}}))); + Electrical.Branches.PwLine L5( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,-54}, + {50,-46}}))); + Electrical.Branches.PwLine L6( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,-94}, + {50,-86}}))); + Electrical.Renewables.PSSE.AddOnBlocks.IrradianceToPower + irradianceToPower( + Ypv(displayUnit="MW") = 3000000, + Sb(displayUnit="MV.A") = 100000000, + Tcstc(displayUnit="K") = 298.15, + fpv=1, + ap=-0.48, + Gtstc=1000) + annotation (Placement(transformation(extent={{44,-20},{34,-10}}))); + Modelica.Blocks.Interfaces.RealInput IN6 "Connector of Real input signal 2" + annotation (Placement(transformation(extent={{-160,-108},{-140,-88}}), + iconTransformation(extent={{-160,-108},{-140,-88}}))); + Modelica.Blocks.Sources.Constant IN66(k=0) + annotation (Placement(transformation(extent={{140,-60},{160,-40}}))); + Electrical.Branches.PwLine L2( + R=0.001, + X=0.01, + G=0, + B=0) annotation (Placement(transformation(extent={{182,6},{194,14}}))); + Electrical.Buses.Bus Bus12(angle_0=powerFlow.powerflow.bus.A5, v_0= + powerFlow.powerflow.bus.V5) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={200,10}))); + Electrical.Machines.ControlsMotors.VariableSpeedDrive.PowerElectronics.AC2DCandDC2AC_MPC + aC2DCandDC2AC_MPC( + V_b=13800, + v_0=powerFlow.powerflow.bus.V5, + angle_0=powerFlow.powerflow.bus.A5, + Rdc=0.1, + Cdc=0.00001, + m0=0.9537) + annotation (Placement(transformation(extent={{220,0},{260,20}}))); + Electrical.Machines.NonMultiDomain.Motors.ThreePhase.PSAT.NMD_MotorTypeI + nMD_MotorTypeI( + M_b=5000000, + V_b=13800, + Sup=false, + a=0, + b=0, + c=0.1) + annotation (Placement(transformation(extent={{300,0},{280,20}}))); + Electrical.Machines.ControlsMotors.VariableSpeedDrive.ControllerLogic.VoltsHertzController_MPC + voltsHertzController_MPC( + V_b=13800, + f_max=60, + f_min=0, + m0=0.9537, + Kp=0.5, + Ki=0.2, + rotor_speed_initial=1.9*Modelica.Constants.pi*60) + annotation (Placement(transformation(extent={{230,-40},{248,-20}}))); + Modelica.Blocks.Interfaces.RealOutput OUT1 + annotation (Placement(transformation(extent={{-284,80},{-264,100}}))); + Modelica.Blocks.Interfaces.RealOutput OUT2 + annotation (Placement(transformation(extent={{-284,60},{-264,80}}))); + Modelica.Blocks.Interfaces.RealOutput OUT3 + annotation (Placement(transformation(extent={{-284,40},{-264,60}}))); + Modelica.Blocks.Interfaces.RealOutput OUT4 + annotation (Placement(transformation(extent={{-284,20},{-264,40}}))); + Modelica.Blocks.Interfaces.RealOutput OUT5 + annotation (Placement(transformation(extent={{-284,0},{-264,20}}))); + Modelica.Blocks.Interfaces.RealOutput OUT6 + annotation (Placement(transformation(extent={{-284,-20},{-264,0}}))); + Modelica.Blocks.Interfaces.RealOutput OUT7 + annotation (Placement(transformation(extent={{-284,-40},{-264,-20}}))); + Modelica.Blocks.Interfaces.RealOutput OUT8 + annotation (Placement(transformation(extent={{-284,-60},{-264,-40}}))); + Modelica.Blocks.Interfaces.RealOutput OUT9 + annotation (Placement(transformation(extent={{-284,-80},{-264,-60}}))); + Modelica.Blocks.Interfaces.RealOutput OUT10 + annotation (Placement(transformation(extent={{-284,-100},{-264,-80}}))); + Modelica.Blocks.Interfaces.RealOutput OUT11 + annotation (Placement(transformation(extent={{-260,80},{-240,100}}))); + Modelica.Blocks.Interfaces.RealOutput OUT12 + annotation (Placement(transformation(extent={{-260,60},{-240,80}}))); + Modelica.Blocks.Interfaces.RealOutput OUT13 + annotation (Placement(transformation(extent={{-260,40},{-240,60}}))); + Modelica.Blocks.Interfaces.RealOutput OUT14 + annotation (Placement(transformation(extent={{-260,20},{-240,40}}))); + Modelica.Blocks.Interfaces.RealOutput OUT15 + annotation (Placement(transformation(extent={{-260,0},{-240,20}}))); + Modelica.Blocks.Interfaces.RealOutput OUT16 + annotation (Placement(transformation(extent={{-260,-20},{-240,0}}))); + Modelica.Blocks.Interfaces.RealOutput OUT17 + annotation (Placement(transformation(extent={{-260,-40},{-240,-20}}))); + Modelica.Blocks.Interfaces.RealOutput OUT18 + annotation (Placement(transformation(extent={{-260,-60},{-240,-40}}))); + Modelica.Blocks.Interfaces.RealOutput OUT19 + annotation (Placement(transformation(extent={{-260,-80},{-240,-60}}))); + Modelica.Blocks.Interfaces.RealOutput OUT20 + annotation (Placement(transformation(extent={{-260,-100},{-240,-80}}))); + Modelica.Blocks.Interfaces.RealOutput OUT21 + annotation (Placement(transformation(extent={{-240,80},{-220,100}}))); + Modelica.Blocks.Interfaces.RealOutput OUT22 + annotation (Placement(transformation(extent={{-240,60},{-220,80}}))); + Modelica.Blocks.Interfaces.RealOutput OUT23 + annotation (Placement(transformation(extent={{-240,40},{-220,60}}))); + Modelica.Blocks.Interfaces.RealOutput OUT24 + annotation (Placement(transformation(extent={{-240,20},{-220,40}}))); + Modelica.Blocks.Interfaces.RealOutput OUT25 + annotation (Placement(transformation(extent={{-240,0},{-220,20}}))); + Modelica.Blocks.Interfaces.RealOutput OUT26 + annotation (Placement(transformation(extent={{-240,-20},{-220,0}}))); + Modelica.Blocks.Interfaces.RealOutput OUT27 + annotation (Placement(transformation(extent={{-240,-40},{-220,-20}}))); + Modelica.Blocks.Interfaces.RealOutput OUT28 + annotation (Placement(transformation(extent={{-240,-60},{-220,-40}}))); + Modelica.Blocks.Interfaces.RealOutput OUT29 + annotation (Placement(transformation(extent={{-240,-80},{-220,-60}}))); + Modelica.Blocks.Interfaces.RealOutput OUT30 + annotation (Placement(transformation(extent={{-240,-100},{-220,-80}}))); + Modelica.Blocks.Interfaces.RealOutput OUT31 + annotation (Placement(transformation(extent={{-220,80},{-200,100}}))); + Modelica.Blocks.Math.Add Add10 + annotation (Placement(transformation(extent={{192,-40},{212,-20}}))); + Modelica.Blocks.Interfaces.RealInput IN7 + "Connector of Real input signal 1" annotation (Placement( + transformation(extent={{-158,-152},{-138,-132}}), + iconTransformation(extent={{-160,-160},{-140,-140}}))); + Modelica.Blocks.Sources.Constant IN77(k=0) + annotation (Placement(transformation(extent={{130,-162},{150,-142}}))); + Modelica.Blocks.Math.Add3 Add1 + annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + rotation=0, + origin={180,-146}))); + Modelica.Blocks.Sources.Constant Ratio_LTC(k=1) + annotation (Placement(transformation(extent={{130,-174},{150,-194}}))); + Electrical.Buses.Bus Bus13(angle_0=powerFlow.powerflow.bus.A13, + v_0=powerFlow.powerflow.bus.V13) + annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={196,-86}))); + Electrical.Branches.PwLine L7( + R=0.001, + X=0.01, + G=0, + B=0) annotation (Placement(transformation(extent={{174,-90},{186,-82}}))); + Electrical.Buses.Bus Bus14( + V_b=120, + angle_0=powerFlow.powerflow.bus.A14, + v_0=powerFlow.powerflow.bus.V14) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={240,-86}))); + TCL.ULTC_VoltageControl uLTC_VoltageControl( + Vbus1=13800, + Vbus2(displayUnit="V") = 120, + Vn=13800, + v_0=1, + kT=13800/120, + m0=1, + m_max=1.05, + m_min=0.95, + K=0.01) + annotation (Placement(transformation(extent={{206,-96},{226,-76}}))); + Modelica.Blocks.Interfaces.RealOutput OUT32 + annotation (Placement(transformation(extent={{-220,60},{-200,80}}))); + Modelica.Blocks.Sources.Step Load_Dip(height=-0.005, startTime=5) + annotation (Placement(transformation(extent={{70,-70},{80,-60}}))); + Modelica.Blocks.Math.Add Add2 + annotation (Placement(transformation(extent={{94,-64},{104,-54}}))); + Electrical.Loads.PSAT.TCL_randominit tCL_randominit( + Sn=1e6, + v0=1, + p0=0.5, + R=100, + C=80, + start0=1) + annotation (Placement(transformation(extent={{262,-96},{282,-76}}))); + Modelica.Blocks.Sources.Constant const(k=0) + annotation (Placement(transformation(extent={{282,-68},{262,-48}}))); + equation + + OUT1 = G2.gen.w; + OUT2 = G2.gen.delta; + OUT3 = G2.gen.Epq; + OUT4 = G2.gen.PSIkd; + OUT5 = G2.gen.PSIppq; + OUT6 = G2.sEXSMPC.simpleLagLim.state; + OUT7 = G2.sEXSMPC.leadLag.TF.x_scaled[1]; + OUT8 = G2.gASTMPC.simpleLagLim.state; + OUT9 = G2.gASTMPC.simpleLag.state; + OUT10 = G2.gASTMPC.simpleLag1.state; + OUT11 = Bus6.v; + + OUT12 =PV.rEGCA1_1.Pgen; + OUT13 =PV.rEGCA1_1.Qgen; + OUT14 =PV.rEGCA1_1.p.ir; + OUT15 =PV.rEGCA1_1.p.ii; + OUT16 = Bus8.v; + + OUT17 =BESS.rEGCA1_1.Pgen; + OUT18 =BESS.rEGCA1_1.Qgen; + OUT19 =BESS.rEGCA1_1.p.ir; + OUT20 =BESS.rEGCA1_1.p.ii; + OUT21 = Bus10.v; + + OUT22 = uLTC_VoltageControl.m; + OUT23 = Bus14.p.vr; + OUT24 = Bus14.p.vi; + + + OUT25= aC2DCandDC2AC_MPC.n.ir; + OUT26= aC2DCandDC2AC_MPC.n.ii; + OUT27= aC2DCandDC2AC_MPC.P; + + OUT28= nMD_MotorTypeI.wr; + OUT29= voltsHertzController_MPC.we; + OUT30= Bus12.v; + + OUT31 = Bus5.v; + OUT32 = Bus5.angle; + + connect(T1.p, Bus2.p) + annotation (Line(points={{-51.2,80},{-40,80}}, color={0,0,255})); + connect(Bus1.p, T1.n) + annotation (Line(points={{-80,80},{-68.8,80}}, color={0,0,255})); + connect(G1.conn, Bus1.p) + annotation (Line(points={{-91,80},{-80,80}}, color={0,0,255})); + connect(L1.n, Bus3.p) + annotation (Line(points={{-14.6,80},{0,80}}, color={0,0,255})); + connect(L1.p, Bus2.p) + annotation (Line(points={{-25.4,80},{-40,80}}, color={0,0,255})); + connect(L2_2.n, Bus4.p) annotation (Line(points={{35.4,70},{44,70},{44,80},{60, + 80}}, color={0,0,255})); + connect(L2_1.n, Bus4.p) annotation (Line(points={{35.4,90},{44,90},{44,80},{60, + 80}}, color={0,0,255})); + connect(L2_1.p, Bus3.p) annotation (Line(points={{24.6,90},{16,90},{16,80},{0, + 80}}, color={0,0,255})); + connect(L2_2.p, Bus3.p) annotation (Line(points={{24.6,70},{16,70},{16,80},{0, + 80}}, color={0,0,255})); + connect(Load1.p, Bus3.p) + annotation (Line(points={{-10,68},{-10,80},{0,80}}, color={0,0,255})); + connect(L3.p, Bus4.p) + annotation (Line(points={{80,65.4},{80,80},{60,80}}, color={0,0,255})); + connect(circuitbreaker.s, Bus5.p) + annotation (Line(points={{80,22},{80,16}}, color={0,0,255})); + connect(circuitbreaker.r, L3.n) + annotation (Line(points={{80,30},{80,54.6}}, color={0,0,255})); + connect(IN11.y, AddU1.u2) annotation (Line(points={{-95.4,4},{-82,4}}, + color={0,0,127})); + connect(IN1, AddU1.u1) annotation (Line(points={{-150,10},{-116,10},{-116,16}, + {-82,16}}, + color={0,0,127})); + + connect(IN22.y,AddU2. u2) annotation (Line(points={{-95.4,-26},{-82,-26}}, + color={0,0,127})); + connect(IN2,AddU2. u1) annotation (Line(points={{-150,-12},{-118,-12},{-118,-14}, + {-82,-14}}, + color={0,0,127})); + connect(AddU2.y, G2.Efd_ref) + annotation (Line(points={{-59,-20},{-52,-20},{-52,4},{-42,4}}, + color={0,0,127})); + connect(AddU1.y, G2.P_ref1) annotation (Line(points={{-59,10},{-52,10},{-52,16}, + {-42,16}}, color={0,0,127})); + connect(IB.p, Bus4.p) + annotation (Line(points={{100,80},{60,80}}, color={0,0,255})); + connect(Load2.p, Bus5.p) annotation (Line(points={{110,-10},{110,10},{80,10},{ + 80,16}}, + color={0,0,255})); + connect(T4.n, Bus10.p) + annotation (Line(points={{-1,-90},{-10,-90}}, color={0,0,255})); + connect(Bus6.p, T2.n) + annotation (Line(points={{-10,10},{-1,10}}, + color={0,0,255})); + connect(AddU3.y, PV.QINPUT) annotation (Line(points={{-59,-50},{-42,-50}}, + color={0,0,127})); + connect(IN33.y,AddU3. u2) + annotation (Line(points={{-95.4,-56},{-82,-56}}, color={0,0,127})); + connect(BESS.p1, Bus10.p) + annotation (Line(points={{-20,-90},{-10,-90}}, color={0,0,255})); + connect(BESS.Paux1, AddU4.y) annotation (Line(points={{-42,-84},{-54,-84},{-54, + -80},{-59,-80}}, color={0,0,127})); + connect(IN55.y, AddU5.u2) + annotation (Line(points={{-95.4,-112},{-82,-112}}, color={0,0,127})); + connect(AddU5.y, BESS.Qext1) annotation (Line(points={{-59,-106},{-52,-106},{-52, + -96},{-42,-96}}, color={0,0,127})); + connect(IN44.y, AddU4.u2) + annotation (Line(points={{-95.4,-86},{-82,-86}}, color={0,0,127})); + connect(AddU4.u1,IN4) annotation (Line(points={{-82,-74},{-100,-74},{-100,-70}, + {-116,-70},{-116,-56},{-150,-56}}, color={0,0,127})); + connect(AddU5.u1,IN5) annotation (Line(points={{-82,-100},{-116,-100},{-116,-78}, + {-150,-78}}, color={0,0,127})); + connect(G2.conn, Bus6.p) annotation (Line(points={{-19,10},{-10,10}}, + color={0,0,255})); + connect(AddU3.u1, IN3) annotation (Line(points={{-82,-44},{-118,-44},{-118,-34}, + {-150,-34}}, color={0,0,127})); + connect(PV.p1, Bus8.p) + annotation (Line(points={{-20,-50},{-10,-50}}, color={0,0,255})); + connect(Bus8.p, T3.n) + annotation (Line(points={{-10,-50},{1,-50}}, color={0,0,255})); + connect(T2.p, Bus7.p) annotation (Line(points={{21,10},{25.5,10},{25.5,10},{30, + 10}}, color={0,0,255})); + connect(T3.p, Bus9.p) + annotation (Line(points={{23,-50},{30,-50}}, color={0,0,255})); + connect(T4.p, Bus11.p) + annotation (Line(points={{21,-90},{30,-90}}, color={0,0,255})); + connect(L4.n, Bus5.p) annotation (Line(points={{49.4,10},{60,10},{60,10},{80,10}, + {80,16}}, color={0,0,255})); + connect(L5.n, Bus5.p) annotation (Line(points={{49.4,-50},{60,-50},{60,10},{80, + 10},{80,16}}, color={0,0,255})); + connect(Bus11.p, L6.p) + annotation (Line(points={{30,-90},{38.6,-90}}, color={0,0,255})); + connect(Bus9.p, L5.p) + annotation (Line(points={{30,-50},{38.6,-50}}, color={0,0,255})); + connect(L6.n, Bus5.p) annotation (Line(points={{49.4,-90},{60,-90},{60,10},{80, + 10},{80,16}}, color={0,0,255})); + connect(Bus7.p, L4.p) annotation (Line(points={{30,10},{34.3,10},{34.3,10},{38.6, + 10}}, color={0,0,255})); + connect(L2.n, Bus12.p) + annotation (Line(points={{193.4,10},{200,10}}, color={0,0,255})); + connect(L2.p, Bus5.p) + annotation (Line(points={{182.6,10},{80,10},{80,16}}, color={0,0,255})); + connect(Bus12.p, aC2DCandDC2AC_MPC.p) annotation (Line(points={{200,10}, + {220,10}}, color={0,0,255})); + connect(aC2DCandDC2AC_MPC.n, nMD_MotorTypeI.p) annotation (Line(points={{260,10}, + {280,10}}, color={0,0,255})); + connect(voltsHertzController_MPC.m, aC2DCandDC2AC_MPC.m_input) + annotation (Line(points={{244.6,-18},{244.6,-10},{249.091,-10},{249.091,-2}}, + color={0,0,127})); + connect(voltsHertzController_MPC.Vc, aC2DCandDC2AC_MPC.Vc) annotation ( + Line(points={{235.4,-18},{235.4,-10},{230.909,-10},{230.909,-2}}, + color={0,0,127})); + connect(nMD_MotorTypeI.wr, voltsHertzController_MPC.motor_speed) + annotation (Line(points={{284,-2},{284,-26},{252,-26}}, color={0,0,127})); + connect(nMD_MotorTypeI.we, voltsHertzController_MPC.we) + annotation (Line(points={{296,-2},{296,-34},{252,-34}}, color={0,0,127})); + connect(aC2DCandDC2AC_MPC.nr_input, nMD_MotorTypeI.wr) annotation (Line( + points={{261.818,3},{268,3},{268,-2},{284,-2}}, color={0,0,127})); + connect(irradianceToPower.Ppv, PV.IRR2POW) annotation (Line(points={{ + 33.5,-15},{-42,-15},{-42,-43}}, color={0,0,127})); + connect(IN66.y, Add10.u2) annotation (Line(points={{161,-50},{180,-50},{180,-36}, + {190,-36}}, color={0,0,127})); + connect(Add10.y, voltsHertzController_MPC.W_ref) + annotation (Line(points={{213,-30},{228,-30}}, color={0,0,127})); + connect(Add10.u1, IN6) annotation (Line(points={{190,-24},{126,-24},{126,-122}, + {-150,-122},{-150,-98}}, color={0,0,127})); + connect(IN77.y,Add1. u2) + annotation (Line(points={{151,-152},{160,-152},{160,-146},{168,-146}}, + color={0,0,127})); + connect(Add1.u1, IN7) annotation (Line(points={{168,-138},{156,-138},{ + 156,-136},{-132,-136},{-132,-142},{-148,-142}}, + color={0,0,127})); + connect(Ratio_LTC.y,Add1. u3) annotation (Line(points={{151,-184},{168, + -184},{168,-154}}, + color={0,0,127})); + connect(L7.n,Bus13. p) + annotation (Line(points={{185.4,-86},{196,-86}}, color={0,0,255})); + connect(L7.p, Bus5.p) annotation (Line(points={{174.6,-86},{64,-86},{64, + 0},{96,0},{96,10},{80,10},{80,16}}, + color={0,0,255})); + connect(Bus13.p,uLTC_VoltageControl. p) + annotation (Line(points={{196,-86},{205,-86}}, color={0,0,255})); + connect(uLTC_VoltageControl.n,Bus14. p) + annotation (Line(points={{227,-86},{240,-86}}, color={0,0,255})); + connect(Add1.y,uLTC_VoltageControl. v_ref) annotation (Line(points={{191, + -146},{216,-146},{216,-98}}, + color={0,0,127})); + connect(Load_Dip.y, Add2.u2) annotation (Line(points={{80.5,-65},{86,-65},{86, + -62},{93,-62}}, color={0,0,127})); + connect(sine.y, Add2.u1) annotation (Line(points={{80.5,-31},{80.5,-32},{88, + -32},{88,-56},{93,-56}}, color={0,0,127})); + connect(Add2.y, Load2.u) annotation (Line(points={{104.5,-59},{112,-59},{112, + -42},{92,-42},{92,-14.5},{101.9,-14.5}}, color={0,0,127})); + connect(Bus14.p, tCL_randominit.p) + annotation (Line(points={{240,-86},{260.5,-86}}, color={0,0,255})); + connect(const.y, tCL_randominit.u) annotation (Line(points={{261,-58},{250,-58}, + {250,-81.4812},{260,-81.4812}}, color={0,0,127})); + annotation (Placement(transformation(extent={{140,-20},{160,0}})), + Placement(transformation(extent={{140,-40},{160,-20}})), + Placement(transformation(extent={{140,-60},{160,-40}})), + Placement(transformation(extent={{140,-80},{160,-60}})), + Diagram(coordinateSystem(preserveAspectRatio=false, + extent={{-140,-200},{320,140}}), graphics={ + Rectangle( + extent={{-160,30},{-134,-124}}, + lineColor={0,140,72}, + lineThickness=0.5), + Rectangle( + extent={{-128,36},{124,-124}}, + lineColor={238,46,47}, + lineThickness=0.5), + Rectangle( + extent={{-128,98},{124,38}}, + lineColor={0,128,255}, + lineThickness=0.5), + Text( + extent={{78,-106},{114,-120}}, + textColor={238,46,47}, + textString="Microgrid"), + Text( + extent={{76,58},{128,34}}, + textColor={28,108,200}, + textString="Utility Grid"), + Text( + extent={{-30,-102},{34,-124}}, + textColor={0,140,72}, + textString="Linearization Unit"), + Text( + extent={{-164,50},{-132,30}}, + textColor={0,140,72}, + textString="Inputs")}), + Documentation(info=" +

This example system shows how the preparation for resynchronization of Generator 2 to the grid. Note that at 2 seconds, a signal is triggered so voltages between buses 3 and 4 should be equal.

+

Simulate the system for 10 seconds. Variables of interest are:

+ +

Note the behavior of those variables before and after the connection of generator G2 to the main grid.

+"),experiment( + StopTime=10, + __Dymola_NumberOfIntervals=1000, + __Dymola_fixedstepsize=0.001, + __Dymola_Algorithm="Dassl"), + Icon(coordinateSystem(extent={{-140,-200},{320,140}}))); + end MPC_LTC_VSD_Original2; + + model MPC_LTC_VSD_Linearized3 + "THIS ONE IS STABLE, CONTROLLABLE, OBSERVABLE!!!!!!!" + extends Modelica.Icons.Example; + + parameter Boolean equivalentGRID = true; + parameter Boolean equivalentsystem = false; + parameter Real set = 0; + + OpenIPSL.Electrical.Buses.Bus Bus1(v_0=powerFlow.powerflow.bus.V1, angle_0= + powerFlow.powerflow.bus.A1) if not equivalentGRID + annotation (Placement(transformation(extent={{-90,70},{-70,90}}))); + OpenIPSL.Electrical.Buses.Bus Bus2(v_0=powerFlow.powerflow.bus.V2, angle_0= + powerFlow.powerflow.bus.A1) if not equivalentGRID + annotation (Placement(transformation(extent={{-50,70},{-30,90}}))); + OpenIPSL.Electrical.Branches.PSSE.TwoWindingTransformer T1( + R=0.001, + X=0.2, + G=0, + B=0, + VNOM1=13800, + VB1=13800, + VNOM2=6000, + VB2=6000) if not equivalentGRID annotation (Placement(transformation( + extent={{-8,-8},{8,8}}, + rotation=180, + origin={-60,80}))); + OpenIPSL.Examples.OpenCPS.Generators.G1 G1( + enableV_b=true, + v_0=powerFlow.powerflow.bus.V1, + angle_0=powerFlow.powerflow.bus.A1, + P_0=powerFlow.powerflow.machines.PG1, + Q_0=powerFlow.powerflow.machines.QG1, + V_b=6000) if not equivalentGRID + annotation (Placement(transformation(extent={{-112,70},{-92,90}}))); + OpenIPSL.Electrical.Branches.PwLine L1( + R=0.001, + X=0.2, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{-26,76}, + {-14,84}}))); + OpenIPSL.Electrical.Buses.Bus Bus3(v_0=powerFlow.powerflow.bus.V3, angle_0= + powerFlow.powerflow.bus.A3) if not equivalentGRID + annotation (Placement(transformation(extent={{-10,70},{10,90}}))); + OpenIPSL.Electrical.Buses.Bus Bus4(v_0=powerFlow.powerflow.bus.V4, angle_0= + powerFlow.powerflow.bus.V4) if not equivalentGRID + annotation (Placement(transformation(extent={{50,70},{70,90}}))); + OpenIPSL.Electrical.Branches.PwLine L2_1( + R=0.0005, + X=0.1, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{24,86}, + {36,94}}))); + OpenIPSL.Electrical.Branches.PwLine L2_2( + R=0.0005, + X=0.1, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{24,66}, + {36,74}}))); + OpenIPSL.Electrical.Buses.Bus Bus5(angle_0=powerFlow.powerflow.bus.A5, v_0= + powerFlow.powerflow.bus.V5) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=90, + origin={80,16}))); + OpenIPSL.Electrical.Branches.PwLine L3( + R=0.001, + X=0.2, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation( + extent={{-6,-4},{6,4}}, + rotation=-90, + origin={80,60}))); + OpenIPSL.Electrical.Buses.Bus Bus6(v_0=powerFlow.powerflow.bus.V6, angle_0= + powerFlow.powerflow.bus.A6) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,10}))); + OpenIPSL.Electrical.Branches.PSSE.TwoWindingTransformer T2( + G=0, + B=0, + VNOM1=13800, + VB1=13800, + VNOM2=6000, + VB2=6000, + R=0.005, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={10,10}))); + GenerationUnits.PSSE.G2_16MVA G2( + enableV_b=true, + enableP_0=true, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V6, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A6, + V_b=6000, + P_0=powerFlow.powerflow.machines.PG2, + Q_0=powerFlow.powerflow.machines.QG2, + enableangle_0=true) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-30,10}))); + inner OpenIPSL.Electrical.SystemBase SysData(S_b=100000000, fn=60) + annotation (Placement(transformation(extent={{-128,104},{-74,124}}))); + OpenIPSL.Electrical.Loads.PSSE.Load Load1( + V_b=220000, + P_0=powerFlow.powerflow.loads.PL1, + Q_0=powerFlow.powerflow.loads.QL1, + v_0=powerFlow.powerflow.bus.V3, + angle_0=powerFlow.powerflow.bus.A3) if not equivalentGRID + annotation (Placement(transformation(extent={{-20,48},{0,68}}))); + Electrical.Events.Breaker circuitbreaker( + enableTrigger=false, + t_o=0.25, + rc_enabled=true, + t_rc=1000) if not equivalentGRID annotation (Placement(transformation( + extent={{-4,-4},{4,4}}, + rotation=90, + origin={80,26}))); + + Modelica.Blocks.Interfaces.RealInput IN1(start=0) + "Connector of Real input signal 2" annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-150,10}),iconTransformation(extent={{-10,-10},{10,10}}, origin={-150,10}))); + Modelica.Blocks.Sources.Constant IN11(k=0) + annotation (Placement(transformation(extent={{-108,-2},{-96,10}}))); + Modelica.Blocks.Math.Add AddU1 + annotation (Placement(transformation(extent={{-80,0},{-60,20}}))); + Modelica.Blocks.Sources.Constant IN22(k=0) + annotation (Placement(transformation(extent={{-108,-32},{-96,-20}}))); + Modelica.Blocks.Math.Add AddU2 + annotation (Placement(transformation(extent={{-80,-30},{-60,-10}}))); + Modelica.Blocks.Interfaces.RealInput IN2(start=0) + "Connector of Real input signal 2" + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-150,-12}), iconTransformation(extent={{-10,-10},{10,10}}, + origin={-150,-12}))); + + Modelica.Blocks.Interfaces.RealInput IN3(start = 0) "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-44},{-140,-24}}), + iconTransformation(extent={{-160,-44},{-140,-24}}))); + Modelica.Blocks.Interfaces.RealInput IN4(start = 0) "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-66},{-140,-46}}), + iconTransformation(extent={{-160,-66},{-140,-46}}))); + Modelica.Blocks.Interfaces.RealInput IN5(start = 0) "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-88},{-140,-68}}), + iconTransformation(extent={{-160,-88},{-140,-68}}))); + + PFData.PowerFlow powerFlow(redeclare record PowerFlow = + OpenIPSL.Examples.ModelPredictiveControl.PFData.PFVSD_TCL) + annotation (Placement(transformation(extent={{-68,104},{-48,124}}))); + Electrical.Machines.PSSE.GENCLS IB( + V_b=220000, + v_0=powerFlow.powerflow.bus.V4, + angle_0=powerFlow.powerflow.bus.A4, + P_0=powerFlow.powerflow.machines.Pinf, + Q_0=powerFlow.powerflow.machines.Qinf, + M_b=100000000, + X_d=1) if not equivalentGRID annotation (Placement(transformation(extent={{110,70}, + {100,90}}))); + Electrical.Loads.PSSE.Load_ExtInput Load2( + P_0=powerFlow.powerflow.loads.PL2, + Q_0=powerFlow.powerflow.loads.QL2, + v_0=powerFlow.powerflow.bus.V5, + angle_0=powerFlow.powerflow.bus.A5, + d_P=0, + t1=100, + d_t=1000) + annotation (Placement(transformation(extent={{100,-30},{120,-10}}))); + + inner Modelica.Blocks.Noise.GlobalSeed globalSeed(useAutomaticSeed=false, + fixedSeed=10000) + annotation (Placement(transformation(extent={{-42,102},{-22,122}}))); + + Electrical.Buses.Bus Bus10(v_0=powerFlow.powerflow.bus.V10, angle_0=powerFlow.powerflow.bus.A10) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,-90}))); + Electrical.Branches.PSSE.TwoWindingTransformer T4( + G=0, + B=0, + CW=1, + VNOM1=13800, + VB1=13800, + VNOM2=480, + VB2=480, + R=0.001, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={10,-90}))); + GenerationUnits.PSSE.Solar_Units.SolarMPCSysIdentification + PV( + V_b=480, + P_0=powerFlow.powerflow.machines.PPV, + enableP_0=true, + Q_0=powerFlow.powerflow.machines.QPV, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V8, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A8, + enableangle_0=true) + annotation (Placement(transformation(extent={{-40,-60},{-20,-40}}))); + Modelica.Blocks.Math.Add AddU3 + annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}))); + Modelica.Blocks.Sources.Constant IN33(k=0) + annotation (Placement(transformation(extent={{-108,-62},{-96,-50}}))); + + Modelica.Blocks.Math.Add AddU4 + annotation (Placement(transformation(extent={{-80,-90},{-60,-70}}))); + Modelica.Blocks.Math.Add AddU5 + annotation (Placement(transformation(extent={{-80,-116},{-60,-96}}))); + Modelica.Blocks.Sources.Constant IN44(k=0) + annotation (Placement(transformation(extent={{-108,-92},{-96,-80}}))); + Modelica.Blocks.Sources.Constant IN55(k=0) + annotation (Placement(transformation(extent={{-108,-118},{-96,-106}}))); + GenerationUnits.PSSE.Battery_Units.BESSMPCSysIdentification + BESS( + V_base=480, + V_b(displayUnit="kV") = 480, + enableV_b=true, + P_0=powerFlow.powerflow.machines.PBESS, + enableP_0=true, + Q_0=powerFlow.powerflow.machines.QBESS, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V10, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A10, + enableangle_0=true) + annotation (Placement(transformation(extent={{-40,-100},{-20,-80}}))); + Electrical.Buses.Bus Bus8(v_0=powerFlow.powerflow.bus.V8, angle_0=powerFlow.powerflow.bus.A8) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,-50}))); + Electrical.Branches.PSSE.TwoWindingTransformer T3( + G=0, + B=0, + CW=1, + VNOM1=13800, + VB1=13800, + VNOM2=480, + VB2=480, + R=0.001, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={12,-50}))); + Electrical.Buses.Bus Bus11(v_0=powerFlow.powerflow.bus.V11, angle_0=powerFlow.powerflow.bus.A11) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,-90}))); + Electrical.Buses.Bus Bus9(v_0=powerFlow.powerflow.bus.V9, angle_0=powerFlow.powerflow.bus.A9) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,-50}))); + Electrical.Buses.Bus Bus7(v_0=powerFlow.powerflow.bus.V7, angle_0=powerFlow.powerflow.bus.A7) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,10}))); + Electrical.Branches.PwLine L4( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,6},{ + 50,14}}))); + Electrical.Branches.PwLine L5( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,-54}, + {50,-46}}))); + Electrical.Branches.PwLine L6( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,-94}, + {50,-86}}))); + Modelica.Blocks.Sources.Sine sine( + amplitude=0, + f=1/260, + phase=3.1415926535898, + startTime=1000) + annotation (Placement(transformation(extent={{68,-36},{78,-26}}))); + Electrical.Loads.NoiseInjections.WhiteNoiseInjection whiteNoiseInjection( + active_sigma=0.000000000000001, + samplePeriod=0.01) + annotation (Placement(transformation(extent={{66,-18},{78,-6}}))); + Modelica.Blocks.Math.Add add + annotation (Placement(transformation(extent={{84,-18},{92,-10}}))); + + Modelica.Blocks.Sources.Constant IN66(k=0) + annotation (Placement(transformation(extent={{140,-60},{160,-40}}))); + Electrical.Branches.PwLine L2( + R=0.001, + X=0.01, + G=0, + B=0) annotation (Placement(transformation(extent={{182,6},{194,14}}))); + Electrical.Buses.Bus Bus12(angle_0=powerFlow.powerflow.bus.A5, v_0= + powerFlow.powerflow.bus.V5) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={200,10}))); + Electrical.Machines.ControlsMotors.VariableSpeedDrive.PowerElectronics.AC2DCandDC2AC_MPC + aC2DCandDC2AC_MPC( + V_b=13800, + v_0=powerFlow.powerflow.bus.V5, + angle_0=powerFlow.powerflow.bus.A5, + Rdc=0.01, + Cdc=0.000001, + m0=0.9537) + annotation (Placement(transformation(extent={{220,0},{260,20}}))); + Electrical.Machines.NonMultiDomain.Motors.ThreePhase.PSAT.NMD_MotorTypeI + nMD_MotorTypeI( + M_b=5000000, + V_b=13800, + Sup=false, + a=0, + b=0, + c=0.1) + annotation (Placement(transformation(extent={{300,0},{280,20}}))); + Electrical.Machines.ControlsMotors.VariableSpeedDrive.ControllerLogic.VoltsHertzController_MPC + voltsHertzController_MPC( + V_b=13800, + f_max=60, + f_min=0, + m0=0.9537, + Kp=0.5, + Ki=0.2, + rotor_speed_initial=1.9*Modelica.Constants.pi*60) + annotation (Placement(transformation(extent={{230,-40},{248,-20}}))); + Modelica.Blocks.Interfaces.RealInput IN6(start=0) "Connector of Real input signal 2" + annotation (Placement(transformation(extent={{-160,-110},{-140,-90}}), + iconTransformation(extent={{-160,-110},{-140,-90}}))); + Modelica.Blocks.Interfaces.RealOutput OUT1 + annotation (Placement(transformation(extent={{-264,68},{-244,88}}))); + Modelica.Blocks.Interfaces.RealOutput OUT2 + annotation (Placement(transformation(extent={{-264,48},{-244,68}}))); + Modelica.Blocks.Interfaces.RealOutput OUT3 + annotation (Placement(transformation(extent={{-264,28},{-244,48}}))); + Modelica.Blocks.Interfaces.RealOutput OUT4 + annotation (Placement(transformation(extent={{-264,8},{-244,28}}))); + Modelica.Blocks.Interfaces.RealOutput OUT5 + annotation (Placement(transformation(extent={{-264,-12},{-244,8}}))); + Modelica.Blocks.Interfaces.RealOutput OUT6 + annotation (Placement(transformation(extent={{-264,-32},{-244,-12}}))); + Modelica.Blocks.Interfaces.RealOutput OUT7 + annotation (Placement(transformation(extent={{-264,-52},{-244,-32}}))); + Modelica.Blocks.Interfaces.RealOutput OUT8 + annotation (Placement(transformation(extent={{-264,-72},{-244,-52}}))); + Modelica.Blocks.Interfaces.RealOutput OUT9 + annotation (Placement(transformation(extent={{-264,-92},{-244,-72}}))); + Modelica.Blocks.Interfaces.RealOutput OUT10 + annotation (Placement(transformation(extent={{-264,-112},{-244,-92}}))); + Modelica.Blocks.Interfaces.RealOutput OUT11 + annotation (Placement(transformation(extent={{-240,68},{-220,88}}))); + Modelica.Blocks.Interfaces.RealOutput OUT12 + annotation (Placement(transformation(extent={{-240,48},{-220,68}}))); + Modelica.Blocks.Interfaces.RealOutput OUT13 + annotation (Placement(transformation(extent={{-240,28},{-220,48}}))); + Modelica.Blocks.Interfaces.RealOutput OUT14 + annotation (Placement(transformation(extent={{-240,8},{-220,28}}))); + Modelica.Blocks.Interfaces.RealOutput OUT15 + annotation (Placement(transformation(extent={{-240,-12},{-220,8}}))); + Modelica.Blocks.Interfaces.RealOutput OUT16 + annotation (Placement(transformation(extent={{-240,-32},{-220,-12}}))); + Modelica.Blocks.Interfaces.RealOutput OUT17 + annotation (Placement(transformation(extent={{-240,-52},{-220,-32}}))); + Modelica.Blocks.Interfaces.RealOutput OUT18 + annotation (Placement(transformation(extent={{-240,-72},{-220,-52}}))); + Modelica.Blocks.Interfaces.RealOutput OUT19 + annotation (Placement(transformation(extent={{-240,-92},{-220,-72}}))); + Modelica.Blocks.Interfaces.RealOutput OUT20 + annotation (Placement(transformation(extent={{-240,-112},{-220,-92}}))); + Modelica.Blocks.Interfaces.RealOutput OUT21 + annotation (Placement(transformation(extent={{-220,68},{-200,88}}))); + Modelica.Blocks.Interfaces.RealOutput OUT22 + annotation (Placement(transformation(extent={{-220,48},{-200,68}}))); + Modelica.Blocks.Interfaces.RealOutput OUT23 + annotation (Placement(transformation(extent={{-220,28},{-200,48}}))); + Modelica.Blocks.Interfaces.RealOutput OUT24 + annotation (Placement(transformation(extent={{-220,8},{-200,28}}))); + Modelica.Blocks.Interfaces.RealOutput OUT25 + annotation (Placement(transformation(extent={{-220,-12},{-200,8}}))); + Modelica.Blocks.Interfaces.RealOutput OUT26 + annotation (Placement(transformation(extent={{-220,-32},{-200,-12}}))); + Modelica.Blocks.Interfaces.RealOutput OUT27 + annotation (Placement(transformation(extent={{-220,-52},{-200,-32}}))); + Modelica.Blocks.Interfaces.RealOutput OUT28 + annotation (Placement(transformation(extent={{-220,-72},{-200,-52}}))); + Modelica.Blocks.Interfaces.RealOutput OUT29 + annotation (Placement(transformation(extent={{-220,-92},{-200,-72}}))); + Modelica.Blocks.Interfaces.RealOutput OUT30 + annotation (Placement(transformation(extent={{-220,-112},{-200,-92}}))); + Modelica.Blocks.Interfaces.RealOutput OUT31 + annotation (Placement(transformation(extent={{-200,68},{-180,88}}))); + Modelica.Blocks.Math.Add add10 + annotation (Placement(transformation(extent={{186,-52},{194,-44}}))); + Modelica.Blocks.Interfaces.RealInput IN7 + "Connector of Real input signal 1" annotation (Placement( + transformation(extent={{-160,-160},{-140,-140}}), + iconTransformation(extent={{-160,-160},{-140,-140}}))); + Modelica.Blocks.Sources.Constant IN77(k=0) + annotation (Placement(transformation(extent={{142,-158},{162,-138}}))); + Modelica.Blocks.Math.Add3 Add1 + annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + rotation=0, + origin={192,-142}))); + Modelica.Blocks.Sources.Constant Ratio_LTC(k=1) + annotation (Placement(transformation(extent={{142,-170},{162,-190}}))); + Electrical.Buses.Bus Bus13(angle_0=powerFlow.powerflow.bus.A13, v_0= + powerFlow.powerflow.bus.V13) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={208,-82}))); + Electrical.Branches.PwLine L7( + R=0.001, + X=0.01, + G=0, + B=0) annotation (Placement(transformation(extent={{186,-86},{198,-78}}))); + Electrical.Buses.Bus Bus14( + V_b=120, + angle_0=powerFlow.powerflow.bus.A14, + v_0=powerFlow.powerflow.bus.V14) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={252,-82}))); + TCL.ULTC_VoltageControl uLTC_VoltageControl( + Vbus1=13800, + Vbus2(displayUnit="V") = 120, + Vn=13800, + v_0=1, + kT=13800/120, + m0=1, + m_max=1.05, + m_min=0.95, + K=0.01) + annotation (Placement(transformation(extent={{218,-92},{238,-72}}))); + Electrical.Loads.PSSE.Load load(V_b=120, P_0=420000) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=90, + origin={276,-82}))); + Modelica.Blocks.Interfaces.RealOutput OUT32 + annotation (Placement(transformation(extent={{-200,48},{-180,68}}))); + equation + + OUT1 = G2.gen.w; + OUT2 = G2.gen.delta; + OUT3 = G2.gen.Epq; + OUT4 = G2.gen.PSIkd; + OUT5 = G2.gen.PSIppq; + OUT6 = G2.sEXSMPC.simpleLagLim.state; + OUT7 = G2.sEXSMPC.leadLag.TF.x_scaled[1]; + OUT8 = G2.gASTMPC.simpleLagLim.state; + OUT9 = G2.gASTMPC.simpleLag.state; + OUT10 = G2.gASTMPC.simpleLag1.state; + OUT11 = Bus6.v; + + OUT12 =PV.rEGCA1_1.Pgen; + OUT13 =PV.rEGCA1_1.Qgen; + OUT14 =PV.rEGCA1_1.p.ir; + OUT15 =PV.rEGCA1_1.p.ii; + OUT16 = Bus8.v; + + OUT17 =BESS.rEGCA1_1.Pgen; + OUT18 =BESS.rEGCA1_1.Qgen; + OUT19 =BESS.rEGCA1_1.p.ir; + OUT20 =BESS.rEGCA1_1.p.ii; + OUT21 = Bus10.v; + + OUT22 = uLTC_VoltageControl.m; + OUT23 = Bus14.p.vr; + OUT24 = Bus14.p.vi; + + OUT25= aC2DCandDC2AC_MPC.n.ir; + OUT26= aC2DCandDC2AC_MPC.n.ii; + OUT27= aC2DCandDC2AC_MPC.P; + + OUT28= nMD_MotorTypeI.wr; + OUT29= voltsHertzController_MPC.we; + OUT30= Bus12.v; + + OUT31 = Bus5.v; + OUT32 = Bus5.angle; + + connect(T1.p, Bus2.p) + annotation (Line(points={{-51.2,80},{-40,80}}, color={0,0,255})); + connect(Bus1.p, T1.n) + annotation (Line(points={{-80,80},{-68.8,80}}, color={0,0,255})); + connect(G1.conn, Bus1.p) + annotation (Line(points={{-91,80},{-80,80}}, color={0,0,255})); + connect(L1.n, Bus3.p) + annotation (Line(points={{-14.6,80},{0,80}}, color={0,0,255})); + connect(L1.p, Bus2.p) + annotation (Line(points={{-25.4,80},{-40,80}}, color={0,0,255})); + connect(L2_2.n, Bus4.p) annotation (Line(points={{35.4,70},{44,70},{44,80},{60, + 80}}, color={0,0,255})); + connect(L2_1.n, Bus4.p) annotation (Line(points={{35.4,90},{44,90},{44,80},{60, + 80}}, color={0,0,255})); + connect(L2_1.p, Bus3.p) annotation (Line(points={{24.6,90},{16,90},{16,80},{0, + 80}}, color={0,0,255})); + connect(L2_2.p, Bus3.p) annotation (Line(points={{24.6,70},{16,70},{16,80},{0, + 80}}, color={0,0,255})); + connect(Load1.p, Bus3.p) + annotation (Line(points={{-10,68},{-10,80},{0,80}}, color={0,0,255})); + connect(L3.p, Bus4.p) + annotation (Line(points={{80,65.4},{80,80},{60,80}}, color={0,0,255})); + connect(circuitbreaker.s, Bus5.p) + annotation (Line(points={{80,22},{80,16}}, color={0,0,255})); + connect(circuitbreaker.r, L3.n) + annotation (Line(points={{80,30},{80,54.6}}, color={0,0,255})); + connect(IN11.y, AddU1.u2) annotation (Line(points={{-95.4,4},{-82,4}}, + color={0,0,127})); + connect(IN1, AddU1.u1) annotation (Line(points={{-150,10},{-116,10},{-116,16}, + {-82,16}}, + color={0,0,127})); + + connect(IN22.y,AddU2. u2) annotation (Line(points={{-95.4,-26},{-82,-26}}, + color={0,0,127})); + connect(IN2,AddU2. u1) annotation (Line(points={{-150,-12},{-118,-12},{-118,-14}, + {-82,-14}}, + color={0,0,127})); + connect(AddU2.y, G2.Efd_ref) + annotation (Line(points={{-59,-20},{-52,-20},{-52,4},{-42,4}}, + color={0,0,127})); + connect(AddU1.y, G2.P_ref1) annotation (Line(points={{-59,10},{-52,10},{-52,16}, + {-42,16}}, color={0,0,127})); + connect(IB.p, Bus4.p) + annotation (Line(points={{100,80},{60,80}}, color={0,0,255})); + connect(Load2.p, Bus5.p) annotation (Line(points={{110,-10},{110,10},{80,10},{ + 80,16}}, + color={0,0,255})); + connect(T4.n, Bus10.p) + annotation (Line(points={{-1,-90},{-10,-90}}, color={0,0,255})); + connect(Bus6.p, T2.n) + annotation (Line(points={{-10,10},{-1,10}}, + color={0,0,255})); + connect(IN33.y,AddU3. u2) + annotation (Line(points={{-95.4,-56},{-82,-56}}, color={0,0,127})); + connect(BESS.p1, Bus10.p) + annotation (Line(points={{-20,-90},{-10,-90}}, color={0,0,255})); + connect(BESS.Paux1, AddU4.y) annotation (Line(points={{-42,-84},{-54,-84},{-54, + -80},{-59,-80}}, color={0,0,127})); + connect(IN55.y, AddU5.u2) + annotation (Line(points={{-95.4,-112},{-82,-112}}, color={0,0,127})); + connect(AddU5.y, BESS.Qext1) annotation (Line(points={{-59,-106},{-52,-106},{-52, + -96},{-42,-96}}, color={0,0,127})); + connect(IN44.y, AddU4.u2) + annotation (Line(points={{-95.4,-86},{-82,-86}}, color={0,0,127})); + connect(AddU4.u1,IN4) annotation (Line(points={{-82,-74},{-100,-74},{-100,-70}, + {-116,-70},{-116,-56},{-150,-56}}, color={0,0,127})); + connect(AddU5.u1,IN5) annotation (Line(points={{-82,-100},{-116,-100},{-116,-78}, + {-150,-78}}, color={0,0,127})); + connect(G2.conn, Bus6.p) annotation (Line(points={{-19,10},{-10,10}}, + color={0,0,255})); + connect(AddU3.u1, IN3) annotation (Line(points={{-82,-44},{-118,-44},{-118,-34}, + {-150,-34}}, color={0,0,127})); + connect(PV.p1, Bus8.p) + annotation (Line(points={{-20,-50},{-10,-50}}, color={0,0,255})); + connect(Bus8.p, T3.n) + annotation (Line(points={{-10,-50},{1,-50}}, color={0,0,255})); + connect(T2.p, Bus7.p) annotation (Line(points={{21,10},{25.5,10},{25.5,10},{30, + 10}}, color={0,0,255})); + connect(T3.p, Bus9.p) + annotation (Line(points={{23,-50},{30,-50}}, color={0,0,255})); + connect(T4.p, Bus11.p) + annotation (Line(points={{21,-90},{30,-90}}, color={0,0,255})); + connect(L4.n, Bus5.p) annotation (Line(points={{49.4,10},{60,10},{60,10},{80,10}, + {80,16}}, color={0,0,255})); + connect(L5.n, Bus5.p) annotation (Line(points={{49.4,-50},{60,-50},{60,10},{80, + 10},{80,16}}, color={0,0,255})); + connect(Bus11.p, L6.p) + annotation (Line(points={{30,-90},{38.6,-90}}, color={0,0,255})); + connect(Bus9.p, L5.p) + annotation (Line(points={{30,-50},{38.6,-50}}, color={0,0,255})); + connect(L6.n, Bus5.p) annotation (Line(points={{49.4,-90},{60,-90},{60,10},{80, + 10},{80,16}}, color={0,0,255})); + connect(Bus7.p, L4.p) annotation (Line(points={{30,10},{34.3,10},{34.3,10},{38.6, + 10}}, color={0,0,255})); + connect(sine.y, add.u2) annotation (Line(points={{78.5,-31},{78.5,-16.4}, + {83.2,-16.4}}, color={0,0,127})); + connect(whiteNoiseInjection.y, add.u1) annotation (Line(points={{78.54, + -12.06},{80.87,-12.06},{80.87,-11.6},{83.2,-11.6}}, color={0,0, + 127})); + connect(add.y, Load2.u) annotation (Line(points={{92.4,-14},{97.15,-14}, + {97.15,-14.5},{101.9,-14.5}}, color={0,0,127})); + connect(PV.Qref, AddU3.y) annotation (Line(points={{-42,-56},{-54,-56},{-54,-50}, + {-59,-50}}, color={0,0,127})); + connect(L2.n,Bus12. p) + annotation (Line(points={{193.4,10},{200,10}}, color={0,0,255})); + connect(L2.p, Bus5.p) + annotation (Line(points={{182.6,10},{80,10},{80,16}}, color={0,0,255})); + connect(Bus12.p, aC2DCandDC2AC_MPC.p) + annotation (Line(points={{200,10},{220,10}}, color={0,0,255})); + connect(aC2DCandDC2AC_MPC.n, nMD_MotorTypeI.p) + annotation (Line(points={{260,10},{280,10}}, color={0,0,255})); + connect(voltsHertzController_MPC.m, aC2DCandDC2AC_MPC.m_input) + annotation (Line(points={{244.6,-18},{244.6,-10},{249.091,-10},{ + 249.091,-2}}, color={0,0,127})); + connect(voltsHertzController_MPC.Vc, aC2DCandDC2AC_MPC.Vc) annotation ( + Line(points={{235.4,-18},{235.4,-10},{230.909,-10},{230.909,-2}}, + color={0,0,127})); + connect(nMD_MotorTypeI.wr, voltsHertzController_MPC.motor_speed) + annotation (Line(points={{284,-2},{284,-26},{252,-26}}, color={0,0,127})); + connect(nMD_MotorTypeI.we, voltsHertzController_MPC.we) + annotation (Line(points={{296,-2},{296,-34},{252,-34}}, color={0,0,127})); + connect(IN66.y, add10.u2) annotation (Line(points={{161,-50},{164,-50.4},{185.2, + -50.4}}, color={0,0,127})); + connect(IN6, add10.u1) annotation (Line(points={{-150,-100},{-120,-100},{-120, + -132},{132,-132},{132,-24},{185.2,-24},{185.2,-45.6}}, color={0,0,127})); + connect(add10.y, voltsHertzController_MPC.W_ref) annotation (Line(points={{194.4, + -48},{208,-48},{208,-30},{228,-30}}, color={0,0,127})); + connect(IN77.y,Add1. u2) + annotation (Line(points={{163,-148},{172,-148},{172,-142},{180,-142}}, + color={0,0,127})); + connect(Add1.u1, IN7) annotation (Line(points={{180,-134},{168,-134},{168,-132}, + {134,-132},{134,-150},{-150,-150}}, color={0,0,127})); + connect(Ratio_LTC.y,Add1. u3) annotation (Line(points={{163,-180},{180,-180},{ + 180,-150}}, color={0,0,127})); + connect(L7.n,Bus13. p) + annotation (Line(points={{197.4,-82},{208,-82}}, color={0,0,255})); + connect(L7.p, Bus5.p) annotation (Line(points={{186.6,-82},{128,-82},{128,10}, + {80,10},{80,16}}, + color={0,0,255})); + connect(Bus13.p,uLTC_VoltageControl. p) + annotation (Line(points={{208,-82},{217,-82}}, color={0,0,255})); + connect(uLTC_VoltageControl.n,Bus14. p) + annotation (Line(points={{239,-82},{252,-82}}, color={0,0,255})); + connect(Add1.y, uLTC_VoltageControl.v_ref) annotation (Line(points={{203,-142}, + {228,-142},{228,-94}}, color={0,0,127})); + connect(load.p, Bus14.p) + annotation (Line(points={{266,-82},{252,-82}}, color={0,0,255})); + annotation(Diagram(coordinateSystem(preserveAspectRatio=false, + extent={{-140,-200},{340,140}}), graphics={ + Rectangle( + extent={{-160,30},{-132,-168}}, + lineColor={0,140,72}, + lineThickness=0.5), + Rectangle( + extent={{-128,36},{124,-124}}, + lineColor={238,46,47}, + lineThickness=0.5), + Rectangle( + extent={{-128,98},{124,38}}, + lineColor={0,128,255}, + lineThickness=0.5), + Text( + extent={{78,-106},{114,-120}}, + textColor={238,46,47}, + textString="Microgrid"), + Text( + extent={{76,58},{128,34}}, + textColor={28,108,200}, + textString="Utility Grid"), + Text( + extent={{-30,-102},{34,-124}}, + textColor={0,140,72}, + textString="Linearization Unit"), + Text( + extent={{-164,50},{-132,30}}, + textColor={0,140,72}, + textString="Inputs")}), + Documentation(info=" +

This example system shows how the preparation for resynchronization of Generator 2 to the grid. Note that at 2 seconds, a signal is triggered so voltages between buses 3 and 4 should be equal.

+

Simulate the system for 10 seconds. Variables of interest are:

+ +

Note the behavior of those variables before and after the connection of generator G2 to the main grid.

+"),experiment( + StopTime=10, + __Dymola_NumberOfIntervals=1000, + __Dymola_Algorithm="Dassl"), + Icon(coordinateSystem(extent={{-140,-200},{340,140}}))); + end MPC_LTC_VSD_Linearized3; + + model MPC_LTC_VSD_Original3 + "THIS ONE IS STABLE, CONTROLLABLE, OBSERVABLE!!!!!!!" + extends Modelica.Icons.Example; + + parameter Boolean equivalentGRID = false; + parameter Boolean equivalentsystem = false; + parameter Real set = 0; + + OpenIPSL.Electrical.Buses.Bus Bus1(v_0=powerFlow.powerflow.bus.V1, angle_0= + powerFlow.powerflow.bus.A1) if not equivalentGRID + annotation (Placement(transformation(extent={{-90,70},{-70,90}}))); + OpenIPSL.Electrical.Buses.Bus Bus2(v_0=powerFlow.powerflow.bus.V2, angle_0= + powerFlow.powerflow.bus.A1) if not equivalentGRID + annotation (Placement(transformation(extent={{-50,70},{-30,90}}))); + OpenIPSL.Electrical.Branches.PSSE.TwoWindingTransformer T1( + R=0.001, + X=0.2, + G=0, + B=0, + VNOM1=13800, + VB1=13800, + VNOM2=6000, + VB2=6000) if not equivalentGRID annotation (Placement(transformation( + extent={{-8,-8},{8,8}}, + rotation=180, + origin={-60,80}))); + OpenIPSL.Examples.OpenCPS.Generators.G1 G1( + enableV_b=true, + v_0=powerFlow.powerflow.bus.V1, + angle_0=powerFlow.powerflow.bus.A1, + P_0=powerFlow.powerflow.machines.PG1, + Q_0=powerFlow.powerflow.machines.QG1, + V_b=6000) if not equivalentGRID + annotation (Placement(transformation(extent={{-112,70},{-92,90}}))); + OpenIPSL.Electrical.Branches.PwLine L1( + R=0.001, + X=0.2, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{-26,76}, + {-14,84}}))); + OpenIPSL.Electrical.Buses.Bus Bus3(v_0=powerFlow.powerflow.bus.V3, angle_0= + powerFlow.powerflow.bus.A3) if not equivalentGRID + annotation (Placement(transformation(extent={{-10,70},{10,90}}))); + OpenIPSL.Electrical.Buses.Bus Bus4(v_0=powerFlow.powerflow.bus.V4, angle_0= + powerFlow.powerflow.bus.V4) if not equivalentGRID + annotation (Placement(transformation(extent={{50,70},{70,90}}))); + OpenIPSL.Electrical.Branches.PwLine L2_1( + R=0.0005, + X=0.1, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{24,86}, + {36,94}}))); + OpenIPSL.Electrical.Branches.PwLine L2_2( + R=0.0005, + X=0.1, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{24,66}, + {36,74}}))); + OpenIPSL.Electrical.Buses.Bus Bus5(angle_0=powerFlow.powerflow.bus.A5, v_0= + powerFlow.powerflow.bus.V5) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=90, + origin={80,16}))); + OpenIPSL.Electrical.Branches.PwLine L3( + R=0.001, + X=0.2, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation( + extent={{-6,-4},{6,4}}, + rotation=-90, + origin={80,60}))); + OpenIPSL.Electrical.Buses.Bus Bus6(v_0=powerFlow.powerflow.bus.V6, angle_0= + powerFlow.powerflow.bus.A6) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,10}))); + OpenIPSL.Electrical.Branches.PSSE.TwoWindingTransformer T2( + G=0, + B=0, + VNOM1=13800, + VB1=13800, + VNOM2=6000, + VB2=6000, + R=0.005, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={10,10}))); + GenerationUnits.PSSE.G2_16MVA G2( + enableV_b=true, + enableP_0=true, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V6, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A6, + V_b=6000, + P_0=powerFlow.powerflow.machines.PG2, + Q_0=powerFlow.powerflow.machines.QG2, + enableangle_0=true) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-30,10}))); + inner OpenIPSL.Electrical.SystemBase SysData(S_b=100000000, fn=60) + annotation (Placement(transformation(extent={{-128,104},{-74,124}}))); + OpenIPSL.Electrical.Loads.PSSE.Load Load1( + V_b=220000, + P_0=powerFlow.powerflow.loads.PL1, + Q_0=powerFlow.powerflow.loads.QL1, + v_0=powerFlow.powerflow.bus.V3, + angle_0=powerFlow.powerflow.bus.A3) if not equivalentGRID + annotation (Placement(transformation(extent={{-20,48},{0,68}}))); + Electrical.Events.Breaker circuitbreaker( + enableTrigger=false, + t_o=0.25, + rc_enabled=true, + t_rc=1000) if not equivalentGRID annotation (Placement(transformation( + extent={{-4,-4},{4,4}}, + rotation=90, + origin={80,26}))); + + Modelica.Blocks.Interfaces.RealInput IN1(start=0) + "Connector of Real input signal 2" annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-150,10}),iconTransformation(extent={{-10,-10},{10,10}}, origin={-150,10}))); + Modelica.Blocks.Sources.Constant IN11(k=0) + annotation (Placement(transformation(extent={{-108,-2},{-96,10}}))); + Modelica.Blocks.Math.Add AddU1 + annotation (Placement(transformation(extent={{-80,0},{-60,20}}))); + Modelica.Blocks.Sources.Constant IN22(k=0) + annotation (Placement(transformation(extent={{-108,-32},{-96,-20}}))); + Modelica.Blocks.Math.Add AddU2 + annotation (Placement(transformation(extent={{-80,-30},{-60,-10}}))); + Modelica.Blocks.Interfaces.RealInput IN2(start=0) + "Connector of Real input signal 2" + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-150,-12}), iconTransformation(extent={{-10,-10},{10,10}}, + origin={-150,-12}))); + Modelica.Blocks.Interfaces.RealInput IN3 "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-44},{-140,-24}}), + iconTransformation(extent={{-160,-44},{-140,-24}}))); + Modelica.Blocks.Interfaces.RealInput IN4(start = 0) "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-66},{-140,-46}}), + iconTransformation(extent={{-160,-66},{-140,-46}}))); + Modelica.Blocks.Interfaces.RealInput IN5(start = 0) "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-88},{-140,-68}}), + iconTransformation(extent={{-160,-88},{-140,-68}}))); + + PFData.PowerFlow powerFlow(redeclare record PowerFlow = + OpenIPSL.Examples.ModelPredictiveControl.PFData.PFVSD_TCL) + annotation (Placement(transformation(extent={{-68,104},{-48,124}}))); + Electrical.Machines.PSSE.GENCLS IB( + V_b=220000, + v_0=powerFlow.powerflow.bus.V4, + angle_0=powerFlow.powerflow.bus.A4, + P_0=powerFlow.powerflow.machines.Pinf, + Q_0=powerFlow.powerflow.machines.Qinf, + M_b=100000000, + X_d=1) if not equivalentGRID annotation (Placement(transformation(extent={{110,70}, + {100,90}}))); + Electrical.Loads.PSSE.Load_ExtInput Load2( + P_0=powerFlow.powerflow.loads.PL2, + Q_0=powerFlow.powerflow.loads.QL2, + v_0=powerFlow.powerflow.bus.V5, + angle_0=powerFlow.powerflow.bus.A5, + d_P=0, + t1=100, + d_t=1000) + annotation (Placement(transformation(extent={{100,-30},{120,-10}}))); + + inner Modelica.Blocks.Noise.GlobalSeed globalSeed( + enableNoise=true, + useAutomaticSeed=false, + fixedSeed=10000) + annotation (Placement(transformation(extent={{-44,102},{-24,122}}))); + Modelica.Blocks.Sources.Sine sine( + amplitude=0.01, + f=1/260, + phase=3.1415926535898, + startTime=1000) + annotation (Placement(transformation(extent={{70,-36},{80,-26}}))); + + Electrical.Buses.Bus Bus10(v_0=powerFlow.powerflow.bus.V10, angle_0=powerFlow.powerflow.bus.A10) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,-90}))); + Electrical.Branches.PSSE.TwoWindingTransformer T4( + G=0, + B=0, + CW=1, + VNOM1=13800, + VB1=13800, + VNOM2=480, + VB2=480, + R=0.001, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={10,-90}))); + GenerationUnits.PSSE.Solar_Units.SolarMPCLocalVQControl_ADD_ON + PV( + V_b=480, + P_0=powerFlow.powerflow.machines.PPV, + enableP_0=true, + Q_0=powerFlow.powerflow.machines.QPV, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V8, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A8, + enableangle_0=true) + annotation (Placement(transformation(extent={{-40,-60},{-20,-40}}))); + Modelica.Blocks.Math.Add AddU3 + annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}))); + Modelica.Blocks.Sources.Constant IN33(k=0) + annotation (Placement(transformation(extent={{-108,-62},{-96,-50}}))); + + Modelica.Blocks.Math.Add AddU4 + annotation (Placement(transformation(extent={{-80,-90},{-60,-70}}))); + Modelica.Blocks.Math.Add AddU5 + annotation (Placement(transformation(extent={{-80,-116},{-60,-96}}))); + Modelica.Blocks.Sources.Constant IN44(k=0) + annotation (Placement(transformation(extent={{-108,-92},{-96,-80}}))); + Modelica.Blocks.Sources.Constant IN55(k=0) + annotation (Placement(transformation(extent={{-108,-118},{-96,-106}}))); + GenerationUnits.PSSE.Battery_Units.BESSMPCLocalVQControl BESS( + V_base=480, + V_b(displayUnit="kV") = 480, + enableV_b=true, + P_0=powerFlow.powerflow.machines.PBESS, + enableP_0=true, + Q_0=powerFlow.powerflow.machines.QBESS, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V10, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A10, + enableangle_0=true) + annotation (Placement(transformation(extent={{-40,-100},{-20,-80}}))); + Electrical.Buses.Bus Bus8(v_0=powerFlow.powerflow.bus.V8, angle_0=powerFlow.powerflow.bus.A8) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,-50}))); + Electrical.Branches.PSSE.TwoWindingTransformer T3( + G=0, + B=0, + CW=1, + VNOM1=13800, + VB1=13800, + VNOM2=480, + VB2=480, + R=0.001, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={12,-50}))); + Electrical.Buses.Bus Bus11(v_0=powerFlow.powerflow.bus.V11, angle_0=powerFlow.powerflow.bus.A11) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,-90}))); + Electrical.Buses.Bus Bus9(v_0=powerFlow.powerflow.bus.V9, angle_0=powerFlow.powerflow.bus.A9) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,-50}))); + Electrical.Buses.Bus Bus7(v_0=powerFlow.powerflow.bus.V7, angle_0=powerFlow.powerflow.bus.A7) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,10}))); + Electrical.Branches.PwLine L4( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,6},{ + 50,14}}))); + Electrical.Branches.PwLine L5( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,-54}, + {50,-46}}))); + Electrical.Branches.PwLine L6( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,-94}, + {50,-86}}))); + Electrical.Renewables.PSSE.AddOnBlocks.IrradianceToPower + irradianceToPower( + Ypv(displayUnit="MW") = 3000000, + Sb(displayUnit="MV.A") = 100000000, + Tcstc(displayUnit="K") = 298.15, + fpv=1, + ap=-0.48, + Gtstc=1000) + annotation (Placement(transformation(extent={{44,-20},{34,-10}}))); + Modelica.Blocks.Interfaces.RealInput IN6 "Connector of Real input signal 2" + annotation (Placement(transformation(extent={{-160,-108},{-140,-88}}), + iconTransformation(extent={{-160,-108},{-140,-88}}))); + Modelica.Blocks.Sources.Constant IN66(k=0) + annotation (Placement(transformation(extent={{140,-60},{160,-40}}))); + Electrical.Branches.PwLine L2( + R=0.001, + X=0.01, + G=0, + B=0) annotation (Placement(transformation(extent={{182,6},{194,14}}))); + Electrical.Buses.Bus Bus12(angle_0=powerFlow.powerflow.bus.A5, v_0= + powerFlow.powerflow.bus.V5) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={200,10}))); + Electrical.Machines.ControlsMotors.VariableSpeedDrive.PowerElectronics.AC2DCandDC2AC_MPC + aC2DCandDC2AC_MPC( + V_b=13800, + v_0=powerFlow.powerflow.bus.V5, + angle_0=powerFlow.powerflow.bus.A5, + Rdc=0.1, + Cdc=0.00001, + m0=0.9537) + annotation (Placement(transformation(extent={{220,0},{260,20}}))); + Electrical.Machines.NonMultiDomain.Motors.ThreePhase.PSAT.NMD_MotorTypeI + nMD_MotorTypeI( + M_b=5000000, + V_b=13800, + Sup=false, + a=0, + b=0, + c=0.1) + annotation (Placement(transformation(extent={{300,0},{280,20}}))); + Electrical.Machines.ControlsMotors.VariableSpeedDrive.ControllerLogic.VoltsHertzController_MPC + voltsHertzController_MPC( + V_b=13800, + f_max=60, + f_min=0, + m0=0.9537, + Kp=0.5, + Ki=0.2, + rotor_speed_initial=1.9*Modelica.Constants.pi*60) + annotation (Placement(transformation(extent={{230,-40},{248,-20}}))); + Modelica.Blocks.Interfaces.RealOutput OUT1 + annotation (Placement(transformation(extent={{-284,80},{-264,100}}))); + Modelica.Blocks.Interfaces.RealOutput OUT2 + annotation (Placement(transformation(extent={{-284,60},{-264,80}}))); + Modelica.Blocks.Interfaces.RealOutput OUT3 + annotation (Placement(transformation(extent={{-284,40},{-264,60}}))); + Modelica.Blocks.Interfaces.RealOutput OUT4 + annotation (Placement(transformation(extent={{-284,20},{-264,40}}))); + Modelica.Blocks.Interfaces.RealOutput OUT5 + annotation (Placement(transformation(extent={{-284,0},{-264,20}}))); + Modelica.Blocks.Interfaces.RealOutput OUT6 + annotation (Placement(transformation(extent={{-284,-20},{-264,0}}))); + Modelica.Blocks.Interfaces.RealOutput OUT7 + annotation (Placement(transformation(extent={{-284,-40},{-264,-20}}))); + Modelica.Blocks.Interfaces.RealOutput OUT8 + annotation (Placement(transformation(extent={{-284,-60},{-264,-40}}))); + Modelica.Blocks.Interfaces.RealOutput OUT9 + annotation (Placement(transformation(extent={{-284,-80},{-264,-60}}))); + Modelica.Blocks.Interfaces.RealOutput OUT10 + annotation (Placement(transformation(extent={{-284,-100},{-264,-80}}))); + Modelica.Blocks.Interfaces.RealOutput OUT11 + annotation (Placement(transformation(extent={{-260,80},{-240,100}}))); + Modelica.Blocks.Interfaces.RealOutput OUT12 + annotation (Placement(transformation(extent={{-260,60},{-240,80}}))); + Modelica.Blocks.Interfaces.RealOutput OUT13 + annotation (Placement(transformation(extent={{-260,40},{-240,60}}))); + Modelica.Blocks.Interfaces.RealOutput OUT14 + annotation (Placement(transformation(extent={{-260,20},{-240,40}}))); + Modelica.Blocks.Interfaces.RealOutput OUT15 + annotation (Placement(transformation(extent={{-260,0},{-240,20}}))); + Modelica.Blocks.Interfaces.RealOutput OUT16 + annotation (Placement(transformation(extent={{-260,-20},{-240,0}}))); + Modelica.Blocks.Interfaces.RealOutput OUT17 + annotation (Placement(transformation(extent={{-260,-40},{-240,-20}}))); + Modelica.Blocks.Interfaces.RealOutput OUT18 + annotation (Placement(transformation(extent={{-260,-60},{-240,-40}}))); + Modelica.Blocks.Interfaces.RealOutput OUT19 + annotation (Placement(transformation(extent={{-260,-80},{-240,-60}}))); + Modelica.Blocks.Interfaces.RealOutput OUT20 + annotation (Placement(transformation(extent={{-260,-100},{-240,-80}}))); + Modelica.Blocks.Interfaces.RealOutput OUT21 + annotation (Placement(transformation(extent={{-240,80},{-220,100}}))); + Modelica.Blocks.Interfaces.RealOutput OUT22 + annotation (Placement(transformation(extent={{-240,60},{-220,80}}))); + Modelica.Blocks.Interfaces.RealOutput OUT23 + annotation (Placement(transformation(extent={{-240,40},{-220,60}}))); + Modelica.Blocks.Interfaces.RealOutput OUT24 + annotation (Placement(transformation(extent={{-240,20},{-220,40}}))); + Modelica.Blocks.Interfaces.RealOutput OUT25 + annotation (Placement(transformation(extent={{-240,0},{-220,20}}))); + Modelica.Blocks.Interfaces.RealOutput OUT26 + annotation (Placement(transformation(extent={{-240,-20},{-220,0}}))); + Modelica.Blocks.Interfaces.RealOutput OUT27 + annotation (Placement(transformation(extent={{-240,-40},{-220,-20}}))); + Modelica.Blocks.Interfaces.RealOutput OUT28 + annotation (Placement(transformation(extent={{-240,-60},{-220,-40}}))); + Modelica.Blocks.Interfaces.RealOutput OUT29 + annotation (Placement(transformation(extent={{-240,-80},{-220,-60}}))); + Modelica.Blocks.Interfaces.RealOutput OUT30 + annotation (Placement(transformation(extent={{-240,-100},{-220,-80}}))); + Modelica.Blocks.Interfaces.RealOutput OUT31 + annotation (Placement(transformation(extent={{-220,80},{-200,100}}))); + Modelica.Blocks.Math.Add Add10 + annotation (Placement(transformation(extent={{192,-40},{212,-20}}))); + Modelica.Blocks.Interfaces.RealInput IN7 + "Connector of Real input signal 1" annotation (Placement( + transformation(extent={{-158,-152},{-138,-132}}), + iconTransformation(extent={{-160,-160},{-140,-140}}))); + Modelica.Blocks.Sources.Constant IN77(k=0) + annotation (Placement(transformation(extent={{130,-162},{150,-142}}))); + Modelica.Blocks.Math.Add3 Add1 + annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + rotation=0, + origin={180,-146}))); + Modelica.Blocks.Sources.Constant Ratio_LTC(k=1) + annotation (Placement(transformation(extent={{130,-174},{150,-194}}))); + Electrical.Buses.Bus Bus13(angle_0=powerFlow.powerflow.bus.A13, + v_0=powerFlow.powerflow.bus.V13) + annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={196,-86}))); + Electrical.Branches.PwLine L7( + R=0.001, + X=0.01, + G=0, + B=0) annotation (Placement(transformation(extent={{174,-90},{186,-82}}))); + Electrical.Buses.Bus Bus14( + V_b=120, + angle_0=powerFlow.powerflow.bus.A14, + v_0=powerFlow.powerflow.bus.V14) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={240,-86}))); + TCL.ULTC_VoltageControl uLTC_VoltageControl( + Vbus1=13800, + Vbus2(displayUnit="V") = 120, + Vn=13800, + v_0=1, + kT=13800/120, + m0=1, + m_max=1.05, + m_min=0.95, + K=0.01) + annotation (Placement(transformation(extent={{206,-96},{226,-76}}))); + Modelica.Blocks.Interfaces.RealOutput OUT32 + annotation (Placement(transformation(extent={{-220,60},{-200,80}}))); + Modelica.Blocks.Sources.Step Load_Dip(height=-0.01, startTime=3) + annotation (Placement(transformation(extent={{70,-70},{80,-60}}))); + Modelica.Blocks.Math.Add Add2 + annotation (Placement(transformation(extent={{94,-64},{104,-54}}))); + Modelica.Blocks.Sources.Constant const(k=0) + annotation (Placement(transformation(extent={{308,-72},{300,-64}}))); + TCL.TCL_Building_no_noise tCL_Building_no_noise(TCL_b=4000) + annotation (Placement(transformation(extent={{260,-96},{280,-76}}))); + Modelica.Blocks.Sources.Constant const1(k=0) + annotation (Placement(transformation(extent={{308,-84},{300,-76}}))); + Modelica.Blocks.Sources.Constant const2(k=0) + annotation (Placement(transformation(extent={{308,-96},{300,-88}}))); + Modelica.Blocks.Sources.Constant const3(k=0) + annotation (Placement(transformation(extent={{308,-108},{300,-100}}))); + equation + + OUT1 = G2.gen.w; + OUT2 = G2.gen.delta; + OUT3 = G2.gen.Epq; + OUT4 = G2.gen.PSIkd; + OUT5 = G2.gen.PSIppq; + OUT6 = G2.sEXSMPC.simpleLagLim.state; + OUT7 = G2.sEXSMPC.leadLag.TF.x_scaled[1]; + OUT8 = G2.gASTMPC.simpleLagLim.state; + OUT9 = G2.gASTMPC.simpleLag.state; + OUT10 = G2.gASTMPC.simpleLag1.state; + OUT11 = Bus6.v; + + OUT12 =PV.rEGCA1_1.Pgen; + OUT13 =PV.rEGCA1_1.Qgen; + OUT14 =PV.rEGCA1_1.p.ir; + OUT15 =PV.rEGCA1_1.p.ii; + OUT16 = Bus8.v; + + OUT17 =BESS.rEGCA1_1.Pgen; + OUT18 =BESS.rEGCA1_1.Qgen; + OUT19 =BESS.rEGCA1_1.p.ir; + OUT20 =BESS.rEGCA1_1.p.ii; + OUT21 = Bus10.v; + + OUT22 = uLTC_VoltageControl.m; + OUT23 = Bus14.p.vr; + OUT24 = Bus14.p.vi; + + OUT25= aC2DCandDC2AC_MPC.n.ir; + OUT26= aC2DCandDC2AC_MPC.n.ii; + OUT27= aC2DCandDC2AC_MPC.P; + + OUT28= nMD_MotorTypeI.wr; + OUT29= voltsHertzController_MPC.we; + OUT30= Bus12.v; + + OUT31 = Bus5.v; + OUT32 = Bus5.angle; + + connect(T1.p, Bus2.p) + annotation (Line(points={{-51.2,80},{-40,80}}, color={0,0,255})); + connect(Bus1.p, T1.n) + annotation (Line(points={{-80,80},{-68.8,80}}, color={0,0,255})); + connect(G1.conn, Bus1.p) + annotation (Line(points={{-91,80},{-80,80}}, color={0,0,255})); + connect(L1.n, Bus3.p) + annotation (Line(points={{-14.6,80},{0,80}}, color={0,0,255})); + connect(L1.p, Bus2.p) + annotation (Line(points={{-25.4,80},{-40,80}}, color={0,0,255})); + connect(L2_2.n, Bus4.p) annotation (Line(points={{35.4,70},{44,70},{44,80},{60, + 80}}, color={0,0,255})); + connect(L2_1.n, Bus4.p) annotation (Line(points={{35.4,90},{44,90},{44,80},{60, + 80}}, color={0,0,255})); + connect(L2_1.p, Bus3.p) annotation (Line(points={{24.6,90},{16,90},{16,80},{0, + 80}}, color={0,0,255})); + connect(L2_2.p, Bus3.p) annotation (Line(points={{24.6,70},{16,70},{16,80},{0, + 80}}, color={0,0,255})); + connect(Load1.p, Bus3.p) + annotation (Line(points={{-10,68},{-10,80},{0,80}}, color={0,0,255})); + connect(L3.p, Bus4.p) + annotation (Line(points={{80,65.4},{80,80},{60,80}}, color={0,0,255})); + connect(circuitbreaker.s, Bus5.p) + annotation (Line(points={{80,22},{80,16}}, color={0,0,255})); + connect(circuitbreaker.r, L3.n) + annotation (Line(points={{80,30},{80,54.6}}, color={0,0,255})); + connect(IN11.y, AddU1.u2) annotation (Line(points={{-95.4,4},{-82,4}}, + color={0,0,127})); + connect(IN1, AddU1.u1) annotation (Line(points={{-150,10},{-116,10},{-116,16}, + {-82,16}}, + color={0,0,127})); + + connect(IN22.y,AddU2. u2) annotation (Line(points={{-95.4,-26},{-82,-26}}, + color={0,0,127})); + connect(IN2,AddU2. u1) annotation (Line(points={{-150,-12},{-118,-12},{-118,-14}, + {-82,-14}}, + color={0,0,127})); + connect(AddU2.y, G2.Efd_ref) + annotation (Line(points={{-59,-20},{-52,-20},{-52,4},{-42,4}}, + color={0,0,127})); + connect(AddU1.y, G2.P_ref1) annotation (Line(points={{-59,10},{-52,10},{-52,16}, + {-42,16}}, color={0,0,127})); + connect(IB.p, Bus4.p) + annotation (Line(points={{100,80},{60,80}}, color={0,0,255})); + connect(Load2.p, Bus5.p) annotation (Line(points={{110,-10},{110,10},{80,10},{ + 80,16}}, + color={0,0,255})); + connect(T4.n, Bus10.p) + annotation (Line(points={{-1,-90},{-10,-90}}, color={0,0,255})); + connect(Bus6.p, T2.n) + annotation (Line(points={{-10,10},{-1,10}}, + color={0,0,255})); + connect(AddU3.y, PV.QINPUT) annotation (Line(points={{-59,-50},{-42,-50}}, + color={0,0,127})); + connect(IN33.y,AddU3. u2) + annotation (Line(points={{-95.4,-56},{-82,-56}}, color={0,0,127})); + connect(BESS.p1, Bus10.p) + annotation (Line(points={{-20,-90},{-10,-90}}, color={0,0,255})); + connect(BESS.Paux1, AddU4.y) annotation (Line(points={{-42,-84},{-54,-84},{-54, + -80},{-59,-80}}, color={0,0,127})); + connect(IN55.y, AddU5.u2) + annotation (Line(points={{-95.4,-112},{-82,-112}}, color={0,0,127})); + connect(AddU5.y, BESS.Qext1) annotation (Line(points={{-59,-106},{-52,-106},{-52, + -96},{-42,-96}}, color={0,0,127})); + connect(IN44.y, AddU4.u2) + annotation (Line(points={{-95.4,-86},{-82,-86}}, color={0,0,127})); + connect(AddU4.u1,IN4) annotation (Line(points={{-82,-74},{-100,-74},{-100,-70}, + {-116,-70},{-116,-56},{-150,-56}}, color={0,0,127})); + connect(AddU5.u1,IN5) annotation (Line(points={{-82,-100},{-116,-100},{-116,-78}, + {-150,-78}}, color={0,0,127})); + connect(G2.conn, Bus6.p) annotation (Line(points={{-19,10},{-10,10}}, + color={0,0,255})); + connect(AddU3.u1, IN3) annotation (Line(points={{-82,-44},{-118,-44},{-118,-34}, + {-150,-34}}, color={0,0,127})); + connect(PV.p1, Bus8.p) + annotation (Line(points={{-20,-50},{-10,-50}}, color={0,0,255})); + connect(Bus8.p, T3.n) + annotation (Line(points={{-10,-50},{1,-50}}, color={0,0,255})); + connect(T2.p, Bus7.p) annotation (Line(points={{21,10},{25.5,10},{25.5,10},{30, + 10}}, color={0,0,255})); + connect(T3.p, Bus9.p) + annotation (Line(points={{23,-50},{30,-50}}, color={0,0,255})); + connect(T4.p, Bus11.p) + annotation (Line(points={{21,-90},{30,-90}}, color={0,0,255})); + connect(L4.n, Bus5.p) annotation (Line(points={{49.4,10},{60,10},{60,10},{80,10}, + {80,16}}, color={0,0,255})); + connect(L5.n, Bus5.p) annotation (Line(points={{49.4,-50},{60,-50},{60,10},{80, + 10},{80,16}}, color={0,0,255})); + connect(Bus11.p, L6.p) + annotation (Line(points={{30,-90},{38.6,-90}}, color={0,0,255})); + connect(Bus9.p, L5.p) + annotation (Line(points={{30,-50},{38.6,-50}}, color={0,0,255})); + connect(L6.n, Bus5.p) annotation (Line(points={{49.4,-90},{60,-90},{60,10},{80, + 10},{80,16}}, color={0,0,255})); + connect(Bus7.p, L4.p) annotation (Line(points={{30,10},{34.3,10},{34.3,10},{38.6, + 10}}, color={0,0,255})); + connect(L2.n, Bus12.p) + annotation (Line(points={{193.4,10},{200,10}}, color={0,0,255})); + connect(L2.p, Bus5.p) + annotation (Line(points={{182.6,10},{80,10},{80,16}}, color={0,0,255})); + connect(Bus12.p, aC2DCandDC2AC_MPC.p) annotation (Line(points={{200,10}, + {220,10}}, color={0,0,255})); + connect(aC2DCandDC2AC_MPC.n, nMD_MotorTypeI.p) annotation (Line(points={{260,10}, + {280,10}}, color={0,0,255})); + connect(voltsHertzController_MPC.m, aC2DCandDC2AC_MPC.m_input) + annotation (Line(points={{244.6,-18},{244.6,-10},{249.091,-10},{ + 249.091,-2}},color={0,0,127})); + connect(voltsHertzController_MPC.Vc, aC2DCandDC2AC_MPC.Vc) annotation ( + Line(points={{235.4,-18},{235.4,-10},{230.909,-10},{230.909,-2}}, + color={0,0,127})); + connect(nMD_MotorTypeI.wr, voltsHertzController_MPC.motor_speed) + annotation (Line(points={{284,-2},{284,-26},{252,-26}}, color={0,0,127})); + connect(nMD_MotorTypeI.we, voltsHertzController_MPC.we) + annotation (Line(points={{296,-2},{296,-34},{252,-34}}, color={0,0,127})); + connect(irradianceToPower.Ppv, PV.IRR2POW) annotation (Line(points={{ + 33.5,-15},{-42,-15},{-42,-43}}, color={0,0,127})); + connect(IN66.y, Add10.u2) annotation (Line(points={{161,-50},{180,-50},{180,-36}, + {190,-36}}, color={0,0,127})); + connect(Add10.y, voltsHertzController_MPC.W_ref) + annotation (Line(points={{213,-30},{228,-30}}, color={0,0,127})); + connect(Add10.u1, IN6) annotation (Line(points={{190,-24},{126,-24},{126,-122}, + {-150,-122},{-150,-98}}, color={0,0,127})); + connect(IN77.y,Add1. u2) + annotation (Line(points={{151,-152},{160,-152},{160,-146},{168,-146}}, + color={0,0,127})); + connect(Add1.u1, IN7) annotation (Line(points={{168,-138},{156,-138},{ + 156,-136},{-132,-136},{-132,-142},{-148,-142}}, + color={0,0,127})); + connect(Ratio_LTC.y,Add1. u3) annotation (Line(points={{151,-184},{168, + -184},{168,-154}}, + color={0,0,127})); + connect(L7.n,Bus13. p) + annotation (Line(points={{185.4,-86},{196,-86}}, color={0,0,255})); + connect(L7.p, Bus5.p) annotation (Line(points={{174.6,-86},{64,-86},{64, + 0},{96,0},{96,10},{80,10},{80,16}}, + color={0,0,255})); + connect(Bus13.p,uLTC_VoltageControl. p) + annotation (Line(points={{196,-86},{205,-86}}, color={0,0,255})); + connect(uLTC_VoltageControl.n,Bus14. p) + annotation (Line(points={{227,-86},{240,-86}}, color={0,0,255})); + connect(Add1.y,uLTC_VoltageControl. v_ref) annotation (Line(points={{191, + -146},{216,-146},{216,-98}}, + color={0,0,127})); + connect(Load_Dip.y, Add2.u2) annotation (Line(points={{80.5,-65},{86,-65},{86, + -62},{93,-62}}, color={0,0,127})); + connect(sine.y, Add2.u1) annotation (Line(points={{80.5,-31},{80.5,-32},{88, + -32},{88,-56},{93,-56}}, color={0,0,127})); + connect(Add2.y, Load2.u) annotation (Line(points={{104.5,-59},{112,-59},{112, + -42},{92,-42},{92,-14.5},{101.9,-14.5}}, color={0,0,127})); + connect(Bus14.p, tCL_Building_no_noise.pwPin) + annotation (Line(points={{240,-86},{260,-86}}, color={0,0,255})); + connect(const3.y, tCL_Building_no_noise.u4) annotation (Line(points={{299.6, + -104},{288,-104},{288,-95},{281,-95}}, color={0,0,127})); + connect(const2.y, tCL_Building_no_noise.u3) annotation (Line(points={{299.6, + -92},{292,-92},{292,-91},{281,-91}}, color={0,0,127})); + connect(const1.y, tCL_Building_no_noise.u2) annotation (Line(points={{299.6, + -80},{298,-81},{281,-81}}, color={0,0,127})); + connect(const.y, tCL_Building_no_noise.u1) annotation (Line(points={{299.6,-68}, + {286,-68},{286,-77},{281,-77}}, color={0,0,127})); + annotation (Placement(transformation(extent={{140,-20},{160,0}})), + Placement(transformation(extent={{140,-40},{160,-20}})), + Placement(transformation(extent={{140,-60},{160,-40}})), + Placement(transformation(extent={{140,-80},{160,-60}})), + Diagram(coordinateSystem(preserveAspectRatio=false, + extent={{-140,-200},{320,140}}), graphics={ + Rectangle( + extent={{-160,30},{-134,-124}}, + lineColor={0,140,72}, + lineThickness=0.5), + Rectangle( + extent={{-128,36},{124,-124}}, + lineColor={238,46,47}, + lineThickness=0.5), + Rectangle( + extent={{-128,98},{124,38}}, + lineColor={0,128,255}, + lineThickness=0.5), + Text( + extent={{78,-106},{114,-120}}, + textColor={238,46,47}, + textString="Microgrid"), + Text( + extent={{76,58},{128,34}}, + textColor={28,108,200}, + textString="Utility Grid"), + Text( + extent={{-30,-102},{34,-124}}, + textColor={0,140,72}, + textString="Linearization Unit"), + Text( + extent={{-164,50},{-132,30}}, + textColor={0,140,72}, + textString="Inputs")}), + Documentation(info=" +

This example system shows how the preparation for resynchronization of Generator 2 to the grid. Note that at 2 seconds, a signal is triggered so voltages between buses 3 and 4 should be equal.

+

Simulate the system for 10 seconds. Variables of interest are:

+ +

Note the behavior of those variables before and after the connection of generator G2 to the main grid.

+"),experiment( + StopTime=10, + __Dymola_NumberOfIntervals=1000, + __Dymola_fixedstepsize=0.001, + __Dymola_Algorithm="Dassl"), + Icon(coordinateSystem(extent={{-140,-200},{320,140}}))); + end MPC_LTC_VSD_Original3; + + + model MPC_LTC_VSD_Linearized4 + "THIS ONE IS STABLE, CONTROLLABLE, OBSERVABLE!!!!!!!" + extends Modelica.Icons.Example; + + parameter Boolean equivalentGRID = true; + parameter Boolean equivalentsystem = false; + parameter Real set = 0; + + OpenIPSL.Electrical.Buses.Bus Bus1(v_0=powerFlow.powerflow.bus.V1, angle_0= + powerFlow.powerflow.bus.A1) if not equivalentGRID + annotation (Placement(transformation(extent={{-90,70},{-70,90}}))); + OpenIPSL.Electrical.Buses.Bus Bus2(v_0=powerFlow.powerflow.bus.V2, angle_0= + powerFlow.powerflow.bus.A1) if not equivalentGRID + annotation (Placement(transformation(extent={{-50,70},{-30,90}}))); + OpenIPSL.Electrical.Branches.PSSE.TwoWindingTransformer T1( + R=0.001, + X=0.2, + G=0, + B=0, + VNOM1=13800, + VB1=13800, + VNOM2=6000, + VB2=6000) if not equivalentGRID annotation (Placement(transformation( + extent={{-8,-8},{8,8}}, + rotation=180, + origin={-60,80}))); + OpenIPSL.Examples.OpenCPS.Generators.G1 G1( + enableV_b=true, + v_0=powerFlow.powerflow.bus.V1, + angle_0=powerFlow.powerflow.bus.A1, + P_0=powerFlow.powerflow.machines.PG1, + Q_0=powerFlow.powerflow.machines.QG1, + V_b=6000) if not equivalentGRID + annotation (Placement(transformation(extent={{-112,70},{-92,90}}))); + OpenIPSL.Electrical.Branches.PwLine L1( + R=0.001, + X=0.2, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{-26,76}, + {-14,84}}))); + OpenIPSL.Electrical.Buses.Bus Bus3(v_0=powerFlow.powerflow.bus.V3, angle_0= + powerFlow.powerflow.bus.A3) if not equivalentGRID + annotation (Placement(transformation(extent={{-10,70},{10,90}}))); + OpenIPSL.Electrical.Buses.Bus Bus4(v_0=powerFlow.powerflow.bus.V4, angle_0= + powerFlow.powerflow.bus.V4) if not equivalentGRID + annotation (Placement(transformation(extent={{50,70},{70,90}}))); + OpenIPSL.Electrical.Branches.PwLine L2_1( + R=0.0005, + X=0.1, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{24,86}, + {36,94}}))); + OpenIPSL.Electrical.Branches.PwLine L2_2( + R=0.0005, + X=0.1, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{24,66}, + {36,74}}))); + OpenIPSL.Electrical.Buses.Bus Bus5(angle_0=powerFlow.powerflow.bus.A5, v_0= + powerFlow.powerflow.bus.V5) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=90, + origin={80,16}))); + OpenIPSL.Electrical.Branches.PwLine L3( + R=0.001, + X=0.2, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation( + extent={{-6,-4},{6,4}}, + rotation=-90, + origin={80,60}))); + OpenIPSL.Electrical.Buses.Bus Bus6(v_0=powerFlow.powerflow.bus.V6, angle_0= + powerFlow.powerflow.bus.A6) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,10}))); + OpenIPSL.Electrical.Branches.PSSE.TwoWindingTransformer T2( + G=0, + B=0, + VNOM1=13800, + VB1=13800, + VNOM2=6000, + VB2=6000, + R=0.005, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={10,10}))); + GenerationUnits.PSSE.G2_16MVA G2( + enableV_b=true, + enableP_0=true, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V6, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A6, + V_b=6000, + P_0=powerFlow.powerflow.machines.PG2, + Q_0=powerFlow.powerflow.machines.QG2, + enableangle_0=true) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-30,10}))); + inner OpenIPSL.Electrical.SystemBase SysData(S_b=100000000, fn=60) + annotation (Placement(transformation(extent={{-128,104},{-74,124}}))); + OpenIPSL.Electrical.Loads.PSSE.Load Load1( + V_b=220000, + P_0=powerFlow.powerflow.loads.PL1, + Q_0=powerFlow.powerflow.loads.QL1, + v_0=powerFlow.powerflow.bus.V3, + angle_0=powerFlow.powerflow.bus.A3) if not equivalentGRID + annotation (Placement(transformation(extent={{-20,48},{0,68}}))); + Electrical.Events.Breaker circuitbreaker( + enableTrigger=false, + t_o=0.25, + rc_enabled=true, + t_rc=1000) if not equivalentGRID annotation (Placement(transformation( + extent={{-4,-4},{4,4}}, + rotation=90, + origin={80,26}))); + + Modelica.Blocks.Interfaces.RealInput IN1(start=0) + "Connector of Real input signal 2" annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-150,10}),iconTransformation(extent={{-10,-10},{10,10}}, origin={-150,10}))); + Modelica.Blocks.Sources.Constant IN11(k=0) + annotation (Placement(transformation(extent={{-108,-2},{-96,10}}))); + Modelica.Blocks.Math.Add AddU1 + annotation (Placement(transformation(extent={{-80,0},{-60,20}}))); + Modelica.Blocks.Sources.Constant IN22(k=0) + annotation (Placement(transformation(extent={{-108,-32},{-96,-20}}))); + Modelica.Blocks.Math.Add AddU2 + annotation (Placement(transformation(extent={{-80,-30},{-60,-10}}))); + Modelica.Blocks.Interfaces.RealInput IN2(start=0) + "Connector of Real input signal 2" + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-150,-12}), iconTransformation(extent={{-10,-10},{10,10}}, + origin={-150,-12}))); + + Modelica.Blocks.Interfaces.RealInput IN3(start = 0) "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-44},{-140,-24}}), + iconTransformation(extent={{-160,-44},{-140,-24}}))); + Modelica.Blocks.Interfaces.RealInput IN4(start = 0) "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-66},{-140,-46}}), + iconTransformation(extent={{-160,-66},{-140,-46}}))); + Modelica.Blocks.Interfaces.RealInput IN5(start = 0) "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-88},{-140,-68}}), + iconTransformation(extent={{-160,-88},{-140,-68}}))); + + PFData.PowerFlow powerFlow(redeclare record PowerFlow = + OpenIPSL.Examples.ModelPredictiveControl.PFData.PFVSD_TCL) + annotation (Placement(transformation(extent={{-68,104},{-48,124}}))); + Electrical.Machines.PSSE.GENCLS IB( + V_b=220000, + v_0=powerFlow.powerflow.bus.V4, + angle_0=powerFlow.powerflow.bus.A4, + P_0=powerFlow.powerflow.machines.Pinf, + Q_0=powerFlow.powerflow.machines.Qinf, + M_b=100000000, + X_d=1) if not equivalentGRID annotation (Placement(transformation(extent={{110,70}, + {100,90}}))); + Electrical.Loads.PSSE.Load_ExtInput Load2( + P_0=powerFlow.powerflow.loads.PL2, + Q_0=powerFlow.powerflow.loads.QL2, + v_0=powerFlow.powerflow.bus.V5, + angle_0=powerFlow.powerflow.bus.A5, + d_P=0, + t1=100, + d_t=1000) + annotation (Placement(transformation(extent={{100,-30},{120,-10}}))); + + inner Modelica.Blocks.Noise.GlobalSeed globalSeed(useAutomaticSeed=false, + fixedSeed=10000) + annotation (Placement(transformation(extent={{-42,102},{-22,122}}))); + + Electrical.Buses.Bus Bus10(v_0=powerFlow.powerflow.bus.V10, angle_0=powerFlow.powerflow.bus.A10) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,-90}))); + Electrical.Branches.PSSE.TwoWindingTransformer T4( + G=0, + B=0, + CW=1, + VNOM1=13800, + VB1=13800, + VNOM2=480, + VB2=480, + R=0.001, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={10,-90}))); + GenerationUnits.PSSE.Solar_Units.SolarMPCSysIdentification + PV( + V_b=480, + P_0=powerFlow.powerflow.machines.PPV, + enableP_0=true, + Q_0=powerFlow.powerflow.machines.QPV, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V8, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A8, + enableangle_0=true) + annotation (Placement(transformation(extent={{-40,-60},{-20,-40}}))); + Modelica.Blocks.Math.Add AddU3 + annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}))); + Modelica.Blocks.Sources.Constant IN33(k=0) + annotation (Placement(transformation(extent={{-108,-62},{-96,-50}}))); + + Modelica.Blocks.Math.Add AddU4 + annotation (Placement(transformation(extent={{-80,-90},{-60,-70}}))); + Modelica.Blocks.Math.Add AddU5 + annotation (Placement(transformation(extent={{-80,-116},{-60,-96}}))); + Modelica.Blocks.Sources.Constant IN44(k=0) + annotation (Placement(transformation(extent={{-108,-92},{-96,-80}}))); + Modelica.Blocks.Sources.Constant IN55(k=0) + annotation (Placement(transformation(extent={{-108,-118},{-96,-106}}))); + GenerationUnits.PSSE.Battery_Units.BESSMPCSysIdentification + BESS( + V_base=480, + V_b(displayUnit="kV") = 480, + enableV_b=true, + P_0=powerFlow.powerflow.machines.PBESS, + enableP_0=true, + Q_0=powerFlow.powerflow.machines.QBESS, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V10, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A10, + enableangle_0=true) + annotation (Placement(transformation(extent={{-40,-100},{-20,-80}}))); + Electrical.Buses.Bus Bus8(v_0=powerFlow.powerflow.bus.V8, angle_0=powerFlow.powerflow.bus.A8) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,-50}))); + Electrical.Branches.PSSE.TwoWindingTransformer T3( + G=0, + B=0, + CW=1, + VNOM1=13800, + VB1=13800, + VNOM2=480, + VB2=480, + R=0.001, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={12,-50}))); + Electrical.Buses.Bus Bus11(v_0=powerFlow.powerflow.bus.V11, angle_0=powerFlow.powerflow.bus.A11) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,-90}))); + Electrical.Buses.Bus Bus9(v_0=powerFlow.powerflow.bus.V9, angle_0=powerFlow.powerflow.bus.A9) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,-50}))); + Electrical.Buses.Bus Bus7(v_0=powerFlow.powerflow.bus.V7, angle_0=powerFlow.powerflow.bus.A7) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,10}))); + Electrical.Branches.PwLine L4( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,6},{ + 50,14}}))); + Electrical.Branches.PwLine L5( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,-54}, + {50,-46}}))); + Electrical.Branches.PwLine L6( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,-94}, + {50,-86}}))); + Modelica.Blocks.Sources.Sine sine( + amplitude=0, + f=1/260, + phase=3.1415926535898, + startTime=1000) + annotation (Placement(transformation(extent={{68,-36},{78,-26}}))); + Electrical.Loads.NoiseInjections.WhiteNoiseInjection whiteNoiseInjection( + active_sigma=0.000000000000001, + samplePeriod=0.01) + annotation (Placement(transformation(extent={{66,-18},{78,-6}}))); + Modelica.Blocks.Math.Add add + annotation (Placement(transformation(extent={{84,-18},{92,-10}}))); + + Modelica.Blocks.Sources.Constant IN66(k=0) + annotation (Placement(transformation(extent={{140,-60},{160,-40}}))); + Electrical.Branches.PwLine L2( + R=0.001, + X=0.01, + G=0, + B=0) annotation (Placement(transformation(extent={{182,6},{194,14}}))); + Electrical.Buses.Bus Bus12(angle_0=powerFlow.powerflow.bus.A5, v_0= + powerFlow.powerflow.bus.V5) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={200,10}))); + Electrical.Machines.ControlsMotors.VariableSpeedDrive.PowerElectronics.AC2DCandDC2AC_MPC + aC2DCandDC2AC_MPC( + V_b=13800, + v_0=powerFlow.powerflow.bus.V5, + angle_0=powerFlow.powerflow.bus.A5, + Rdc=0.01, + Cdc=0.000001, + m0=0.9537) + annotation (Placement(transformation(extent={{220,0},{260,20}}))); + Electrical.Machines.ControlsMotors.VariableSpeedDrive.ControllerLogic.VoltsHertzController_MPC + voltsHertzController_MPC( + V_b=13800, + f_max=60, + f_min=0, + m0=0.9537, + Kp=0.5, + Ki=0.2, + rotor_speed_initial=1.9*Modelica.Constants.pi*60) + annotation (Placement(transformation(extent={{230,-40},{248,-20}}))); + Modelica.Blocks.Interfaces.RealInput IN6(start=0) "Connector of Real input signal 2" + annotation (Placement(transformation(extent={{-160,-110},{-140,-90}}), + iconTransformation(extent={{-160,-110},{-140,-90}}))); + Modelica.Blocks.Interfaces.RealOutput OUT1 + annotation (Placement(transformation(extent={{-264,68},{-244,88}}))); + Modelica.Blocks.Interfaces.RealOutput OUT2 + annotation (Placement(transformation(extent={{-264,48},{-244,68}}))); + Modelica.Blocks.Interfaces.RealOutput OUT3 + annotation (Placement(transformation(extent={{-264,28},{-244,48}}))); + Modelica.Blocks.Interfaces.RealOutput OUT4 + annotation (Placement(transformation(extent={{-264,8},{-244,28}}))); + Modelica.Blocks.Interfaces.RealOutput OUT5 + annotation (Placement(transformation(extent={{-264,-12},{-244,8}}))); + Modelica.Blocks.Interfaces.RealOutput OUT6 + annotation (Placement(transformation(extent={{-264,-32},{-244,-12}}))); + Modelica.Blocks.Interfaces.RealOutput OUT7 + annotation (Placement(transformation(extent={{-264,-52},{-244,-32}}))); + Modelica.Blocks.Interfaces.RealOutput OUT8 + annotation (Placement(transformation(extent={{-264,-72},{-244,-52}}))); + Modelica.Blocks.Interfaces.RealOutput OUT9 + annotation (Placement(transformation(extent={{-264,-92},{-244,-72}}))); + Modelica.Blocks.Interfaces.RealOutput OUT10 + annotation (Placement(transformation(extent={{-264,-112},{-244,-92}}))); + Modelica.Blocks.Interfaces.RealOutput OUT11 + annotation (Placement(transformation(extent={{-240,68},{-220,88}}))); + Modelica.Blocks.Interfaces.RealOutput OUT12 + annotation (Placement(transformation(extent={{-240,48},{-220,68}}))); + Modelica.Blocks.Interfaces.RealOutput OUT13 + annotation (Placement(transformation(extent={{-240,28},{-220,48}}))); + Modelica.Blocks.Interfaces.RealOutput OUT14 + annotation (Placement(transformation(extent={{-240,8},{-220,28}}))); + Modelica.Blocks.Interfaces.RealOutput OUT15 + annotation (Placement(transformation(extent={{-240,-12},{-220,8}}))); + Modelica.Blocks.Interfaces.RealOutput OUT16 + annotation (Placement(transformation(extent={{-240,-32},{-220,-12}}))); + Modelica.Blocks.Interfaces.RealOutput OUT17 + annotation (Placement(transformation(extent={{-240,-52},{-220,-32}}))); + Modelica.Blocks.Interfaces.RealOutput OUT18 + annotation (Placement(transformation(extent={{-240,-72},{-220,-52}}))); + Modelica.Blocks.Interfaces.RealOutput OUT19 + annotation (Placement(transformation(extent={{-240,-92},{-220,-72}}))); + Modelica.Blocks.Interfaces.RealOutput OUT20 + annotation (Placement(transformation(extent={{-240,-112},{-220,-92}}))); + Modelica.Blocks.Interfaces.RealOutput OUT21 + annotation (Placement(transformation(extent={{-220,68},{-200,88}}))); + Modelica.Blocks.Interfaces.RealOutput OUT22 + annotation (Placement(transformation(extent={{-220,48},{-200,68}}))); + Modelica.Blocks.Interfaces.RealOutput OUT23 + annotation (Placement(transformation(extent={{-220,28},{-200,48}}))); + Modelica.Blocks.Interfaces.RealOutput OUT24 + annotation (Placement(transformation(extent={{-220,8},{-200,28}}))); + Modelica.Blocks.Interfaces.RealOutput OUT25 + annotation (Placement(transformation(extent={{-220,-12},{-200,8}}))); + Modelica.Blocks.Interfaces.RealOutput OUT26 + annotation (Placement(transformation(extent={{-220,-32},{-200,-12}}))); + Modelica.Blocks.Interfaces.RealOutput OUT27 + annotation (Placement(transformation(extent={{-220,-52},{-200,-32}}))); + Modelica.Blocks.Interfaces.RealOutput OUT28 + annotation (Placement(transformation(extent={{-220,-72},{-200,-52}}))); + Modelica.Blocks.Interfaces.RealOutput OUT29 + annotation (Placement(transformation(extent={{-220,-92},{-200,-72}}))); + Modelica.Blocks.Interfaces.RealOutput OUT30 + annotation (Placement(transformation(extent={{-220,-112},{-200,-92}}))); + Modelica.Blocks.Interfaces.RealOutput OUT31 + annotation (Placement(transformation(extent={{-200,68},{-180,88}}))); + Modelica.Blocks.Math.Add add10 + annotation (Placement(transformation(extent={{186,-52},{194,-44}}))); + Modelica.Blocks.Interfaces.RealInput IN7 + "Connector of Real input signal 1" annotation (Placement( + transformation(extent={{-160,-160},{-140,-140}}), + iconTransformation(extent={{-160,-160},{-140,-140}}))); + Modelica.Blocks.Sources.Constant IN77(k=0) + annotation (Placement(transformation(extent={{142,-158},{162,-138}}))); + Modelica.Blocks.Math.Add3 Add1 + annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + rotation=0, + origin={192,-142}))); + Modelica.Blocks.Sources.Constant Ratio_LTC(k=1) + annotation (Placement(transformation(extent={{142,-170},{162,-190}}))); + Electrical.Buses.Bus Bus13(angle_0=powerFlow.powerflow.bus.A13, v_0= + powerFlow.powerflow.bus.V13) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={208,-82}))); + Electrical.Branches.PwLine L7( + R=0.001, + X=0.01, + G=0, + B=0) annotation (Placement(transformation(extent={{186,-86},{198,-78}}))); + Electrical.Buses.Bus Bus14( + V_b=120, + angle_0=powerFlow.powerflow.bus.A14, + v_0=powerFlow.powerflow.bus.V14) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={252,-82}))); + TCL.ULTC_VoltageControl uLTC_VoltageControl( + Vbus1=13800, + Vbus2(displayUnit="V") = 120, + Vn=13800, + v_0=1, + kT=13800/120, + m0=1, + m_max=1.05, + m_min=0.95, + K=0.01) + annotation (Placement(transformation(extent={{218,-92},{238,-72}}))); + Electrical.Loads.PSSE.Load load(V_b=120, P_0=420000) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=90, + origin={276,-82}))); + Modelica.Blocks.Interfaces.RealOutput OUT32 + annotation (Placement(transformation(extent={{-200,48},{-180,68}}))); + Electrical.Buses.Bus MOTORBUS(angle_0=powerFlow.powerflow.bus.A5, v_0= + powerFlow.powerflow.bus.V5) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={280,10}))); + Modelica.Blocks.Sources.Constant Speed(k=356) + annotation (Placement(transformation(extent={{286,-16},{266,-36}}))); + Electrical.Loads.PSSE.Load load1( + V_b=120, + P_0=100000, + Q_0=200000) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=90, + origin={306,10}))); + equation + + OUT1 = G2.gen.w; + OUT2 = G2.gen.delta; + OUT3 = G2.gen.Epq; + OUT4 = G2.gen.PSIkd; + OUT5 = G2.gen.PSIppq; + OUT6 = G2.sEXSMPC.simpleLagLim.state; + OUT7 = G2.sEXSMPC.leadLag.TF.x_scaled[1]; + OUT8 = G2.gASTMPC.simpleLagLim.state; + OUT9 = G2.gASTMPC.simpleLag.state; + OUT10 = G2.gASTMPC.simpleLag1.state; + OUT11 = Bus6.v; + + OUT12 =PV.rEGCA1_1.Pgen; + OUT13 =PV.rEGCA1_1.Qgen; + OUT14 =PV.rEGCA1_1.p.ir; + OUT15 =PV.rEGCA1_1.p.ii; + OUT16 = Bus8.v; + + OUT17 =BESS.rEGCA1_1.Pgen; + OUT18 =BESS.rEGCA1_1.Qgen; + OUT19 =BESS.rEGCA1_1.p.ir; + OUT20 =BESS.rEGCA1_1.p.ii; + OUT21 = Bus10.v; + + OUT22 = uLTC_VoltageControl.m; + OUT23 = Bus14.p.vr; + OUT24 = Bus14.p.vi; + + OUT25= aC2DCandDC2AC_MPC.n.ir; + OUT26= aC2DCandDC2AC_MPC.n.ii; + OUT27= aC2DCandDC2AC_MPC.P; + OUT28 = MOTORBUS.v; + + + OUT29= voltsHertzController_MPC.we; + OUT30= Bus12.v; + + OUT31 = Bus5.v; + OUT32 = Bus5.angle; + + connect(T1.p, Bus2.p) + annotation (Line(points={{-51.2,80},{-40,80}}, color={0,0,255})); + connect(Bus1.p, T1.n) + annotation (Line(points={{-80,80},{-68.8,80}}, color={0,0,255})); + connect(G1.conn, Bus1.p) + annotation (Line(points={{-91,80},{-80,80}}, color={0,0,255})); + connect(L1.n, Bus3.p) + annotation (Line(points={{-14.6,80},{0,80}}, color={0,0,255})); + connect(L1.p, Bus2.p) + annotation (Line(points={{-25.4,80},{-40,80}}, color={0,0,255})); + connect(L2_2.n, Bus4.p) annotation (Line(points={{35.4,70},{44,70},{44,80},{60, + 80}}, color={0,0,255})); + connect(L2_1.n, Bus4.p) annotation (Line(points={{35.4,90},{44,90},{44,80},{60, + 80}}, color={0,0,255})); + connect(L2_1.p, Bus3.p) annotation (Line(points={{24.6,90},{16,90},{16,80},{0, + 80}}, color={0,0,255})); + connect(L2_2.p, Bus3.p) annotation (Line(points={{24.6,70},{16,70},{16,80},{0, + 80}}, color={0,0,255})); + connect(Load1.p, Bus3.p) + annotation (Line(points={{-10,68},{-10,80},{0,80}}, color={0,0,255})); + connect(L3.p, Bus4.p) + annotation (Line(points={{80,65.4},{80,80},{60,80}}, color={0,0,255})); + connect(circuitbreaker.s, Bus5.p) + annotation (Line(points={{80,22},{80,16}}, color={0,0,255})); + connect(circuitbreaker.r, L3.n) + annotation (Line(points={{80,30},{80,54.6}}, color={0,0,255})); + connect(IN11.y, AddU1.u2) annotation (Line(points={{-95.4,4},{-82,4}}, + color={0,0,127})); + connect(IN1, AddU1.u1) annotation (Line(points={{-150,10},{-116,10},{-116,16}, + {-82,16}}, + color={0,0,127})); + + connect(IN22.y,AddU2. u2) annotation (Line(points={{-95.4,-26},{-82,-26}}, + color={0,0,127})); + connect(IN2,AddU2. u1) annotation (Line(points={{-150,-12},{-118,-12},{-118,-14}, + {-82,-14}}, + color={0,0,127})); + connect(AddU2.y, G2.Efd_ref) + annotation (Line(points={{-59,-20},{-52,-20},{-52,4},{-42,4}}, + color={0,0,127})); + connect(AddU1.y, G2.P_ref1) annotation (Line(points={{-59,10},{-52,10},{-52,16}, + {-42,16}}, color={0,0,127})); + connect(IB.p, Bus4.p) + annotation (Line(points={{100,80},{60,80}}, color={0,0,255})); + connect(Load2.p, Bus5.p) annotation (Line(points={{110,-10},{110,10},{80,10},{ + 80,16}}, + color={0,0,255})); + connect(T4.n, Bus10.p) + annotation (Line(points={{-1,-90},{-10,-90}}, color={0,0,255})); + connect(Bus6.p, T2.n) + annotation (Line(points={{-10,10},{-1,10}}, + color={0,0,255})); + connect(IN33.y,AddU3. u2) + annotation (Line(points={{-95.4,-56},{-82,-56}}, color={0,0,127})); + connect(BESS.p1, Bus10.p) + annotation (Line(points={{-20,-90},{-10,-90}}, color={0,0,255})); + connect(BESS.Paux1, AddU4.y) annotation (Line(points={{-42,-84},{-54,-84},{-54, + -80},{-59,-80}}, color={0,0,127})); + connect(IN55.y, AddU5.u2) + annotation (Line(points={{-95.4,-112},{-82,-112}}, color={0,0,127})); + connect(AddU5.y, BESS.Qext1) annotation (Line(points={{-59,-106},{-52,-106},{-52, + -96},{-42,-96}}, color={0,0,127})); + connect(IN44.y, AddU4.u2) + annotation (Line(points={{-95.4,-86},{-82,-86}}, color={0,0,127})); + connect(AddU4.u1,IN4) annotation (Line(points={{-82,-74},{-100,-74},{-100,-70}, + {-116,-70},{-116,-56},{-150,-56}}, color={0,0,127})); + connect(AddU5.u1,IN5) annotation (Line(points={{-82,-100},{-116,-100},{-116,-78}, + {-150,-78}}, color={0,0,127})); + connect(G2.conn, Bus6.p) annotation (Line(points={{-19,10},{-10,10}}, + color={0,0,255})); + connect(AddU3.u1, IN3) annotation (Line(points={{-82,-44},{-118,-44},{-118,-34}, + {-150,-34}}, color={0,0,127})); + connect(PV.p1, Bus8.p) + annotation (Line(points={{-20,-50},{-10,-50}}, color={0,0,255})); + connect(Bus8.p, T3.n) + annotation (Line(points={{-10,-50},{1,-50}}, color={0,0,255})); + connect(T2.p, Bus7.p) annotation (Line(points={{21,10},{25.5,10},{25.5,10},{30, + 10}}, color={0,0,255})); + connect(T3.p, Bus9.p) + annotation (Line(points={{23,-50},{30,-50}}, color={0,0,255})); + connect(T4.p, Bus11.p) + annotation (Line(points={{21,-90},{30,-90}}, color={0,0,255})); + connect(L4.n, Bus5.p) annotation (Line(points={{49.4,10},{60,10},{60,10},{80,10}, + {80,16}}, color={0,0,255})); + connect(L5.n, Bus5.p) annotation (Line(points={{49.4,-50},{60,-50},{60,10},{80, + 10},{80,16}}, color={0,0,255})); + connect(Bus11.p, L6.p) + annotation (Line(points={{30,-90},{38.6,-90}}, color={0,0,255})); + connect(Bus9.p, L5.p) + annotation (Line(points={{30,-50},{38.6,-50}}, color={0,0,255})); + connect(L6.n, Bus5.p) annotation (Line(points={{49.4,-90},{60,-90},{60,10},{80, + 10},{80,16}}, color={0,0,255})); + connect(Bus7.p, L4.p) annotation (Line(points={{30,10},{34.3,10},{34.3,10},{38.6, + 10}}, color={0,0,255})); + connect(sine.y, add.u2) annotation (Line(points={{78.5,-31},{78.5,-16.4}, + {83.2,-16.4}}, color={0,0,127})); + connect(whiteNoiseInjection.y, add.u1) annotation (Line(points={{78.54, + -12.06},{80.87,-12.06},{80.87,-11.6},{83.2,-11.6}}, color={0,0, + 127})); + connect(add.y, Load2.u) annotation (Line(points={{92.4,-14},{97.15,-14}, + {97.15,-14.5},{101.9,-14.5}}, color={0,0,127})); + connect(PV.Qref, AddU3.y) annotation (Line(points={{-42,-56},{-54,-56},{-54,-50}, + {-59,-50}}, color={0,0,127})); + connect(L2.n,Bus12. p) + annotation (Line(points={{193.4,10},{200,10}}, color={0,0,255})); + connect(L2.p, Bus5.p) + annotation (Line(points={{182.6,10},{80,10},{80,16}}, color={0,0,255})); + connect(Bus12.p, aC2DCandDC2AC_MPC.p) + annotation (Line(points={{200,10},{220,10}}, color={0,0,255})); + connect(voltsHertzController_MPC.m, aC2DCandDC2AC_MPC.m_input) + annotation (Line(points={{244.6,-18},{244.6,-10},{249.091,-10},{ + 249.091,-2}}, color={0,0,127})); + connect(voltsHertzController_MPC.Vc, aC2DCandDC2AC_MPC.Vc) annotation ( + Line(points={{235.4,-18},{235.4,-10},{230.909,-10},{230.909,-2}}, + color={0,0,127})); + connect(IN66.y, add10.u2) annotation (Line(points={{161,-50},{164,-50.4},{185.2, + -50.4}}, color={0,0,127})); + connect(IN6, add10.u1) annotation (Line(points={{-150,-100},{-120,-100},{-120, + -132},{132,-132},{132,-24},{185.2,-24},{185.2,-45.6}}, color={0,0,127})); + connect(add10.y, voltsHertzController_MPC.W_ref) annotation (Line(points={{194.4, + -48},{208,-48},{208,-30},{228,-30}}, color={0,0,127})); + connect(IN77.y,Add1. u2) + annotation (Line(points={{163,-148},{172,-148},{172,-142},{180,-142}}, + color={0,0,127})); + connect(Add1.u1, IN7) annotation (Line(points={{180,-134},{168,-134},{168,-132}, + {134,-132},{134,-150},{-150,-150}}, color={0,0,127})); + connect(Ratio_LTC.y,Add1. u3) annotation (Line(points={{163,-180},{180,-180},{ + 180,-150}}, color={0,0,127})); + connect(L7.n,Bus13. p) + annotation (Line(points={{197.4,-82},{208,-82}}, color={0,0,255})); + connect(L7.p, Bus5.p) annotation (Line(points={{186.6,-82},{128,-82},{128,10}, + {80,10},{80,16}}, + color={0,0,255})); + connect(Bus13.p,uLTC_VoltageControl. p) + annotation (Line(points={{208,-82},{217,-82}}, color={0,0,255})); + connect(uLTC_VoltageControl.n,Bus14. p) + annotation (Line(points={{239,-82},{252,-82}}, color={0,0,255})); + connect(Add1.y, uLTC_VoltageControl.v_ref) annotation (Line(points={{203,-142}, + {228,-142},{228,-94}}, color={0,0,127})); + connect(load.p, Bus14.p) + annotation (Line(points={{266,-82},{252,-82}}, color={0,0,255})); + connect(aC2DCandDC2AC_MPC.n, MOTORBUS.p) + annotation (Line(points={{260,10},{280,10}}, color={0,0,255})); + connect(voltsHertzController_MPC.motor_speed, Speed.y) + annotation (Line(points={{252,-26},{265,-26}}, color={0,0,127})); + connect(MOTORBUS.p, load1.p) + annotation (Line(points={{280,10},{296,10}}, color={0,0,255})); + annotation(Diagram(coordinateSystem(preserveAspectRatio=false, + extent={{-140,-200},{340,140}}), graphics={ + Rectangle( + extent={{-160,30},{-132,-168}}, + lineColor={0,140,72}, + lineThickness=0.5), + Rectangle( + extent={{-128,36},{124,-124}}, + lineColor={238,46,47}, + lineThickness=0.5), + Rectangle( + extent={{-128,98},{124,38}}, + lineColor={0,128,255}, + lineThickness=0.5), + Text( + extent={{78,-106},{114,-120}}, + textColor={238,46,47}, + textString="Microgrid"), + Text( + extent={{76,58},{128,34}}, + textColor={28,108,200}, + textString="Utility Grid"), + Text( + extent={{-30,-102},{34,-124}}, + textColor={0,140,72}, + textString="Linearization Unit"), + Text( + extent={{-164,50},{-132,30}}, + textColor={0,140,72}, + textString="Inputs")}), + Documentation(info=" +

This example system shows how the preparation for resynchronization of Generator 2 to the grid. Note that at 2 seconds, a signal is triggered so voltages between buses 3 and 4 should be equal.

+

Simulate the system for 10 seconds. Variables of interest are:

+ +

Note the behavior of those variables before and after the connection of generator G2 to the main grid.

+"),experiment( + StopTime=10, + __Dymola_NumberOfIntervals=1000, + __Dymola_Algorithm="Dassl"), + Icon(coordinateSystem(extent={{-140,-200},{340,140}}))); + end MPC_LTC_VSD_Linearized4; + + model MPC_LTC_VSD_Original4 + "THIS ONE IS STABLE, CONTROLLABLE, OBSERVABLE!!!!!!!" + extends Modelica.Icons.Example; + + parameter Boolean equivalentGRID = false; + parameter Boolean equivalentsystem = false; + parameter Real set = 0; + + OpenIPSL.Electrical.Buses.Bus Bus1(v_0=powerFlow.powerflow.bus.V1, angle_0= + powerFlow.powerflow.bus.A1) if not equivalentGRID + annotation (Placement(transformation(extent={{-90,70},{-70,90}}))); + OpenIPSL.Electrical.Buses.Bus Bus2(v_0=powerFlow.powerflow.bus.V2, angle_0= + powerFlow.powerflow.bus.A1) if not equivalentGRID + annotation (Placement(transformation(extent={{-50,70},{-30,90}}))); + OpenIPSL.Electrical.Branches.PSSE.TwoWindingTransformer T1( + R=0.001, + X=0.2, + G=0, + B=0, + VNOM1=13800, + VB1=13800, + VNOM2=6000, + VB2=6000) if not equivalentGRID annotation (Placement(transformation( + extent={{-8,-8},{8,8}}, + rotation=180, + origin={-60,80}))); + OpenIPSL.Examples.OpenCPS.Generators.G1 G1( + enableV_b=true, + v_0=powerFlow.powerflow.bus.V1, + angle_0=powerFlow.powerflow.bus.A1, + P_0=powerFlow.powerflow.machines.PG1, + Q_0=powerFlow.powerflow.machines.QG1, + V_b=6000) if not equivalentGRID + annotation (Placement(transformation(extent={{-112,70},{-92,90}}))); + OpenIPSL.Electrical.Branches.PwLine L1( + R=0.001, + X=0.2, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{-26,76}, + {-14,84}}))); + OpenIPSL.Electrical.Buses.Bus Bus3(v_0=powerFlow.powerflow.bus.V3, angle_0= + powerFlow.powerflow.bus.A3) if not equivalentGRID + annotation (Placement(transformation(extent={{-10,70},{10,90}}))); + OpenIPSL.Electrical.Buses.Bus Bus4(v_0=powerFlow.powerflow.bus.V4, angle_0= + powerFlow.powerflow.bus.V4) if not equivalentGRID + annotation (Placement(transformation(extent={{50,70},{70,90}}))); + OpenIPSL.Electrical.Branches.PwLine L2_1( + R=0.0005, + X=0.1, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{24,86}, + {36,94}}))); + OpenIPSL.Electrical.Branches.PwLine L2_2( + R=0.0005, + X=0.1, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation(extent={{24,66}, + {36,74}}))); + OpenIPSL.Electrical.Buses.Bus Bus5(angle_0=powerFlow.powerflow.bus.A5, v_0= + powerFlow.powerflow.bus.V5) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=90, + origin={80,16}))); + OpenIPSL.Electrical.Branches.PwLine L3( + R=0.001, + X=0.2, + G=0, + B=0) if not equivalentGRID annotation (Placement(transformation( + extent={{-6,-4},{6,4}}, + rotation=-90, + origin={80,60}))); + OpenIPSL.Electrical.Buses.Bus Bus6(v_0=powerFlow.powerflow.bus.V6, angle_0= + powerFlow.powerflow.bus.A6) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,10}))); + OpenIPSL.Electrical.Branches.PSSE.TwoWindingTransformer T2( + G=0, + B=0, + VNOM1=13800, + VB1=13800, + VNOM2=6000, + VB2=6000, + R=0.005, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={10,10}))); + GenerationUnits.PSSE.G2_16MVA G2( + enableV_b=true, + enableP_0=true, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V6, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A6, + V_b=6000, + P_0=powerFlow.powerflow.machines.PG2, + Q_0=powerFlow.powerflow.machines.QG2, + enableangle_0=true) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-30,10}))); + inner OpenIPSL.Electrical.SystemBase SysData(S_b=100000000, fn=60) + annotation (Placement(transformation(extent={{-128,104},{-74,124}}))); + OpenIPSL.Electrical.Loads.PSSE.Load Load1( + V_b=220000, + P_0=powerFlow.powerflow.loads.PL1, + Q_0=powerFlow.powerflow.loads.QL1, + v_0=powerFlow.powerflow.bus.V3, + angle_0=powerFlow.powerflow.bus.A3) if not equivalentGRID + annotation (Placement(transformation(extent={{-20,48},{0,68}}))); + Electrical.Events.Breaker circuitbreaker( + enableTrigger=false, + t_o=0.25, + rc_enabled=true, + t_rc=1000) if not equivalentGRID annotation (Placement(transformation( + extent={{-4,-4},{4,4}}, + rotation=90, + origin={80,26}))); + + Modelica.Blocks.Interfaces.RealInput IN1(start=0) + "Connector of Real input signal 2" annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-150,10}),iconTransformation(extent={{-10,-10},{10,10}}, origin={-150,10}))); + Modelica.Blocks.Sources.Constant IN11(k=0) + annotation (Placement(transformation(extent={{-108,-2},{-96,10}}))); + Modelica.Blocks.Math.Add AddU1 + annotation (Placement(transformation(extent={{-80,0},{-60,20}}))); + Modelica.Blocks.Sources.Constant IN22(k=0) + annotation (Placement(transformation(extent={{-108,-32},{-96,-20}}))); + Modelica.Blocks.Math.Add AddU2 + annotation (Placement(transformation(extent={{-80,-30},{-60,-10}}))); + Modelica.Blocks.Interfaces.RealInput IN2(start=0) + "Connector of Real input signal 2" + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-150,-12}), iconTransformation(extent={{-10,-10},{10,10}}, + origin={-150,-12}))); + Modelica.Blocks.Interfaces.RealInput IN3 "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-44},{-140,-24}}), + iconTransformation(extent={{-160,-44},{-140,-24}}))); + Modelica.Blocks.Interfaces.RealInput IN4(start = 0) "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-66},{-140,-46}}), + iconTransformation(extent={{-160,-66},{-140,-46}}))); + Modelica.Blocks.Interfaces.RealInput IN5(start = 0) "Connector of Real input signal 1" + annotation (Placement(transformation(extent={{-160,-88},{-140,-68}}), + iconTransformation(extent={{-160,-88},{-140,-68}}))); + + PFData.PowerFlow powerFlow(redeclare record PowerFlow = + OpenIPSL.Examples.ModelPredictiveControl.PFData.PFVSD_TCL) + annotation (Placement(transformation(extent={{-68,104},{-48,124}}))); + Electrical.Machines.PSSE.GENCLS IB( + V_b=220000, + v_0=powerFlow.powerflow.bus.V4, + angle_0=powerFlow.powerflow.bus.A4, + P_0=powerFlow.powerflow.machines.Pinf, + Q_0=powerFlow.powerflow.machines.Qinf, + M_b=100000000, + X_d=1) if not equivalentGRID annotation (Placement(transformation(extent={{110,70}, + {100,90}}))); + Electrical.Loads.PSSE.Load_ExtInput Load2( + P_0=powerFlow.powerflow.loads.PL2, + Q_0=powerFlow.powerflow.loads.QL2, + v_0=powerFlow.powerflow.bus.V5, + angle_0=powerFlow.powerflow.bus.A5, + d_P=0, + t1=100, + d_t=1000) + annotation (Placement(transformation(extent={{100,-30},{120,-10}}))); + + inner Modelica.Blocks.Noise.GlobalSeed globalSeed( + enableNoise=true, + useAutomaticSeed=false, + fixedSeed=10000) + annotation (Placement(transformation(extent={{-44,102},{-24,122}}))); + Modelica.Blocks.Sources.Sine sine( + amplitude=0.01, + f=1/260, + phase=3.1415926535898, + startTime=1000) + annotation (Placement(transformation(extent={{70,-36},{80,-26}}))); + + Electrical.Buses.Bus Bus10(v_0=powerFlow.powerflow.bus.V10, angle_0=powerFlow.powerflow.bus.A10) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,-90}))); + Electrical.Branches.PSSE.TwoWindingTransformer T4( + G=0, + B=0, + CW=1, + VNOM1=13800, + VB1=13800, + VNOM2=480, + VB2=480, + R=0.001, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={10,-90}))); + GenerationUnits.PSSE.Solar_Units.SolarMPCLocalVQControl_ADD_ON + PV( + V_b=480, + P_0=powerFlow.powerflow.machines.PPV, + enableP_0=true, + Q_0=powerFlow.powerflow.machines.QPV, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V8, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A8, + enableangle_0=true) + annotation (Placement(transformation(extent={{-40,-60},{-20,-40}}))); + Modelica.Blocks.Math.Add AddU3 + annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}))); + Modelica.Blocks.Sources.Constant IN33(k=0) + annotation (Placement(transformation(extent={{-108,-62},{-96,-50}}))); + + Modelica.Blocks.Math.Add AddU4 + annotation (Placement(transformation(extent={{-80,-90},{-60,-70}}))); + Modelica.Blocks.Math.Add AddU5 + annotation (Placement(transformation(extent={{-80,-116},{-60,-96}}))); + Modelica.Blocks.Sources.Constant IN44(k=0) + annotation (Placement(transformation(extent={{-108,-92},{-96,-80}}))); + Modelica.Blocks.Sources.Constant IN55(k=0) + annotation (Placement(transformation(extent={{-108,-118},{-96,-106}}))); + GenerationUnits.PSSE.Battery_Units.BESSMPCLocalVQControl BESS( + V_base=480, + V_b(displayUnit="kV") = 480, + enableV_b=true, + P_0=powerFlow.powerflow.machines.PBESS, + enableP_0=true, + Q_0=powerFlow.powerflow.machines.QBESS, + enableQ_0=true, + v_0=powerFlow.powerflow.bus.V10, + enablev_0=true, + angle_0=powerFlow.powerflow.bus.A10, + enableangle_0=true) + annotation (Placement(transformation(extent={{-40,-100},{-20,-80}}))); + Electrical.Buses.Bus Bus8(v_0=powerFlow.powerflow.bus.V8, angle_0=powerFlow.powerflow.bus.A8) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-10,-50}))); + Electrical.Branches.PSSE.TwoWindingTransformer T3( + G=0, + B=0, + CW=1, + VNOM1=13800, + VB1=13800, + VNOM2=480, + VB2=480, + R=0.001, + X=0.1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={12,-50}))); + Electrical.Buses.Bus Bus11(v_0=powerFlow.powerflow.bus.V11, angle_0=powerFlow.powerflow.bus.A11) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,-90}))); + Electrical.Buses.Bus Bus9(v_0=powerFlow.powerflow.bus.V9, angle_0=powerFlow.powerflow.bus.A9) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,-50}))); + Electrical.Buses.Bus Bus7(v_0=powerFlow.powerflow.bus.V7, angle_0=powerFlow.powerflow.bus.A7) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={30,10}))); + Electrical.Branches.PwLine L4( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,6},{ + 50,14}}))); + Electrical.Branches.PwLine L5( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,-54}, + {50,-46}}))); + Electrical.Branches.PwLine L6( + R=0.01, + X=0.001, + G=0, + B=0) annotation (Placement(transformation(extent={{38,-94}, + {50,-86}}))); + Electrical.Renewables.PSSE.AddOnBlocks.IrradianceToPower + irradianceToPower( + Ypv(displayUnit="MW") = 3000000, + Sb(displayUnit="MV.A") = 100000000, + Tcstc(displayUnit="K") = 298.15, + fpv=1, + ap=-0.48, + Gtstc=1000) + annotation (Placement(transformation(extent={{44,-20},{34,-10}}))); + Modelica.Blocks.Interfaces.RealInput IN6 "Connector of Real input signal 2" + annotation (Placement(transformation(extent={{-160,-108},{-140,-88}}), + iconTransformation(extent={{-160,-108},{-140,-88}}))); + Modelica.Blocks.Sources.Constant IN66(k=0) + annotation (Placement(transformation(extent={{140,-60},{160,-40}}))); + Electrical.Branches.PwLine L2( + R=0.001, + X=0.01, + G=0, + B=0) annotation (Placement(transformation(extent={{182,6},{194,14}}))); + Electrical.Buses.Bus Bus12(angle_0=powerFlow.powerflow.bus.A5, v_0= + powerFlow.powerflow.bus.V5) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={200,10}))); + Electrical.Machines.ControlsMotors.VariableSpeedDrive.PowerElectronics.AC2DCandDC2AC_MPC + aC2DCandDC2AC_MPC( + V_b=13800, + v_0=powerFlow.powerflow.bus.V5, + angle_0=powerFlow.powerflow.bus.A5, + Rdc=0.1, + Cdc=0.00001, + m0=0.9537) + annotation (Placement(transformation(extent={{220,0},{260,20}}))); + Electrical.Machines.NonMultiDomain.Motors.ThreePhase.PSAT.NMD_MotorTypeI + nMD_MotorTypeI( + M_b=1000000, + V_b=13800, + Sup=false, + a=0, + b=0, + c=0.1) + annotation (Placement(transformation(extent={{300,0},{280,20}}))); + Electrical.Machines.ControlsMotors.VariableSpeedDrive.ControllerLogic.VoltsHertzController_MPC + voltsHertzController_MPC( + V_b=13800, + f_max=60, + f_min=0, + m0=0.9537, + Kp=0.5, + Ki=0.2, + rotor_speed_initial=1.9*Modelica.Constants.pi*60) + annotation (Placement(transformation(extent={{230,-40},{248,-20}}))); + Modelica.Blocks.Interfaces.RealOutput OUT1 + annotation (Placement(transformation(extent={{-284,80},{-264,100}}))); + Modelica.Blocks.Interfaces.RealOutput OUT2 + annotation (Placement(transformation(extent={{-284,60},{-264,80}}))); + Modelica.Blocks.Interfaces.RealOutput OUT3 + annotation (Placement(transformation(extent={{-284,40},{-264,60}}))); + Modelica.Blocks.Interfaces.RealOutput OUT4 + annotation (Placement(transformation(extent={{-284,20},{-264,40}}))); + Modelica.Blocks.Interfaces.RealOutput OUT5 + annotation (Placement(transformation(extent={{-284,0},{-264,20}}))); + Modelica.Blocks.Interfaces.RealOutput OUT6 + annotation (Placement(transformation(extent={{-284,-20},{-264,0}}))); + Modelica.Blocks.Interfaces.RealOutput OUT7 + annotation (Placement(transformation(extent={{-284,-40},{-264,-20}}))); + Modelica.Blocks.Interfaces.RealOutput OUT8 + annotation (Placement(transformation(extent={{-284,-60},{-264,-40}}))); + Modelica.Blocks.Interfaces.RealOutput OUT9 + annotation (Placement(transformation(extent={{-284,-80},{-264,-60}}))); + Modelica.Blocks.Interfaces.RealOutput OUT10 + annotation (Placement(transformation(extent={{-284,-100},{-264,-80}}))); + Modelica.Blocks.Interfaces.RealOutput OUT11 + annotation (Placement(transformation(extent={{-260,80},{-240,100}}))); + Modelica.Blocks.Interfaces.RealOutput OUT12 + annotation (Placement(transformation(extent={{-260,60},{-240,80}}))); + Modelica.Blocks.Interfaces.RealOutput OUT13 + annotation (Placement(transformation(extent={{-260,40},{-240,60}}))); + Modelica.Blocks.Interfaces.RealOutput OUT14 + annotation (Placement(transformation(extent={{-260,20},{-240,40}}))); + Modelica.Blocks.Interfaces.RealOutput OUT15 + annotation (Placement(transformation(extent={{-260,0},{-240,20}}))); + Modelica.Blocks.Interfaces.RealOutput OUT16 + annotation (Placement(transformation(extent={{-260,-20},{-240,0}}))); + Modelica.Blocks.Interfaces.RealOutput OUT17 + annotation (Placement(transformation(extent={{-260,-40},{-240,-20}}))); + Modelica.Blocks.Interfaces.RealOutput OUT18 + annotation (Placement(transformation(extent={{-260,-60},{-240,-40}}))); + Modelica.Blocks.Interfaces.RealOutput OUT19 + annotation (Placement(transformation(extent={{-260,-80},{-240,-60}}))); + Modelica.Blocks.Interfaces.RealOutput OUT20 + annotation (Placement(transformation(extent={{-260,-100},{-240,-80}}))); + Modelica.Blocks.Interfaces.RealOutput OUT21 + annotation (Placement(transformation(extent={{-240,80},{-220,100}}))); + Modelica.Blocks.Interfaces.RealOutput OUT22 + annotation (Placement(transformation(extent={{-240,60},{-220,80}}))); + Modelica.Blocks.Interfaces.RealOutput OUT23 + annotation (Placement(transformation(extent={{-240,40},{-220,60}}))); + Modelica.Blocks.Interfaces.RealOutput OUT24 + annotation (Placement(transformation(extent={{-240,20},{-220,40}}))); + Modelica.Blocks.Interfaces.RealOutput OUT25 + annotation (Placement(transformation(extent={{-240,0},{-220,20}}))); + Modelica.Blocks.Interfaces.RealOutput OUT26 + annotation (Placement(transformation(extent={{-240,-20},{-220,0}}))); + Modelica.Blocks.Interfaces.RealOutput OUT27 + annotation (Placement(transformation(extent={{-240,-40},{-220,-20}}))); + Modelica.Blocks.Interfaces.RealOutput OUT28 + annotation (Placement(transformation(extent={{-240,-60},{-220,-40}}))); + Modelica.Blocks.Interfaces.RealOutput OUT29 + annotation (Placement(transformation(extent={{-240,-80},{-220,-60}}))); + Modelica.Blocks.Interfaces.RealOutput OUT30 + annotation (Placement(transformation(extent={{-240,-100},{-220,-80}}))); + Modelica.Blocks.Interfaces.RealOutput OUT31 + annotation (Placement(transformation(extent={{-220,80},{-200,100}}))); + Modelica.Blocks.Math.Add Add10 + annotation (Placement(transformation(extent={{192,-40},{212,-20}}))); + Modelica.Blocks.Interfaces.RealInput IN7 + "Connector of Real input signal 1" annotation (Placement( + transformation(extent={{-158,-152},{-138,-132}}), + iconTransformation(extent={{-160,-160},{-140,-140}}))); + Modelica.Blocks.Sources.Constant IN77(k=0) + annotation (Placement(transformation(extent={{130,-162},{150,-142}}))); + Modelica.Blocks.Math.Add3 Add1 + annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + rotation=0, + origin={180,-146}))); + Modelica.Blocks.Sources.Constant Ratio_LTC(k=1) + annotation (Placement(transformation(extent={{130,-174},{150,-194}}))); + Electrical.Buses.Bus Bus13(angle_0=powerFlow.powerflow.bus.A13, + v_0=powerFlow.powerflow.bus.V13) + annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={196,-86}))); + Electrical.Branches.PwLine L7( + R=0.001, + X=0.01, + G=0, + B=0) annotation (Placement(transformation(extent={{174,-90},{186,-82}}))); + Electrical.Buses.Bus Bus14( + V_b=120, + angle_0=powerFlow.powerflow.bus.A14, + v_0=powerFlow.powerflow.bus.V14) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={240,-86}))); + TCL.ULTC_VoltageControl uLTC_VoltageControl( + Vbus1=13800, + Vbus2(displayUnit="V") = 120, + Vn=13800, + v_0=1, + kT=13800/120, + m0=1, + m_max=1.05, + m_min=0.95, + K=0.01) + annotation (Placement(transformation(extent={{206,-96},{226,-76}}))); + Modelica.Blocks.Interfaces.RealOutput OUT32 + annotation (Placement(transformation(extent={{-220,60},{-200,80}}))); + Modelica.Blocks.Sources.Step Load_Dip(height=-0.01, startTime=0.25) + annotation (Placement(transformation(extent={{70,-70},{80,-60}}))); + Modelica.Blocks.Math.Add Add2 + annotation (Placement(transformation(extent={{94,-64},{104,-54}}))); + Modelica.Blocks.Sources.Constant const(k=0) + annotation (Placement(transformation(extent={{308,-72},{300,-64}}))); + TCL.TCL_Building_no_noise tCL_Building_no_noise(TCL_b=4000) + annotation (Placement(transformation(extent={{260,-96},{280,-76}}))); + Modelica.Blocks.Sources.Constant const1(k=0) + annotation (Placement(transformation(extent={{308,-84},{300,-76}}))); + Modelica.Blocks.Sources.Constant const2(k=0) + annotation (Placement(transformation(extent={{308,-96},{300,-88}}))); + Modelica.Blocks.Sources.Constant const3(k=0) + annotation (Placement(transformation(extent={{308,-108},{300,-100}}))); + Electrical.Buses.Bus MOTORBUS(angle_0=powerFlow.powerflow.bus.A5, v_0= + powerFlow.powerflow.bus.V5) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={268,10}))); + equation + + + OUT1 = G2.gen.w; + OUT2 = G2.gen.delta; + OUT3 = G2.gen.Epq; + OUT4 = G2.gen.PSIkd; + OUT5 = G2.gen.PSIppq; + OUT6 = G2.sEXSMPC.simpleLagLim.state; + OUT7 = G2.sEXSMPC.leadLag.TF.x_scaled[1]; + OUT8 = G2.gASTMPC.simpleLagLim.state; + OUT9 = G2.gASTMPC.simpleLag.state; + OUT10 = G2.gASTMPC.simpleLag1.state; + OUT11 = Bus6.v; + + OUT12 =PV.rEGCA1_1.Pgen; + OUT13 =PV.rEGCA1_1.Qgen; + OUT14 =PV.rEGCA1_1.p.ir; + OUT15 =PV.rEGCA1_1.p.ii; + OUT16 = Bus8.v; + + OUT17 =BESS.rEGCA1_1.Pgen; + OUT18 =BESS.rEGCA1_1.Qgen; + OUT19 =BESS.rEGCA1_1.p.ir; + OUT20 =BESS.rEGCA1_1.p.ii; + OUT21 = Bus10.v; + + OUT22 = uLTC_VoltageControl.m; + OUT23 = Bus14.p.vr; + OUT24 = Bus14.p.vi; + + OUT25= aC2DCandDC2AC_MPC.n.ir; + OUT26= aC2DCandDC2AC_MPC.n.ii; + OUT27= aC2DCandDC2AC_MPC.P; + OUT28 = MOTORBUS.v; + + + OUT29= voltsHertzController_MPC.we; + OUT30= Bus12.v; + + OUT31 = Bus5.v; + OUT32 = Bus5.angle; + + connect(T1.p, Bus2.p) + annotation (Line(points={{-51.2,80},{-40,80}}, color={0,0,255})); + connect(Bus1.p, T1.n) + annotation (Line(points={{-80,80},{-68.8,80}}, color={0,0,255})); + connect(G1.conn, Bus1.p) + annotation (Line(points={{-91,80},{-80,80}}, color={0,0,255})); + connect(L1.n, Bus3.p) + annotation (Line(points={{-14.6,80},{0,80}}, color={0,0,255})); + connect(L1.p, Bus2.p) + annotation (Line(points={{-25.4,80},{-40,80}}, color={0,0,255})); + connect(L2_2.n, Bus4.p) annotation (Line(points={{35.4,70},{44,70},{44,80},{60, + 80}}, color={0,0,255})); + connect(L2_1.n, Bus4.p) annotation (Line(points={{35.4,90},{44,90},{44,80},{60, + 80}}, color={0,0,255})); + connect(L2_1.p, Bus3.p) annotation (Line(points={{24.6,90},{16,90},{16,80},{0, + 80}}, color={0,0,255})); + connect(L2_2.p, Bus3.p) annotation (Line(points={{24.6,70},{16,70},{16,80},{0, + 80}}, color={0,0,255})); + connect(Load1.p, Bus3.p) + annotation (Line(points={{-10,68},{-10,80},{0,80}}, color={0,0,255})); + connect(L3.p, Bus4.p) + annotation (Line(points={{80,65.4},{80,80},{60,80}}, color={0,0,255})); + connect(circuitbreaker.s, Bus5.p) + annotation (Line(points={{80,22},{80,16}}, color={0,0,255})); + connect(circuitbreaker.r, L3.n) + annotation (Line(points={{80,30},{80,54.6}}, color={0,0,255})); + connect(IN11.y, AddU1.u2) annotation (Line(points={{-95.4,4},{-82,4}}, + color={0,0,127})); + connect(IN1, AddU1.u1) annotation (Line(points={{-150,10},{-116,10},{-116,16}, + {-82,16}}, + color={0,0,127})); + + connect(IN22.y,AddU2. u2) annotation (Line(points={{-95.4,-26},{-82,-26}}, + color={0,0,127})); + connect(IN2,AddU2. u1) annotation (Line(points={{-150,-12},{-118,-12},{-118,-14}, + {-82,-14}}, + color={0,0,127})); + connect(AddU2.y, G2.Efd_ref) + annotation (Line(points={{-59,-20},{-52,-20},{-52,4},{-42,4}}, + color={0,0,127})); + connect(AddU1.y, G2.P_ref1) annotation (Line(points={{-59,10},{-52,10},{-52,16}, + {-42,16}}, color={0,0,127})); + connect(IB.p, Bus4.p) + annotation (Line(points={{100,80},{60,80}}, color={0,0,255})); + connect(Load2.p, Bus5.p) annotation (Line(points={{110,-10},{110,10},{80,10},{ + 80,16}}, + color={0,0,255})); + connect(T4.n, Bus10.p) + annotation (Line(points={{-1,-90},{-10,-90}}, color={0,0,255})); + connect(Bus6.p, T2.n) + annotation (Line(points={{-10,10},{-1,10}}, + color={0,0,255})); + connect(AddU3.y, PV.QINPUT) annotation (Line(points={{-59,-50},{-42,-50}}, + color={0,0,127})); + connect(IN33.y,AddU3. u2) + annotation (Line(points={{-95.4,-56},{-82,-56}}, color={0,0,127})); + connect(BESS.p1, Bus10.p) + annotation (Line(points={{-20,-90},{-10,-90}}, color={0,0,255})); + connect(BESS.Paux1, AddU4.y) annotation (Line(points={{-42,-84},{-54,-84},{-54, + -80},{-59,-80}}, color={0,0,127})); + connect(IN55.y, AddU5.u2) + annotation (Line(points={{-95.4,-112},{-82,-112}}, color={0,0,127})); + connect(AddU5.y, BESS.Qext1) annotation (Line(points={{-59,-106},{-52,-106},{-52, + -96},{-42,-96}}, color={0,0,127})); + connect(IN44.y, AddU4.u2) + annotation (Line(points={{-95.4,-86},{-82,-86}}, color={0,0,127})); + connect(AddU4.u1,IN4) annotation (Line(points={{-82,-74},{-100,-74},{-100,-70}, + {-116,-70},{-116,-56},{-150,-56}}, color={0,0,127})); + connect(AddU5.u1,IN5) annotation (Line(points={{-82,-100},{-116,-100},{-116,-78}, + {-150,-78}}, color={0,0,127})); + connect(G2.conn, Bus6.p) annotation (Line(points={{-19,10},{-10,10}}, + color={0,0,255})); + connect(AddU3.u1, IN3) annotation (Line(points={{-82,-44},{-118,-44},{-118,-34}, + {-150,-34}}, color={0,0,127})); + connect(PV.p1, Bus8.p) + annotation (Line(points={{-20,-50},{-10,-50}}, color={0,0,255})); + connect(Bus8.p, T3.n) + annotation (Line(points={{-10,-50},{1,-50}}, color={0,0,255})); + connect(T2.p, Bus7.p) annotation (Line(points={{21,10},{25.5,10},{25.5,10},{30, + 10}}, color={0,0,255})); + connect(T3.p, Bus9.p) + annotation (Line(points={{23,-50},{30,-50}}, color={0,0,255})); + connect(T4.p, Bus11.p) + annotation (Line(points={{21,-90},{30,-90}}, color={0,0,255})); + connect(L4.n, Bus5.p) annotation (Line(points={{49.4,10},{60,10},{60,10},{80,10}, + {80,16}}, color={0,0,255})); + connect(L5.n, Bus5.p) annotation (Line(points={{49.4,-50},{60,-50},{60,10},{80, + 10},{80,16}}, color={0,0,255})); + connect(Bus11.p, L6.p) + annotation (Line(points={{30,-90},{38.6,-90}}, color={0,0,255})); + connect(Bus9.p, L5.p) + annotation (Line(points={{30,-50},{38.6,-50}}, color={0,0,255})); + connect(L6.n, Bus5.p) annotation (Line(points={{49.4,-90},{60,-90},{60,10},{80, + 10},{80,16}}, color={0,0,255})); + connect(Bus7.p, L4.p) annotation (Line(points={{30,10},{34.3,10},{34.3,10},{38.6, + 10}}, color={0,0,255})); + connect(L2.n, Bus12.p) + annotation (Line(points={{193.4,10},{200,10}}, color={0,0,255})); + connect(L2.p, Bus5.p) + annotation (Line(points={{182.6,10},{80,10},{80,16}}, color={0,0,255})); + connect(Bus12.p, aC2DCandDC2AC_MPC.p) annotation (Line(points={{200,10}, + {220,10}}, color={0,0,255})); + connect(voltsHertzController_MPC.m, aC2DCandDC2AC_MPC.m_input) + annotation (Line(points={{244.6,-18},{244.6,-10},{249.091,-10},{ + 249.091,-2}},color={0,0,127})); + connect(voltsHertzController_MPC.Vc, aC2DCandDC2AC_MPC.Vc) annotation ( + Line(points={{235.4,-18},{235.4,-10},{230.909,-10},{230.909,-2}}, + color={0,0,127})); + connect(nMD_MotorTypeI.wr, voltsHertzController_MPC.motor_speed) + annotation (Line(points={{284,-2},{284,-26},{252,-26}}, color={0,0,127})); + connect(nMD_MotorTypeI.we, voltsHertzController_MPC.we) + annotation (Line(points={{296,-2},{296,-34},{252,-34}}, color={0,0,127})); + connect(irradianceToPower.Ppv, PV.IRR2POW) annotation (Line(points={{ + 33.5,-15},{-42,-15},{-42,-43}}, color={0,0,127})); + connect(IN66.y, Add10.u2) annotation (Line(points={{161,-50},{180,-50},{180,-36}, + {190,-36}}, color={0,0,127})); + connect(Add10.y, voltsHertzController_MPC.W_ref) + annotation (Line(points={{213,-30},{228,-30}}, color={0,0,127})); + connect(Add10.u1, IN6) annotation (Line(points={{190,-24},{126,-24},{126,-122}, + {-150,-122},{-150,-98}}, color={0,0,127})); + connect(IN77.y,Add1. u2) + annotation (Line(points={{151,-152},{160,-152},{160,-146},{168,-146}}, + color={0,0,127})); + connect(Add1.u1, IN7) annotation (Line(points={{168,-138},{156,-138},{ + 156,-136},{-132,-136},{-132,-142},{-148,-142}}, + color={0,0,127})); + connect(Ratio_LTC.y,Add1. u3) annotation (Line(points={{151,-184},{168, + -184},{168,-154}}, + color={0,0,127})); + connect(L7.n,Bus13. p) + annotation (Line(points={{185.4,-86},{196,-86}}, color={0,0,255})); + connect(L7.p, Bus5.p) annotation (Line(points={{174.6,-86},{64,-86},{64, + 0},{96,0},{96,10},{80,10},{80,16}}, + color={0,0,255})); + connect(Bus13.p,uLTC_VoltageControl. p) + annotation (Line(points={{196,-86},{205,-86}}, color={0,0,255})); + connect(uLTC_VoltageControl.n,Bus14. p) + annotation (Line(points={{227,-86},{240,-86}}, color={0,0,255})); + connect(Add1.y,uLTC_VoltageControl. v_ref) annotation (Line(points={{191, + -146},{216,-146},{216,-98}}, + color={0,0,127})); + connect(Load_Dip.y, Add2.u2) annotation (Line(points={{80.5,-65},{86,-65},{86, + -62},{93,-62}}, color={0,0,127})); + connect(sine.y, Add2.u1) annotation (Line(points={{80.5,-31},{80.5,-32},{88, + -32},{88,-56},{93,-56}}, color={0,0,127})); + connect(Add2.y, Load2.u) annotation (Line(points={{104.5,-59},{112,-59},{112, + -42},{92,-42},{92,-14.5},{101.9,-14.5}}, color={0,0,127})); + connect(Bus14.p, tCL_Building_no_noise.pwPin) + annotation (Line(points={{240,-86},{260,-86}}, color={0,0,255})); + connect(const3.y, tCL_Building_no_noise.u4) annotation (Line(points={{299.6, + -104},{288,-104},{288,-95},{281,-95}}, color={0,0,127})); + connect(const2.y, tCL_Building_no_noise.u3) annotation (Line(points={{299.6, + -92},{292,-92},{292,-91},{281,-91}}, color={0,0,127})); + connect(const1.y, tCL_Building_no_noise.u2) annotation (Line(points={{299.6, + -80},{298,-81},{281,-81}}, color={0,0,127})); + connect(const.y, tCL_Building_no_noise.u1) annotation (Line(points={{299.6,-68}, + {286,-68},{286,-77},{281,-77}}, color={0,0,127})); + connect(aC2DCandDC2AC_MPC.n, MOTORBUS.p) + annotation (Line(points={{260,10},{268,10}}, color={0,0,255})); + connect(MOTORBUS.p, nMD_MotorTypeI.p) + annotation (Line(points={{268,10},{280,10}}, color={0,0,255})); + annotation (Placement(transformation(extent={{140,-20},{160,0}})), + Placement(transformation(extent={{140,-40},{160,-20}})), + Placement(transformation(extent={{140,-60},{160,-40}})), + Placement(transformation(extent={{140,-80},{160,-60}})), + Diagram(coordinateSystem(preserveAspectRatio=false, + extent={{-140,-200},{320,140}}), graphics={ + Rectangle( + extent={{-160,30},{-134,-124}}, + lineColor={0,140,72}, + lineThickness=0.5), + Rectangle( + extent={{-128,36},{124,-124}}, + lineColor={238,46,47}, + lineThickness=0.5), + Rectangle( + extent={{-128,98},{124,38}}, + lineColor={0,128,255}, + lineThickness=0.5), + Text( + extent={{78,-106},{114,-120}}, + textColor={238,46,47}, + textString="Microgrid"), + Text( + extent={{76,58},{128,34}}, + textColor={28,108,200}, + textString="Utility Grid"), + Text( + extent={{-30,-102},{34,-124}}, + textColor={0,140,72}, + textString="Linearization Unit"), + Text( + extent={{-164,50},{-132,30}}, + textColor={0,140,72}, + textString="Inputs")}), + Documentation(info=" +

This example system shows how the preparation for resynchronization of Generator 2 to the grid. Note that at 2 seconds, a signal is triggered so voltages between buses 3 and 4 should be equal.

+

Simulate the system for 10 seconds. Variables of interest are:

+ +

Note the behavior of those variables before and after the connection of generator G2 to the main grid.

+"),experiment( + StopTime=10, + __Dymola_NumberOfIntervals=1000, + __Dymola_fixedstepsize=0.001, + __Dymola_Algorithm="Dassl"), + Icon(coordinateSystem(extent={{-140,-200},{320,140}}))); + end MPC_LTC_VSD_Original4; end MPCMotor; end Luigi_Vanfretti_Special_Package; extends Modelica.Icons.ExamplesPackage; diff --git a/OpenIPSL/Examples/TCL.mo b/OpenIPSL/Examples/TCL.mo index a279a4b8c..a0e70b24f 100644 --- a/OpenIPSL/Examples/TCL.mo +++ b/OpenIPSL/Examples/TCL.mo @@ -454,163 +454,164 @@ package TCL model TCL_Building_no_noise Interfaces.PwPin pwPin annotation (Placement(transformation(extent={{-110,-10},{-90,10}}))); - Electrical.Loads.PSAT.TCL_randominit TCL1(start0=start0_TCL1) annotation ( + Electrical.Loads.PSAT.TCL_randominit TCL1(Sn=TCL_b, + p0=P0, start0=start0_TCL1) annotation ( Placement(transformation( extent={{-10,-10},{10,10}}, rotation=90, origin={-70,70}))); - Electrical.Loads.PSAT.TCL_randominit TCL7( start0=start0_TCL7) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL7(Sn=TCL_b, p0=P0, start0=start0_TCL7) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=90, origin={50,70}))); - Electrical.Loads.PSAT.TCL_randominit TCL9( start0=start0_TCL9) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL9(Sn=TCL_b, p0=P0, start0=start0_TCL9) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=90, origin={-70,30}))); - Electrical.Loads.PSAT.TCL_randominit TCL10( start0=start0_TCL10) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL10(Sn=TCL_b, p0=P0, start0=start0_TCL10) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=90, origin={-50,30}))); - Electrical.Loads.PSAT.TCL_randominit TCL11( start0=start0_TCL11) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL11(Sn=TCL_b, p0=P0, start0=start0_TCL11) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=90, origin={-30,30}))); - Electrical.Loads.PSAT.TCL_randominit TCL13( start0=start0_TCL13) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL13(Sn=TCL_b, p0=P0, start0=start0_TCL13) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=90, origin={10,30}))); - Electrical.Loads.PSAT.TCL_randominit TCL2( start0=start0_TCL2) + Electrical.Loads.PSAT.TCL_randominit TCL2(Sn=TCL_b, p0=P0, start0=start0_TCL2) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=90, origin={-50,70}))); - Electrical.Loads.PSAT.TCL_randominit TCL3( start0=start0_TCL3) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL3(Sn=TCL_b, p0=P0, start0=start0_TCL3) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=90, origin={-30,70}))); - Electrical.Loads.PSAT.TCL_randominit TCL4( start0=start0_TCL4) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL4(Sn=TCL_b, p0=P0, start0=start0_TCL4) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=90, origin={-10,70}))); - Electrical.Loads.PSAT.TCL_randominit TCL5( start0=start0_TCL5) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL5(Sn=TCL_b, p0=P0, start0=start0_TCL5) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=90, origin={10,70}))); - Electrical.Loads.PSAT.TCL_randominit TCL6( start0=start0_TCL6) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL6(Sn=TCL_b, p0=P0, start0=start0_TCL6) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=90, origin={30,70}))); - Electrical.Loads.PSAT.TCL_randominit TCL12( start0=start0_TCL12) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL12(Sn=TCL_b, p0=P0, start0=start0_TCL12) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=90, origin={-10,30}))); - Electrical.Loads.PSAT.TCL_randominit TCL14( start0=start0_TCL14) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL14(Sn=TCL_b, p0=P0, start0=start0_TCL14) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=90, origin={30,30}))); - Electrical.Loads.PSAT.TCL_randominit TCL8( start0=start0_TCL8) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL8(Sn=TCL_b, p0=P0, start0=start0_TCL8) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=90, origin={70,70}))); - Electrical.Loads.PSAT.TCL_randominit TCL15( start0=start0_TCL15) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL15(Sn=TCL_b, p0=P0, start0=start0_TCL15) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=90, origin={50,30}))); - Electrical.Loads.PSAT.TCL_randominit TCL16( start0=start0_TCL16) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL16(Sn=TCL_b, p0=P0, start0=start0_TCL16) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=90, origin={70,30}))); - Electrical.Loads.PSAT.TCL_randominit TCL17( start0=start0_TCL17) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL17(Sn=TCL_b, p0=P0, start0=start0_TCL17) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=270, origin={-70,-30}))); - Electrical.Loads.PSAT.TCL_randominit TCL18( start0=start0_TCL18) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL18(Sn=TCL_b, p0=P0, start0=start0_TCL18) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=270, origin={-50,-30}))); - Electrical.Loads.PSAT.TCL_randominit TCL19( start0=start0_TCL19) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL19(Sn=TCL_b, p0=P0, start0=start0_TCL19) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=270, origin={-30,-30}))); - Electrical.Loads.PSAT.TCL_randominit TCL21( start0=start0_TCL21) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL21(Sn=TCL_b, p0=P0, start0=start0_TCL21) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=270, origin={10,-30}))); - Electrical.Loads.PSAT.TCL_randominit TCL20( start0=start0_TCL20) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL20(Sn=TCL_b, p0=P0, start0=start0_TCL20) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=270, origin={-10,-30}))); - Electrical.Loads.PSAT.TCL_randominit TCL22( start0=start0_TCL22) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL22(Sn=TCL_b, p0=P0, start0=start0_TCL22) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=270, origin={30,-30}))); - Electrical.Loads.PSAT.TCL_randominit TCL23( start0=start0_TCL23) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL23(Sn=TCL_b, p0=P0, start0=start0_TCL23) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=270, origin={50,-30}))); - Electrical.Loads.PSAT.TCL_randominit TCL24( start0=start0_TCL24) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL24(Sn=TCL_b, p0=P0, start0=start0_TCL24) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=270, origin={70,-30}))); - Electrical.Loads.PSAT.TCL_randominit TCL25( start0=start0_TCL25) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL25(Sn=TCL_b, p0=P0, start0=start0_TCL25) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=270, origin={-70,-70}))); - Electrical.Loads.PSAT.TCL_randominit TCL26( start0=start0_TCL26) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL26(Sn=TCL_b, p0=P0, start0=start0_TCL26) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=270, origin={-50,-70}))); - Electrical.Loads.PSAT.TCL_randominit TCL27( start0=start0_TCL27) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL27(Sn=TCL_b, p0=P0, start0=start0_TCL27) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=270, origin={-30,-70}))); - Electrical.Loads.PSAT.TCL_randominit TCL29( start0=start0_TCL29) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL29(Sn=TCL_b, p0=P0, start0=start0_TCL29) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=270, origin={10,-70}))); - Electrical.Loads.PSAT.TCL_randominit TCL28( start0=start0_TCL28) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL28(Sn=TCL_b, p0=P0, start0=start0_TCL28) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=270, origin={-10,-70}))); - Electrical.Loads.PSAT.TCL_randominit TCL30( start0=start0_TCL30) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL30(Sn=TCL_b, p0=P0, start0=start0_TCL30) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=270, origin={30,-70}))); - Electrical.Loads.PSAT.TCL_randominit TCL31( start0=start0_TCL31) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL31(Sn=TCL_b, p0=P0, start0=start0_TCL31) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=270, origin={50,-70}))); - Electrical.Loads.PSAT.TCL_randominit TCL32( start0=start0_TCL32) annotation (Placement( + Electrical.Loads.PSAT.TCL_randominit TCL32(Sn=TCL_b, p0=P0, start0=start0_TCL32) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=270,