model ConditionalFixedHeatFlowSensor "HeatFlowSensor, conditional fixed Temperature"
extends Modelica.Icons.RotationalSensor;
parameter Boolean useFixedTemperature(start = false) "Fixed Temperature if true"
annotation (Evaluate = true);
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a port_a annotation (Placement(transformation(extent = {
{-110, -10},
{-90, 10}})));
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_b port_b annotation (Placement(transformation(extent = {
{90, -10},
{110, 10}})));
Modelica.Thermal.HeatTransfer.Sensors.HeatFlowSensor heatFlowSensor annotation (Placement(transformation(extent = {
{-10, -10},
{10, 10}})));
Modelica.Thermal.HeatTransfer.Sources.FixedTemperature fixedTemperature(final T(displayUnit = "K") = 293.15) if useFixedTemperature annotation (Placement(transformation(
extent = {
{-10, -10},
{10, 10}},
rotation = 90,
origin = {-50, -30})));
Modelica.Blocks.Interfaces.RealOutput Q_flow(unit = "W") "Heat flow from port_a to port_b as output signal"
annotation (Placement(transformation(
extent = {
{-10, -10},
{10, 10}},
rotation = 270,
origin = {0, -100})));
equation
connect(port_a,heatFlowSensor.port_a) annotation (Line(
points = {
{-100, 0},
{-10, 0}},
color = {191, 0, 0}));
connect(fixedTemperature.port,heatFlowSensor.port_a) annotation (Line(
points = {
{-50, -20},
{-50, 0},
{-10, 0}},
color = {191, 0, 0}));
connect(heatFlowSensor.Q_flow,Q_flow) annotation (Line(
points = {
{0, -10},
{0, -100}},
color = {0, 0, 127}));
connect(heatFlowSensor.port_b,port_b) annotation (Line(
points = {
{10, 0},
{100, 0}},
color = {191, 0, 0}));
annotation (
defaultComponentName = "heatFlowSensor",
Icon(
graphics = {
Rectangle(
lineColor = {255, 0, 0},
fillColor = {255, 0, 0},
fillPattern = FillPattern.HorizontalCylinder,
extent = {
{-90, -10},
{-70, 10}}),
Rectangle(
lineColor = {255, 0, 0},
fillColor = {255, 0, 0},
fillPattern = FillPattern.HorizontalCylinder,
extent = {
{70, -10},
{90, 10}}),
Text(
lineColor = {0, 0, 255},
extent = {
{-150, 85},
{150, 125}},
textString = "%name"),
Line(
points = {
{0, -70},
{0, -90}},
color = {0, 0, 127})},
coordinateSystem(
extent = {
{-100, -100},
{100, 100}},
preserveAspectRatio = true)),
Documentation(info = "<html>\n<p>\nIf useFixedTemperature = false, this sensor acts just as a normal\n<a href=\"modelica://Modelica.Thermal.HeatTransfer.Sensors.HeatFlowSensor\">HeatFlowSensor</a>.\n</p>\n<p>\nIf useFixedTemperature = true, it is assumed that the connections to both heatPorts of this sensor are conditionally removed;\nin this case, the measured Q_flow is reported = 0 automatically.\nTo avoid a singular equation system, the temperature of the sensor is set to 293.15 K.\n</p>\n</html>"));
end ConditionalFixedHeatFlowSensor;