| 1 | within ;
 | 
|---|
| 2 | package ThermalExamples
 | 
|---|
| 3 |   extends Modelica.Icons.Package;
 | 
|---|
| 4 |   package Examples
 | 
|---|
| 5 |     extends Modelica.Icons.ExamplesPackage;
 | 
|---|
| 6 |     partial model PartialBoiler
 | 
|---|
| 7 |       Modelica.Electrical.Analog.Basic.Resistor resistor(
 | 
|---|
| 8 |         R=7.5,
 | 
|---|
| 9 |         T_ref=293.15,
 | 
|---|
| 10 |         alpha=0.004,
 | 
|---|
| 11 |         useHeatPort=true)
 | 
|---|
| 12 |         annotation (Placement(transformation(extent={{40,10},{60,30}})));
 | 
|---|
| 13 |       Modelica.Electrical.Analog.Sources.SineVoltage sineVoltage(V=sqrt(2)*230, f=
 | 
|---|
| 14 |             50) annotation (Placement(transformation(extent={{40,30},{60,50}})));
 | 
|---|
| 15 |       Modelica.Electrical.Analog.Basic.Ground ground annotation (Placement(
 | 
|---|
| 16 |             transformation(
 | 
|---|
| 17 |             extent={{-10,-10},{10,10}},
 | 
|---|
| 18 |             rotation=90,
 | 
|---|
| 19 |             origin={80,30})));
 | 
|---|
| 20 |       Modelica.Thermal.HeatTransfer.Components.HeatCapacitor heatCapacitor(C=700, T(
 | 
|---|
| 21 |             fixed=true)) annotation (Placement(transformation(
 | 
|---|
| 22 |             extent={{-10,-10},{10,10}},
 | 
|---|
| 23 |             rotation=90,
 | 
|---|
| 24 |             origin={30,0})));
 | 
|---|
| 25 |       Modelica.Thermal.HeatTransfer.Components.ThermalResistor thermalResistor(R=
 | 
|---|
| 26 |             0.0015) annotation (Placement(transformation(
 | 
|---|
| 27 |             extent={{-10,-10},{10,10}},
 | 
|---|
| 28 |             rotation=270,
 | 
|---|
| 29 |             origin={50,-20})));
 | 
|---|
| 30 |       Modelica.Thermal.FluidHeatFlow.Components.Pipe pipe(
 | 
|---|
| 31 |         medium=Modelica.Thermal.FluidHeatFlow.Media.Water(),
 | 
|---|
| 32 |         m=0.03,
 | 
|---|
| 33 |         T0=293.15,
 | 
|---|
| 34 |         T0fixed=true,
 | 
|---|
| 35 |         V_flowLaminar(displayUnit="l/min") = 3.3333333333333e-05,
 | 
|---|
| 36 |         dpLaminar=1000,
 | 
|---|
| 37 |         V_flowNominal(displayUnit="l/min") = 6.6666666666667e-05,
 | 
|---|
| 38 |         dpNominal=10000,
 | 
|---|
| 39 |         useHeatPort=true,
 | 
|---|
| 40 |         h_g=0) annotation (Placement(transformation(extent={{40,-40},{60,-60}})));
 | 
|---|
| 41 |       Modelica.Thermal.FluidHeatFlow.Sources.Ambient ambient1(
 | 
|---|
| 42 |         medium=Modelica.Thermal.FluidHeatFlow.Media.Water(),
 | 
|---|
| 43 |         constantAmbientPressure=100000,
 | 
|---|
| 44 |         constantAmbientTemperature=293.15)
 | 
|---|
| 45 |         annotation (Placement(transformation(extent={{0,-60},{-20,-40}})));
 | 
|---|
| 46 |       Modelica.Thermal.FluidHeatFlow.Sources.VolumeFlow volumeFlow(
 | 
|---|
| 47 |         medium=Modelica.Thermal.FluidHeatFlow.Media.Water(),
 | 
|---|
| 48 |         m=0.03,
 | 
|---|
| 49 |         T0=293.15,
 | 
|---|
| 50 |         T0fixed=true,
 | 
|---|
| 51 |         constantVolumeFlow(displayUnit="l/min") = 6.3333333333333e-05)
 | 
|---|
| 52 |         annotation (Placement(transformation(extent={{10,-60},{30,-40}})));
 | 
|---|
| 53 |       Modelica.Thermal.FluidHeatFlow.Sensors.TemperatureSensor temperatureSensor(
 | 
|---|
| 54 |           medium=Modelica.Thermal.FluidHeatFlow.Media.Water()) annotation (
 | 
|---|
| 55 |           Placement(transformation(
 | 
|---|
| 56 |             extent={{-10,-10},{10,10}},
 | 
|---|
| 57 |             rotation=270,
 | 
|---|
| 58 |             origin={70,-60})));
 | 
