Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions VirtualFCS/Control/BatteryManagementSystem.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ within VirtualFCS.Control;

model BatteryManagementSystem "Implement algorithms for the control of battery systems."
parameter Real N_s "Number of Cells in Series";
parameter Real lowerVoltageLimit = N_s * 2;
parameter Real upperVoltageLimit = N_s * 3.6;
parameter Modelica.Units.SI.Voltage lowerVoltageLimit = N_s * 2;
parameter Modelica.Units.SI.Voltage upperVoltageLimit = N_s * 3.6;
VirtualFCS.Control.ChargeCounter chargeCounter annotation(
Placement(visible = true, transformation(origin = {25, -1}, extent = {{25, -25}, {-25, 25}}, rotation = 0)));
Modelica.Electrical.Analog.Interfaces.NegativePin pin_n_battery annotation(
Expand Down Expand Up @@ -47,4 +47,4 @@ equation
Icon(graphics = {Rectangle(fillColor = {50, 50, 50}, fillPattern = FillPattern.Solid, extent = {{-100, 100}, {100, -100}}), Text(origin = {2, 72}, lineColor = {255, 255, 255}, extent = {{-26, 22}, {26, -22}}, textString = "Load"), Text(origin = {0, -52}, lineColor = {255, 255, 255}, extent = {{-44, 34}, {48, -36}}, textString = "Battery"), Text(origin = {104, 146}, lineColor = {0, 0, 255}, extent = {{-26, 22}, {84, -80}}, textString = "%name"), Text(origin = {62, 24}, lineColor = {255, 255, 255}, extent = {{-44, 34}, {26, -24}}, textString = "SOC_init"), Text(origin = {106, -52}, lineColor = {255, 255, 255}, extent = {{-44, 34}, {-8, 10}}, textString = "Q")}, coordinateSystem(extent = {{-150, -100}, {150, 100}}, initialScale = 0.1)),
Diagram(coordinateSystem(extent = {{-150, -100}, {150, 100}})),
Documentation(info = "<html><head></head><body>The BatteryManagementSystem component is responsible for protecting the battery pack. It ensures that the pack is not overcharged or overdischarged to dangerous state-of-charge levels. It also limits the maximum charging and discharging current the battery pack can support.</body></html>"));
end BatteryManagementSystem;
end BatteryManagementSystem;
2 changes: 1 addition & 1 deletion VirtualFCS/Control/DCMotorControlPumpElectricDC.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ within VirtualFCS.Control;

