Skip to content

Commit

Permalink
Utilize PressureRate unit
Browse files Browse the repository at this point in the history
  • Loading branch information
beutlich committed Jan 14, 2024
1 parent 7f46072 commit 770cbc2
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 56 deletions.
62 changes: 33 additions & 29 deletions Modelica/Electrical/Digital.mo
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ the library and has the following content:
annotation (
Documentation(info="<html>
<p>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.</p>
</html>"), experiment(StopTime=250));
</html>"), experiment(StopTime=25));
end FlipFlop;

model HalfAdder "Adding circuit for binary numbers without input carry bit"
Expand Down Expand Up @@ -1315,15 +1315,18 @@ sum <strong>Adder4</strong>.c_out <strong>Adder4.s</strong> <strong>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 (
Expand Down Expand Up @@ -1528,49 +1531,50 @@ sum <strong>Adder4</strong>.c_out <strong>Adder4.s</strong> <strong>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}})));
D.Basic.And And1(n=3) annotation (Placement(transformation(extent={{-70,
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="<html>
<p>Based on the <a href=\"modelica://Modelica.Electrical.Digital.Examples.Utilities.RS\">RS</a> 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.</p>
Expand Down
30 changes: 15 additions & 15 deletions Modelica/Media/Air/MoistAir.mo
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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);*/
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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";
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions Modelica/Media/Water/IF97_Utilities.mo
Original file line number Diff line number Diff line change
Expand Up @@ -3113,8 +3113,8 @@ email: [email protected]
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
Expand Down Expand Up @@ -3201,8 +3201,8 @@ email: [email protected]
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
Expand Down
16 changes: 8 additions & 8 deletions Modelica/Media/package.mo
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 770cbc2

Please sign in to comment.