Formation Otrera #2
@@ -3,19 +3,21 @@ within OTRERA_formation.Components;
|
||||
model Fan
|
||||
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
|
||||
parameter Modelica.Units.SI.MassFlowRate m_flow ;
|
||||
parameter Modelica.Units.SI.MassFlowRate m_flow = 10 ;
|
||||
//INTERNAL VARIABLES
|
||||
Medium.ThermodynamicState state ;
|
||||
Modelica.Units.SI.SpecificHeatCapacity cp ;
|
||||
|
||||
//IMPORTED COMPONENTS
|
||||
|
||||
|
||||
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 * (-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;
|
||||
15
Formation/OTRERA_formation/Models/Test_fan.mo
Normal file
15
Formation/OTRERA_formation/Models/Test_fan.mo
Normal 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;
|
||||
@@ -3,3 +3,5 @@ Coupled_model_prescribed
|
||||
Coupled_model_prescribed_variable
|
||||
Test_Media
|
||||
Test_replaceable_media
|
||||
Test_fan
|
||||
Test_wall
|
||||
|
||||
@@ -5,5 +5,5 @@ package OTRERA_formation
|
||||
|
||||
|
||||
annotation(
|
||||
uses(Modelica(version = "4.1.0")));
|
||||
uses(Modelica(version = "4.1.0"), TAeZoSysPro(version = "4.0-main")));
|
||||
end OTRERA_formation;
|
||||
Reference in New Issue
Block a user