├── LICENSE ├── MicroGrid ├── Control │ ├── Examples │ │ ├── PLL_Example.mo │ │ ├── PWM_1Ph_Example.mo │ │ ├── PWM_3Ph_Example.mo │ │ ├── package.mo │ │ └── package.order │ ├── Feedback │ │ ├── BatteryControl.mo │ │ ├── BoostControl.mo │ │ ├── StateFeedback.mo │ │ ├── package.mo │ │ └── package.order │ ├── Interfaces │ │ ├── Control2Real.mo │ │ ├── Real2Control.mo │ │ ├── SignalBus.mo │ │ ├── abc2dq.mo │ │ ├── clarke.mo │ │ ├── dq2abc.mo │ │ ├── invClarke.mo │ │ ├── invPark.mo │ │ ├── package.mo │ │ ├── package.order │ │ └── park.mo │ ├── Modulation │ │ ├── SawtoothPWM.mo │ │ ├── TriangPWM_1Ph.mo │ │ ├── TriangPWM_3Ph.mo │ │ ├── package.mo │ │ └── package.order │ ├── PhaseLockedLoop │ │ ├── DSOGI_PLL.mo │ │ ├── Utilities │ │ │ ├── IntegratorWithReset.mo │ │ │ ├── SOGI.mo │ │ │ ├── TOSSI.mo │ │ │ ├── package.mo │ │ │ └── package.order │ │ ├── package.mo │ │ └── package.order │ ├── RefGenerators │ │ ├── mppt.mo │ │ ├── package.mo │ │ └── package.order │ ├── package.mo │ └── package.order ├── Electrical │ ├── BasicComponents │ │ ├── capacitor.mo │ │ ├── diode.mo │ │ ├── ground.mo │ │ ├── inductor.mo │ │ ├── package.mo │ │ ├── package.order │ │ ├── resistor.mo │ │ └── switch.mo │ ├── Branches │ │ ├── Breakers │ │ │ ├── package.mo │ │ │ ├── package.order │ │ │ └── threePhaseBreaker.mo │ │ ├── Filters │ │ │ ├── BranchLCL.mo │ │ │ ├── BranchRL.mo │ │ │ ├── ThreePhaseLCL.mo │ │ │ ├── ThreePhaseRL.mo │ │ │ ├── package.mo │ │ │ └── package.order │ │ ├── Lines │ │ │ ├── package.mo │ │ │ └── package.order │ │ ├── Transformers │ │ │ ├── package.mo │ │ │ └── package.order │ │ ├── package.mo │ │ └── package.order │ ├── Converters │ │ ├── Boost.mo │ │ ├── BuckBoost.mo │ │ ├── VSC01.mo │ │ ├── VSC02.mo │ │ ├── package.mo │ │ └── package.order │ ├── Examples │ │ ├── Boost_Example.mo │ │ ├── PV_Example.mo │ │ ├── package.mo │ │ └── package.order │ ├── Interfaces │ │ ├── NegativePin.mo │ │ ├── OnePort.mo │ │ ├── PositivePin.mo │ │ ├── Wave2Phasor.mo │ │ ├── package.mo │ │ └── package.order │ ├── Sources │ │ ├── currentDC.mo │ │ ├── gateSignal.mo │ │ ├── package.mo │ │ ├── package.order │ │ ├── singlePhaseAC.mo │ │ ├── threePhaseAC.mo │ │ └── voltageDC.mo │ ├── package.mo │ └── package.order ├── Examples │ ├── MicroGrid_Example.mo │ ├── VSC_Inverter │ │ ├── AverageSystem.mo │ │ ├── Export │ │ │ ├── AveragePlant.mo │ │ │ ├── Controller.mo │ │ │ ├── SwitchingPlant.mo │ │ │ ├── package.mo │ │ │ └── package.order │ │ ├── SwitchingSystem.mo │ │ ├── package.mo │ │ └── package.order │ ├── package.mo │ └── package.order ├── PhotoVoltaics │ ├── PV_module.mo │ ├── Records │ │ ├── KPV_235_PE.mo │ │ ├── KPV_240_PE.mo │ │ ├── LG275S1C_G4.mo │ │ ├── LG280S1C_G4.mo │ │ ├── LG285S1C_G4.mo │ │ ├── LG300N1C_G4.mo │ │ ├── LG305N1C_B3.mo │ │ ├── LG305N1C_G4.mo │ │ ├── LG310N1C_G4.mo │ │ ├── LG315N1C_G4.mo │ │ ├── LG320N1C_G4.mo │ │ ├── LG335S2W_G4.mo │ │ ├── LG340S2W_G4.mo │ │ ├── LG360N2W_B3.mo │ │ ├── LG365N2W_G4.mo │ │ ├── LG370N2W_G4.mo │ │ ├── LG375N2W_G4.mo │ │ ├── ModuleData.mo │ │ ├── NU_RD260.mo │ │ ├── SC_195_72M.mo │ │ ├── SC_200_72M.mo │ │ ├── SC_205_72M.mo │ │ ├── SHARP_NU_R0_E3E.mo │ │ ├── SHARP_NU_R5_ESZ.mo │ │ ├── SHARP_NU_RD260.mo │ │ ├── SHARP_NU_RD280.mo │ │ ├── SHARP_NU_RD285.mo │ │ ├── SHARP_NU_S0_E3E.mo │ │ ├── SHARP_NU_S0_ESZ.mo │ │ ├── SHARP_NU_S5_E3E.mo │ │ ├── SPR_E19_320.mo │ │ ├── SPR_E20_327.mo │ │ ├── SW_250_MONO.mo │ │ ├── SW_260_POLY.mo │ │ ├── SW_285_MONO.mo │ │ ├── SW_290_MONO.mo │ │ ├── SW_300_MONO.mo │ │ ├── SW_395_MONO.mo │ │ ├── TSM_200_DC01A.mo │ │ ├── TSM_230_PC05.mo │ │ ├── package.mo │ │ └── package.order │ ├── package.mo │ └── package.order ├── Sensors │ ├── CurrentSensor.mo │ ├── Interfaces │ │ ├── Real2Sensor.mo │ │ ├── Sensor2Real.mo │ │ ├── SignalBus.mo │ │ ├── package.mo │ │ └── package.order │ ├── VoltageSensor.mo │ ├── package.mo │ ├── package.order │ ├── threePhaseCurrentSensor.mo │ └── threePhaseVoltageSensor.mo ├── Storage │ ├── Battery.mo │ ├── package.mo │ └── package.order ├── package.mo └── package.order └── README.md /MicroGrid/Control/Examples/PLL_Example.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Control.Examples; 2 | model PLL_Example 3 | extends Modelica.Icons.Example; 4 | Electrical.Sources.threePhaseAC threePhaseAC1 annotation(Placement(visible = true, transformation(origin = {-60, -27.139}, extent = {{-17.139, -17.139}, {17.139, 17.139}}, rotation = -90))); 5 | Electrical.BasicComponents.ground ground1 annotation(Placement(visible = true, transformation(origin = {-60, -67.417}, extent = {{-12.583, -12.583}, {12.583, 12.583}}, rotation = 0))); 6 | Electrical.BasicComponents.resistor resistor1 annotation(Placement(visible = true, transformation(origin = {-70, 60}, extent = {{-12.388, -12.388}, {12.388, 12.388}}, rotation = -270))); 7 | Electrical.BasicComponents.resistor resistor2 annotation(Placement(visible = true, transformation(origin = {-60, 60}, extent = {{-12.388, -12.388}, {12.388, 12.388}}, rotation = -270))); 8 | Electrical.BasicComponents.resistor resistor3 annotation(Placement(visible = true, transformation(origin = {-50, 60}, extent = {{-12.388, -12.388}, {12.388, 12.388}}, rotation = -270))); 9 | Electrical.BasicComponents.ground ground2 annotation(Placement(visible = true, transformation(origin = {-60, 92.583}, extent = {{-12.583, -12.583}, {12.583, 12.583}}, rotation = -540))); 10 | Sensors.VoltageSensor voltageSensor1 annotation(Placement(visible = true, transformation(origin = {-20, -10}, extent = {{10, -10}, {-10, 10}}, rotation = 90))); 11 | Sensors.VoltageSensor voltageSensor2 annotation(Placement(visible = true, transformation(origin = {0, 10}, extent = {{10, -10}, {-10, 10}}, rotation = 90))); 12 | Sensors.VoltageSensor voltageSensor3 annotation(Placement(visible = true, transformation(origin = {20, 30}, extent = {{10, -10}, {-10, 10}}, rotation = 90))); 13 | PhaseLockedLoop.DSOGI_PLL dSOGI_PLL1 annotation(Placement(visible = true, transformation(origin = {57.58, -35.577}, extent = {{17.58, -17.58}, {-17.58, 17.58}}, rotation = 90))); 14 | Modelica.Blocks.Interaction.Show.RealValue V_D annotation(Placement(visible = true, transformation(origin = {-8.25, -66.475}, extent = {{10, -10}, {-10, 10}}, rotation = 0))); 15 | Modelica.Blocks.Interaction.Show.RealValue V_Q annotation(Placement(visible = true, transformation(origin = {-8.25, -76.579}, extent = {{10, -10}, {-10, 10}}, rotation = 0))); 16 | Interfaces.Control2Real control2Real1 annotation(Placement(visible = true, transformation(origin = {21.75, -66.39}, extent = {{10, -10}, {-10, 10}}, rotation = 0))); 17 | Interfaces.Control2Real control2Real2 annotation(Placement(visible = true, transformation(origin = {21.75, -76.579}, extent = {{10, -10}, {-10, 10}}, rotation = 0))); 18 | Interfaces.Control2Real control2Real3 annotation(Placement(visible = true, transformation(origin = {21.75, -87.301}, extent = {{10, -10}, {-10, 10}}, rotation = 0))); 19 | Modelica.Blocks.Interaction.Show.RealValue V_Q1 annotation(Placement(visible = true, transformation(origin = {-8.25, -87.301}, extent = {{10, -10}, {-10, 10}}, rotation = 0))); 20 | equation 21 | connect(resistor1.n, ground2.p) annotation(Line(visible = true, origin = {-65, 75.978}, points = {{-5, -6.067}, {-5, 1.022}, {5, 1.022}, {5, 4.022}}, color = {0, 0, 255})); 22 | connect(resistor3.n, ground2.p) annotation(Line(visible = true, origin = {-55, 75.978}, points = {{5, -6.067}, {5, 1.022}, {-5, 1.022}, {-5, 4.022}}, color = {0, 0, 255})); 23 | connect(resistor2.n, ground2.p) annotation(Line(visible = true, origin = {-60, 74.955}, points = {{0, -5.045}, {-0, 5.045}}, color = {0, 0, 255})); 24 | connect(resistor2.p, threePhaseAC1.p2) annotation(Line(visible = true, origin = {-60, 19.702}, points = {{0, 30.387}, {-0, -30.387}}, color = {0, 0, 255})); 25 | connect(resistor3.p, threePhaseAC1.p1) annotation(Line(visible = true, origin = {-49.858, 6.887}, points = {{-0.142, 43.203}, {-0.142, -12.815}, {0.142, -12.815}, {0.142, -17.572}}, color = {0, 0, 255})); 26 | connect(ground1.p, threePhaseAC1.gnd) annotation(Line(visible = true, origin = {-60, -49.213}, points = {{0, -5.621}, {0, 5.621}}, color = {0, 0, 255})); 27 | connect(threePhaseAC1.gnd, voltageSensor1.n) annotation(Line(visible = true, origin = {-40, -40.073}, points = {{-20, -3.52}, {-20, -8.276}, {20, -8.276}, {20, 20.073}}, color = {0, 0, 255})); 28 | connect(threePhaseAC1.gnd, voltageSensor2.n) annotation(Line(visible = true, origin = {-30, -35.073}, points = {{-30, -8.52}, {-30, -13.276}, {30, -13.276}, {30, 35.073}}, color = {0, 0, 255})); 29 | connect(threePhaseAC1.gnd, voltageSensor3.n) annotation(Line(visible = true, origin = {-20, -30.073}, points = {{-40, -13.52}, {-40, -18.276}, {40, -18.276}, {40, 50.073}}, color = {0, 0, 255})); 30 | connect(voltageSensor1.p, threePhaseAC1.p1) annotation(Line(visible = true, origin = {-34.858, -1.171}, points = {{14.858, 1.171}, {14.858, 4.171}, {-14.858, 4.171}, {-14.858, -9.514}}, color = {0, 0, 255})); 31 | connect(voltageSensor2.p, threePhaseAC1.p2) annotation(Line(visible = true, origin = {-30, 13.829}, points = {{30, 6.171}, {30, 9.171}, {-30, 9.171}, {-30, -24.514}}, color = {0, 0, 255})); 32 | connect(voltageSensor1.voltSignal, dSOGI_PLL1.vA) annotation(Line(visible = true, origin = {27.358, -13.026}, points = {{-38.008, 3.026}, {19.004, 3.026}, {19.004, -6.053}}, color = {255, 0, 0})); 33 | connect(voltageSensor2.voltSignal, dSOGI_PLL1.vB) annotation(Line(visible = true, origin = {41.894, 0.275}, points = {{-32.544, 9.725}, {16.272, 9.725}, {16.272, -19.45}}, color = {255, 0, 0})); 34 | connect(voltageSensor3.voltSignal, dSOGI_PLL1.vC) annotation(Line(visible = true, origin = {56.374, 13.642}, points = {{-27.024, 16.358}, {13.512, 16.358}, {13.512, -32.717}}, color = {255, 0, 0})); 35 | connect(threePhaseAC1.p3, resistor1.p) annotation(Line(visible = true, origin = {-70.142, 32.157}, points = {{-0.142, -42.843}, {-0.142, 12.455}, {0.142, 12.455}, {0.142, 17.933}}, color = {0, 0, 255})); 36 | connect(voltageSensor3.p, threePhaseAC1.p3) annotation(Line(visible = true, origin = {-25.142, 28.829}, points = {{45.142, 11.171}, {45.142, 14.171}, {-45.142, 14.171}, {-45.142, -39.514}}, color = {0, 0, 255})); 37 | connect(V_D.numberPort, control2Real1.OutputReal) annotation(Line(visible = true, origin = {8.125, -66.433}, points = {{-4.875, -0.042}, {0.625, -0.043}, {0.625, 0.043}, {3.625, 0.043}}, color = {1, 37, 163})); 38 | connect(V_Q.numberPort, control2Real2.OutputReal) annotation(Line(visible = true, origin = {7.5, -76.579}, points = {{-4.25, 0}, {4.25, 0}}, color = {1, 37, 163})); 39 | connect(control2Real1.InputSignal, dSOGI_PLL1.vD) annotation(Line(visible = true, origin = {51.237, -61.287}, points = {{-20.387, -5.203}, {-4.792, -5.203}, {-4.792, 9.286}}, color = {0, 128, 0})); 40 | connect(control2Real2.InputSignal, dSOGI_PLL1.vQ) annotation(Line(visible = true, origin = {58.883, -68.052}, points = {{-28.033, -8.627}, {-0.42, -8.627}, {-0.42, 16.135}}, color = {0, 128, 0})); 41 | connect(dSOGI_PLL1.Delta, control2Real3.InputSignal) annotation(Line(visible = true, origin = {73.486, -59.867}, points = {{-3.6, 7.806}, {-3.486, -7.985}, {-3.486, -27.534}, {-42.636, -27.534}}, color = {0, 128, 0})); 42 | connect(V_Q1.numberPort, control2Real3.OutputReal) annotation(Line(visible = true, origin = {7.5, -87.301}, points = {{-4.25, 0}, {4.25, 0}}, color = {1, 37, 163})); 43 | annotation(experiment(StopTime = 1.0)); 44 | end PLL_Example; 45 | -------------------------------------------------------------------------------- /MicroGrid/Control/Examples/PWM_1Ph_Example.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Control.Examples; 2 | model PWM_1Ph_Example 3 | extends Modelica.Icons.Example; 4 | Modulation.TriangPWM_1Ph triangPWM_1Ph1 annotation(Placement(visible = true, transformation(origin = {30, 13.056}, extent = {{-13.056, -13.056}, {13.056, 13.056}}, rotation = 0))); 5 | Modelica.Blocks.Sources.Sine sine1(freqHz = 60, amplitude = 0.8) annotation(Placement(visible = true, transformation(origin = {-50, 13.053}, extent = {{-13.053, -13.053}, {13.053, 13.053}}, rotation = 0))); 6 | Interfaces.Real2Control real2Control1 annotation(Placement(visible = true, transformation(origin = {-9.277, 12.887}, extent = {{-12.887, -12.887}, {12.887, 12.887}}, rotation = 0))); 7 | equation 8 | connect(sine1.y, real2Control1.InputReal) annotation(Line(visible = true, origin = {-26.712, 12.97}, points = {{-8.93, 0.083}, {1.547, 0.083}, {1.547, -0.083}, {5.836, -0.083}}, color = {1, 37, 163})); 9 | connect(real2Control1.OutputSignal, triangPWM_1Ph1.m_index) annotation(Line(visible = true, origin = {12.137, 12.971}, points = {{-9.172, 0.046}, {1.791, 0.046}, {1.791, -0.046}, {5.59, -0.046}}, color = {0, 128, 0})); 10 | annotation(experiment(StopTime = 0.1)); 11 | end PWM_1Ph_Example; 12 | -------------------------------------------------------------------------------- /MicroGrid/Control/Examples/PWM_3Ph_Example.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Control.Examples; 2 | model PWM_3Ph_Example 3 | extends Modelica.Icons.Example; 4 | Modelica.Blocks.Sources.Sine sine1(freqHz = 60, amplitude = 0.8) annotation(Placement(visible = true, transformation(origin = {-40, -76.843}, extent = {{-13.053, -13.053}, {13.053, 13.053}}, rotation = -270))); 5 | Interfaces.Real2Control real2Control1 annotation(Placement(visible = true, transformation(origin = {-40, -33.79}, extent = {{-12.887, -12.887}, {12.887, 12.887}}, rotation = -270))); 6 | Modelica.Blocks.Sources.Sine sine2(freqHz = 60, amplitude = 0.8, phase = -2.0943951023932) annotation(Placement(visible = true, transformation(origin = {0, -76.895}, extent = {{-13.053, -13.053}, {13.053, 13.053}}, rotation = -270))); 7 | Interfaces.Real2Control real2Control2 annotation(Placement(visible = true, transformation(origin = {0, -33.842}, extent = {{-12.887, -12.887}, {12.887, 12.887}}, rotation = -270))); 8 | Modelica.Blocks.Sources.Sine sine3(freqHz = 60, amplitude = 0.8, phase = -4.18879020478639) annotation(Placement(visible = true, transformation(origin = {40, -76.947}, extent = {{-13.053, -13.053}, {13.053, 13.053}}, rotation = -270))); 9 | Interfaces.Real2Control real2Control3 annotation(Placement(visible = true, transformation(origin = {40, -33.894}, extent = {{-12.887, -12.887}, {12.887, 12.887}}, rotation = -270))); 10 | Electrical.Converters.VSC01 switchedVSC1(g_switch=1e-5, f_s=1e3) annotation ( 11 | Placement(visible=true, transformation( 12 | origin={0,20}, 13 | extent={{-20,-20},{20,20}}, 14 | rotation=0))); 15 | Electrical.Sources.voltageDC voltageDC1(V = 400) annotation(Placement(visible = true, transformation(origin = {55, 20}, extent = {{-20, -20}, {20, 20}}, rotation = -90))); 16 | Electrical.BasicComponents.ground ground1 annotation(Placement(visible = true, transformation(origin = {-93.702, 20}, extent = {{-10, -10}, {10, 10}}, rotation = -90))); 17 | Electrical.BasicComponents.resistor resistor1 annotation(Placement(visible = true, transformation(origin = {-50, 35.975}, extent = {{10, -10}, {-10, 10}}, rotation = 0))); 18 | Electrical.BasicComponents.resistor resistor2 annotation(Placement(visible = true, transformation(origin = {-50, 20}, extent = {{10, -10}, {-10, 10}}, rotation = 0))); 19 | Electrical.BasicComponents.resistor resistor3 annotation(Placement(visible = true, transformation(origin = {-50, 3.307}, extent = {{10, -10}, {-10, 10}}, rotation = 0))); 20 | equation 21 | connect(sine1.y, real2Control1.InputReal) annotation(Line(visible = true, origin = {-40, -53.936}, points={{0, 22 | -8.5487},{0,8.5477}}, color = {1, 37, 163})); 23 | connect(sine2.y, real2Control2.InputReal) annotation(Line(visible = true, origin = {0, -53.988}, points={{0, 24 | -8.5487},{0,8.5477}}, color = {1, 37, 163})); 25 | connect(sine3.y, real2Control3.InputReal) annotation(Line(visible = true, origin = {40, -54.041}, points={{0, 26 | -8.5477},{0,8.5487}}, color = {1, 37, 163})); 27 | connect(real2Control1.OutputSignal, switchedVSC1.switching1) annotation(Line(visible = true, origin = {-25.064, -10.209}, points={{ 28 | -15.0649,-11.3383},{-15.0649,0.209},{15.064,0.209},{15.064,10.9218}}, color = {0, 128, 0})); 29 | connect(real2Control2.OutputSignal, switchedVSC1.switching2) annotation(Line(visible = true, origin = {-0.064, -6.966}, points={{ 30 | -0.06487,-14.6333},{-0.06487,3.516},{0.064,3.516},{0.064,7.601}}, color = {0, 128, 0})); 31 | connect(real2Control3.OutputSignal, switchedVSC1.switching3) annotation(Line(visible = true, origin = {25.146, -10.312}, points={{14.7251, 32 | -11.3393},{14.7251,0.312},{-14.7246,0.312},{-14.7246,10.7138}}, color = {0, 128, 0})); 33 | connect(switchedVSC1.vdc_n, voltageDC1.n) annotation(Line(visible = true, origin = {35.097, 0.943}, points={{ 34 | -16.5098,2.414},{-11.647,2.414},{-11.647,-3.943},{19.903,-3.943},{ 35 | 19.903,3.057}}, color = {0, 0, 255})); 36 | connect(switchedVSC1.vdc_p, voltageDC1.p) annotation(Line(visible = true, origin = {35.082, 38.933}, points={{ 37 | -16.5726,-2.601},{-11.632,-2.601},{-11.632,4.067},{19.918,4.067},{ 38 | 19.918,-2.933}}, color = {0, 0, 255})); 39 | connect(resistor1.p, switchedVSC1.p1) annotation(Line(visible = true, origin = {-26.852, 36.309}, points={{-15.148, 40 | -0.334},{3.402,-0.334},{3.402,0.334},{8.3426,0.334}}, color = {0, 0, 255})); 41 | connect(resistor2.p, switchedVSC1.p2) annotation(Line(visible = true, origin = {-27.008, 20.156}, points={{-14.992, 42 | -0.156},{3.558,-0.156},{3.558,0.155},{7.8764,0.155}}, color = {0, 0, 255})); 43 | connect(resistor3.p, switchedVSC1.p3) annotation(Line(visible = true, origin = {-27.027, 3.653}, points={{-14.973, 44 | -0.346},{3.577,-0.346},{3.577,0.347},{7.8176,0.347}}, color = {0, 0, 255})); 45 | connect(resistor1.n, ground1.p) annotation(Line(visible = true, origin = {-75.777, 27.987}, points={{17.777, 46 | 7.988},{-4.926,7.988},{-4.926,-7.987},{-7.925,-7.987}}, color = {0, 0, 255})); 47 | connect(resistor2.n, ground1.p) annotation(Line(visible = true, origin = {-70.851, 20}, points = {{12.851, 0}, {-12.851, 0}}, color = {0, 0, 255})); 48 | connect(resistor3.n, ground1.p) annotation(Line(visible = true, origin = {-75.777, 11.653}, points={{17.777, 49 | -8.346},{-4.926,-8.346},{-4.926,8.347},{-7.925,8.347}}, color = {0, 0, 255})); 50 | annotation(experiment(StopTime = 0.1)); 51 | end PWM_3Ph_Example; 52 | -------------------------------------------------------------------------------- /MicroGrid/Control/Examples/package.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Control; 2 | package Examples 3 | extends Modelica.Icons.ExamplesPackage; 4 | end Examples; 5 | -------------------------------------------------------------------------------- /MicroGrid/Control/Examples/package.order: -------------------------------------------------------------------------------- 1 | PWM_1Ph_Example 2 | PWM_3Ph_Example 3 | PLL_Example 4 | -------------------------------------------------------------------------------- /MicroGrid/Control/Feedback/BatteryControl.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Control.Feedback; 2 | model BatteryControl 3 | extends Modelica.Electrical.PowerConverters.Icons.Control; 4 | end BatteryControl; 5 | -------------------------------------------------------------------------------- /MicroGrid/Control/Feedback/BoostControl.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Control.Feedback; 2 | model BoostControl 3 | extends Modelica.Electrical.PowerConverters.Icons.Control; 4 | parameter Real Gain = 1; 5 | parameter Real TimeCons = 1; 6 | Interfaces.SignalBus V_ref annotation(Placement(visible = true, transformation(origin = {-95, -40}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {-92.53, -45.016}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 7 | Interfaces.SignalBus DutyRatio annotation(Placement(visible = true, transformation(origin = {155.084, 0}, extent = {{-14.916, -14.916}, {14.916, 14.916}}, rotation = 0), iconTransformation(origin = {94.881, -2.333}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 8 | Interfaces.Control2Real control2Real1 annotation(Placement(visible = true, transformation(origin = {-65, -40}, extent = {{-15, -15}, {15, 15}}, rotation = 0))); 9 | Sensors.Interfaces.SignalBus V_measured annotation(Placement(visible = true, transformation(origin = {-95, 40}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {-92.547, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 10 | Sensors.Interfaces.Sensor2Real sensor2Real1 annotation(Placement(visible = true, transformation(origin = {-65, 40}, extent = {{-15, -15}, {15, 15}}, rotation = 0))); 11 | Modelica.Blocks.Math.Feedback feedback1 annotation(Placement(visible = true, transformation(origin = {-7.197, -0}, extent = {{-15, 15}, {15, -15}}, rotation = 0))); 12 | Modelica.Blocks.Continuous.PI PI(k = Gain, T = TimeCons, initType = Modelica.Blocks.Types.Init.InitialOutput, y_start = 0) annotation(Placement(visible = true, transformation(origin = {33.07, 0}, extent = {{-15, -15}, {15, 15}}, rotation = 0))); 13 | Interfaces.Real2Control real2Control1 annotation(Placement(visible = true, transformation(origin = {122.779, -0}, extent = {{-15.041, -15.041}, {15.041, 15.041}}, rotation = -360))); 14 | Modelica.Blocks.Math.Gain gain1(k = -1) annotation(Placement(visible = true, transformation(origin = {82.826, -0}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 15 | equation 16 | connect(V_ref, control2Real1.InputSignal) annotation(Line(visible = true, origin = {-89.55, -40.1}, points = {{-5.45, 0.1}, {-5.45, -0.05}, {10.9, -0.05}}, color = {0, 128, 0})); 17 | connect(V_measured, sensor2Real1.InputSignal) annotation(Line(visible = true, origin = {-89.55, 39.9}, points = {{-5.45, 0.1}, {-5.45, -0.05}, {10.9, -0.05}}, color = {255, 0, 0})); 18 | connect(real2Control1.OutputSignal, DutyRatio) annotation(Line(visible = true, origin = {142.622, 0.075}, points = {{-5.554, 0.075}, {-3.454, 0.075}, {-3.454, -0.075}, {12.462, -0.075}}, color = {0, 128, 0})); 19 | connect(sensor2Real1.OutputReal, feedback1.u2) annotation(Line(visible = true, origin = {-21.465, 30.667}, points = {{-28.535, 9.333}, {14.268, 9.333}, {14.268, -18.667}}, color = {1, 37, 163})); 20 | connect(control2Real1.OutputReal, feedback1.u1) annotation(Line(visible = true, origin = {-34.714, -20}, points = {{-15.286, -20}, {-0.115, -20}, {-0.115, 20}, {15.517, 20}}, color = {1, 37, 163})); 21 | connect(feedback1.y, PI.u) annotation(Line(visible = true, origin = {10.686, -0}, points = {{-4.384, -0}, {4.384, 0}}, color = {1, 37, 163})); 22 | connect(PI.y, gain1.u) annotation(Line(visible = true, origin = {60.198, -0}, points = {{-10.628, 0}, {10.628, -0}}, color = {1, 37, 163})); 23 | connect(gain1.y, real2Control1.InputReal) annotation(Line(visible = true, origin = {101.534, -0}, points = {{-7.708, 0}, {7.708, -0}}, color = {1, 37, 163})); 24 | annotation(Diagram(coordinateSystem(extent = {{-100, -100}, {160, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10})), Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), graphics={ Text(visible = true, origin = {4.214, -1.926}, extent = {{-65.786, -38.074}, {65.786, 38.074}}, textString = "BoostControl")})); 25 | end BoostControl; 26 | -------------------------------------------------------------------------------- /MicroGrid/Control/Feedback/package.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Control; 2 | package Feedback 3 | extends Modelica.Icons.Package; 4 | end Feedback; 5 | -------------------------------------------------------------------------------- /MicroGrid/Control/Feedback/package.order: -------------------------------------------------------------------------------- 1 | BatteryControl 2 | BoostControl 3 | StateFeedback 4 | -------------------------------------------------------------------------------- /MicroGrid/Control/Interfaces/Control2Real.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Control.Interfaces; 2 | model Control2Real 3 | Modelica.Blocks.Interfaces.RealOutput OutputReal annotation(Placement(transformation(extent = {{90, -10}, {110, 10}}), iconTransformation(extent = {{90, -10}, {110, 10}}))); 4 | MicroGrid.Control.Interfaces.SignalBus InputSignal annotation(Placement(transformation(extent = {{-110, -16}, {-72, 14}}))); 5 | equation 6 | InputSignal.sensorSignal = OutputReal; 7 | annotation(Icon(graphics={ Rectangle(extent = {{-92, 28}, {92, -28}}, lineColor = {0, 140, 72}, 8 | lineThickness = 0.5), Polygon(points = {{-80, 0}, {-80, 0}}, lineColor = {28, 108, 200}), Polygon(points = {{90, 0}, {72, 2}, {-86, 18}, {-86, -20}, {90, 0}}, lineColor = {0, 140, 72}, fillColor = {28, 108, 200}, 9 | fillPattern = FillPattern.CrossDiag)})); 10 | end Control2Real; 11 | -------------------------------------------------------------------------------- /MicroGrid/Control/Interfaces/Real2Control.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Control.Interfaces; 2 | model Real2Control 3 | MicroGrid.Control.Interfaces.SignalBus OutputSignal annotation(Placement(transformation(extent = {{74, -18}, {110, 16}}), iconTransformation(extent = {{80, -14}, {110, 16}}))); 4 | Modelica.Blocks.Interfaces.RealInput InputReal annotation(Placement(transformation(extent = {{-100, -10}, {-80, 10}}), iconTransformation(extent = {{-100, -10}, {-80, 10}}))); 5 | equation 6 | OutputSignal.sensorSignal = InputReal; 7 | annotation(Icon(graphics={ Rectangle(extent = {{-92, 28}, {92, -28}}, lineColor = {28, 108, 200}, 8 | lineThickness = 0.5), Polygon(points = {{-80, 0}, {-80, 0}}, lineColor = {0, 140, 72}), Polygon(points = {{90, 0}, {72, 2}, {-86, 18}, {-86, -20}, {90, 0}}, lineColor = {0, 140, 72}, fillColor = {0, 140, 72}, 9 | fillPattern = FillPattern.CrossDiag)})); 10 | end Real2Control; 11 | -------------------------------------------------------------------------------- /MicroGrid/Control/Interfaces/SignalBus.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Control.Interfaces; 2 | connector SignalBus "Communication bus for controller signals" 3 | Real sensorSignal; 4 | annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics={ Line(points = {{-16.0, 2.0}, {16.0, 2.0}}, color = {255, 204, 51}, thickness = 0.5), Rectangle(lineColor = {0, 128, 0}, 5 | lineThickness = 0.5, extent = {{-10.0, 0.0}, {8.0, 8.0}}), Polygon(fillColor = {0, 128, 0}, 6 | fillPattern = FillPattern.Solid, points = {{-80.0, 50.0}, {80.0, 50.0}, {100.0, 30.0}, {80.0, -40.0}, {60.0, -50.0}, {-60.0, -50.0}, {-80.0, -40.0}, {-100.0, 30.0}}, smooth = Smooth.Bezier), Ellipse( 7 | fillPattern = FillPattern.Solid, extent = {{-55.0, 15.0}, {-45.0, 25.0}}), Ellipse( 8 | fillPattern = FillPattern.Solid, extent = {{45.0, 15.0}, {55.0, 25.0}}), Ellipse( 9 | fillPattern = FillPattern.Solid, extent = {{-5.0, -25.0}, {5.0, -15.0}}), Rectangle(lineColor = {0, 128, 0}, 10 | lineThickness = 0.5, extent = {{-20.0, 0.0}, {20.0, 4.0}})}), Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics={ Polygon(points = {{-40, 25}, {40, 25}, {50, 15}, {40, -20}, {30, -25}, {-30, -25}, {-40, -20}, {-50, 15}}, lineColor = {0, 0, 0}, fillColor = {0, 128, 0}, 11 | fillPattern = FillPattern.Solid, smooth = Smooth.Bezier), Ellipse(extent = {{-22.5, 7.5}, {-17.5, 12.5}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, 12 | fillPattern = FillPattern.Solid), Ellipse(extent = {{17.5, 12.5}, {22.5, 7.5}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, 13 | fillPattern = FillPattern.Solid), Ellipse(extent = {{-2.5, -7.5}, {2.5, -12.5}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, 14 | fillPattern = FillPattern.Solid), Text(extent = {{-150, 70}, {150, 40}}, lineColor = {0, 0, 0}, textString = "%name")})); 15 | end SignalBus; 16 | -------------------------------------------------------------------------------- /MicroGrid/Control/Interfaces/abc2dq.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Control.Interfaces; 2 | model abc2dq "Transformation block from abc-frame to dq-frame." 3 | extends Modelica.Electrical.PowerConverters.Icons.Converter; 4 | import Modelica.Constants.pi; 5 | MicroGrid.Sensors.Interfaces.SignalBus v_A annotation(Placement(visible = true, transformation(origin = {-95, 70}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {-92.51, 64.722}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 6 | MicroGrid.Sensors.Interfaces.SignalBus v_B annotation(Placement(visible = true, transformation(origin = {-95, 0}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {-92.51, -3.051}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 7 | MicroGrid.Sensors.Interfaces.SignalBus v_C annotation(Placement(visible = true, transformation(origin = {-95, -70}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {-92.51, -70}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 8 | SignalBus Delta annotation(Placement(visible = true, transformation(origin = {0, -95}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {-0, -94.841}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 9 | SignalBus v_d annotation(Placement(visible = true, transformation(origin = {95, 40}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {92.331, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 10 | SignalBus v_q annotation(Placement(visible = true, transformation(origin = {95, -40}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {91.506, -40}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 11 | equation 12 | v_d.sensorSignal = 2 / 3 * (v_A.sensorSignal * Modelica.Math.cos(Delta.sensorSignal) + v_B.sensorSignal * Modelica.Math.cos(Delta.sensorSignal - 2 * pi / 3) + v_C.sensorSignal * Modelica.Math.cos(Delta.sensorSignal - 4 * pi / 3)); 13 | v_q.sensorSignal = 2 / 3 * (v_A.sensorSignal * Modelica.Math.sin(Delta.sensorSignal) + v_B.sensorSignal * Modelica.Math.sin(Delta.sensorSignal - 2 * pi / 3) + v_C.sensorSignal * Modelica.Math.sin(Delta.sensorSignal - 4 * pi / 3)); 14 | annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), graphics={ Text(visible = true, origin = {-34.494, 40}, extent = {{-37.051, -24.194}, {37.051, 24.194}}, textString = "abc"), Text(visible = true, origin = {30, -35.709}, extent = {{-37.2, -24.291}, {37.2, 24.291}}, textString = "dq")})); 15 | end abc2dq; 16 | -------------------------------------------------------------------------------- /MicroGrid/Control/Interfaces/clarke.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Control.Interfaces; 2 | model clarke "Clarke transformation block." 3 | extends Modelica.Electrical.PowerConverters.Icons.Converter; 4 | import Modelica.Constants.pi; 5 | SignalBus v_alfa annotation(Placement(visible = true, transformation(origin = {95, 40}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {93.303, 34.008}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 6 | SignalBus v_beta annotation(Placement(visible = true, transformation(origin = {95, -40}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {93.774, -33.225}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 7 | MicroGrid.Sensors.Interfaces.SignalBus v_A annotation(Placement(visible = true, transformation(origin = {-95, 70}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {-92.51, 64.722}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 8 | MicroGrid.Sensors.Interfaces.SignalBus v_B annotation(Placement(visible = true, transformation(origin = {-95, 0}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {-92.986, -0}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 9 | MicroGrid.Sensors.Interfaces.SignalBus v_C annotation(Placement(visible = true, transformation(origin = {-95, -70}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {-92.51, -70}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 10 | equation 11 | v_alfa.sensorSignal = 2 / 3 * (v_A.sensorSignal - 1 / 2 * v_B.sensorSignal - 1 / 2 * v_C.sensorSignal); 12 | v_beta.sensorSignal = 2 / 3 * (sqrt(3) / 2 * v_B.sensorSignal - sqrt(3) / 2 * v_C.sensorSignal); 13 | annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), graphics={ Text(visible = true, origin = {31.162, -33.218}, extent = {{-41.162, -43.218}, {41.162, 43.218}}, textString = "alfa-beta"), Text(visible = true, origin = {-30.792, 40}, extent = {{-29.208, -30.667}, {29.208, 30.667}}, textString = "abc")})); 14 | end clarke; 15 | -------------------------------------------------------------------------------- /MicroGrid/Control/Interfaces/dq2abc.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Control.Interfaces; 2 | model dq2abc "Transformation block from abc-frame to dq-frame." 3 | extends Modelica.Electrical.PowerConverters.Icons.Converter; 4 | import Modelica.Constants.pi; 5 | SignalBus v_A annotation(Placement(visible = true, transformation(origin = {93.445, 70}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {93.723, 63.514}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 6 | SignalBus v_B annotation(Placement(visible = true, transformation(origin = {95, 0}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {92.719, -0}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 7 | SignalBus v_C annotation(Placement(visible = true, transformation(origin = {95, -70}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {92.719, -70}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 8 | SignalBus Delta annotation(Placement(visible = true, transformation(origin = {0, -95}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {-0, -94.841}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 9 | SignalBus v_d annotation(Placement(visible = true, transformation(origin = {-95, 40}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {-94.404, 37.992}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 10 | SignalBus v_q annotation(Placement(visible = true, transformation(origin = {-95, -40}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {-93.221, -40}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 11 | equation 12 | v_A.sensorSignal = v_d.sensorSignal * Modelica.Math.cos(Delta.sensorSignal) + v_q.sensorSignal * Modelica.Math.sin(Delta.sensorSignal); 13 | v_B.sensorSignal = v_d.sensorSignal * Modelica.Math.cos(Delta.sensorSignal - 2 * pi / 3) + v_q.sensorSignal * Modelica.Math.sin(Delta.sensorSignal - 2 * pi / 3); 14 | v_C.sensorSignal = v_d.sensorSignal * Modelica.Math.cos(Delta.sensorSignal - 4 * pi / 3) + v_q.sensorSignal * Modelica.Math.sin(Delta.sensorSignal - 4 * pi / 3); 15 | annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), graphics={ Text(visible = true, origin = {38.932, -33.184}, extent = {{-41.068, -26.816}, {41.068, 26.816}}, textString = "abc"), Text(visible = true, origin = {-32.082, 40}, extent = {{-39.651, -25.891}, {39.651, 25.891}}, textString = "dq")})); 16 | end dq2abc; 17 | -------------------------------------------------------------------------------- /MicroGrid/Control/Interfaces/invClarke.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Control.Interfaces; 2 | model invClarke "Inverse Clarke transformation block." 3 | extends Modelica.Electrical.PowerConverters.Icons.Converter; 4 | import Modelica.Constants.pi; 5 | SignalBus v_alfa annotation(Placement(visible = true, transformation(origin = {-95, 40}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {-92.93, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 6 | SignalBus v_beta annotation(Placement(visible = true, transformation(origin = {-95, -40}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {-93.965, -38.245}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 7 | SignalBus v_A annotation(Placement(visible = true, transformation(origin = {93.445, 70}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {93.723, 63.514}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 8 | SignalBus v_B annotation(Placement(visible = true, transformation(origin = {95, 0}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {92.719, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 9 | SignalBus v_C annotation(Placement(visible = true, transformation(origin = {95, -70}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {92.719, -70}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 10 | equation 11 | v_A.sensorSignal = v_alfa.sensorSignal; 12 | v_B.sensorSignal = (-1 / 2) * v_alfa.sensorSignal + sqrt(3) / 2 * v_beta.sensorSignal; 13 | v_C.sensorSignal = (-1 / 2) * v_alfa.sensorSignal - sqrt(3) / 2 * v_beta.sensorSignal; 14 | annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), graphics={ Text(visible = true, origin = {-25.601, 30}, extent = {{-41.162, -43.218}, {41.162, 43.218}}, textString = "alfa-beta"), Text(visible = true, origin = {39.208, -39.333}, extent = {{-29.208, -30.667}, {29.208, 30.667}}, textString = "abc")})); 15 | end invClarke; 16 | -------------------------------------------------------------------------------- /MicroGrid/Control/Interfaces/invPark.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Control.Interfaces; 2 | model invPark "Inverse Park transformation block." 3 | extends Modelica.Electrical.PowerConverters.Icons.Converter; 4 | import Modelica.Constants.pi; 5 | SignalBus Delta annotation(Placement(visible = true, transformation(origin = {0, -95}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {-0, -94.841}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 6 | SignalBus v_d annotation(Placement(visible = true, transformation(origin = {-95, 40}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {-93.165, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 7 | SignalBus v_q annotation(Placement(visible = true, transformation(origin = {-95, -40}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {-93.559, -40}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 8 | SignalBus v_alfa annotation(Placement(visible = true, transformation(origin = {95, 40}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {91.9, 42.588}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 9 | SignalBus v_beta annotation(Placement(visible = true, transformation(origin = {95, -40}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {91.726, -37.412}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 10 | equation 11 | v_alfa.sensorSignal = v_d.sensorSignal * Modelica.Math.cos(Delta.sensorSignal) - v_q.sensorSignal * Modelica.Math.sin(Delta.sensorSignal); 12 | v_beta.sensorSignal = v_d.sensorSignal * Modelica.Math.sin(Delta.sensorSignal) + v_q.sensorSignal * Modelica.Math.cos(Delta.sensorSignal); 13 | annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), graphics={ Text(visible = true, origin = {30, -35.061}, extent = {{-41.162, -43.218}, {41.162, 43.218}}, textString = "alfa-beta"), Text(visible = true, origin = {-35.571, 43.704}, extent = {{-19.215, -20.175}, {19.215, 20.175}}, textString = "dq")})); 14 | end invPark; 15 | -------------------------------------------------------------------------------- /MicroGrid/Control/Interfaces/package.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Control; 2 | package Interfaces 3 | extends Modelica.Icons.InterfacesPackage; 4 | end Interfaces; 5 | -------------------------------------------------------------------------------- /MicroGrid/Control/Interfaces/package.order: -------------------------------------------------------------------------------- 1 | SignalBus 2 | Control2Real 3 | Real2Control 4 | abc2dq 5 | dq2abc 6 | park 7 | invPark 8 | clarke 9 | invClarke 10 | -------------------------------------------------------------------------------- /MicroGrid/Control/Interfaces/park.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Control.Interfaces; 2 | model park "Park transformation block." 3 | extends Modelica.Electrical.PowerConverters.Icons.Converter; 4 | import Modelica.Constants.pi; 5 | SignalBus Delta annotation(Placement(visible = true, transformation(origin = {0, -95}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {-0, -94.841}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 6 | SignalBus v_d annotation(Placement(visible = true, transformation(origin = {95, 40}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {92.331, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 7 | SignalBus v_q annotation(Placement(visible = true, transformation(origin = {95, -40}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {91.506, -40}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 8 | SignalBus v_alfa annotation(Placement(visible = true, transformation(origin = {-95, 40}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {-92.302, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 9 | SignalBus v_beta annotation(Placement(visible = true, transformation(origin = {-95, -40}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {-92.696, -42.588}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 10 | equation 11 | v_d.sensorSignal = v_alfa.sensorSignal * Modelica.Math.cos(Delta.sensorSignal) + v_beta.sensorSignal * Modelica.Math.sin(Delta.sensorSignal); 12 | v_q.sensorSignal = (-v_alfa.sensorSignal * Modelica.Math.sin(Delta.sensorSignal)) + v_beta.sensorSignal * Modelica.Math.cos(Delta.sensorSignal); 13 | annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), graphics={ Text(visible = true, origin = {-20, 40}, extent = {{-41.162, -43.218}, {41.162, 43.218}}, textString = "alfa-beta"), Text(visible = true, origin = {40, -39.825}, extent = {{-19.215, -20.175}, {19.215, 20.175}}, textString = "dq")})); 14 | end park; 15 | -------------------------------------------------------------------------------- /MicroGrid/Control/Modulation/SawtoothPWM.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Control.Modulation; 2 | model SawtoothPWM "Generate the firing signal for switch" 3 | extends Modelica.Electrical.PowerConverters.Icons.Control; 4 | parameter Modelica.SIunits.Frequency f = 1000 "Switching frequency"; 5 | Modelica.Blocks.Interfaces.BooleanOutput fire "Firing PWM signal" annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {60, 110}))); 6 | Modelica.Blocks.Nonlinear.Limiter limiter(uMax = 1, uMin = 0) annotation(Placement(transformation(extent = {{-38, -10}, {-18, 10}}))); 7 | Modelica.Blocks.Logical.Less greaterEqual annotation(Placement(transformation(extent = {{-10, 10}, {10, -10}}, origin = {44, -8}))); 8 | Modelica.Blocks.Discrete.ZeroOrderHold zeroOrderHold(final startTime = 0, final samplePeriod = 1 / f, 9 | ySample( start = 0, fixed = true)) 10 | annotation(Placement(transformation(extent = {{-8, -10}, {12, 10}}))); 11 | Modelica.Blocks.Sources.SawTooth sawtooth(final period = 1 / f, final amplitude = 1, final nperiod = -1, final offset = 0, final startTime = 0) annotation(Placement(transformation(origin = {-28, -50}, extent = {{-10, -10}, {10, 10}}))); 12 | Interfaces.SignalBus InputDutyRatio annotation(Placement(transformation(extent = {{-124, -22}, {-64, 20}}))); 13 | Interfaces.Control2Real control2Real annotation(Placement(transformation(extent = {{-68, -10}, {-48, 10}}))); 14 | equation 15 | connect(limiter.y, zeroOrderHold.u) annotation(Line(points = {{-17, 0}, {-10, 0}}, color = {0, 0, 127})); 16 | connect(zeroOrderHold.y, greaterEqual.u2) annotation(Line(points = {{13, 0}, {32, 0}}, color = {0, 0, 127})); 17 | connect(sawtooth.y, greaterEqual.u1) annotation(Line(points = {{-17, -50}, {22, -50}, {22, -8}, {32, -8}}, color = {0, 0, 127})); 18 | connect(greaterEqual.y, fire) annotation(Line(points = {{55, -8}, {60, -8}, {60, 110}}, color = {255, 0, 255})); 19 | connect(InputDutyRatio, control2Real.InputSignal) annotation(Line(points = {{-94, -1}, {-82, -1}, {-82, 0}, {-67.4, 0}}, color = {0, 128, 0}, thickness = 0.5)); 20 | connect(limiter.u, control2Real.OutputReal) annotation(Line(points = {{-40, 0}, {-48, 0}}, color = {0, 0, 127})); 21 | annotation(Icon(graphics={ Line(points = {{-80, 40}, {80, 40}}, color = {255, 0, 0}), Line(points = {{-52, -140}}, color = {0, 0, 255}), Line(points = {{-80.1563, 54.922}, {-50, 70}, {-50, 30}, {30, 70}, {30, 30}, {79.531, 54.766}}, color = {0, 0, 255}), Line(points = {{-50, 80}, {-50, -80}}, color = {0, 0, 255}, pattern = LinePattern.Dash), Line(points = {{-30, 80}, {-30, -80}}, color = {0, 0, 255}, pattern = LinePattern.Dash), Line(points = {{30, 80}, {30, -80}}, color = {0, 0, 255}, pattern = LinePattern.Dash), Line(points = {{50, 80}, {50, -80}}, color = {0, 0, 255}, pattern = LinePattern.Dash), Line(points = {{-80, -80}, {-50, -80}, {-50, -40}, {-30, -40}, {-30, -80}, {30, -80}, {30, -40}, {50, -40}, {50, -80}, {80, -80}}, color = {255, 0, 255})})); 22 | end SawtoothPWM; 23 | -------------------------------------------------------------------------------- /MicroGrid/Control/Modulation/TriangPWM_1Ph.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Control.Modulation; 2 | model TriangPWM_1Ph 3 | extends Modelica.Electrical.PowerConverters.Icons.Control; 4 | parameter Modelica.SIunits.Frequency f = 1000 "Switching frequency"; 5 | parameter Modelica.SIunits.Time startTime = 0 "Start time"; 6 | Modelica.Blocks.Interfaces.BooleanOutput fire "Firing PWM signal" annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {-60, 110}), visible = true, iconTransformation(origin = {-60, 110}, extent = {{-10, -10}, {10, 10}}, rotation = 90))); 7 | Modelica.Blocks.Nonlinear.Limiter limiter(uMax = 1, uMin = -1) annotation(Placement(transformation(extent = {{-38, -10}, {-18, 10}}))); 8 | Modelica.Blocks.Logical.Less greaterEqual annotation(Placement(transformation(extent = {{-10, 10}, {10, -10}}, origin = {44, -8}))); 9 | Modelica.Blocks.Sources.Trapezoid triangular(amplitude = 2, offset = -1, period = 1 / f, width = 0, rising = 0.5 / f, falling = 0.5 / f) annotation(Placement(transformation(origin = {-28, -50}, extent = {{-10, -10}, {10, 10}}))); 10 | Interfaces.SignalBus m_index annotation(Placement(transformation(extent = {{-124, -22}, {-64, 20}}, origin = {0, 0}, rotation = 0), visible = true, iconTransformation(origin = {0, 0}, extent = {{-124, -22}, {-64, 20}}, rotation = 0))); 11 | Interfaces.Control2Real control2Real annotation(Placement(transformation(extent = {{-68, -10}, {-48, 10}}))); 12 | Modelica.Blocks.Logical.Not not1 annotation(Placement(visible = true, transformation(origin = {60, 50}, extent = {{-10, -10}, {10, 10}}, rotation = -270))); 13 | Modelica.Blocks.Interfaces.BooleanOutput fire_compl "Firing PWM signal" annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {60, 110}), visible = true, iconTransformation(origin = {68, 110}, extent = {{-10, -10}, {10, 10}}, rotation = 90))); 14 | Modelica.Blocks.Discrete.ZeroOrderHold zeroOrderHold(final startTime = startTime, final samplePeriod = 1 / (5 * f)) annotation(Placement(transformation(extent = {{-8, -10}, {12, 10}}))); 15 | equation 16 | connect(triangular.y, greaterEqual.u1) annotation(Line(points = {{-17, -50}, {22, -50}, {22, -8}, {32, -8}}, color = {0, 0, 127})); 17 | connect(m_index, control2Real.InputSignal) annotation(Line(points = {{-94, -1}, {-82, -1}, {-82, 0}, {-67.1, -0.1}}, color = {0, 128, 0}, thickness = 0.5, visible = true)); 18 | connect(limiter.u, control2Real.OutputReal) annotation(Line(points = {{-40, 0}, {-48, 0}}, color = {0, 0, 127})); 19 | connect(not1.y, fire_compl) annotation(Line(visible = true, origin = {60, 85.5}, points = {{0, -24.5}, {0, 24.5}}, color = {190, 52, 178})); 20 | connect(greaterEqual.y, not1.u) annotation(Line(visible = true, origin = {58.333, 7.333}, points = {{-3.333, -15.333}, {1.667, -15.333}, {1.667, 30.667}}, color = {190, 52, 178})); 21 | connect(fire, greaterEqual.y) annotation(Line(visible = true, origin = {11, 30.8}, points = {{-71, 79.2}, {-71, -0.8}, {49, -0.8}, {49, -38.8}, {44, -38.8}}, color = {190, 52, 178})); 22 | connect(zeroOrderHold.y, greaterEqual.u2) annotation(Line(points = {{13, 0}, {32, 0}}, color = {0, 0, 127})); 23 | connect(limiter.y, zeroOrderHold.u) annotation(Line(points = {{-17, 0}, {-10, 0}}, color = {0, 0, 127})); 24 | annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), graphics={ Text(visible = true, origin = {12.391, 41.668}, extent = {{-67.609, -35}, {67.609, 35}}, textString = "Single-Phase"), Text(visible = true, origin = {10, 5}, extent = {{-64.708, -15}, {64.708, 15}}, textString = "sinusoidal"), Text(visible = true, origin = {5.352, -30}, extent = {{-44.648, -13.784}, {44.648, 13.784}}, textString = "PWM")})); 25 | end TriangPWM_1Ph; 26 | -------------------------------------------------------------------------------- /MicroGrid/Control/Modulation/package.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Control; 2 | package Modulation 3 | extends Modelica.Icons.Package; 4 | end Modulation; 5 | -------------------------------------------------------------------------------- /MicroGrid/Control/Modulation/package.order: -------------------------------------------------------------------------------- 1 | SawtoothPWM 2 | TriangPWM_1Ph 3 | TriangPWM_3Ph 4 | -------------------------------------------------------------------------------- /MicroGrid/Control/PhaseLockedLoop/Utilities/IntegratorWithReset.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Control.PhaseLockedLoop.Utilities; 2 | block IntegratorWithReset "Integrator with Automatic Reset for PLLs" 3 | extends Modelica.Blocks.Interfaces.SISO(y(start=y_start)); 4 | import Modelica.Constants.pi; 5 | parameter Real k(unit="1")=1 "Integrator gain"; 6 | parameter Real y_start=0 "Initial or guess value of output (= state)" annotation (Dialog(group="Initialization")); 7 | initial equation 8 | y = y_start; 9 | equation 10 | der(y) = k*u; 11 | when y > 2*pi then 12 | reinit(y,y_start); 13 | end when; 14 | annotation(Icon(coordinateSystem( 15 | preserveAspectRatio=true, 16 | extent={{-100.0,-100.0},{100.0,100.0}}), 17 | graphics={ 18 | Line( 19 | points={{-80.0,78.0},{-80.0,-90.0}}, 20 | color={192,192,192}), 21 | Polygon( 22 | lineColor={192,192,192}, 23 | fillColor={192,192,192}, 24 | fillPattern=FillPattern.Solid, 25 | points={{-80.0,90.0},{-88.0,68.0},{-72.0,68.0},{-80.0,90.0}}), 26 | Line( 27 | points={{-90.0,-80.0},{82.0,-80.0}}, 28 | color={192,192,192}), 29 | Polygon( 30 | lineColor={192,192,192}, 31 | fillColor={192,192,192}, 32 | fillPattern=FillPattern.Solid, 33 | points={{90.0,-80.0},{68.0,-72.0},{68.0,-88.0},{90.0,-80.0}}), 34 | Text( 35 | lineColor={192,192,192}, 36 | extent={{0.0,-70.0},{60.0,-10.0}}, 37 | textString="I"), 38 | Text( 39 | extent={{-150.0,-150.0},{150.0,-110.0}}, 40 | textString="k=%k"), 41 | Line( 42 | points={{-80.0,-80.0},{80.0,80.0}}, 43 | color={0,0,127})}), 44 | Diagram(coordinateSystem( 45 | preserveAspectRatio=true, 46 | extent={{-100,-100},{100,100}}), graphics={ 47 | Rectangle(extent={{-60,60},{60,-60}}, lineColor={0,0,255}), 48 | Line(points={{-100,0},{-60,0}}, color={0,0,255}), 49 | Line(points={{60,0},{100,0}}, color={0,0,255}), 50 | Text( 51 | extent={{-36,60},{32,2}}, 52 | lineColor={0,0,0}, 53 | textString="k"), 54 | Text( 55 | extent={{-32,0},{36,-58}}, 56 | lineColor={0,0,0}, 57 | textString="s"), 58 | Line(points={{-46,0},{46,0}})})); 59 | end IntegratorWithReset; 60 | -------------------------------------------------------------------------------- /MicroGrid/Control/PhaseLockedLoop/Utilities/SOGI.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Control.PhaseLockedLoop.Utilities; 2 | model SOGI "Second Order Generalized Integrator" 3 | import Modelica.Constants.pi; 4 | extends Modelica.Electrical.PowerConverters.Icons.Control; 5 | parameter Real FilterGain = 1.41 "Filter gain"; 6 | parameter Real FrequencyHz = 60 "System nominal frequency"; 7 | Modelica.Blocks.Math.Feedback feedback annotation(Placement(visible = true, transformation(origin = {-70, 0}, extent = {{-10, 10}, {10, -10}}, rotation = 0))); 8 | Modelica.Blocks.Math.Gain gain1(k = FilterGain) annotation(Placement(visible = true, transformation(origin = {-34.893, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 9 | Modelica.Blocks.Math.Feedback feedback2 annotation(Placement(visible = true, transformation(origin = {-4.607, -0}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 10 | Modelica.Blocks.Math.Gain gain2(k = 2 * pi * FrequencyHz) annotation(Placement(visible = true, transformation(origin = {24.02, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 11 | Modelica.Blocks.Continuous.Integrator integrator1(initType = Modelica.Blocks.Types.Init.InitialOutput, y_start = 0) annotation(Placement(visible = true, transformation(origin = {56.598, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 12 | Modelica.Blocks.Continuous.Integrator integrator2(initType = Modelica.Blocks.Types.Init.InitialOutput, y_start = 0) annotation(Placement(visible = true, transformation(origin = {56.153, -40}, extent = {{10, -10}, {-10, 10}}, rotation = 0))); 13 | Modelica.Blocks.Math.Gain gain3(k = 2 * pi * FrequencyHz) annotation(Placement(visible = true, transformation(origin = {20, -40}, extent = {{10, -10}, {-10, 10}}, rotation = 0))); 14 | Modelica.Blocks.Interfaces.RealInput v_in annotation(Placement(visible = true, transformation(origin = {-110, -0}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-96.559, -2.066}, extent = {{-20, -20}, {20, 20}}, rotation = 0))); 15 | Modelica.Blocks.Interfaces.RealOutput v annotation(Placement(visible = true, transformation(origin = {165, 40}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {100, 50}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 16 | Modelica.Blocks.Interfaces.RealOutput qv annotation(Placement(visible = true, transformation(origin = {165, -40}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {100, -50}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 17 | equation 18 | connect(feedback.y, gain1.u) annotation(Line(visible = true, origin = {-53.947, -0}, points={{-7.053, 19 | 0},{7.054,0}}, color = {1, 37, 163})); 20 | connect(gain1.y, feedback2.u1) annotation(Line(visible = true, origin = {-18.25, -0}, points = {{-5.643, -0}, {5.643, 0}}, color = {1, 37, 163})); 21 | connect(feedback2.y, gain2.u) annotation(Line(visible = true, origin = {8.206, -0}, points={{-3.813, 22 | 0},{3.814,0}}, color = {1, 37, 163})); 23 | connect(gain3.u, integrator2.y) annotation(Line(visible = true, origin = {38.577, -40}, points={{-6.577, 24 | 0},{6.576,0}}, color = {1, 37, 163})); 25 | connect(gain3.y, feedback2.u2) annotation(Line(visible = true, origin = {-0.072, -29.333}, points={{9.072, 26 | -10.667},{-4.535,-10.667},{-4.535,21.333}}, color = {1, 37, 163})); 27 | connect(integrator1.y, integrator2.u) annotation(Line(visible = true, origin = {73.938, -20}, points={{-6.34, 28 | 20},{6.062,20},{6.062,-20},{-5.785,-20}}, color = {1, 37, 163})); 29 | connect(v_in, feedback.u1) annotation(Line(visible = true, origin = {-94, -0}, points = {{-16, 0}, {16, -0}}, color = {1, 37, 163})); 30 | connect(gain3.y, qv) annotation(Line(visible = true, origin = {67.528, -46.667}, points = {{-58.528, 6.667}, {-71.945, 6.667}, {-71.945, -13.333}, {52.472, -13.333}, {52.472, 6.667}, {97.472, 6.667}}, color = {1, 37, 163})); 31 | connect(v, integrator1.y) annotation(Line(visible = true, origin = {118.149, 20}, points = {{46.851, 20}, {1.851, 20}, {1.851, -20}, {-50.551, -20}}, color = {1, 37, 163})); 32 | connect(integrator1.y, feedback.u2) annotation(Line(visible = true, origin = {17.52, 13.6}, points = {{50.078, -13.6}, {62.48, -13.6}, {62.48, 16.4}, {-87.52, 16.4}, {-87.52, -5.6}}, color = {1, 37, 163})); 33 | connect(gain2.y, integrator1.u) annotation(Line(visible = true, origin = {39.809, 0}, points = {{-4.789, 0}, {4.789, 0}}, color = {1, 37, 163})); 34 | annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), graphics={ Text(visible = true, origin = {-4.527, -0}, extent = {{-55.473, -34.767}, {55.473, 34.767}}, textString = "SOGI - PBF")}), Diagram(coordinateSystem(extent = {{-100, -95.952}, {160, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}))); 35 | end SOGI; 36 | -------------------------------------------------------------------------------- /MicroGrid/Control/PhaseLockedLoop/Utilities/TOSSI.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Control.PhaseLockedLoop.Utilities; 2 | model TOSSI "Third Order Sinusoidal Integrator" 3 | extends Modelica.Electrical.PowerConverters.Icons.Control; 4 | equation 5 | 6 | end TOSSI; 7 | -------------------------------------------------------------------------------- /MicroGrid/Control/PhaseLockedLoop/Utilities/package.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Control.PhaseLockedLoop; 2 | package Utilities 3 | extends Modelica.Icons.UtilitiesPackage; 4 | end Utilities; 5 | -------------------------------------------------------------------------------- /MicroGrid/Control/PhaseLockedLoop/Utilities/package.order: -------------------------------------------------------------------------------- 1 | IntegratorWithReset 2 | SOGI 3 | TOSSI 4 | -------------------------------------------------------------------------------- /MicroGrid/Control/PhaseLockedLoop/package.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Control; 2 | package PhaseLockedLoop 3 | extends Modelica.Icons.Package; 4 | end PhaseLockedLoop; 5 | -------------------------------------------------------------------------------- /MicroGrid/Control/PhaseLockedLoop/package.order: -------------------------------------------------------------------------------- 1 | Utilities 2 | DSOGI_PLL 3 | -------------------------------------------------------------------------------- /MicroGrid/Control/RefGenerators/mppt.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Control.RefGenerators; 2 | model mppt 3 | extends Modelica.Electrical.PowerConverters.Icons.Control; 4 | Sensors.Interfaces.SignalBus u annotation(Placement(visible = true, transformation(origin = {-95.876, 40}, extent = {{-15.876, -15.876}, {15.876, 15.876}}, rotation = 0), iconTransformation(origin = {-94.539, 43.086}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 5 | Sensors.Interfaces.SignalBus i annotation(Placement(visible = true, transformation(origin = {-95, -40}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {-95.269, -46.532}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 6 | Interfaces.SignalBus y annotation(Placement(visible = true, transformation(origin = {95, -0}, extent = {{-15, -15}, {15, 15}}, rotation = 0), iconTransformation(origin = {94.539, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 7 | parameter Real Ts; 8 | parameter Real deltaVpvRefPanel; 9 | Real pot; 10 | Real potActFiltered; 11 | discrete Real potact; 12 | discrete Real potprev; 13 | discrete Real prevu; 14 | discrete Real actu; 15 | discrete Real deltau; 16 | discrete Real deltap; 17 | discrete Real vref(start = 30); 18 | equation 19 | pot = u.sensorSignal * i.sensorSignal; 20 | der(potActFiltered) = (pot - potActFiltered) * 100; 21 | y.sensorSignal = pre(vref); 22 | algorithm 23 | when sample(0, Ts) then 24 | potprev := potact; 25 | potact := potActFiltered; 26 | prevu := actu; 27 | actu := u.sensorSignal; 28 | deltau := actu - prevu; 29 | deltap := potact - potprev; 30 | if abs(deltau) > 0.1 * deltaVpvRefPanel then 31 | if abs(deltap) > 0.2 then 32 | if deltap / deltau > 0 then 33 | vref := vref + deltaVpvRefPanel; 34 | end if; 35 | if deltap / deltau < 0 then 36 | vref := vref - deltaVpvRefPanel; 37 | end if; 38 | end if; 39 | end if; 40 | end when; 41 | annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}, initialScale = 0.1, grid = {10, 10}), graphics={ Rectangle(visible = true, origin = {0, -1.101}, fillColor = {255, 255, 255}, 42 | fillPattern = FillPattern.Solid, 43 | lineThickness = 0.75, extent = {{-80, -81.101}, {80, 81.101}}), Line(visible = true, points = {{-34, -34}, {-10, 4}, {14, 30}, {32, 30}, {36, -32}}, smooth = Smooth.Bezier), Ellipse(visible = true, fillColor = {255, 0, 0}, pattern = LinePattern.None, 44 | fillPattern = FillPattern.Solid, extent = {{14, 24}, {26, 36}})}), Diagram(coordinateSystem(preserveAspectRatio = false))); 45 | end mppt; 46 | -------------------------------------------------------------------------------- /MicroGrid/Control/RefGenerators/package.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Control; 2 | package RefGenerators 3 | extends Modelica.Icons.Package; 4 | end RefGenerators; 5 | -------------------------------------------------------------------------------- /MicroGrid/Control/RefGenerators/package.order: -------------------------------------------------------------------------------- 1 | mppt 2 | -------------------------------------------------------------------------------- /MicroGrid/Control/package.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid; 2 | package Control 3 | extends Modelica.Icons.Package; 4 | 5 | annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics={ Rectangle(origin = {0.0, 35.1488}, fillColor = {255, 255, 255}, extent = {{-30.0, -20.1488}, {30.0, 20.1488}}), Rectangle(origin = {0.0, -34.8512}, fillColor = {255, 255, 255}, extent = {{-30.0, -20.1488}, {30.0, 20.1488}}), Line(origin = {-51.25, 0.0}, points = {{21.25, -35.0}, {-13.75, -35.0}, {-13.75, 35.0}, {6.25, 35.0}}), Polygon(origin = {-40.0, 35.0}, pattern = LinePattern.None, 6 | fillPattern = FillPattern.Solid, points = {{10.0, 0.0}, {-5.0, 5.0}, {-5.0, -5.0}}), Line(origin = {51.25, 0.0}, points = {{-21.25, 35.0}, {13.75, 35.0}, {13.75, -35.0}, {-6.25, -35.0}}), Polygon(origin = {40.0, -35.0}, pattern = LinePattern.None, 7 | fillPattern = FillPattern.Solid, points = {{-10.0, 0.0}, {5.0, 5.0}, {5.0, -5.0}})})); 8 | end Control; 9 | -------------------------------------------------------------------------------- /MicroGrid/Control/package.order: -------------------------------------------------------------------------------- 1 | Examples 2 | Interfaces 3 | Modulation 4 | Feedback 5 | PhaseLockedLoop 6 | RefGenerators 7 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/BasicComponents/capacitor.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical.BasicComponents; 2 | model capacitor "Ideal capacitor" 3 | extends MicroGrid.Electrical.Interfaces.OnePort(v(start=0)); 4 | parameter Modelica.SIunits.Capacitance C=1 "Capacitance"; 5 | equation 6 | i = C*der(v); 7 | annotation ( 8 | Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100, 9 | 100}}), graphics={ 10 | Line(points={{-6,28},{-6,-28}}, color={0,0,255}), 11 | Line(points={{6,28},{6,-28}}, color={0,0,255}), 12 | Line(points={{-90,0},{-6,0}}, color={0,0,255}), 13 | Line(points={{6,0},{90,0}}, color={0,0,255}), 14 | Text( 15 | extent={{-136,-60},{136,-92}}, 16 | lineColor={0,0,0}, 17 | textString="C=%C"), 18 | Text( 19 | extent={{-150,85},{150,45}}, 20 | textString="%name", 21 | lineColor={0,0,255})}), 22 | Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{ 23 | 100,100}}), graphics={Line( 24 | points={{-20,40},{-20,-40}}, 25 | thickness=0.5, 26 | color={0,0,255}),Line( 27 | points={{20,40},{20,-40}}, 28 | thickness=0.5, 29 | color={0,0,255}),Line(points={{-80,0},{-20,0}}, color={0,0,255}), 30 | Line(points={{20,0},{80,0}}, color={0,0,255})})); 31 | end capacitor; 32 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/BasicComponents/diode.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical.BasicComponents; 2 | model diode "basic and simplified diode" 3 | extends MicroGrid.Electrical.Interfaces.OnePort; 4 | parameter Modelica.SIunits.Resistance r_on(final min=0) = 1.E-5 "Forward ON state resistance"; 5 | parameter Modelica.SIunits.Conductance g_off(final min=0) = 0 "Backward OFF state conductance"; 6 | parameter Modelica.SIunits.Voltage v_knee(final min=0) = 0 "Forward threshold voltage"; 7 | protected 8 | Boolean off(start=true) "Switching off-state indicator"; 9 | Real s(start=0, final unit="1") "Auxiliary variable for actual position on the diode characteristic"; 10 | constant Modelica.SIunits.Voltage unitVoltage=1 annotation (HideResult=true); 11 | constant Modelica.SIunits.Current unitCurrent=1 annotation (HideResult=true); 12 | equation 13 | off = s < 0; 14 | v = (s*unitCurrent)*(if off then 1 else r_on) + v_knee; 15 | i = (s*unitVoltage)*(if off then g_off else 1) + g_off*v_knee; 16 | annotation ( 17 | Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,100}}),graphics={ 18 | Polygon(points={{30,0},{-30,40},{-30,-40},{30,0}},lineColor={0,0,0},fillColor={255,255,255}, 19 | fillPattern = FillPattern.Solid), 20 | Line(points={{-90,0},{40,0}}, color={0,0,255}), 21 | Line(points={{40,0},{90,0}}, color={0,0,255}), 22 | Line(points={{30,40},{30,-40}}, color={0,0,255}), 23 | Text(extent={{-150,-40},{150,-80}},textString="%name",lineColor={0,0,255})}), 24 | Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,100}}),graphics={ 25 | Polygon(points={{30,0},{-30,40},{-30,-40},{30,0}},lineColor={0,0,0},fillColor={255,255,255}, 26 | fillPattern = FillPattern.Solid), 27 | Line(points={{-80,0},{40,0}}, color={0,0,255}), 28 | Line(points={{40,0},{80,0}}, color={0,0,255}), 29 | Line(points={{30,40},{30,-40}}, color={0,0,255})})); 30 | end diode; 31 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/BasicComponents/ground.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical.BasicComponents; 2 | model ground "Ground node" 3 | MicroGrid.Electrical.Interfaces.PositivePin p annotation (Placement(transformation( 4 | origin={0,100}, 5 | extent={{10,-10},{-10,10}}, 6 | rotation=270))); 7 | equation 8 | p.v = 0; 9 | annotation ( 10 | Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100, 11 | 100}}), graphics={ 12 | Line(points={{-60,50},{60,50}}, color={0,0,255}), 13 | Line(points={{-40,30},{40,30}}, color={0,0,255}), 14 | Line(points={{-20,10},{20,10}}, color={0,0,255}), 15 | Line(points={{0,90},{0,50}}, color={0,0,255}), 16 | Text( 17 | extent={{-144,-19},{156,-59}}, 18 | textString="%name", 19 | lineColor={0,0,255})}), 20 | Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{ 21 | 100,100}}), graphics={Line( 22 | points={{-60,50},{60,50}}, 23 | thickness=0.5, 24 | color={0,0,255}),Line( 25 | points={{-40,30},{40,30}}, 26 | thickness=0.5, 27 | color={0,0,255}),Line( 28 | points={{-20,10},{20,10}}, 29 | thickness=0.5, 30 | color={0,0,255}),Line( 31 | points={{0,96},{0,50}}, 32 | thickness=0.5, 33 | color={0,0,255}),Text( 34 | extent={{-24,-38},{22,-6}}, 35 | textString="p.v=0", 36 | lineColor={0,0,255})})); 37 | end ground; 38 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/BasicComponents/inductor.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical.BasicComponents; 2 | model inductor "Ideal inductor" 3 | extends MicroGrid.Electrical.Interfaces.OnePort(i(start=0)); 4 | parameter Modelica.SIunits.Inductance L=1 "Inductance"; 5 | equation 6 | L*der(i) = v; // Faraday law 7 | annotation ( 8 | Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100, 9 | 100}}), graphics={ 10 | Line(points={{-60,0},{-60,6},{-51,15},{-45,15},{-39,15},{-30,6},{-30,0}}, color={0,0,255}, smooth=Smooth.Bezier), 11 | Line(points={{-30,0},{-30,6},{-21,15},{-15,15},{-9,15},{0,6},{0,0}}, color={0,0,255}, smooth=Smooth.Bezier), 12 | Line(points={{0,0},{0,6},{9,15},{15,15},{21,15},{30,6},{30,0}}, color={0,0,255}, smooth=Smooth.Bezier), 13 | Line(points={{30,0},{30,6},{39,15},{45,15},{51,15},{60,6},{60,0}}, color={0,0,255}, smooth=Smooth.Bezier), 14 | Line(points={{60,0},{90,0}}, color={0,0,255}), 15 | Line(points={{-90,0},{-60,0}}, color={0,0,255}), 16 | Text( 17 | extent={{-138,-60},{144,-94}}, 18 | lineColor={0,0,0}, 19 | textString="L=%L"), 20 | Text( 21 | extent={{-152,79},{148,39}}, 22 | textString="%name", 23 | lineColor={0,0,255})}), 24 | Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{ 25 | 100,100}}), graphics={ 26 | Line(points={{-60,0},{-60,6},{-51,15},{-45,15},{-39,15},{-30,6},{-30,0}}, color={0,0,255}, smooth=Smooth.Bezier), 27 | Line(points={{-30,0},{-30,6},{-21,15},{-15,15},{-9,15},{0,6},{0,0}}, color={0,0,255}, smooth=Smooth.Bezier), 28 | Line(points={{0,0},{0,6},{9,15},{15,15},{21,15},{30,6},{30,0}}, color={0,0,255}, smooth=Smooth.Bezier), 29 | Line(points={{30,0},{30,6},{39,15},{45,15},{51,15},{60,6},{60,0}}, color={0,0,255}, smooth=Smooth.Bezier), 30 | Line(points={{60,0},{80,0}}, color={0,0,255}), 31 | Line(points={{-80,0},{-60,0}}, color={0,0,255})})); 32 | end inductor; 33 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/BasicComponents/package.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical; 2 | package BasicComponents 3 | extends Modelica.Icons.Package; 4 | 5 | annotation(Icon(graphics={ 6 | Line(points={{-12,60},{-12,-60}}), 7 | Line(points={{-80,0},{-12,0}}), 8 | Line(points={{12,60},{12,-60}}), 9 | Line(points={{12,0},{80,0}})})); 10 | end BasicComponents; 11 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/BasicComponents/package.order: -------------------------------------------------------------------------------- 1 | ground 2 | resistor 3 | inductor 4 | capacitor 5 | diode 6 | switch 7 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/BasicComponents/resistor.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical.BasicComponents; 2 | model resistor "Linear ideal resistor" 3 | extends MicroGrid.Electrical.Interfaces.OnePort; 4 | parameter Modelica.SIunits.Resistance R=1 "Resistance"; 5 | equation 6 | v = R*i; // Ohm law 7 | annotation ( 8 | Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{ 9 | 100,100}}), graphics={ 10 | Rectangle(extent={{-60,30},{60,-30}},lineColor={0,0,255}), 11 | Line(points={{-86,0},{-60,0}}, color={0,0,255}), 12 | Line(points={{60,0},{86,0}}, color={0,0,255}), 13 | Text(extent={{-144,-40},{142,-72}}, lineColor={0,0,0},textString="R=%R"), 14 | Text(extent={{-152,87},{148,47}},textString="%name",lineColor={0,0,255})}), 15 | Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{ 16 | 100,100}}), graphics={ 17 | Rectangle(extent={{-70,30},{70,-30}},lineColor={0,0,255}), 18 | Line(points={{-80,0},{-70,0}}, color={0,0,255}), 19 | Line(points={{70,0},{80,0}}, color={0,0,255})})); 20 | end resistor; 21 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/BasicComponents/switch.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical.BasicComponents; 2 | model switch "basic switch" 3 | extends MicroGrid.Electrical.Interfaces.OnePort; 4 | Modelica.Blocks.Interfaces.BooleanInput control "true => switch is closed, false => switch is open" annotation(Placement(transformation(origin = {0, 70}, extent = {{-20, -20}, {20, 20}}, rotation = 270))); 5 | parameter Modelica.SIunits.Resistance r_on(final min = 0) = 1.E-5 "Forward ON state resistance"; 6 | parameter Modelica.SIunits.Conductance g_off(final min = 0) = 0 "Backward OFF state conductance"; 7 | protected 8 | Boolean off "Indicates off-state"; 9 | Real s(final unit="1") "Auxiliary variable for actual position on the switch characteristic"; 10 | Modelica.SIunits.Voltage unitVoltage = 1 annotation(HideResult = true); 11 | Modelica.SIunits.Current unitCurrent = 1 annotation(HideResult = true); 12 | equation 13 | off = not control; 14 | v = s*(if off then unitVoltage else r_on*unitCurrent); 15 | i = s*(if off then g_off*unitVoltage else unitCurrent); 16 | annotation(Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics={ Ellipse(extent = {{-44, 4}, {-36, -4}}, lineColor = {0, 0, 255}), Line(points = {{-80, 0}, {-44, 0}}, color = {0, 0, 255}), Line(points = {{-37, 2}, {40, 50}}, color = {0, 0, 255}), Line(points = {{40, 0}, {80, 0}}, color = {0, 0, 255})}), Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics={ Ellipse(extent = {{-44, 4}, {-36, -4}}, lineColor = {0, 0, 255}), Line(points = {{-90, 0}, {-44, 0}}, color = {0, 0, 255}), Line(points = {{-37, 2}, {40, 50}}, color = {0, 0, 255}), Line(points = {{40, 0}, {90, 0}}, color = {0, 0, 255}), Text(extent = {{-150, -30}, {150, -70}}, textString = "%name", lineColor = {0, 0, 255})})); 17 | end switch; 18 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Branches/Breakers/package.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical.Branches; 2 | package Breakers 3 | extends Modelica.Icons.Package; 4 | 5 | end Breakers; 6 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Branches/Breakers/package.order: -------------------------------------------------------------------------------- 1 | threePhaseBreaker 2 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Branches/Breakers/threePhaseBreaker.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical.Branches.Breakers; 2 | model threePhaseBreaker "Ideal three-phase breaker." 3 | parameter Modelica.SIunits.Time ClosingTime = 0.01 "Start time"; 4 | Modelica.Blocks.Sources.BooleanStep booleanStep1(startTime=ClosingTime, startValue=false) annotation(Placement(visible = true, transformation(origin={-44,88}, extent = {{-7.638, -7.638}, {7.638, 7.638}}, rotation = 0))); 5 | Electrical.Interfaces.PositivePin p1 annotation (Placement(transformation(extent={{-106,50},{-86,70}}))); 6 | Electrical.Interfaces.PositivePin p2 annotation (Placement(transformation(extent={{-106,-10},{-86,10}}))); 7 | Electrical.Interfaces.PositivePin p3 annotation (Placement(transformation(extent={{-106,-70},{-86,-50}}))); 8 | Electrical.Interfaces.NegativePin n1 annotation (Placement(transformation(extent={{86,50},{106,70}}))); 9 | Electrical.Interfaces.NegativePin n2 annotation (Placement(transformation(extent={{86,-10},{106,10}}))); 10 | Electrical.Interfaces.NegativePin n3 annotation (Placement(transformation(extent={{86,-70},{106,-50}}))); 11 | BasicComponents.switch switch1(g_off=1E-7) annotation(Placement(visible = true, transformation(origin={-0.442, 12 | 60}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 13 | BasicComponents.switch switch2(g_off=1E-7) annotation(Placement(visible = true, transformation(origin={0.167,0}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 14 | BasicComponents.switch switch3(g_off=1E-7) annotation(Placement(visible = true, transformation(origin={-0.001, 15 | -60}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 16 | equation 17 | 18 | connect(p1, switch1.p) 19 | annotation (Line(points={{-96,60},{-8.442,60}}, color={0,0,255})); 20 | connect(switch1.n, n1) 21 | annotation (Line(points={{7.558,60},{96,60}}, color={0,0,255})); 22 | connect(p2, switch2.p) 23 | annotation (Line(points={{-96,0},{-7.833,0}}, color={0,0,255})); 24 | connect(switch2.n, n2) 25 | annotation (Line(points={{8.167,0},{96,0},{96,0}}, color={0,0,255})); 26 | connect(p3, switch3.p) 27 | annotation (Line(points={{-96,-60},{-8.001,-60}}, color={0,0,255})); 28 | connect(switch3.n, n3) 29 | annotation (Line(points={{7.999,-60},{96,-60}}, color={0,0,255})); 30 | connect(booleanStep1.y, switch1.control) annotation (Line(points={{-35.5982, 31 | 88},{-0.442,88},{-0.442,67}}, color={255,0,255})); 32 | connect(switch2.control, switch1.control) annotation (Line(points={{0.167,7}, 33 | {-16,7},{-16,88},{-0.442,88},{-0.442,67}}, color={255,0,255})); 34 | connect(switch3.control, switch1.control) annotation (Line(points={{-0.001, 35 | -53},{-28,-53},{-28,88},{-0.442,88},{-0.442,67}}, color={255,0,255})); 36 | annotation (Icon(graphics={ Ellipse(extent={{ 37 | -44,64},{-36,56}}, lineColor = {0, 0, 255}), Line(points={{ 38 | -90,60},{-44,60}}, color = {0, 0, 255}), Line(points={{ 39 | -37,62},{40,80}}, color = {0, 0, 255}), Line(points={{ 40 | 40,60},{90,60}}, color = {0, 0, 255}), Text(extent={{ 41 | -152,126},{148,86}}, textString = "%name", lineColor = {0, 0, 255}), 42 | Ellipse(extent={{ 43 | -44,4},{-36,-4}}, lineColor = {0, 0, 255}), Line(points={{ 44 | -90,0},{-44,0}}, color = {0, 0, 255}), Line(points={{ 45 | -37,2},{40,20}}, color = {0, 0, 255}), Line(points={{ 46 | 40,0},{90,0}}, color = {0, 0, 255}), 47 | Ellipse(extent={{ 48 | -44,-56},{-36,-64}}, lineColor = {0, 0, 255}), Line(points={{ 49 | -90,-60},{-44,-60}}, color = {0, 0, 255}), Line(points={{ 50 | -37,-58},{40,-40}}, color = {0, 0, 255}), Line(points={{ 51 | 40,-60},{90,-60}}, color = {0, 0, 255})})); 52 | end threePhaseBreaker; 53 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Branches/Filters/BranchLCL.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical.Branches.Filters; 2 | model BranchLCL "Branch with two RL branches connected in series and a capacitor between them connected to ground." 3 | Interfaces.PositivePin p annotation(Placement(transformation(extent={{-90,-10}, 4 | {-70,10}}))); 5 | Interfaces.NegativePin n annotation (Placement(transformation(extent={{70,-10}, 6 | {90,10}}))); 7 | parameter Modelica.SIunits.Resistance R1 = 0.1 "Left-side resistance"; 8 | parameter Modelica.SIunits.Inductance L1 = 0.1 "Left-side inductance"; 9 | parameter Modelica.SIunits.Resistance R2 = 0.1 "Right-side resistance"; 10 | parameter Modelica.SIunits.Inductance L2 = 0.1 "Right-side inductance"; 11 | parameter Modelica.SIunits.Capacitance C = 0.001 "Branch capacitance"; 12 | BasicComponents.resistor resistor1(R=R1) annotation (Placement(transformation(extent={{-66,-10}, 13 | {-46,10}}))); 14 | BasicComponents.inductor inductor1(i(fixed=true), 15 | L=L1) annotation (Placement(transformation(extent={{-38,-10}, 16 | {-18,10}}))); 17 | BasicComponents.resistor resistor2(R=R2) annotation (Placement(transformation(extent={{18,-10}, 18 | {38,10}}))); 19 | BasicComponents.inductor inductor2(i(fixed=true), 20 | L=L2) annotation (Placement(transformation(extent={{46,-10}, 21 | {66,10}}))); 22 | BasicComponents.capacitor capacitor(v(fixed=true), 23 | C=C) annotation (Placement(transformation( 24 | extent={{-10,-10},{10,10}}, 25 | rotation=-90, 26 | origin={0,-18}))); 27 | BasicComponents.ground ground 28 | annotation (Placement(transformation(extent={{-10,-64},{10,-44}}))); 29 | equation 30 | 31 | connect(capacitor.n, ground.p) annotation (Line(points={{-1.4988e-15,-26},{0,-26}, 32 | {0,-44}}, color={0,0,255})); 33 | 34 | connect(resistor1.p, p) annotation (Line( 35 | points={{-64,0},{-80,0}}, 36 | color={0,0,255}, 37 | smooth=Smooth.Bezier)); 38 | connect(resistor1.n, inductor1.p) annotation (Line( 39 | points={{-48,0},{-42,0},{-36,0}}, 40 | color={0,0,255}, 41 | smooth=Smooth.Bezier)); 42 | connect(resistor2.n, inductor2.p) annotation (Line( 43 | points={{36,0},{42,0},{48,0}}, 44 | color={0,0,255}, 45 | smooth=Smooth.Bezier)); 46 | connect(inductor2.n, n) annotation (Line( 47 | points={{64,0},{80,0}}, 48 | color={0,0,255}, 49 | smooth=Smooth.Bezier)); 50 | connect(capacitor.p, resistor2.p) annotation (Line( 51 | points={{0,-10},{0,0},{20,0}}, 52 | color={0,0,255}, 53 | smooth=Smooth.Bezier)); 54 | annotation (Icon(graphics={ 55 | Text( 56 | extent={{-152,79},{148,39}}, 57 | textString="%name", 58 | lineColor={0,0,255}), 59 | Line(points={{6,0},{6,6},{10,16},{16,16},{18,12},{20,6},{20,0}},color={0,0,255}, smooth= 60 | Smooth.Bezier), 61 | Line(points={{16,12},{12,8},{10,0},{12,-18},{18,-18},{20,-6},{20,0}}, 62 | color={0,0,255}, smooth= 63 | Smooth.Bezier), 64 | Line(points={{30,12},{24,8},{22,0},{24,-18},{30,-18},{32,-6},{32,0}}, 65 | color={0,0,255}, smooth= 66 | Smooth.Bezier), 67 | Line(points={{42,12},{36,8},{34,0},{36,-18},{42,-18},{44,-6},{44,0}}, 68 | color={0,0,255}, smooth= 69 | Smooth.Bezier), 70 | Line(points={{44,14},{48,16},{50,6},{50,4},{50,2},{50,2},{50,0}}, 71 | color={0,0,255}, smooth= 72 | Smooth.Bezier), 73 | Line(points={{32,14},{36,16},{42,16},{44,10},{44,8},{44,4},{44,0}}, 74 | color={0,0,255}, smooth= 75 | Smooth.Bezier), 76 | Line(points={{20,12},{24,16},{30,16},{32,10},{32,8},{32,4},{32,0}}, 77 | color={0,0,255}, smooth= 78 | Smooth.Bezier), 79 | Line( 80 | points={{50,0},{72,0},{70,0}}, 81 | color={0,0,255}, 82 | smooth=Smooth.Bezier), 83 | Line(points={{-50,0},{-50,6},{-46,16},{-40,16},{-38,12},{-36,6},{-36,0}}, 84 | color={0,0,255}, smooth= 85 | Smooth.Bezier), 86 | Line(points={{-40,12},{-44,8},{-46,0},{-44,-18},{-38,-18},{-36,-6},{-36,0}}, 87 | color={0,0,255}, smooth= 88 | Smooth.Bezier), 89 | Line(points={{-26,12},{-32,8},{-34,0},{-32,-18},{-26,-18},{-24,-6},{-24,0}}, 90 | color={0,0,255}, smooth= 91 | Smooth.Bezier), 92 | Line(points={{-14,12},{-20,8},{-22,0},{-20,-18},{-14,-18},{-12,-6},{-12,0}}, 93 | color={0,0,255}, smooth= 94 | Smooth.Bezier), 95 | Line(points={{-12,14},{-8,16},{-6,6},{-6,4},{-6,2},{-6,2},{-6,0}}, 96 | color={0,0,255}, smooth= 97 | Smooth.Bezier), 98 | Line(points={{-24,14},{-20,16},{-14,16},{-12,10},{-12,8},{-12,4},{-12,0}}, 99 | color={0,0,255}, smooth= 100 | Smooth.Bezier), 101 | Line(points={{-36,12},{-32,16},{-26,16},{-24,10},{-24,8},{-24,4},{-24,0}}, 102 | color={0,0,255}, smooth= 103 | Smooth.Bezier), 104 | Line( 105 | points={{-72,0},{-50,0},{-50,0}}, 106 | color={0,0,255}, 107 | smooth=Smooth.Bezier), 108 | Line( 109 | points={{-6,0},{6,0},{6,0}}, 110 | color={0,0,255}, 111 | smooth=Smooth.Bezier), 112 | Line(points={{0,28},{0,-28}}, color={0,0,255}, 113 | origin={0,-32}, 114 | rotation=-90), 115 | Line(points={{0,28},{0,-28}}, color={0,0,255}, 116 | origin={0,-40}, 117 | rotation=-90), 118 | Line(points={{0,0},{0,-32}}, color={0,0,255}), 119 | Line(points={{0,-40},{0,-76}}, 120 | color={0,0,255})})); 121 | end BranchLCL; 122 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Branches/Filters/BranchRL.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical.Branches.Filters; 2 | model BranchRL "Branch with resistor and reactor connected in series." 3 | Interfaces.PositivePin p annotation(Placement(transformation(extent={{-90,-10}, 4 | {-70,10}}))); 5 | Interfaces.NegativePin n annotation (Placement(transformation(extent={{70,-10}, 6 | {90,10}}))); 7 | parameter Modelica.SIunits.Resistance R = 0.1 "Branch resistance"; 8 | parameter Modelica.SIunits.Inductance L = 0.1 "Branch inductance"; 9 | BasicComponents.resistor resistor(R = R) annotation (Placement(transformation(extent={{-30,-10},{-10,10}}))); 10 | BasicComponents.inductor inductor(i(fixed=true), 11 | L = L) annotation (Placement(transformation(extent={{10,-10},{30,10}}))); 12 | equation 13 | 14 | connect(p, resistor.p) 15 | annotation (Line(points={{-80,0},{-28,0}}, color={0,0,255})); 16 | connect(resistor.n, inductor.p) 17 | annotation (Line(points={{-12,0},{12,0}}, color={0,0,255})); 18 | connect(n, inductor.n) 19 | annotation (Line(points={{80,0},{28,0}}, color={0,0,255})); 20 | annotation (Icon(graphics={ 21 | Line(points={{-78,0},{-44,0},{-40,20},{-30,-20}}, color={0,0,255}), 22 | Line(points={{-30,-20},{-20,20},{-10,-20},{-4,0},{6,0}}, color={0,0,255}), 23 | Line(points={{6,0},{6,6},{10,16},{16,16},{18,12},{20,6},{20,0}},color={0,0,255}, smooth= 24 | Smooth.Bezier), 25 | Line(points={{16,12},{12,8},{10,0},{12,-18},{18,-18},{20,-6},{20,0}}, 26 | color={0,0,255}, smooth= 27 | Smooth.Bezier), 28 | Line(points={{30,12},{24,8},{22,0},{24,-18},{30,-18},{32,-6},{32,0}}, 29 | color={0,0,255}, smooth= 30 | Smooth.Bezier), 31 | Line(points={{42,12},{36,8},{34,0},{36,-18},{42,-18},{44,-6},{44,0}}, 32 | color={0,0,255}, smooth= 33 | Smooth.Bezier), 34 | Line(points={{44,14},{48,16},{50,6},{50,4},{50,2},{50,2},{50,0}}, 35 | color={0,0,255}, smooth= 36 | Smooth.Bezier), 37 | Line(points={{32,14},{36,16},{42,16},{44,10},{44,8},{44,4},{44,0}}, 38 | color={0,0,255}, smooth= 39 | Smooth.Bezier), 40 | Line(points={{20,12},{24,16},{30,16},{32,10},{32,8},{32,4},{32,0}}, 41 | color={0,0,255}, smooth= 42 | Smooth.Bezier), 43 | Line( 44 | points={{50,0},{72,0},{70,0}}, 45 | color={0,0,255}, 46 | smooth=Smooth.Bezier), 47 | Text( 48 | extent={{-152,79},{148,39}}, 49 | textString="%name", 50 | lineColor={0,0,255})})); 51 | end BranchRL; 52 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Branches/Filters/ThreePhaseRL.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical.Branches.Filters; 2 | model ThreePhaseRL 3 | parameter Modelica.SIunits.Resistance Rb = 0.1 "Each phase resistance"; 4 | parameter Modelica.SIunits.Inductance Lb = 0.1 "Each phase inductance"; 5 | BranchRL RL1(R=Rb,L=Lb) annotation (Placement(transformation(extent={{-10,50},{10,70}}))); 6 | BranchRL RL2(R=Rb,L=Lb) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); 7 | BranchRL RL3(R=Rb,L=Lb) annotation (Placement(transformation(extent={{-10,-70},{10,-50}}))); 8 | Interfaces.PositivePin p1 annotation(Placement(transformation(extent = {{-106, 50}, {-86, 70}}))); 9 | Interfaces.PositivePin p2 annotation(Placement(transformation(extent = {{-106, -10}, {-86, 10}}))); 10 | Interfaces.PositivePin p3 annotation(Placement(transformation(extent = {{-106, -70}, {-86, -50}}))); 11 | Interfaces.NegativePin n1 annotation (Placement(transformation(extent={{86,50},{106,70}}))); 12 | Interfaces.NegativePin n2 annotation (Placement(transformation(extent={{86,-10},{106,10}}))); 13 | Interfaces.NegativePin n3 annotation (Placement(transformation(extent={{86,-70},{106,-50}}))); 14 | equation 15 | 16 | connect(p1, RL1.p) 17 | annotation (Line(points={{-96,60},{-8,60}}, color={0,0,255})); 18 | connect(p2, RL2.p) 19 | annotation (Line(points={{-96,0},{-8,0}}, color={0,0,255})); 20 | connect(p3, RL3.p) 21 | annotation (Line(points={{-96,-60},{-8,-60}}, color={0,0,255})); 22 | connect(n1, RL1.n) 23 | annotation (Line(points={{96,60},{8,60}}, color={0,0,255})); 24 | connect(n2, RL2.n) annotation (Line(points={{96,0},{8,0}}, color={0,0,255})); 25 | connect(n3, RL3.n) 26 | annotation (Line(points={{96,-60},{8,-60}}, color={0,0,255})); 27 | annotation (Icon(graphics={ 28 | Text( 29 | extent={{-152,123},{148,83}}, 30 | textString="%name", 31 | lineColor={0,0,255}), 32 | Line(points={{-88,60},{-44,60},{-40,80},{-30,40}},color={0,0,255}), 33 | Line(points={{-30,40},{-20,80},{-10,40},{-4,60},{6,60}}, color={0,0,255}), 34 | Line(points={{6,60},{6,66},{10,76},{16,76},{18,72},{20,66},{20,60}}, 35 | color={0,0,255}, smooth= 36 | Smooth.Bezier), 37 | Line(points={{16,72},{12,68},{10,60},{12,42},{18,42},{20,54},{20,60}}, 38 | color={0,0,255}, smooth= 39 | Smooth.Bezier), 40 | Line(points={{30,72},{24,68},{22,60},{24,42},{30,42},{32,54},{32,60}}, 41 | color={0,0,255}, smooth= 42 | Smooth.Bezier), 43 | Line(points={{42,72},{36,68},{34,60},{36,42},{42,42},{44,54},{44,60}}, 44 | color={0,0,255}, smooth= 45 | Smooth.Bezier), 46 | Line(points={{44,74},{48,76},{50,66},{50,64},{50,62},{50,62},{50,60}}, 47 | color={0,0,255}, smooth= 48 | Smooth.Bezier), 49 | Line(points={{32,74},{36,76},{42,76},{44,70},{44,68},{44,64},{44,60}}, 50 | color={0,0,255}, smooth= 51 | Smooth.Bezier), 52 | Line(points={{20,72},{24,76},{30,76},{32,70},{32,68},{32,64},{32,60}}, 53 | color={0,0,255}, smooth= 54 | Smooth.Bezier), 55 | Line( 56 | points={{50,60},{96,60},{86,60}}, 57 | color={0,0,255}, 58 | smooth=Smooth.Bezier), 59 | Line(points={{-86,0},{-44,0},{-40,20},{-30,-20}}, color={0,0,255}), 60 | Line(points={{-30,-20},{-20,20},{-10,-20},{-4,0},{6,0}}, color={0,0,255}), 61 | Line(points={{6,0},{6,6},{10,16},{16,16},{18,12},{20,6},{20,0}},color={0,0,255}, smooth= 62 | Smooth.Bezier), 63 | Line(points={{16,12},{12,8},{10,0},{12,-18},{18,-18},{20,-6},{20,0}}, 64 | color={0,0,255}, smooth= 65 | Smooth.Bezier), 66 | Line(points={{30,12},{24,8},{22,0},{24,-18},{30,-18},{32,-6},{32,0}}, 67 | color={0,0,255}, smooth= 68 | Smooth.Bezier), 69 | Line(points={{42,12},{36,8},{34,0},{36,-18},{42,-18},{44,-6},{44,0}}, 70 | color={0,0,255}, smooth= 71 | Smooth.Bezier), 72 | Line(points={{44,14},{48,16},{50,6},{50,4},{50,2},{50,2},{50,0}}, 73 | color={0,0,255}, smooth= 74 | Smooth.Bezier), 75 | Line(points={{32,14},{36,16},{42,16},{44,10},{44,8},{44,4},{44,0}}, 76 | color={0,0,255}, smooth= 77 | Smooth.Bezier), 78 | Line(points={{20,12},{24,16},{30,16},{32,10},{32,8},{32,4},{32,0}}, 79 | color={0,0,255}, smooth= 80 | Smooth.Bezier), 81 | Line( 82 | points={{50,0},{96,0},{88,0}}, 83 | color={0,0,255}, 84 | smooth=Smooth.Bezier), 85 | Line(points={{-86,-60},{-44,-60},{-40,-40},{-30,-80}}, 86 | color={0,0,255}), 87 | Line(points={{-30,-80},{-20,-40},{-10,-80},{-4,-60},{6,-60}}, 88 | color={0,0,255}), 89 | Line(points={{6,-60},{6,-54},{10,-44},{16,-44},{18,-48},{20,-54},{20,-60}}, 90 | color={0,0,255}, smooth= 91 | Smooth.Bezier), 92 | Line(points={{16,-48},{12,-52},{10,-60},{12,-78},{18,-78},{20,-66},{20,-60}}, 93 | color={0,0,255}, smooth= 94 | Smooth.Bezier), 95 | Line(points={{30,-48},{24,-52},{22,-60},{24,-78},{30,-78},{32,-66},{32,-60}}, 96 | color={0,0,255}, smooth= 97 | Smooth.Bezier), 98 | Line(points={{42,-48},{36,-52},{34,-60},{36,-78},{42,-78},{44,-66},{44,-60}}, 99 | color={0,0,255}, smooth= 100 | Smooth.Bezier), 101 | Line(points={{44,-46},{48,-44},{50,-54},{50,-56},{50,-58},{50,-58},{50,-60}}, 102 | color={0,0,255}, smooth= 103 | Smooth.Bezier), 104 | Line(points={{32,-46},{36,-44},{42,-44},{44,-50},{44,-52},{44,-56},{44,-60}}, 105 | color={0,0,255}, smooth= 106 | Smooth.Bezier), 107 | Line(points={{20,-48},{24,-44},{30,-44},{32,-50},{32,-52},{32,-56},{32,-60}}, 108 | color={0,0,255}, smooth= 109 | Smooth.Bezier), 110 | Line( 111 | points={{50,-60},{96,-60},{86,-60}}, 112 | color={0,0,255}, 113 | smooth=Smooth.Bezier)})); 114 | end ThreePhaseRL; 115 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Branches/Filters/package.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical.Branches; 2 | package Filters 3 | extends Modelica.Icons.Package; 4 | 5 | end Filters; 6 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Branches/Filters/package.order: -------------------------------------------------------------------------------- 1 | BranchRL 2 | BranchLCL 3 | ThreePhaseRL 4 | ThreePhaseLCL 5 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Branches/Lines/package.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical.Branches; 2 | package Lines 3 | extends Modelica.Icons.Package; 4 | 5 | end Lines; 6 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Branches/Lines/package.order: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ALSETLab/MicroGrid/32baa0f79eee0e2ab1f488460d868bd21bfd97dc/MicroGrid/Electrical/Branches/Lines/package.order -------------------------------------------------------------------------------- /MicroGrid/Electrical/Branches/Transformers/package.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical.Branches; 2 | package Transformers 3 | extends Modelica.Icons.Package; 4 | 5 | end Transformers; 6 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Branches/Transformers/package.order: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ALSETLab/MicroGrid/32baa0f79eee0e2ab1f488460d868bd21bfd97dc/MicroGrid/Electrical/Branches/Transformers/package.order -------------------------------------------------------------------------------- /MicroGrid/Electrical/Branches/package.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical; 2 | package Branches 3 | extends Modelica.Icons.Package; 4 | 5 | annotation(Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100}, 6 | {100,100}}), graphics={ 7 | Rectangle( 8 | origin={11.626,40}, 9 | lineColor={0,0,255}, 10 | fillColor={255,255,255}, 11 | fillPattern=FillPattern.Solid, 12 | extent={{-80,-70},{60,-10}}), 13 | Line( 14 | origin={11.626,40}, 15 | points={{60,-40},{80,-40}}, 16 | color={0,0,255}), 17 | Line(points={{-88.374,0},{-68.374,0}}, color={0,0,255})})); 18 | end Branches; 19 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Branches/package.order: -------------------------------------------------------------------------------- 1 | Filters 2 | Transformers 3 | Lines 4 | Breakers 5 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Converters/Boost.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical.Converters; 2 | model Boost "DC/DC Boost Converter" 3 | extends Modelica.Electrical.PowerConverters.Icons.Converter; 4 | parameter Modelica.SIunits.Inductance L_boost "Boost input indctance"; 5 | parameter Modelica.SIunits.Voltage Vdrop "Diode forward voltage drop"; 6 | parameter Modelica.SIunits.Resistance r_diode "Diode forward resistance"; 7 | parameter Modelica.SIunits.Conductance g_diode "Diode reverse conductance"; 8 | parameter Modelica.SIunits.Resistance r_switch "Switch forward resistance"; 9 | parameter Modelica.SIunits.Conductance g_switch "Switch reverse conductance"; 10 | parameter Modelica.SIunits.Frequency f_s "Desired fixed switching frequency"; 11 | Interfaces.PositivePin Input_p annotation(Placement(transformation(extent = {{-106, 70}, {-86, 90}}))); 12 | Interfaces.NegativePin Input_n annotation(Placement(transformation(extent = {{-106, -90}, {-86, -70}}))); 13 | Interfaces.PositivePin Output_p annotation(Placement(transformation(extent = {{86, 70}, {106, 90}}))); 14 | Interfaces.NegativePin Output_n annotation(Placement(transformation(extent = {{86, -90}, {106, -70}}))); 15 | BasicComponents.inductor InputInductor(L = L_boost, i(fixed = true)) annotation(Placement(transformation(extent = {{-36, 16}, {-16, 36}}))); 16 | BasicComponents.diode diode(v_knee = Vdrop, r_on = r_diode, g_off = g_diode) annotation(Placement(transformation(extent = {{16, 16}, {36, 36}}, origin = {0.736, -0.357}, rotation = 0), visible = true)); 17 | BasicComponents.switch switch(r_on = r_switch, g_off = g_switch) annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {0, -2}))); 18 | Control.Interfaces.SignalBus DutyRatio annotation(Placement(transformation(extent = {{-14, -112}, {14, -82}}))); 19 | Control.Modulation.SawtoothPWM sawtoothPWM(f = f_s) annotation(Placement(transformation(extent = {{20, -82}, {40, -62}}))); 20 | equation 21 | connect(InputInductor.p, Input_p) annotation(Line(points = {{-34, 26}, {-60, 26}, {-60, 80}, {-96, 80}}, color = {0, 0, 255})); 22 | connect(diode.n, Output_p) annotation(Line(points = {{34.736, 25.643}, {60, 26}, {60, 80}, {96, 80}}, color = {0, 0, 255}, visible = true)); 23 | connect(diode.p, switch.p) annotation(Line(points={{12.491,6.547},{-6.245, 24 | 6.547},{-6.245,-13.096}}, color = {0, 0, 255}, visible = true, origin = {6.245, 19.096})); 25 | connect(switch.n, Output_n) annotation(Line(points = {{-1.77636e-15, -10}, {-1.77636e-15, -22}, {0, -22}, {0, -32}, {48, -32}, {48, -80}, {96, -80}}, color = {0, 0, 255})); 26 | connect(DutyRatio, sawtoothPWM.InputDutyRatio) annotation(Line(points = {{1.77636e-15, -97}, {1.77636e-15, -72.1}, {20.6, -72.1}}, color = {0, 128, 0}, thickness = 0.5)); 27 | connect(switch.control, sawtoothPWM.fire) annotation(Line(points = {{7, -2}, {36, -2}, {36, -61}}, color = {255, 0, 255})); 28 | connect(Input_n, Output_n) annotation(Line(points = {{-96, -80}, {-52, -80}, {-52, -32}, {48, -32}, {48, -80}, {96, -80}}, color = {0, 0, 255})); 29 | connect(InputInductor.n, switch.p) annotation(Line(visible = true, origin = {-6, 19.333}, points = {{-12, 6.667}, {6, 6.667}, {6, -13.333}}, color = {0, 0, 255})); 30 | annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), graphics={ Text(visible = true, origin = {46.093, -32.57}, extent = {{-37.781, -32.57}, {37.781, 32.57}}, textString = "DC"), Text(visible = true, origin = {-30, 42.57}, extent = {{-37.781, -32.57}, {37.781, 32.57}}, textString = "DC")})); 31 | end Boost; 32 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Converters/BuckBoost.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical.Converters; 2 | model BuckBoost "DC/DC Buck-Boost Converter" 3 | extends Modelica.Electrical.PowerConverters.Icons.Converter; 4 | parameter Modelica.SIunits.Inductance L_boost "Boost input indctance"; 5 | parameter Modelica.SIunits.Voltage Vdrop "Diode forward voltage drop"; 6 | parameter Modelica.SIunits.Resistance r_diode "Diode forward resistance"; 7 | parameter Modelica.SIunits.Conductance g_diode "Diode reverse conductance"; 8 | parameter Modelica.SIunits.Resistance r_switch "Switch forward resistance"; 9 | parameter Modelica.SIunits.Conductance g_switch "Switch reverse conductance"; 10 | parameter Modelica.SIunits.Frequency f_s "Desired fixed switching frequency"; 11 | Interfaces.PositivePin Input_p annotation(Placement(transformation(extent = {{-106, 70}, {-86, 90}}))); 12 | Interfaces.NegativePin Input_n annotation(Placement(transformation(extent = {{-106, -90}, {-86, -70}}))); 13 | Interfaces.PositivePin Output_p annotation(Placement(transformation(extent = {{86, 70}, {106, 90}}))); 14 | Interfaces.NegativePin Output_n annotation(Placement(transformation(extent = {{86, -90}, {106, -70}}))); 15 | BasicComponents.inductor InputInductor(L = L_boost, i(fixed = true)) annotation(Placement(transformation(extent = {{-36, 16}, {-16, 36}}, origin = {-34, 29}, rotation = 0), visible = true)); 16 | BasicComponents.diode diode(v_knee = Vdrop, r_on = r_diode, g_off = g_diode) annotation(Placement(transformation(extent = {{16, 16}, {36, 36}}, origin = {17, 29}, rotation = 0), visible = true)); 17 | BasicComponents.switch switch(r_on = r_switch, g_off = g_switch) annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {0, -2}))); 18 | Control.Interfaces.SignalBus DutyRatio annotation(Placement(transformation(extent = {{-14, -112}, {14, -82}}))); 19 | Control.Modulation.SawtoothPWM sawtoothPWM(f = f_s) annotation(Placement(transformation(extent = {{20, -82}, {40, -62}}))); 20 | BasicComponents.diode diode1(v_knee = Vdrop, r_on = r_diode, g_off = g_diode) annotation(Placement(visible = true, transformation(origin = {-22.165, -2.333}, extent = {{-10, -10}, {10, 10}}, rotation = -270))); 21 | BasicComponents.switch switch1(r_on = r_switch, g_off = g_switch) annotation(Placement(visible = true, transformation(origin = {43.111, 40}, extent = {{-10, 10}, {10, -10}}, rotation = 0))); 22 | Modelica.Blocks.Logical.Not not1 annotation(Placement(visible = true, transformation(origin = {43.302, 15.026}, extent = {{-8.305, -8.305}, {8.305, 8.305}}, rotation = -270))); 23 | equation 24 | connect(InputInductor.p, Input_p) annotation(Line(points = {{-48, 26}, {-60, 26}, {-60, 51}, {-76, 51}}, color = {0, 0, 255}, visible = true, origin = {-20, 29})); 25 | connect(diode.n, Output_p) annotation(Line(points = {{32.555, 26}, {60, 26}, {60, 51}, {77.555, 51}}, color = {0, 0, 255}, visible = true, origin = {18.445, 29})); 26 | connect(InputInductor.n, diode.p) annotation(Line(points = {{-52, -0}, {35, 0}}, color = {0, 0, 255}, visible = true, origin = {-0, 55})); 27 | connect(diode.p, switch.p) annotation(Line(points = {{18, 26}, {-17, 26}, {-17, -23}}, color = {0, 0, 255}, visible = true, origin = {17, 29})); 28 | connect(switch.n, Output_n) annotation(Line(points = {{-22, -10}, {-22, -22}, {-22, -22}, {-22, -32}, {48, -32}, {48, -80}, {74, -80}}, color = {0, 0, 255}, visible = true, origin = {22, -0})); 29 | connect(Output_n, Output_n) annotation(Line(points = {{96, -80}, {96, -80}}, color = {0, 0, 255})); 30 | connect(DutyRatio, DutyRatio) annotation(Line(points = {{1.77636e-15, -97}, {1.77636e-15, -97}}, color = {0, 128, 0}, thickness = 0.5)); 31 | connect(DutyRatio, sawtoothPWM.InputDutyRatio) annotation(Line(points = {{1.77636e-15, -97}, {1.77636e-15, -72.1}, {20.6, -72.1}}, color = {0, 128, 0}, thickness = 0.5)); 32 | connect(switch.control, sawtoothPWM.fire) annotation(Line(points = {{7, -2}, {36, -2}, {36, -61}}, color = {255, 0, 255})); 33 | connect(Output_p, Output_p) annotation(Line(points = {{96, 80}, {96, 80}}, color = {0, 0, 255})); 34 | connect(Input_n, switch.n) annotation(Line(visible = true, origin = {-47.2, -46.91}, points = {{-48.8, -33.09}, {-22.8, -33.09}, {-22.8, 14.635}, {47.2, 14.635}, {47.2, 36.91}}, color = {0, 0, 255})); 35 | connect(diode1.n, switch.p) annotation(Line(visible = true, origin = {-11.082, 7.417}, points={{-11.083, 36 | -1.75},{-11.083,1.583},{11.082,1.583},{11.082,-1.417}}, color = {0, 0, 255})); 37 | connect(diode1.p, switch.n) annotation(Line(visible = true, origin = {-11.082, -11.75}, points={{-11.083, 38 | 1.417},{-11.083,-1.583},{11.082,-1.583},{11.082,1.75}}, color = {0, 0, 255})); 39 | connect(switch1.p, diode.p) annotation(Line(visible = true, origin = {35.074, 50}, points = {{0.037, -10}, {0.037, 5}, {-0.074, 5}}, color = {0, 0, 255})); 40 | connect(switch1.n, diode.n) annotation(Line(visible = true, origin = {51.074, 50}, points = {{0.037, -10}, {0.037, 5}, {-0.074, 5}}, color = {0, 0, 255})); 41 | connect(not1.u, sawtoothPWM.fire) annotation(Line(visible = true, origin = {39.651, -13.693}, points = {{3.651, 18.753}, {3.651, 13.693}, {-3.651, 13.693}, {-3.651, -47.307}}, color = {190, 52, 178})); 42 | connect(not1.y, switch1.control) annotation(Line(visible = true, origin = {43.207, 28.79}, points={{0.095, 43 | -4.6285},{0.095,0.21},{-0.096,0.21},{-0.096,4.21}}, color = {190, 52, 178})); 44 | annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), graphics={ Text(visible = true, origin = {46.093, -32.57}, extent = {{-37.781, -32.57}, {37.781, 32.57}}, textString = "DC"), Text(visible = true, origin = {-32.219, 47.43}, extent = {{-37.781, -32.57}, {37.781, 32.57}}, textString = "DC")})); 45 | end BuckBoost; 46 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Converters/package.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical; 2 | package Converters 3 | extends Modelica.Icons.Package; 4 | 5 | annotation(Icon(graphics={ Line(points = {{-78, 0}, {80, 0}}, color = {95, 95, 95}), Line(points = {{36, 50}, {36, -52}}, color = {95, 95, 95}), Polygon(points = {{36, 0}, {-34, 50}, {-34, -50}, {36, 0}}, lineColor = {95, 95, 95})})); 6 | end Converters; 7 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Converters/package.order: -------------------------------------------------------------------------------- 1 | Boost 2 | BuckBoost 3 | VSC01 4 | VSC02 5 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Examples/Boost_Example.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical.Examples; 2 | model Boost_Example 3 | extends Modelica.Icons.Example; 4 | MicroGrid.Electrical.Sources.voltageDC voltageDC(V = 1.5) annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {-68, 10}))); 5 | MicroGrid.Electrical.BasicComponents.ground ground annotation(Placement(transformation(extent = {{-78, -34}, {-58, -14}}))); 6 | MicroGrid.Electrical.BasicComponents.capacitor OutputCapacitor(C = 0.00047, v(fixed = true)) annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {14, 10}))); 7 | MicroGrid.Electrical.BasicComponents.resistor LoadResistor(R = 75) annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {40, 10}))); 8 | MicroGrid.Electrical.Converters.Boost switchedBoost( 9 | L_boost=0.0001, 10 | f_s=50000, 11 | r_diode=1E-5, 12 | g_diode=1E-5, 13 | r_switch=1E-5, 14 | g_switch=1E-5, 15 | Vdrop=0.475) 16 | annotation (Placement(transformation(extent={{-28,0},{-8,20}}))); 17 | Modelica.Blocks.Sources.Constant DutyRatioValue(k = 0.75) annotation(Placement(transformation(extent = {{54, -46}, {34, -26}}))); 18 | MicroGrid.Control.Interfaces.Real2Control real2Control annotation(Placement(transformation(extent = {{20, -46}, {0, -26}}))); 19 | MicroGrid.Sensors.CurrentSensor currentSensor annotation(Placement(transformation(extent = {{-56, 28}, {-36, 8}}))); 20 | MicroGrid.Sensors.VoltageSensor voltageSensor annotation(Placement(transformation(extent = {{-10, 10}, {10, -10}}, rotation = -90, origin = {74, 10}))); 21 | equation 22 | connect(voltageDC.n, ground.p) annotation(Line(points = {{-68, 2}, {-68, -14}}, color = {0, 0, 255})); 23 | connect(voltageDC.n, switchedBoost.Input_n) annotation(Line(points = {{-68, 2}, {-27.6, 2}}, color = {0, 0, 255})); 24 | connect(switchedBoost.Output_p, OutputCapacitor.p) annotation(Line(points = {{-8.4, 18}, {14, 18}}, color = {0, 0, 255})); 25 | connect(switchedBoost.Output_n, OutputCapacitor.n) annotation(Line(points = {{-8.4, 2}, {14, 2}}, color = {0, 0, 255})); 26 | connect(OutputCapacitor.p, LoadResistor.p) annotation(Line(points = {{14, 18}, {40, 18}}, color = {0, 0, 255})); 27 | connect(OutputCapacitor.n, LoadResistor.n) annotation(Line(points = {{14, 2}, {40, 2}}, color = {0, 0, 255})); 28 | connect(real2Control.InputReal, DutyRatioValue.y) annotation(Line(points = {{19, -36}, {33, -36}}, color = {0, 0, 127})); 29 | connect(real2Control.OutputSignal, switchedBoost.DutyRatio) annotation(Line(points={{0.5, 30 | -35.9},{-18,-35.9},{-18,0.3}}, color = {0, 128, 0}, thickness = 0.5)); 31 | connect(voltageDC.p, currentSensor.p) annotation(Line(points = {{-68, 18}, {-56, 18}}, color = {0, 0, 255})); 32 | connect(currentSensor.n, switchedBoost.Input_p) annotation(Line(points = {{-36, 18}, {-27.6, 18}}, color = {0, 0, 255})); 33 | connect(LoadResistor.p, voltageSensor.p) annotation(Line(points = {{40, 18}, {40, 20}, {74, 20}}, color = {0, 0, 255})); 34 | connect(voltageSensor.n, LoadResistor.n) annotation(Line(points = {{74, 0}, {40, 0}, {40, 2}}, color = {0, 0, 255})); 35 | end Boost_Example; 36 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Examples/PV_Example.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical.Examples; 2 | model PV_Example 3 | extends Modelica.Icons.Example; 4 | parameter PhotoVoltaics.Records.SHARP_NU_S5_E3E panelData annotation(Placement(visible = true, transformation(origin = {130, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 5 | // replaceable record panelData = MicroGrid.PhotoVoltaics.Records.LG300N1C_G4 constrainedby MicroGrid.PhotoVoltaics.Records.ModuleData annotation(choicesAllMatching, Placement(visible = true, transformation(origin = {80, 80}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-20, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0))); 6 | PhotoVoltaics.PV_module PV1(moduleData = panelData, Ns = 3, Np = 3) annotation(Placement(visible = true, transformation(origin = {0.312, -90.466}, extent = {{15, -15}, {-15, 15}}, rotation = 360))); 7 | Converters.Boost Boost( 8 | Vdrop=0, 9 | r_diode=1E-5, 10 | g_diode=1E-5, 11 | r_switch=1E-5, 12 | g_switch=1E-5, 13 | f_s=100000, 14 | L_boost=0.005) annotation (Placement(visible=true, transformation( 15 | origin={0,45}, 16 | extent={{15,-15},{-15,15}}, 17 | rotation=270))); 18 | Sensors.VoltageSensor voltageSensor1 annotation(Placement(visible = true, transformation(origin = {2.028, -57.418}, extent = {{12.214, 12.214}, {-12.214, -12.214}}, rotation = 0))); 19 | Sensors.CurrentSensor currentSensor1 annotation(Placement(visible = true, transformation(origin = {14.869, -32.841}, extent = {{12.841, 12.841}, {-12.841, -12.841}}, rotation = -90))); 20 | Control.RefGenerators.mppt mppt1( 21 | vref( start = 75, fixed = true), 22 | Ts = 0.001, deltaVpvRefPanel = 0.05) annotation(Placement(visible = true, transformation(origin = {60.847, -38.803}, extent = {{12.829, -12.829}, {-12.829, 12.829}}, rotation = 180))); 23 | Control.Feedback.BoostControl boostControl1(TimeCons = 0.005, Gain = 0.005) annotation(Placement(visible = true, transformation(origin = {85, 17.808}, extent = {{15, 15}, {-15, -15}}, rotation = 270))); 24 | Sources.voltageDC V_dc(V = 400) annotation(Placement(visible = true, transformation(origin = {0, 84.848}, extent = {{15.152, -15.152}, {-15.152, 15.152}}, rotation = 0))); 25 | BasicComponents.resistor resistor1(R = 0.02) annotation(Placement(visible = true, transformation(origin = {22.93, 17.192}, extent = {{-10, -10}, {10, 10}}, rotation = -270))); 26 | BasicComponents.capacitor capacitor1(C = 0.00004, v( 27 | start = 0, fixed = true)) 28 | annotation(Placement(visible = true, transformation(origin = {-0.789, 3.769}, extent = {{10.789, -10.789}, {-10.789, 10.789}}, rotation = 0))); 29 | Modelica.Blocks.Sources.Constant Temperature(k = 303) annotation(Placement(visible = true, transformation(origin = {-30, -112.41}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 30 | BasicComponents.ground ground1 annotation(Placement(visible = true, transformation(origin = {-43.519, 83.762}, extent = {{-10, -10}, {10, 10}}, rotation = -90))); 31 | Modelica.Blocks.Sources.Trapezoid Irradiation(offset = 700, falling = 0.1, rising = 0.1, amplitude = 100, width = 0.3, startTime = 0.1) annotation(Placement(visible = true, transformation(origin = {38.371, -110}, extent = {{10, -10}, {-10, 10}}, rotation = 0))); 32 | equation 33 | connect(currentSensor1.p, voltageSensor1.p) annotation(Line(visible = true, origin = {14.66, -53.506}, points = {{0.209, 7.824}, {0.209, -3.912}, {-0.418, -3.912}}, color = {0, 0, 255})); 34 | connect(currentSensor1.currSignal, mppt1.i) annotation(Line(visible = true, origin = {41.376, -32.773}, points={{ 35 | -14.5007,0.06041},{3.626,0.06041},{3.626,-0.0604097},{7.24894, 36 | -0.0604097}}, color = {255, 0, 0})); 37 | connect(voltageSensor1.voltSignal, mppt1.u) annotation(Line(visible = true, origin = {28.556, -43.814}, points={{-26.528, 38 | -2.18391},{-26.528,1.61},{16.446,1.61},{16.446,-0.516503},{20.1626, 39 | -0.516503}}, color = {255, 0, 0})); 40 | connect(mppt1.y, boostControl1.V_ref) annotation(Line(visible = true, origin = {85.493, -24.56}, points={{ 41 | -12.5176,-14.243},{6.2594,-14.243},{6.2594,28.4885}}, color = {0, 128, 0})); 42 | connect(boostControl1.DutyRatio, Boost.DutyRatio) annotation(Line(visible = true, origin = {39.354, 59.013}, points={{45.996, 43 | -26.9728},{45.996,0.531},{45.996,0.987},{45.996,10.563},{-65.507, 44 | 10.563},{-65.507,-14.013},{-53.904,-14.013}}, color = {0, 128, 0})); 45 | connect(V_dc.p, Boost.Output_p) annotation(Line(visible = true, origin = {14.485, 71.154}, points={{-2.3634, 46 | 13.694},{3.667,13.694},{3.667,-7.817},{-2.485,-7.817},{-2.485,-11.754}}, color = {0, 0, 255})); 47 | connect(V_dc.n, Boost.Output_n) annotation(Line(visible = true, origin = {-14.485, 71.154}, points={{2.3634, 48 | 13.694},{-3.667,13.694},{-3.667,-7.817},{2.485,-7.817},{2.485,-11.754}}, color = {0, 0, 255})); 49 | connect(Boost.Input_p, resistor1.n) annotation(Line(visible = true, origin = {17.465, 28.044}, points = {{-5.465, 2.556}, {-5.465, 0.148}, {5.465, 0.148}, {5.465, -2.852}}, color = {0, 0, 255})); 50 | connect(resistor1.p, currentSensor1.n) annotation(Line(visible = true, origin = {18.899, -11.202}, points={{4.031, 51 | 20.394},{4.031,-5.798},{-4.03,-5.798},{-4.03,-8.798}}, color = {0, 0, 255})); 52 | connect(voltageSensor1.voltSignal, boostControl1.V_measured) annotation(Line(visible = true, origin = {40.514, -13.092}, points={{-38.486, 53 | -32.9059},{-38.486,7.944},{38.486,7.944},{38.486,17.018}}, color = {255, 0, 0})); 54 | connect(capacitor1.p, resistor1.p) annotation(Line(visible = true, origin = {17.901, 5.577}, points={{ 55 | -10.0588,-1.808},{5.029,-1.808},{5.029,3.615}}, color = {0, 0, 255})); 56 | connect(Temperature.y, PV1.T) annotation(Line(visible = true, origin = {-11.125, -109.095}, points = {{-7.875, -3.315}, {3.937, -3.315}, {3.937, 6.629}}, color = {1, 37, 163})); 57 | connect(Boost.Input_n, capacitor1.n) annotation(Line(visible = true, origin = {-12.515, 18.293}, points={{0.515, 58 | 12.307},{0.515,8.37},{-2.063,8.37},{-2.063,-14.524},{3.0948,-14.524}}, color = {0, 0, 255})); 59 | connect(capacitor1.n, voltageSensor1.n) annotation(Line(visible = true, origin = {-12.191, -26.825}, points={{2.7708, 60 | 30.594},{-2.387,30.594},{-2.387,-30.593},{2.005,-30.593}}, color = {0, 0, 255})); 61 | connect(ground1.p, V_dc.n) annotation(Line(visible = true, origin = {-20.486, 84.305}, points={{-13.033, 62 | -0.543},{2.334,-0.543},{2.334,0.543},{8.3644,0.543}}, color = {0, 0, 255})); 63 | connect(PV1.p, voltageSensor1.p) annotation(Line(visible = true, origin = {14.794, -73.942}, points = {{-2.482, -16.524}, {1.517, -16.524}, {1.517, 16.524}, {-0.552, 16.524}}, color = {0, 0, 255})); 64 | connect(voltageSensor1.n, PV1.n) annotation(Line(visible = true, origin = {-13.313, -73.942}, points = {{3.127, 16.524}, {-2.375, 16.524}, {-2.375, -16.524}, {1.625, -16.524}}, color = {0, 0, 255})); 65 | connect(Irradiation.y, PV1.Irr) annotation(Line(visible = true, origin = {14.332, -107.489}, points={{13.039, 66 | -2.511},{-6.52,-2.511},{-6.52,5.023}}, color = {1, 37, 163})); 67 | annotation(experiment(StopTime = 0.4), Diagram(coordinateSystem(extent = {{-160, -134.3}, {160, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}))); 68 | end PV_Example; 69 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Examples/package.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical; 2 | package Examples 3 | extends Modelica.Icons.ExamplesPackage; 4 | end Examples; 5 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Examples/package.order: -------------------------------------------------------------------------------- 1 | Boost_Example 2 | PV_Example 3 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Interfaces/NegativePin.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical.Interfaces; 2 | connector NegativePin "Negative pin of an electric component" 3 | Modelica.SIunits.Voltage v "Potential at the pin" annotation ( 4 | unassignedMessage="An electrical potential cannot be uniquely calculated. 5 | The reason could be that 6 | - a ground object is missing (Modelica.Electrical.Analog.Basic.Ground) 7 | to define the zero potential of the electrical circuit, or 8 | - a connector of an electrical component is not connected."); 9 | flow Modelica.SIunits.Current i "Current flowing into the pin" annotation ( 10 | unassignedMessage="An electrical current cannot be uniquely calculated. 11 | The reason could be that 12 | - a ground object is missing (Modelica.Electrical.Analog.Basic.Ground) 13 | to define the zero potential of the electrical circuit, or 14 | - a connector of an electrical component is not connected."); 15 | annotation (defaultComponentName="pin_n", 16 | Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100, 17 | 100}}), graphics={Rectangle( 18 | extent={{-100,100},{100,-100}}, 19 | lineColor={0,0,255}, 20 | fillColor={255,255,255}, 21 | fillPattern=FillPattern.Solid)}), 22 | Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{ 23 | 100,100}}), graphics={Rectangle( 24 | extent={{-40,40},{40,-40}}, 25 | lineColor={0,0,255}, 26 | fillColor={255,255,255}, 27 | fillPattern=FillPattern.Solid), Text( 28 | extent={{-40,110},{160,50}}, 29 | textString="%name", 30 | lineColor={0,0,255})})); 31 | end NegativePin; 32 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Interfaces/OnePort.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical.Interfaces; 2 | partial model OnePort 3 | "Electrical component with two electrical pins, one positive and one negative." 4 | Modelica.SIunits.Voltage v "Voltage drop between the two pins (= p.v - n.v)"; 5 | Modelica.SIunits.Current i "Current flowing from pin p to pin n"; 6 | MicroGrid.Electrical.Interfaces.PositivePin p "Potential p.v greater than potential n.v" 7 | annotation (Placement(transformation(extent={{-90,-10},{-70,10}}))); 8 | MicroGrid.Electrical.Interfaces.NegativePin n 9 | annotation (Placement(transformation(extent={{70,-10},{90,10}}))); 10 | equation 11 | // Current enter by the positive pin: 12 | i = p.i; 13 | // Kirchhoff's First Law: 14 | p.i+n.i=0; 15 | // Voltage drop betweem pins: 16 | p.v-n.v = v; 17 | annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( 18 | coordinateSystem(preserveAspectRatio=false))); 19 | end OnePort; 20 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Interfaces/PositivePin.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical.Interfaces; 2 | connector PositivePin "Positive pin of an electric component" 3 | Modelica.SIunits.Voltage v "Potential at the pin" annotation ( 4 | unassignedMessage="An electrical potential cannot be uniquely calculated. 5 | The reason could be that 6 | - a ground object is missing (Modelica.Electrical.Analog.Basic.Ground) 7 | to define the zero potential of the electrical circuit, or 8 | - a connector of an electrical component is not connected."); 9 | flow Modelica.SIunits.Current i "Current flowing into the pin" annotation ( 10 | unassignedMessage="An electrical current cannot be uniquely calculated. 11 | The reason could be that 12 | - a ground object is missing (Modelica.Electrical.Analog.Basic.Ground) 13 | to define the zero potential of the electrical circuit, or 14 | - a connector of an electrical component is not connected."); 15 | annotation (defaultComponentName="pin_p", 16 | Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100, 17 | 100}}), graphics={Rectangle( 18 | extent={{-100,100},{100,-100}}, 19 | lineColor={0,0,255}, 20 | fillColor={0,0,255}, 21 | fillPattern=FillPattern.Solid)}), 22 | Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{ 23 | 100,100}}), graphics={Rectangle( 24 | extent={{-40,40},{40,-40}}, 25 | lineColor={0,0,255}, 26 | fillColor={0,0,255}, 27 | fillPattern=FillPattern.Solid), Text( 28 | extent={{-160,110},{40,50}}, 29 | lineColor={0,0,255}, 30 | textString="%name")})); 31 | end PositivePin; 32 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Interfaces/Wave2Phasor.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical.Interfaces; 2 | model Wave2Phasor "This model allows the wave-phasor interface between 3 | MicroGrid library and OpenIPSL using SOGI filter input." 4 | extends Modelica.Electrical.PowerConverters.Icons.Converter; 5 | // Pins for wave signal: 6 | PositivePin PinA annotation (Placement(transformation(extent={{80,70},{100,90}}), 7 | iconTransformation(extent={{80,70},{100,90}}))); 8 | PositivePin PinB annotation (Placement(transformation(extent={{80,-10},{100,10}}))); 9 | PositivePin PinC annotation (Placement(transformation(extent={{80,-90},{100,-70}}), 10 | iconTransformation(extent={{80,-90},{100,-70}}))); 11 | NegativePin PinGrd annotation (Placement(transformation(extent={{-10,-100},{10, 12 | -80}}), iconTransformation(extent={{-10,-100},{10,-80}}))); 13 | // Pin for phasor signal: 14 | OpenIPSL.Interfaces.PwPin PSPin annotation (Placement(transformation(extent={{-100,-10},{-80,10}}))); 15 | // Pins for filtering: 16 | Modelica.Blocks.Interfaces.RealInput iapos annotation (Placement(transformation( 17 | extent={{-20,-20},{20,20}}, 18 | rotation=-90, 19 | origin={-60,106}), iconTransformation( 20 | extent={{-12,-12},{12,12}}, 21 | rotation=-90, 22 | origin={-60,94}))); 23 | Modelica.Blocks.Interfaces.RealInput ibpos annotation (Placement(transformation( 24 | extent={{-20,-20},{20,20}}, 25 | rotation=-90, 26 | origin={-20,106}), iconTransformation( 27 | extent={{-12,-12},{12,12}}, 28 | rotation=-90, 29 | origin={-20,94}))); 30 | Modelica.Blocks.Interfaces.RealOutput ialpha annotation (Placement(transformation( 31 | extent={{-10,-10},{10,10}}, 32 | rotation=90, 33 | origin={20,106}), iconTransformation( 34 | extent={{-10,-10},{10,10}}, 35 | rotation=90, 36 | origin={20,98}))); 37 | Modelica.Blocks.Interfaces.RealOutput ibeta annotation (Placement(transformation( 38 | extent={{-10,-10},{10,10}}, 39 | rotation=90, 40 | origin={40,106}), iconTransformation( 41 | extent={{-10,-10},{10,10}}, 42 | rotation=90, 43 | origin={60,98}))); 44 | // Parameters: 45 | parameter Modelica.SIunits.ApparentPower S_b(displayUnit="MVA")=100e6 46 | "System base power" 47 | annotation (Dialog(group="Power system data", enable=enableS_b)); 48 | parameter Modelica.SIunits.Voltage V_b(displayUnit="kV")=400e3 49 | "Base voltage of the bus" 50 | annotation (Dialog(group="Power system data", enable=enableV_b)); 51 | parameter Modelica.SIunits.Frequency fn(displayUnit="Hz")=60 52 | "System frequency" 53 | annotation (Dialog(group="Power system data", enable=enablefn)); 54 | // Importing pi constant: 55 | import Modelica.Constants.pi; 56 | protected 57 | Modelica.SIunits.Voltage MagV; // voltage magnitude in phasor domain 58 | Modelica.SIunits.Angle AngV; // voltage angle in phasor domain 59 | equation 60 | // ----- Current equations: 61 | PinGrd.i = -PinA.i-PinB.i-PinC.i; 62 | // Calculating Clarke transformation and filtering fundamental component: 63 | ialpha = (0.5)*(2/3)*(PinA.i - (1/2)*PinB.i - (1/2)*PinC.i); 64 | ibeta = (0.5)*(2/3)*((sqrt(3)/2)*PinB.i - (sqrt(3)/2)*PinC.i); 65 | // Real and imaginary parts of the current for phasor using Park transf.: 66 | PSPin.ii= -(1/sqrt(2))*(V_b/S_b)*(iapos*Modelica.Math.cos(2*pi*fn*time)+ibpos*Modelica.Math.sin(2*pi*fn*time)); 67 | PSPin.ir= -(1/sqrt(2))*(V_b/S_b)*(-iapos*Modelica.Math.sin(2*pi*fn*time)+ibpos*Modelica.Math.cos(2*pi*fn*time)); 68 | // ----- Voltage equations: 69 | // Magnitude and angle for voltage signal: 70 | MagV = V_b*sqrt(PSPin.vr^2 + PSPin.vi^2); 71 | AngV = Modelica.Math.atan2(PSPin.vi,PSPin.vr); 72 | // Voltage difference between two nodes: 73 | PinA.v-PinGrd.v = MagV*sqrt(2/3)*Modelica.Math.sin(2*pi*fn*time+AngV); 74 | PinB.v-PinGrd.v = MagV*sqrt(2/3)*Modelica.Math.sin(2*pi*fn*time+AngV-2*pi/3); 75 | PinC.v-PinGrd.v = MagV*sqrt(2/3)*Modelica.Math.sin(2*pi*fn*time+AngV+2*pi/3); 76 | annotation (Icon(graphics={Text( 77 | extent={{-72,74},{0,40}}, 78 | lineColor={0,0,0}, 79 | textString="Phasor"), Text( 80 | extent={{0,-22},{72,-56}}, 81 | lineColor={0,0,0}, 82 | textString="Wave")})); 83 | end Wave2Phasor; 84 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Interfaces/package.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical; 2 | package Interfaces 3 | extends Modelica.Icons.InterfacesPackage; 4 | 5 | end Interfaces; 6 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Interfaces/package.order: -------------------------------------------------------------------------------- 1 | PositivePin 2 | NegativePin 3 | OnePort 4 | Wave2Phasor 5 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Sources/currentDC.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical.Sources; 2 | model currentDC "DC Current source using a real input as signalfor current" 3 | MicroGrid.Electrical.Interfaces.PositivePin p annotation (Placement(transformation(extent={{-110, 4 | -10},{-90,10}}))); 5 | MicroGrid.Electrical.Interfaces.NegativePin n annotation (Placement(transformation(extent={{110, 6 | -10},{90,10}}))); 7 | Modelica.SIunits.Voltage v "Voltage drop between the two pins (= p.v - n.v)"; 8 | Modelica.Blocks.Interfaces.RealInput i(unit="A") 9 | "Current flowing from pin p to pin n as input signal" annotation ( 10 | Placement(transformation( 11 | origin={0,70}, 12 | extent={{-20,-20},{20,20}}, 13 | rotation=270))); 14 | equation 15 | v = p.v - n.v; 16 | 0 = p.i + n.i; 17 | i = p.i; 18 | annotation ( 19 | Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100, 20 | 100}}), graphics={ 21 | Ellipse( 22 | extent={{-50,50},{50,-50}}, 23 | lineColor={0,0,255}, 24 | fillColor={255,255,255}, 25 | fillPattern=FillPattern.Solid), 26 | Line(points={{-90,0},{-50,0}}, color={0,0,255}), 27 | Line(points={{50,0},{90,0}}, color={0,0,255}), 28 | Line(points={{0,-50},{0,50}}, color={0,0,255}), 29 | Text( 30 | extent={{-150,-120},{150,-80}}, 31 | textString="%name", 32 | lineColor={0,0,255}), 33 | Polygon( 34 | points={{90,0},{60,10},{60,-10},{90,0}}, 35 | lineColor={0,0,255}, 36 | fillColor={0,0,255}, 37 | fillPattern=FillPattern.Solid)}), 38 | Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{ 39 | 100,100}}), graphics={Ellipse( 40 | extent={{-50,50},{50,-50}}, 41 | lineColor={0,0,255}, 42 | fillColor={255,255,255}, 43 | fillPattern=FillPattern.Solid),Line(points={{-96,0},{-50,0}}, 44 | color={0,0,255}),Line(points={{50,0},{96,0}}, color={0,0,255}),Line( 45 | points={{0,-50},{0,50}}, color={0,0,255})})); 46 | end currentDC; 47 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Sources/gateSignal.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical.Sources; 2 | model gateSignal "Signal Generator for Triggering Swiches" 3 | 4 | end gateSignal; 5 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Sources/package.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical; 2 | package Sources 3 | extends Modelica.Icons.SourcesPackage; 4 | 5 | end Sources; 6 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Sources/package.order: -------------------------------------------------------------------------------- 1 | currentDC 2 | voltageDC 3 | singlePhaseAC 4 | threePhaseAC 5 | gateSignal 6 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Sources/singlePhaseAC.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical.Sources; 2 | model singlePhaseAC "Single Phase AC Voltage Source" 3 | parameter Modelica.SIunits.Voltage V(start=1) "Amplitude of voltage waveform"; 4 | parameter Modelica.SIunits.Angle phase=0 "Phase of voltage waveform"; 5 | parameter Modelica.SIunits.Frequency freq(start=1) "Frequency of voltage waveform"; 6 | extends MicroGrid.Electrical.Interfaces.OnePort; 7 | import Modelica.Constants.pi; 8 | equation 9 | v = V*Modelica.Math.sin(2*pi*freq*time + phase); 10 | annotation ( 11 | Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100, 12 | 100}}), graphics={Ellipse( 13 | extent={{-50,50},{50,-50}}, 14 | lineColor={0,0,0}, 15 | fillColor={255,255,255}, 16 | fillPattern=FillPattern.Solid), 17 | Line(points={{-90,0},{-50,0}}, color={0,0,0}), 18 | Line(points={{50,0},{90,0}}, color={0,0,0}), 19 | Line(points={{-50,0},{50,0}}, color={0,0,0}), 20 | Text( 21 | extent={{-150,-104},{150,-64}}, 22 | textString="%name", 23 | lineColor={0,0,255}),Line(points={{-66,0},{-56.2,29.9},{-49.8,46.5}, 24 | {-44.2,58.1},{-39.3,65.2},{-34.3,69.2},{-29.4,69.8},{-24.5,67}, 25 | {-19.6,61},{-14.6,52},{-9,38.6},{-1.98,18.6},{12.79,-26.9},{ 26 | 19.1,-44},{24.8,-56.2},{29.7,-64},{34.6,-68.6},{39.5,-70},{44.5, 27 | -67.9},{49.4,-62.5},{54.3,-54.1},{59.9,-41.3},{67,-21.7},{74,0}}, 28 | color={0,0,255})}), 29 | Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100, 30 | 100}}), graphics={Ellipse( 31 | extent={{-50,50},{50,-50}}, 32 | lineColor={0,0,0}, 33 | fillColor={255,255,255}, 34 | fillPattern=FillPattern.Solid), 35 | Line(points={{-90,0},{-50,0}}, color={0,0,0}), 36 | Line(points={{50,0},{90,0}}, color={0,0,0}), 37 | Line(points={{-50,0},{50,0}}, color={0,0,0}), 38 | Line(points={{-66,0},{-56.2,29.9},{-49.8,46.5}, 39 | {-44.2,58.1},{-39.3,65.2},{-34.3,69.2},{-29.4,69.8},{-24.5,67}, 40 | {-19.6,61},{-14.6,52},{-9,38.6},{-1.98,18.6},{12.79,-26.9},{ 41 | 19.1,-44},{24.8,-56.2},{29.7,-64},{34.6,-68.6},{39.5,-70},{44.5, 42 | -67.9},{49.4,-62.5},{54.3,-54.1},{59.9,-41.3},{67,-21.7},{74,0}}, 43 | color={0,0,0})})); 44 | end singlePhaseAC; 45 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Sources/threePhaseAC.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical.Sources; 2 | model threePhaseAC "Three Phase AC Voltage Source" 3 | parameter Real VLine = 220 "Line voltage, in volts"; 4 | parameter Real FreqHz = 60 "Voltage frequency, in herts"; 5 | Interfaces.PositivePin p1 annotation(Placement(transformation(extent = {{-106, 50}, {-86, 70}}))); 6 | Interfaces.PositivePin p2 annotation(Placement(transformation(extent = {{-106, -10}, {-86, 10}}))); 7 | Interfaces.PositivePin p3 annotation(Placement(transformation(extent = {{-106, -70}, {-86, -50}}))); 8 | singlePhaseAC Phase1(V = VLine * sqrt(2) / sqrt(3), freq = FreqHz) annotation(Placement(transformation(extent = {{-56, 50}, {-36, 70}}))); 9 | singlePhaseAC Phase2(V = VLine * sqrt(2) / sqrt(3), freq = FreqHz, phase = -2.0943951023932) annotation(Placement(transformation(extent = {{-58, -10}, {-38, 10}}))); 10 | singlePhaseAC Phase3(V = VLine * sqrt(2) / sqrt(3), freq = FreqHz, phase = -4.18879020478639) annotation(Placement(transformation(extent = {{-58, -70}, {-38, -50}}))); 11 | Interfaces.NegativePin gnd annotation(Placement(transformation(extent = {{86, -10}, {106, 10}}))); 12 | equation 13 | connect(p1, p1) annotation(Line(points = {{-96, 60}, {-96, 60}}, color = {0, 0, 255})); 14 | connect(Phase1.p, p1) annotation(Line(points={{-54,60},{-96,60}}, color = {0, 0, 255})); 15 | connect(Phase2.p, p2) annotation(Line(points={{-56,0},{-96,0}}, color = {0, 0, 255})); 16 | connect(Phase3.p, p3) annotation(Line(points={{-56,-60},{-96,-60}}, color = {0, 0, 255})); 17 | connect(Phase2.n, gnd) annotation(Line(points={{-40,0},{96,0}}, color = {0, 0, 255})); 18 | connect(Phase3.n, gnd) annotation(Line(points={{-40,-60},{0,-60},{0,0},{96,0}}, color = {0, 0, 255})); 19 | connect(Phase1.n, gnd) annotation(Line(points={{-38,60},{0,60},{0,0},{96,0}}, color = {0, 0, 255})); 20 | annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics={ Ellipse(extent = {{-50, 50}, {50, -50}}, lineColor = {0, 0, 0}, fillColor = {255, 255, 255}, 21 | fillPattern = FillPattern.Solid), Line(points = {{-90, 0}, {-50, 0}}, color = {0, 0, 0}), Line(points = {{50, 0}, {90, 0}}, color = {0, 0, 0}), Line(points = {{-50, 0}, {50, 0}}, color = {0, 0, 0}), Text(extent = {{-150, -104}, {150, -64}}, textString = "%name", lineColor = {0, 0, 255}), Line(points = {{-70, 0}, {-60.2, 29.9}, {-53.8, 46.5}, {-48.2, 58.1}, {-43.3, 65.2}, {-38.3, 69.2}, {-33.4, 69.8}, {-28.5, 67}, {-23.6, 61}, {-18.6, 52}, {-13, 38.6}, {-5.98, 18.6}, {8.79, -26.9}, {15.1, -44}, {20.8, -56.2}, {25.7, -64}, {30.6, -68.6}, {35.5, -70}, {40.5, -67.9}, {45.4, -62.5}, {50.3, -54.1}, {55.9, -41.3}, {63, -21.7}, {70, 0}}, color = {0, 0, 255}), Line(points = {{-86, 60}, {-72, 60}}, color = {0, 0, 0}), Line(points = {{-86, -60}, {-72, -60}}, color = {0, 0, 0}), Line(points = {{-40, -3.67391e-15}, {20, 0}}, color = {0, 0, 0}, origin = {-72, -40}, rotation = -90), Line(points = {{-40, -3.67391e-15}, {20, 0}}, color = {0, 0, 0}, origin = {-72, 20}, rotation = -90), Line(points = {{-36, 0}, {-26.2, 29.9}, {-19.8, 46.5}, {-14.2, 58.1}, {-9.3, 65.2}, {-4.3, 69.2}, {0.6, 69.8}, {5.5, 67}, {10.4, 61}, {15.4, 52}, {21, 38.6}, {28.02, 18.6}, {42.79, -26.9}, {49.1, -44}, {54.8, -56.2}, {59.7, -64}, {64.6, -68.6}, {69.5, -70}, {74.5, -67.9}, {79.4, -62.5}, {84.3, -54.1}, {89.9, -41.3}, {97, -21.7}, {104, 0}}, color = {0, 0, 255}), Line(points = {{-104, 0}, {-94.2, 29.9}, {-87.8, 46.5}, {-82.2, 58.1}, {-77.3, 65.2}, {-72.3, 69.2}, {-67.4, 69.8}, {-62.5, 67}, {-57.6, 61}, {-52.6, 52}, {-47, 38.6}, {-39.98, 18.6}, {-25.21, -26.9}, {-18.9, -44}, {-13.2, -56.2}, {-8.3, -64}, {-3.4, -68.6}, {1.5, -70}, {6.5, -67.9}, {11.4, -62.5}, {16.3, -54.1}, {21.9, -41.3}, {29, -21.7}, {36, 0}}, color = {0, 0, 255})})); 22 | end threePhaseAC; 23 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/Sources/voltageDC.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Electrical.Sources; 2 | model voltageDC "DC Voltage Source" 3 | parameter Modelica.SIunits.Voltage V(start=1) "Voltage value"; 4 | extends MicroGrid.Electrical.Interfaces.OnePort; 5 | 6 | equation 7 | v = V; 8 | annotation ( 9 | Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100, 10 | 100}}), graphics={ 11 | Line(points={{-90,0},{-10,0}}, color={0,0,255}), 12 | Line(points={{-10,60},{-10,-60}}, color={0,0,255}), 13 | Line(points={{0,30},{0,-30}}, color={0,0,255}), 14 | Line(points={{0,0},{90,0}}, color={0,0,255}), 15 | Text( 16 | extent={{-150,-112},{150,-72}}, 17 | textString="%name=%V", 18 | lineColor={0,0,255}), 19 | Text( 20 | extent={{-96,50},{4,0}}, 21 | lineColor={0,0,255}, 22 | textString="+"), 23 | Text( 24 | extent={{-10,48},{90,-2}}, 25 | lineColor={0,0,255}, 26 | textString="-")}), 27 | Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{ 28 | 100,100}}), graphics={Line(points={{-96,0},{-10,0}}, color={0,0, 29 | 255}),Line(points={{-10,60},{-10,-60}}, color={0,0,255}),Line( 30 | points={{0,30},{0,-30}}, color={0,0,255}),Line(points={{0,0},{96,0}}, 31 | color={0,0,255})})); 32 | end voltageDC; 33 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/package.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid; 2 | package Electrical 3 | extends Modelica.Icons.Package; 4 | 5 | annotation(Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100.0,-100.0},{100.0,100.0}}), graphics={ 6 | Rectangle( 7 | origin={20.3125,82.8571}, 8 | extent={{-45.3125,-57.8571},{4.6875,-27.8571}}), 9 | Line( 10 | origin={8.0,48.0}, 11 | points={{32.0,-58.0},{72.0,-58.0}}), 12 | Line( 13 | origin={9.0,54.0}, 14 | points={{31.0,-49.0},{71.0,-49.0}}), 15 | Line( 16 | origin={-2.0,55.0}, 17 | points={{-83.0,-50.0},{-33.0,-50.0}}), 18 | Line( 19 | origin={-3.0,45.0}, 20 | points={{-72.0,-55.0},{-42.0,-55.0}}), 21 | Line( 22 | origin={1.0,50.0}, 23 | points={{-61.0,-45.0},{-61.0,-10.0},{-26.0,-10.0}}), 24 | Line( 25 | origin={7.0,50.0}, 26 | points={{18.0,-10.0},{53.0,-10.0},{53.0,-45.0}}), 27 | Line( 28 | origin={6.2593,48.0}, 29 | points={{53.7407,-58.0},{53.7407,-93.0},{-66.2593,-93.0},{-66.2593,-58.0}})})); 30 | end Electrical; 31 | -------------------------------------------------------------------------------- /MicroGrid/Electrical/package.order: -------------------------------------------------------------------------------- 1 | Examples 2 | Interfaces 3 | BasicComponents 4 | Branches 5 | Sources 6 | Converters 7 | -------------------------------------------------------------------------------- /MicroGrid/Examples/VSC_Inverter/Export/package.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Examples.VSC_Inverter; 2 | package Export 3 | //extends Modelica.Icons.Package; 4 | 5 | end Export; 6 | -------------------------------------------------------------------------------- /MicroGrid/Examples/VSC_Inverter/Export/package.order: -------------------------------------------------------------------------------- 1 | SwitchingPlant 2 | AveragePlant 3 | Controller 4 | -------------------------------------------------------------------------------- /MicroGrid/Examples/VSC_Inverter/package.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Examples; 2 | package VSC_Inverter 3 | extends Modelica.Icons.ExamplesPackage; 4 | 5 | end VSC_Inverter; 6 | -------------------------------------------------------------------------------- /MicroGrid/Examples/VSC_Inverter/package.order: -------------------------------------------------------------------------------- 1 | AverageSystem 2 | SwitchingSystem 3 | Export 4 | -------------------------------------------------------------------------------- /MicroGrid/Examples/package.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid; 2 | package Examples 3 | extends Modelica.Icons.ExamplesPackage; 4 | 5 | end Examples; 6 | -------------------------------------------------------------------------------- /MicroGrid/Examples/package.order: -------------------------------------------------------------------------------- 1 | MicroGrid_Example 2 | VSC_Inverter 3 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/PV_module.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics; 2 | model PV_module 3 | extends MicroGrid.Electrical.Interfaces.OnePort; 4 | parameter MicroGrid.PhotoVoltaics.Records.ModuleData moduleData annotation(Placement(visible = true, transformation(origin = {80, 80}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-20, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0))); 5 | parameter Integer Np = 1; 6 | parameter Integer Ns = 1; 7 | Modelica.Blocks.Interfaces.RealInput Irr annotation(Placement(visible = true, transformation(origin = {-40, -100}, extent = {{-20, -20}, {20, 20}}, rotation = -270), iconTransformation(origin = {-50, -80}, extent = {{-20, -20}, {20, 20}}, rotation = -270))); 8 | Modelica.Blocks.Interfaces.RealInput T annotation(Placement(visible = true, transformation(origin = {40, -100}, extent = {{-20, -20}, {20, 20}}, rotation = -270), iconTransformation(origin = {50, -80}, extent = {{-20, -20}, {20, 20}}, rotation = -270))); 9 | Real Ac = 1.6; 10 | Real Eg = 1.1; 11 | Real q = moduleData.Q; 12 | Real lambdaRef = moduleData.irradianceRef; 13 | Real Isc = moduleData.IscRef; 14 | Real Voc = moduleData.VocRef; 15 | Real Tref = moduleData.TRef; 16 | Real K = Modelica.Constants.k; 17 | Real K1 = moduleData.alphaIsc; 18 | Real K2 = moduleData.alphaVoc; 19 | Real Rspv = 0.01; 20 | Integer ns = moduleData.ns; 21 | Real Ior = 1.0647e-6; 22 | Real Iph; 23 | Real Irs = Ior * (T / Tref) ^ 3 * Modelica.Math.exp(q * Eg * (1 / Tref - 1 / T) / K / Ac); 24 | Real exponent; 25 | Real Ipv; 26 | Real Vpv; 27 | equation 28 | v = Ns * Vpv; 29 | exponent = q / (K * Ac * T) * (Vpv / ns + Rspv * Ipv / ns); 30 | //oc * (1 + K2 * (T - Tref)) 31 | Iph = (Isc + K1 * (T - Tref)) * Irr / lambdaRef; 32 | Ipv = Np * Iph - Np * Irs * (Modelica.Math.exp(exponent) - 1); 33 | Ipv + i = 0; 34 | annotation(Icon(coordinateSystem(preserveAspectRatio = false), graphics={ Rectangle(lineColor = {0, 0, 0}, 35 | fillPattern = FillPattern.VerticalCylinder, extent = {{-76, 76}, {76, -76}}, fillColor = {85, 85, 255}), Line(points = {{-80, 0}, {80, 0}}, color = {255, 255, 255}), Rectangle(extent = {{-84, 84}, {84, -84}}, lineColor = {0, 0, 0}), Polygon(points = {{-84, 76}, {-76, 84}, {-68, 76}, {-76, 68}, {-84, 76}}, fillColor = {255, 255, 255}, 36 | fillPattern = FillPattern.Solid, pattern = LinePattern.None), Line(points = {{-24, 76}, {-24, -76}}, color = {255, 255, 255}), Polygon(points = {{-8, 76}, {0, 84}, {8, 76}, {0, 68}, {-8, 76}}, fillColor = {255, 255, 255}, 37 | fillPattern = FillPattern.Solid, pattern = LinePattern.None), Polygon(points = {{68, 76}, {76, 84}, {84, 76}, {76, 68}, {68, 76}}, fillColor = {255, 255, 255}, 38 | fillPattern = FillPattern.Solid, pattern = LinePattern.None), Polygon(points = {{68, 0}, {76, 8}, {84, 0}, {76, -8}, {68, 0}}, fillColor = {255, 255, 255}, 39 | fillPattern = FillPattern.Solid, pattern = LinePattern.None), Polygon(points = {{68, -76}, {76, -68}, {84, -76}, {76, -84}, {68, -76}}, fillColor = {255, 255, 255}, 40 | fillPattern = FillPattern.Solid, pattern = LinePattern.None), Polygon(points = {{-84, -76}, {-76, -68}, {-68, -76}, {-76, -84}, {-84, -76}}, fillColor = {255, 255, 255}, 41 | fillPattern = FillPattern.Solid, pattern = LinePattern.None), Line(points = {{-54, 76}, {-54, -76}}, color = {255, 255, 255}), Polygon(points = {{-84, 0}, {-76, 8}, {-68, 0}, {-76, -8}, {-84, 0}}, fillColor = {255, 255, 255}, 42 | fillPattern = FillPattern.Solid, pattern = LinePattern.None), Polygon(points = {{-8, 0}, {0, 8}, {8, 0}, {0, -8}, {-8, 0}}, fillColor = {255, 255, 255}, 43 | fillPattern = FillPattern.Solid, pattern = LinePattern.None), Polygon(points = {{-8, -76}, {0, -68}, {8, -76}, {0, -84}, {-8, -76}}, fillColor = {255, 255, 255}, 44 | fillPattern = FillPattern.Solid, pattern = LinePattern.None), Line(points = {{0, 76}, {0, -76}}, color = {255, 255, 255}), Line(points = {{24, 76}, {24, -76}}, color = {255, 255, 255}), Line(points = {{54, 76}, {54, -76}}, color = {255, 255, 255}), Text(extent = {{-150, -150}, {150, -110}}, textString = "%name", lineColor = {0, 0, 255})})); 45 | end PV_module; 46 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/KPV_235_PE.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record KPV_235_PE "Kioto polycrystalline SI cell 235W" 3 | extends ModuleData(final moduleName = "KPV_235_PE", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 37.24, final IscRef = 8.61, final VmpRef = 29.82, final ImpRef = 7.97, final alphaIsc = +0.0005, final alphaVoc = -0.0031, final ns = 60, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | Kioto. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end KPV_235_PE; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/KPV_240_PE.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record KPV_240_PE "Kioto polycrystalline SI cell 240W" 3 | extends ModuleData(final moduleName = "KPV_240_PE", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 37.33, final IscRef = 8.78, final VmpRef = 29.87, final ImpRef = 8.04, final alphaIsc = +0.0005, final alphaVoc = -0.0031, final ns = 60, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | Kioto. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end KPV_240_PE; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/LG275S1C_G4.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record LG275S1C_G4 "LG monocrystalline SI cell 275W" 3 | extends ModuleData(final moduleName = "LG275S1C_G4", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 38.7, final IscRef = 9.26, final VmpRef = 31.7, final ImpRef = 8.68, final alphaIsc = +0.0003, final alphaVoc = -0.003, final ns = 72, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | LG. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end LG275S1C_G4; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/LG280S1C_G4.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record LG280S1C_G4 "LG monocrystalline SI cell 280W" 3 | extends ModuleData(final moduleName = "LG280S1C_G4", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 39, final IscRef = 9.43, final VmpRef = 32.3, final ImpRef = 8.88, final alphaIsc = +0.0003, final alphaVoc = -0.003, final ns = 72, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | LG. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end LG280S1C_G4; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/LG285S1C_G4.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record LG285S1C_G4 "LG monocrystalline SI cell 285W" 3 | extends ModuleData(final moduleName = "LG285S1C_G4", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 39, final IscRef = 9.43, final VmpRef = 32.3, final ImpRef = 8.88, final alphaIsc = +0.0003, final alphaVoc = -0.003, final ns = 72, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | LG. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end LG285S1C_G4; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/LG300N1C_G4.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record LG300N1C_G4 "LG monocrystalline SI cell 300W" 3 | extends ModuleData(final moduleName = "LG300N1C_G4", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 39.8, final IscRef = 9.9, final VmpRef = 32.2, final ImpRef = 9.34, final alphaIsc = +0.0003, final alphaVoc = -0.0028, final ns = 72, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | LG. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end LG300N1C_G4; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/LG305N1C_B3.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record LG305N1C_B3 "LG monocrystalline SI cell 305W" 3 | extends ModuleData(final moduleName = "LG305N1C_B3", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 40, final IscRef = 10.1, final VmpRef = 32.1, final ImpRef = 9.52, final alphaIsc = +0.0004, final alphaVoc = -0.0029, final ns = 72, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | LG. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end LG305N1C_B3; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/LG305N1C_G4.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record LG305N1C_G4 "LG monocrystalline SI cell 305W" 3 | extends ModuleData(final moduleName = "LG305N1C_G4", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 40.1, final IscRef = 9.93, final VmpRef = 32.5, final ImpRef = 9.39, final alphaIsc = +0.0003, final alphaVoc = -0.0028, final ns = 72, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | LG. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end LG305N1C_G4; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/LG310N1C_G4.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record LG310N1C_G4 "LG monocrystalline SI cell 310W" 3 | extends ModuleData(final moduleName = "LG310N1C_G4", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 40.4, final IscRef = 9.96, final VmpRef = 32.8, final ImpRef = 9.45, final alphaIsc = +0.0003, final alphaVoc = -0.0028, final ns = 72, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | LG. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end LG310N1C_G4; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/LG315N1C_G4.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record LG315N1C_G4 "LG monocrystalline SI cell 315W" 3 | extends ModuleData(final moduleName = "LG315N1C_G4", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 40.6, final IscRef = 10.02, final VmpRef = 33.2, final ImpRef = 9.5, final alphaIsc = +0.0003, final alphaVoc = -0.0028, final ns = 72, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | LG. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end LG315N1C_G4; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/LG320N1C_G4.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record LG320N1C_G4 "LG monocrystalline SI cell 320W" 3 | extends ModuleData(final moduleName = "LG320N1C_G4", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 40.9, final IscRef = 10.05, final VmpRef = 33.8, final ImpRef = 9.53, final alphaIsc = +0.0003, final alphaVoc = -0.0028, final ns = 72, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | LG. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end LG320N1C_G4; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/LG335S2W_G4.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record LG335S2W_G4 "LG monocrystalline SI cell 335W" 3 | extends ModuleData(final moduleName = "LG335S2W_G4", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 46.2, final IscRef = 9.48, final VmpRef = 37.5, final ImpRef = 8.94, final alphaIsc = +0.0003, final alphaVoc = -0.003, final ns = 72, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | LG. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end LG335S2W_G4; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/LG340S2W_G4.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record LG340S2W_G4 "LG monocrystalline SI cell 340W" 3 | extends ModuleData(final moduleName = "LG340S2W_G4", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 46.4, final IscRef = 9.54, final VmpRef = 37.7, final ImpRef = 9.02, final alphaIsc = +0.0003, final alphaVoc = -0.003, final ns = 72, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | LG. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end LG340S2W_G4; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/LG360N2W_B3.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record LG360N2W_B3 "LG monocrystalline SI cell 360W" 3 | extends ModuleData(final moduleName = "LG360N2W_B3", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 48.3, final IscRef = 9.84, final VmpRef = 38.4, final ImpRef = 9.39, final alphaIsc = +0.0004, final alphaVoc = -0.003, final ns = 72, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | LG. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end LG360N2W_B3; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/LG365N2W_G4.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record LG365N2W_G4 "LG monocrystalline SI cell 365W" 3 | extends ModuleData(final moduleName = "LG365N2W_G4", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 47.7, final IscRef = 9.92, final VmpRef = 38.9, final ImpRef = 9.39, final alphaIsc = +0.0003, final alphaVoc = -0.0028, final ns = 72, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | LG. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end LG365N2W_G4; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/LG370N2W_G4.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record LG370N2W_G4 "LG monocrystalline SI cell 370W" 3 | extends ModuleData(final moduleName = "LG370N2W_G4", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 48, final IscRef = 9.98, final VmpRef = 39.2, final ImpRef = 9.44, final alphaIsc = +0.0003, final alphaVoc = -0.0028, final ns = 72, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | LG. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end LG370N2W_G4; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/LG375N2W_G4.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record LG375N2W_G4 "LG monocrystalline SI cell 375W" 3 | extends ModuleData(final moduleName = "LG375N2W_G4", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 48.3, final IscRef = 10.04, final VmpRef = 39.6, final ImpRef = 9.5, final alphaIsc = +0.0003, final alphaVoc = -0.0028, final ns = 72, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | LG. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end LG375N2W_G4; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/ModuleData.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record ModuleData "Data of PV module" 3 | extends Modelica.Icons.Record; 4 | parameter String moduleName = "Generic"; 5 | constant Modelica.SIunits.Charge Q = 1.6021766208E-19 "Elementary charge of electron"; 6 | parameter Modelica.SIunits.Temperature TRef = 298.15 "Reference temperature" annotation(Dialog(group = "Reference data")); 7 | final parameter Modelica.SIunits.Irradiance irradianceRef = 1000 "Reference solar irradiance" annotation(Dialog(group = "Reference data")); 8 | parameter Modelica.SIunits.Voltage VocRef(min = Modelica.Constants.small) = 30.2 "Reference open circuit module voltage > 0 at TRref" annotation(Dialog(group = "Reference data")); 9 | final parameter Modelica.SIunits.Voltage VocCellRef = VocRef / ns "Reference open circuit cell voltage > 0 at TRref"; 10 | parameter Modelica.SIunits.Current IscRef(min = Modelica.Constants.small) = 8.54 "Reference short circuit current > 0 at TRref and irradianceRef" annotation(Dialog(group = "Reference data")); 11 | parameter Modelica.SIunits.Voltage VmpRef(min = Modelica.Constants.small) = 24.0 "Reference maximum power module voltage > 0 at TRref" annotation(Dialog(group = "Reference data")); 12 | final parameter Modelica.SIunits.Voltage VmpCellRef = VmpRef / ns "Reference maximum power cell voltage > 0 at TRref"; 13 | parameter Modelica.SIunits.Current ImpRef(min = Modelica.Constants.small) = 7.71 "Reference maximum power current > 0 at TRref and irradianceRef" annotation(Dialog(group = "Reference data")); 14 | parameter Modelica.SIunits.LinearTemperatureCoefficient alphaIsc = +0.00053 "Temperature coefficient of reference short circuit current at TRref" annotation(Dialog(group = "Reference data")); 15 | parameter Modelica.SIunits.LinearTemperatureCoefficient alphaVoc = -0.00340 "Temperature coefficient of reference open circuit module voltage at TRref" annotation(Dialog(group = "Reference data")); 16 | parameter Integer ns = 1 "Number of series connected cells"; 17 | parameter Integer nb = 1 "Number of bypass diodes per module"; 18 | parameter Modelica.SIunits.Voltage BvCell = 18 "Breakthrough cell voltage" annotation(Dialog(group = "Breakthrough data")); 19 | parameter Modelica.SIunits.Current Ibv = 1 "Breakthrough knee current" annotation(Dialog(group = "Breakthrough data")); 20 | parameter Real Nbv = 0.74 "Breakthrough emission coefficient" annotation(Dialog(group = "Breakthrough data")); 21 | final parameter Modelica.SIunits.Voltage VtCellRef = Modelica.Constants.k * TRef / Q "Reference temperature voltage of cell"; 22 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Icon(coordinateSystem(preserveAspectRatio = false), graphics={ Text(lineColor = {0, 0, 255}, extent = {{-200, -150}, {200, -110}}, textString = "%moduleName")}), Diagram(coordinateSystem(preserveAspectRatio = false)), Documentation(info = " 23 |

This record defines parameters provided by photovoltaic module manufacturers.

24 | ")); 25 | end ModuleData; 26 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/NU_RD260.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record NU_RD260 "SHARP monocrystalline SI cell 260W" 3 | extends ModuleData(final moduleName = "NU_RD260", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 38.5, final IscRef = 9.07, final VmpRef = 31.3, final ImpRef = 8.37, final alphaIsc = +0.0005, final alphaVoc = -0.0029, final ns = 60, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | SHARP. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end NU_RD260; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/SC_195_72M.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record SC_195_72M "Sunclass monocrystalline SI cell 195W" 3 | extends ModuleData(final moduleName = "SC_195_72M", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 45.5, final IscRef = 5.63, final VmpRef = 36.9, final ImpRef = 5.28, final alphaIsc = +0.0004, final alphaVoc = -0.0029, final ns = 72, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | Sunclass. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end SC_195_72M; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/SC_200_72M.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record SC_200_72M "Sunclass monocrystalline SI cell 200W" 3 | extends ModuleData(final moduleName = "SC_200_72M", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 45.65, final IscRef = 5.65, final VmpRef = 37.3, final ImpRef = 5.36, final alphaIsc = +0.0004, final alphaVoc = -0.0029, final ns = 72, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | Sunclass. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end SC_200_72M; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/SC_205_72M.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record SC_205_72M "Sunclass monocrystalline SI cell 205W" 3 | extends ModuleData(final moduleName = "SC_205_72M", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 45.75, final IscRef = 5.7, final VmpRef = 37.55, final ImpRef = 5.46, final alphaIsc = +0.0004, final alphaVoc = -0.0029, final ns = 72, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | Sunclass. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end SC_205_72M; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/SHARP_NU_R0_E3E.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record SHARP_NU_R0_E3E "SHARP NU monocrystalline SI cell 170W" 3 | extends ModuleData(final moduleName = "SHARP_NU_R0_E3E", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 29.4, final IscRef = 8.37, final VmpRef = 22.4, final ImpRef = 7.6, final alphaIsc = +0.00053, final alphaVoc = -0.00350, final ns = 48, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | SHARP. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end SHARP_NU_R0_E3E; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/SHARP_NU_R5_ESZ.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record SHARP_NU_R5_ESZ "SHARP NU monocrystalline SI cell 175W" 3 | extends ModuleData(final moduleName = "SHARP_NU_R5_ESZ", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 29.8, final IscRef = 8.29, final VmpRef = 23.2, final ImpRef = 7.55, final alphaIsc = +0.00053, final alphaVoc = -0.00350, final ns = 48, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | SHARP. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end SHARP_NU_R5_ESZ; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/SHARP_NU_RD260.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record SHARP_NU_RD260 "SHARP monocrystalline SI cell 260W" 3 | extends ModuleData(final moduleName = "SHARP_NU_RD260", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 38.5, final IscRef = 9.07, final VmpRef = 31.3, final ImpRef = 8.37, final alphaIsc = +0.0005, final alphaVoc = -0.0029, final ns = 60, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | SHARP. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end SHARP_NU_RD260; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/SHARP_NU_RD280.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record SHARP_NU_RD280 "SHARP monocrystalline SI cell 280W" 3 | extends ModuleData(final moduleName = "NU_RD280", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 39.2, final IscRef = 9.67, final VmpRef = 31.2, final ImpRef = 8.97, final alphaIsc = +0.0005, final alphaVoc = -0.0029, final ns = 60, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | SHARP. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end SHARP_NU_RD280; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/SHARP_NU_RD285.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record SHARP_NU_RD285 "SHARP monocrystalline SI cell 285W" 3 | extends ModuleData(final moduleName = "SHARP_NU_RD285", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 39.2, final IscRef = 9.37, final VmpRef = 31.3, final ImpRef = 9.1, final alphaIsc = +0.0005, final alphaVoc = -0.0029, final ns = 60, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | SHARP. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end SHARP_NU_RD285; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/SHARP_NU_S0_E3E.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record SHARP_NU_S0_E3E "SHARP NU monocrystalline SI cell 180W" 3 | extends ModuleData(final moduleName = "SHARP_NU_S0_E3E", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 30, final IscRef = 8.37, final VmpRef = 23.7, final ImpRef = 7.6, final alphaIsc = +0.00053, final alphaVoc = -0.00350, final ns = 48, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | SHARP. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end SHARP_NU_S0_E3E; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/SHARP_NU_S0_ESZ.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record SHARP_NU_S0_ESZ "SHARP NU monocrystalline SI cell 180W" 3 | extends ModuleData(final moduleName = "SHARP_NU_S0_ESZ", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 30, final IscRef = 8.23, final VmpRef = 23.7, final ImpRef = 7.6, final alphaIsc = +0.00053, final alphaVoc = -0.00350, final ns = 48, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | SHARP. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end SHARP_NU_S0_ESZ; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/SHARP_NU_S5_E3E.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record SHARP_NU_S5_E3E "SHARP NU monocrystalline SI cell 185W" 3 | extends ModuleData(final moduleName = "SHARP_NU_S5_E3E", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 30.2, final IscRef = 8.54, final VmpRef = 24.0, final ImpRef = 7.71, final alphaIsc = +0.00053, final alphaVoc = -0.00340, final ns = 48, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | SHARP. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end SHARP_NU_S5_E3E; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/SPR_E19_320.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record SPR_E19_320 "Sunpower monocrystalline SI cell 320W" 3 | extends ModuleData(final moduleName = "SPR_E19_320", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 64.8, final IscRef = 6.26, final VmpRef = 54.7, final ImpRef = 5.86, final alphaIsc = +0.00056, final alphaVoc = -0.00273, final ns = 96, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | Sunpower. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end SPR_E19_320; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/SPR_E20_327.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record SPR_E20_327 "Sunpower monocrystalline SI cell 327W" 3 | extends ModuleData(final moduleName = "SPR_E20_327", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 64.9, final IscRef = 6.46, final VmpRef = 54.7, final ImpRef = 5.98, final alphaIsc = +0.00054, final alphaVoc = -0.00272, final ns = 96, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | Sunpower. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end SPR_E20_327; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/SW_250_MONO.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record SW_250_MONO "Solarworld monocrystalline SI cell 250W" 3 | extends ModuleData(final moduleName = "SW_250_MONO", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 37.8, final IscRef = 8.28, final VmpRef = 31.1, final ImpRef = 8.05, final alphaIsc = +0.00004, final alphaVoc = -0.003, final ns = 60, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | Solarworld. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end SW_250_MONO; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/SW_260_POLY.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record SW_260_POLY "Solarworld polycrystalline SI cell 260W" 3 | extends ModuleData(final moduleName = "SW_260_POLY", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 38.4, final IscRef = 8.94, final VmpRef = 31.4, final ImpRef = 8.37, final alphaIsc = +0.00051, final alphaVoc = -0.0031, final ns = 60, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | Solarworld. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end SW_260_POLY; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/SW_285_MONO.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record SW_285_MONO "Solarworld monocrystalline SI cell 285W" 3 | extends ModuleData(final moduleName = "SW_285_MONO", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 39.7, final IscRef = 9.84, final VmpRef = 31.3, final ImpRef = 9.2, final alphaIsc = +0.0004, final alphaVoc = -0.003, final ns = 60, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | Solarworld. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end SW_285_MONO; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/SW_290_MONO.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record SW_290_MONO "Solarworld monocrystalline SI cell 290W" 3 | extends ModuleData(final moduleName = "SW_290_MONO", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 39.9, final IscRef = 9.97, final VmpRef = 31.4, final ImpRef = 9.33, final alphaIsc = +0.0004, final alphaVoc = -0.003, final ns = 60, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | Solarworld. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end SW_290_MONO; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/SW_300_MONO.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record SW_300_MONO "Solarworld monocrystalline SI cell 300W" 3 | extends ModuleData(final moduleName = "SW_300_MONO", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 40.1, final IscRef = 10.23, final VmpRef = 31.6, final ImpRef = 9.57, final alphaIsc = +0.0004, final alphaVoc = -0.003, final ns = 60, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | Solarworld. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end SW_300_MONO; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/SW_395_MONO.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record SW_395_MONO "Solarworld monocrystalline SI cell 295W" 3 | extends ModuleData(final moduleName = "SW_395_MONO", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 40, final IscRef = 10.1, final VmpRef = 31.4, final ImpRef = 9.45, final alphaIsc = +0.0004, final alphaVoc = -0.003, final ns = 60, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | Solarworld. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end SW_395_MONO; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/TSM_200_DC01A.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record TSM_200_DC01A "Comax monocrystalline SI cell 200W" 3 | extends ModuleData(final moduleName = "TSM 200 DC01A", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 46, final IscRef = 5.6, final VmpRef = 37.6, final ImpRef = 5.37, final alphaIsc = +0.0002, final alphaVoc = -0.003, final ns = 72, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | Comax. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end TSM_200_DC01A; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/TSM_230_PC05.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics.Records; 2 | record TSM_230_PC05 "Trina polycrystalline SI cell 230W" 3 | extends ModuleData(final moduleName = "TSM 230 PC05", final TRef = 298.15, final irradianceRef = 1000, final VocRef = 37, final IscRef = 8.26, final VmpRef = 29.8, final ImpRef = 7.72, final alphaIsc = +0.0005, final alphaVoc = -0.0032, final ns = 60, final nb = 3); 4 | annotation(defaultComponentName = "moduleData", defaultComponentPrefixes = "parameter", Documentation(info = " 5 | The original data of this module are taken from 6 | Trina. You may want to download this PDF file and store it in the directory Resources/DataSheets for convenience reasons. You may want to make these data directly 7 | available. 8 | ")); 9 | end TSM_230_PC05; 10 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/package.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.PhotoVoltaics; 2 | package Records "Records" 3 | extends Modelica.Icons.Record; 4 | end Records; 5 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/Records/package.order: -------------------------------------------------------------------------------- 1 | ModuleData 2 | TSM_200_DC01A 3 | TSM_230_PC05 4 | LG360N2W_B3 5 | LG305N1C_B3 6 | LG300N1C_G4 7 | LG335S2W_G4 8 | LG340S2W_G4 9 | LG285S1C_G4 10 | LG280S1C_G4 11 | LG275S1C_G4 12 | LG375N2W_G4 13 | LG370N2W_G4 14 | LG365N2W_G4 15 | LG320N1C_G4 16 | LG315N1C_G4 17 | LG310N1C_G4 18 | LG305N1C_G4 19 | SW_250_MONO 20 | SW_285_MONO 21 | SW_260_POLY 22 | SW_290_MONO 23 | SW_395_MONO 24 | SW_300_MONO 25 | NU_RD260 26 | SC_195_72M 27 | SC_200_72M 28 | SC_205_72M 29 | SHARP_NU_S5_E3E 30 | SHARP_NU_S0_E3E 31 | SHARP_NU_S0_ESZ 32 | SHARP_NU_R5_ESZ 33 | SHARP_NU_R0_E3E 34 | SHARP_NU_RD285 35 | SHARP_NU_RD280 36 | SHARP_NU_RD260 37 | SPR_E20_327 38 | SPR_E19_320 39 | KPV_235_PE 40 | KPV_240_PE 41 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/package.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid; 2 | package PhotoVoltaics 3 | extends Modelica.Icons.Package; 4 | 5 | annotation(Icon(graphics={ Ellipse(extent = {{-70, 52}, {-10, -6}}, pattern = LinePattern.None, lineColor = {0, 0, 0}, fillColor = {229, 184, 0}, 6 | fillPattern = FillPattern.Solid), Polygon(points = {{-78, -60}, {-42, 14}, {42, 14}, {86, -60}, {-78, -60}}, fillColor = {27, 77, 130}, 7 | fillPattern = FillPattern.Solid, pattern = LinePattern.None)})); 8 | end PhotoVoltaics; 9 | -------------------------------------------------------------------------------- /MicroGrid/PhotoVoltaics/package.order: -------------------------------------------------------------------------------- 1 | Records 2 | PV_module 3 | -------------------------------------------------------------------------------- /MicroGrid/Sensors/CurrentSensor.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Sensors; 2 | model CurrentSensor "Sensor to measure the current flowing between two pins" 3 | extends Modelica.Icons.RotationalSensor; 4 | MicroGrid.Electrical.Interfaces.PositivePin p "positive pin" annotation (Placement( 5 | transformation(extent={{-110,-10},{-90,10}}))); 6 | MicroGrid.Electrical.Interfaces.NegativePin n "negative pin" annotation (Placement( 7 | transformation(extent={{90,-10},{110,10}}))); 8 | MicroGrid.Sensors.Interfaces.SignalBus currSignal "Current in the branch from p to n as output signal" 9 | annotation (Placement(transformation( 10 | origin={0,-95}, 11 | extent={{10,-10},{-10,10}}, 12 | rotation=0), iconTransformation(extent={{17,-15.5},{-17,15.5}}, origin={ 13 | 1,-93.5}))); 14 | equation 15 | p.v = n.v; 16 | p.i = currSignal.sensorSignal; 17 | n.i = -currSignal.sensorSignal; 18 | annotation ( 19 | Icon(coordinateSystem( 20 | preserveAspectRatio=true, 21 | extent={{-100,-100},{100,100}}), graphics={ 22 | Text( 23 | extent={{-29,-11},{30,-70}}, 24 | lineColor={0,0,0}, 25 | textString="A"), 26 | Line(points={{-70,0},{-90,0}}, color={0,0,255}), 27 | Text( 28 | extent={{-150,80},{150,120}}, 29 | textString="%name", 30 | lineColor={0,0,255}), 31 | Line(points={{70,0},{90,0}}, color={0,0,255}), 32 | Line(points={{0,-90},{0,-70}}, color={0,0,127})}), 33 | Diagram(coordinateSystem( 34 | preserveAspectRatio=true, 35 | extent={{-100,-100},{100,100}}), graphics={ 36 | Text( 37 | extent={{-153,79},{147,119}}, 38 | textString="%name", 39 | lineColor={0,0,255}), 40 | Line(points={{-70,0},{-96,0}}), 41 | Line(points={{70,0},{96,0}}), 42 | Line(points={{0,-90},{0,-70}}, color={0,0,255})})); 43 | end CurrentSensor; 44 | -------------------------------------------------------------------------------- /MicroGrid/Sensors/Interfaces/Real2Sensor.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Sensors.Interfaces; 2 | model Real2Sensor 3 | 4 | MicroGrid.Sensors.Interfaces.SignalBus OutputSignal annotation (Placement( 5 | transformation(extent={{74,-18},{110,16}}), iconTransformation(extent={{80,-14}, 6 | {110,16}}))); 7 | Modelica.Blocks.Interfaces.RealInput InputReal 8 | annotation (Placement(transformation(extent={{-100,-10},{-80,10}}), 9 | iconTransformation(extent={{-100,-10},{-80,10}}))); 10 | equation 11 | OutputSignal.sensorSignal = InputReal; 12 | 13 | annotation (Icon(graphics={ 14 | Rectangle( 15 | extent={{-92,28},{92,-28}}, 16 | lineColor={28,108,200}, 17 | lineThickness=0.5), 18 | Polygon(points={{-80,0},{-80,0}}, lineColor={0,140,72}), 19 | Polygon( 20 | points={{90,0},{72,2},{-86,18},{-86,-20},{90,0}}, 21 | lineColor={28,108,200}, 22 | fillColor={238,46,47}, 23 | fillPattern=FillPattern.CrossDiag)})); 24 | end Real2Sensor; 25 | -------------------------------------------------------------------------------- /MicroGrid/Sensors/Interfaces/Sensor2Real.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Sensors.Interfaces; 2 | model Sensor2Real 3 | 4 | Modelica.Blocks.Interfaces.RealOutput OutputReal annotation (Placement( 5 | transformation(extent={{90,-10},{110,10}}), iconTransformation(extent={{ 6 | 90,-10},{110,10}}))); 7 | MicroGrid.Sensors.Interfaces.SignalBus InputSignal 8 | annotation (Placement(transformation(extent={{-110,-16},{-72,14}}))); 9 | equation 10 | InputSignal.sensorSignal = OutputReal; 11 | 12 | annotation (Icon(graphics={ 13 | Rectangle( 14 | extent={{-92,28},{92,-28}}, 15 | lineColor={238,46,47}, 16 | lineThickness=0.5), 17 | Polygon(points={{-80,0},{-80,0}}, lineColor={28,108,200}), 18 | Polygon( 19 | points={{90,0},{72,2},{-86,18},{-86,-20},{90,0}}, 20 | lineColor={238,46,47}, 21 | fillColor={28,108,200}, 22 | fillPattern=FillPattern.CrossDiag)})); 23 | end Sensor2Real; 24 | -------------------------------------------------------------------------------- /MicroGrid/Sensors/Interfaces/SignalBus.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Sensors.Interfaces; 2 | connector SignalBus "Communication bus for sensors signals" 3 | Real sensorSignal; 4 | annotation ( 5 | Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={ 6 | Line( 7 | points={{-16.0,2.0},{16.0,2.0}}, 8 | color={255,204,51}, 9 | thickness=0.5), 10 | Rectangle( 11 | lineColor={255,0,0}, 12 | lineThickness=0.5, 13 | extent={{-10.0,0.0},{8.0,8.0}}), 14 | Polygon( 15 | fillColor={255,0,0}, 16 | fillPattern=FillPattern.Solid, 17 | points={{-80.0,50.0},{80.0,50.0},{100.0,30.0},{80.0,-40.0},{60.0,-50.0},{-60.0,-50.0},{-80.0,-40.0},{-100.0,30.0}}, 18 | smooth=Smooth.Bezier), 19 | Ellipse( 20 | fillPattern=FillPattern.Solid, 21 | extent={{-55.0,15.0},{-45.0,25.0}}), 22 | Ellipse( 23 | fillPattern=FillPattern.Solid, 24 | extent={{45.0,15.0},{55.0,25.0}}), 25 | Ellipse( 26 | fillPattern=FillPattern.Solid, 27 | extent={{-5.0,-25.0},{5.0,-15.0}}), 28 | Rectangle( 29 | lineColor={255,0,0}, 30 | lineThickness=0.5, 31 | extent={{-20.0,0.0},{20.0,4.0}})}), 32 | Diagram(coordinateSystem( 33 | preserveAspectRatio=false, 34 | extent={{-100,-100},{100,100}}), graphics={ 35 | Polygon( 36 | points={{-40,25},{40,25},{50,15},{40,-20},{30,-25},{-30,-25},{-40,-20},{-50,15}}, 37 | lineColor={0,0,0}, 38 | fillColor={255,0,0}, 39 | fillPattern=FillPattern.Solid, 40 | smooth=Smooth.Bezier), 41 | Ellipse( 42 | extent={{-22.5,7.5},{-17.5,12.5}}, 43 | lineColor={0,0,0}, 44 | fillColor={0,0,0}, 45 | fillPattern=FillPattern.Solid), 46 | Ellipse( 47 | extent={{17.5,12.5},{22.5,7.5}}, 48 | lineColor={0,0,0}, 49 | fillColor={0,0,0}, 50 | fillPattern=FillPattern.Solid), 51 | Ellipse( 52 | extent={{-2.5,-7.5},{2.5,-12.5}}, 53 | lineColor={0,0,0}, 54 | fillColor={0,0,0}, 55 | fillPattern=FillPattern.Solid), 56 | Text( 57 | extent={{-150,70},{150,40}}, 58 | lineColor={0,0,0}, 59 | textString= 60 | "%name")})); 61 | end SignalBus; 62 | -------------------------------------------------------------------------------- /MicroGrid/Sensors/Interfaces/package.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Sensors; 2 | package Interfaces 3 | extends Modelica.Icons.InterfacesPackage; 4 | 5 | end Interfaces; 6 | -------------------------------------------------------------------------------- /MicroGrid/Sensors/Interfaces/package.order: -------------------------------------------------------------------------------- 1 | SignalBus 2 | Sensor2Real 3 | Real2Sensor 4 | -------------------------------------------------------------------------------- /MicroGrid/Sensors/VoltageSensor.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Sensors; 2 | model VoltageSensor "Sensor to measure the voltage difference between two pins" 3 | extends Modelica.Icons.RotationalSensor; 4 | MicroGrid.Electrical.Interfaces.PositivePin p "positive pin" annotation (Placement( 5 | transformation(extent={{-110,-10},{-90,10}}))); 6 | MicroGrid.Electrical.Interfaces.NegativePin n "negative pin" annotation (Placement( 7 | transformation(extent={{90,-10},{110,10}}))); 8 | MicroGrid.Sensors.Interfaces.SignalBus voltSignal 9 | "Voltage between pin p and n (= p.v - n.v) as output signal" 10 | annotation (Placement(transformation( 11 | origin={0,-95}, 12 | extent={{10,-10},{-10,10}}, 13 | rotation=0), iconTransformation(extent={{16,-15.5},{-16,15.5}}, origin={ 14 | 0,-93.5}))); 15 | equation 16 | p.i = 0; 17 | n.i = 0; 18 | voltSignal.sensorSignal = p.v - n.v; 19 | annotation ( 20 | Icon(coordinateSystem( 21 | preserveAspectRatio=true, 22 | extent={{-100,-100},{100,100}}), graphics={ 23 | Text( 24 | extent={{-29,-11},{30,-70}}, 25 | lineColor={0,0,0}, 26 | textString="V"), 27 | Line(points={{-70,0},{-90,0}}, color={0,0,255}), 28 | Line(points={{70,0},{90,0}}, color={0,0,255}), 29 | Line(points={{0,-90},{0,-70}}, color={0,0,127}), 30 | Text( 31 | extent={{-150,80},{150,120}}, 32 | textString="%name", 33 | lineColor={0,0,255})}), 34 | Diagram(coordinateSystem( 35 | preserveAspectRatio=true, 36 | extent={{-100,-100},{100,100}}), graphics={ 37 | Line(points={{-70,0},{-96,0}}), 38 | Line(points={{70,0},{96,0}}), 39 | Line(points={{0,-90},{0,-70}}, color={0,0,255})})); 40 | end VoltageSensor; 41 | -------------------------------------------------------------------------------- /MicroGrid/Sensors/package.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid; 2 | package Sensors 3 | extends Modelica.Icons.SensorsPackage; 4 | 5 | end Sensors; 6 | -------------------------------------------------------------------------------- /MicroGrid/Sensors/package.order: -------------------------------------------------------------------------------- 1 | Interfaces 2 | VoltageSensor 3 | CurrentSensor 4 | threePhaseVoltageSensor 5 | threePhaseCurrentSensor 6 | -------------------------------------------------------------------------------- /MicroGrid/Sensors/threePhaseCurrentSensor.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Sensors; 2 | model threePhaseCurrentSensor "Sensor to measure the each phase current in a three-phase system" 3 | extends Modelica.Electrical.PowerConverters.Icons.Control; 4 | Electrical.Interfaces.PositivePin p1 annotation (Placement(transformation(extent={{-106,50},{-86,70}}))); 5 | Electrical.Interfaces.PositivePin p2 annotation (Placement(transformation(extent={{-106,-10},{-86,10}}))); 6 | Electrical.Interfaces.PositivePin p3 annotation (Placement(transformation(extent={{-106,-70},{-86,-50}}))); 7 | Electrical.Interfaces.NegativePin n1 annotation (Placement(transformation(extent={{86,50},{106,70}}))); 8 | Electrical.Interfaces.NegativePin n2 annotation (Placement(transformation(extent={{86,-10},{106,10}}))); 9 | Electrical.Interfaces.NegativePin n3 annotation (Placement(transformation(extent={{86,-70},{106,-50}}))); 10 | CurrentSensor CurrentSensor1 annotation (Placement(transformation(extent={{-70,50},{-50,70}}))); 11 | CurrentSensor CurrentSensor2 annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); 12 | CurrentSensor CurrentSensor3 annotation (Placement(transformation(extent={{50,-70},{70,-50}}))); 13 | Interfaces.SignalBus imeasured1 annotation (Placement(transformation(extent={{-70,-108},{-50,-88}}))); 14 | Interfaces.SignalBus imeasured2 annotation (Placement(transformation(extent={{-10,-108},{10,-88}}))); 15 | Interfaces.SignalBus imeasured3 annotation (Placement(transformation(extent={{50,-108},{70,-88}}))); 16 | equation 17 | 18 | connect(CurrentSensor1.p, p1) annotation (Line(points={{-70,60},{-96,60}}, color={0,0,255})); 19 | connect(CurrentSensor1.n, n1) annotation (Line(points={{-50,60},{96,60},{96,60}}, color={0,0,255})); 20 | connect(CurrentSensor2.p, p2) annotation (Line(points={{-10,0},{-96,0}}, color={0,0,255})); 21 | connect(CurrentSensor2.n, n2) annotation (Line(points={{10,0},{96,0}}, color={0,0,255})); 22 | connect(CurrentSensor3.p, p3) annotation (Line(points={{50,-60},{-96,-60},{-96,-60}}, color={0,0,255})); 23 | connect(CurrentSensor3.n, n3) annotation (Line(points={{70,-60},{96,-60}}, color={0,0,255})); 24 | connect(CurrentSensor1.currSignal, imeasured1) annotation (Line( 25 | points={{-59.9,50.65},{-59.9,-98},{-60,-98}}, 26 | color={255,0,0}, 27 | thickness=0.5)); 28 | connect(CurrentSensor2.currSignal, imeasured2) annotation (Line( 29 | points={{0.1,-9.35},{0.1,-98},{0,-98},{0,-98}}, 30 | color={255,0,0}, 31 | thickness=0.5)); 32 | connect(CurrentSensor3.currSignal, imeasured3) annotation (Line( 33 | points={{60.1,-69.35},{60.1,-98},{60,-98},{60,-98}}, 34 | color={255,0,0}, 35 | thickness=0.5)); 36 | annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, 37 | -100},{100,100}}), graphics={ 38 | Ellipse(origin={0.0,-30.0}, 39 | fillColor={255,255,255}, 40 | extent={{-90.0,-90.0},{90.0,90.0}}, 41 | startAngle=20.0, 42 | endAngle=160.0), 43 | Ellipse(origin={0.0,-30.0}, 44 | fillColor={128,128,128}, 45 | pattern=LinePattern.None, 46 | fillPattern=FillPattern.Solid, 47 | extent={{-20.0,-20.0},{20.0,20.0}}), 48 | Line(origin={0.0,-30.0}, 49 | points={{0.0,60.0},{0.0,90.0}}), 50 | Ellipse(origin={-0.0,-30.0}, 51 | fillColor={64,64,64}, 52 | pattern=LinePattern.None, 53 | fillPattern=FillPattern.Solid, 54 | extent={{-10.0,-10.0},{10.0,10.0}}), 55 | Polygon( 56 | origin={-0.0,-30.0}, 57 | rotation=-35.0, 58 | fillColor={64,64,64}, 59 | pattern=LinePattern.None, 60 | fillPattern=FillPattern.Solid, 61 | points={{-7.0,0.0},{-3.0,85.0},{0.0,90.0},{3.0,85.0},{7.0,0.0}}), 62 | Text( 63 | extent={{-72,105},{68,80}}, 64 | textString="%name", 65 | lineColor={0,0,255})})); 66 | end threePhaseCurrentSensor; 67 | -------------------------------------------------------------------------------- /MicroGrid/Sensors/threePhaseVoltageSensor.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Sensors; 2 | model threePhaseVoltageSensor "Sensor to measure the each phase voltage (phase to ground) in a three-phase system" 3 | extends Modelica.Electrical.PowerConverters.Icons.Control; 4 | Electrical.Interfaces.PositivePin p1 annotation (Placement(transformation(extent={{-106,50},{-86,70}}))); 5 | Electrical.Interfaces.PositivePin p2 annotation (Placement(transformation(extent={{-106,-10},{-86,10}}))); 6 | Electrical.Interfaces.PositivePin p3 annotation (Placement(transformation(extent={{-106,-70},{-86,-50}}))); 7 | VoltageSensor VoltageSensor1 annotation (Placement(transformation(extent={{-70,50},{-50,70}}))); 8 | VoltageSensor VoltageSensor2 annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); 9 | VoltageSensor VoltageSensor3 annotation (Placement(transformation(extent={{50,-70},{70,-50}}))); 10 | Electrical.BasicComponents.ground ground annotation (Placement(transformation( 11 | extent={{-10,-10},{10,10}}, 12 | rotation=90, 13 | origin={90,0}))); 14 | Interfaces.SignalBus vmeasured1 annotation (Placement(transformation(extent={{-70,-108},{-50,-88}}))); 15 | Interfaces.SignalBus vmeasured2 annotation (Placement(transformation(extent={{-10,-108},{10,-88}}))); 16 | Interfaces.SignalBus vmeasured3 annotation (Placement(transformation(extent={{50,-108},{70,-88}}))); 17 | equation 18 | 19 | connect(VoltageSensor2.n, ground.p) annotation (Line(points={{10,0},{46,0},{46, 20 | 4.44089e-16},{80,4.44089e-16}}, color={0,0,255})); 21 | connect(VoltageSensor1.n, ground.p) annotation (Line(points={{-50,60},{80,60}, 22 | {80,4.44089e-16}}, color={0,0,255})); 23 | connect(VoltageSensor3.n, ground.p) annotation (Line(points={{70,-60},{80,-60}, 24 | {80,6.66134e-16}}, color={0,0,255})); 25 | connect(VoltageSensor1.p, p1) 26 | annotation (Line(points={{-70,60},{-96,60}}, color={0,0,255})); 27 | connect(VoltageSensor2.p, p2) 28 | annotation (Line(points={{-10,0},{-96,0}}, color={0,0,255})); 29 | connect(VoltageSensor3.p, p3) 30 | annotation (Line(points={{50,-60},{-96,-60}}, color={0,0,255})); 31 | connect(vmeasured1, VoltageSensor1.voltSignal) annotation (Line( 32 | points={{-60,-98},{-60,50.65}}, 33 | color={255,0,0}, 34 | thickness=0.5)); 35 | connect(vmeasured2, VoltageSensor2.voltSignal) annotation (Line( 36 | points={{0,-98},{0,-9.35}}, 37 | color={255,0,0}, 38 | thickness=0.5)); 39 | connect(vmeasured3, VoltageSensor3.voltSignal) annotation (Line( 40 | points={{60,-98},{60,-69.35}}, 41 | color={255,0,0}, 42 | thickness=0.5)); 43 | annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, 44 | -100},{100,100}}), graphics={ 45 | Ellipse(origin={0.0,-30.0}, 46 | fillColor={255,255,255}, 47 | extent={{-90.0,-90.0},{90.0,90.0}}, 48 | startAngle=20.0, 49 | endAngle=160.0), 50 | Ellipse(origin={0.0,-30.0}, 51 | fillColor={128,128,128}, 52 | pattern=LinePattern.None, 53 | fillPattern=FillPattern.Solid, 54 | extent={{-20.0,-20.0},{20.0,20.0}}), 55 | Line(origin={0.0,-30.0}, 56 | points={{0.0,60.0},{0.0,90.0}}), 57 | Ellipse(origin={-0.0,-30.0}, 58 | fillColor={64,64,64}, 59 | pattern=LinePattern.None, 60 | fillPattern=FillPattern.Solid, 61 | extent={{-10.0,-10.0},{10.0,10.0}}), 62 | Polygon( 63 | origin={-0.0,-30.0}, 64 | rotation=-35.0, 65 | fillColor={64,64,64}, 66 | pattern=LinePattern.None, 67 | fillPattern=FillPattern.Solid, 68 | points={{-7.0,0.0},{-3.0,85.0},{0.0,90.0},{3.0,85.0},{7.0,0.0}}), 69 | Text( 70 | extent={{-72,105},{68,80}}, 71 | textString="%name", 72 | lineColor={0,0,255})})); 73 | end threePhaseVoltageSensor; 74 | -------------------------------------------------------------------------------- /MicroGrid/Storage/Battery.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid.Storage; 2 | model Battery 3 | extends MicroGrid.Electrical.Interfaces.OnePort; 4 | parameter Real E0 = 12.6463; 5 | parameter Real Q = 0.65; 6 | parameter Real A = 0.65; 7 | parameter Real B = 2884.61; 8 | parameter Real K = 0.33; 9 | parameter Real R = 0.25; 10 | parameter Real SoCO = 90; 11 | Real Qt; 12 | Real SoC; 13 | Real E; 14 | initial equation 15 | Qt = (1 - SoCO / 100) * Q; 16 | equation 17 | der(Qt) = -i / 3600; 18 | E = E0 - K * Q / (Q - Qt) + A * exp(-B * Qt); 19 | v = E + R * i; 20 | SoC = (1 - Qt / Q) * 100; 21 | 22 | annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}, grid = {2, 2}, initialScale = 0.1), graphics={ Line(visible = true, origin = {14, 0}, points = {{-90, 0}, {-50, 0}}), Line(visible = true, origin = {-14, 0}, points = {{50, 0}, {90, 0}}), Line(visible = true, origin = {14, 0}, points = {{-50, 40}, {-50, -40}}), Line(visible = true, points = {{-20, 20}, {-20, -20}}), Line(visible = true, points = {{-20, 0}, {20, 0}}), Line(visible = true, points = {{20, 40}, {20, -40}}), Line(visible = true, origin = {-14, 0}, points = {{50, 20}, {50, -20}}), Text(visible = true, textColor = {28, 108, 200}, extent = {{-80, -80}, {80, -40}}, textString = "%name")})); 23 | end Battery; 24 | -------------------------------------------------------------------------------- /MicroGrid/Storage/package.mo: -------------------------------------------------------------------------------- 1 | within MicroGrid; 2 | package Storage 3 | extends Modelica.Icons.SourcesPackage; 4 | end Storage; 5 | -------------------------------------------------------------------------------- /MicroGrid/Storage/package.order: -------------------------------------------------------------------------------- 1 | Battery 2 | -------------------------------------------------------------------------------- /MicroGrid/package.mo: -------------------------------------------------------------------------------- 1 | package MicroGrid 2 | extends Modelica.Icons.Package; 3 | 4 | annotation(uses(Modelica(version="3.2.2"))); 5 | end MicroGrid; 6 | -------------------------------------------------------------------------------- /MicroGrid/package.order: -------------------------------------------------------------------------------- 1 | Examples 2 | Electrical 3 | Storage 4 | PhotoVoltaics 5 | Control 6 | Sensors 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MicroGrid 2 | Small library made as final project for the course Modeling and Simulation of Cyber-Physical Systems. It contains models for batteries, photovoltaics modules, converters and control systems. 3 | 4 | ## How to simulate it? 5 | - Download the library MicroGrid. 6 | - Go to folder `MicroGrid` and load the model `package.mo`. This act will load all the models into the Working tab in the Modelica-compliant software used. 7 | - The main package, MicroGrid, consists of six subpackages, named: (1) Examples, (2) Electrical, (3) Storage, (4) PhotoVoltaics, (5) Control and (6) Sensors. The microgrid example is within (1) Examples, named `MicroGrid_Example.mo`. Other examples are available in `Electrical/Examples` and in `Control/Examples`. 8 | - The model `Examples/MicroGrid_Example.mo` can be simulated in different manners, depending on the Modelica-compliant software being used. For OpenModelica and Dymola, the user should move to Simulation tab and by clicking the Simulate button. For SystemModeler, the Simulate button is located in the Modeling tab. 9 | 10 | ## License - No Warranty 11 | 12 | This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the GNU Public License version 3. 13 | 14 | Copyright (C) 2018-2019, Marcelo de Castro Fernandes and Luigi Vanfretti. 15 | 16 | ## Acknowledgement 17 | This work was supported in part by the Engineering Research Center Program of the National Science Foundation and the Department of Energy under NSF Award Number EEC-1041877 and the CURENT Industry Partnership Program. 18 | --------------------------------------------------------------------------------