Formation Otrera #2

Open
matthieu wants to merge 9 commits from mdescombes/formation_init into main
4 changed files with 28 additions and 9 deletions
Showing only changes of commit 2b11da7dc7 - Show all commits

View File

@@ -3,19 +3,21 @@ within OTRERA_formation.Components;
model Fan model Fan
replaceable package Medium = Modelica.Media.Air.ReferenceAir.Air_pT constrainedby Modelica.Media.Interfaces.PartialMedium annotation(choicesAllMatching = true) ; replaceable package Medium = Modelica.Media.Air.ReferenceAir.Air_pT constrainedby Modelica.Media.Interfaces.PartialMedium annotation(choicesAllMatching = true) ;
extends Modelica.Thermal.HeatTransfer.Interfaces.Element1D ;
//USER DEFINED PARAMETERS //USER DEFINED PARAMETERS
parameter Modelica.Units.SI.MassFlowRate m_flow ; parameter Modelica.Units.SI.MassFlowRate m_flow = 10 ;
//INTERNAL VARIABLES //INTERNAL VARIABLES
Medium.ThermodynamicState state ; Medium.ThermodynamicState state ;
Modelica.Units.SI.SpecificHeatCapacity cp ; Modelica.Units.SI.SpecificHeatCapacity cp ;
Modelica.Units.SI.HeatFlowRate Q_flow ;
//IMPORTED COMPONENTS //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 equation
state = Medium.setState_pT(p=Medium.p_default,T=port_a.T); state = Medium.setState_pT(p=Medium.p_default,T=port_a.T);
cp = Medium.specificHeatCapacityCp(state) ; cp = Medium.specificHeatCapacityCp(state) ;
Q_flow = m_flow * cp * (-dT) ; Q_flow = m_flow * cp * (port_b.T - port_a.T) ;
port_b.Q_flow = Q_flow;
port_a.Q_flow = 0 ;
end Fan; end Fan;

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

@@ -3,3 +3,5 @@ Coupled_model_prescribed
Coupled_model_prescribed_variable Coupled_model_prescribed_variable
Test_Media Test_Media
Test_replaceable_media Test_replaceable_media
Test_fan
Test_wall

View File

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