Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ model MetroscopiaCCGT_reverse
display_unit="mbar",
signal_unit="mbar")
annotation (Placement(transformation(extent={{28,274},{40,286}})));
Sensors_Control.FlueGases.PressureSensor P_source_air_sensor(sensor_function="BC", init_P=1)
Sensors_Control.FlueGases.PressureSensor P_source_air_sensor(sensor_function="BC", P_start=1)
annotation (Placement(transformation(extent={{-646,-6},{-634,6}})));
Sensors_Control.FlueGases.TemperatureSensor T_source_air_sensor(sensor_function="BC")
annotation (Placement(transformation(extent={{-626,-6},{-614,6}})));
Expand Down Expand Up @@ -620,8 +620,8 @@ equation
annotation (Line(points={{-90,24},{-90,44}}, color={28,108,200}));
connect(P_Cond_sensor.C_in, LPsteamTurbine.C_out)
annotation (Line(points={{28,280},{20,280}}, color={28,108,200}));
connect(P_Cond_sensor.C_out, condenser.C_hot_in) annotation (Line(points={{40,280},
{60,280},{60,218.134}}, color={28,108,200}));
connect(P_Cond_sensor.C_out, condenser.C_hot_in) annotation (Line(points={{40,280},{60,280},{60,218.134}},
color={28,108,200}));