model DCMotorControlPumpElectricDC "Control the speed of a DC motor"
//*** DEFINE REPLACEABLE PACKAGES ***//
replaceable parameter VirtualFCS.Utilities.ParameterRecords.DriveDataDcPm driveData annotation(
replaceable parameter VirtualFCS.Utilities.ParameterRecords.DriveDataCpump driveData annotation(
Placement(visible = true, transformation(extent = {{-248, 44}, {-228, 64}}, rotation = 0))) constrainedby Modelica.Electrical.Machines.Examples.ControlledDCDrives.Utilities.DriveDataDCPM annotation(
Placement(transformation(extent = {{20, -80}, {40, -60}})));
//*** INSTANTIATE COMPONENTS ***//
Expand Down
2 changes: 1 addition & 1 deletion VirtualFCS/Control/DCMotorControlRecirculationBlower.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ within VirtualFCS.Control;

model DCMotorControlRecirculationBlower "Control the speed of a DC motor"
//*** DEFINE REPLACEABLE PACKAGES ***//
replaceable parameter VirtualFCS.Utilities.ParameterRecords.DriveDataDcPm driveData annotation(
replaceable parameter VirtualFCS.Utilities.ParameterRecords.DriveDataRBlower driveData annotation(
Placement(visible = true, transformation(extent = {{-248, 44}, {-228, 64}}, rotation = 0))) constrainedby Modelica.Electrical.Machines.Examples.ControlledDCDrives.Utilities.DriveDataDCPM annotation(
Placement(transformation(extent = {{20, -80}, {40, -60}})));
//*** INSTANTIATE COMPONENTS ***//
Expand Down
2 changes: 1 addition & 1 deletion VirtualFCS/Control/EMS_FC.mo
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
within VirtualFCS.Control;

block EMS_FC
parameter Real ramp_up(unit = "1/s") = 20 "FC stack current ramp up rate";
parameter Modelica.Units.SI.TimeAging ramp_up = 20 "FC stack current ramp up rate";
Modelica.Blocks.Math.Abs abs1 annotation(
Placement(visible = true, transformation(origin = {70, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.Constant OFF(k = 0) annotation(
Expand Down
10 changes: 6 additions & 4 deletions VirtualFCS/Control/EnergyManagementSystem.mo
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
within VirtualFCS.Control;

block EnergyManagementSystem "Implement algorithms to control the energy and power distribution in a hybrid system."
parameter Real I_nom_FC_stack(unit = "A") = 100 "FC stack nominal operating current";
parameter Real ramp_up(unit = "1/s") = 20 "FC stack current ramp up rate";
parameter Modelica.Units.SI.Current I_nom_FC_stack = 100 "FC stack nominal operating current";
parameter Modelica.Units.SI.TimeAging ramp_up = 20 "FC stack current ramp up rate";
parameter Real SOC_lower_limit(unit = "1") = 0.2 "SOC lower limit";
parameter Real SOC_higher_limit(unit = "1") = 0.8 "SOC lower limit";
Modelica.Blocks.Sources.Constant shut_down(k = 0) annotation(
Placement(visible = true, transformation(origin = {-70, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Logical.Hysteresis hysteresis(pre_y_start = true, uHigh = 0.8, uLow = 0.2) annotation(
Modelica.Blocks.Logical.Hysteresis hysteresis(pre_y_start = true, uHigh = SOC_higher_limit, uLow = SOC_lower_limit) annotation(
Placement(visible = true, transformation(origin = {-70, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.Constant setFuelCellCurrent(k = -I_nom_FC_stack) annotation(
Placement(visible = true, transformation(origin = {-70, -40}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Expand Down Expand Up @@ -37,4 +39,4 @@ equation
annotation(
Icon(graphics = {Rectangle(fillColor = {50, 50, 50}, fillPattern = FillPattern.Solid, extent = {{-100, 100}, {100, -100}}), Text(origin = {-8, 121}, lineColor = {0, 0, 255}, extent = {{-54, 17}, {54, -17}}, textString = "%name")}, coordinateSystem(initialScale = 0.1)),
Documentation(info = "<html><head></head><body><div>The EnergyManagementSystem component is designed to manage the flow of power between the fuel cell stack, battery, vehicle load, and balance-of-plant load. It splits the load according to pre-defined energy management rules, which are implemented within the bounds of the battery management system and the fuel cell control unit.</div><div><br></div>This model implements a simple energy management algorithm for a hybrid fuel cell &amp; battery system. The model reads the state-of-charge (SOC) of the battery. If it is less than a lower threshold value, then a signal is sent to activate the fuel cell with a given electric current. The rate at which current can be demanded from the fuel cell is limited by a slew rate.&nbsp;</body></html>"));
end EnergyManagementSystem;
end EnergyManagementSystem;
4 changes: 1 addition & 3 deletions VirtualFCS/Control/PumpSpeedControl.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ within VirtualFCS.Control;

block PumpSpeedControl
parameter Real k = 1 "Control Gain";
parameter Real Td = 0.1 "Time Constant of Derivative Block";
//parameter Real k = 1 "Control Gain";
//parameter Real Td = 1 "Time Constant of Derivative Block";
parameter Modelica.Units.SI.Time Td = 0.1 "Time Constant of Derivative Block";
Modelica.Blocks.Continuous.LimPID limPID(Td = Td, initType = Modelica.Blocks.Types.Init.InitialOutput, k = k, yMax = 1, yMin = 0) annotation(
Placement(visible = true, transformation(origin = {-30, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Interfaces.RealInput setMassFlow annotation(
Expand Down
10 changes: 5 additions & 5 deletions VirtualFCS/Control/PumpSpeedControlCooling.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ within VirtualFCS.Control;

block PumpSpeedControlCooling
parameter Real k = 1 "Control Gain";
parameter Real Td = 0.1 "Time Constant of Derivative Block";
parameter Real Ti = 0.1 "Time Constant of Integral Block";
parameter Modelica.Units.SI.Time Td = 0.1 "Time Constant of Derivative Block";
parameter Modelica.Units.SI.Time Ti = 0.1 "Time Constant of Integral Block";
Modelica.Blocks.Interfaces.RealInput setMassFlow annotation(
Placement(visible = true, transformation(origin = {-100, 40}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-110, 50}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Interfaces.RealInput getMassFlow annotation(
Placement(visible = true, transformation(origin = {-100, -20}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-110, -50}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Interfaces.RealOutput setPumpSpeed annotation(
Placement(visible = true, transformation(origin = {110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Continuous.LimPID limPID(Ni = 0.1,Td = Td, Ti = Ti, controllerType = Modelica.Blocks.Types.SimpleController.PI, initType = Modelica.Blocks.Types.Init.InitialOutput, k = k, yMax = 1, yMin = 0, y_start = 1) annotation(
Placement(visible = true, transformation(origin = {84, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Continuous.LimPID limPID(Ni = 0.1,Td = Td, Ti = Ti, controllerType = Modelica.Blocks.Types.SimpleController.PI, initType = Modelica.Blocks.Types.Init.InitialOutput, k = k, yMax = 1, yMin = 0, y_start = 0.005) annotation(
Placement(visible = true, transformation(origin = {-30, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(setMassFlow, limPID.u_s) annotation(
Line(points = {{-100, 40}, {-60, 40}, {-60, 30}, {-42, 30}}, color = {0, 0, 127}));
connect(getMassFlow, limPID.u_m) annotation(
Line(points = {{-100, -20}, {-30, -20}, {-30, 18}}, color = {0, 0, 127}));
connect(limPID.y, setPumpSpeed) annotation(
Line(points = {{-18, 30}, {20, 30}, {20, 0}, {110, 0}}, color = {0, 0, 127}));
Line(points = {{-18, 30}, {20, 30}, {20, 0}, {84, 0}}, color = {0, 0, 127}));
annotation(
Icon(graphics = {Rectangle(fillColor = {50, 50, 50}, fillPattern = FillPattern.Solid, extent = {{-100, 100}, {100, -100}}), Text(origin = {-3, 126}, textColor = {0, 0, 255}, extent = {{-55, 18}, {55, -18}}, textString = "%name")}, coordinateSystem(initialScale = 0.1)),
Documentation(info = "<html><head></head><body><div>Control the speed of a <a href=\"modelica://VirtualFCS.Fluid.PumpElectricDC\">Electric Pump DC</a>&nbsp;or <a href=\"modelica://VirtualFCS.Fluid.RecirculationBlower\">Recirculation Blower</a></div><div><br></div><div><b>Description</b></div><div><br></div>This block uses a simple <a href=\"modelica://Modelica.Blocks.Continuous.LimPID\">PID</a> control to set pump speed as a function of mass flow.&nbsp;<div><br></div><div>The block requires that a sensor be placed to measure the mass flow through the pump in question. The measured value for the mass flow is taken in the getMassFlow interface, while the desired mass flow is set in the setMassFlowInterface. Properties of the&nbsp;<a href=\"modelica://Modelica.Blocks.Continuous.LimPID\">PID</a>&nbsp;control can be adjusted in the limPID block, and the resulting control signal is sent to the setPumpSpeed interface.&nbsp;</div></body></html>"));
Expand Down
6 changes: 3 additions & 3 deletions VirtualFCS/Control/PurgeValveControl.mo
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ within VirtualFCS.Control;
block PurgeValveControl
Modelica.Blocks.Logical.Switch switch annotation(
Placement(visible = true, transformation(origin = {54, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.Trapezoid setPurgeValveState(amplitude = 0.01, falling = 0.05, period = 40, rising = 0.05, width = 0.350) annotation(
Modelica.Blocks.Sources.Trapezoid setPurgeValveState(amplitude = 0.0007, falling = 0.05, period = 40, rising = 0.05, width = 0.350) annotation(
Placement(visible = true, transformation(origin = {-19, 59}, extent = {{-12, -12}, {12, 12}}, rotation = 0)));
Modelica.Blocks.Logical.GreaterThreshold greaterThreshold(threshold = 1) annotation(
Placement(visible = true, transformation(origin = {-18, 0}, extent = {{-12, -12}, {12, 12}}, rotation = 0)));
Expand All @@ -29,7 +29,7 @@ equation
connect(abs1.y, greaterThreshold.u) annotation(
Line(points = {{-46, 0}, {-32, 0}, {-32, 0}, {-32, 0}}, color = {0, 0, 127}));
annotation(
Icon(graphics = {Rectangle(fillColor = {50, 50, 50}, fillPattern = FillPattern.Solid, extent = {{-100, 100}, {100, -100}}), Text(origin = {-3, 126}, lineColor = {0, 0, 255}, extent = {{-55, 18}, {55, -18}}, textString = "%name")}, coordinateSystem(initialScale = 0.1)),
Icon(graphics = {Rectangle(fillColor = {50, 50, 50}, fillPattern = FillPattern.Solid, extent = {{-100, 100}, {100, -100}}), Text(origin = {-3, 126}, textColor = {0, 0, 255}, extent = {{-55, 18}, {55, -18}}, textString = "%name")}, coordinateSystem(initialScale = 0.1)),
Documentation(info = "<html><head></head><body><div>
<p><span style=\"font-family: Arial; white-space: normal;\">Control the state of the</span><span style=\"font-size: 12px;\">&nbsp;</span><a href=\"modelica://Modelica.Fluid.Valves.ValveCompressible\">Purge Valve</a><span style=\"font-family: Arial; white-space: normal;\">&nbsp;in a hydrogen fuel cell system</span></p></div><div><b><font face=\"Arial\">Description</font></b></div><div><br></div><font face=\"Arial\">Fuel cell systems often contain a&nbsp;</font><a href=\"modelica://Modelica.Fluid.Valves.ValveCompressible\">Purge Valve</a><font face=\"Arial\">&nbsp;in the <a href=\"modelica://VirtualFCS.SubSystems.Hydrogen.SubSystemHydrogen\">Hydrogen SubSystem</a> that is designed to purge impurities from the hydrogen line. There are different strategies for controlling this behaviour. Some systems open the&nbsp;</font><a href=\"modelica://Modelica.Fluid.Valves.ValveCompressible\">Purge Valve</a><font face=\"Arial\">&nbsp;at regular intervals during&nbsp;</font><span style=\"font-family: Arial;\">&nbsp;</span><a href=\"modelica://VirtualFCS.Electrochemical.Hydrogen.FuelCellStack\" style=\"font-family: Arial;\">Fuel Cell Stack</a><font face=\"Arial\">&nbsp;operation. Others employ a charge counting algorithm to open the valve for every X Ah that passes through the</font><span style=\"font-family: Arial;\">&nbsp;</span><a href=\"modelica://VirtualFCS.Electrochemical.Hydrogen.FuelCellStack\" style=\"font-family: Arial;\">Fuel Cell Stack</a><font face=\"Arial\">.&nbsp;</font><div><font face=\"Arial\"><br></font></div><div><font face=\"Arial\">In this implementation, the block first determines if the <a href=\"modelica://VirtualFCS.Electrochemical.Hydrogen.FuelCellStack\">Fuel Cell Stack</a> is on (i.e. abs(i_FC &gt; 1)). If it is not on, then the&nbsp;</font><a href=\"modelica://Modelica.Fluid.Valves.ValveCompressible\">Purge Valve</a><font face=\"Arial\">&nbsp;is closed. If it is on, then the&nbsp;</font><a href=\"modelica://Modelica.Fluid.Valves.ValveCompressible\">Purge Valve</a><font face=\"Arial\">&nbsp;is opened at regular intervals defined by the setPurgeValveState block. The control signal is then sent to the valve.&nbsp;</font><div><font face=\"Arial\"><br></font></div><div><b><font face=\"Arial\"><br></font></b></div><div><b><font face=\"Arial\">Further update</font></b></div><div><b><font face=\"Arial\"><br></font></b></div><div><font face=\"Arial\">Future development of this block will include alternative algorithms for determining the purging behaviour.&nbsp;</font></div></div></body></html>"));
end PurgeValveControl;
end PurgeValveControl;
6 changes: 3 additions & 3 deletions VirtualFCS/Control/VoltageLimiter.mo
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
within VirtualFCS.Control;

model VoltageLimiter "Enforce voltage limits on battery cells."
parameter Real upperVoltageLimit(unit = "V") = 3.6 "Upper Voltage Limit";
parameter Real lowerVoltageLimit(unit = "V") = 2.0 "Lower Voltage Limit";
parameter Modelica.Units.SI.Voltage upperVoltageLimit = 3.6 "Upper Voltage Limit";
parameter Modelica.Units.SI.Voltage lowerVoltageLimit = 2.0 "Lower Voltage Limit";
Modelica.Electrical.Analog.Interfaces.PositivePin pin_p_battery annotation(
Placement(visible = true, transformation(origin = {196, 0}, extent = {{10, -10}, {-10, 10}}, rotation = 0), iconTransformation(origin = {110, 190}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
Modelica.Electrical.Analog.Interfaces.NegativePin pin_n_battery annotation(
Expand Down Expand Up @@ -68,4 +68,4 @@ equation
Icon(graphics = {Rectangle(origin = {-100, 100}, fillColor = {50, 50, 50}, fillPattern = FillPattern.Solid, extent = {{-100, 100}, {300, -300}}), Text(origin = {2, 137}, lineColor = {255, 255, 255}, extent = {{-74, 31}, {74, -31}}, textString = "Battery"), Text(origin = {-4, -101}, lineColor = {255, 255, 255}, extent = {{-74, 31}, {74, -31}}, textString = "Load"), Text(origin = {-7, 253}, lineColor = {0, 0, 255}, extent = {{-181, 45}, {181, -45}}, textString = "%name")}, coordinateSystem(extent = {{-200, -200}, {200, 200}}, initialScale = 0.1)),
Diagram(coordinateSystem(extent = {{-200, -200}, {200, 200}})),
Documentation(info = "<html><head></head><body>The voltage limiter block enforces user-defined upper and lower voltage limits for battery cells and packs.&nbsp;</body></html>"));
end VoltageLimiter;
end VoltageLimiter;
2 changes: 1 addition & 1 deletion VirtualFCS/Electrical/DCConverterSwitch.mo
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,4 @@ The DC/DC converter is characterized by:
where underlined voltages and currents represent complex phasors</li>
</ul>
</html>"));
end DCConverterSwitch;
end DCConverterSwitch;
4 changes: 2 additions & 2 deletions VirtualFCS/Electrical/DC_converter.mo
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ model DC_converter "An ideal DC-DC converter"
Placement(visible = true, transformation(extent = {{-70, -10}, {-50, 10}}, rotation = 0)));
Modelica.Blocks.Math.Feedback feedback annotation(
Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {50, 0})));
Modelica.Blocks.Continuous.Integrator powerController(initType = Modelica.Blocks.Types.Init.InitialOutput, k = 1 / Ti, y_start = 0) annotation(
Modelica.Blocks.Continuous.Integrator powerController(initType = Modelica.Blocks.Types.Init.InitialOutput, k = 1/Ti, y_start = 0) annotation(
Placement(transformation(extent = {{30, 10}, {10, 30}})));
Modelica.Electrical.Analog.Interfaces.NegativePin pin_nFC annotation(
Placement(visible = true, transformation(origin = {-80, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-100, 100}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Expand Down Expand Up @@ -61,7 +61,7 @@ equation
connect(signalCurrent_DCbus.n, pin_nBus) annotation(
Line(points = {{-20, -50}, {-80, -50}, {-80, -72}, {-80, -72}}, color = {0, 0, 255}));
annotation(
Icon(coordinateSystem(preserveAspectRatio = false, initialScale = 0.1), graphics = {Rectangle(lineColor = {0, 0, 255}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-100, 100}, {100, -100}}), Line(points = {{100, 100}, {20, 20}}, color = {0, 0, 255}), Line(points = {{-20, -20}, {-100, -100}}, color = {0, 0, 255}), Text(origin = {-2, -142}, lineColor = {128, 128, 128}, extent = {{-40, 80}, {40, 60}}, textString = "DC bus"), Text(lineColor = {0, 0, 255}, extent = {{-100, 20}, {100, -20}}, textString = "%name"), Text(origin = {0, 146}, lineColor = {128, 128, 128}, extent = {{-40, -60}, {40, -80}}, textString = "Fuel cell")}),
Icon(coordinateSystem(preserveAspectRatio = false, initialScale = 0.1), graphics = {Rectangle(lineColor = {0, 0, 255}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-100, 100}, {100, -100}}), Line(points = {{100, 100}, {20, 20}}, color = {0, 0, 255}), Line(points = {{-20, -20}, {-100, -100}}, color = {0, 0, 255}), Text(origin = {-2, -142}, textColor = {128, 128, 128}, extent = {{-40, 80}, {40, 60}}, textString = "DC bus"), Text(textColor = {0, 0, 255}, extent = {{-100, 20}, {100, -20}}, textString = "%name"), Text(origin = {0, 146}, textColor = {128, 128, 128}, extent = {{-40, -60}, {40, -80}}, textString = "Fuel cell")}),
Diagram(coordinateSystem(preserveAspectRatio = false)),
Documentation(info = "<html>
<p>This is a model of an ideal DC-DC inverter based on a power balance achieved by an integral controller.</p>
Expand Down
Loading