9 Commits

21 changed files with 281 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,4 @@
within OTRERA_formation;
package Cases
end Cases;

View File

@@ -0,0 +1,32 @@
within OTRERA_formation.Components;
model Convection
//USER DEFINED PARAMETERS
parameter Modelica.Units.SI.Area S=0.0 "Exchange area between fluid and solid" ;
parameter Modelica.Units.SI.CoefficientOfHeatTransfer h = 0.0 "Convective heat transfer coefficient";
//INTERNAL VARIABLES
Modelica.Units.SI.HeatFlowRate Q_flow ;
Modelica.Units.SI.Temperature T_wall ;
Modelica.Units.SI.Temperature T_fluid ;
//IMPORTED COMPONENTS
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a port_wall annotation(
Placement(transformation(origin = {-96, 2}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {-90, 0}, extent = {{-10, -10}, {10, 10}})));
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_b port_fluid annotation(
Placement(transformation(origin = {96, 0}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {90, 0}, extent = {{-10, -10}, {10, 10}})));
equation
Q_flow = h * S * (T_wall - T_fluid) ;
//Port handover
port_fluid.Q_flow + port_wall.Q_flow = 0.0 ;
port_fluid.Q_flow = -Q_flow ;
T_wall = port_wall.T ;
T_fluid = port_fluid.T ;
end Convection;

View File

@@ -0,0 +1,21 @@
within OTRERA_formation.Components;
model Convection_with_Element1D
extends Modelica.Thermal.HeatTransfer.Interfaces.Element1D ;
//USER DEFINED PARAMETERS
parameter Modelica.Units.SI.Area S=0.0 "Exchange area between fluid and solid" ;
parameter Modelica.Units.SI.CoefficientOfHeatTransfer h = 0.0 "Convective heat transfer coefficient";
//INTERNAL VARIABLES
//IMPORTED COMPONENTS
equation
Q_flow = h * S * dT ;
//Port handover
end Convection_with_Element1D;

View File

@@ -0,0 +1,23 @@
within OTRERA_formation.Components;
model Fan
replaceable package Medium = Modelica.Media.Air.ReferenceAir.Air_pT constrainedby Modelica.Media.Interfaces.PartialMedium annotation(choicesAllMatching = true) ;
//USER DEFINED PARAMETERS
parameter Modelica.Units.SI.MassFlowRate m_flow = 10 ;
//INTERNAL VARIABLES
Medium.ThermodynamicState state ;
Modelica.Units.SI.SpecificHeatCapacity cp ;
Modelica.Units.SI.HeatFlowRate Q_flow ;
//IMPORTED COMPONENTS
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a port_a annotation(
Placement(transformation(origin = {-96, 0}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {-88, 6}, extent = {{-10, -10}, {10, 10}})));
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_b port_b annotation(
Placement(transformation(origin = {96, 0}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {90, 2}, extent = {{-10, -10}, {10, 10}})));
equation
state = Medium.setState_pT(p=Medium.p_default,T=port_a.T);
cp = Medium.specificHeatCapacityCp(state) ;
Q_flow = m_flow * cp * (port_b.T - port_a.T) ;
port_b.Q_flow = Q_flow;
port_a.Q_flow = 0 ;
end Fan;

View File

@@ -0,0 +1,20 @@
within OTRERA_formation.Components;
model Heatflow
//USER DEFINED PARAMETERS
parameter Modelica.Units.SI.HeatFlowRate Q_flow;
//INTERNAL VARIABLES
//IMPORTED COMPONENTS
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_b port annotation(
Placement(transformation(origin = {0, 2}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {4, -2}, extent = {{-10, -10}, {10, 10}})));
equation
Q_flow = -port.Q_flow ;
annotation(
Icon(graphics = {Line(origin = {-53, 0}, points = {{-43, 0}, {43, 0}}, color = {246, 97, 81}, thickness = 3, arrow = {Arrow.None, Arrow.Filled}), Rectangle(origin = {-50, 0}, extent = {{-50, 100}, {50, -100}})}));
end Heatflow;

View File