connect(P_source_air_sensor.C_out, T_source_air_sensor.C_in)
annotation (Line(points={{-634,0},{-626,0}}, color={95,95,95}));
Expand Down Expand Up @@ -707,8 +707,8 @@ equation
points={{20,293.44},{20,320},{56.08,320}},
color={244,125,35},
smooth=Smooth.Bezier));
connect(pumpRec_controlValve.C_out, loopBreaker.C_in) annotation (Line(points={{166.5,
80},{180,80},{180,64}}, color={28,108,200}));
connect(pumpRec_controlValve.C_out, loopBreaker.C_in) annotation (Line(points={{166.5,80},{180,80},{180,64}},
color={28,108,200}));
connect(pumpRec.C_out, T_pumpRec_out_sensor.C_in) annotation (Line(points={{101,80.5455},{110,80.5455}},
color={28,108,200}));
connect(AirFilter.C_out, P_filter_out_sensor.C_in)
Expand All @@ -728,8 +728,8 @@ equation
annotation (Line(points={{-180,138.9},{-180,130.182}}, color={0,0,127}));
connect(Q_deSH_sensor.C_in, loopBreaker.C_in) annotation (Line(points={{-132,120},{180,120},{180,64}},
color={28,108,200}));
connect(Q_deSH_sensor.C_out, deSH_controlValve.C_in) annotation (Line(points={{-144,
120},{-158,120},{-158,120},{-173.75,120}}, color={28,108,200}));
connect(Q_deSH_sensor.C_out, deSH_controlValve.C_in) annotation (Line(points={{-144,120},{-158,120},{-158,120},{-173.75,120}},
color={28,108,200}));
connect(deSH_controlValve.C_out, HPsuperheater2.C_cold_in) annotation (Line(
points={{-186.25,120},{-230,120},{-230,34},{-260,34},{-260,24}},
color={28,108,
Expand All @@ -755,8 +755,7 @@ equation
color={244,125,35},
smooth=Smooth.Bezier));
connect(T_flue_gas_sink_sensor.C_out, P_flue_gas_sink_sensor.C_in) annotation (Line(points={{176,0},{222,0},{222,192}}, color={95,95,95}));
connect(HPST_control_valve.C_in, displayer.C_out) annotation (Line(points={{-223.25,
180},{-230,180},{-230,180},{-235,180}}, color={28,108,200}));
connect(HPST_control_valve.C_in, displayer.C_out) annotation (Line(points={{-223.25,180},{-230,180},{-230,180},{-235,180}}, color={28,108,200}));
connect(displayer.C_in, P_w_HPSH2_out_sensor.C_out) annotation (Line(points={{-241,180},{-280,180},{-280,86}}, color={28,108,200}));
connect(source_fuel.C_out, fuelDisplayer.C_in) annotation (Line(points={{-440,-95},{-440,-83}}, color={213,213,0}));
connect(fuelDisplayer.C_out, T_fuel_source_sensor.C_in) annotation (Line(points={{-440,-77},{-440,-65}}, color={213,213,0}));
Expand Down Expand Up @@ -839,26 +838,22 @@ equation
201},{-174.22,201},{-174.22,193.12}}, color={0,0,127}));
connect(HPsteamTurbine.eta_is, HPsteamTurbine_eta_is) annotation (Line(points={{-166.74,
194.72},{-175,194.72},{-175,209}}, color={0,0,127}));
connect(LPST_control_valve.Cv, LPST_control_valve_Cv) annotation (Line(points={{-56.3,
288.969},{-56.3,289},{-67,289}}, color={0,0,127}));
connect(HPST_control_valve.Cv, HPST_control_valve_Cv) annotation (Line(points={{-218.3,
188.969},{-220,189},{-227,189}}, color={0,0,127}));
connect(LPST_control_valve.Cv, LPST_control_valve_Cv) annotation (Line(points={{-56.3,288.969},{-56.3,289},{-67,289}}, color={0,0,127}));
connect(HPST_control_valve.Cv, HPST_control_valve_Cv) annotation (Line(points={{-218.3,188.969},{-220,189},{-227,189}}, color={0,0,127}));
connect(T_flue_gas_sink_sensor.T_sensor, T_flue_gas_sink) annotation (Line(points={{170,6},{170,10}}, color={0,0,127}));
connect(W_ST_out_sensor.W_sensor, W_ST_out) annotation (Line(points={{96,326},{96,332}}, color={0,0,127}));
connect(P_HPST_in_sensor.P_sensor, P_HPST_in) annotation (Line(points={{-194,186},{-194,192}}, color={0,0,127}));
connect(deSH_opening, deSH_opening_sensor.opening_sensor) annotation (Line(points={{-180,154},{-180,149.1}}, color={0,0,127}));
connect(Evap_opening_sensor.opening_sensor,Evap_opening) annotation (Line(points={{30,63.1},{30,68}}, color={0,0,127}));
connect(pumpRec_opening, pumpRec_opening_sensor.opening_sensor) annotation (Line(points={{160,110},{160,105.1}}, color={0,0,127}));
connect(deSH_controlValve_Cv_max, deSH_controlValve.Cv_max) annotation (Line(points={{-167,
127},{-172,127},{-172,127},{-177.5,127}}, color={0,0,127}));
connect(deSH_controlValve_Cv_max, deSH_controlValve.Cv_max) annotation (Line(points={{-167,127},{-172,127},{-172,127},{-177.5,127}}, color={0,0,127}));
connect(Evap_controlValve.Cv_max, Evap_controlValve_Cv_max) annotation (Line(points={{32.5,41.0003},{34,41.0003},{34,41},{39,41}}, color={0,0,127}));
connect(pumpRec_controlValve.Cv_max, pumpRec_controlValve_Cv_max) annotation (Line(points={{157.4,
87},{152,87},{152,105},{147,105}}, color={0,0,127}));
connect(pumpRec_controlValve.Cv_max, pumpRec_controlValve_Cv_max) annotation (Line(points={{157.4,87},{152,87},{152,105},{147,105}}, color={0,0,127}));
connect(Q_pumpRec_out_sensor.Q_sensor, Q_pumpRec_out) annotation (Line(points={{145,85.5455},{145,93}}, color={0,0,127}));
connect(condenser_Kth, condenser.Kth) annotation (Line(points={{40,230},{40,219.556},{44,219.556}},
connect(condenser_Kth, condenser.Kth) annotation (Line(points={{40,230},{40,219.556},{47.2,219.556}},
color={0,0,127}));
connect(condenser.Qv_cold_in, condenser_Qv_cold_in) annotation (Line(points={{38,208.889},{27,208.889},{27,230},{20,230}}, color={0,0,127}));
connect(condenser.Kfr_cold, condenser_Kfr_cold.y) annotation (Line(points={{38,214.222},{32,214.222},{32,221.7}}, color={0,0,127}));
connect(condenser.Qv_cold_in, condenser_Qv_cold_in) annotation (Line(points={{38,214.222},{27,214.222},{27,230},{20,230}}, color={0,0,127}));
connect(condenser.Kfr_cold, condenser_Kfr_cold.y) annotation (Line(points={{38,207.111},{32,207.111},{32,221.7}}, color={0,0,127}));
connect(combustionChamber_Kfr.y, combustionChamber.Kfr) annotation (Line(points={{-432,19.6},{-432,16},{-437,16},{-437,11}}, color={0,0,127}));
connect(combustionChamber_eta.y, combustionChamber.eta) annotation (Line(points={{-448,19.6},{-448,16},{-443,16},{-443,11}}, color={0,0,127}));
connect(evaporator.Kth, Evap_Kth) annotation (Line(points={{-8,-21},{-8,-30}}, color={0,0,127}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ partial model DeltaPressureSensor
replaceable package Medium =
MetroscopeModelingLibrary.Partial.Media.PartialMedium;

parameter Utilities.Units.DifferentialPressure DP_0=1e4;

parameter Real init_DP = 0.05;
parameter Real DP_start = 0.05 "Write here the build value of the quantity. This value will be used in the simulation.";

parameter String display_unit = "bar" "Specify the display unit"
annotation(choices(choice="bar", choice="mbar", choice="psi", choice="Pa"));
parameter String signal_unit = "bar" "Specify the signal unit. This should be the unit of DP_start and of the tag linked to the sensor." annotation(choices(choice="bar", choice="mbar", choice="psi", choice="Pa"));

parameter Utilities.Units.DifferentialPressure DP_0=1e4;
Utilities.Units.DifferentialPressure DP(start=DP_0, nominal=DP_0);
Real DP_bar(unit="bar", start=DP_0*Utilities.Constants.Pa_to_barA); // Pressure difference in bar
Real DP_mbar(unit="mbar", start=DP_0*Utilities.Constants.Pa_to_mbar); // Pressure difference in mbar
Expand All @@ -20,13 +24,11 @@ partial model DeltaPressureSensor
parameter String causality = "" "Specify which parameter is calibrated by this sensor";
outer parameter Boolean show_causality = true "Used to show or not the causality";
outer parameter Boolean display_output = false "Used to switch ON or OFF output display";
parameter String display_unit = "bar" "Specify the display unit"
annotation(choices(choice="bar", choice="mbar", choice="psi", choice="Pa"));
parameter String signal_unit = "bar" annotation(choices(choice="bar", choice="mbar", choice="psi", choice="Pa"));


replaceable Partial.Connectors.FluidInlet C_in(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-110,-10},{-90,10}})));
replaceable Partial.Connectors.FluidOutlet C_out(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{90,-10},{110,10}})));
Utilities.Interfaces.GenericReal DP_sensor(start=init_DP) annotation (Placement(transformation(
Utilities.Interfaces.GenericReal DP_sensor(start=DP_start) annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=90,
origin={0,100}), iconTransformation(
Expand Down
17 changes: 10 additions & 7 deletions MetroscopeModelingLibrary/Partial/Sensors_Control/FlowSensor.mo
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@ partial model FlowSensor
import MetroscopeModelingLibrary.Utilities.Units;
import MetroscopeModelingLibrary.Utilities.Constants;

parameter Units.VolumeFlowRate Qv_0 = Q_0/1000;

Units.VolumeFlowRate Qv(start=Qv_0, nominal=Qv_0);
Real Q_lm(start=Qv_0*Constants.m3s_to_lm, nominal=Qv_0*Constants.m3s_to_lm); // Flow rate in liter per minute;
parameter Units.PositiveMassFlowRate Q_start = 100 "Write here the build value of the quantity. This value will be used in the simulation.";
parameter String signal_unit = "kg/s" "Specify the signal unit. This should be the unit of Q_start and of the tag linked to the sensor." annotation(choices(choice="kg/s", choice="m3/s", choice="l/m", choice="t/h", choice="lb/s", choice="Mlb/h"));

parameter String display_unit = "kg/s" "Specify the display unit" annotation(choices(choice="kg/s", choice="m3/s", choice="l/m", choice="t/h", choice="lb/s", choice="Mlb/h"));


Units.VolumeFlowRate Qv;
Real Q_lm; // Flow rate in liter per minute;

Real Q_th(start=Q_0*Constants.kgs_to_th, nominal=Q_0*Constants.kgs_to_th); // Flow rate in tons per hour
Real Q_lbs(start=Q_0*Constants.kgs_to_lbs, nominal=Q_0*Constants.kgs_to_lbs); // Flow rate in pounds per second;
Expand All @@ -19,12 +24,10 @@ partial model FlowSensor
// Failure modes
parameter Boolean faulty = false;

parameter String display_unit = "kg/s" "Specify the display unit"
annotation(choices(choice="kg/s", choice="m3/s", choice="l/m", choice="t/h", choice="lb/s", choice="Mlb/h"));
outer parameter Boolean display_output = true "Used to switch ON or OFF output display";
parameter String signal_unit = "kg/s" annotation (choices(choice="kg/s", choice="l/m", choice="t/h"));

Utilities.Interfaces.GenericReal Q_sensor(start=Q_0) annotation (Placement(transformation(

Utilities.Interfaces.GenericReal Q_sensor(start=Q_start) annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=90,
origin={0,100}), iconTransformation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ partial model PressureSensor
import MetroscopeModelingLibrary.Utilities.Units;
import MetroscopeModelingLibrary.Utilities.Constants;

parameter Real init_P = 1;
parameter Real P_start = 1 "Write here the build value of the quantity. This value will be used in the simulation.";
parameter String signal_unit = "barA" "Specify the signal unit. This should be the unit of P_start and of the tag linked to the sensor." annotation(choices(choice="barA", choice="barG", choice="mbar", choice="MPaA", choice="kPaA"));

parameter String display_unit = "barA" "Specify the display unit"
annotation(choices(choice="barA", choice="barG", choice="mbar", choice="MPaA", choice="kPaA",choice="psiA",choice="psiG",choice="inHg"));


// All nominal values of gauge pressures are set to the absolute pressure value to avoid zero nominal value

Expand All @@ -25,11 +30,8 @@ partial model PressureSensor
Real P_mbar(nominal = P_0*Constants.Pa_to_mbar, start = P_0*Constants.Pa_to_mbar, unit="mbar"); // Absolute pressure in milibar

outer parameter Boolean display_output = true "Used to switch ON or OFF output display";
parameter String display_unit = "barA" "Specify the display unit"
annotation(choices(choice="barA", choice="barG", choice="mbar", choice="MPaA", choice="kPaA",choice="psiA",choice="psiG",choice="inHg"));
parameter String signal_unit = "barA" annotation(choices(choice="barA", choice="barG", choice="mbar", choice="MPaA", choice="kPaA"));

Utilities.Interfaces.GenericReal P_sensor(start=init_P)
Utilities.Interfaces.GenericReal P_sensor(start=P_start)
annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=90,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,27 @@ partial model TemperatureSensor
import MetroscopeModelingLibrary.Utilities.Constants;

// Initialization parameters
parameter Real T_start = 300 "Write here the build value of the quantity. This value will be used in the simulation.";

parameter String signal_unit = "degC" "Specify the signal unit. This should be the unit of T_start and of the tag linked to the sensor." annotation (choices(choice="degC", choice="K", choice="degF"));

parameter String display_unit = "degC" "Specify the display unit"
annotation(choices(choice="degC", choice="K", choice="degF"));

parameter Units.Temperature T_0 = 300;
parameter Real init_T = 300;


Units.Temperature T(start=T_0); // Temperature in SI Units : K
Real T_degC(unit="degC", start=T_0 +Constants.T0_degC_in_K, nominal=T_0 +Constants.T0_degC_in_K); // Temperature in degC
Real T_degF(unit="degF",
start=(T_0 +Constants.T0_degC_in_K) *Constants.degC_to_degF +Constants.T0_degC_in_degF,
nominal=(T_0 +Constants.T0_degC_in_K) *Constants.degC_to_degF +Constants.T0_degC_in_degF); // Temperature in degF

parameter String display_unit = "degC" "Specify the display unit"
annotation(choices(choice="degC", choice="K", choice="degF"));

outer parameter Boolean display_output = true "Used to switch ON or OFF output display";
parameter String signal_unit = "degC" annotation (choices(choice="degC", choice="K", choice="degF"));

Utilities.Interfaces.GenericReal T_sensor(start=init_T) annotation (Placement(transformation(

Utilities.Interfaces.GenericReal T_sensor(start=T_start) annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=90,
origin={0,100}), iconTransformation(
Expand Down