|---|
| 59 |       Modelica.Thermal.FluidHeatFlow.Sources.Ambient ambient2(
 | 
|---|
| 60 |         medium=Modelica.Thermal.FluidHeatFlow.Media.Water(),
 | 
|---|
| 61 |         constantAmbientPressure=100000,
 | 
|---|
| 62 |         constantAmbientTemperature=293.15)
 | 
|---|
| 63 |         annotation (Placement(transformation(extent={{80,-60},{100,-40}})));
 | 
|---|
| 64 |     equation
 | 
|---|
| 65 |       connect(sineVoltage.n, ground.p)
 | 
|---|
| 66 |         annotation (Line(points={{60,40},{70,40},{70,30}}, color={0,0,255}));
 | 
|---|
| 67 |       connect(ground.p, resistor.n)
 | 
|---|
| 68 |         annotation (Line(points={{70,30},{70,20},{60,20}}, color={0,0,255}));
 | 
|---|
| 69 |       connect(resistor.heatPort, thermalResistor.port_a)
 | 
|---|
| 70 |         annotation (Line(points={{50,10},{50,-10}},color={191,0,0}));
 | 
|---|
| 71 |       connect(thermalResistor.port_b, pipe.heatPort)
 | 
|---|
| 72 |         annotation (Line(points={{50,-30},{50,-40}}, color={191,0,0}));
 | 
|---|
| 73 |       connect(pipe.flowPort_a, volumeFlow.flowPort_b)
 | 
|---|
| 74 |         annotation (Line(points={{40,-50},{30,-50}}, color={255,0,0}));
 | 
|---|
| 75 |       connect(ambient1.flowPort, volumeFlow.flowPort_a)
 | 
|---|
| 76 |         annotation (Line(points={{0,-50},{10,-50}},    color={255,0,0}));
 | 
|---|
| 77 |       connect(pipe.flowPort_b, ambient2.flowPort)
 | 
|---|
| 78 |         annotation (Line(points={{60,-50},{80,-50}}, color={255,0,0}));
 | 
|---|
| 79 |       connect(pipe.flowPort_b, temperatureSensor.flowPort)
 | 
|---|
| 80 |         annotation (Line(points={{60,-50},{70,-50}},          color={255,0,0}));
 | 
|---|
| 81 |       connect(resistor.heatPort, heatCapacitor.port)
 | 
|---|
| 82 |         annotation (Line(points={{50,10},{50,0},{40,0}},   color={191,0,0}));
 | 
|---|
| 83 |     end PartialBoiler;
 | 
|---|
| 84 | 
 | 
|---|
| 85 |     model BoilerMaxT
 | 
|---|
| 86 |       extends Modelica.Icons.Example;
 | 
|---|
| 87 |       extends PartialBoiler;
 | 
|---|
| 88 |     equation
 | 
|---|
| 89 |       connect(sineVoltage.p, resistor.p) annotation (Line(points={{40,40},{30,
 | 
|---|
| 90 |               40},{30,20},{40,20}}, color={0,0,255}));
 | 
|---|
| 91 |       annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
 | 
|---|
| 92 |             coordinateSystem(preserveAspectRatio=false)),
 | 
|---|
| 93 |         experiment(
 | 
|---|
| 94 |           StopTime=30,
 | 
|---|
| 95 |           Interval=0.0005,
 | 
|---|
| 96 |           Tolerance=1e-06,
 | 
|---|
| 97 |           __Dymola_Algorithm="Dassl"));
 | 
|---|
| 98 |     end BoilerMaxT;
 | 
|---|
| 99 | 
 | 
|---|
| 100 |     model BoilerOnOff
 | 
|---|
| 101 |       extends Modelica.Icons.Example;
 | 
|---|
| 102 |       extends PartialBoiler;
 | 
|---|
| 103 |       Modelica.Electrical.Analog.Ideal.IdealClosingSwitch switch annotation (
 | 
|---|
| 104 |           Placement(transformation(
 | 
|---|
| 105 |             extent={{10,-10},{-10,10}},
 | 
|---|
| 106 |             rotation=90,
 | 
|---|
| 107 |             origin={30,30})));
 | 
|---|
| 108 |       Modelica.Blocks.Logical.OnOffController onOffController(bandwidth=2,
 | 
|---|
| 109 |           pre_y_start=false)
 | 
|---|
| 110 |         annotation (Placement(transformation(extent={{-20,20},{0,40}})));
 | 
|---|
| 111 |       Modelica.Blocks.Sources.Ramp ramp(
 | 
|---|
| 112 |         height=15,
 | 
|---|
| 113 |         duration=15,
 | 
|---|
| 114 |         offset=20,
 | 
|---|
| 115 |         startTime=5)
 | 
|---|
| 116 |         annotation (Placement(transformation(extent={{-70,30},{-50,50}})));
 | 
