|
| 1 | +within OpenIPSL.Electrical.Renewables.PSSE; |
| 2 | +model BESS "Framework for a battery energy storage system plant including controllers" |
| 3 | +parameter Types.ApparentPower M_b=RenewableGenerator.SysData.S_b "Machine base power" annotation(Dialog(group= "Power flow data")); |
| 4 | +extends OpenIPSL.Electrical.Essentials.pfComponent( |
| 5 | + final enablefn=true, |
| 6 | + final enableV_b=false, |
| 7 | + final enableangle_0=true, |
| 8 | + final enablev_0=true, |
| 9 | + final enableQ_0=true, |
| 10 | + final enableP_0=true, |
| 11 | + final enabledisplayPF=true, |
| 12 | + final enableS_b=true); |
| 13 | + |
| 14 | + // Parameters for selection |
| 15 | + parameter Integer QFunctionality = 0 "BESS Reactive Power Control Options" annotation(Dialog(group= "Reactive Power Control Options"), choices(choice=0 "Constant local PF control", choice=1 "Constant local Q control", choice=2 "Local V control", choice=3 "Local coordinated V/Q control", choice=4 "Plant level Q control", choice=5 "Plant level V control", choice=6 "Plant level Q control + local coordinated V/Q control", choice=7 "Plant level V control + local coordinated V/Q control")); |
| 16 | + parameter Integer PFunctionality = 0 "BESS Real Power Control Options" annotation (Dialog(group= "Active Power Control Options", enable=(QFunctionality >=4)), choices(choice=0 "No governor response", choice=1 "Governor response with up and down regulation")); |
| 17 | + |
| 18 | + replaceable |
| 19 | + OpenIPSL.Electrical.Renewables.PSSE.InverterInterface.BaseClasses.BaseREGC |
| 20 | + RenewableGenerator( |
| 21 | + M_b=M_b, |
| 22 | + P_0=P_0, |
| 23 | + Q_0=Q_0, |
| 24 | + v_0=v_0, |
| 25 | + angle_0=angle_0) annotation (choicesAllMatching=true, Placement( |
| 26 | + transformation(extent={{30,-20},{70,20}}))); |
| 27 | + replaceable |
| 28 | + OpenIPSL.Electrical.Renewables.PSSE.ElectricalController.BaseClasses.BaseREECC |
| 29 | + RenewableController( |
| 30 | + pfflag=pfflag, |
| 31 | + vflag=vflag, |
| 32 | + qflag=qflag, |
| 33 | + pqflag=false) annotation (choicesAllMatching=true, Placement(transformation( |
| 34 | + extent={{-20,-20},{20,20}}))); |
| 35 | + Interfaces.PwPin pwPin |
| 36 | + annotation (Placement(transformation(extent={{90,-10},{110,10}}))); |
| 37 | + replaceable |
| 38 | + OpenIPSL.Electrical.Renewables.PSSE.PlantController.BaseClasses.BaseREPC |
| 39 | + PlantController( |
| 40 | + M_b=M_b, |
| 41 | + P_0=P_0, |
| 42 | + Q_0=Q_0, |
| 43 | + v_0=v_0, |
| 44 | + angle_0=angle_0, |
| 45 | + fflag=fflag, |
| 46 | + refflag=refflag) if QFunctionality >= 4 annotation (choicesAllMatching=true, |
| 47 | + Placement(transformation(extent={{-78,-20},{-38,20}}))); |
| 48 | + Modelica.Blocks.Math.Gain gain(k=1) |
| 49 | + if QFunctionality < 4 |
| 50 | + annotation (Placement(transformation( |
| 51 | + extent={{-6,-6},{6,6}}, |
| 52 | + rotation=180, |
| 53 | + origin={-6,-60}))); |
| 54 | + Modelica.Blocks.Math.Gain gain1(k=1) |
| 55 | + if QFunctionality < 4 |
| 56 | + annotation (Placement(transformation( |
| 57 | + extent={{-6,6},{6,-6}}, |
| 58 | + rotation=180, |
| 59 | + origin={-6,-80}))); |
| 60 | + Modelica.Blocks.Sources.Constant freq_ref(k=SysData.fn) if QFunctionality >= 4 |
| 61 | + annotation (Placement(transformation(extent={{-70,-60},{-80,-50}}))); |
| 62 | + Modelica.Blocks.Interfaces.RealInput FREQ if QFunctionality >= 4 "Connection Point Frequency" |
| 63 | + annotation (Placement(transformation(extent={{-140,-20},{-100,20}}))); |
| 64 | + |
| 65 | + Modelica.Blocks.Sources.Constant PAUX(k=0) |
| 66 | + annotation (Placement(transformation(extent={{-80,-80},{-70,-70}}))); |
| 67 | + Modelica.Blocks.Interfaces.RealInput branch_ir if QFunctionality >= 4 "Measured Branch Real Current" |
| 68 | + annotation (Placement(transformation( |
| 69 | + extent={{-20,-20},{20,20}}, |
| 70 | + rotation=270, |
| 71 | + origin={-80,120}),iconTransformation( |
| 72 | + extent={{-20,-20},{20,20}}, |
| 73 | + rotation=90, |
| 74 | + origin={60,-100}))); |
| 75 | + Modelica.Blocks.Interfaces.RealInput branch_ii if QFunctionality >= 4 "Measured Branch Imaginary Current" |
| 76 | + annotation (Placement(transformation( |
| 77 | + extent={{-20,-20},{20,20}}, |
| 78 | + rotation=270, |
| 79 | + origin={-40,120}),iconTransformation( |
| 80 | + extent={{-20,-20},{20,20}}, |
| 81 | + rotation=90, |
| 82 | + origin={-60,-100}))); |
| 83 | + Modelica.Blocks.Interfaces.RealInput regulate_vr if QFunctionality >= 4 "Regulated Branch Real Voltage" |
| 84 | + annotation (Placement(transformation( |
| 85 | + extent={{-20,-20},{20,20}}, |
| 86 | + rotation=270, |
| 87 | + origin={40,120}),iconTransformation( |
| 88 | + extent={{-20,-20},{20,20}}, |
| 89 | + rotation=270, |
| 90 | + origin={-60,100}))); |
| 91 | + Modelica.Blocks.Interfaces.RealInput regulate_vi if QFunctionality >= 4 "Regulated Branch Imaginary Voltage" |
| 92 | + annotation (Placement(transformation( |
| 93 | + extent={{-20,-20},{20,20}}, |
| 94 | + rotation=270, |
| 95 | + origin={80,120}),iconTransformation( |
| 96 | + extent={{-20,-20},{20,20}}, |
| 97 | + rotation=270, |
| 98 | + origin={60,100}))); |
| 99 | +protected |
| 100 | + parameter Boolean pfflag = (if QFunctionality == 0 then true else false); |
| 101 | + parameter Boolean vflag = (if QFunctionality == 3 or QFunctionality == 6 or QFunctionality == 7 then true else false); |
| 102 | + parameter Boolean qflag = (if QFunctionality == 2 or QFunctionality == 3 or QFunctionality == 6 or QFunctionality == 7 then true else false); |
| 103 | + parameter Boolean refflag = (if QFunctionality == 5 or QFunctionality == 7 then true else false); |
| 104 | + parameter Boolean fflag = (if PFunctionality == 1 then true else false); |
| 105 | +equation |
| 106 | + connect(RenewableController.Ipcmd, RenewableGenerator.Ipcmd) |
| 107 | + annotation (Line(points={{20.6667,-11.3333},{24,-11.3333},{24,-11.4286},{ |
| 108 | + 27.1429,-11.4286}}, color={0,0,127})); |
| 109 | + connect(RenewableController.Iqcmd, RenewableGenerator.Iqcmd) |
| 110 | + annotation (Line(points={{20.6667,11.3333},{24,11.3333},{24,11.4286},{ |
| 111 | + 27.1429,11.4286}}, color={0,0,127})); |
| 112 | + connect(RenewableGenerator.IQ0, RenewableController.iq0) annotation (Line( |
| 113 | + points={{32.8571,-21.4286},{32.8571,-28},{16,-28},{16,-21.3333}}, |
| 114 | + color={0,0,127})); |
| 115 | + connect(RenewableGenerator.IP0, RenewableController.ip0) annotation (Line( |
| 116 | + points={{41.4286,-21.4286},{41.4286,-32},{8,-32},{8,-21.3333}}, color= |
| 117 | + {0,0,127})); |
| 118 | + connect(RenewableGenerator.V_0, RenewableController.v0) annotation (Line( |
| 119 | + points={{50,-21.4286},{50,-36},{0,-36},{0,-21.3333}}, color={0,0,127})); |
| 120 | + connect(RenewableGenerator.q_0, RenewableController.q0) annotation (Line( |
| 121 | + points={{58.5714,-21.4286},{58.5714,-40},{-8,-40},{-8,-21.3333}}, |
| 122 | + color={0, |
| 123 | + 0,127})); |
| 124 | + connect(RenewableGenerator.p_0, RenewableController.p0) annotation (Line( |
| 125 | + points={{67.1429,-21.4286},{67.1429,-44},{-16,-44},{-16,-21.3333}}, |
| 126 | + color={0,0,127})); |
| 127 | + connect(RenewableGenerator.V_t, RenewableController.Vt) annotation (Line( |
| 128 | + points={{38.5714,21.4286},{38.5714,26},{-26,26},{-26,16},{-21.3333,16}}, |
| 129 | + color={0,0,127})); |
| 130 | + connect(RenewableGenerator.Pgen, RenewableController.Pe) annotation (Line( |
| 131 | + points={{50,21.4286},{50,30},{-28,30},{-28,10.6667},{-21.3333,10.6667}}, |
| 132 | + color={0,0,127})); |
| 133 | + connect(RenewableGenerator.Qgen, RenewableController.Qgen) annotation (Line( |
| 134 | + points={{61.4286,21.4286},{61.4286,34},{-30,34},{-30,5.33333},{-21.3333, |
| 135 | + 5.33333}}, |
| 136 | + color={0,0,127})); |
| 137 | + connect(PlantController.Qext, RenewableController.Qext) annotation (Line( |
| 138 | + points={{-37,10},{-32,10},{-32,0},{-21.3333,0}}, color={0, |
| 139 | + 0,127})); |
| 140 | + connect(PlantController.Pref, RenewableController.Pref) annotation (Line( |
| 141 | + points={{-37,-10},{-34,-10},{-34,-6},{-24,-6},{-24,-5.33333},{-21.3333, |
| 142 | + -5.33333}}, color={ |
| 143 | + 0,0,127})); |
| 144 | + connect(PlantController.p0, RenewableController.p0) annotation (Line(points={{-70,-22}, |
| 145 | + {-70,-44},{-16,-44},{-16,-21.3333}}, color={0,0,127})); |
| 146 | + connect(PlantController.v0, RenewableController.v0) annotation (Line(points={{-58,-22}, |
| 147 | + {-58,-36},{0,-36},{0,-21.3333}}, color={0,0,127})); |
| 148 | + connect(PlantController.q0, RenewableController.q0) annotation (Line(points={{-46,-22}, |
| 149 | + {-46,-40},{-8,-40},{-8,-21.3333}}, color={0,0,127})); |
| 150 | + connect(gain.u, RenewableGenerator.p_0) annotation (Line(points={{1.2,-60},{ |
| 151 | + 67.1429,-60},{67.1429,-21.4286}}, |
| 152 | + color={0,0,127})); |
| 153 | + connect(gain1.y, RenewableController.Qext) annotation (Line(points={{-12.6, |
| 154 | + -80},{-32,-80},{-32,0},{-21.3333,0}}, color={0,0,127})); |
| 155 | + connect(gain.y, RenewableController.Pref) annotation (Line(points={{-12.6,-60}, |
| 156 | + {-30,-60},{-30,-5.33333},{-21.3333,-5.33333}}, color={0,0,127})); |
| 157 | + connect(gain1.u, RenewableGenerator.q_0) annotation (Line(points={{1.2,-80},{ |
| 158 | + 58.5714,-80},{58.5714,-21.4286}}, |
| 159 | + color={0,0,127})); |
| 160 | + connect(freq_ref.y, PlantController.Freq_ref) annotation (Line(points={{-80.5, |
| 161 | + -55},{-88,-55},{-88,-12},{-80,-12}}, color={0,0,127})); |
| 162 | + connect(PlantController.Plant_pref, RenewableGenerator.p_0) annotation (Line( |
| 163 | + points={{-80,4},{-96,4},{-96,-92},{67.1429,-92},{67.1429,-21.4286}}, |
| 164 | + color={0,0,127})); |
| 165 | + connect(PlantController.Qref, RenewableGenerator.q_0) annotation (Line(points={{-80,12}, |
| 166 | + {-98,12},{-98,-98},{58.5714,-98},{58.5714,-21.4286}}, color={ |
| 167 | + 0,0,127})); |
| 168 | + connect(RenewableGenerator.p, pwPin) |
| 169 | + annotation (Line(points={{70,0},{100,0}}, color={0,0,255})); |
| 170 | + connect(PlantController.Freq, FREQ) annotation (Line(points={{-80,-4},{-92,-4},{-92,0},{-120,0}}, |
| 171 | + color={0,0,127})); |
| 172 | + connect(PAUX.y, RenewableController.Paux) annotation (Line(points={{-69.5,-75}, |
| 173 | + {-26,-75},{-26,-10.6667},{-21.3333,-10.6667}}, color={0,0,127})); |
| 174 | + connect(PlantController.branch_ii, branch_ii) annotation (Line(points={{-62,22},{-62,96},{-40,96},{-40,120}}, |
| 175 | + color={0,0,127})); |
| 176 | + connect(PlantController.branch_ir, branch_ir) annotation (Line(points={{-72,22},{-72,96},{-80,96},{-80,120}}, |
| 177 | + color={0,0,127})); |
| 178 | + connect(PlantController.regulate_vr, regulate_vr) annotation (Line(points={{-52,22},{-52,94},{40,94},{40,120}}, |
| 179 | + color={0,0,127})); |
| 180 | + connect(PlantController.regulate_vi, regulate_vi) annotation (Line(points={{-44,22},{-44,92},{80,92},{80,120}}, |
| 181 | + color={0,0,127})); |
| 182 | + annotation (Icon(graphics={ Ellipse( |
| 183 | + extent={{-100,100},{100,-100}}, |
| 184 | + lineColor={0,0,0}, |
| 185 | + fillColor={255,170,85}, |
| 186 | + fillPattern=FillPattern.Solid), |
| 187 | + Text( |
| 188 | + extent={{-40,20},{40,-20}}, |
| 189 | + lineColor={0,0,0}, |
| 190 | + textString="%name"), Line( |
| 191 | + points={{-20,20},{-44,42},{-66,32},{-80,0}}, |
| 192 | + color={0,0,0}, |
| 193 | + smooth=Smooth.Bezier), Line( |
| 194 | + points={{20,-20},{44,-42},{66,-32},{80,0}}, |
| 195 | + color={0,0,0}, |
| 196 | + smooth=Smooth.Bezier)}), |
| 197 | + Documentation(info="<html> |
| 198 | +<p> |
| 199 | +This model is meant as a simple framework to create a battery energy storage system plant that consists of: |
| 200 | +</p> |
| 201 | +<ul> |
| 202 | +<li>Generator/Converter</li> |
| 203 | +<li>Electrical Controller</li> |
| 204 | +<li>Plant Controller</li> |
| 205 | +</ul> |
| 206 | +<p> |
| 207 | +The type of each can be selected via a drop down list where also |
| 208 | + a deactivation is provided (normally via feed through). |
| 209 | +</p> |
| 210 | +<p> |
| 211 | +The type of control configuration can also be selected via drop down list. |
| 212 | +</p> |
| 213 | +</html>")); |
| 214 | +end BESS; |
0 commit comments