Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 15 additions & 25 deletions ThermofluidStream/Sensors/DifferenceSensorSelect.mo
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ model DifferenceSensorSelect "Sensor for selectable quantatiy difference"
Documentation(info="<html>
<p>Medium Model for the negative input of the sensor. Make sure it is the same for the stream the sensors inputs are connected.</p>
</html>"));
parameter Integer digits(min=0) = 1 "Number of displayed digits";
parameter Integer digits(final min=0) = 3 "Number of significant digits to be displayed";
parameter SI.Density rho_min = dropOfCommons.rho_min "Minimum density"
annotation(Dialog(tab="Advanced", group="Regularization"));
parameter Quantities quantity "Measured quantity";
Expand Down Expand Up @@ -51,15 +51,11 @@ model DifferenceSensorSelect "Sensor for selectable quantatiy difference"
annotation(Dialog(group="Output", enable=outputValue and filter_output and init==InitMode.state));

Interfaces.Inlet inletA(redeclare package Medium=MediumA)
annotation (Placement(transformation(extent={{-20, -20},{20, 20}}, origin={-100,0}),
iconTransformation(extent={{-120,-20},{-80,20}})));
annotation (Placement(transformation(extent={{-120,-20},{-80,20}})));
Interfaces.Inlet inletB(redeclare package Medium=MediumB)
annotation (Placement(transformation(extent={{-20, -20},{20, 20}}, origin={136,-10}),
iconTransformation(extent={{120,-20},{80,20}})));
annotation (Placement(transformation(extent={{120,-20},{80,20}})));
Modelica.Blocks.Interfaces.RealOutput value_out(unit=Internal.getUnit(quantity)) = value if outputValue "Sensor output connector"
annotation (Placement(transformation(extent={{4,-78},{24,-58}}), iconTransformation(extent={{-10,-10},{10,10}},
rotation=270,
origin={0,-90})));
annotation (Placement(transformation(extent={{-10,-10},{10,10}},rotation=270,origin={0,-90})));

output Real value(unit=Internal.getUnit(quantity)) "Computed difference in the selected quantity";

Expand Down Expand Up @@ -101,38 +97,32 @@ equation
value = direct_value;
end if;

annotation (Icon(coordinateSystem(preserveAspectRatio=true), graphics={
annotation (defaultComponentName ="differentialSensor",Icon(coordinateSystem(preserveAspectRatio=true), graphics={
Text(visible=displayInstanceName,
extent={{-150,80},{150,40}},
textString="%name",
textColor=dropOfCommons.instanceNameColor),
Rectangle(
extent={{-54,24},{66,-36}},
extent={{-74,24},{86,-36}},
lineColor={0,0,0},
fillColor={215,215,215},
fillPattern=FillPattern.Solid,
pattern=LinePattern.None),
Line(
points={{-100,0},{100,0}},
color={28,108,200},
thickness=0.5),
Rectangle(
extent={{-60,30},{60,-30}},
extent={{-80,30},{80,-30}},
lineColor={0,0,0},
fillColor={255,255,255},
fillPattern=FillPattern.Solid),
Text(
extent={{-60,30},{60,-30}},
textColor={28,108,200},
textString=DynamicSelect("value", String(
value,
format="1."+String(digits)+"f"))),
extent={{-80,26},{80,-26}},
textColor={0,0,0},
textString=DynamicSelect(" 0.0 ", " "+String(value,significantDigits=digits)+" ")),
Text(
extent={{-150,-40},{150,-70}},
textColor={0,0,0},
textString=quantityString),
Ellipse(
extent={{70,30},{90,10}},
extent={{90,40},{110,20}},
lineColor={28,108,200},
lineThickness=0.5),
Line(visible=outputValue,
Expand All @@ -142,22 +132,22 @@ equation
points={{0,-30},{0,-40}},
color={0,0,127}),
Line(
points={{72,20},{88,20}},
points={{92,30},{108,30}},
color={28,108,200},
thickness=0.5),
Ellipse(
extent={{-90,30},{-70,10}},
extent={{-110,40},{-90,20}},
lineColor={28,108,200},
lineThickness=0.5),
Line(
points={{-88,20},{-72,20}},
points={{-108,30},{-92,30}},
color={28,108,200},
thickness=0.5),
Line(
points={{-8,0},{8,0}},
color={28,108,200},
thickness=0.5,
origin={-80,20},
origin={-100,30},
rotation=90)}),
Diagram(coordinateSystem(preserveAspectRatio=true)),
Documentation(info="<html>
Expand Down
58 changes: 23 additions & 35 deletions ThermofluidStream/Sensors/DifferenceSensor_Tp.mo
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ model DifferenceSensor_Tp "Sensor for Temperature and pressure difference"
Documentation(info="<html>
<p>Medium Model for the negative input of the sensor. Make sure it is the same for the stream the sensors inputs are connected.</p>
</html>"));
parameter Integer digits(min=0) = 1 "Number of displayed digits";
parameter Integer digits(final min=0) = 3 "Number of significant digits to be displayed";
parameter ThermofluidStream.Sensors.Internal.Types.TemperatureUnit temperatureUnit = "K" "Temperature unit (display and output)"
annotation(choicesAllMatching = true, Evaluate = true);
parameter ThermofluidStream.Sensors.Internal.Types.PressureUnit pressureUnit = "Pa" "Pressure unit (display and output)"
Expand All @@ -42,13 +42,13 @@ model DifferenceSensor_Tp "Sensor for Temperature and pressure difference"
annotation(Dialog(group="Output", enable=outputPressure and filter_output and init==InitMode.state));

Interfaces.Inlet inletA(redeclare package Medium=MediumA)
annotation (Placement(transformation(extent={{-20, -20},{20, 20}}, origin={-100,80}), iconTransformation(extent={{-120,40},{-80,80}})));
annotation (Placement(transformation(extent={{-120,40},{-80,80}})));
Interfaces.Inlet inletB(redeclare package Medium=MediumB)
annotation (Placement(transformation(extent={{-20, -20},{20, 20}}, origin={-100,-80}), iconTransformation(extent={{-120,-80},{-80,-40}})));
annotation (Placement(transformation(extent={{-120,-80},{-80,-40}})));
Modelica.Blocks.Interfaces.RealOutput T_out(final quantity="ThermodynamicTemperature", final unit=temperatureUnit) = T if outputTemperature "Temperature difference output connector"
annotation (Placement(transformation(extent={{70,30},{90,50}}), iconTransformation(extent={{70,30},{90,50}})));
annotation (Placement(transformation(extent={{100,30},{120,50}})));
Modelica.Blocks.Interfaces.RealOutput p_out(final quantity="Pressure", final unit=pressureUnit) = p if outputPressure "Pressure difference output connector"
annotation (Placement(transformation(extent={{70,-50},{90,-30}}), iconTransformation(extent={{70,-50},{90,-30}})));
annotation (Placement(transformation(extent={{100,-50},{120,-30}})));

output Real p(final quantity="Pressure", final unit=pressureUnit);
output Real T(final quantity="ThermodynamicTemperature", final unit=temperatureUnit);
Expand Down Expand Up @@ -102,62 +102,50 @@ equation
T = direct_T;
end if;

annotation (Icon(coordinateSystem(preserveAspectRatio=true), graphics={
annotation (defaultComponentName ="differentialSensorTp",Icon(coordinateSystem(preserveAspectRatio=true), graphics={
Text(visible=displayInstanceName,
extent={{-150,140},{150,100}},
textString="%name",
textColor=dropOfCommons.instanceNameColor),
Rectangle(
extent={{-54,54},{66,-66}},
extent={{-74,54},{86,-66}},
lineColor={0,0,0},
fillColor={215,215,215},
fillPattern=FillPattern.Solid,
pattern=LinePattern.None),
Line(
points={{-80,0},{0,0}},
color={28,108,200},
thickness=0.5),
Rectangle(
extent={{-60,60},{60,-60}},
extent={{-80,60},{80,-60}},
lineColor={0,0,0},
fillColor={255,255,255},
fillPattern=FillPattern.Solid),
Text(
extent={{-60,55},{60,5}},
textColor={28,108,200},
textString=DynamicSelect("T", String(
T,
format="1."+String(digits)+"f"))),
extent={{-80,56},{80,6}},
textColor={0,0,0},
textString=DynamicSelect(" T ", " "+String(T,significantDigits=digits)+" ")),
Text(
extent={{-60,-5},{60,-55}},
textColor={28,108,200},
textString=DynamicSelect("p", String(
p,
format="1."+String(digits)+"f"))),
Text(visible=not outputTemperature,
extent={{70,45},{130,15}},
extent={{-80,-6},{80,-56}},
textColor={0,0,0},
textString=DynamicSelect(" p ", " "+String(p,significantDigits=digits)+" ")),
Text(visible= not outputTemperature,
extent={{90,46},{150,16}},
textColor={0,0,0},
textString=temperatureString,
horizontalAlignment=TextAlignment.Left),
Text(visible=not outputPressure,
extent={{70,-15},{130,-45}},
Text(visible= not outputPressure,
extent={{90,-16},{150,-46}},
textColor={0,0,0},
horizontalAlignment=TextAlignment.Left,
textString="%pressureUnit"),
Text(visible= outputTemperature,
extent={{75,78},{135,48}},
extent={{95,78},{155,48}},
textColor={0,0,0},
textString=temperatureString,
horizontalAlignment=TextAlignment.Left),
Text(visible=outputPressure,
extent={{75,-2},{135,-32}},
Text(visible= outputPressure,
extent={{95,-2},{155,-32}},
textColor={0,0,0},
textString="%pressureUnit",
horizontalAlignment=TextAlignment.Left),
Line(
points={{-80,60},{-80,-60}},
color={28,108,200},
thickness=0.5),
Line(
points={{-100,-60},{-80,-60}},
color={28,108,200},
Expand All @@ -175,10 +163,10 @@ equation
lineColor={28,108,200},
lineThickness=0.5),
Line(visible=outputTemperature,
points={{60,40},{78,40}},
points={{80,40},{100,40}},
color={0,0,127}),
Line(visible=outputPressure,
points={{60,-40},{78,-40}},
points={{80,-40},{100,-40}},
color={0,0,127}),
Line(
points={{-108,90},{-92,90}},
Expand Down
41 changes: 15 additions & 26 deletions ThermofluidStream/Sensors/DifferenceTwoPhaseSensorSensorSelect.mo
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ model DifferenceTwoPhaseSensorSensorSelect "Sensor for selectable quantatiy diff
<p>Medium Model for the negative input of the sensor. Make sure it is the same for the stream the sensors inputs are connected.</p>
</html>"));

parameter Integer digits(min=0) = 1 "Number of displayed digits";
parameter Integer digits(final min=0) = 3 "Number of significant digits to be displayed";
parameter Quantities quantity "Measured quantity";

final parameter String quantityString=
Expand All @@ -43,16 +43,11 @@ model DifferenceTwoPhaseSensorSensorSelect "Sensor for selectable quantatiy diff
annotation(Dialog(group="Output", enable=outputValue and filter_output and init==InitMode.state));

Interfaces.Inlet inletA(redeclare package Medium=MediumA)
annotation (Placement(transformation(extent={{-20, -20},{20, 20}}, origin={-100,80}),
iconTransformation(extent={{-120,-20},{-80,20}})));
annotation (Placement(transformation(extent={{-120,-20},{-80,20}})));
Interfaces.Inlet inletB(redeclare package Medium=MediumB)
annotation (Placement(transformation(extent={{-20, -20},{20, 20}}, origin={-100,-80}),
iconTransformation(extent={{120,-20},{80,20}})));
annotation (Placement(transformation(extent={{120,-20},{80,20}})));
Modelica.Blocks.Interfaces.RealOutput value_out(unit=Internal.getTwoPhaseUnit(quantity)) = value if outputValue "Sensor output connector"
annotation (Placement(transformation(extent={{28,-90},{48,-70}}), iconTransformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={0,-90})));
annotation (Placement(transformation(extent={{-10,-10},{10,10}},rotation=270,origin={0,-90})));

output Real value(unit=Internal.getTwoPhaseUnit(quantity)) "Computed difference in the selected quantity";

Expand Down Expand Up @@ -94,32 +89,26 @@ equation
value = direct_value;
end if;

annotation (Icon(coordinateSystem(preserveAspectRatio=true), graphics={
annotation (defaultComponentName ="differentialSensor",Icon(coordinateSystem(preserveAspectRatio=true), graphics={
Text(visible=displayInstanceName,
extent={{-150,120},{150,80}},
textString="%name",
textColor=dropOfCommons.instanceNameColor),
Rectangle(
extent={{-54,24},{66,-36}},
extent={{-74,24},{86,-36}},
lineColor={0,0,0},
fillColor={215,215,215},
fillPattern=FillPattern.Solid,
pattern=LinePattern.None),
Line(
points={{-100,0},{100,0}},
color={28,108,200},
thickness=0.5),
Rectangle(
extent={{-60,30},{60,-30}},
extent={{-80,30},{80,-30}},
lineColor={0,0,0},
fillColor={255,255,255},
fillPattern=FillPattern.Solid),
Text(
extent={{-60,30},{60,-30}},
textColor={28,108,200},
textString=DynamicSelect("value", String(
value,
format="1."+String(digits)+"f"))),
extent={{-80,26},{80,-26}},
textColor={0,0,0},
textString=DynamicSelect(" 0.0 ", " "+String(value,significantDigits=digits)+" ")),
Text(
extent={{-150,-70},{150,-40}},
textColor={0,0,0},
Expand All @@ -131,25 +120,25 @@ equation
points={{0,-70},{0,-80}},
color={0,0,127}),
Ellipse(
extent={{-90,30},{-70,10}},
extent={{-110,40},{-90,20}},
lineColor={28,108,200},
lineThickness=0.5),
Line(
points={{-88,20},{-72,20}},
points={{-108,30},{-92,30}},
color={28,108,200},
thickness=0.5),
Line(
points={{-8,0},{8,0}},
color={28,108,200},
thickness=0.5,
origin={-80,20},
origin={-100,30},
rotation=90),
Line(
points={{72,20},{88,20}},
points={{92,30},{108,30}},
color={28,108,200},
thickness=0.5),
Ellipse(
extent={{70,30},{90,10}},
extent={{90,40},{110,20}},
lineColor={28,108,200},
lineThickness=0.5)}),
Diagram(coordinateSystem(preserveAspectRatio=true)),
Expand Down
Loading