|---|
| 117 |       Blocks.K2deg k2deg annotation (Placement(transformation(
 | 
|---|
| 118 |             extent={{-10,-10},{10,10}},
 | 
|---|
| 119 |             rotation=90,
 | 
|---|
| 120 |             origin={-40,-50})));
 | 
|---|
| 121 |     equation
 | 
|---|
| 122 |       connect(onOffController.y, switch.control)
 | 
|---|
| 123 |         annotation (Line(points={{1,30},{18,30}},   color={255,0,255}));
 | 
|---|
| 124 |       connect(ramp.y, onOffController.reference) annotation (Line(points={{-49,40},{
 | 
|---|
| 125 |               -40,40},{-40,36},{-22,36}},  color={0,0,127}));
 | 
|---|
| 126 |       connect(k2deg.y, onOffController.u) annotation (Line(points={{-40,-39},{
 | 
|---|
| 127 |               -40,24},{-22,24}}, color={0,0,127}));
 | 
|---|
| 128 |       connect(switch.p, sineVoltage.p)
 | 
|---|
| 129 |         annotation (Line(points={{30,40},{40,40}}, color={0,0,255}));
 | 
|---|
| 130 |       connect(switch.n, resistor.p)
 | 
|---|
| 131 |         annotation (Line(points={{30,20},{40,20}}, color={0,0,255}));
 | 
|---|
| 132 |       connect(temperatureSensor.y, k2deg.u) annotation (Line(points={{70,-71},{
 | 
|---|
| 133 |               70,-76},{-40,-76},{-40,-62}}, color={0,0,127}));
 | 
|---|
| 134 |       annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
 | 
|---|
| 135 |             coordinateSystem(preserveAspectRatio=false)),
 | 
|---|
| 136 |         experiment(
 | 
|---|
| 137 |           StopTime=30,
 | 
|---|
| 138 |           Interval=0.0005,
 | 
|---|
| 139 |           Tolerance=1e-06,
 | 
|---|
| 140 |           __Dymola_Algorithm="Dassl"));
 | 
|---|
| 141 |     end BoilerOnOff;
 | 
|---|
| 142 | 
 | 
|---|
| 143 |     model BoilerTriac
 | 
|---|
| 144 |       extends Modelica.Icons.Example;
 | 
|---|
| 145 |       extends PartialBoiler;
 | 
|---|
| 146 |       Modelica.Blocks.Sources.Ramp ramp(
 | 
|---|
| 147 |         height=15,
 | 
|---|
| 148 |         duration=15,
 | 
|---|
| 149 |         offset=20,
 | 
|---|
| 150 |         startTime=5)
 | 
|---|
| 151 |         annotation (Placement(transformation(extent={{-100,20},{-80,40}})));
 | 
|---|
| 152 |       Blocks.K2deg k2deg annotation (Placement(transformation(
 | 
|---|
| 153 |             extent={{-10,-10},{10,10}},
 | 
|---|
| 154 |             rotation=90,
 | 
|---|
| 155 |             origin={-60,-50})));
 | 
|---|
| 156 |       Modelica.Electrical.PowerConverters.ACAC.SinglePhaseTriac triac
 | 
|---|
| 157 |         annotation (Placement(transformation(
 | 
|---|
| 158 |             extent={{-10,-10},{10,10}},
 | 
|---|
| 159 |             rotation=270,
 | 
|---|
| 160 |             origin={30,30})));
 | 
|---|
| 161 |       Modelica.Electrical.PowerConverters.ACDC.Control.Signal2mPulse adaptor(m=
 | 
|---|
| 162 |             1, useConstantFiringAngle=false) annotation (Placement(
 | 
|---|
| 163 |             transformation(
 | 
|---|
| 164 |             extent={{-10,-10},{10,10}},
 | 
|---|
| 165 |             rotation=270,
 | 
|---|
| 166 |             origin={0,30})));
 | 
|---|
| 167 |       Modelica.Electrical.Analog.Sensors.VoltageSensor voltageSensor
 | 
|---|
| 168 |         annotation (Placement(transformation(extent={{40,70},{60,50}})));
 | 
|---|
| 169 |       Modelica.Electrical.PowerConverters.ACAC.Control.VoltageToAngle
 | 
|---|
| 170 |         voltageToAngle(VNominal=230, voltage2Angle=Modelica.Electrical.PowerConverters.Types.Voltage2AngleType.RMS)
 | 
|---|
| 171 |         annotation (Placement(transformation(extent={{-40,20},{-20,40}})));
 | 
|---|
| 172 |       Modelica.Blocks.Continuous.LimPID PID(
 | 
|---|
| 173 |         controllerType=Modelica.Blocks.Types.SimpleController.PI,
 | 
|---|
| 174 |         k=100,
 | 
|---|
| 175 |         Ti=4,
 | 
|---|
| 176 |         yMax=230,
 | 
|---|
| 177 |         yMin=0)
 | 
