model Density "Ideal one port density sensor"
extends Sensors.BaseClasses.PartialAbsoluteSensor;
extends Modelica.Icons.RotationalSensor;
Modelica.Blocks.Interfaces.RealOutput d(final quantity = "Density", final unit = "kg/m3", displayUnit = "g/cm3", min = 0) "Density in port medium"
annotation (Placement(transformation(extent = {
{100, -10},
{120, 10}})));
equation
d = Medium.density(Medium.setState_phX(port.p, inStream(port.h_outflow), inStream(port.Xi_outflow)));
annotation (
defaultComponentName = "density",
Icon(
coordinateSystem(
preserveAspectRatio = false,
extent = {
{-100, -100},
{100, 100}}),
graphics = {
Line(
points = {
{0, -70},
{0, -100}},
color = {0, 0, 127}),
Text(
extent = {
{-150, 80},
{150, 120}},
textString = "%name",
lineColor = {0, 0, 255}),
Text(
extent = {
{154, -31},
{56, -61}},
textString = "d"),
Line(
points = {
{70, 0},
{100, 0}},
color = {0, 0, 127})}),
Documentation(info = "<html>\n<p>\nThis component monitors the density of the fluid passing its port.\nThe sensor is ideal, i.e., it does not influence the fluid.\n</p>\n\n</html>"));
end Density;