@@ -0,0 +1,17 @@
within OTRERA_formation.Components;
model Temperature
//USER DEFINED PARAMETERS
parameter Modelica.Units.SI.Temperature T ;
//INTERNAL VARIABLES
//IMPORTED COMPONENTS
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a port annotation(
Placement(transformation(extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {-2, 0}, extent = {{-10, -10}, {10, 10}})));
equation
T = port.T;
annotation(
Diagram(graphics),
Icon(graphics = {Rectangle(origin = {-50, 0}, extent = {{-50, 100}, {50, -100}}), Text(origin = {-45, 21}, extent = {{27, -23}, {-27, 23}}, textString = "T°")}));
end Temperature;

View File

@@ -0,0 +1,39 @@
within OTRERA_formation.Components;
model ThermalCapacity
import Modelica.Fluid.Types.Dynamics ;
//USER DEFINED PARAMETERS
parameter Dynamics energyDynamics = Dynamics.FixedInitial ;
parameter Modelica.Units.SI.Mass m = 10 "Object mass";
parameter Modelica.Units.SI.SpecificHeatCapacity cp(min=0) = 1000 ;
parameter Modelica.Units.SI.Temperature T_start = 283.15 ;
//INTERNAL VARIABLES
Modelica.Units.SI.Temperature T ;
Modelica.Units.SI.HeatFlowRate Q_flow ;
//IMPORTED COMPONENTS
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a port annotation(
Placement(transformation(extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {-2, -4}, extent = {{-10, -10}, {10, 10}})));
initial equation
if energyDynamics == Dynamics.SteadyStateInitial then
der(T) = 0 ;
elseif energyDynamics == Dynamics.FixedInitial then
T = T_start ;
end if ;
equation
if energyDynamics == Dynamics.SteadyState then
Q_flow = 0 ;
else
Q_flow = m * cp * der(T) ;
end if ;
//PORT HANDOVER
Q_flow = port.Q_flow ;
T = port.T ;
annotation(
Icon(graphics = {Ellipse(origin = {-2, 3}, fillColor = {134, 94, 60}, fillPattern = FillPattern.Solid, extent = {{-92, -85}, {92, 85}})}));
end ThermalCapacity;

View File

@@ -0,0 +1,4 @@
within OTRERA_formation;
package Components
end Components;

View File

@@ -0,0 +1,6 @@
ThermalCapacity
Heatflow
Temperature
Convection
Convection_with_Element1D
Fan

View File

@@ -0,0 +1,17 @@
within OTRERA_formation.Models;
model Coupled_model
Components.ThermalCapacity M1(m = 10, cp = 1000, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, T_start = 283.15) annotation(
Placement(transformation(origin = {-32, 30}, extent = {{-10, -10}, {10, 10}})));
OTRERA_formation.Components.ThermalCapacity M2(cp = 1000, m = 10, T_start = 283.15, energyDynamics = Modelica.Fluid.Types.Dynamics.FixedInitial) annotation(
Placement(transformation(origin = {28, 30}, extent = {{-10, -10}, {10, 10}})));
Components.Convection convection(S = 10, h = 1000) annotation(
Placement(transformation(origin = {-2, 30}, extent = {{-10, -10}, {10, 10}})));
equation
connect(M1.port, convection.port_wall) annotation(
Line(points = {{-32.2, 29.6}, {-10.2, 29.6}}, color = {191, 0, 0}));
connect(convection.port_fluid, M2.port) annotation(
Line(points = {{7, 30}, {27, 30}}, color = {191, 0, 0}));
annotation(
Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}), graphics = {Text(origin = {-30, 50}, extent = {{-16, -8}, {16, 8}}, textString = "M1"), Text(origin = {28, 52}, extent = {{-16, -8}, {16, 8}}, textString = "M2")}));
end Coupled_model;

View File