|---|
| 178 |         annotation (Placement(transformation(extent={{-70,20},{-50,40}})));
 | 
|---|
| 179 |     equation
 | 
|---|
| 180 |       connect(adaptor.fire_p[1], triac.fire1)
 | 
|---|
| 181 |         annotation (Line(points={{11,36},{18,36}}, color={255,0,255}));
 | 
|---|
| 182 |       connect(adaptor.fire_n[1], triac.fire2)
 | 
|---|
| 183 |         annotation (Line(points={{11,24},{18,24}}, color={255,0,255}));
 | 
|---|
| 184 |       connect(voltageSensor.v, adaptor.v[1]) annotation (Line(points={{50,71},{
 | 
|---|
| 185 |               50,80},{0,80},{0,42}}, color={0,0,127}));
 | 
|---|
| 186 |       connect(voltageToAngle.firingAngle, adaptor.firingAngle)
 | 
|---|
| 187 |         annotation (Line(points={{-19,30},{-12,30}}, color={0,0,127}));
 | 
|---|
| 188 |       connect(k2deg.y, PID.u_m)
 | 
|---|
| 189 |         annotation (Line(points={{-60,-39},{-60,18}},color={0,0,127}));
 | 
|---|
| 190 |       connect(ramp.y, PID.u_s)
 | 
|---|
| 191 |         annotation (Line(points={{-79,30},{-72,30}}, color={0,0,127}));
 | 
|---|
| 192 |       connect(PID.y, voltageToAngle.vRef)
 | 
|---|
| 193 |         annotation (Line(points={{-49,30},{-42,30}}, color={0,0,127}));
 | 
|---|
| 194 |       connect(triac.p, sineVoltage.p)
 | 
|---|
| 195 |         annotation (Line(points={{30,40},{40,40}}, color={0,0,255}));
 | 
|---|
| 196 |       connect(triac.n, resistor.p)
 | 
|---|
| 197 |         annotation (Line(points={{30,20},{40,20}}, color={0,0,255}));
 | 
|---|
| 198 |       connect(sineVoltage.p, voltageSensor.p)
 | 
|---|
| 199 |         annotation (Line(points={{40,40},{40,60}}, color={0,0,255}));
 | 
|---|
| 200 |       connect(sineVoltage.n, voltageSensor.n)
 | 
|---|
| 201 |         annotation (Line(points={{60,40},{60,60}}, color={0,0,255}));
 | 
|---|
| 202 |       connect(temperatureSensor.y, k2deg.u) annotation (Line(points={{70,-71},{
 | 
|---|
| 203 |               70,-76},{-60,-76},{-60,-62}}, color={0,0,127}));
 | 
|---|
| 204 |       annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
 | 
|---|
| 205 |             coordinateSystem(preserveAspectRatio=false)),
 | 
|---|
| 206 |         experiment(
 | 
|---|
| 207 |           StopTime=30,
 | 
|---|
| 208 |           Interval=0.0005,
 | 
|---|
| 209 |           Tolerance=1e-06,
 | 
|---|
| 210 |           __Dymola_Algorithm="Dassl"));
 | 
|---|
| 211 |     end BoilerTriac;
 | 
|---|
| 212 | 
 | 
|---|
| 213 |     model FMUBoilerTriac
 | 
|---|
| 214 |       extends PartialBoiler;
 | 
|---|
| 215 |       Blocks.K2deg k2deg annotation (Placement(transformation(
 | 
|---|
| 216 |             extent={{-10,-10},{10,10}},
 | 
|---|
| 217 |             rotation=90,
 | 
|---|
| 218 |             origin={-60,-50})));
 | 
|---|
| 219 |       Modelica.Electrical.PowerConverters.ACAC.SinglePhaseTriac triac
 | 
|---|
| 220 |         annotation (Placement(transformation(
 | 
|---|
| 221 |             extent={{-10,-10},{10,10}},
 | 
|---|
| 222 |             rotation=270,
 | 
|---|
| 223 |             origin={30,30})));
 | 
|---|
| 224 |       Modelica.Electrical.PowerConverters.ACDC.Control.Signal2mPulse adaptor(m=
 | 
|---|
| 225 |             1, useConstantFiringAngle=false) annotation (Placement(
 | 
|---|
| 226 |             transformation(
 | 
|---|
| 227 |             extent={{-10,-10},{10,10}},
 | 
|---|
| 228 |             rotation=270,
 | 
|---|
| 229 |             origin={0,30})));
 | 
|---|
| 230 |       Modelica.Electrical.Analog.Sensors.VoltageSensor voltageSensor
 | 
|---|
| 231 |         annotation (Placement(transformation(extent={{40,70},{60,50}})));
 | 
|---|
| 232 |       Modelica.Electrical.PowerConverters.ACAC.Control.VoltageToAngle
 | 
|---|
| 233 |         voltageToAngle(VNominal=230, voltage2Angle=Modelica.Electrical.PowerConverters.Types.Voltage2AngleType.RMS)
 | 
