-
Notifications
You must be signed in to change notification settings - Fork 88
Expand file tree
/
Copy pathSimpleRC.mo
More file actions
98 lines (98 loc) · 4.45 KB
/
SimpleRC.mo
File metadata and controls
98 lines (98 loc) · 4.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
within ;
model SimpleRC
"A simple thermal R1C1 model with sinusoidal outside air temperature and heating input."
Modelica.Thermal.HeatTransfer.Components.HeatCapacitor cap(C=1e6)
annotation (Placement(transformation(extent={{30,20},{50,40}})));
Modelica.Thermal.HeatTransfer.Components.ThermalResistor res(R=0.01)
annotation (Placement(transformation(extent={{0,10},{20,30}})));
Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor senTZone
annotation (Placement(transformation(extent={{50,10},{70,30}})));
Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature preTOut
annotation (Placement(transformation(extent={{-40,10},{-20,30}})));
Modelica.Blocks.Sources.Sine souTOut(
f=1/(3600*24),
offset=273.15 + 20,
amplitude=10)
annotation (Placement(transformation(extent={{-100,10},{-80,30}})));
Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow preHeat
annotation (Placement(transformation(extent={{20,-30},{40,-10}})));
Modelica.Blocks.Math.Gain eff(k=1/0.99)
annotation (Placement(transformation(extent={{20,-90},{40,-70}})));
Modelica.Blocks.Continuous.LimPID con(
controllerType=Modelica.Blocks.Types.SimpleController.P,
k=2000,
yMin=0,
yMax=100000)
annotation (Placement(transformation(extent={{-40,-30},{-20,-10}})));
Modelica.Blocks.Sources.Step set(
height=2,
offset=273.15 + 20,
startTime=3600*24)
annotation (Placement(transformation(extent={{-100,-30},{-80,-10}})));
IBPSA.Utilities.IO.SignalExchange.Overwrite
oveSet( u(
unit="K",
min=273.15 + 10,
max=273.15 + 35), description="Zone temperature setpoint")
annotation (Placement(transformation(extent={{-70,-30},{-50,-10}})));
IBPSA.Utilities.IO.SignalExchange.Overwrite
oveAct(
u(
unit="W",
min=0,
max=3000), description="Control signal for heater thermal power")
annotation (Placement(transformation(extent={{-10,-30},{10,-10}})));
IBPSA.Utilities.IO.SignalExchange.Read
TZone(
KPIs=IBPSA.Utilities.IO.SignalExchange.SignalTypes.SignalsForKPIs.AirZoneTemperature,
y(unit="K"),
description="Zone temperature")
annotation (Placement(transformation(extent={{100,10},{120,30}})));
IBPSA.Utilities.IO.SignalExchange.Read
PHeat(
KPIs=IBPSA.Utilities.IO.SignalExchange.SignalTypes.SignalsForKPIs.GasPower,
y(unit="W"),
description="Heater electrical power")
annotation (Placement(transformation(extent={{100,-90},{120,-70}})));
equation
connect(res.port_b, cap.port)
annotation (Line(points={{20,20},{40,20}},
color={191,0,0}));
connect(cap.port, senTZone.port)
annotation (Line(points={{40,20},{50,20}},
color={191,0,0}));
connect(preTOut.port, res.port_a)
annotation (Line(points={{-20,20},{0,20}}, color={191,0,0}));
connect(souTOut.y, preTOut.T)
annotation (Line(points={{-79,20},{-42,20}},
color={0,0,127}));
connect(preHeat.port, cap.port)
annotation (Line(points={{40,-20},{40,20}}, color={191,0,0}));
connect(senTZone.T, con.u_m) annotation (Line(points={{71,20},{80,20},{80,-40},
{-30,-40},{-30,-32}}, color={0,0,127}));
connect(set.y, oveSet.u)
annotation (Line(points={{-79,-20},{-72,-20}}, color={0,0,127}));
connect(oveSet.y, con.u_s)
annotation (Line(points={{-49,-20},{-42,-20}}, color={0,0,127}));
connect(con.y, oveAct.u)
annotation (Line(points={{-19,-20},{-12,-20}}, color={0,0,127}));
connect(oveAct.y, preHeat.Q_flow)
annotation (Line(points={{11,-20},{20,-20}}, color={0,0,127}));
connect(oveAct.y, eff.u) annotation (Line(points={{11,-20},{14,-20},{14,-80},
{18,-80}}, color={0,0,127}));
connect(senTZone.T, TZone.u)
annotation (Line(points={{71,20},{98,20}}, color={0,0,127}));
connect(eff.y, PHeat.u) annotation (Line(points={{41,-80},{98,-80}},
color={0,0,127}));
annotation (uses(Modelica(version="4.0.0"), IBPSA(version="4.0.0")),
Documentation(revisions="<html>
<ul>
<li>
October 24, 2025, by Ettore Zanetti:<br/>
Updated model to use Modelica 4.0 and Buildings 12.1.0.
This is for <a href=https://github.com/ibpsa/project1-boptest/issues/422>
BOPTEST issue #422</a>.
</li>
</ul>
</html>"));
end SimpleRC;