@@ -0,0 +1,16 @@
within OTRERA_formation.Models;
model Coupled_model_prescribed
extends OTRERA_formation.Models.Coupled_model (M1(m = 100));
Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow prescribedHeatFlow annotation(
Placement(transformation(origin = {-62, 30}, extent = {{-10, -10}, {10, 10}})));
Modelica.Blocks.Sources.Constant const(k = 1000) annotation(
Placement(transformation(origin = {-90, 30}, extent = {{-10, -10}, {10, 10}})));
equation
connect(const.y, prescribedHeatFlow.Q_flow) annotation(
Line(points = {{-78, 30}, {-72, 30}}, color = {0, 0, 127}));
connect(prescribedHeatFlow.port, M1.port) annotation(
Line(points = {{-52, 30}, {-32, 30}}, color = {191, 0, 0}));
annotation(
Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}})));
end Coupled_model_prescribed;

View File

@@ -0,0 +1,16 @@
within OTRERA_formation.Models;
model Coupled_model_prescribed_variable
extends Models.Coupled_model;
Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow prescribedHeatFlow annotation(
Placement(transformation(origin = {-62, 30}, extent = {{-10, -10}, {10, 10}})));
Modelica.Blocks.Sources.Ramp ramp annotation(
Placement(transformation(origin = {-94, 28}, extent = {{-10, -10}, {10, 10}})));
equation
connect(ramp.y, prescribedHeatFlow.Q_flow) annotation(
Line(points = {{-82, 28}, {-72, 28}, {-72, 30}}, color = {0, 0, 127}));
connect(prescribedHeatFlow.port, M1.port) annotation(
Line(points = {{-52, 30}, {-32, 30}}, color = {191, 0, 0}));
annotation(
Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}})));
end Coupled_model_prescribed_variable;

View File

@@ -0,0 +1,20 @@
within OTRERA_formation.Models;
model Test_Media
replaceable package Medium = Modelica.Media.Air.MoistAir constrainedby Modelica.Media.Interfaces.PartialMedium annotation(choicesAllMatching = true) ;
//USER DEFINED PARAMETERS
parameter Modelica.Units.SI.Temperature T = 573.15 ;
parameter Modelica.Units.SI.Pressure p = 155e5 ;
//INTERNAL VARIABLES
Medium.ThermodynamicState state ;
Medium.Density d ;
//IMPORTED COMPONENTS
equation
state = Medium.setState_pTX(p=p,T=T);
d = Medium.density(state) ;
end Test_Media;

View File

@@ -0,0 +1,15 @@
within OTRERA_formation.Models;
model Test_fan
Components.Fan fan(m_flow = 10) annotation(
Placement(transformation(origin = {2, 10}, extent = {{-10, -10}, {10, 10}})));
Components.ThermalCapacity thermalCapacity(T_start = 293.15) annotation(
Placement(transformation(origin = {50, 10}, extent = {{-10, -10}, {10, 10}})));
Components.Temperature temperature(T = 303.15) annotation(
Placement(transformation(origin = {-46, 10}, extent = {{-10, -10}, {10, 10}})));
equation
connect(temperature.port, fan.port_a) annotation(
Line(points = {{-46, 10}, {-8, 10}}, color = {191, 0, 0}));
connect(fan.port_b, thermalCapacity.port) annotation(
Line(points = {{12, 10}, {50, 10}}, color = {191, 0, 0}));
end Test_fan;

View File

@@ -0,0 +1,8 @@
within OTRERA_formation.Models;
model Test_replaceable_media
Test_Media test_Media(T = 623.15, p = 1.4e7, redeclare package Medium = Modelica.Media.Water.WaterIF97_R1pT) annotation(
Placement(transformation(origin = {2, 6}, extent = {{-10, -10}, {10, 10}})));
equation
end Test_replaceable_media;

View File

@@ -0,0 +1,4 @@
within OTRERA_formation;
package Models
end Models;

View File

@@ -0,0 +1,7 @@
Coupled_model
Coupled_model_prescribed
Coupled_model_prescribed_variable
Test_Media
Test_replaceable_media
Test_fan
Test_wall

View File

@@ -0,0 +1,9 @@
package OTRERA_formation
annotation(
uses(Modelica(version = "4.1.0"), TAeZoSysPro(version = "4.0-main")));
end OTRERA_formation;

View File

@@ -0,0 +1,3 @@
Components
Models
Cases