|---|
| 234 |         annotation (Placement(transformation(extent={{-40,20},{-20,40}})));
 | 
|---|
| 235 |       Modelica.Blocks.Interfaces.RealOutput Tout
 | 
|---|
| 236 |         "Connector of Real output signal" annotation (Placement(transformation(
 | 
|---|
| 237 |             extent={{-10,-10},{10,10}},
 | 
|---|
| 238 |             rotation=180,
 | 
|---|
| 239 |             origin={-80,-20}), iconTransformation(
 | 
|---|
| 240 |             extent={{-10,-10},{10,10}},
 | 
|---|
| 241 |             rotation=0,
 | 
|---|
| 242 |             origin={110,0})));
 | 
|---|
| 243 |       Modelica.Blocks.Interfaces.RealInput vRef "Reference voltage" annotation (
 | 
|---|
| 244 |          Placement(transformation(extent={{-10,-10},{10,10}},
 | 
|---|
| 245 |             rotation=0,
 | 
|---|
| 246 |             origin={-80,30}),
 | 
|---|
| 247 |             iconTransformation(extent={{-140,-20},{-100,20}})));
 | 
|---|
| 248 |     equation
 | 
|---|
| 249 |       connect(adaptor.fire_p[1], triac.fire1)
 | 
|---|
| 250 |         annotation (Line(points={{11,36},{18,36}}, color={255,0,255}));
 | 
|---|
| 251 |       connect(adaptor.fire_n[1], triac.fire2)
 | 
|---|
| 252 |         annotation (Line(points={{11,24},{18,24}}, color={255,0,255}));
 | 
|---|
| 253 |       connect(voltageSensor.v, adaptor.v[1]) annotation (Line(points={{50,71},{
 | 
|---|
| 254 |               50,80},{0,80},{0,42}}, color={0,0,127}));
 | 
|---|
| 255 |       connect(voltageToAngle.firingAngle, adaptor.firingAngle)
 | 
|---|
| 256 |         annotation (Line(points={{-19,30},{-12,30}}, color={0,0,127}));
 | 
|---|
| 257 |       connect(triac.p, sineVoltage.p)
 | 
|---|
| 258 |         annotation (Line(points={{30,40},{40,40}}, color={0,0,255}));
 | 
|---|
| 259 |       connect(triac.n, resistor.p)
 | 
|---|
| 260 |         annotation (Line(points={{30,20},{40,20}}, color={0,0,255}));
 | 
|---|
| 261 |       connect(sineVoltage.p, voltageSensor.p)
 | 
|---|
| 262 |         annotation (Line(points={{40,40},{40,60}}, color={0,0,255}));
 | 
|---|
| 263 |       connect(sineVoltage.n, voltageSensor.n)
 | 
|---|
| 264 |         annotation (Line(points={{60,40},{60,60}}, color={0,0,255}));
 | 
|---|
| 265 |       connect(temperatureSensor.y, k2deg.u) annotation (Line(points={{70,-71},{
 | 
|---|
| 266 |               70,-76},{-60,-76},{-60,-62}}, color={0,0,127}));
 | 
|---|
| 267 |       connect(k2deg.y, Tout)
 | 
|---|
| 268 |         annotation (Line(points={{-60,-39},{-60,-20},{-80,-20}},
 | 
|---|
| 269 |                                                        color={0,0,127}));
 | 
|---|
| 270 |       connect(voltageToAngle.vRef, vRef)
 | 
|---|
| 271 |         annotation (Line(points={{-42,30},{-80,30}}, color={0,0,127}));
 | 
|---|
| 272 |       annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
 | 
|---|
| 273 |             coordinateSystem(preserveAspectRatio=false)),
 | 
|---|
| 274 |         experiment(
 | 
|---|
| 275 |           StopTime=30,
 | 
|---|
| 276 |           Interval=0.0005,
 | 
|---|
| 277 |           Tolerance=1e-06,
 | 
|---|
| 278 |           __Dymola_Algorithm="Dassl"));
 | 
|---|
| 279 |     end FMUBoilerTriac;
 | 
|---|
| 280 | 
 | 
|---|
| 281 |     model BoilerSampled
 | 
|---|
| 282 |       extends Modelica.Icons.Example;
 | 
|---|
| 283 | 
 | 
|---|
| 284 |       Modelica.Blocks.Sources.Ramp ramp(
 | 
|---|
| 285 |         height=15,
 | 
|---|
| 286 |         duration=15,
 | 
|---|
| 287 |         offset=20,
 | 
|---|
| 288 |         startTime=5)
 | 
|---|
| 289 |         annotation (Placement(transformation(extent={{-90,-10},{-70,10}})));
 | 
