From 770cbc2685867cf15d01e7547a13d91a91a975fa Mon Sep 17 00:00:00 2001 From: Thomas Beutlich Date: Sun, 14 Jan 2024 20:45:35 +0100 Subject: [PATCH] Utilize PressureRate unit --- Modelica/Electrical/Digital.mo | 62 ++++++++++++++------------ Modelica/Media/Air/MoistAir.mo | 30 ++++++------- Modelica/Media/Water/IF97_Utilities.mo | 8 ++-- Modelica/Media/package.mo | 16 +++---- 4 files changed, 60 insertions(+), 56 deletions(-) diff --git a/Modelica/Electrical/Digital.mo b/Modelica/Electrical/Digital.mo index 7f28cc815fc..420ae17375b 100644 --- a/Modelica/Electrical/Digital.mo +++ b/Modelica/Electrical/Digital.mo @@ -248,7 +248,7 @@ the library and has the following content: annotation ( Documentation(info="

A pulse-triggered master-slave flip-flop is demonstrated. The flipflop component is composed by basic gates. It can be found in the Utilities subpackage. The example is designed to test and demonstrate the basic gate components.

-"), experiment(StopTime=250)); +"), experiment(StopTime=25)); end FlipFlop; model HalfAdder "Adding circuit for binary numbers without input carry bit" @@ -1315,15 +1315,18 @@ sum Adder4.c_out Adder4.s Adder3.s D.Delay.TransportDelay TD1(final delayTime=delayTime, final y0=q0) annotation (Placement(transformation(extent={{-60,-64},{-40,-44}}))); equation - connect(s, Nor1.x[2]) annotation (Line(points={{-100,70},{-32,70}}, color={127,0,127})); - connect(r, Nor2.x[1]) annotation (Line(points={{-100,-70},{-32,-70}}, color={127,0,127})); - connect(Nor2.y, Nor1.x[1]) annotation (Line(points={{0,-62},{20,-62},{ - 20,-20},{-70,20},{-70,54},{-32,54}}, color={127,0,127})); + connect(s, Nor1.x[2]) annotation (Line(points={{-100,70},{-66,70},{ + -66,62},{-32,62}}, color={127,0,127})); + connect(r, Nor2.x[1]) annotation (Line(points={{-100,-70},{-66,-70},{ + -66,-62},{-32,-62}}, color={127,0,127})); + connect(Nor2.y, Nor1.x[1]) annotation (Line(points={{0,-62},{20,-62}, + {20,-20},{-70,-20},{-70,62},{-32,62}}, color={127,0,127})); connect(Nor1.y,qn) annotation (Line( points={{0,62},{50,62},{50,-70},{100,-70}}, color={127,0,127})); connect(Nor2.y,q) annotation (Line( points={{0,-62},{70,-62},{70,70},{100,70}}, color={127,0,127})); - connect(TD1.y, Nor2.x[2]) annotation (Line(points={{-40,-54},{-32,-54}}, color={127,0,127})); + connect(TD1.y, Nor2.x[2]) annotation (Line(points={{-40,-54},{-36,-54}, + {-36,-62},{-32,-62}}, color={127,0,127})); connect(TD1.x, Nor1.y) annotation (Line(points={{-56,-54},{-70,-54},{-70, -20},{20,20},{20,62},{0,62}}, color={127,0,127})); annotation ( @@ -1528,7 +1531,7 @@ sum Adder4.c_out Adder4.s Adder3.s {{-110,-80},{-90,-60}}))); D.Examples.Utilities.RS RS1(final delayTime=delayTime, final q0=q0) annotation (Placement(transformation( - extent={{30,-24},{70,16}}))); + extent={{36,-20},{76,20}}))); D.Examples.Utilities.RS RS2(final delayTime=delayTime, final q0=q0) annotation (Placement(transformation( extent={{-44,-20},{-4,20}}))); @@ -1536,41 +1539,42 @@ sum Adder4.c_out Adder4.s Adder3.s 4},{-50,24}}))); D.Basic.And And2(n=3) annotation (Placement(transformation(extent={{-70, -24},{-50,-4}}))); - D.Basic.And And3 annotation (Placement(transformation(extent={{4,0},{24, - 20}}))); - D.Basic.And And4 annotation (Placement(transformation(extent={{4,-28},{ - 24,-8}}))); + D.Basic.And And3 annotation (Placement(transformation(extent={{10,4},{30,24}}))); + D.Basic.And And4 annotation (Placement(transformation(extent={{10,-24},{30,-4}}))); D.Basic.Not Not1 annotation (Placement(transformation(extent={{-34,-66}, {-14,-46}}))); equation connect(And2.y, RS2.r) annotation (Line(points={{-50,-14},{-44,-14}}, color={127,0,127})); connect(And1.y, RS2.s) annotation (Line(points={{-50,14},{-44,14}}, color={127,0,127})); connect(clk, And2.x[3]) annotation (Line(points={{-100,0},{-74,0},{ - -74,-8.66667},{-66,-8.66667}}, color={127,0,127})); + -74,-11.3333},{-66,-11.3333}}, color={127,0,127})); connect(clk, And1.x[1]) annotation (Line(points={{-100,0},{-74,0},{ - -74,8.66667},{-66,8.66667}}, color={127,0,127})); + -74,11.3333},{-66,11.3333}}, color={127,0,127})); connect(k, And2.x[2]) annotation (Line(points={{-100,-70},{-74,-70},{ -74,-14},{-66,-14}}, color={127,0,127})); - connect(And4.y, RS1.r) annotation (Line(points={{24,-18},{30,-18}}, color={127,0,127})); - connect(And3.y, RS1.s) annotation (Line(points={{24,10},{30,10}}, color={127,0,127})); - connect(RS2.qn, And4.x[2]) annotation (Line(points={{-4,-14},{8,-14}}, color={127,0,127})); - connect(RS2.q, And3.x[2]) annotation (Line(points={{-4,14},{8,14}}, color={127,0,127})); + connect(And4.y, RS1.r) annotation (Line(points={{30,-14},{36,-14}}, color={127,0,127})); + connect(And3.y, RS1.s) annotation (Line(points={{30,14},{36,14}}, color={127,0,127})); + connect(RS2.qn, And4.x[2]) annotation (Line(points={{-4,-14},{14,-14}},color={127,0,127})); connect(clk, Not1.x) annotation (Line(points={{-100,0},{-80,0},{-80,-56}, {-30,-56}}, color={127,0,127})); - connect(Not1.y, And3.x[1]) annotation (Line(points={{-14,-56},{2,-56},{ - 2,6},{8,6}}, color={127,0,127})); - connect(Not1.y, And4.x[1]) annotation (Line(points={{-14,-56},{2,-56},{ - 2,-22},{8,-22}}, color={127,0,127})); + connect(Not1.y, And3.x[1]) annotation (Line(points={{-14,-56},{0, + -56},{0,0},{6,0},{6,11.3333},{14,11.3333}}, + color={127,0,127})); + connect(Not1.y, And4.x[1]) annotation (Line(points={{-14,-56},{0,-56},{0,0}, + {6,0},{6,-11.3333},{14,-11.3333}}, + color={127,0,127})); connect(j, And1.x[2]) annotation (Line(points={{-100,70},{-74,70},{-74, 14},{-66,14}}, color={127,0,127})); - connect(RS1.q, And2.x[1]) annotation (Line(points={{70,10},{80,10}, - {80,-36},{-70,-36},{-70,-19.3333},{-66,-19.3333}}, color={127,0,127})); - connect(RS1.qn, And1.x[3]) annotation (Line(points={{70,-18},{86, - -18},{86,36},{-70,36},{-70,19.3333},{-66,19.3333}}, color={127,0,127})); - connect(RS1.qn, q) annotation (Line(points={{70,-18},{86,-18},{86,70},{ - 100,70}}, color={127,0,127})); - connect(RS1.q, qn) annotation (Line(points={{70,10},{80,10},{80,-70},{100, - -70}}, color={127,0,127})); + connect(RS1.q, And2.x[1]) annotation (Line(points={{76,14},{80,14}, + {80,-36},{-70,-36},{-70,-16.6667},{-66,-16.6667}}, color={127,0,127})); + connect(RS1.qn, And1.x[3]) annotation (Line(points={{76,-14},{86, + -14},{86,36},{-70,36},{-70,16.6667},{-66,16.6667}}, color={127,0,127})); + connect(RS1.qn, q) annotation (Line(points={{76,-14},{86,-14},{86,70},{100,70}}, + color={127,0,127})); + connect(RS1.q, qn) annotation (Line(points={{76,14},{80,14},{80,-70},{100,-70}}, + color={127,0,127})); + connect(RS2.q, And3.x[2]) + annotation (Line(points={{-4,14},{14,14}}, color={127,0,127})); annotation ( Documentation(info="

Based on the RS component JKFF is a J-K-flipflop composed according to the schematic. Its parameter delayTime is the delay time of the RS component transport delay, q0 is the initial value of that delay.

diff --git a/Modelica/Media/Air/MoistAir.mo b/Modelica/Media/Air/MoistAir.mo index b698e1293e0..6ce59f8df50 100644 --- a/Modelica/Media/Air/MoistAir.mo +++ b/Modelica/Media/Air/MoistAir.mo @@ -356,8 +356,8 @@ The ideal gas constant for moist air is computed from the gas phase composition. extends Modelica.Icons.Function; input SI.Temperature Tsat "Saturation temperature"; - input Real dTsat(unit="K/s") "Saturation temperature derivative"; - output Real psat_der(unit="Pa/s") "Saturation pressure derivative"; + input SI.TemperatureSlope dTsat "Saturation temperature derivative"; + output SI.PressureRate psat_der "Saturation pressure derivative"; protected SI.Temperature Tcritical=647.096 "Critical temperature"; SI.AbsolutePressure pcritical=22.064e6 "Critical pressure"; @@ -414,8 +414,8 @@ The ideal gas constant for moist air is computed from the gas phase composition. extends Modelica.Icons.Function; input SI.Temperature Tsat "Sublimation temperature"; - input Real dTsat(unit="K/s") "Sublimation temperature derivative"; - output Real psat_der(unit="Pa/s") "Sublimation pressure derivative"; + input SI.TemperatureSlope dTsat "Sublimation temperature derivative"; + output SI.PressureRate psat_der "Sublimation pressure derivative"; protected SI.Temperature Ttriple=273.16 "Triple point temperature"; SI.AbsolutePressure ptriple=611.657 "Triple point pressure"; @@ -458,9 +458,9 @@ Saturation pressure of water in the liquid and the solid region is computed usin function saturationPressure_der "Derivative function for 'saturationPressure'" extends Modelica.Icons.Function; - input Temperature Tsat "Saturation temperature"; - input Real dTsat(unit="K/s") "Time derivative of saturation temperature"; - output Real psat_der(unit="Pa/s") "Saturation pressure"; + input SI.Temperature Tsat "Saturation temperature"; + input SI.TemperatureSlope dTsat "Time derivative of saturation temperature"; + output SI.PressureRate psat_der "Saturation pressure"; algorithm /*psat := Utilities.spliceFunction(saturationPressureLiquid(Tsat),sublimationPressureIce(Tsat),Tsat-273.16,1.0);*/ @@ -801,8 +801,8 @@ Specific enthalpy of moist air is computed from pressure, temperature and compos input SI.Pressure p "Pressure"; input SI.Temperature T "Temperature"; input SI.MassFraction X[:] "Mass fractions of moist air"; - input Real dp(unit="Pa/s") "Pressure derivative"; - input Real dT(unit="K/s") "Temperature derivative"; + input SI.PressureRate dp "Pressure derivative"; + input SI.TemperatureSlope dT "Temperature derivative"; input Real dX[:](each unit="1/s") "Composition derivative"; output Real h_der(unit="J/(kg.s)") "Time derivative of specific enthalpy"; protected @@ -817,7 +817,7 @@ Specific enthalpy of moist air is computed from pressure, temperature and compos Real dX_air(unit="1/s") "Time derivative of dry air mass fraction"; Real dX_liq(unit="1/s") "Time derivative of liquid/solid water mass fraction"; - Real dps(unit="Pa/s") "Time derivative of saturation pressure"; + SI.PressureRate dps "Time derivative of saturation pressure"; Real dx_sat(unit="1/s") "Time derivative of absolute humidity per unit mass of dry air"; algorithm @@ -969,8 +969,8 @@ Specific internal energy is determined from pressure p, temperature T and compos input SI.Pressure p "Pressure"; input SI.Temperature T "Temperature"; input SI.MassFraction X[:] "Mass fractions of moist air"; - input Real dp(unit="Pa/s") "Pressure derivative"; - input Real dT(unit="K/s") "Temperature derivative"; + input SI.PressureRate dp "Pressure derivative"; + input SI.TemperatureSlope dT "Temperature derivative"; input Real dX[:](each unit="1/s") "Mass fraction derivatives"; output Real u_der(unit="J/(kg.s)") "Specific internal energy derivative"; protected @@ -987,7 +987,7 @@ Specific internal energy is determined from pressure p, temperature T and compos Real dX_air(unit="1/s") "Time derivative of dry air mass fraction"; Real dX_liq(unit="1/s") "Time derivative of liquid/solid water mass fraction"; - Real dps(unit="Pa/s") "Time derivative of saturation pressure"; + SI.PressureRate dps "Time derivative of saturation pressure"; Real dx_sat(unit="1/s") "Time derivative of absolute humidity per unit mass of dry air"; Real dR_gas(unit="J/(kg.K.s)") "Time derivative of ideal gas constant"; @@ -1344,8 +1344,8 @@ Specific entropy of moist air is computed from pressure, temperature and composi input SI.Pressure p "Pressure"; input SI.Temperature T "Temperature"; input SI.MassFraction X[:] "Mass fractions of moist air"; - input Real dp(unit="Pa/s") "Derivative of pressure"; - input Real dT(unit="K/s") "Derivative of temperature"; + input SI.PressureRate dp "Derivative of pressure"; + input SI.TemperatureSlope dT "Derivative of temperature"; input Real dX[nX](each unit="1/s") "Derivative of mass fractions"; output Real ds(unit="J/(kg.K.s)") "Specific entropy at p, T, X"; protected diff --git a/Modelica/Media/Water/IF97_Utilities.mo b/Modelica/Media/Water/IF97_Utilities.mo index 9e00afdf07d..9ef1966485e 100644 --- a/Modelica/Media/Water/IF97_Utilities.mo +++ b/Modelica/Media/Water/IF97_Utilities.mo @@ -3113,8 +3113,8 @@ email: hubertus@modelon.se function tsat_der "Derivative function for tsat" extends Modelica.Icons.Function; input SI.Pressure p "Pressure"; - input Real der_p(unit="Pa/s") "Pressure derivative"; - output Real der_tsat(unit="K/s") "Temperature derivative"; + input SI.PressureRate der_p "Pressure derivative"; + output SI.TemperatureSlope der_tsat "Temperature derivative"; protected Real dtp; algorithm @@ -3201,8 +3201,8 @@ email: hubertus@modelon.se function psat_der "Derivative function for psat" extends Modelica.Icons.Function; input SI.Temperature T "Temperature (K)"; - input Real der_T(unit="K/s") "Temperature derivative"; - output Real der_psat(unit="Pa/s") "Pressure"; + input SI.TemperatureSlope der_T "Temperature derivative"; + output SI.PressureRate der_psat "Pressure"; protected Real dpt; algorithm diff --git a/Modelica/Media/package.mo b/Modelica/Media/package.mo index 2603351494d..b08b4e3d08a 100644 --- a/Modelica/Media/package.mo +++ b/Modelica/Media/package.mo @@ -2220,11 +2220,11 @@ package Examples Real der_T; protected parameter SI.AbsolutePressure p01 = 100000.0 "state.p at time 0"; - parameter Real pRate1(unit = "Pa/s") = 0 "state.p rate of change"; + parameter SI.PressureRate pRate1 = 0 "state.p rate of change"; parameter SI.Temperature T01 = 200 "state.T at time 0"; parameter SI.TemperatureSlope Trate1 = 1000 "state.T rate of change"; parameter SI.AbsolutePressure p02 = 2.0e5 "state2.p at time 0"; - parameter Real pRate2(unit = "Pa/s") = 0 "state2.p rate of change"; + parameter SI.PressureRate pRate2 = 0 "state2.p rate of change"; parameter SI.Temperature T02 = 500 "state2.T at time 0"; parameter SI.TemperatureSlope Trate2 = 0 "state2.T rate of change"; @@ -2408,11 +2408,11 @@ is given to compare the approximation. protected constant SI.Time unitTime=1; parameter SI.AbsolutePressure p01 = 1.e5 "state1.p at time 0"; - parameter Real pRate1(unit = "Pa/s") = 1.e5 "state1.p rate of change"; + parameter SI.PressureRate pRate1 = 1.e5 "state1.p rate of change"; parameter SI.Temperature T01 = 300 "state1.T at time 0"; parameter SI.TemperatureSlope Trate1 = 10 "state1.T rate of change"; parameter SI.AbsolutePressure p02 = 1.e5 "state2.p at time 0"; - parameter Real pRate2(unit = "Pa/s") = 1.e5/2 "state2.p rate of change"; + parameter SI.PressureRate pRate2 = 1.e5/2 "state2.p rate of change"; parameter SI.Temperature T02 = 340 "state2.T at time 0"; parameter SI.TemperatureSlope Trate2 = -20 "state2.T rate of change"; equation @@ -2613,8 +2613,8 @@ It must be noted that the relationship of both axis variables is not right-angle extends Modelica.Icons.Example; ExtendedProperties medium(p(start=2000.0, fixed=true), h(start=8.0e5, fixed=true)); - parameter Real dh(unit="J/(kg.s)", displayUnit="kJ/(kg.s)")=80000.0 "Derivative of specific enthalpy of medium"; - parameter Real dp(unit="Pa/s", displayUnit="bar/s")=1.0e6 "Derivative of pressure of medium"; + parameter Real dh(unit="J/(kg.s)", displayUnit="kJ/(kg.s)") = 80000.0 "Derivative of specific enthalpy of medium"; + parameter SI.PressureRate dp = 1.0e6 "Derivative of pressure of medium"; equation der(medium.p) = dp; der(medium.h) = dh; @@ -2717,11 +2717,11 @@ points, e.g., when an isentropic reference state is computed. protected constant SI.Time unitTime=1; parameter SI.AbsolutePressure p01 = 1.e5 "state1.p at time 0"; - parameter Real pRate1(unit = "Pa/s") = 1.e5 "state1.p rate of change"; + parameter SI.PressureRate pRate1 = 1.e5 "state1.p rate of change"; parameter SI.Temperature T01 = 300 "state1.T at time 0"; parameter SI.TemperatureSlope Trate1 = 10 "state1.T rate of change"; parameter SI.AbsolutePressure p02 = 1.e5 "state2.p at time 0"; - parameter Real pRate2(unit = "Pa/s") = 1.e5/2 "state2.p rate of change"; + parameter SI.PressureRate pRate2 = 1.e5/2 "state2.p rate of change"; parameter SI.Temperature T02 = 340 "state2.T at time 0"; parameter SI.TemperatureSlope Trate2 = -20 "state2.T rate of change"; equation