|---|
| 290 |       Modelica.Blocks.Continuous.LimPID PID(
 | 
|---|
| 291 |         controllerType=Modelica.Blocks.Types.SimpleController.PI,
 | 
|---|
| 292 |         k=100,
 | 
|---|
| 293 |         Ti=4,
 | 
|---|
| 294 |         yMax=230,
 | 
|---|
| 295 |         yMin=0)
 | 
|---|
| 296 |         annotation (Placement(transformation(extent={{-10,-10},{10,10}})));
 | 
|---|
| 297 |       FMUBoilerTriac fMUBoilerTriac
 | 
|---|
| 298 |         annotation (Placement(transformation(extent={{60,-10},{80,10}})));
 | 
|---|
| 299 |       Modelica.Blocks.Discrete.TriggeredSampler triggeredSampler1(y_start=20)
 | 
|---|
| 300 |         annotation (Placement(transformation(extent={{-60,-10},{-40,10}})));
 | 
|---|
| 301 |       Modelica.Blocks.Discrete.TriggeredSampler triggeredSampler2(y_start=0)
 | 
|---|
| 302 |         annotation (Placement(transformation(extent={{20,-10},{40,10}})));
 | 
|---|
| 303 |       Modelica.Blocks.Discrete.TriggeredSampler triggeredSampler3(y_start=20)
 | 
|---|
| 304 |         annotation (Placement(transformation(extent={{60,-30},{40,-10}})));
 | 
|---|
| 305 |       Modelica.Blocks.Sources.SampleTrigger sampleTrigger(period=0.02)
 | 
|---|
| 306 |         annotation (Placement(transformation(extent={{-90,-50},{-70,-30}})));
 | 
|---|
| 307 |     equation
 | 
|---|
| 308 |       connect(ramp.y, triggeredSampler1.u)
 | 
|---|
| 309 |         annotation (Line(points={{-69,0},{-62,0}}, color={0,0,127}));
 | 
|---|
| 310 |       connect(triggeredSampler1.y, PID.u_s)
 | 
|---|
| 311 |         annotation (Line(points={{-39,0},{-12,0}}, color={0,0,127}));
 | 
|---|
| 312 |       connect(PID.y, triggeredSampler2.u)
 | 
|---|
| 313 |         annotation (Line(points={{11,0},{18,0}},
 | 
|---|
| 314 |                                                color={0,0,127}));
 | 
|---|
| 315 |       connect(triggeredSampler2.y, fMUBoilerTriac.vRef)
 | 
|---|
| 316 |         annotation (Line(points={{41,0},{58,0}}, color={0,0,127}));
 | 
|---|
| 317 |       connect(fMUBoilerTriac.Tout, triggeredSampler3.u) annotation (Line(points={{81,0},{
 | 
|---|
| 318 |               90,0},{90,-20},{62,-20}},         color={0,0,127}));
 | 
|---|
| 319 |       connect(triggeredSampler3.y, PID.u_m) annotation (Line(points={{39,-20},{
 | 
|---|
| 320 |               0,-20},{0,-12}},     color={0,0,127}));
 | 
|---|
| 321 |       connect(sampleTrigger.y, triggeredSampler1.trigger) annotation (Line(
 | 
|---|
| 322 |             points={{-69,-40},{-50,-40},{-50,-11.8}}, color={255,0,255}));
 | 
|---|
| 323 |       connect(sampleTrigger.y, triggeredSampler2.trigger) annotation (Line(
 | 
|---|
| 324 |             points={{-69,-40},{30,-40},{30,-11.8}}, color={255,0,255}));
 | 
|---|
| 325 |       connect(sampleTrigger.y, triggeredSampler3.trigger) annotation (Line(
 | 
|---|
| 326 |             points={{-69,-40},{50,-40},{50,-31.8}}, color={255,0,255}));
 | 
|---|
| 327 |       annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
 | 
|---|
| 328 |             coordinateSystem(preserveAspectRatio=false)),
 | 
|---|
| 329 |         experiment(
 | 
|---|
| 330 |           StopTime=30,
 | 
|---|
| 331 |           Interval=0.0005,
 | 
|---|
| 332 |           Tolerance=1e-06,
 | 
|---|
| 333 |           __Dymola_Algorithm="Dassl"));
 | 
|---|
| 334 |     end BoilerSampled;
 | 
|---|
| 335 | 
 | 
|---|
| 336 |     model BoilerClocked
 | 
|---|
| 337 |       extends Modelica.Icons.Example;
 | 
|---|
| 338 | 
 | 
|---|
| 339 |       Modelica.Blocks.Sources.Ramp ramp(
 | 
|---|
| 340 |         height=15,
 | 
|---|
| 341 |         duration=15,
 | 
|---|
| 342 |         offset=20,
 | 
|---|
| 343 |         startTime=5)
 | 
|---|
| 344 |         annotation (Placement(transformation(extent={{-90,-10},{-70,10}})));
 | 
|---|
| 345 |       Modelica.Blocks.Continuous.LimPID PID(
 | 
|---|
| 346 |         controllerType=Modelica.Blocks.Types.SimpleController.PI,
 | 
|---|
| 347 |         k=100,
 | 
|---|
| 348 |         Ti=4,
 | 
|---|
| 349 |         yMax=230,
 | 
|---|
| 350 |         yMin=0)
 | 
|---|
| 351 |         annotation (Placement(transformation(extent={{-10,-10},{10,10}})));
 | 
|---|
| 352 |       FMUBoilerTriac fMUBoilerTriac
 | 
|---|
| 353 |         annotation (Placement(transformation(extent={{60,-10},{80,10}})));
 | 
|---|
| 354 |       Modelica.Clocked.RealSignals.Sampler.SampleClocked
 | 
|---|
| 355 |                                                 sample1
 | 
|---|
| 356 |         annotation (Placement(transformation(extent={{-56,-6},{-44,6}})));
 | 
|---|
| 357 |       Modelica.Clocked.RealSignals.Sampler.Hold hold2
 | 
|---|
| 358 |         annotation (Placement(transformation(extent={{24,-6},{36,6}})));
 | 
|---|
| 359 |       Modelica.Clocked.RealSignals.Sampler.Sample sample3
 | 
|---|
| 360 |         annotation (Placement(transformation(extent={{56,-26},{44,-14}})));
 | 
|---|
| 361 |       Modelica.Clocked.ClockSignals.Clocks.PeriodicRealClock periodicClock1(period=0.02,
 | 
|---|
| 362 |         useSolver=true,
 | 
|---|
| 363 |         solverMethod="ImplicitEuler")
 | 
|---|
| 364 |         annotation (Placement(transformation(extent={{-86,-36},{-74,-24}})));
 | 
|---|
| 365 |     equation
 | 
|---|
| 366 |       connect(ramp.y, sample1.u)
 | 
|---|
| 367 |         annotation (Line(points={{-69,0},{-57.2,0}}, color={0,0,127}));
 | 
|---|
| 368 |       connect(sample1.y, PID.u_s)
 | 
|---|
| 369 |         annotation (Line(points={{-43.4,0},{-12,0}}, color={0,0,127}));
 | 
|---|
| 370 |       connect(PID.y, hold2.u)
 | 
|---|
| 371 |         annotation (Line(points={{11,0},{22.8,0}},color={0,0,127}));
 | 
|---|
| 372 |       connect(hold2.y, fMUBoilerTriac.vRef)
 | 
|---|
| 373 |         annotation (Line(points={{36.6,0},{58,0}}, color={0,0,127}));
 | 
|---|
| 374 |       connect(fMUBoilerTriac.Tout, sample3.u) annotation (Line(points={{81,0},{
 | 
|---|
| 375 |               90,0},{90,-20},{57.2,-20}}, color={0,0,127}));
 | 
|---|
| 376 |       connect(sample3.y, PID.u_m) annotation (Line(points={{43.4,-20},{0,-20},{
 | 
|---|
| 377 |               0,-12}},    color={0,0,127}));
 | 
|---|
| 378 |       connect(periodicClock1.y, sample1.clock) annotation (Line(
 | 
|---|
| 379 |           points={{-73.4,-30},{-50,-30},{-50,-7.2}},
 | 
|---|
| 380 |           color={175,175,175},
 | 
|---|
| 381 |           pattern=LinePattern.Dot,
 | 
|---|
| 382 |           thickness=0.5));
 | 
|---|
| 383 |       annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
 | 
|---|
| 384 |             coordinateSystem(preserveAspectRatio=false)),
 | 
|---|
| 385 |         experiment(
 | 
|---|
| 386 |           StopTime=30,
 | 
|---|
| 387 |           Interval=0.0005,
 | 
|---|
| 388 |           Tolerance=1e-06,
 | 
|---|
| 389 |           __Dymola_Algorithm="Dassl"));
 | 
|---|
| 390 |     end BoilerClocked;
 | 
|---|
| 391 | 
 | 
|---|
| 392 |     model BoilerDiscrete
 | 
|---|
| 393 |       extends Modelica.Icons.Example;
 | 
|---|
| 394 | 
 | 
|---|
| 395 |       Modelica.Blocks.Sources.Ramp ramp(
 | 
|---|
| 396 |         height=15,
 | 
|---|
| 397 |         duration=15,
 | 
|---|
| 398 |         offset=20,
 | 
|---|
| 399 |         startTime=5)
 | 
|---|
| 400 |         annotation (Placement(transformation(extent={{-90,-10},{-70,10}})));
 | 
|---|
| 401 |       Modelica.Clocked.RealSignals.NonPeriodic.PI
 | 
|---|
| 402 |                                         PI1(
 | 
|---|
| 403 |         k=100,
 | 
|---|
| 404 |         T=4,
 | 
|---|
| 405 |         x(fixed=true, start=0))
 | 
|---|
| 406 |         annotation (Placement(transformation(extent={{-10,-10},{10,10}})));
 | 
|---|
| 407 |       FMUBoilerTriac fMUBoilerTriac
 | 
|---|
| 408 |         annotation (Placement(transformation(extent={{60,-10},{80,10}})));
 | 
|---|
| 409 |       Modelica.Clocked.RealSignals.Sampler.SampleClocked
 | 
|---|
| 410 |                                                 sample1
 | 
|---|
| 411 |         annotation (Placement(transformation(extent={{-56,-6},{-44,6}})));
 | 
|---|
| 412 |       Modelica.Clocked.RealSignals.Sampler.Hold hold2
 | 
|---|
| 413 |         annotation (Placement(transformation(extent={{24,-6},{36,6}})));
 | 
|---|
| 414 |       Modelica.Clocked.RealSignals.Sampler.Sample sample3
 | 
|---|
| 415 |         annotation (Placement(transformation(extent={{56,-26},{44,-14}})));
 | 
|---|
| 416 |       Modelica.Clocked.ClockSignals.Clocks.PeriodicRealClock periodicClock1(period=0.02,
 | 
|---|
| 417 |         useSolver=false,
 | 
|---|
| 418 |         solverMethod="ImplicitEuler")
 | 
|---|
| 419 |         annotation (Placement(transformation(extent={{-86,-36},{-74,-24}})));
 | 
|---|
| 420 |       Modelica.Blocks.Math.Feedback feedback
 | 
|---|
| 421 |         annotation (Placement(transformation(extent={{-40,-10},{-20,10}})));
 | 
|---|
| 422 |     equation
 | 
|---|
| 423 |       connect(ramp.y, sample1.u)
 | 
|---|
| 424 |         annotation (Line(points={{-69,0},{-57.2,0}}, color={0,0,127}));
 | 
|---|
| 425 |       connect(PI1.y, hold2.u)
 | 
|---|
| 426 |         annotation (Line(points={{11,0},{22.8,0}},color={0,0,127}));
 | 
|---|
| 427 |       connect(hold2.y, fMUBoilerTriac.vRef)
 | 
|---|
| 428 |         annotation (Line(points={{36.6,0},{58,0}}, color={0,0,127}));
 | 
|---|
| 429 |       connect(fMUBoilerTriac.Tout, sample3.u) annotation (Line(points={{81,0},{
 | 
|---|
| 430 |               90,0},{90,-20},{57.2,-20}}, color={0,0,127}));
 | 
|---|
| 431 |       connect(periodicClock1.y, sample1.clock) annotation (Line(
 | 
|---|
| 432 |           points={{-73.4,-30},{-50,-30},{-50,-7.2}},
 | 
|---|
| 433 |           color={175,175,175},
 | 
|---|
| 434 |           pattern=LinePattern.Dot,
 | 
|---|
| 435 |           thickness=0.5));
 | 
|---|
| 436 |       connect(sample1.y, feedback.u1)
 | 
|---|
| 437 |         annotation (Line(points={{-43.4,0},{-38,0}}, color={0,0,127}));
 | 
|---|
| 438 |       connect(feedback.y, PI1.u)
 | 
|---|
| 439 |         annotation (Line(points={{-21,0},{-12,0}}, color={0,0,127}));
 | 
|---|
| 440 |       connect(sample3.y, feedback.u2) annotation (Line(points={{43.4,-20},{-30,
 | 
|---|
| 441 |               -20},{-30,-8}}, color={0,0,127}));
 | 
|---|
| 442 |       annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
 | 
|---|
| 443 |             coordinateSystem(preserveAspectRatio=false)),
 | 
|---|
| 444 |         experiment(
 | 
|---|
| 445 |           StopTime=30,
 | 
|---|
| 446 |           Interval=0.0005,
 | 
|---|
| 447 |           Tolerance=1e-06,
 | 
|---|
| 448 |           __Dymola_Algorithm="Dassl"));
 | 
|---|
| 449 |     end BoilerDiscrete;
 | 
|---|
| 450 |   end Examples;
 | 
|---|
| 451 | 
 | 
|---|
| 452 |   package Blocks
 | 
|---|
| 453 |     extends Modelica.Icons.Package;
 | 
|---|
| 454 |     block K2deg
 | 
|---|
| 455 |       extends Modelica.Blocks.Interfaces.SISO;
 | 
|---|
| 456 |       import Modelica.Units.Conversions.to_degC;
 | 
|---|
| 457 |     equation
 | 
|---|
| 458 |       y=to_degC(u);
 | 
|---|
| 459 |     end K2deg;
 | 
|---|
| 460 |   end Blocks;
 | 
|---|
| 461 |   annotation (uses(Modelica(version="4.0.0")));
 | 
|---|
| 462 | end ThermalExamples;
 | 
|---|