diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/BoundaryConditions/FuelSourcePQ.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/BoundaryConditions/FuelSourcePQ.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/BoundaryConditions/FuelSourcePQ.mo"	2022-03-10 09:57:37.968144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/BoundaryConditions/FuelSourcePQ.mo"	2022-03-10 09:58:53.552153697 +0000
@@ -1,12 +1,12 @@
 within ThermoSysPro.Combustion.BoundaryConditions;
 model FuelSourcePQ "Fuel source with fixed pressure and mass flow rate"
-  parameter Modelica.SIunits.AbsolutePressure P0=1e5
+  parameter Modelica.Units.SI.AbsolutePressure P0=1e5
     "Fuel pressure (active if pressure input port is not connected)";
-  parameter Modelica.SIunits.MassFlowRate Q0=10
+  parameter Modelica.Units.SI.MassFlowRate Q0=10
     "Fuel mass flow rate (active if mass flow input port is not connected)";
-  parameter Modelica.SIunits.Temperature T0=300 "Fuel temperature";
-  parameter Modelica.SIunits.SpecificEnergy LHV=48e6 "Lower heating value";
-  parameter Modelica.SIunits.SpecificHeatCapacity Cp=1e3
+  parameter Modelica.Units.SI.Temperature T0=300 "Fuel temperature";
+  parameter Modelica.Units.SI.SpecificEnergy LHV=48e6 "Lower heating value";
+  parameter Modelica.Units.SI.SpecificHeatCapacity Cp=1e3
     "Fuel specific heat capacity at 273.15K";
   parameter Real Hum=0.0 "Fuel humidity (%)";
   parameter Real Xc=0.75 "C mass fraction";
@@ -16,7 +16,7 @@
   parameter Real Xs=0 "S mass fraction";
   parameter Real Xashes=0 "Ashes mass fraction";
   parameter Real Vol=0 "Volatile matter mass fraction";
-  parameter Modelica.SIunits.Density rho=0.72 "Fuel density";
+  parameter Modelica.Units.SI.Density rho=0.72 "Fuel density";
 
   Connectors.FuelOutlet C                   annotation (Placement(
         transformation(extent={{90,-10},{110,10}}, rotation=0)));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/CombustionChambers/GTCombustionChamber.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/CombustionChambers/GTCombustionChamber.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/CombustionChambers/GTCombustionChamber.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/CombustionChambers/GTCombustionChamber.mo"	2022-03-10 09:58:53.524153692 +0000
@@ -1,14 +1,14 @@
 within ThermoSysPro.Combustion.CombustionChambers;
 model GTCombustionChamber "Gas turbine combustion chamber"
   parameter Real kcham=1 "Pressure loss coefficient in the combustion chamber";
-  parameter Modelica.SIunits.Area Acham=1
+  parameter Modelica.Units.SI.Area Acham=1
     "Average corss-sectional area of the combusiton chamber";
   parameter Real eta_comb=1 "Combustion efficiency";
-  parameter Modelica.SIunits.Power Wpth=1e6
+  parameter Modelica.Units.SI.Power Wpth=1e6
     "Thermal loss fraction in the body of the combustion chamber";
   parameter Boolean air_atomisation=false
     "true: computation with air atomisation - false: computation without air atomisation";
-  parameter Modelica.SIunits.Temperature Tecpat=293
+  parameter Modelica.Units.SI.Temperature Tecpat=293
     "Temperature at the inlet of the atomisation compressor";
   parameter Real kat=0 "Atomisation pressure loss coefficient";
   parameter Real XQat=0 "Atomisation air mass flow rate coefficient";
@@ -27,79 +27,79 @@
   Real amSO2 "SO2 molecular mass";
   Real eta_isc(start=1)
     "Intermediate variable for the computation of the isentropic efficiency of the atomisaiton compressor";
-  Modelica.SIunits.Area Achamc(start=1)
+  Modelica.Units.SI.Area Achamc(start=1)
     "Intermediate variable for the computation of the average corss-section aera of the combusion chamber";
   Real XeaO2c(start=0.2)
     "Intermediate variable for the computation of the O2 mass fraction";
 
 public
-  Modelica.SIunits.MassFlowRate Qea(start=400) "Air mass flow rate";
-  Modelica.SIunits.AbsolutePressure Pea(start=1e5) "Air pressure at the inlet";
-  Modelica.SIunits.Temperature Tea(start=600) "Air temperature at the inlet";
-  Modelica.SIunits.SpecificEnthalpy Hea(start=50e3)
+  Modelica.Units.SI.MassFlowRate Qea(start=400) "Air mass flow rate";
+  Modelica.Units.SI.AbsolutePressure Pea(start=1e5) "Air pressure at the inlet";
+  Modelica.Units.SI.Temperature Tea(start=600) "Air temperature at the inlet";
+  Modelica.Units.SI.SpecificEnthalpy Hea(start=50e3)
     "Air specific enthalpy at the inlet";
   Real XeaCO2(start=0) "CO2 mass fraction at the air inlet";
   Real XeaH2O(start=0.1) "H2O mass fraction at the air inlet";
   Real XeaO2(start=0.2) "O2 mass fraction at the air inlet";
   Real XeaSO2(start=0) "SO2 mass fraction at the air inlet";
-  Modelica.SIunits.MassFlowRate Qfuel(start=5) "Fuel mass flow rate";
-  Modelica.SIunits.Temperature Tfuel(start=300) "Fuel temperature";
-  Modelica.SIunits.SpecificEnthalpy Hfuel(start=10e3) "Fuel specific enthalpy";
+  Modelica.Units.SI.MassFlowRate Qfuel(start=5) "Fuel mass flow rate";
+  Modelica.Units.SI.Temperature Tfuel(start=300) "Fuel temperature";
+  Modelica.Units.SI.SpecificEnthalpy Hfuel(start=10e3) "Fuel specific enthalpy";
   Real XCfuel(start=0.8) "C mass fraction in the fuel";
   Real XHfuel(start=0.2) "H mass fraction in the fuel";
   Real XOfuel(start=0) "O mass fraction in the fuel";
   Real XSfuel(start=0) "S mass fraction in the fuel";
-  Modelica.SIunits.SpecificEnergy LHVfuel(start=5e7) "Fuel lower heating value";
-  Modelica.SIunits.SpecificHeatCapacity Cpfuel(start=1000)
+  Modelica.Units.SI.SpecificEnergy LHVfuel(start=5e7) "Fuel lower heating value";
+  Modelica.Units.SI.SpecificHeatCapacity Cpfuel(start=1000)
     "Fuel specific heat capacity";
-  Modelica.SIunits.MassFlowRate Qews(start=1) "Water/steam mass flow rate";
-  Modelica.SIunits.SpecificEnthalpy Hews(start=10e3)
+  Modelica.Units.SI.MassFlowRate Qews(start=1) "Water/steam mass flow rate";
+  Modelica.Units.SI.SpecificEnthalpy Hews(start=10e3)
     "Water/steam specific enthalpy at the inlet";
-  Modelica.SIunits.MassFlowRate Qsf(start=400) "Flue gases mass flow rate";
-  Modelica.SIunits.AbsolutePressure Psf(start=12e5)
+  Modelica.Units.SI.MassFlowRate Qsf(start=400) "Flue gases mass flow rate";
+  Modelica.Units.SI.AbsolutePressure Psf(start=12e5)
     "Flue gases pressure at the outlet";
-  Modelica.SIunits.Temperature Tsf(start=1500)
+  Modelica.Units.SI.Temperature Tsf(start=1500)
     "Flue gases temperature at the outlet";
-  Modelica.SIunits.SpecificEnthalpy Hsf(start=50e4)
+  Modelica.Units.SI.SpecificEnthalpy Hsf(start=50e4)
     "Flue gases specific enthalpy at the outlet";
   Real XsfCO2(start=0.5) "CO2 mass fraction in the flue gases";
   Real XsfH2O(start=0.1) "H2O mass fraction in the flue gases";
   Real XsfO2(start=0) "O2 mass fraction in the flue gases";
   Real XsfSO2(start=0) "SO2 mass fraction in the flue gases";
-  Modelica.SIunits.Power Wfuel(start=5e8) "LHV power available in the fuel";
+  Modelica.Units.SI.Power Wfuel(start=5e8) "LHV power available in the fuel";
   Real exc(start=1) "Combustion air ratio";
   ThermoSysPro.Units.DifferentialPressure deltaPccb(start=1e3)
     "Pressure loss in the combusiton chamber";
-  Modelica.SIunits.SpecificEnthalpy Hrair(start=10e3)
+  Modelica.Units.SI.SpecificEnthalpy Hrair(start=10e3)
     "Air reference specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy Hrws(start=10e4)
+  Modelica.Units.SI.SpecificEnthalpy Hrws(start=10e4)
     "Water/steam reference specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy Hrfuel(start=10e3)
+  Modelica.Units.SI.SpecificEnthalpy Hrfuel(start=10e3)
     "Fuel reference specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy Hrfg(start=10e3)
+  Modelica.Units.SI.SpecificEnthalpy Hrfg(start=10e3)
     "Flue gases reference specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy Hecpat(start=10e3)
+  Modelica.Units.SI.SpecificEnthalpy Hecpat(start=10e3)
     "Air specific enthalpy at the inlet of the atomisaiton compressor";
-  Modelica.SIunits.SpecificEnthalpy Hiscpat(start=10e3)
+  Modelica.Units.SI.SpecificEnthalpy Hiscpat(start=10e3)
     "Air specific enthalpy after isentropic expansion at the outlet of the atomisaiotn compressor";
-  Modelica.SIunits.AbsolutePressure Pecpat(start=1e5)
+  Modelica.Units.SI.AbsolutePressure Pecpat(start=1e5)
     "Pressure at the inlet of the atomisation compressor";
-  Modelica.SIunits.AbsolutePressure Pscpat(start=1e5)
+  Modelica.Units.SI.AbsolutePressure Pscpat(start=1e5)
     "Pressure at the outlet of the atomisation compressor";
-  Modelica.SIunits.SpecificEntropy Secpat(start=1e3)
+  Modelica.Units.SI.SpecificEntropy Secpat(start=1e3)
     "Entropy at the inlet of the atomisation compressor";
-  Modelica.SIunits.MassFlowRate Qm(start=400)
+  Modelica.Units.SI.MassFlowRate Qm(start=400)
     "Average mass flow rate in the combustion chamber";
   Real Vea(start=0.001) "Air volume mass (m3/kg)";
   Real Vsf(start=0.001) "Flue gases volume mass (m3/kg)";
-  Modelica.SIunits.Density rhoea(start=0.001) "Air density at the inlet";
-  Modelica.SIunits.Density rhosf(start=0.001)
+  Modelica.Units.SI.Density rhoea(start=0.001) "Air density at the inlet";
+  Modelica.Units.SI.Density rhosf(start=0.001)
     "Flue gases density at the outlet";
   Real Vccbm(start=0.001) "Average volume mass in the combustion chamber";
-  Modelica.SIunits.Velocity v(start=100)
+  Modelica.Units.SI.Velocity v(start=100)
     "Flue gases reference velocity in the combusiton chamber";
-  Modelica.SIunits.Power Wcpat(start=1e3) "Power of the atomisation compressor";
-  Modelica.SIunits.Power Wrfat(start=1e3)
+  Modelica.Units.SI.Power Wcpat(start=1e3) "Power of the atomisation compressor";
+  Modelica.Units.SI.Power Wrfat(start=1e3)
     "Thermal power extracted by the atomisaiton refrigerant";
 public
   ThermoSysPro.Combustion.Connectors.FuelInlet Cfuel "Fuel inlet"
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/CombustionChambers/GenericCombustion.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/CombustionChambers/GenericCombustion.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/CombustionChambers/GenericCombustion.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/CombustionChambers/GenericCombustion.mo"	2022-03-10 09:58:53.480153687 +0000
@@ -2,16 +2,16 @@
 model GenericCombustion "Generic combustion chamber"
   parameter ThermoSysPro.Units.PressureLossCoefficient kcham=1
     "Pressure loss coefficient in the combustion chamber";
-  parameter Modelica.SIunits.Area Acham=1
+  parameter Modelica.Units.SI.Area Acham=1
     "Average corss-sectional area of the combusiton chamber";
   parameter Real Xpth=0.01
     "Thermal loss fraction in the body of the combustion chamber (0-1 over Q.HHV)";
   parameter Real ImbCV=0 "Unburnt particles ratio in the volatile ashes (0-1)";
   parameter Real ImbBF=0
     "Unburnt particle ratio in the low furnace ashes (0-1)";
-  parameter Modelica.SIunits.SpecificHeatCapacity Cpcd=500
+  parameter Modelica.Units.SI.SpecificHeatCapacity Cpcd=500
     "Ashes specific heat capacity";
-  parameter Modelica.SIunits.Temperature Tbf=500
+  parameter Modelica.Units.SI.Temperature Tbf=500
     "Ashes temperature at the outlet of the low furnace";
   parameter Real Xbf=0.1 "Ashes ration in the low furnace (0-1)";
 
@@ -20,79 +20,79 @@
   constant Real amH=1.00797 "Hydrogen atomic mass";
   constant Real amO=15.9994 "Oxygen atomic mass";
   constant Real amS=32.064 "Sulfur atomic mass";
-  constant Modelica.SIunits.SpecificEnergy HHVcarbone=32.8e6
+  constant Modelica.Units.SI.SpecificEnergy HHVcarbone=32.8e6
     "Unburnt carbon higher heating value";
   Real amCO2 "CO2 molecular mass";
   Real amH2O "H2O molecular mass";
   Real amSO2 "SO2 molecular mass";
 
 public
-  Modelica.SIunits.MassFlowRate Qea(start=400) "Air mass flow rate";
-  Modelica.SIunits.AbsolutePressure Pea(start=1e5) "Air pressure at the inlet";
-  Modelica.SIunits.Temperature Tea(start=600) "Air temperature at the inlet";
-  Modelica.SIunits.SpecificEnthalpy Hea(start=50e3)
+  Modelica.Units.SI.MassFlowRate Qea(start=400) "Air mass flow rate";
+  Modelica.Units.SI.AbsolutePressure Pea(start=1e5) "Air pressure at the inlet";
+  Modelica.Units.SI.Temperature Tea(start=600) "Air temperature at the inlet";
+  Modelica.Units.SI.SpecificEnthalpy Hea(start=50e3)
     "Air specific enthalpy at the inlet";
   Real XeaCO2(start=0) "CO2 mass fraction at the air inlet";
   Real XeaH2O(start=0.1) "H2O mass fraction at the air inlet";
   Real XeaO2(start=0.2) "O2 mass fraction at the air inlet";
   Real XeaSO2(start=0) "SO2 mass fraction at the air inlet";
-  Modelica.SIunits.MassFlowRate Qfuel(start=5) "Fuel mass flow rate";
-  Modelica.SIunits.Temperature Tfuel(start=300) "Fuel temperature";
-  Modelica.SIunits.SpecificEnthalpy Hfuel(start=10e3) "Fuel specific enthalpy";
+  Modelica.Units.SI.MassFlowRate Qfuel(start=5) "Fuel mass flow rate";
+  Modelica.Units.SI.Temperature Tfuel(start=300) "Fuel temperature";
+  Modelica.Units.SI.SpecificEnthalpy Hfuel(start=10e3) "Fuel specific enthalpy";
   Real XCfuel(start=0.8) "C mass fraction in the fuel";
   Real XHfuel(start=0.2) "H mass fraction in the fuel";
   Real XOfuel(start=0) "O mass fraction in the fuel";
   Real XSfuel(start=0) "S mass fraction in the fuel";
   Real Xwfuel(start=0) "H2O mass fraction in the fuel";
   Real XCDfuel(start=0) "Ashes mass fraction in the fuel";
-  Modelica.SIunits.SpecificEnergy LHVfuel(start=5e7) "Fuel lower heating value";
-  Modelica.SIunits.SpecificHeatCapacity Cpfuel(start=1000)
+  Modelica.Units.SI.SpecificEnergy LHVfuel(start=5e7) "Fuel lower heating value";
+  Modelica.Units.SI.SpecificHeatCapacity Cpfuel(start=1000)
     "Fuel specific heat capacity";
-  Modelica.SIunits.SpecificEnergy HHVfuel "Fuel higher heating value";
-  Modelica.SIunits.MassFlowRate Qews(start=1) "Water/steam mass flow rate";
-  Modelica.SIunits.SpecificEnthalpy Hews(start=10e3)
+  Modelica.Units.SI.SpecificEnergy HHVfuel "Fuel higher heating value";
+  Modelica.Units.SI.MassFlowRate Qews(start=1) "Water/steam mass flow rate";
+  Modelica.Units.SI.SpecificEnthalpy Hews(start=10e3)
     "Water/steam specific enthalpy at the inlet";
-  Modelica.SIunits.MassFlowRate Qsf(start=400) "Flue gases mass flow rate";
-  Modelica.SIunits.AbsolutePressure Psf(start=12e5)
+  Modelica.Units.SI.MassFlowRate Qsf(start=400) "Flue gases mass flow rate";
+  Modelica.Units.SI.AbsolutePressure Psf(start=12e5)
     "Flue gases pressure at the outlet";
-  Modelica.SIunits.Temperature Tsf(start=1500)
+  Modelica.Units.SI.Temperature Tsf(start=1500)
     "Flue gases temperature at the outlet";
-  Modelica.SIunits.SpecificEnthalpy Hsf(start=50e4)
+  Modelica.Units.SI.SpecificEnthalpy Hsf(start=50e4)
     "Flue gases specific enthalpy at the outlet";
   Real XsfCO2(start=0.5) "CO2 mass fraction in the flue gases";
   Real XsfH2O(start=0.1) "H2O mass fraction in the flue gases";
   Real XsfO2(start=0) "O2 mass fraction in the flue gases";
   Real XsfSO2(start=0) "SO2 mass fraction in the flue gases";
-  Modelica.SIunits.Power Wfuel(start=5e8) "LHV power available in the fuel";
-  Modelica.SIunits.Power Wpth(start=1e6) "Thermal losses power";
+  Modelica.Units.SI.Power Wfuel(start=5e8) "LHV power available in the fuel";
+  Modelica.Units.SI.Power Wpth(start=1e6) "Thermal losses power";
   Real exc(start=1) "Combustion air ratio";
-  Modelica.SIunits.MassFlowRate Qcv(start=1) "Volatile ashes mass flow rate";
-  Modelica.SIunits.MassFlowRate Qbf(start=1) "Low furnace ashes mass flow rate";
-  Modelica.SIunits.SpecificEnthalpy Hcv(start=10e3)
+  Modelica.Units.SI.MassFlowRate Qcv(start=1) "Volatile ashes mass flow rate";
+  Modelica.Units.SI.MassFlowRate Qbf(start=1) "Low furnace ashes mass flow rate";
+  Modelica.Units.SI.SpecificEnthalpy Hcv(start=10e3)
     "Volatile ashes specific enthalpy at the outlet";
-  Modelica.SIunits.SpecificEnthalpy Hbf(start=10e3)
+  Modelica.Units.SI.SpecificEnthalpy Hbf(start=10e3)
     "Low furnace ashes specific enthalpy at the outlet";
   ThermoSysPro.Units.DifferentialPressure deltaPccb(start=1e3)
     "Pressure loss in the combustion chamber";
-  Modelica.SIunits.SpecificEnthalpy Hrair(start=10e3)
+  Modelica.Units.SI.SpecificEnthalpy Hrair(start=10e3)
     "Air reference specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy Hrws(start=10e4)
+  Modelica.Units.SI.SpecificEnthalpy Hrws(start=10e4)
     "Water/steam reference specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy Hrfuel(start=10e3)
+  Modelica.Units.SI.SpecificEnthalpy Hrfuel(start=10e3)
     "Fuel reference specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy Hrcd(start=10e3)
+  Modelica.Units.SI.SpecificEnthalpy Hrcd(start=10e3)
     "Ashes reference specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy Hrfg(start=10e3)
+  Modelica.Units.SI.SpecificEnthalpy Hrfg(start=10e3)
     "Flue gases reference specific enthalpy";
   Real Vea(start=0.001) "Air volume mass (m3/kg)";
   Real Vsf(start=0.001) "Flue gases volume mass (m3/kg)";
-  Modelica.SIunits.Density rhoea(start=0.001) "Air density at the inlet";
-  Modelica.SIunits.Density rhosf(start=0.001)
+  Modelica.Units.SI.Density rhoea(start=0.001) "Air density at the inlet";
+  Modelica.Units.SI.Density rhosf(start=0.001)
     "Flue gases density at the outlet";
-  Modelica.SIunits.MassFlowRate Qm(start=400)
+  Modelica.Units.SI.MassFlowRate Qm(start=400)
     "Average mlass flow rate in the combusiton chamber";
   Real Vccbm(start=0.001) "Average volume mass in the combustion chamber";
-  Modelica.SIunits.Velocity v(start=100)
+  Modelica.Units.SI.Velocity v(start=100)
     "Flue gases reference velocity in the combusiton chamber";
 public
   ThermoSysPro.Combustion.Connectors.FuelInlet Cfuel "Fuel inlet"
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/CombustionChambers/GenericCombustion1D.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/CombustionChambers/GenericCombustion1D.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/CombustionChambers/GenericCombustion1D.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/CombustionChambers/GenericCombustion1D.mo"	2022-03-10 09:58:53.400153678 +0000
@@ -3,10 +3,10 @@
 
   parameter Integer NCEL = 7;
 
-  parameter Modelica.SIunits.Area Acham=1
+  parameter Modelica.Units.SI.Area Acham=1
     "Average cross-sectional area of the combusition chamber";
   //parameter Modelica.SIunits.Area SM[NCEL] = {639.92,198.58,466.48,466.48,466.48,523.79,523.79}
-  parameter Modelica.SIunits.Area SM[NCEL] = fill(100, NCEL)
+  parameter Modelica.Units.SI.Area SM[NCEL] = fill(100, NCEL)
     "Heat exchange area for the node i = projetee )";
   parameter Real RSURF[NCEL] = cat(1,{1.321},fill(1.409,NCEL - 1))
     "Reel surface/projetee surface ";
@@ -17,23 +17,22 @@
   parameter Real ImbCV=0 "Unburnt particles ratio in the volatile ashes (0-1)";
   parameter Real ImbBF=0
     "Unburnt particle ratio in the low furnace ashes (0-1)";
-  parameter Modelica.SIunits.SpecificHeatCapacity Cpcd=500
+  parameter Modelica.Units.SI.SpecificHeatCapacity Cpcd=500
     "Ashes specific heat capacity";
-  parameter Modelica.SIunits.Temperature Tbf=500
+  parameter Modelica.Units.SI.Temperature Tbf=500
     "Ashes temperature at the outlet of the low furnace";
   parameter Real Xbf=0.1 "Ashes ration in the low furnace (0-1)";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer Kec= 50
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer Kec= 50
     "Convection and conduction(fouling) heat exchange coefficient";
   parameter Real EPSPAR = 0.6 "Combustion chamber walls emissivity";
-  //parameter Real hrCorr=1.00 "Corrective term for ratiation heat exchange";
-
+  //parameter Real hrCorr=1.00 "Corrective term for ratiation heat exchange";
 protected
   constant Real SIGMA = 5.669e-8 "Boltzman constant W/m^2/K^4";
   constant Real amC=12.01115 "Carbon atomic mass";
   constant Real amH=1.00797 "Hydrogen atomic mass";
   constant Real amO=15.9994 "Oxygen atomic mass";
   constant Real amS=32.064 "Sulfur atomic mass";
-  constant Modelica.SIunits.SpecificEnergy HHVcarbone=32.8e6
+  constant Modelica.Units.SI.SpecificEnergy HHVcarbone=32.8e6
     "Unburnt carbon higher heating value, CO2 = 3.2791664E+07";
   constant Real RAD = 0.017453293 "pi/180";
   Real amCO2 "CO2 molecular mass";
@@ -41,81 +40,81 @@
   Real amSO2 "SO2 molecular mass";
 
 public
-  Modelica.SIunits.MassFlowRate Qea(start=400) "Air mass flow rate";
-  Modelica.SIunits.AbsolutePressure Pea(start=1e5) "Air pressure at the inlet";
-  Modelica.SIunits.Temperature Tea(start=600) "Air temperature at the inlet";
-  Modelica.SIunits.SpecificEnthalpy Hea(start=50e3)
+  Modelica.Units.SI.MassFlowRate Qea(start=400) "Air mass flow rate";
+  Modelica.Units.SI.AbsolutePressure Pea(start=1e5) "Air pressure at the inlet";
+  Modelica.Units.SI.Temperature Tea(start=600) "Air temperature at the inlet";
+  Modelica.Units.SI.SpecificEnthalpy Hea(start=50e3)
     "Air specific enthalpy at the inlet";
   Real XeaCO2(start=0) "CO2 mass fraction at the air inlet";
   Real XeaH2O(start=0.1) "H2O mass fraction at the air inlet";
   Real XeaO2(start=0.2) "O2 mass fraction at the air inlet";
   Real XeaSO2(start=0) "SO2 mass fraction at the air inlet";
-  Modelica.SIunits.MassFlowRate Qfuel(start=5) "Fuel mass flow rate";
-  Modelica.SIunits.Temperature Tfuel(start=300) "Fuel temperature";
-  Modelica.SIunits.SpecificEnthalpy Hfuel(start=10e3) "Fuel specific enthalpy";
+  Modelica.Units.SI.MassFlowRate Qfuel(start=5) "Fuel mass flow rate";
+  Modelica.Units.SI.Temperature Tfuel(start=300) "Fuel temperature";
+  Modelica.Units.SI.SpecificEnthalpy Hfuel(start=10e3) "Fuel specific enthalpy";
   Real XCfuel(start=0.8) "C mass fraction in the fuel /pur";
   Real XHfuel(start=0.2) "H mass fraction in the fuel /pur";
   Real XOfuel(start=0) "O mass fraction in the fuel /pur";
   Real XSfuel(start=0) "S mass fraction in the fuel /pur";
   Real Xwfuel(start=0) "H2O mass fraction in the fuel";
   Real XCDfuel(start=0) "Ashes mass fraction in the fuel /Dryer";
-  Modelica.SIunits.SpecificEnergy LHVfuel_D(start=5e7)
+  Modelica.Units.SI.SpecificEnergy LHVfuel_D(start=5e7)
     "Fuel lower heating value /Dryer";
-  Modelica.SIunits.SpecificEnergy LHVfuel(start=5e7)
+  Modelica.Units.SI.SpecificEnergy LHVfuel(start=5e7)
     "Fuel lower heating value /Brut";
-  Modelica.SIunits.SpecificHeatCapacity Cpfuel(start=1000)
+  Modelica.Units.SI.SpecificHeatCapacity Cpfuel(start=1000)
     "Fuel specific heat capacity";
-  Modelica.SIunits.SpecificEnergy HHVfuel "Fuel higher heating value";
-  Modelica.SIunits.MassFlowRate Qews(start=1) "Water/steam mass flow rate";
-  Modelica.SIunits.SpecificEnthalpy Hews(start=10e3)
+  Modelica.Units.SI.SpecificEnergy HHVfuel "Fuel higher heating value";
+  Modelica.Units.SI.MassFlowRate Qews(start=1) "Water/steam mass flow rate";
+  Modelica.Units.SI.SpecificEnthalpy Hews(start=10e3)
     "Water/steam specific enthalpy at the inlet";
-  Modelica.SIunits.MassFlowRate Qsf(start=400) "Flue gases mass flow rate";
-  Modelica.SIunits.AbsolutePressure Psf(start=12e5)
+  Modelica.Units.SI.MassFlowRate Qsf(start=400) "Flue gases mass flow rate";
+  Modelica.Units.SI.AbsolutePressure Psf(start=12e5)
     "Flue gases pressure at the outlet";
-  Modelica.SIunits.Temperature Tsf(start=1500)
+  Modelica.Units.SI.Temperature Tsf(start=1500)
     "Flue gases temperature at the outlet";
-  Modelica.SIunits.SpecificEnthalpy Hsf(start=50e4)
+  Modelica.Units.SI.SpecificEnthalpy Hsf(start=50e4)
     "Flue gases specific enthalpy at the outlet";
   Real XsfCO2(start=0.5) "CO2 mass fraction in the flue gases";
   Real XsfH2O(start=0.1) "H2O mass fraction in the flue gases";
   Real XsfO2(start=0) "O2 mass fraction in the flue gases";
   Real XsfSO2(start=0) "SO2 mass fraction in the flue gases";
   //////////////////////Modelica.SIunits.Power Wfuel(start=5e8) "LHV power available in the fuel";
-  Modelica.SIunits.Power Wpth(start=1e6) "Thermal losses power";
+  Modelica.Units.SI.Power Wpth(start=1e6) "Thermal losses power";
   Real exc(start=1) "Combustion air ratio";
-  Modelica.SIunits.MassFlowRate Qcv(start=1) "Volatile ashes mass flow rate";
-  Modelica.SIunits.MassFlowRate Qbf(start=1) "Low furnace ashes mass flow rate";
-  Modelica.SIunits.SpecificEnthalpy Hcv(start=10e3)
+  Modelica.Units.SI.MassFlowRate Qcv(start=1) "Volatile ashes mass flow rate";
+  Modelica.Units.SI.MassFlowRate Qbf(start=1) "Low furnace ashes mass flow rate";
+  Modelica.Units.SI.SpecificEnthalpy Hcv(start=10e3)
     "Volatile ashes specific enthalpy at the outlet";
-  Modelica.SIunits.SpecificEnthalpy Hbf(start=10e3)
+  Modelica.Units.SI.SpecificEnthalpy Hbf(start=10e3)
     "Low furnace ashes specific enthalpy at the outlet";
   ThermoSysPro.Units.DifferentialPressure deltaPccb(start=1e3)
     "Pressure loss in the combustion chamber";
-  Modelica.SIunits.SpecificEnthalpy Hrair(start=10e3)
+  Modelica.Units.SI.SpecificEnthalpy Hrair(start=10e3)
     "Air reference specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy Hrws(start=10e4)
+  Modelica.Units.SI.SpecificEnthalpy Hrws(start=10e4)
     "Water/steam reference specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy Hrfuel(start=10e3)
+  Modelica.Units.SI.SpecificEnthalpy Hrfuel(start=10e3)
     "Fuel reference specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy Hrcd(start=10e3)
+  Modelica.Units.SI.SpecificEnthalpy Hrcd(start=10e3)
     "Ashes reference specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy Hrfg(start=10e3)
+  Modelica.Units.SI.SpecificEnthalpy Hrfg(start=10e3)
     "Flue gases reference specific enthalpy";
   Real Vea(start=0.001) "Air volume mass (m3/kg)";
   Real Vsf(start=0.001) "Flue gases volume mass (m3/kg)";
-  Modelica.SIunits.Density rhoea(start=0.001) "Air density at the inlet";
-  Modelica.SIunits.Density rhosf(start=0.001)
+  Modelica.Units.SI.Density rhoea(start=0.001) "Air density at the inlet";
+  Modelica.Units.SI.Density rhosf(start=0.001)
     "Flue gases density at the outlet";
-  Modelica.SIunits.MassFlowRate Qm(start=400)
+  Modelica.Units.SI.MassFlowRate Qm(start=400)
     "Average mlass flow rate in the combusiton chamber";
   Real Vccbm(start=0.001) "Average volume mass in the combustion chamber";
-  Modelica.SIunits.Velocity v(start=100)
+  Modelica.Units.SI.Velocity v(start=100)
     "Flue gases reference velocity in the combusiton chamber";
-  Modelica.SIunits.Temperature Tpi[NCEL](start=fill(400, NCEL))
+  Modelica.Units.SI.Temperature Tpi[NCEL](start=fill(400, NCEL))
     "Wall temperature for node i";
-  Modelica.SIunits.Power Ws[NCEL]( start=fill(10e6,NCEL))
+  Modelica.Units.SI.Power Ws[NCEL]( start=fill(10e6,NCEL))
     "Power delivered to each segment";
-  Modelica.SIunits.Power Wst( start = 50.e6)
+  Modelica.Units.SI.Power Wst( start = 50.e6)
     "Total power exchanged on all segment";
 
 public
@@ -199,11 +198,10 @@
   Qbf = Qfuel*XCDfuel*Xbf/(1 - ImbBF);
 
   /* CO2 flue gases mass fraction */
-  XsfCO2*Qsf = (Qea*XeaCO2) + ((Qfuel*XCfuel - Qcv*ImbCV - Qbf*ImbBF)*amCO2/amC);
-
-  /* H2O flue gases mass fraction */
-  //XsfH2O*Qsf = Qews + (Qea*XeaH2O+Qfuel*XHfuel* amH2O/2 /amH);
-  XsfH2O*Qsf = Qews + (Qea*XeaH2O+Qfuel*XHfuel* amH2O/2 /amH)+Xwfuel*Qfuel;
+  XsfCO2*Qsf = (Qea*XeaCO2) + ((Qfuel*XCfuel - Qcv*ImbCV - Qbf*ImbBF)*amCO2/amC);
+/* H2O flue gases mass fraction */
+//XsfH2O*Qsf = Qews + (Qea*XeaH2O+Qfuel*XHfuel* amH2O/2 /amH);
+  XsfH2O * Qsf = Qews + Qea * XeaH2O + Qfuel * XHfuel * amH2O / 2 / amH + Xwfuel * Qfuel;
 
   /* O2 flue gases mass fraction */
   XsfO2*Qsf = (Qea*XeaO2) - (Qfuel*amO*(2*XCfuel/amC + 0.5*XHfuel/amH + 2*XSfuel/amS)) + (Qfuel*XOfuel);
@@ -223,10 +221,9 @@
   /* Combusiton air ratio */
   exc = Qea*(1 - XeaH2O)/
         ((Qfuel*amO*(2*XCfuel/amC + 0.5*XHfuel/amH + 2*XSfuel/amS - XOfuel/amO) -
-         Qfuel*amO*2*(Qcv*ImbCV + Qbf*ImbBF)/amC)/(XeaO2/(1 - XeaH2O)));
-//  exc = Qea*(1 - XeaH2O)/((Qfuel*amO*(2*XCfuel/amC + 0.5*XHfuel/amH + 2*XSfuel/amS - XOfuel/amO))/(XeaO2c/(1 - XeaH2O)));
-
-  /* Pressure losses */
+         Qfuel*amO*2*(Qcv*ImbCV + Qbf*ImbBF)/amC)/(XeaO2/(1 - XeaH2O)));
+//  exc = Qea*(1 - XeaH2O)/((Qfuel*amO*(2*XCfuel/amC + 0.5*XHfuel/amH + 2*XSfuel/amS - XOfuel/amO))/(XeaO2c/(1 - XeaH2O)));
+/* Pressure losses */
   Pea - Psf = deltaPccb;
   Qm = (Qea + Qfuel + Qews)/2;
   Vccbm = (Vea + Vsf)/2;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/CombustionChambers/GridFurnace.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/CombustionChambers/GridFurnace.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/CombustionChambers/GridFurnace.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/CombustionChambers/GridFurnace.mo"	2022-03-10 09:58:53.340153669 +0000
@@ -1,13 +1,13 @@
-﻿within ThermoSysPro.Combustion.CombustionChambers;
+within ThermoSysPro.Combustion.CombustionChambers;
 model GridFurnace "Combustion furnace"
   parameter Real X2eap=0.1 "Primary air fraction in zone 2";
   parameter Real X3eap=0.1 "Primary air fraction in zone 3";
   parameter Real XCleom=0 "Cl mass fraction in the biomass";
   parameter Real XFeom=0 "F mass fraction in the biomass";
   parameter Real XMACHeom=0 "machefers mass fraction in the biomass";
-  parameter Modelica.SIunits.Density rhoCENDom=0.5
+  parameter Modelica.Units.SI.Density rhoCENDom=0.5
     "Density of the ashes in the biomass";
-  parameter Modelica.SIunits.Temperature Tfrecirc=600
+  parameter Modelica.Units.SI.Temperature Tfrecirc=600
     "Temperature of the recirculated flue gases";
   parameter Real XfCO2recirc=0.3
     "CO2 mass fraction in the recirculated flue gases";
@@ -18,17 +18,17 @@
   parameter Real XfSO2recirc=0
     "SO2 mass fraction in the recirculated flue gases";
   parameter Real Xrecirc=0.1 "Recirculated flue gases fraction in Qsf";
-  parameter Modelica.SIunits.SpecificHeatCapacity CpMACH=500
+  parameter Modelica.Units.SI.SpecificHeatCapacity CpMACH=500
     "Clinker average specific heat capacity";
-  parameter Modelica.SIunits.SpecificHeatCapacity CpMACHs2=500
+  parameter Modelica.Units.SI.SpecificHeatCapacity CpMACHs2=500
     "Clinker specific heat capacity at the outlet of zone 2";
-  parameter Modelica.SIunits.SpecificHeatCapacity CpMACHs3=500
+  parameter Modelica.Units.SI.SpecificHeatCapacity CpMACHs3=500
     "Clinker specific heat capacity at the outlet of zone 3";
-  parameter Modelica.SIunits.SpecificHeatCapacity CpMACHs4=500
+  parameter Modelica.Units.SI.SpecificHeatCapacity CpMACHs4=500
     "Clinker specific heat capacity at the outlet of zone 4";
-  parameter Modelica.SIunits.Temperature TsjeMACH=293
+  parameter Modelica.Units.SI.Temperature TsjeMACH=293
     "Clinker temperature at the outlet of the water seal";
-  parameter Modelica.SIunits.Temperature Teeje=293
+  parameter Modelica.Units.SI.Temperature Teeje=293
     "Water temperature at the outlet of the water seal";
   parameter Real XsjeH2OMACH=0.2
     "Clinker humidity at the outlet of the water seal";
@@ -36,46 +36,46 @@
   parameter Integer jointeau=0 "1: with water seal - 0: without water seal";
   parameter Real XCvol=0 "Volatile carbon fraction";
   parameter Real XCimb=0 "Unburnt carbon fraction";
-  parameter Modelica.SIunits.Temperature T1sfm=500
+  parameter Modelica.Units.SI.Temperature T1sfm=500
     "Flue gases temperature at the outlet of zone 1";
   parameter Real Eray2=0.1
     "Energy fraction radiated towards zone 2 of the furnace";
   parameter Real Eray5=0.1
     "Energy fraction radiated towards zone 5 of the furnac";
   parameter Real perte=0 "Loss percent of LHV";
-  parameter Modelica.SIunits.SpecificHeatCapacity Cp3CO=500
+  parameter Modelica.Units.SI.SpecificHeatCapacity Cp3CO=500
     "CO specific heat capacity in zone 3";
 
 public
-  Modelica.SIunits.MassFlowRate Qsf(start=10)
+  Modelica.Units.SI.MassFlowRate Qsf(start=10)
     "Flue gases mass flow rate at the outlet";
-  Modelica.SIunits.AbsolutePressure Psf(start=1e5)
+  Modelica.Units.SI.AbsolutePressure Psf(start=1e5)
     "Flue gases pressure at the outlet";
-  Modelica.SIunits.Temperature Tsf(start=1000)
+  Modelica.Units.SI.Temperature Tsf(start=1000)
     "Flue gases temperature at the outlet";
   Real XsfN2(start=0.6) "Flue gases N2 mass fraction at the outlet";
   Real XsfCO2(start=0.1) "Flue gases CO2 mass fraction at the outlet";
   Real XsfH2O(start=0.1) "Flue gases H2O mass fraction at the outlet";
   Real XsfO2(start=0.1) "Flue gases O2 mass fraction at the outlet";
   Real XsfSO2(start=0.1) "Flue gases SO2 mass fraction at the outlet";
-  Modelica.SIunits.MassFlowRate Qeap(start=10) "Primary air mass flow rate";
-  Modelica.SIunits.AbsolutePressure Peap(start=1e5) "Primary air pressure";
-  Modelica.SIunits.Temperature Teap(start=300) "Primary air temperature";
+  Modelica.Units.SI.MassFlowRate Qeap(start=10) "Primary air mass flow rate";
+  Modelica.Units.SI.AbsolutePressure Peap(start=1e5) "Primary air pressure";
+  Modelica.Units.SI.Temperature Teap(start=300) "Primary air temperature";
   Real XeapN2(start=0.6) "Primary air N2 mass fraction";
   Real XeapCO2(start=0.1) "Primary air CO2 mass fraction";
   Real XeapH2O(start=0.1) "Primary air H2O mass fraction";
   Real XeapO2(start=0.1) "Primary air O2 mass fraction";
   Real XeapSO2(start=0.1) "Primary air SO2 mass fraction";
-  Modelica.SIunits.MassFlowRate Qeas(start=10) "Secondary air mass flow rate";
-  Modelica.SIunits.AbsolutePressure Peas(start=1e5) "Secondary air pressure";
-  Modelica.SIunits.Temperature Teas(start=300) "Secondary air temperature";
+  Modelica.Units.SI.MassFlowRate Qeas(start=10) "Secondary air mass flow rate";
+  Modelica.Units.SI.AbsolutePressure Peas(start=1e5) "Secondary air pressure";
+  Modelica.Units.SI.Temperature Teas(start=300) "Secondary air temperature";
   Real XeasN2(start=0.6) "Secondary air N2 mass fraction";
   Real XeasCO2(start=0.1) "Secondary air CO2 mass fraction";
   Real XeasH2O(start=0.1) "Secondary air H2O mass fraction";
   Real XeasO2(start=0.1) "Secondaryr O2 mass fraction";
   Real XeasSO2(start=0.1) "Secondary SO2 mass fraction";
-  Modelica.SIunits.MassFlowRate Qeom(start=10) "Biomass mass flow rate";
-  Modelica.SIunits.Temperature Teom(start=300) "Biomass temperature";
+  Modelica.Units.SI.MassFlowRate Qeom(start=10) "Biomass mass flow rate";
+  Modelica.Units.SI.Temperature Teom(start=300) "Biomass temperature";
   Real PCIom(start=1e6) "Biomass LHV (J/kg)";
   Real XCeom(start=0.1) "Biomass C mass fraction";
   Real XHeom(start=0.1) "Biomass H mass fraction";
@@ -84,62 +84,62 @@
   Real XSeom(start=0.1) "Biomass S mass fraction";
   Real XCENDeom(start=0.1) "Biomass ashes mass fraction";
   Real XH2Oeom(start=0.1) "Biomass humidity";
-  Modelica.SIunits.SpecificHeatCapacity Cpom(start=1000)
+  Modelica.Units.SI.SpecificHeatCapacity Cpom(start=1000)
     "Biomass specific heat capacity";
-  Modelica.SIunits.MassFlowRate Qerefo(start=10) "Cooling water mass flow rate";
-  Modelica.SIunits.SpecificEnthalpy Herefo(start=10e3)
+  Modelica.Units.SI.MassFlowRate Qerefo(start=10) "Cooling water mass flow rate";
+  Modelica.Units.SI.SpecificEnthalpy Herefo(start=10e3)
     "Cooling water specific enthalpy";
-  Modelica.SIunits.MassFlowRate Qfrecirc(start=10)
+  Modelica.Units.SI.MassFlowRate Qfrecirc(start=10)
     "Recirculated flue gases mass flow rate";
   Real XsfN2recirc(start=0.1) "Recirculated flue gases N2 mass fraction";
   Real PCIMACH(start=10e6) "Clinker LHV";
-  Modelica.SIunits.MassFlowRate QsMACH(start=10) "Clinker mass flow rate";
-  Modelica.SIunits.Temperature TsMACH(start=500) "Clinket temperature";
+  Modelica.Units.SI.MassFlowRate QsMACH(start=10) "Clinker mass flow rate";
+  Modelica.Units.SI.Temperature TsMACH(start=500) "Clinket temperature";
   Real FVN(start=0.1) "Volatile ashes mass fraction";
-  Modelica.SIunits.Density rhocend(start=500) "Ashes density in the flue gases";
-  Modelica.SIunits.Power Wsr(start=10e6) "Radiated power";
+  Modelica.Units.SI.Density rhocend(start=500) "Ashes density in the flue gases";
+  Modelica.Units.SI.Power Wsr(start=10e6) "Radiated power";
   Real excair(start=0.1) "Combustion excess air";
 
 protected
-  constant Modelica.SIunits.SpecificEnthalpy H0v=2501551.43
+  constant Modelica.Units.SI.SpecificEnthalpy H0v=2501551.43
     "Vaporisation energy at 0°C";
-  constant Modelica.SIunits.SpecificEnthalpy HfCO2=3.2791664e7
+  constant Modelica.Units.SI.SpecificEnthalpy HfCO2=3.2791664e7
     "CO2 formation enthalpy";
-  constant Modelica.SIunits.SpecificEnthalpy HfCO=9.201e6
+  constant Modelica.Units.SI.SpecificEnthalpy HfCO=9.201e6
     "CO formation enthalpy";
-  constant Modelica.SIunits.SpecificEnthalpy HfH2Og=13.433333e6
+  constant Modelica.Units.SI.SpecificEnthalpy HfH2Og=13.433333e6
     "H2Og formation enthalpy";
-  constant Modelica.SIunits.SpecificEnthalpy HfSO2=4.6302650e6
+  constant Modelica.Units.SI.SpecificEnthalpy HfSO2=4.6302650e6
     "SO2 formation enthalpy";
-  constant Modelica.SIunits.SpecificEnthalpy HfH2Ol=15.883300e6
+  constant Modelica.Units.SI.SpecificEnthalpy HfH2Ol=15.883300e6
     "H2Ol formation enthalpy";
 
 public
   Real X1eap(start=0.1) "Primary air fraction in zone 1";
-  Modelica.SIunits.MassFlowRate Q1eap(start=10)
+  Modelica.Units.SI.MassFlowRate Q1eap(start=10)
     "Primary mass flow rate in zone 1";
-  Modelica.SIunits.MassFlowRate Q2eap(start=10)
+  Modelica.Units.SI.MassFlowRate Q2eap(start=10)
     "Primary mass flow rate in zone 2";
-  Modelica.SIunits.MassFlowRate Q3eap(start=10)
+  Modelica.Units.SI.MassFlowRate Q3eap(start=10)
     "Primary mass flow rate in zone 3";
   Real XCvol2(start=0.1) "C mass fraction burnt in zone 2";
   Real XMACHimb(start=0.1) "C mass raction unburnt in the clinker";
   Real XCvol3(start=0.1) "C mass fraction burnt in zone 3";
 
 //Zone1
-  Modelica.SIunits.SpecificEnthalpy Heap(start=1e3)
+  Modelica.Units.SI.SpecificEnthalpy Heap(start=1e3)
     "Humid air specific enthalpy at the primary air temperature";
-  Modelica.SIunits.SpecificEnthalpy Heas(start=1e3)
+  Modelica.Units.SI.SpecificEnthalpy Heas(start=1e3)
     "Humid air specific enthalpy at the secondary air temperature";
-  Modelica.SIunits.SpecificEnthalpy H1a(start=1e3)
+  Modelica.Units.SI.SpecificEnthalpy H1a(start=1e3)
     "Primary air specific enthalpy at T1sfm";
-  Modelica.SIunits.SpecificEnthalpy Hefrecirc(start=1e3)
+  Modelica.Units.SI.SpecificEnthalpy Hefrecirc(start=1e3)
     "Specific enthalpy of the incoming recirculated flue gases";
-  Modelica.SIunits.MassFlowRate Qeasm(start=10)
+  Modelica.Units.SI.MassFlowRate Qeasm(start=10)
     "Mass flow rate of the secondary air / recirculated flue gases mixture";
-  Modelica.SIunits.SpecificEnthalpy Heasm(start=1e3)
+  Modelica.Units.SI.SpecificEnthalpy Heasm(start=1e3)
     "Specific enthalpy of the secondary air / recirculated flue gases mixture";
-  Modelica.SIunits.Temperature Teasm(start=500)
+  Modelica.Units.SI.Temperature Teasm(start=500)
     "Temperature of the secondary air / recirculated flue gases mixture";
   Real XeasmO2(start=0.1)
     "O2 mass fraction in the secondary air / recirculated flue gases mixture";
@@ -153,43 +153,43 @@
     "N2 mass fraction in the secondary air / recirculated flue gases mixture";
   Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
-  Modelica.SIunits.SpecificEnthalpy Heauom(start=1e3)
+  Modelica.Units.SI.SpecificEnthalpy Heauom(start=1e3)
     "Biomass water specific enthalpy";
-  Modelica.SIunits.AbsolutePressure Psateom(start=1e5)
+  Modelica.Units.SI.AbsolutePressure Psateom(start=1e5)
     "Water saturation presure at Teom";
-  Modelica.SIunits.SpecificEnthalpy Hvteom(start=10e3)
+  Modelica.Units.SI.SpecificEnthalpy Hvteom(start=10e3)
     "Steam saturation specific enthalpy at Teom";
-  Modelica.SIunits.SpecificEnthalpy Hlteom(start=10e3)
+  Modelica.Units.SI.SpecificEnthalpy Hlteom(start=10e3)
     "Water saturation specific enthalpy at Teom";
-  Modelica.SIunits.SpecificEnthalpy Hvapteom(start=10e3)
+  Modelica.Units.SI.SpecificEnthalpy Hvapteom(start=10e3)
     "Phase transition energy at Teom";
-  Modelica.SIunits.SpecificEnthalpy Hs1vom(start=1e3)
+  Modelica.Units.SI.SpecificEnthalpy Hs1vom(start=1e3)
     "Water specific enthalpy of the outgoing biomass at T1sfm vapor";
-  Modelica.SIunits.SpecificEnthalpy Heom(start=1e3)
+  Modelica.Units.SI.SpecificEnthalpy Heom(start=1e3)
     "Biomass specific enthalpy at the inlet";
-  Modelica.SIunits.Power Wff(start=1e6) "Flue gases formation energy";
-  Modelica.SIunits.Power Wp(start=1e6) "Biomass pyrolysis power";
-  Modelica.SIunits.Power Wimbp(start=1e6)
+  Modelica.Units.SI.Power Wff(start=1e6) "Flue gases formation energy";
+  Modelica.Units.SI.Power Wp(start=1e6) "Biomass pyrolysis power";
+  Modelica.Units.SI.Power Wimbp(start=1e6)
     "Power saved in the combustion flue gases due to the non-destruction of unburnt C";
-  Modelica.SIunits.Power Wimbm(start=1e6)
+  Modelica.Units.SI.Power Wimbm(start=1e6)
     "Power lost by the combustion flue gases due to the non-combustion of unburnt C";
-  Modelica.SIunits.SpecificEnthalpy Hpyr(start=1e3)
+  Modelica.Units.SI.SpecificEnthalpy Hpyr(start=1e3)
     "Pyrolysis specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy H1om(start=1e3)
+  Modelica.Units.SI.SpecificEnthalpy H1om(start=1e3)
     "Specific enthalpy of the dry biomass at the pyrolysis temperature of the biomass";
-  Modelica.SIunits.MassFlowRate Q1H2O(start=10)
+  Modelica.Units.SI.MassFlowRate Q1H2O(start=10)
     "H2O mass flow rate at the oultet of zone 1";
-  Modelica.SIunits.MassFlowRate Q1O2(start=10)
+  Modelica.Units.SI.MassFlowRate Q1O2(start=10)
     "O2 mass flow rate at the oultet of zone 1";
-  Modelica.SIunits.MassFlowRate Q1N2(start=10)
+  Modelica.Units.SI.MassFlowRate Q1N2(start=10)
     "N2 mass flow rate at the oultet of zone 1";
-  Modelica.SIunits.MassFlowRate Q1CO2(start=10)
+  Modelica.Units.SI.MassFlowRate Q1CO2(start=10)
     "CO2 mass flow rate at the oultet of zone 1";
-  Modelica.SIunits.MassFlowRate Q1SO2(start=10)
+  Modelica.Units.SI.MassFlowRate Q1SO2(start=10)
     "SO2 mass flow rate at the oultet of zone 1";
-  Modelica.SIunits.MassFlowRate Q1g(start=10)
+  Modelica.Units.SI.MassFlowRate Q1g(start=10)
     "Total mass flow rate at the oultet of zone 1";
-  Modelica.SIunits.MassFlowRate Q2eom(start=10)
+  Modelica.Units.SI.MassFlowRate Q2eom(start=10)
     "Biomass mass flow rate at the inlet of zone 2";
   Real PCI1om(start=1e6) "LHV after drying";
   Real X1MACHom(start=0.1) "Clinker mass fraction in the biomass after drying";
@@ -204,35 +204,35 @@
   Real X1F(start=0.1) "F mass fraction in the biomass after drying";
   Real X1S(start=0.1) "S mass fraction in the biomass after drying";
   Real X1CEND(start=0.1) "Ashes mass fraction in the biomass after drying";
-  Modelica.SIunits.MassFlowRate Qcendom(start=10) "Ashes mass flow rate";
+  Modelica.Units.SI.MassFlowRate Qcendom(start=10) "Ashes mass flow rate";
   Real Xfcend(start=0.1) "Ashes mass fraction in the flue gases";
-  Modelica.SIunits.Power P1g(start=1e6) "Power saved in zone 1";
+  Modelica.Units.SI.Power P1g(start=1e6) "Power saved in zone 1";
 
 //Zone 2
-  Modelica.SIunits.MassFlowRate Q2eo(start=10)
+  Modelica.Units.SI.MassFlowRate Q2eo(start=10)
     "Mass flow rate of the oxygen carried by the air and the biomass at the inlet of zone 2";
-  Modelica.SIunits.MassFlowRate Q2HCl(start=10)
+  Modelica.Units.SI.MassFlowRate Q2HCl(start=10)
     "Combustion HCl mass fraction in zone 2";
-  Modelica.SIunits.MassFlowRate Q2HF(start=10)
+  Modelica.Units.SI.MassFlowRate Q2HF(start=10)
     "Combustion HF mass flow rate at the outlet of zone 2";
-  Modelica.SIunits.MassFlowRate Q2SO2(start=10)
+  Modelica.Units.SI.MassFlowRate Q2SO2(start=10)
     "Combustion SO2 mass flow rate at the outlet of zone 2";
-  Modelica.SIunits.MassFlowRate Q2H2O(start=10)
+  Modelica.Units.SI.MassFlowRate Q2H2O(start=10)
     "Combustion H2O mass flow rate at the outlet of zone 2";
-  Modelica.SIunits.MassFlowRate Q2CO(start=10)
+  Modelica.Units.SI.MassFlowRate Q2CO(start=10)
     "Combustion CO mass flow rate at the outlet of zone 2";
-  Modelica.SIunits.MassFlowRate Q2N2(start=10)
+  Modelica.Units.SI.MassFlowRate Q2N2(start=10)
     "Combustion N2 mass flow rate at the outlet of zone 2";
-  Modelica.SIunits.MassFlowRate Q2O2(start=10)
+  Modelica.Units.SI.MassFlowRate Q2O2(start=10)
     "Combustion O2 mass flow rate at the outlet of zone 2";
-  Modelica.SIunits.MassFlowRate Q2cend(start=10)
+  Modelica.Units.SI.MassFlowRate Q2cend(start=10)
     "Combustion ashes mass flow rate at the outlet of zone 2";
-  Modelica.SIunits.MassFlowRate Q2CO2(start=10)
+  Modelica.Units.SI.MassFlowRate Q2CO2(start=10)
     "Combustion CO2 mass flow rate at the outlet of zone 2";
-  Modelica.SIunits.MassFlowRate Q2g(start=10)
+  Modelica.Units.SI.MassFlowRate Q2g(start=10)
     "Elements total mass flow rate after combustion";
   Real Epsivol(start=0.1) "Volatile matter mass fraction produced in zone 2";
-  Modelica.SIunits.MassFlowRate Q3eom(start=10)
+  Modelica.Units.SI.MassFlowRate Q3eom(start=10)
     "Solid matter at the inlet of zone 3";
   Real X2MACHom(start=0.1)
     "Clinker mass fraction of the biomass after volatilisation";
@@ -242,13 +242,13 @@
     "Unburnt C mas fraction in the clinker after volatilisation";
   Real PCICsol(start=1e6) "LHV of the solid outgoing carbon";
   Real PCICvol(start=1e6) "LHV of the volatile carbon transformed into CO";
-  Modelica.SIunits.SpecificEnthalpy H2(start=1e3) "Enthalpy released in zone 2";
-  Modelica.SIunits.Power P2g(start=1e6)
+  Modelica.Units.SI.SpecificEnthalpy H2(start=1e3) "Enthalpy released in zone 2";
+  Modelica.Units.SI.Power P2g(start=1e6)
     "Power released by the combustion in zone 2";
-  Modelica.SIunits.Power P1o(start=1e6) "Power captured by the biomass";
-  Modelica.SIunits.Power P1v(start=1e6) "Power captured by the steam";
-  Modelica.SIunits.Power P1a(start=1e6) "Power captured by the air";
-  Modelica.SIunits.Power P1r(start=1e6) "Power captured by the cooling water";
+  Modelica.Units.SI.Power P1o(start=1e6) "Power captured by the biomass";
+  Modelica.Units.SI.Power P1v(start=1e6) "Power captured by the steam";
+  Modelica.Units.SI.Power P1a(start=1e6) "Power captured by the air";
+  Modelica.Units.SI.Power P1r(start=1e6) "Power captured by the cooling water";
   Real Eray0(start=0.2)
     "Fraction of the radiated power from zone 2 unused for the drying";
   Real X2O2(start=0.1) "O2 mass fraction at the oultet of zone 2";
@@ -256,138 +256,138 @@
   Real X2CO2(start=0.1) "CO2 mass fraction at the oultet of zone 2";
   Real X2H2O(start=0.1) "H2O mass fraction at the oultet of zone 2";
   Real X2N2(start=0.1) "N2 mass fraction at the oultet of zone 2";
-  Modelica.SIunits.SpecificEnthalpy H2g(start=1200000)
+  Modelica.Units.SI.SpecificEnthalpy H2g(start=1200000)
     "Flue gases specific enthalpy at the oultet of zone 2";
-  Modelica.SIunits.Temperature T2(start=1000)
+  Modelica.Units.SI.Temperature T2(start=1000)
     "Flue gases temperature at the oultet of zone 2";
 
 //Zone 3
-  Modelica.SIunits.MassFlowRate Q3od(start=10)
+  Modelica.Units.SI.MassFlowRate Q3od(start=10)
     "O mass flow rate available for the oxydation of the clinker in CO and/or CO2";
-  Modelica.SIunits.MassFlowRate Q3cd(start=10)
+  Modelica.Units.SI.MassFlowRate Q3cd(start=10)
     "C mass flow rate available for the oxydation of the clinker in CO and/or CO2";
   Real taux3oc(start=0.1)
     "Ratio of the mass flow rates O/C available for the oxydation of the clinker";
-  Modelica.SIunits.MassFlowRate Q3CO2(start=10)
+  Modelica.Units.SI.MassFlowRate Q3CO2(start=10)
     "CO2 mass flow rate at the outlet of zone 3";
-  Modelica.SIunits.MassFlowRate Q3CO(start=10)
+  Modelica.Units.SI.MassFlowRate Q3CO(start=10)
     "CO mass flow rate at the outlet of zone 3";
-  Modelica.SIunits.MassFlowRate Q3O2(start=10)
+  Modelica.Units.SI.MassFlowRate Q3O2(start=10)
     "O2 mass flow rate at the outlet of zone 3";
-  Modelica.SIunits.MassFlowRate Q3N2(start=10)
+  Modelica.Units.SI.MassFlowRate Q3N2(start=10)
     "N2 mass flow rate at the outlet of zone 3";
-  Modelica.SIunits.MassFlowRate Q3H2O(start=10)
+  Modelica.Units.SI.MassFlowRate Q3H2O(start=10)
     "H2O mass flow rate at the outlet of zone 3";
-  Modelica.SIunits.MassFlowRate Q3SO2(start=10)
+  Modelica.Units.SI.MassFlowRate Q3SO2(start=10)
     "SO2 mass flow rate at the outlet of zone 3";
-  Modelica.SIunits.Power P3s(start=1e6)
+  Modelica.Units.SI.Power P3s(start=1e6)
     "Power captured by solid matter in zone 3";
-  Modelica.SIunits.Power P3g(start=1e6)
+  Modelica.Units.SI.Power P3g(start=1e6)
     "Power captured by gaseous matter in zone 3";
-  Modelica.SIunits.SpecificEnthalpy H3s(start=1e3)
+  Modelica.Units.SI.SpecificEnthalpy H3s(start=1e3)
     "Gaseous matter specific enthalpy at T3g";
-  Modelica.SIunits.SpecificEnthalpy H3g(start=1e3)
+  Modelica.Units.SI.SpecificEnthalpy H3g(start=1e3)
     "Solid matter specific enthalpy at T3o";
   Real XC2vol31(start=0.1)
     "C mass fraction burnt in zone 3 after volatilisation";
   Real XC2vol4(start=0.1) "C mass fraction burnt at the inlet of zone 4";
-  Modelica.SIunits.MassFlowRate Q3g(start=10)
+  Modelica.Units.SI.MassFlowRate Q3g(start=10)
     "Flue gases mass flow rate at the outlet of zone 3";
-  Modelica.SIunits.MassFlowRate Q4eom(start=10)
+  Modelica.Units.SI.MassFlowRate Q4eom(start=10)
     "Clinker mass flow rate at the inlet of zone 4";
   Real X4MACHom(start=0.1)
     "Mass flow rate of the biomass clinker after C volatilisation in zone 3";
   Real X4MACHimb(start=0.1)
     "Unburnt C mass fraction in the clinker after C volatilisation in zone 3";
-  Modelica.SIunits.SpecificHeatCapacity Cp3a(start=1000)
+  Modelica.Units.SI.SpecificHeatCapacity Cp3a(start=1000)
     "Average specific heat capacity at the inlet of zone 3";
-  Modelica.SIunits.Temperature T3o(start=500)
+  Modelica.Units.SI.Temperature T3o(start=500)
     "Clinker temperature at the outlet of zone 3";
-  constant Modelica.SIunits.SpecificHeatCapacity Cp3g=1100
+  constant Modelica.Units.SI.SpecificHeatCapacity Cp3g=1100
     "Average flue gases specific heat capacity at T3g";
-  Modelica.SIunits.Power P3ac(start=1e6) "Air power heated at (T2 + T3o)/2";
-  Modelica.SIunits.Power P3co(start=1e6) "CO power heated at (T2 + T3o)/2";
-  Modelica.SIunits.Power P3(start=1e6)
+  Modelica.Units.SI.Power P3ac(start=1e6) "Air power heated at (T2 + T3o)/2";
+  Modelica.Units.SI.Power P3co(start=1e6) "CO power heated at (T2 + T3o)/2";
+  Modelica.Units.SI.Power P3(start=1e6)
     "Total flue gases power at the outlet of zone 3";
 
 //Zone 4
-  Modelica.SIunits.Temperature T4o(start=600)
+  Modelica.Units.SI.Temperature T4o(start=600)
     "Clinker temperature at the outlet for the water seal";
-  Modelica.SIunits.Temperature T4er(start=600)
+  Modelica.Units.SI.Temperature T4er(start=600)
     "Water temperature at the inlet of the water seal";
   Real X4H2O(start=0.1)
     "H2O mass fraction in the clinker at the outlet of the water seal";
-  Modelica.SIunits.SpecificHeatCapacity Cp4liq(start=1000)
+  Modelica.Units.SI.SpecificHeatCapacity Cp4liq(start=1000)
     "Water specific heat capacity at TEej";
-  Modelica.SIunits.Power P4m(start=1e6)
+  Modelica.Units.SI.Power P4m(start=1e6)
     "Power lost by the clinker during vaporisation";
-  Modelica.SIunits.Power P4h(start=1e6)
+  Modelica.Units.SI.Power P4h(start=1e6)
     "Power associated to the clinker humidity";
-  Modelica.SIunits.MassFlowRate Q4v(start=10)
+  Modelica.Units.SI.MassFlowRate Q4v(start=10)
     "Steam mass flow rate generated by the water seal";
-  Modelica.SIunits.SpecificEnthalpy H4(start=1e3) "Enthalpy in zone 4";
-  Modelica.SIunits.Power P4v(start=1e6) "Power captured by the steam in zone 4";
-  constant Modelica.SIunits.SpecificEnthalpy Hvapo=2501600
+  Modelica.Units.SI.SpecificEnthalpy H4(start=1e3) "Enthalpy in zone 4";
+  Modelica.Units.SI.Power P4v(start=1e6) "Power captured by the steam in zone 4";
+  constant Modelica.Units.SI.SpecificEnthalpy Hvapo=2501600
     "Vaporisation energy";
 
 //Zone 5
-  Modelica.SIunits.MassFlowRate QO2p(start=10)
+  Modelica.Units.SI.MassFlowRate QO2p(start=10)
     "Flue gases O2 mass flow rate at the outlet";
-  Modelica.SIunits.MassFlowRate Qairp(start=10)
+  Modelica.Units.SI.MassFlowRate Qairp(start=10)
     "Excess air mass flow rate for data Qo2p";
-  Modelica.SIunits.MassFlowRate Qairs(start=10)
+  Modelica.Units.SI.MassFlowRate Qairs(start=10)
     "Stoechiometric air mass flow rate";
-  Modelica.SIunits.MassFlowRate Q5eH2O(start=10)
+  Modelica.Units.SI.MassFlowRate Q5eH2O(start=10)
     "Steam mass flow rate at the inlet of zone 5";
-  Modelica.SIunits.MassFlowRate Q5eCO(start=10)
+  Modelica.Units.SI.MassFlowRate Q5eCO(start=10)
     "CO mass flow rate at the inlet of zone 5";
-  Modelica.SIunits.MassFlowRate Q5eCO2(start=10)
+  Modelica.Units.SI.MassFlowRate Q5eCO2(start=10)
     "CO2 mass flow rate at the inlet of zone 5";
-  Modelica.SIunits.MassFlowRate Q5eO2(start=10)
+  Modelica.Units.SI.MassFlowRate Q5eO2(start=10)
     "O2 mass flow rate at the inlet of zone 5";
-  Modelica.SIunits.MassFlowRate Q5eN2(start=10)
+  Modelica.Units.SI.MassFlowRate Q5eN2(start=10)
     "N2 mass flow rate at the inlet of zone 5";
-  Modelica.SIunits.MassFlowRate Q5eSO2(start=10)
+  Modelica.Units.SI.MassFlowRate Q5eSO2(start=10)
     "SO2 mass flow rate at the inlet of zone 5";
-  Modelica.SIunits.MassFlowRate Q5eHCl(start=10)
+  Modelica.Units.SI.MassFlowRate Q5eHCl(start=10)
     "HCl mass flow rate at the inlet of zone 5";
-  Modelica.SIunits.MassFlowRate Q5eHF(start=10)
+  Modelica.Units.SI.MassFlowRate Q5eHF(start=10)
     "HF mass flow rate at the inlet of zone 5";
-  Modelica.SIunits.MassFlowRate Q5ecend(start=10)
+  Modelica.Units.SI.MassFlowRate Q5ecend(start=10)
     "Ashes mass flow rate at the inlet of zone 5";
-  Modelica.SIunits.MassFlowRate Q5eam(start=10)
+  Modelica.Units.SI.MassFlowRate Q5eam(start=10)
     "Total mass flow rate at the inlet of zone 5";
-  Modelica.SIunits.MassFlowRate Q5od(start=10)
+  Modelica.Units.SI.MassFlowRate Q5od(start=10)
     "O mass flow rate available in zone 5";
-  Modelica.SIunits.MassFlowRate Q5cd(start=10)
+  Modelica.Units.SI.MassFlowRate Q5cd(start=10)
     "C mass flow rate available in zone 5";
-  Modelica.SIunits.MassFlowRate Q5hd(start=10)
+  Modelica.Units.SI.MassFlowRate Q5hd(start=10)
     "H mass flow rate available in zone 5";
-  Modelica.SIunits.MassFlowRate Q5ost(start=10)
+  Modelica.Units.SI.MassFlowRate Q5ost(start=10)
     "Stoechiométrique O mass flow rate for zone 5";
   Real exc5(start=0.1) "Air excess for zone 5";
-  Modelica.SIunits.Power P5(start=1e6) "Power released by oxydation in zone 5";
-  Modelica.SIunits.MassFlowRate Q5sCO2(start=10)
+  Modelica.Units.SI.Power P5(start=1e6) "Power released by oxydation in zone 5";
+  Modelica.Units.SI.MassFlowRate Q5sCO2(start=10)
     "CO2 mass flow rate at the outlet of zone 5";
-  Modelica.SIunits.MassFlowRate Q5sO2(start=10)
+  Modelica.Units.SI.MassFlowRate Q5sO2(start=10)
     "O2 mass flow rate at the outlet of zone 5";
-  Modelica.SIunits.MassFlowRate Q5sCO(start=10)
+  Modelica.Units.SI.MassFlowRate Q5sCO(start=10)
     "CO mass flow rate at the outlet of zone 5";
-  Modelica.SIunits.Power P5s(start=1e6) "Power released by oxydation in zone 5";
+  Modelica.Units.SI.Power P5s(start=1e6) "Power released by oxydation in zone 5";
   Real XsfCO(start=0.1) "Flue gases CO mass fraction at the outlet of zone 5";
   Real XsfN21(start=0.1) "Flue gases N2 mass fraction at the outlet of zone 5";
   Real XsfHCl(start=0.1) "Flue gases HCl mass fraction at the outlet of zone 5";
   Real XsfHF(start=0.1) "Flue gases HF mass fraction at the outlet of zone 5";
   Real XsfCEND(start=0.1) "Ashes mass fraction at the outlet of zone 5";
-  Modelica.SIunits.Power P5a(start=1e6) "Power brought by secondary air";
-  Modelica.SIunits.Power P5t(start=1e6) "Power accumulated in the flue gases";
+  Modelica.Units.SI.Power P5a(start=1e6) "Power brought by secondary air";
+  Modelica.Units.SI.Power P5t(start=1e6) "Power accumulated in the flue gases";
   Real Xcor(start=0.1) "Corrective factor for the flue gases mass fractions";
   Real X5sH2OC(start=0.1) "Corrected flue gases H2O mass fraction";
   Real X5sCO2C(start=0.1) "Corrected flue gases CO2 mass fraction";
   Real X5sO2C(start=0.1) "Corrected flue gases O2 mass fraction";
   Real X5sSO2C(start=0.1) "Corrected flue gases SO2 mass fraction";
   Real X5sN2C(start=0.1) "Corrected flue gases N2 mass fraction";
-  Modelica.SIunits.Density rhonorm(start=1000)
+  Modelica.Units.SI.Density rhonorm(start=1000)
     "Density of the outgoing flue gases Masse at 0 deg C and 1 atm";
   Real FVN0(start=0.1)
     "Ashes normal volume fraction for the computation of FVN";
@@ -484,13 +484,11 @@
   /* Carbon distribution */
   XCvol2 = XCeom*XCvol;
   XMACHimb = XCeom*XCimb;
-  XCvol3 = XCeom*(1 - XCvol - XCimb);
-
-  //--------------------------------------------------------------------
-  // 1st zone : Drying
-  //------------------
-
-  /* Primary air specific enthalpy at Teap */
+  XCvol3 = XCeom*(1 - XCvol - XCimb);
+//--------------------------------------------------------------------
+// 1st zone : Drying
+//------------------
+/* Primary air specific enthalpy at Teap */
   Heap = ThermoSysPro.Properties.FlueGases.FlueGases_h(Peap, Teap, XeapCO2, XeapH2O, XeapO2, XeapSO2);
 
   /* Secondary air specific enthalpy at à Teas */
@@ -504,26 +502,25 @@
   Hefrecirc = ThermoSysPro.Properties.FlueGases.FlueGases_h(Psf, Tfrecirc, XfCO2recirc, XfH2Orecirc, XfO2recirc, XfSO2recirc);
 
   /* Mass flow rate of the secondary air / flue gases recirculated mixture */
-  Qeasm = Qeas + Qfrecirc;
-
-  /* Mixture */
-  if (Qeasm <= 0) then
-    XeasmO2 = 0;
-    XeasmCO2 = 0;
-    XeasmH2O = 0;
-    XeasmSO2 = 0;
-    XeasmN2 = 0;
-    Heasm = 1e3;
-    Teasm = 274.15;
-  else
-    XeasmO2 = (XfO2recirc*Qfrecirc + XeasO2*Qeas)/Qeasm;
-    XeasmCO2 = (XfCO2recirc*Qfrecirc)/Qeasm;
-    XeasmH2O = (XfH2Orecirc*Qfrecirc + XeasH2O*Qeas)/Qeasm;
-    XeasmSO2 = (XfSO2recirc*Qfrecirc)/Qeasm;
-    XeasmN2 = 1 - XeasmO2 - XeasmSO2 - XeasmH2O - XeasmSO2;
-    Heasm = (Qeasm*Heas+Qfrecirc*Hefrecirc)/Qeasm;
-    // Changed from FlueGases_T to FlueGases_h to provide a differentiable function
-    Heasm = ThermoSysPro.Properties.FlueGases.FlueGases_h(Psf, Teasm, XeasmCO2, XeasmH2O, XeasmO2, XeasmSO2);
+  Qeasm = Qeas + Qfrecirc;
+/* Mixture */
+  if Qeasm <= 0 then
+    XeasmO2 = 0;
+    XeasmCO2 = 0;
+    XeasmH2O = 0;
+    XeasmSO2 = 0;
+    XeasmN2 = 0;
+    Heasm = 1e3;
+    Teasm = 274.15;
+  else
+    XeasmO2 = (XfO2recirc * Qfrecirc + XeasO2 * Qeas) / Qeasm;
+    XeasmCO2 = XfCO2recirc * Qfrecirc / Qeasm;
+    XeasmH2O = (XfH2Orecirc * Qfrecirc + XeasH2O * Qeas) / Qeasm;
+    XeasmSO2 = XfSO2recirc * Qfrecirc / Qeasm;
+    XeasmN2 = 1 - XeasmO2 - XeasmSO2 - XeasmH2O - XeasmSO2;
+    Heasm = (Qeasm * Heas + Qfrecirc * Hefrecirc) / Qeasm;
+// Changed from FlueGases_T to FlueGases_h to provide a differentiable function
+    Heasm = ThermoSysPro.Properties.FlueGases.FlueGases_h(Psf, Teasm, XeasmCO2, XeasmH2O, XeasmO2, XeasmSO2);
   end if;
 
   /* Specific enthalpy of the water in the biomass */
@@ -594,15 +591,13 @@
   Xfcend = Qcendom/Qsf;
 
   /* Power captured in zone 1 */
-  P1g = Qeom*XH2Oeom*Hs1vom + Qeom*XH2Oeom*Hvapteom + Q1eap*H1a + Qerefo*Hs1vom;
-
-  //--------------------------------------------------------------------
-  // 2nd zone : Combustion
-  //----------------------
-
-  /* Outgoing flue gases mass flow rate after combustion */
-  /* Oxygen brought by air and the biomass */
-  Q2eo = Q2eom*X1O + Q2eap*XeapO2;
+  P1g = Qeom*XH2Oeom*Hs1vom + Qeom*XH2Oeom*Hvapteom + Q1eap*H1a + Qerefo*Hs1vom;
+//--------------------------------------------------------------------
+// 2nd zone : Combustion
+//----------------------
+/* Outgoing flue gases mass flow rate after combustion */
+/* Oxygen brought by air and the biomass */
+  Q2eo = Q2eom * X1O + Q2eap * XeapO2;
 
   /* Outgoing mass flow rates */
   Q2HCl = 36.5/35.5*Q2eom*X1Cl;
@@ -647,16 +642,14 @@
   X2N2 = 1 - (X2O2 + X2SO2 + X2CO2 + X2H2O);
 
   /* Specific enthalpy and temperature at the outlet of zone 2 */
-  H2g = (Q2eap*Heap + Q2eom*H1om + P2g*(1 - Eray0 - Eray2) - Q3eom*CpMACHs2*(T2 - 273.15))/Q2g;
-  // Changed from FlueGases_T to FlueGases_h to provide a differentiable function
-  H2g = ThermoSysPro.Properties.FlueGases.FlueGases_h(Peap, T2, X2CO2, X2H2O, X2O2, X2SO2);
-
-  //--------------------------------------------------------------------
-  // 3rd zone : Clinker cooling
-  //---------------------------
-
-  /* Oxydation of the clinkler carbon into CO and/or CO2 */
-  Q3od = Q3eap*XeapO2;
+  H2g = (Q2eap*Heap + Q2eom*H1om + P2g*(1 - Eray0 - Eray2) - Q3eom*CpMACHs2*(T2 - 273.15))/Q2g;
+// Changed from FlueGases_T to FlueGases_h to provide a differentiable function
+  H2g = ThermoSysPro.Properties.FlueGases.FlueGases_h(Peap, T2, X2CO2, X2H2O, X2O2, X2SO2);
+//--------------------------------------------------------------------
+// 3rd zone : Clinker cooling
+//---------------------------
+/* Oxydation of the clinkler carbon into CO and/or CO2 */
+  Q3od = Q3eap * XeapO2;
   Q3cd = Q3eom*XC2vol3;
   taux3oc = Q3od/Q3cd;
 
@@ -735,51 +728,47 @@
       (Q3eap*Cp3a/2 + (28/12)*Q3eom*XC2vol31*Cp3CO/2 + Q4eom*CpMACHs3);
   P3ac = (Q3eap - (16/12)*Q3eom*XC2vol31)*Cp3a*((T2 - 273.15) + (T3o - 273.15))/2;
   P3co = (28/12)*Q3eom*XC2vol31*Cp3CO*((T2 - 273.15) + (T3o - 273.15))/2;
-  P3 = P3g + P3ac + P3co;
-
-  //--------------------------------------------------------------------
-  // 4th zone : Water seal
-  //----------------------
-
-  /* Steam mass flow rate generated by the water seal */
-  if (jointeau == 1) then
-    T4o = TsjeMACH;
-    TsMACH = TsjeMACH;
-    T4er = Teeje;
-    X4H2O = XsjeH2OMACH;
-    Cp4liq = 4180;
-    P4m = Q4eom*CpMACHs4*((T3o - 273.15) - (T4o - 273.15));
-    P4h = Q4eom*X4H2O*Cp4liq*((T4o - 273.15) - (T4er - 273.15));
-    Q4v = rendje*(P4m - P4h)/(Cp4liq*(373.15 - (T4er - 273.15)) + Hvapo);
-    pro5 = ThermoSysPro.Properties.WaterSteam.IF97.Water_PT(Peap, 373.15, 2);
-    H4 = pro5.h;
-    P4v = Q4v*pro5.h;
-  else
-    T4o = 273.15;
-    TsMACH = T3o;
-    T4er = 273.15;
-    X4H2O = 0;
-    Cp4liq = 0;
-    P4m = 0;
-    P4h = 0;
-    Q4v = 0;
-    pro5 = ThermoSysPro.Properties.WaterSteam.IF97.Water_PT(Peap, 373.15, 2);
-    H4 = pro5.h;
-    P4v = 0;
+  P3 = P3g + P3ac + P3co;
+//--------------------------------------------------------------------
+// 4th zone : Water seal
+//----------------------
+/* Steam mass flow rate generated by the water seal */
+  if jointeau == 1 then
+    T4o = TsjeMACH;
+    TsMACH = TsjeMACH;
+    T4er = Teeje;
+    X4H2O = XsjeH2OMACH;
+    Cp4liq = 4180;
+    P4m = Q4eom * CpMACHs4 * (T3o - 273.15 - (T4o - 273.15));
+    P4h = Q4eom * X4H2O * Cp4liq * (T4o - 273.15 - (T4er - 273.15));
+    Q4v = rendje * (P4m - P4h) / (Cp4liq * (373.15 - (T4er - 273.15)) + Hvapo);
+    pro5 = ThermoSysPro.Properties.WaterSteam.IF97.Water_PT(Peap, 373.15, 2);
+    H4 = pro5.h;
+    P4v = Q4v * pro5.h;
+  else
+    T4o = 273.15;
+    TsMACH = T3o;
+    T4er = 273.15;
+    X4H2O = 0;
+    Cp4liq = 0;
+    P4m = 0;
+    P4h = 0;
+    Q4v = 0;
+    pro5 = ThermoSysPro.Properties.WaterSteam.IF97.Water_PT(Peap, 373.15, 2);
+    H4 = pro5.h;
+    P4v = 0;
   end if;
 
   /* Clinker mass flow rate at the outlet */
   QsMACH = Q4eom;
 
   /* Clinker LHV at the outlet */
-  PCIMACH = (Wimbm - Wimbp)/QsMACH;
-
-  //--------------------------------------------------------------------
-  // 5th zone : Post-combustion
-  //---------------------------
-
-  /* Excess air of the combustion */
-  QO2p = Qsf*XsfO2;
+  PCIMACH = (Wimbm - Wimbp)/QsMACH;
+//--------------------------------------------------------------------
+// 5th zone : Post-combustion
+//---------------------------
+/* Excess air of the combustion */
+  QO2p = Qsf * XsfO2;
   Qairp = QO2p/XeapO2*(1 - XeapH2O);
   Qairs = (Qeap + Qeas) - Qairp;
   excair = (Qairp/Qairs)*100;
@@ -841,11 +830,10 @@
   P5t = P1g + H2g*Q2g + P3 + P4v + P5s + P5a;
 
   /* Power radiated */
-  Wsr = P5s*Eray5/(1 - Eray5) + P2g*Eray2;
-
-  /* Flue gases temperature at the outlet */
-  // Changed from FlueGases_T to FlueGases_h to provide a differentiable function
-  P5t/Qsf = ThermoSysPro.Properties.FlueGases.FlueGases_h(Psf, Tsf, XsfCO2, XsfH2O, XsfO2, XsfSO2);
+  Wsr = P5s*Eray5/(1 - Eray5) + P2g*Eray2;
+/* Flue gases temperature at the outlet */
+// Changed from FlueGases_T to FlueGases_h to provide a differentiable function
+  P5t / Qsf = ThermoSysPro.Properties.FlueGases.FlueGases_h(Psf, Tsf, XsfCO2, XsfH2O, XsfO2, XsfSO2);
 
   /* Ashes volume mass */
   rhocend = rhoCENDom;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/CombustionChambers/PostCombustionGas.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/CombustionChambers/PostCombustionGas.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/CombustionChambers/PostCombustionGas.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/CombustionChambers/PostCombustionGas.mo"	2022-03-10 09:58:53.020153630 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.Combustion.CombustionChambers;
+within ThermoSysPro.Combustion.CombustionChambers;
 model PostCombustionGas "Post-combustion"
   parameter Real XClfuel=0 "Chloride mass fraction in fuel";
   parameter Real XFfuel=0 "Fluoride mass fraction in fuel";
@@ -10,29 +10,29 @@
   constant Real HfCO2=3.275e+07 "CO2 formation specific enthalpy";
   constant Real HfCO=9.201e+06 "CO formation specific enthalpy";
   constant Real HfH2O=2.418e+08 "H2O steam formation specific enthalpy";
-  constant Modelica.SIunits.SpecificEnthalpy H0v=2501551.43
+  constant Modelica.Units.SI.SpecificEnthalpy H0v=2501551.43
     "Vaporisation specific enthalpy at 0°C";
-  constant Modelica.SIunits.MassFlowRate Qeps=0.0001 "Minimum value for Qmel";
-  Modelica.SIunits.MassFlowRate Qmelc(start=10)
+  constant Modelica.Units.SI.MassFlowRate Qeps=0.0001 "Minimum value for Qmel";
+  Modelica.Units.SI.MassFlowRate Qmelc(start=10)
     "Intermediate variable for the computation of Qmel";
   Real Keq0(start=0.1) "Intermediate variable for the compuation of Keq";
   Real delta(start=0.1)
     "Intermediate variable to compute the progress of stage 4";
 
 public
-  Modelica.SIunits.MassFlowRate Qef(start=10)
+  Modelica.Units.SI.MassFlowRate Qef(start=10)
     "Flue gases mass flow rate at the inlet";
-  Modelica.SIunits.Temperature Tef(start=1700)
+  Modelica.Units.SI.Temperature Tef(start=1700)
     "Flue gases temperature at the inlet";
   Real XefCO2(start=0.5) "CO2 mass fraction at the flue gases inlet";
   Real XefH2O(start=0) "H2O mass fraction at the flue gases inlet";
   Real XefO2(start=0.5) "O2 mass fraction at the flue gases inlet";
   Real XefSO2(start=0) "SO2 mass fraction at the flue gases inlet";
-  Modelica.SIunits.MassFlowRate Qsf(start=10)
+  Modelica.Units.SI.MassFlowRate Qsf(start=10)
     "Flue gases mass flow rate at the outlet";
-  Modelica.SIunits.Temperature Tsf(start=1700)
+  Modelica.Units.SI.Temperature Tsf(start=1700)
     "Flue gases temperature at the outlet";
-  Modelica.SIunits.AbsolutePressure Psf(start=1e5)
+  Modelica.Units.SI.AbsolutePressure Psf(start=1e5)
     "Flue gases pressure at the outlet";
   Real XsfCO2(start=0.2) "CO2 mass fraction at the flue gases outlet";
   Real XsfCO(start=0.1) "CO mass fraction at the flue gases outlet";
@@ -41,54 +41,54 @@
   Real XsfO2(start=0.1) "O2 mass fraction at the flue gases outlet";
   Real XsfN2(start=0.2) "N2 mass fraction at the flue gases outlet";
   Real XsfSO2(start=0.1) "SO2 mass fraction at the flue gases outlet";
-  Modelica.SIunits.MassFlowRate Qea(start=0.2)
+  Modelica.Units.SI.MassFlowRate Qea(start=0.2)
     "Air mass flow rate at the inlet";
-  Modelica.SIunits.Temperature Tea(start=300) "Air temperature at the inlet";
-  Modelica.SIunits.AbsolutePressure Pea(start=1e5) "Air pressure at the inlet";
+  Modelica.Units.SI.Temperature Tea(start=300) "Air temperature at the inlet";
+  Modelica.Units.SI.AbsolutePressure Pea(start=1e5) "Air pressure at the inlet";
   Real XeaCO2(start=0.2) "CO2 mass fraction at the air inlet";
   Real XeaH2O(start=0.2) "H20 mass fraction at the air inlet";
   Real XeaO2(start=0.2) "O2 mass fraction at the air inlet";
   Real XeaSO2(start=0.2) "SO2 mass fraction at the air inlet";
-  Modelica.SIunits.MassFlowRate Qec(start=0.1)
+  Modelica.Units.SI.MassFlowRate Qec(start=0.1)
     "Fuel mass flow rate at the inlet";
-  Modelica.SIunits.Temperature Tec(start=1700) "Fuel temperature at the inlet";
-  Modelica.SIunits.SpecificHeatCapacity Cpfuel(start=1000)
+  Modelica.Units.SI.Temperature Tec(start=1700) "Fuel temperature at the inlet";
+  Modelica.Units.SI.SpecificHeatCapacity Cpfuel(start=1000)
     "Fuel specific heat capacity";
-  Modelica.SIunits.SpecificEnergy LHVfuel( start=1e6) "Fuel LHV";
+  Modelica.Units.SI.SpecificEnergy LHVfuel( start=1e6) "Fuel LHV";
   Real XH2Ofuel(start=0) "H2O mass fraction in fuel";
   Real XCfuel(start=0.25) "C mass fraction in fuel";
   Real XHfuel(start=0.75) "H mass fraction in fuel";
   Real XOfuel(start=0) "O mass fraction in fuel";
   Real XNfuel(start=0) "N mass fraction in fuel";
   Real XSfuel(start=0) "S mass fraction in fuel";
-  Modelica.SIunits.Power Wrad(start=1e6) "Power radiated";
-  Modelica.SIunits.SpecificEnthalpy Hea(start=1e3)
+  Modelica.Units.SI.Power Wrad(start=1e6) "Power radiated";
+  Modelica.Units.SI.SpecificEnthalpy Hea(start=1e3)
     "Humid air specific enthalpy at the temperature of the input air";
-  Modelica.SIunits.SpecificEnthalpy Hef(start=1e3)
+  Modelica.Units.SI.SpecificEnthalpy Hef(start=1e3)
     "Flue gases specific enthalpy at the inlet";
-  Modelica.SIunits.MassFlowRate Qmel(start=10)
+  Modelica.Units.SI.MassFlowRate Qmel(start=10)
     "Mass flow rate of the air/flue gases mixture";
   Real XmelO2(start=0.1) "O2 pass fraction in the air/flue gases mixture";
   Real XmelCO2(start=0.1) "CO2 pass fraction in the air/flue gases mixture";
   Real XmelH2O(start=0.1) "H2O pass fraction in the air/flue gases mixture";
   Real XmelSO2(start=0.1) "SO2 pass fraction in the air/flue gases mixture";
   Real XmelN2(start=0.1) "N2 pass fraction in the air/flue gases mixture";
-  Modelica.SIunits.SpecificEnthalpy Hmel(start=1e3)
+  Modelica.Units.SI.SpecificEnthalpy Hmel(start=1e3)
     "Specific enthalpy of the air/flue gases mixture";
-  Modelica.SIunits.Temperature Tmel(start=500)
+  Modelica.Units.SI.Temperature Tmel(start=500)
     "Temperature of the air/flue gases mixture";
-  Modelica.SIunits.SpecificEnthalpy Hwfuel(start=1e3)
+  Modelica.Units.SI.SpecificEnthalpy Hwfuel(start=1e3)
     "Specific enthalpy of the water in fuel";
-  Modelica.SIunits.SpecificEnthalpy Hfuel(start=1e3) "Fuel specific enthalpy";
-  Modelica.SIunits.MassFlowRate Q1H2O(start=10)
+  Modelica.Units.SI.SpecificEnthalpy Hfuel(start=1e3) "Fuel specific enthalpy";
+  Modelica.Units.SI.MassFlowRate Q1H2O(start=10)
     "H2O mass flow rate at the outlet of zone 1";
-  Modelica.SIunits.MassFlowRate Q1O2(start=10)
+  Modelica.Units.SI.MassFlowRate Q1O2(start=10)
     "O2 mass flow rate at the outlet of zone 1";
-  Modelica.SIunits.MassFlowRate Q1N2(start=10)
+  Modelica.Units.SI.MassFlowRate Q1N2(start=10)
     "N2 mass flow rate at the outlet of zone 1";
-  Modelica.SIunits.MassFlowRate Q1CO2(start=10)
+  Modelica.Units.SI.MassFlowRate Q1CO2(start=10)
     "CO2 mass flow rate at the outlet of zone 1";
-  Modelica.SIunits.MassFlowRate Q1SO2(start=10)
+  Modelica.Units.SI.MassFlowRate Q1SO2(start=10)
     "SO2 mass flow rate at the outlet of zone 1";
   Real X1Cfuel(start=0.1) "C mass fraction in fuel after drying";
   Real X1Hfuel(start=0.1) "H mass fraction in fuel after drying";
@@ -97,39 +97,39 @@
   Real X1Clfuel(start=0.1) "Cl mass fraction in fuel after drying";
   Real X1Ffuel(start=0.1) "F mass fraction in fuel after drying";
   Real X1Sfuel(start=0.1) "S mass fraction in fuel after drying";
-  Modelica.SIunits.MassFlowRate Q1ec(start=10)
+  Modelica.Units.SI.MassFlowRate Q1ec(start=10)
     "Fuel mass flow rate after drying";
-  Modelica.SIunits.SpecificEnergy LHVfuel1(start=1e6) "Fuel LHV after drying";
-  Modelica.SIunits.MassFlowRate Q2eO(start=10)
+  Modelica.Units.SI.SpecificEnergy LHVfuel1(start=1e6) "Fuel LHV after drying";
+  Modelica.Units.SI.MassFlowRate Q2eO(start=10)
     "O2 mass flow rate at the inlet of zone 2";
-  Modelica.SIunits.MassFlowRate Q21HCl(start=10)
+  Modelica.Units.SI.MassFlowRate Q21HCl(start=10)
     "HCl mass flow rate at the outlet of zone 2";
-  Modelica.SIunits.MassFlowRate Q21HF(start=10)
+  Modelica.Units.SI.MassFlowRate Q21HF(start=10)
     "HF mass flow rate at the outlet of zone 2";
-  Modelica.SIunits.MassFlowRate Q21SO2(start=10)
+  Modelica.Units.SI.MassFlowRate Q21SO2(start=10)
     "SO2 mass flow rate at the outlet of zone 2";
-  Modelica.SIunits.MassFlowRate Q21N2(start=10)
+  Modelica.Units.SI.MassFlowRate Q21N2(start=10)
     "N2 mass flow rate at the outlet of zone 2";
-  Modelica.SIunits.MassFlowRate Q22CO(start=10)
+  Modelica.Units.SI.MassFlowRate Q22CO(start=10)
     "CO mass flow rate produced in stage 2";
-  Modelica.SIunits.MassFlowRate Q22O2(start=10)
+  Modelica.Units.SI.MassFlowRate Q22O2(start=10)
     "O2 mass flow rate left after stage 2";
-  Modelica.SIunits.MassFlowRate Q22H2(start=10)
+  Modelica.Units.SI.MassFlowRate Q22H2(start=10)
     "H2 mass flow rate produced at stage 2";
   Real etaO2(start=0.1) "O2 fraction at the end of the combustion";
-  Modelica.SIunits.MassFlowRate Q23CO2(start=10)
+  Modelica.Units.SI.MassFlowRate Q23CO2(start=10)
     "CO2 mass flow rate at the end of stage 3";
-  Modelica.SIunits.MassFlowRate Q23H2O(start=10)
+  Modelica.Units.SI.MassFlowRate Q23H2O(start=10)
     "H2O mass flow rate at the end of stage 3";
-  Modelica.SIunits.MassFlowRate Q23CO(start=10)
+  Modelica.Units.SI.MassFlowRate Q23CO(start=10)
     "CO mass flow rate at the end of stage 3";
-  Modelica.SIunits.MassFlowRate Q23H2(start=10)
+  Modelica.Units.SI.MassFlowRate Q23H2(start=10)
     "H2 mass flow rate at the end of stage 3";
-  Modelica.SIunits.MassFlowRate Q23O2(start=10)
+  Modelica.Units.SI.MassFlowRate Q23O2(start=10)
     "O2 mass flow rate at the end of stage 3";
-  Modelica.SIunits.MassFlowRate Q24eg(start=10)
+  Modelica.Units.SI.MassFlowRate Q24eg(start=10)
     "Mass flow rate of the volatile elements at the end of zone 2";
-  Modelica.SIunits.MassFlowRate Q24sg(start=10)
+  Modelica.Units.SI.MassFlowRate Q24sg(start=10)
     "Mass flow rate of the volatile elements at the outlet of zone 2";
   Real X24O2(start=0.1) "O2 mass fraction in flue gases of zone 4";
   Real X24SO2(start=0.1) "SO2 mass fraction in flue gases of zone 4";
@@ -154,18 +154,18 @@
   Real X24sH2vol(start=0.1) "H2 volume fraction after stage 4";
   Real X24sH2Ovol(start=0.1) "H2O volume fraction after stage 4";
   Real AVE(start=0.1) "Progress of stage 4";
-  Modelica.SIunits.MassFlowRate Q24H2O(start=10)
+  Modelica.Units.SI.MassFlowRate Q24H2O(start=10)
     "H2O mass flow rate at the ned of stage 4";
-  Modelica.SIunits.MassFlowRate Q24H2(start=10)
+  Modelica.Units.SI.MassFlowRate Q24H2(start=10)
     "H2 mass flow rate at the ned of stage 4";
-  Modelica.SIunits.MassFlowRate Q24CO(start=10)
+  Modelica.Units.SI.MassFlowRate Q24CO(start=10)
     "CO mass flow rate at the ned of stage 4";
-  Modelica.SIunits.MassFlowRate Q24CO2(start=10)
+  Modelica.Units.SI.MassFlowRate Q24CO2(start=10)
     "CO2 mass flow rate at the ned of stage 4";
   Real PciCvol(start=1e6) "Power released by the combustion";
-  Modelica.SIunits.Power P2g(start=1e6) "Power released by the combustion";
+  Modelica.Units.SI.Power P2g(start=1e6) "Power released by the combustion";
   Real XsfC(start=0.1) "C mass fraction in the flue gases";
-  Modelica.SIunits.Power P2t(start=1e6) "Total flue gases power at the outlet";
+  Modelica.Units.SI.Power P2t(start=1e6) "Total flue gases power at the outlet";
 
 public
   ThermoSysPro.FlueGases.Connectors.FlueGasesInlet Ca "Air inlet"
@@ -220,21 +220,17 @@
   XOfuel = Cfuel.Xo;
   XNfuel = Cfuel.Xn;
   XSfuel = Cfuel.Xs;
-  Cpfuel = Cfuel.cp;
-
-  // 1st zone : Mixing air - flue gases - water in fuel
-  // --------------------------------------------------
-
-  /* Humid air specific enthalpy at the temperature of the input air */
+  Cpfuel = Cfuel.cp;
+// 1st zone : Mixing air - flue gases - water in fuel
+// --------------------------------------------------
+/* Humid air specific enthalpy at the temperature of the input air */
   Hea = ThermoSysPro.Properties.FlueGases.FlueGases_h(Pea, Tea, XeaCO2, XeaH2O, XeaO2, XeaSO2);
 
   /* Flue gases specific enthalpy at the inlet */
-  Hef = ThermoSysPro.Properties.FlueGases.FlueGases_h(Psf, Tef, XefCO2, XefH2O, XefO2, XefSO2);
-
-  // Air - flue gases mixing
-  // - - - - - - - - - - - -
-
-  /* Mixture flow rate */
+  Hef = ThermoSysPro.Properties.FlueGases.FlueGases_h(Psf, Tef, XefCO2, XefH2O, XefO2, XefSO2);
+// Air - flue gases mixing
+// - - - - - - - - - - - -
+/* Mixture flow rate */
   Qmelc = Qea + Qef;
   0 = if (Qmelc - Qeps <= 0) then (Qmel - Qeps) else (Qmelc - Qmel);
 
@@ -246,25 +242,21 @@
   XmelN2 = 1 - XmelO2 - XmelCO2 - XmelH2O - XmelSO2;
 
   /* Mixture specific enthalpy */
-  Hmel = (Qea*Hea + Hef*Qef)/Qmel;
-
-  /* Mixture temperature */
-  // Changed from FlueGases_T to FlueGases_h to provide a differentiable function
-  Hmel = ThermoSysPro.Properties.FlueGases.FlueGases_h(Psf, Tmel, XmelCO2, XmelH2O, XmelO2, XmelSO2);
-
-  // Fuel
-  // - -
-
-  /* Specific entahlpy of the water in fuel */
+  Hmel = (Qea*Hea + Hef*Qef)/Qmel;
+/* Mixture temperature */
+// Changed from FlueGases_T to FlueGases_h to provide a differentiable function
+  Hmel = ThermoSysPro.Properties.FlueGases.FlueGases_h(Psf, Tmel, XmelCO2, XmelH2O, XmelO2, XmelSO2);
+// Fuel
+// - -
+/* Specific entahlpy of the water in fuel */
   pro1 = ThermoSysPro.Properties.WaterSteam.IF97.Water_PT(Pea, Tec, mode);
   Hwfuel = pro1.h;
 
   /* Fuel specific enthalpy */
-  Hfuel = Cpfuel*(Tec - 273.16);
-
-  // Mass flow rates leaving zone 1
-  // - - - - - - - - - - - - - - - -
-  Q1H2O = Qec*XH2Ofuel + Qmel*XmelH2O;
+  Hfuel = Cpfuel*(Tec - 273.16);
+// Mass flow rates leaving zone 1
+// - - - - - - - - - - - - - - - -
+  Q1H2O = Qec * XH2Ofuel + Qmel * XmelH2O;
   Q1O2 = Qmel*XmelO2;
   Q1N2 = Qmel*XmelN2;
   Q1CO2 = Qmel*XmelCO2;
@@ -279,28 +271,23 @@
   X1Nfuel = XNfuel*(1 - XH2Ofuel);
   X1Clfuel = XClfuel*(1 - XH2Ofuel);
   X1Ffuel = XFfuel*(1 - XH2Ofuel);
-  X1Sfuel = XSfuel*(1 - XH2Ofuel);
-
-  // 2nd zone : Combustion
-  // ---------------------
-
-  // Stage 1 : Combustion of trace elements
-  // - - - - - - - - - - - - - - - - - - - -
-
-  /* Oxygen mass flow rate */
-  Q2eO = Q1ec*X1Ofuel + Qmel*XmelO2;
+  X1Sfuel = XSfuel*(1 - XH2Ofuel);
+// 2nd zone : Combustion
+// ---------------------
+// Stage 1 : Combustion of trace elements
+// - - - - - - - - - - - - - - - - - - - -
+/* Oxygen mass flow rate */
+  Q2eO = Q1ec * X1Ofuel + Qmel * XmelO2;
 
   /* Other exiting mass flow rates */
   Q21HCl = 36.5/35.5*Q1ec*X1Clfuel;
   Q21HF = 20/19*Q1ec*X1Ffuel;
   Q21SO2 = 64.06/32.06*Q1ec*X1Sfuel + Qmel*XmelSO2;
-  Q21N2 = Q1N2 + Q1ec*X1Nfuel;
-
-  // Etape 2 : CH4 oxydation into CO : CH4+1/2O2=>2H2+CO
-  // - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-  /* Mass flow rate of CO produced */
-  Q22CO = 28/12*Q1ec*X1Cfuel;
+  Q21N2 = Q1N2 + Q1ec*X1Nfuel;
+// Etape 2 : CH4 oxydation into CO : CH4+1/2O2=>2H2+CO
+// - - - - - - - - - - - - - - - - - - - - - - - - - -
+/* Mass flow rate of CO produced */
+  Q22CO = 28 / 12 * Q1ec * X1Cfuel;
 
   /* Oxygen mass flow rate */
   Q22O2 = Q2eO - Q1ec*(X1Sfuel/32.06*32.06 + 32/12/2*X1Cfuel);
@@ -309,120 +296,104 @@
   Q22H2 = Q1ec*(X1Hfuel - 1/35.5*X1Clfuel - 1/19*X1Ffuel);
 
   /* O2 fraction */
-  etaO2 = Q2eO - Q1ec*(X1Sfuel + 16/2*(X1Hfuel - 1/35.5*X1Clfuel - 1/19*X1Ffuel) + 16/12*X1Cfuel*2);
-
-  if (etaO2 < 1e-6) then
-    //---------------
-    // Lack of oxygen
-    //---------------
-
-    // Stage 3 : CO oxydation into CO2 : 2H2+CO+3/2O2=>CO2+2H2O
-    // - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-    Q23CO2 = Q1CO2 + 2/3*Q22O2/32*44;
-    Q23H2O = Qmel*XmelH2O + 4/3*Q22O2/32*18 + Qec*XH2Ofuel;
-    Q23CO = Q22CO - 2/3*Q22O2/32*28;
-    Q23H2 = Q22H2 - 4/3*Q22O2/32*2;
-    Q23O2 = 0;
-
-    // Stage 4 :Equilibrium reaction CO/CO2
-    // - - - - - - - - - - - - - - - - - - -
-
-    /* Total mass flow rate of the volatile elements in zone 2 */
-    Q24eg = Q23H2 + Q21HCl + Q21HF + Q21SO2 + Q23H2O + Q23CO + Q21N2 + Q23O2 + Q23CO2;
-
-    /* Composition */
-    X24O2 = Q23O2/Q24eg;
-    X24SO2 = Q21SO2/Q24eg;
-    X24H2O = Q23H2O/Q24eg;
-    X24CO = Q23CO/Q24eg;
-    X24CO2 = Q23CO2/Q24eg;
-    X24C = X24CO + X24CO2;
-    X24N2 = 1 - (X24O2 + X24SO2 + X24H2O + X24CO + X24CO2);
-
-    /* Equilibrium constant */
-    Keq0 = 0.0042*(Tmel - 273.15) - 2.4555;
-    0 = if (Keq0 > 0) then (Keq - Keq0) else Keq;
-
-    /* Molar mass of the incoming gases */
-    Mm4e = (Q23CO/28 + Q23H2O/18 + Q23CO2/44 + Q23H2/2 + Q21N2/28)/Q24eg;
-
-    /* Volume fractions at the inlet of stage 4 */
-    X24eCOvol = Q23CO/Q24eg/Mm4e/28;
-    X24eCO2vol = Q23CO2/Q24eg/Mm4e/44;
-    X24eH2vol = Q23H2/Q24eg/Mm4e/2;
-    X24eH2Ovol = Q23H2O/Q24eg/Mm4e/18;
-    X24eN2vol = Q21N2/Q24eg/Mm4e/28;
-    X24eHClvol = Q21HCl/Q24eg/Mm4e/36.5;
-    X24eHFvol = Q21HF/Q24eg/Mm4e/20;
-    X24eSO2vol = Q21SO2/Q24eg/Mm4e/64.06;
-
-    /* Reaction progress */
-    delta = ((X24eCOvol + X24eH2Ovol) + Keq*(X24eCO2vol + X24eH2vol))^2 - 4*(Keq - 1)*(Keq*X24eCO2vol*X24eH2vol - X24eCOvol*X24eH2Ovol);
-    AVE = ((X24eCOvol + X24eH2Ovol) + Keq*(X24eCO2vol + X24eH2vol) - (delta)^0.5)/2/(Keq - 1);
-
-    /* Volume fractions at the outlet of stage 4 */
-    X24sCOvol = X24eCOvol + AVE;
-    X24sCO2vol = X24eCO2vol - AVE;
-    X24sH2vol = X24eH2vol - AVE;
-    X24sH2Ovol = X24eH2Ovol + AVE;
-
-    /* Molar mass of the outgoing gases */
-    Mm4s = X24sCOvol*28 + X24sCO2vol*44 + X24sH2vol*2 + X24sH2Ovol*18 + X24eN2vol*28;
-
-    /* Mass flow rates */
-    Q24CO = X24sCOvol*28/Mm4s*Q24eg;
-    Q24CO2 = X24sCO2vol*44/Mm4s*Q24eg;
-    Q24H2O = X24sH2Ovol*18/Mm4s*Q24eg;
-    Q24H2 = X24sH2vol*2/Mm4s*Q24eg;
-
-    Q24sg = Q24H2 + Q21HCl + Q21HF + Q21SO2 + Q24H2O + Q24CO + Q21N2 + Q23O2 + Q24CO2;
-
-  else
-    //-----------------
-    // Excess of oxygen
-    //-----------------
-
-    // Stage 3 : CO oxydation into CO2 : 2H2+CO+3/2O2=>CO2+2H2O
-    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-    Q23CO2 = Q1CO2 + Q1ec*X1Cfuel/12*44;
-    Q23H2O = Qmel*XmelH2O+Q1ec*(X1Hfuel - 1/35.5*X1Clfuel - 1/19*X1Ffuel)*18/2 + Qec*XH2Ofuel;
-    Q23CO = 0;
-    Q23H2 = 0;
-    Q23O2 = Q2eO - Q1ec*(X1Sfuel + 16/2*(X1Hfuel - 1/35.5*X1Clfuel - 1/19*X1Ffuel) + 16/12*X1Cfuel*2);
-
-    // Stage 4 : Eaquilibrium reaction CO/CO2
-    // - - - - - - - - - - - - - - - - - - -
-    Q24eg = Q23H2 + Q21HCl + Q21HF + Q21SO2 + Q23H2O + Q23CO + Q21N2 + Q23O2 + Q23CO2;
-    X24O2 = 0;
-    X24SO2 = 0;
-    X24H2O = 0;
-    X24CO = 0;
-    X24CO2 = 0;
-    X24C = 0;
-    X24N2 = 0;
-    Keq0 = 0;
-    0 = if (Keq0 > 0) then (Keq - Keq0) else Keq;
-    Mm4e = 0;
-    X24eCOvol = 0;
-    X24eCO2vol = 0;
-    X24eH2vol = 0;
-    X24eH2Ovol = 0;
-    X24eN2vol = 0;
-    X24eHClvol = 0;
-    X24eHFvol = 0;
-    X24eSO2vol = 0;
-    delta = 0;
-    AVE = 0;
-    X24sCOvol = 0;
-    X24sCO2vol = 0;
-    X24sH2vol = 0;
-    X24sH2Ovol = 0;
-    Mm4s = 0;
-    Q24CO = Q23CO;
-    Q24CO2 = Q23CO2;
-    Q24H2O = Q23H2O;
-    Q24H2 = Q23H2;
-    Q24sg = Q24eg;
+  etaO2 = Q2eO - Q1ec*(X1Sfuel + 16/2*(X1Hfuel - 1/35.5*X1Clfuel - 1/19*X1Ffuel) + 16/12*X1Cfuel*2);
+  if etaO2 < 1e-6 then
+//---------------
+// Lack of oxygen
+//---------------
+// Stage 3 : CO oxydation into CO2 : 2H2+CO+3/2O2=>CO2+2H2O
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+    Q23CO2 = Q1CO2 + 2 / 3 * Q22O2 / 32 * 44;
+    Q23H2O = Qmel * XmelH2O + 4 / 3 * Q22O2 / 32 * 18 + Qec * XH2Ofuel;
+    Q23CO = Q22CO - 2 / 3 * Q22O2 / 32 * 28;
+    Q23H2 = Q22H2 - 4 / 3 * Q22O2 / 32 * 2;
+    Q23O2 = 0;
+// Stage 4 :Equilibrium reaction CO/CO2
+// - - - - - - - - - - - - - - - - - - -
+/* Total mass flow rate of the volatile elements in zone 2 */
+    Q24eg = Q23H2 + Q21HCl + Q21HF + Q21SO2 + Q23H2O + Q23CO + Q21N2 + Q23O2 + Q23CO2;
+/* Composition */
+    X24O2 = Q23O2 / Q24eg;
+    X24SO2 = Q21SO2 / Q24eg;
+    X24H2O = Q23H2O / Q24eg;
+    X24CO = Q23CO / Q24eg;
+    X24CO2 = Q23CO2 / Q24eg;
+    X24C = X24CO + X24CO2;
+    X24N2 = 1 - (X24O2 + X24SO2 + X24H2O + X24CO + X24CO2);
+/* Equilibrium constant */
+    Keq0 = 0.0042 * (Tmel - 273.15) - 2.4555;
+    0 = if Keq0 > 0 then Keq - Keq0 else Keq;
+/* Molar mass of the incoming gases */
+    Mm4e = (Q23CO / 28 + Q23H2O / 18 + Q23CO2 / 44 + Q23H2 / 2 + Q21N2 / 28) / Q24eg;
+/* Volume fractions at the inlet of stage 4 */
+    X24eCOvol = Q23CO / Q24eg / Mm4e / 28;
+    X24eCO2vol = Q23CO2 / Q24eg / Mm4e / 44;
+    X24eH2vol = Q23H2 / Q24eg / Mm4e / 2;
+    X24eH2Ovol = Q23H2O / Q24eg / Mm4e / 18;
+    X24eN2vol = Q21N2 / Q24eg / Mm4e / 28;
+    X24eHClvol = Q21HCl / Q24eg / Mm4e / 36.5;
+    X24eHFvol = Q21HF / Q24eg / Mm4e / 20;
+    X24eSO2vol = Q21SO2 / Q24eg / Mm4e / 64.06;
+/* Reaction progress */
+    delta = (X24eCOvol + X24eH2Ovol + Keq * (X24eCO2vol + X24eH2vol)) ^ 2 - 4 * (Keq - 1) * (Keq * X24eCO2vol * X24eH2vol - X24eCOvol * X24eH2Ovol);
+    AVE = (X24eCOvol + X24eH2Ovol + Keq * (X24eCO2vol + X24eH2vol) - delta ^ 0.5) / 2 / (Keq - 1);
+/* Volume fractions at the outlet of stage 4 */
+    X24sCOvol = X24eCOvol + AVE;
+    X24sCO2vol = X24eCO2vol - AVE;
+    X24sH2vol = X24eH2vol - AVE;
+    X24sH2Ovol = X24eH2Ovol + AVE;
+/* Molar mass of the outgoing gases */
+    Mm4s = X24sCOvol * 28 + X24sCO2vol * 44 + X24sH2vol * 2 + X24sH2Ovol * 18 + X24eN2vol * 28;
+/* Mass flow rates */
+    Q24CO = X24sCOvol * 28 / Mm4s * Q24eg;
+    Q24CO2 = X24sCO2vol * 44 / Mm4s * Q24eg;
+    Q24H2O = X24sH2Ovol * 18 / Mm4s * Q24eg;
+    Q24H2 = X24sH2vol * 2 / Mm4s * Q24eg;
+    Q24sg = Q24H2 + Q21HCl + Q21HF + Q21SO2 + Q24H2O + Q24CO + Q21N2 + Q23O2 + Q24CO2;
+  else
+//-----------------
+// Excess of oxygen
+//-----------------
+// Stage 3 : CO oxydation into CO2 : 2H2+CO+3/2O2=>CO2+2H2O
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+    Q23CO2 = Q1CO2 + Q1ec * X1Cfuel / 12 * 44;
+    Q23H2O = Qmel * XmelH2O + Q1ec * (X1Hfuel - 1 / 35.5 * X1Clfuel - 1 / 19 * X1Ffuel) * 18 / 2 + Qec * XH2Ofuel;
+    Q23CO = 0;
+    Q23H2 = 0;
+    Q23O2 = Q2eO - Q1ec * (X1Sfuel + 16 / 2 * (X1Hfuel - 1 / 35.5 * X1Clfuel - 1 / 19 * X1Ffuel) + 16 / 12 * X1Cfuel * 2);
+// Stage 4 : Eaquilibrium reaction CO/CO2
+// - - - - - - - - - - - - - - - - - - -
+    Q24eg = Q23H2 + Q21HCl + Q21HF + Q21SO2 + Q23H2O + Q23CO + Q21N2 + Q23O2 + Q23CO2;
+    X24O2 = 0;
+    X24SO2 = 0;
+    X24H2O = 0;
+    X24CO = 0;
+    X24CO2 = 0;
+    X24C = 0;
+    X24N2 = 0;
+    Keq0 = 0;
+    0 = if Keq0 > 0 then Keq - Keq0 else Keq;
+    Mm4e = 0;
+    X24eCOvol = 0;
+    X24eCO2vol = 0;
+    X24eH2vol = 0;
+    X24eH2Ovol = 0;
+    X24eN2vol = 0;
+    X24eHClvol = 0;
+    X24eHFvol = 0;
+    X24eSO2vol = 0;
+    delta = 0;
+    AVE = 0;
+    X24sCOvol = 0;
+    X24sCO2vol = 0;
+    X24sH2vol = 0;
+    X24sH2Ovol = 0;
+    Mm4s = 0;
+    Q24CO = Q23CO;
+    Q24CO2 = Q23CO2;
+    Q24H2O = Q23H2O;
+    Q24H2 = Q23H2;
+    Q24sg = Q24eg;
   end if;
 
   /* Mass flow rate at the outlet */
@@ -445,9 +416,9 @@
   XsfN2 = 1 - (XsfO2 + XsfSO2 + XsfH2O + XsfCO2 + XsfCO);
 
   /* Power accumukated by the gases in zone 2 */
-  P2t = ((Q24H2O - (Qmel*XmelH2O))*H0v + Qmel*Hmel + Q1ec*Hfuel + P2g)*(1 - Xrad);
-  // Changed from FlueGases_T to FlueGases_h to provide a differentiable function
-  P2t/Qsf = ThermoSysPro.Properties.FlueGases.FlueGases_h(Psf, Tsf, XsfC, XsfH2O, XsfO2, XsfSO2);
+  P2t = ((Q24H2O - (Qmel*XmelH2O))*H0v + Qmel*Hmel + Q1ec*Hfuel + P2g)*(1 - Xrad);
+// Changed from FlueGases_T to FlueGases_h to provide a differentiable function
+  P2t / Qsf = ThermoSysPro.Properties.FlueGases.FlueGases_h(Psf, Tsf, XsfC, XsfH2O, XsfO2, XsfSO2);
 
   Wrad = P2t*Xrad;
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/Connectors.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/Connectors.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/Connectors.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/Connectors.mo"	2022-03-10 09:58:52.932153619 +0000
@@ -1,12 +1,13 @@
 within ThermoSysPro.Combustion;
 package Connectors "Connectors"
 
+
   connector FuelInlet "Fuel inlet connector"
-    Modelica.SIunits.MassFlowRate Q "Fuel mass flow rate";
-    Modelica.SIunits.Temperature T "Fuel temperature";
-    Modelica.SIunits.AbsolutePressure P "Fuel pressure";
-    Modelica.SIunits.SpecificEnergy LHV "Lower heating value";
-    Modelica.SIunits.SpecificHeatCapacity cp
+    Modelica.Units.SI.MassFlowRate Q "Fuel mass flow rate";
+    Modelica.Units.SI.Temperature T "Fuel temperature";
+    Modelica.Units.SI.AbsolutePressure P "Fuel pressure";
+    Modelica.Units.SI.SpecificEnergy LHV "Lower heating value";
+    Modelica.Units.SI.SpecificHeatCapacity cp
       "Fuel specific heat capacity at 273.15 K";
     Real hum "Fuel humidity (%)";
     Real Xc "C mass fraction";
@@ -16,7 +17,7 @@
     Real Xs "S mass fraction";
     Real Xashes "Ashes mass fraction";
     Real VolM "Percentage of volatile matter";
-    Modelica.SIunits.Density rho "Fuel density";
+    Modelica.Units.SI.Density rho "Fuel density";
 
     input Boolean a=true
       "Pseudo-variable for the verification of the connection orientation";
@@ -41,11 +42,11 @@
   end FuelInlet;
 
   connector FuelOutlet "Fuel outlet connector"
-    Modelica.SIunits.MassFlowRate Q "Fuel mass flow rate";
-    Modelica.SIunits.Temperature T "Fuel temperature";
-    Modelica.SIunits.AbsolutePressure P "Fuel pressure";
-    Modelica.SIunits.SpecificEnergy LHV "Lower heating value";
-    Modelica.SIunits.SpecificHeatCapacity cp
+    Modelica.Units.SI.MassFlowRate Q "Fuel mass flow rate";
+    Modelica.Units.SI.Temperature T "Fuel temperature";
+    Modelica.Units.SI.AbsolutePressure P "Fuel pressure";
+    Modelica.Units.SI.SpecificEnergy LHV "Lower heating value";
+    Modelica.Units.SI.SpecificHeatCapacity cp
       "Fuel specific heat capacity at 273.15 K";
     Real hum "Fuel humidity (%)";
     Real Xc "C mass fraction";
@@ -55,7 +56,7 @@
     Real Xs "S mass fraction";
     Real Xashes "Ashes mass fraction";
     Real VolM "Percentage of volatile matter";
-    Modelica.SIunits.Density rho "Fuel density";
+    Modelica.Units.SI.Density rho "Fuel density";
 
     output Boolean a
       "Pseudo-variable for the verification of the connection orientation";
@@ -80,11 +81,11 @@
   end FuelOutlet;
 
   connector FuelInletI "Internal fuel inlet connector"
-    Modelica.SIunits.MassFlowRate Q "Fuel mass flow rate";
-    Modelica.SIunits.Temperature T "Fuel temperature";
-    Modelica.SIunits.AbsolutePressure P "Fuel pressure";
-    Modelica.SIunits.SpecificEnergy LHV "Lower heating value";
-    Modelica.SIunits.SpecificHeatCapacity cp
+    Modelica.Units.SI.MassFlowRate Q "Fuel mass flow rate";
+    Modelica.Units.SI.Temperature T "Fuel temperature";
+    Modelica.Units.SI.AbsolutePressure P "Fuel pressure";
+    Modelica.Units.SI.SpecificEnergy LHV "Lower heating value";
+    Modelica.Units.SI.SpecificHeatCapacity cp
       "Fuel specific heat capacity at 273.15 K";
     Real hum "Fuel humidity (%)";
     Real Xc "C mass fraction";
@@ -94,7 +95,7 @@
     Real Xs "S mass fraction";
     Real Xashes "Ashes mass fraction";
     Real VolM "Percentage of volatile matter";
-    Modelica.SIunits.Density rho "Fuel density";
+    Modelica.Units.SI.Density rho "Fuel density";
 
     input Boolean a
       "Pseudo-variable for the verification of the connection orientation";
@@ -120,11 +121,11 @@
   end FuelInletI;
 
   connector FuelOutletI "Internal fuel outlet connector"
-    Modelica.SIunits.MassFlowRate Q "Fuel mass flow rate";
-    Modelica.SIunits.Temperature T "Fuel temperature";
-    Modelica.SIunits.AbsolutePressure P "Fuel pressure";
-    Modelica.SIunits.SpecificEnergy LHV "Lower heating value";
-    Modelica.SIunits.SpecificHeatCapacity cp
+    Modelica.Units.SI.MassFlowRate Q "Fuel mass flow rate";
+    Modelica.Units.SI.Temperature T "Fuel temperature";
+    Modelica.Units.SI.AbsolutePressure P "Fuel pressure";
+    Modelica.Units.SI.SpecificEnergy LHV "Lower heating value";
+    Modelica.Units.SI.SpecificHeatCapacity cp
       "Fuel specific heat capacity at 273.15 K";
     Real hum "Fuel humidity (%)";
     Real Xc "C mass fraction";
@@ -134,7 +135,7 @@
     Real Xs "S mass fraction";
     Real Xashes "Ashes mass fraction";
     Real VolM "Percentage of volatile matter";
-    Modelica.SIunits.Density rho "Fuel density";
+    Modelica.Units.SI.Density rho "Fuel density";
 
     output Boolean a
       "Pseudo-variable for the verification of the connection orientation";
@@ -158,7 +159,6 @@
 </HTML>
 "));
   end FuelOutletI;
-
   annotation (Icon(graphics={
         Text(
           extent={{-102,0},{24,-26}},
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/Sensors/FuelMassFlowSensor.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/Sensors/FuelMassFlowSensor.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/Sensors/FuelMassFlowSensor.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Combustion/Sensors/FuelMassFlowSensor.mo"	2022-03-10 09:58:52.892153612 +0000
@@ -1,9 +1,6 @@
 within ThermoSysPro.Combustion.Sensors;
-model FuelMassFlowSensor "Fuel mass flow rate sensor"
-
-public
-  Modelica.SIunits.MassFlowRate Q(start=20) "Mass flow rate";
-
+model FuelMassFlowSensor "Fuel mass flow rate sensor"
+  Modelica.Units.SI.MassFlowRate Q(start = 20) "Mass flow rate";
 public
   ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal Mesure
     annotation (Placement(transformation(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Misc/Function_FM.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Misc/Function_FM.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Misc/Function_FM.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Misc/Function_FM.mo"	2022-03-10 09:58:52.848153607 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Correlations.Misc;
 function Function_FM
   "Calculation of the correction factor for material and gauge"
-  input Modelica.SIunits.Thickness e_tubes "Weight average thickness of tubes";
+  input Modelica.Units.SI.Thickness e_tubes "Weight average thickness of tubes";
   input Integer Tube_Material "Material of the tubes. 1:Cu Fe 194 - 2:Arsenical Cu - 3:Admiralty - 4:Al Brass - 5:Al Bronze - 6:Carbon Steel 
     - 7:Cu Ni 90-10 - 8:Cu Ni 70-30 - 9:SS (UNS S43035) - 10:Titanium Grades 1 & 2 - 11:SS (UNS S44660) 
     - 12:SS (UNS S44735) - 13:SS TP 304 - 14:SS TP 316/317 - 15:SS (UNS N08367)";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Misc/Pro_FlueGases.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Misc/Pro_FlueGases.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Misc/Pro_FlueGases.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Misc/Pro_FlueGases.mo"	2022-03-10 09:58:52.836153607 +0000
@@ -1,17 +1,17 @@
 within ThermoSysPro.Correlations.Misc;
 record Pro_FlueGases
   "Flue gases properties for the computation of correlations"
-  Modelica.SIunits.Density rhoMF(start=0.5) "Flue gases average density";
-  Modelica.SIunits.SpecificHeatCapacity cpMF(start=500)
+  Modelica.Units.SI.Density rhoMF(start=0.5) "Flue gases average density";
+  Modelica.Units.SI.SpecificHeatCapacity cpMF(start=500)
     "Flue gases average specific heat capacity";
-  Modelica.SIunits.DynamicViscosity muMF(start=1.e-5)
+  Modelica.Units.SI.DynamicViscosity muMF(start=1.e-5)
     "Flue gases average dynamic viscosity";
-  Modelica.SIunits.ThermalConductivity kMF(start=0.10)
+  Modelica.Units.SI.ThermalConductivity kMF(start=0.10)
     "Flue gases average thermal conductivity";
-  Modelica.SIunits.SpecificHeatCapacity cpMFF(start=500)
+  Modelica.Units.SI.SpecificHeatCapacity cpMFF(start=500)
     "Film specific heat capacity";
-  Modelica.SIunits.DynamicViscosity muMFF(start=1.e-5) "Film dynamic viscosity";
-  Modelica.SIunits.ThermalConductivity kMFF(start=0.10)
+  Modelica.Units.SI.DynamicViscosity muMFF(start=1.e-5) "Film dynamic viscosity";
+  Modelica.Units.SI.ThermalConductivity kMFF(start=0.10)
     "Film thermal conductivity";
   Real Xtot " ";
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Misc/Pro_TwoPhaseWaterSteam.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Misc/Pro_TwoPhaseWaterSteam.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Misc/Pro_TwoPhaseWaterSteam.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Misc/Pro_TwoPhaseWaterSteam.mo"	2022-03-10 09:58:52.824153605 +0000
@@ -1,26 +1,26 @@
 within ThermoSysPro.Correlations.Misc;
 record Pro_TwoPhaseWaterSteam
   "Water/steam properties for the computation of correlations"
-  Modelica.SIunits.Density rhol "Density of the liquid phase";
-  Modelica.SIunits.Density rhov "Density of the vapor phase";
-  Modelica.SIunits.SpecificEnthalpy hl "Specific enthalpy of the liquid phase";
-  Modelica.SIunits.SpecificEnthalpy hv "Specific enthalpy of the vapor phase";
-  Modelica.SIunits.SpecificEnergy lv "Phase transition energy";
-  Modelica.SIunits.SpecificHeatCapacity cpl
+
+  Modelica.Units.SI.Density rhol "Density of the liquid phase";
+  Modelica.Units.SI.Density rhov "Density of the vapor phase";
+  Modelica.Units.SI.SpecificEnthalpy hl "Specific enthalpy of the liquid phase";
+  Modelica.Units.SI.SpecificEnthalpy hv "Specific enthalpy of the vapor phase";
+  Modelica.Units.SI.SpecificEnergy lv "Phase transition energy";
+  Modelica.Units.SI.SpecificHeatCapacity cpl
     "Specific heat capacity of the liquid phase";
-  Modelica.SIunits.SpecificHeatCapacity cpv
+  Modelica.Units.SI.SpecificHeatCapacity cpv
     "Specific heat capacity of the vapor phase";
-  Modelica.SIunits.DynamicViscosity mul "Dynamic viscosity of the liquid phase";
-  Modelica.SIunits.DynamicViscosity muv "Dynamic viscosity of the vapor phase";
-  Modelica.SIunits.ThermalConductivity kl
+  Modelica.Units.SI.DynamicViscosity mul "Dynamic viscosity of the liquid phase";
+  Modelica.Units.SI.DynamicViscosity muv "Dynamic viscosity of the vapor phase";
+  Modelica.Units.SI.ThermalConductivity kl
     "Thermal conductivity of the liquid phase";
-  Modelica.SIunits.ThermalConductivity kv
+  Modelica.Units.SI.ThermalConductivity kv
     "Thermal conductivity of the vapor phase";
-  Modelica.SIunits.SurfaceTension tsl "Surface tension of the liquid phase";
-  Modelica.SIunits.Density rholv "Density of the water/steam mixture";
-  Modelica.SIunits.SpecificEnthalpy hlv
+  Modelica.Units.SI.SurfaceTension tsl "Surface tension of the liquid phase";
+  Modelica.Units.SI.Density rholv "Density of the water/steam mixture";
+  Modelica.Units.SI.SpecificEnthalpy hlv
     "Specific enthalpy of the water/steam mixture";
-
   annotation (Icon(graphics={
         Rectangle(
           extent={{-100,50},{100,-100}},
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Misc/Pro_WaterSteam.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Misc/Pro_WaterSteam.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Misc/Pro_WaterSteam.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Misc/Pro_WaterSteam.mo"	2022-03-10 09:58:52.816153603 +0000
@@ -1,21 +1,21 @@
 within ThermoSysPro.Correlations.Misc;
 record Pro_WaterSteam
   "Water/steam properties for the computation of correlations"
-  Modelica.SIunits.Temperature TEE
+  Modelica.Units.SI.Temperature TEE
     "Water/steam temperature at the inlet of the exchanger";
-  Modelica.SIunits.Temperature TME "Average water/steam temperature";
-  Modelica.SIunits.Density rhoME "Average water/steam density";
-  Modelica.SIunits.Density rhoSE
+  Modelica.Units.SI.Temperature TME "Average water/steam temperature";
+  Modelica.Units.SI.Density rhoME "Average water/steam density";
+  Modelica.Units.SI.Density rhoSE
     "Water/steam density at the outlet of the exchanger";
-  Modelica.SIunits.AbsolutePressure PME(start=100e5)
+  Modelica.Units.SI.AbsolutePressure PME(start=100e5)
     "Average water/steam pressure";
-  Modelica.SIunits.SpecificEntropy SME "Average water/steam specific entropy";
+  Modelica.Units.SI.SpecificEntropy SME "Average water/steam specific entropy";
   Real xm "Average steam mass fraction";
-  Modelica.SIunits.SpecificHeatCapacity cpME
-    "Water/steam specific heat capacity";
-  Modelica.SIunits.DynamicViscosity muME "Water/steam dynamic viscosity";
-  Modelica.SIunits.ThermalConductivity kME "Water/steam thermal conductivity";
 
+  Modelica.Units.SI.SpecificHeatCapacity cpME
+    "Water/steam specific heat capacity";
+  Modelica.Units.SI.DynamicViscosity muME "Water/steam dynamic viscosity";
+  Modelica.Units.SI.ThermalConductivity kME "Water/steam thermal conductivity";
   annotation (
     Window(
       x=0.11,
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Misc/PropFlueGases.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Misc/PropFlueGases.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Misc/PropFlueGases.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Misc/PropFlueGases.mo"	2022-03-10 09:58:52.776153598 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Correlations.Misc;
 function PropFlueGases "Computation of the flue gases properties"
-  input Modelica.SIunits.AbsolutePressure Pmf "Flue gases average pressure";
-  input Modelica.SIunits.Temperature Tmf "Flue gases average temperature";
+  input Modelica.Units.SI.AbsolutePressure Pmf "Flue gases average pressure";
+  input Modelica.Units.SI.Temperature Tmf "Flue gases average temperature";
   input Real XefCO2 "CO2 mass fraction";
   input Real XefH2O "H2O mass fraction";
   input Real XefO2 "O2 mass fraction";
@@ -11,11 +11,11 @@
   output Real propf[4] "Flue gases physical properties vector";
 
 protected
-  Modelica.SIunits.ThermalConductivity condf "Flue gases thermal conductivity";
-  Modelica.SIunits.SpecificHeatCapacity cpf "Flue gases specific heat capacity";
-  Modelica.SIunits.DynamicViscosity muf "Flue gases dynamic viscosity";
-  Modelica.SIunits.Density rhof "Flue gases density";
 
+  Modelica.Units.SI.ThermalConductivity condf "Flue gases thermal conductivity";
+  Modelica.Units.SI.SpecificHeatCapacity cpf "Flue gases specific heat capacity";
+  Modelica.Units.SI.DynamicViscosity muf "Flue gases dynamic viscosity";
+  Modelica.Units.SI.Density rhof "Flue gases density";
 algorithm
   condf := ThermoSysPro.Properties.FlueGases.FlueGases_k(Pmf, Tmf, XefCO2, XefH2O, XefO2, XefSO2);
   cpf := ThermoSysPro.Properties.FlueGases.FlueGases_cp(Pmf, Tmf, XefCO2, XefH2O, XefO2, XefSO2);
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Misc/PropWaterSteam.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Misc/PropWaterSteam.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Misc/PropWaterSteam.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Misc/PropWaterSteam.mo"	2022-03-10 09:58:52.768153598 +0000
@@ -1,29 +1,29 @@
 within ThermoSysPro.Correlations.Misc;
 function PropWaterSteam "Computation of the water/steam properties"
-  input Modelica.SIunits.AbsolutePressure Pmc "Water/steam average pressure";
-  input Modelica.SIunits.SpecificEnthalpy Hmc
+  input Modelica.Units.SI.AbsolutePressure Pmc "Water/steam average pressure";
+  input Modelica.Units.SI.SpecificEnthalpy Hmc
     "Water/steam average specific enthalpy";
   input Real Xmc "Steam average mass fraction";
 
 protected
-  constant Modelica.SIunits.AbsolutePressure Pc=221.2e5 "Critical pressure";
-  Modelica.SIunits.Temperature Tsat1 "Saturation temperature at Pmc";
-  Modelica.SIunits.Temperature T "Water/steam mixture temperature";
-  Modelica.SIunits.SpecificEnthalpy hlv "Water/steam mixture specific enthalpy";
-  Modelica.SIunits.Density rholv "Water/steam mixture density";
-  Modelica.SIunits.Density rhol "Water density";
-  Modelica.SIunits.Density rhov "Steam density";
-  Modelica.SIunits.SpecificEnthalpy hl "Water specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy hv "Steam specific enthalpy";
-  Modelica.SIunits.SpecificEnergy lv "Phase transition energy";
-  Modelica.SIunits.SpecificHeatCapacity cpl "Water specific heat capacity";
-  Modelica.SIunits.SpecificHeatCapacity cpv "Steam specific heat capacity";
-  Modelica.SIunits.DynamicViscosity mul "Water dynamic viscosity";
-  Modelica.SIunits.DynamicViscosity muv "Steam dynamic viscosity";
-  Modelica.SIunits.ThermalConductivity kl "Water thermal conductivity";
-  Modelica.SIunits.ThermalConductivity kv "Steam thermal conductivity";
-  Modelica.SIunits.SurfaceTension tsl "Water surface tensiton";
 
+  constant Modelica.Units.SI.AbsolutePressure Pc=221.2e5 "Critical pressure";
+  Modelica.Units.SI.Temperature Tsat1 "Saturation temperature at Pmc";
+  Modelica.Units.SI.Temperature T "Water/steam mixture temperature";
+  Modelica.Units.SI.SpecificEnthalpy hlv "Water/steam mixture specific enthalpy";
+  Modelica.Units.SI.Density rholv "Water/steam mixture density";
+  Modelica.Units.SI.Density rhol "Water density";
+  Modelica.Units.SI.Density rhov "Steam density";
+  Modelica.Units.SI.SpecificEnthalpy hl "Water specific enthalpy";
+  Modelica.Units.SI.SpecificEnthalpy hv "Steam specific enthalpy";
+  Modelica.Units.SI.SpecificEnergy lv "Phase transition energy";
+  Modelica.Units.SI.SpecificHeatCapacity cpl "Water specific heat capacity";
+  Modelica.Units.SI.SpecificHeatCapacity cpv "Steam specific heat capacity";
+  Modelica.Units.SI.DynamicViscosity mul "Water dynamic viscosity";
+  Modelica.Units.SI.DynamicViscosity muv "Steam dynamic viscosity";
+  Modelica.Units.SI.ThermalConductivity kl "Water thermal conductivity";
+  Modelica.Units.SI.ThermalConductivity kv "Steam thermal conductivity";
+  Modelica.Units.SI.SurfaceTension tsl "Water surface tensiton";
 protected
   ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat vsatm
                                    annotation (Placement(transformation(extent=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Misc/WBCorrectiveDiameterCoefficient.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Misc/WBCorrectiveDiameterCoefficient.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Misc/WBCorrectiveDiameterCoefficient.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Misc/WBCorrectiveDiameterCoefficient.mo"	2022-03-10 09:58:52.748153595 +0000
@@ -2,7 +2,7 @@
 function WBCorrectiveDiameterCoefficient "Corrective diameter coefficient"
   input Real PasTD "Transverse step on the diameter";
   input Real PasLD "Longitudinal steap on the diameter";
-  input Modelica.SIunits.Diameter Dext "Pipes external diameter";
+  input Modelica.Units.SI.Diameter Dext "Pipes external diameter";
   input Integer option_interpolation=1
     "1: linear interpolation - 2: spline interpolation";
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/Function_U1.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/Function_U1.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/Function_U1.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/Function_U1.mo"	2022-03-10 09:58:52.716153591 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Correlations.Thermal;
 function Function_U1 "Calculation of the uncorrected heat transfer coefficient"
-  input Modelica.SIunits.Diameter D_tubes "Weight average thickness of tubes";
-  input Modelica.SIunits.Velocity Vf "Velocity of cold water";
+  input Modelica.Units.SI.Diameter D_tubes "Weight average thickness of tubes";
+  input Modelica.Units.SI.Velocity Vf "Velocity of cold water";
 
 protected
   Real U11;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBCrossedCurrentConvectiveHeatTransferCoefficient.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBCrossedCurrentConvectiveHeatTransferCoefficient.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBCrossedCurrentConvectiveHeatTransferCoefficient.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBCrossedCurrentConvectiveHeatTransferCoefficient.mo"	2022-03-10 09:58:52.700153588 +0000
@@ -1,16 +1,16 @@
 within ThermoSysPro.Correlations.Thermal;
 function WBCrossedCurrentConvectiveHeatTransferCoefficient
   "Convective heat transfer coefficient for crossed current heat exchangers"
-  input Modelica.SIunits.Temperature TFilm "Film temperature";
-  input Modelica.SIunits.MassFlowRate Qf "Flue gases mass flow rate";
+  input Modelica.Units.SI.Temperature TFilm "Film temperature";
+  input Modelica.Units.SI.MassFlowRate Qf "Flue gases mass flow rate";
   input Real Xh2o "H2O mass fraction in the flue gases";
-  input Modelica.SIunits.Area Sgaz "Geometrical parameter";
-  input Modelica.SIunits.Diameter Dext "Pipes external diameter";
+  input Modelica.Units.SI.Area Sgaz "Geometrical parameter";
+  input Modelica.Units.SI.Diameter Dext "Pipes external diameter";
   input Real Fa "Pipes position coefficient";
   input Integer option_interpolation=1
     "1: linear interpolation - 2: spline interpolation";
 
-  output Modelica.SIunits.CoefficientOfHeatTransfer Kcfc
+  output Modelica.Units.SI.CoefficientOfHeatTransfer Kcfc
     "Convective heat transfer coefficient for crossed current heat exchanger";
 
 protected
@@ -19,10 +19,10 @@
   Real Sgazb "Sgaz in feet^2";
   Real TFilmb "Film temperature in Farenheit";
 
-  //**********************************************************************************
-  //   Values of "Physical properties factor" for cross-current combustion flue gases
-  //   taken from "The Babcock & Wilcox Company - STEAM/its generation and use"
-  //**********************************************************************************/
+//**********************************************************************************
+  //   Values of "Physical properties factor" for cross-current combustion flue gases
+  //   taken from "The Babcock & Wilcox Company - STEAM/its generation and use"
+  //**********************************************************************************/
   constant Real TabUm[5]={0,5,10,15,20};
   constant Real TabTFilm[6]={0,600,1200,1800,2400,3000};
   constant Real TabFpp[5, 6]=[0.0825, 0.11, 0.129, 0.142, 0.155, 0.165; 0.085,
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBFlueGasesHeatTransferCoefficient.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBFlueGasesHeatTransferCoefficient.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBFlueGasesHeatTransferCoefficient.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBFlueGasesHeatTransferCoefficient.mo"	2022-03-10 09:58:52.688153587 +0000
@@ -2,40 +2,40 @@
 function WBFlueGasesHeatTransferCoefficient
   "Flue gases heat transfer coefficient"
   input Real propf[4] "Flue gases properties vector";
-  input Modelica.SIunits.MassFlowRate Qef
+  input Modelica.Units.SI.MassFlowRate Qef
     "Flue gases mass flow rate at the inlet";
-  input Modelica.SIunits.AbsolutePressure Pmf "Flue gases average pressure";
-  input Modelica.SIunits.Temperature Tmf "Flue gases average temperature";
+  input Modelica.Units.SI.AbsolutePressure Pmf "Flue gases average pressure";
+  input Modelica.Units.SI.Temperature Tmf "Flue gases average temperature";
   input Real XefCO2 "CO2 mass fraction at the inlet";
   input Real XefH2O "H2O mass fraction at the inlet";
-  input Modelica.SIunits.PathLength dz "Step in the z direction";
-  input Modelica.SIunits.Length long "Wall zone length";
-  input Modelica.SIunits.Length prof "Wall zone width";
-  input Modelica.SIunits.Temperature Tpext "External wall temperature";
+  input Modelica.Units.SI.PathLength dz "Step in the z direction";
+  input Modelica.Units.SI.Length long "Wall zone length";
+  input Modelica.Units.SI.Length prof "Wall zone width";
+  input Modelica.Units.SI.Temperature Tpext "External wall temperature";
   input Real fvd=0 "Particles volume fraction";
   input Real emimur=0.1 "Wall emissivity";
 
-  output Modelica.SIunits.CoefficientOfHeatTransfer hf
+  output Modelica.Units.SI.CoefficientOfHeatTransfer hf
     "Global heat transfer coefficient";
 
 protected
-  Modelica.SIunits.ThermalConductivity condf "Flue gases thermal conductivity";
-  Modelica.SIunits.SpecificHeatCapacity cpf "Flue gases specific heat capacity";
-  Modelica.SIunits.DynamicViscosity muf "Flue gases dynamic viscosity";
+  Modelica.Units.SI.ThermalConductivity condf "Flue gases thermal conductivity";
+  Modelica.Units.SI.SpecificHeatCapacity cpf "Flue gases specific heat capacity";
+  Modelica.Units.SI.DynamicViscosity muf "Flue gases dynamic viscosity";
   Real Ref "Flue gases Reynolds number";
   Real Prf "Flue gases Prandtl number";
-  Modelica.SIunits.CoefficientOfHeatTransfer hc
+  Modelica.Units.SI.CoefficientOfHeatTransfer hc
     "Flue gases convective heat transfer coefficient";
-  Modelica.SIunits.Volume volumg "Gas volume";
-  Modelica.SIunits.Area senveng "Gas total envelope surface";
-  Modelica.SIunits.Radius rop "Average optical radius between pipes";
+  Modelica.Units.SI.Volume volumg "Gas volume";
+  Modelica.Units.SI.Area senveng "Gas total envelope surface";
+  Modelica.Units.SI.Radius rop "Average optical radius between pipes";
   Real EG " ";
   Real ES " ";
   Real emigaz "Gas emissivity";
   Real emigaz0 "Gas emissivity";
-  Modelica.SIunits.CoefficientOfHeatTransfer hr
-    "Radiation heat transfer coefficient";
 
+  Modelica.Units.SI.CoefficientOfHeatTransfer hr
+    "Radiation heat transfer coefficient";
 algorithm
   condf := propf[1];
   cpf := propf[2];
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBHeatExchangerEfficiency.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBHeatExchangerEfficiency.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBHeatExchangerEfficiency.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBHeatExchangerEfficiency.mo"	2022-03-10 09:58:52.672153586 +0000
@@ -1,14 +1,14 @@
 within ThermoSysPro.Correlations.Thermal;
 function WBHeatExchangerEfficiency "Heat exchanger efficiency"
-  input Modelica.SIunits.MassFlowRate QevC "Steam mass flow rate at the inlet";
-  input Modelica.SIunits.MassFlowRate QeeF "Water mass flow rate at the inlet";
-  input Modelica.SIunits.SpecificHeatCapacity Cc
+  input Modelica.Units.SI.MassFlowRate QevC "Steam mass flow rate at the inlet";
+  input Modelica.Units.SI.MassFlowRate QeeF "Water mass flow rate at the inlet";
+  input Modelica.Units.SI.SpecificHeatCapacity Cc
     "Hot fluid specific heat capacity";
-  input Modelica.SIunits.SpecificHeatCapacity Cf
+  input Modelica.Units.SI.SpecificHeatCapacity Cf
     "Cold fluid specific heat capacity";
-  input Modelica.SIunits.CoefficientOfHeatTransfer KEG0
+  input Modelica.Units.SI.CoefficientOfHeatTransfer KEG0
     "Global heat transfer coefficient";
-  input Modelica.SIunits.Area S0 "External exchange surface";
+  input Modelica.Units.SI.Area S0 "External exchange surface";
   input Real Phase " = 0 ou 1 one-phase flow - otherwise two-phase flow";
 
   output Real EC0 "Heat exchanger efficiency";
@@ -18,9 +18,9 @@
   Real CpMIN "Minimum heat capacity for the two fluids";
   Real CpMAX "Maximum heat capacity for the two fluids";
   Integer TYP2 "0 = co-current, 1 = counter-current";
-  Modelica.SIunits.CoefficientOfHeatTransfer KEG
+  Modelica.Units.SI.CoefficientOfHeatTransfer KEG
     "Global heat exchange coefficient";
-  Modelica.SIunits.Area S "External exchange surface";
+  Modelica.Units.SI.Area S "External exchange surface";
   Real EC "Exchnager efficiency";
 
 algorithm
@@ -28,40 +28,35 @@
 
   /* Verification of the inputs */
   KEG := if (KEG0 > 0) then KEG0 else 10;
-  S := if (S0 > 0) then S0 else 1;
-
-  //  NTU method
-  //  ----------
-
-  /* Minimum and maximum heat capacities */
-  if (QevC*Cc < QeeF*Cf) then
-    CpMIN := noEvent(abs(QevC*Cc));
-    CpMAX := noEvent(abs(QeeF*Cf));
-  else
-    CpMIN := noEvent(abs(QeeF*Cf));
-    CpMAX := noEvent(abs(QevC*Cc));
-  end if;
-
-  /* Heat exchanger efficiency */
-  if ((Phase > 0) and (Phase < 1)) then
-    /* Two-phase flow */
-    NUT := KEG*S/noEvent(abs(QeeF*Cf));
-    EC := 1 - Modelica.Math.exp(-NUT);
-  else
-    NUT := KEG*S/CpMIN;
-    /* One-phase flow */
-    /* Crossed currents */
-    if (abs(QevC*Cc) < abs(QeeF*Cf)) then
-      /* CpMIN is associated to the flue gases (fluide brasse) */
-      EC := 1. - Modelica.Math.exp(-(abs(QeeF*Cf)/abs(QevC*Cc))*(1. - Modelica.Math.exp(-NUT*abs(QevC*Cc)/abs(QeeF*Cf))));
-    else
-      /* CpMIN is associated to water (fluide non brasse) */
-      EC := abs(QevC*Cc)/abs(QeeF*Cf)*(1. - Modelica.Math.exp(-abs(QeeF*Cf)/abs(QevC*Cc)*(1 - Modelica.Math.exp(-NUT))));
-    end if;
-  end if;
-
-  EC0 := if (EC > 0.) then EC else 1.e-2;
-
+  S := if (S0 > 0) then S0 else 1;
+//  NTU method
+//  ----------
+/* Minimum and maximum heat capacities */
+  if QevC * Cc < QeeF * Cf then
+    CpMIN := noEvent(abs(QevC * Cc));
+    CpMAX := noEvent(abs(QeeF * Cf));
+  else
+    CpMIN := noEvent(abs(QeeF * Cf));
+    CpMAX := noEvent(abs(QevC * Cc));
+  end if;
+/* Heat exchanger efficiency */
+  if Phase > 0 and Phase < 1 then
+    NUT := KEG * S / noEvent(abs(QeeF * Cf));
+    EC := 1 - Modelica.Math.exp(-NUT);
+  else
+    NUT := KEG * S / CpMIN;
+    if abs(QevC * Cc) < abs(QeeF * Cf) then
+      EC := 1. - Modelica.Math.exp(-abs(QeeF * Cf) / abs(QevC * Cc) * (1. - Modelica.Math.exp(-NUT * abs(QevC * Cc) / abs(QeeF * Cf))));
+    else
+      EC := abs(QevC * Cc) / abs(QeeF * Cf) * (1. - Modelica.Math.exp(-abs(QeeF * Cf) / abs(QevC * Cc) * (1 - Modelica.Math.exp(-NUT))));
+    end if;
+  end if;
+/* Two-phase flow */
+/* One-phase flow */
+/* Crossed currents */
+/* CpMIN is associated to the flue gases (fluide brasse) */
+/* CpMIN is associated to water (fluide non brasse) */
+  EC0 := if EC > 0. then EC else 1.e-2;
   annotation (
     smoothOrder=2,
     Icon(graphics),        Documentation(revisions="<html>
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBInternalHeatTransferCoefficient.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBInternalHeatTransferCoefficient.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBInternalHeatTransferCoefficient.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBInternalHeatTransferCoefficient.mo"	2022-03-10 09:58:52.660153584 +0000
@@ -8,48 +8,48 @@
   input Real geomt[6] "Geometrical data vector";
   input Real Gm "Water mass velocity at the inlet (kg/m2s)";
   input Real Xmc "Steam average mass fraction";
-  input Modelica.SIunits.Power flux "Heat flux";
-  input Modelica.SIunits.AbsolutePressure Pmc "Water average pressure";
-  input Modelica.SIunits.Area Si "Internal exchnage surface over dz";
+  input Modelica.Units.SI.Power flux "Heat flux";
+  input Modelica.Units.SI.AbsolutePressure Pmc "Water average pressure";
+  input Modelica.Units.SI.Area Si "Internal exchnage surface over dz";
 
-  output Modelica.SIunits.CoefficientOfHeatTransfer hi
+  output Modelica.Units.SI.CoefficientOfHeatTransfer hi
     "Internal heat transfer coefficient";
 
 protected
-  constant Modelica.SIunits.AbsolutePressure Pc=221.2e5 "Critical pressure";
-  Modelica.SIunits.Density rhol "Density of the liquid phase";
-  Modelica.SIunits.Density rhov "Density of the steam phase";
-  Modelica.SIunits.DynamicViscosity mul "Dynamic viscosity of the liquid phase";
-  Modelica.SIunits.DynamicViscosity muv "Dynamic viscosity of the vapor phase";
-  Modelica.SIunits.ThermalConductivity kl
+  constant Modelica.Units.SI.AbsolutePressure Pc=221.2e5 "Critical pressure";
+  Modelica.Units.SI.Density rhol "Density of the liquid phase";
+  Modelica.Units.SI.Density rhov "Density of the steam phase";
+  Modelica.Units.SI.DynamicViscosity mul "Dynamic viscosity of the liquid phase";
+  Modelica.Units.SI.DynamicViscosity muv "Dynamic viscosity of the vapor phase";
+  Modelica.Units.SI.ThermalConductivity kl
     "Thermal conductivity of the liquid phase";
-  Modelica.SIunits.ThermalConductivity kv
+  Modelica.Units.SI.ThermalConductivity kv
     "Thermal conductivity of the vapor phase";
-  Modelica.SIunits.SpecificHeatCapacity cpl
+  Modelica.Units.SI.SpecificHeatCapacity cpl
     "Specific heat capacity of the liquid phase";
-  Modelica.SIunits.SpecificHeatCapacity cpv
+  Modelica.Units.SI.SpecificHeatCapacity cpv
     "Specific heat capacity of the vapor phase";
-  Modelica.SIunits.SpecificEnergy lv "Phase transition change energy";
-  Modelica.SIunits.Diameter dtin "Pipes internal diameter";
+  Modelica.Units.SI.SpecificEnergy lv "Phase transition change energy";
+  Modelica.Units.SI.Diameter dtin "Pipes internal diameter";
   Real Xmc0 "Steam average mass fraction";
   Real Frl "Froude number for the computation of hi";
   Real Frl0 "Froude number for the computation of hi";
   Real Xtt "Martinelli number";
   Real Rel "Reynolds number for the computation of hi";
   Real Prl "Prandtl number for the computation of hi";
-  Modelica.SIunits.CoefficientOfHeatTransfer hc
+  Modelica.Units.SI.CoefficientOfHeatTransfer hc
     "Convective heat transfer coefficient for the compuation of hi";
   Real Bo "Boiling number";
   Real E "Variable for the compuation of hi";
   Real pred "Variable for the compuation of hi";
-  Modelica.SIunits.CoefficientOfHeatTransfer heb
+  Modelica.Units.SI.CoefficientOfHeatTransfer heb
     "Boiling heat transfer coefficient";
   Real S "Corrective term for the removal of nucleation";
   Real Rev "Reynolds number for the computation of hi";
   Real Prv "Prandtl number for the computation of hi";
-  Modelica.SIunits.CoefficientOfHeatTransfer hvi
-    "Heat transfer coefficient for the drying of the wall";
 
+  Modelica.Units.SI.CoefficientOfHeatTransfer hvi
+    "Heat transfer coefficient for the drying of the wall";
 algorithm
   rhol := hy.rhol;
   rhov := hy.rhov;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBInternalOnePhaseFlowHeatTransferCoefficient.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBInternalOnePhaseFlowHeatTransferCoefficient.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBInternalOnePhaseFlowHeatTransferCoefficient.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBInternalOnePhaseFlowHeatTransferCoefficient.mo"	2022-03-10 09:58:52.640153582 +0000
@@ -8,16 +8,16 @@
   input Real geomt[6] "Geometrical data vector";
   input Real Gm "Water mass velocity at the inlet (kg/m2s)";
 
-  output Modelica.SIunits.CoefficientOfHeatTransfer hi
+  output Modelica.Units.SI.CoefficientOfHeatTransfer hi
     "Internal heat transfer coefficient";
 
 protected
-  Modelica.SIunits.DynamicViscosity mul "Dynamic viscosity of the liquid phase";
-  Modelica.SIunits.SpecificHeatCapacity cpl
+  Modelica.Units.SI.DynamicViscosity mul "Dynamic viscosity of the liquid phase";
+  Modelica.Units.SI.SpecificHeatCapacity cpl
     "Specific heat capacity of the liquid phase";
-  Modelica.SIunits.ThermalConductivity kl
+  Modelica.Units.SI.ThermalConductivity kl
     "Thermal conductivity of the liquid phase";
-  Modelica.SIunits.Diameter dtin "Pipes internal diameter";
+  Modelica.Units.SI.Diameter dtin "Pipes internal diameter";
   Real Re "Reynolds number for the computation of hi";
   Real Pr "Prandtl Reynolds number for the computation of hi";
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBInternalSuperCriticalFlowHeatTransferCoefficient.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBInternalSuperCriticalFlowHeatTransferCoefficient.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBInternalSuperCriticalFlowHeatTransferCoefficient.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBInternalSuperCriticalFlowHeatTransferCoefficient.mo"	2022-03-10 09:58:52.636153580 +0000
@@ -7,20 +7,20 @@
         transformation(extent={{-26,-74},{-6,-54}}, rotation=0)));
   input Real geomt[6] "Geometrical data vector";
   input Real Gm "Water mass velocity at the inlet (kg/m2s)";
-  input Modelica.SIunits.AbsolutePressure Pmc "Water average pressure";
-  input Modelica.SIunits.Temperature Tmc "Water average temperature";
-  input Modelica.SIunits.Temperature Tpint "Wall temperature";
+  input Modelica.Units.SI.AbsolutePressure Pmc "Water average pressure";
+  input Modelica.Units.SI.Temperature Tmc "Water average temperature";
+  input Modelica.Units.SI.Temperature Tpint "Wall temperature";
 
-  output Modelica.SIunits.CoefficientOfHeatTransfer hi
+  output Modelica.Units.SI.CoefficientOfHeatTransfer hi
     "Internal heat transfer coefficient";
 
 protected
-  Modelica.SIunits.DynamicViscosity mul "Dynamic viscosity of the liquid phase";
-  Modelica.SIunits.SpecificHeatCapacity cpl
+  Modelica.Units.SI.DynamicViscosity mul "Dynamic viscosity of the liquid phase";
+  Modelica.Units.SI.SpecificHeatCapacity cpl
     "Specific heat capacity of the liquid phase";
-  Modelica.SIunits.ThermalConductivity kl
+  Modelica.Units.SI.ThermalConductivity kl
     "Thermal conductivity of the liquid phase";
-  Modelica.SIunits.Diameter dtin "Pipes internal diameter";
+  Modelica.Units.SI.Diameter dtin "Pipes internal diameter";
   Real Re "Reynolds number for the computation of hi";
   Real Pr "Prandtl number for the computation of hi";
   Real cor1 "Corrective coefficient for hi in the supercritical case";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBInternalTwoPhaseFlowHeatTransferCoefficient.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBInternalTwoPhaseFlowHeatTransferCoefficient.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBInternalTwoPhaseFlowHeatTransferCoefficient.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBInternalTwoPhaseFlowHeatTransferCoefficient.mo"	2022-03-10 09:58:52.624153579 +0000
@@ -8,48 +8,48 @@
   input Real geomt[6] "Geometrical data vector";
   input Real Gm "Water mass velocity at the inlet (kg/m2s)";
   input Real Xmc "Steam average mass fraction";
-  input Modelica.SIunits.Power flux "Heat flux";
-  input Modelica.SIunits.AbsolutePressure Pmc "Water average pressure";
-  input Modelica.SIunits.Area Si "Internal exchnage surface over dz";
+  input Modelica.Units.SI.Power flux "Heat flux";
+  input Modelica.Units.SI.AbsolutePressure Pmc "Water average pressure";
+  input Modelica.Units.SI.Area Si "Internal exchnage surface over dz";
 
-  output Modelica.SIunits.CoefficientOfHeatTransfer hi
+  output Modelica.Units.SI.CoefficientOfHeatTransfer hi
     "Internal heat transfer coefficient";
 
 protected
-  constant Modelica.SIunits.AbsolutePressure Pc=221.2e5 "Critical pressure";
-  Modelica.SIunits.Density rhol "Density of the liquid phase";
-  Modelica.SIunits.Density rhov "Density of the steam phase";
-  Modelica.SIunits.DynamicViscosity mul "Dynamic viscosity of the liquid phase";
-  Modelica.SIunits.DynamicViscosity muv "Dynamic viscosity of the vapor phase";
-  Modelica.SIunits.ThermalConductivity kl
+  constant Modelica.Units.SI.AbsolutePressure Pc=221.2e5 "Critical pressure";
+  Modelica.Units.SI.Density rhol "Density of the liquid phase";
+  Modelica.Units.SI.Density rhov "Density of the steam phase";
+  Modelica.Units.SI.DynamicViscosity mul "Dynamic viscosity of the liquid phase";
+  Modelica.Units.SI.DynamicViscosity muv "Dynamic viscosity of the vapor phase";
+  Modelica.Units.SI.ThermalConductivity kl
     "Thermal conductivity of the liquid phase";
-  Modelica.SIunits.ThermalConductivity kv
+  Modelica.Units.SI.ThermalConductivity kv
     "Thermal conductivity of the vapor phase";
-  Modelica.SIunits.SpecificHeatCapacity cpl
+  Modelica.Units.SI.SpecificHeatCapacity cpl
     "Specific heat capacity of the liquid phase";
-  Modelica.SIunits.SpecificHeatCapacity cpv
+  Modelica.Units.SI.SpecificHeatCapacity cpv
     "Specific heat capacity of the vapor phase";
-  Modelica.SIunits.SpecificEnergy lv "Phase transition change energy";
-  Modelica.SIunits.Diameter dtin "Pipes internal diameter";
+  Modelica.Units.SI.SpecificEnergy lv "Phase transition change energy";
+  Modelica.Units.SI.Diameter dtin "Pipes internal diameter";
   Real Xmc0 "Steam average mass fraction";
   Real Frl "Froude number for the computation of hi";
   Real Frl0 "Froude number for the computation of hi";
   Real Xtt "Martinelli number";
   Real Rel "Reynolds number for the computation of hi";
   Real Prl "Prandtl number for the computation of hi";
-  Modelica.SIunits.CoefficientOfHeatTransfer hc
+  Modelica.Units.SI.CoefficientOfHeatTransfer hc
     "Convective heat transfer coefficient for the compuation of hi";
   Real Bo "Boiling number";
   Real E "Variable for the compuation of hi";
   Real pred "Variable for the compuation of hi";
-  Modelica.SIunits.CoefficientOfHeatTransfer heb
+  Modelica.Units.SI.CoefficientOfHeatTransfer heb
     "Boiling heat transfer coefficient";
   Real S "Corrective term for the removal of nucleation";
   Real Rev "Reynolds number for the computation of hi";
   Real Prv "Prandtl number for the computation of hi";
-  Modelica.SIunits.CoefficientOfHeatTransfer hvi
-    "Heat transfer coefficient for the drying of the wall";
 
+  Modelica.Units.SI.CoefficientOfHeatTransfer hvi
+    "Heat transfer coefficient for the drying of the wall";
 algorithm
   rhol := hy.rhol;
   rhov := hy.rhov;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBLongitudinalCurrentConvectiveHeatTransferCoefficient.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBLongitudinalCurrentConvectiveHeatTransferCoefficient.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBLongitudinalCurrentConvectiveHeatTransferCoefficient.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBLongitudinalCurrentConvectiveHeatTransferCoefficient.mo"	2022-03-10 09:58:52.612153577 +0000
@@ -1,16 +1,16 @@
-﻿within ThermoSysPro.Correlations.Thermal;
+within ThermoSysPro.Correlations.Thermal;
 function WBLongitudinalCurrentConvectiveHeatTransferCoefficient
   "Convective heat transfer coefficient for co- or counter-current heat exchangers"
-  input Modelica.SIunits.Temperature TFilm "Film temperature";
-  input Modelica.SIunits.Temperature Tmf "Flue gases average temperature";
-  input Modelica.SIunits.MassFlowRate Qf "Flue gases mass flow rate";
+  input Modelica.Units.SI.Temperature TFilm "Film temperature";
+  input Modelica.Units.SI.Temperature Tmf "Flue gases average temperature";
+  input Modelica.Units.SI.MassFlowRate Qf "Flue gases mass flow rate";
   input Real Xh2o "H2O mass fraction";
-  input Modelica.SIunits.Area Sgaz "Geometrical parameter";
-  input Modelica.SIunits.Diameter Dext "Pipes external diameter";
+  input Modelica.Units.SI.Area Sgaz "Geometrical parameter";
+  input Modelica.Units.SI.Diameter Dext "Pipes external diameter";
   input Integer option_interpolation=1
     "1: linear interpolation - 2: spline interpolation";
 
-  output Modelica.SIunits.CoefficientOfHeatTransfer Kcfl
+  output Modelica.Units.SI.CoefficientOfHeatTransfer Kcfl
     "Convective heat transfer coefficient for longitudinal flows";
 
 protected
@@ -20,10 +20,10 @@
   Real TFilmb "Film temperature in Farenheit";
   Real Tmfb "Température moyenne des fumées en °F";
 
-  //**********************************************************************************
-  //   Values of "Physical properties factor" for transverse flow combustion flue gases
-  //   taken from "The Babcock & Wilcox Company - STEAM/its generation and use"
-  //**********************************************************************************/
+//**********************************************************************************
+  //   Values of "Physical properties factor" for transverse flow combustion flue gases
+  //   taken from "The Babcock & Wilcox Company - STEAM/its generation and use"
+  //**********************************************************************************/
   constant Real TabUm[5]={0,5,10,15,20};
   constant Real TabTFilm[12]={0,200,400,600,800,1000,1200,1400,1600,2000,2400,
       2800};
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBRadiativeHeatTransferCoefficient.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBRadiativeHeatTransferCoefficient.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBRadiativeHeatTransferCoefficient.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Correlations/Thermal/WBRadiativeHeatTransferCoefficient.mo"	2022-03-10 09:58:52.604153577 +0000
@@ -1,20 +1,20 @@
-﻿within ThermoSysPro.Correlations.Thermal;
+within ThermoSysPro.Correlations.Thermal;
 function WBRadiativeHeatTransferCoefficient
   "Radiative heat transfer coefficient for the wall heat exchanger"
   input ThermoSysPro.Units.DifferentialTemperature DeltaT
     "Temperature difference between the flue gases and the walls";
-  input Modelica.SIunits.Temperature Tp "Surface temperature";
+  input Modelica.Units.SI.Temperature Tp "Surface temperature";
   input Real Pph2o "H20 fraction";
   input Real Ppco2 "CO2 fraction";
   input Real Beaml "Geometrical parameter";
   input Integer option_interpolation=1
     "1: linear interpolation - 2: spline interpolation";
 
-  output Modelica.SIunits.CoefficientOfHeatTransfer Kr
+  output Modelica.Units.SI.CoefficientOfHeatTransfer Kr
     "Radiative heat transgfer coefficient";
 
 protected
-  Modelica.SIunits.AbsolutePressure Pgaz "CO2+H2O partial pressure";
+  Modelica.Units.SI.AbsolutePressure Pgaz "CO2+H2O partial pressure";
   Real Rap "H20/C02 partial pressure";
   Real Kprim "Interpolation result over TabKr";
   Real Ak "Interpolation result over TabK2";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/ElectroMechanics/BoundaryConditions/SourceAngularVelocity.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/ElectroMechanics/BoundaryConditions/SourceAngularVelocity.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/ElectroMechanics/BoundaryConditions/SourceAngularVelocity.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/ElectroMechanics/BoundaryConditions/SourceAngularVelocity.mo"	2022-03-10 09:58:52.548153569 +0000
@@ -6,7 +6,7 @@
   constant Real pi=Modelica.Constants.pi "pi";
 
 public
-  Modelica.SIunits.AngularVelocity w "Angular velocity";
+  Modelica.Units.SI.AngularVelocity w "Angular velocity";
 
   ThermoSysPro.ElectroMechanics.Connectors.MechanichalTorque M
     annotation (Placement(transformation(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/ElectroMechanics/BoundaryConditions/SourceMechanicalPower.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/ElectroMechanics/BoundaryConditions/SourceMechanicalPower.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/ElectroMechanics/BoundaryConditions/SourceMechanicalPower.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/ElectroMechanics/BoundaryConditions/SourceMechanicalPower.mo"	2022-03-10 09:58:52.540153569 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.ElectroMechanics.BoundaryConditions;
 model SourceMechanicalPower "Mechanical power source"
-  parameter Modelica.SIunits.Power W0=150000;
+  parameter Modelica.Units.SI.Power W0=150000;
 
   ThermoSysPro.ElectroMechanics.Connectors.MechanichalTorque M
     annotation (Placement(transformation(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/ElectroMechanics/BoundaryConditions/SourceTorque.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/ElectroMechanics/BoundaryConditions/SourceTorque.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/ElectroMechanics/BoundaryConditions/SourceTorque.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/ElectroMechanics/BoundaryConditions/SourceTorque.mo"	2022-03-10 09:58:52.532153567 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.ElectroMechanics.BoundaryConditions;
 model SourceTorque "Torque source"
-  parameter Modelica.SIunits.Torque T0=0;
+  parameter Modelica.Units.SI.Torque T0=0;
 
   ThermoSysPro.ElectroMechanics.Connectors.MechanichalTorque M
     annotation (Placement(transformation(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/ElectroMechanics/Connectors.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/ElectroMechanics/Connectors.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/ElectroMechanics/Connectors.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/ElectroMechanics/Connectors.mo"	2022-03-10 09:58:52.520153566 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.ElectroMechanics;
 package Connectors "Connectors"
   connector MechanichalTorque "Mechanical torque"
-    Modelica.SIunits.Torque Ctr "Torque";
-    Modelica.SIunits.AngularVelocity w "Angular velocity";
+    Modelica.Units.SI.Torque Ctr "Torque";
+    Modelica.Units.SI.AngularVelocity w "Angular velocity";
     annotation (
       Window(
         x=0.25,
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/ElectroMechanics/Machines/Shaft.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/ElectroMechanics/Machines/Shaft.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/ElectroMechanics/Machines/Shaft.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/ElectroMechanics/Machines/Shaft.mo"	2022-03-10 09:58:52.492153562 +0000
@@ -6,10 +6,10 @@
     "true: start from steady state - false: start from delta=0";
 
 public
-  Modelica.SIunits.Angle delta(start=0) "Torsion angle";
-  Modelica.SIunits.AngularVelocity w_rel
+  Modelica.Units.SI.Angle delta(start=0) "Torsion angle";
+  Modelica.Units.SI.AngularVelocity w_rel
     "Relative angular speed between the two extremities of the shaft";
-  Modelica.SIunits.Torque Ctr "Transmitted torque";
+  Modelica.Units.SI.Torque Ctr "Transmitted torque";
   ThermoSysPro.ElectroMechanics.Connectors.MechanichalTorque C2
                                   annotation (Placement(transformation(extent={
             {100,-10},{120,10}}, rotation=0)));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/ElectroMechanics/Machines/SynchronousMotor.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/ElectroMechanics/Machines/SynchronousMotor.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/ElectroMechanics/Machines/SynchronousMotor.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/ElectroMechanics/Machines/SynchronousMotor.mo"	2022-03-10 09:58:52.484153562 +0000
@@ -4,12 +4,12 @@
     "Nominal rotational speed";
   parameter ThermoSysPro.Units.AngularVelocity_rpm Vrot0=0
     "Initial rotational speed (active if steady_state_mech=true)";
-  parameter Modelica.SIunits.Voltage Ualim=380. "Voltage";
+  parameter Modelica.Units.SI.Voltage Ualim=380. "Voltage";
   parameter Real D=10.0 "Damping coefficient (mechanical losses) (n.u.)";
-  parameter Modelica.SIunits.Inductance Lm=1. "Motor nductance";
-  parameter Modelica.SIunits.Resistance Rm=0.00001 "Motor resistance";
+  parameter Modelica.Units.SI.Inductance Lm=1. "Motor nductance";
+  parameter Modelica.Units.SI.Resistance Rm=0.00001 "Motor resistance";
   parameter Real Ki=1. "Proportionnality coef. between Cm and Im (N.m/A)";
-  parameter Modelica.SIunits.MomentOfInertia J=4. "Motor moment of inertia";
+  parameter Modelica.Units.SI.MomentOfInertia J=4. "Motor moment of inertia";
   parameter Boolean steady_state_mech=true
     "true: start from steady state - false : start from Vrot0";
   parameter Boolean mech_coupling=true "Use mechanical coupling component";
@@ -20,13 +20,13 @@
     "Voltage in rotor under stationary state";
 
 public
-  Modelica.SIunits.AngularVelocity w "Angular speed";
-  Modelica.SIunits.Torque Cm "Motor torque";
-  Modelica.SIunits.Torque Ctr "Mechanical torque";
-  Modelica.SIunits.Current Im "Current";
-  Modelica.SIunits.Voltage Um "Voltage";
 
 
+  Modelica.Units.SI.AngularVelocity w "Angular speed";
+  Modelica.Units.SI.Torque Cm "Motor torque";
+  Modelica.Units.SI.Torque Ctr "Mechanical torque";
+  Modelica.Units.SI.Current Im "Current";
+  Modelica.Units.SI.Voltage Um "Voltage";
 public
   ThermoSysPro.InstrumentationAndControl.Connectors.InputLogical marche
     annotation (Placement(transformation(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/PowerPlants/CombinedCyclePowerPlant/GasTurbineTrip.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/PowerPlants/CombinedCyclePowerPlant/GasTurbineTrip.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/PowerPlants/CombinedCyclePowerPlant/GasTurbineTrip.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/PowerPlants/CombinedCyclePowerPlant/GasTurbineTrip.mo"	2022-03-10 09:58:52.392153549 +0000
@@ -6,21 +6,19 @@
     "Turbine HP: Nominal isentropic efficiency ";
   parameter Real CstMP(fixed=false,start=278905.664031036)
     "Stodola's ellipse coefficient MP";
-  //parameter Real EtaIsNomMP(fixed=false,start=0.96)
-  //  "Turbine MP: Nominal isentropic efficiency ";
+  //parameter Real EtaIsNomMP(fixed=false,start=0.96)
+  //  "Turbine MP: Nominal isentropic efficiency ";
   parameter Real CstBP(fixed=false,start=13491.6445678148)
     "Stodola's ellipse coefficient BP";
   parameter Real EtaIsNomBP(fixed=false,start=0.92)
     "Turbine MP: Nominal isentropic efficiency ";
-// //
-  //parameter Modelica.SIunits.AbsolutePressure PoutPumpEx(fixed=false,start=22e5)"Flow pressure at the outlet of the pump";
-  //parameter Modelica.SIunits.Length zc(fixed=false,start=1.5) "Condenser water level";
-
+  // //
+  //parameter Modelica.SIunits.AbsolutePressure PoutPumpEx(fixed=false,start=22e5)"Flow pressure at the outlet of the pump";
+  //parameter Modelica.SIunits.Length zc(fixed=false,start=1.5) "Condenser water level";
   parameter Real LP_Pump_a1(fixed=false,start=-6000)
     "x^2 coef. of the pump characteristics hn = f(vol_flow) (s2/m5)";
 
-  //parameter Real a3_PumpBP(fixed=false,start=400)"Constant coef. of the pump characteristics hn = f(vol_flow) (m)";
-
+//parameter Real a3_PumpBP(fixed=false,start=400)"Constant coef. of the pump characteristics hn = f(vol_flow) (m)";
   parameter ThermoSysPro.Units.Cv CvmaxValveAHP(fixed=false,start=135)
     "Maximum CV: alim. valve MP Drum ";
   parameter ThermoSysPro.Units.Cv CvmaxValveVHP(fixed=false,start=47829.4)
@@ -32,14 +30,13 @@
   parameter ThermoSysPro.Units.Cv CvmaxValveVBP(fixed=false,start=32000)
     "Maximum CV: steame valve BP Drum ";
 
-  //parameter ThermoSysPro.Units.Cv CvmaxValveWBP(fixed=false,start=10000)
-  //  "Maximum CV: Water valve BP Drum ";
-
+//parameter ThermoSysPro.Units.Cv CvmaxValveWBP(fixed=false,start=10000)
+  //  "Maximum CV: Water valve BP Drum ";
   parameter Real Fouling_SHP(fixed=false,start=0.075)
     "Sur HP: heat exchange fouling coefficient";
 
-  //parameter Real Fouling_EHP(fixed=false,start=1)
-  //  "Eco HP1: heat exchange fouling coefficient";
+//parameter Real Fouling_EHP(fixed=false,start=1)
+  //  "Eco HP1: heat exchange fouling coefficient";
   parameter Real Fouling_EHP1(fixed=false,start=0.07)
     "Eco HP1: heat exchange fouling coefficient";
   parameter Real Fouling_EHP2(fixed=false,start=0.11)
@@ -52,9 +49,8 @@
   parameter Real Fouling_SMP(fixed=false,start=0.1358)
     "Sur MP1: heat exchange fouling coefficient";
 
-  //parameter Real Fouling_SMP(fixed=true,start=0.065)
-  //  "Sur MP1: heat exchange fouling coefficient";
-
+//parameter Real Fouling_SMP(fixed=true,start=0.065)
+  //  "Sur MP1: heat exchange fouling coefficient";
   parameter Real Fouling_EMP(fixed=false,start=0.09)
     "Eco MP: heat exchange fouling coefficient";
 
@@ -77,8 +73,8 @@
   parameter Real K_Dp_HP_2(fixed=false,start=10.)
     "SMPin: Friction pressure loss coefficient";
 
-  //parameter Real K_PerteChargeZero2(fixed=true,start=1e-4)
-  //  "TurbineMP out: Friction pressure loss coefficient";
+//parameter Real K_PerteChargeZero2(fixed=true,start=1e-4)
+  //  "TurbineMP out: Friction pressure loss coefficient";
   parameter Real K_Dp_HP_IP(fixed=false,start=1.)
     "Outlet THP: Friction pressure loss coefficient";
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/PowerPlants/CombinedCyclePowerPlant/LoadVariation.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/PowerPlants/CombinedCyclePowerPlant/LoadVariation.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/PowerPlants/CombinedCyclePowerPlant/LoadVariation.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/PowerPlants/CombinedCyclePowerPlant/LoadVariation.mo"	2022-03-10 09:58:51.800153475 +0000
@@ -6,21 +6,19 @@
     "Turbine HP: Nominal isentropic efficiency ";
   parameter Real CstMP(fixed=false,start=278905.664031036)
     "Stodola's ellipse coefficient MP";
-  //parameter Real EtaIsNomMP(fixed=false,start=0.96)
-  //  "Turbine MP: Nominal isentropic efficiency ";
+  //parameter Real EtaIsNomMP(fixed=false,start=0.96)
+  //  "Turbine MP: Nominal isentropic efficiency ";
   parameter Real CstBP(fixed=false,start=13491.6445678148)
     "Stodola's ellipse coefficient BP";
   parameter Real EtaIsNomBP(fixed=false,start=0.92)
     "Turbine MP: Nominal isentropic efficiency ";
-// //
-  //parameter Modelica.SIunits.AbsolutePressure PoutPumpEx(fixed=false,start=22e5)"Flow pressure at the outlet of the pump";
-  //parameter Modelica.SIunits.Length zc(fixed=false,start=1.5) "Condenser water level";
-
+  // //
+  //parameter Modelica.SIunits.AbsolutePressure PoutPumpEx(fixed=false,start=22e5)"Flow pressure at the outlet of the pump";
+  //parameter Modelica.SIunits.Length zc(fixed=false,start=1.5) "Condenser water level";
   parameter Real LP_Pump_a1(fixed=false,start=-6000)
     "x^2 coef. of the pump characteristics hn = f(vol_flow) (s2/m5)";
 
-  //parameter Real a3_PumpBP(fixed=false,start=400)"Constant coef. of the pump characteristics hn = f(vol_flow) (m)";
-
+//parameter Real a3_PumpBP(fixed=false,start=400)"Constant coef. of the pump characteristics hn = f(vol_flow) (m)";
   parameter ThermoSysPro.Units.Cv CvmaxValveAHP(fixed=false,start=135)
     "Maximum CV: alim. valve MP Drum ";
   parameter ThermoSysPro.Units.Cv CvmaxValveVHP(fixed=false,start=47829.4)
@@ -32,14 +30,13 @@
   parameter ThermoSysPro.Units.Cv CvmaxValveVBP(fixed=false,start=32000)
     "Maximum CV: steame valve BP Drum ";
 
-  //parameter ThermoSysPro.Units.Cv CvmaxValveWBP(fixed=false,start=10000)
-  //  "Maximum CV: Water valve BP Drum ";
-
+//parameter ThermoSysPro.Units.Cv CvmaxValveWBP(fixed=false,start=10000)
+  //  "Maximum CV: Water valve BP Drum ";
   parameter Real Fouling_SHP(fixed=false,start=0.075)
     "Sur HP: heat exchange fouling coefficient";
 
-  //parameter Real Fouling_EHP(fixed=false,start=1)
-  //  "Eco HP1: heat exchange fouling coefficient";
+//parameter Real Fouling_EHP(fixed=false,start=1)
+  //  "Eco HP1: heat exchange fouling coefficient";
   parameter Real Fouling_EHP1(fixed=false,start=0.07)
     "Eco HP1: heat exchange fouling coefficient";
   parameter Real Fouling_EHP2(fixed=false,start=0.11)
@@ -52,9 +49,8 @@
   parameter Real Fouling_SMP(fixed=false,start=0.1358)
     "Sur MP1: heat exchange fouling coefficient";
 
-  //parameter Real Fouling_SMP(fixed=true,start=0.065)
-  //  "Sur MP1: heat exchange fouling coefficient";
-
+//parameter Real Fouling_SMP(fixed=true,start=0.065)
+  //  "Sur MP1: heat exchange fouling coefficient";
   parameter Real Fouling_EMP(fixed=false,start=0.09)
     "Eco MP: heat exchange fouling coefficient";
 
@@ -77,8 +73,8 @@
   parameter Real K_Dp_HP_2(fixed=false,start=10.)
     "SMPin: Friction pressure loss coefficient";
 
-  //parameter Real K_PerteChargeZero2(fixed=true,start=1e-4)
-  //  "TurbineMP out: Friction pressure loss coefficient";
+//parameter Real K_PerteChargeZero2(fixed=true,start=1e-4)
+  //  "TurbineMP out: Friction pressure loss coefficient";
   parameter Real K_Dp_HP_IP(fixed=false,start=1.)
     "Outlet THP: Friction pressure loss coefficient";
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/PowerPlants/ConcentratedSolarPowerPlant_PTSC.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/PowerPlants/ConcentratedSolarPowerPlant_PTSC.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/PowerPlants/ConcentratedSolarPowerPlant_PTSC.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/PowerPlants/ConcentratedSolarPowerPlant_PTSC.mo"	2022-03-10 09:58:51.348153417 +0000
@@ -1,9 +1,9 @@
-﻿within ThermoSysPro.Examples.Book.PowerPlants;
+within ThermoSysPro.Examples.Book.PowerPlants;
 model ConcentratedSolarPowerPlant_PTSC "Model of a concentrated solar power plant with PTSC"
   import ThermoSysPro;
 
-//parameter Real L1 = 500 "Longueur de la première chaine de capteurs";
-parameter Real L1 = 500 "Longueur de la première chaine de capteurs";
+//parameter Real L1 = 500 "Longueur de la première chaine de capteurs";
+  parameter Real L1 = 500 "Longueur de la première chaine de capteurs";
 parameter Integer Ns1 = 20
     "Nombre de mailles de la première chaine de capteurs";
 
@@ -13,8 +13,8 @@
 parameter Real L3 = 450 "Longueur de la première chaine de capteurs";
 parameter Integer Ns3 = 80 "Nombre de mailles de la première échangeur";
 
-//parameter Real L4 = 7.9254 "Longueur de la première chaine de capteurs";
-parameter Real L4 = 20 "Longueur de la première chaine de capteurs";
+//parameter Real L4 = 7.9254 "Longueur de la première chaine de capteurs";
+  parameter Real L4 = 20 "Longueur de la première chaine de capteurs";
 parameter Integer Ns4 = 3 "Nombre de mailles de la première échangeur";
 
   WaterSteam.HeatExchangers.DynamicOnePhaseFlowPipe TubeEcran_2(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/SimpleExamples/HeatExchanger/TestDynamicCondenser.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/SimpleExamples/HeatExchanger/TestDynamicCondenser.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/SimpleExamples/HeatExchanger/TestDynamicCondenser.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/SimpleExamples/HeatExchanger/TestDynamicCondenser.mo"	2022-03-10 09:58:50.868153356 +0000
@@ -4,9 +4,8 @@
   parameter Real COP1( fixed=false,start=0.7)
     "Corrective terme for heat exchange coefficient or Fouling coefficient";
 
-  //parameter Modelica.SIunits.MassFlowRate QCRF = 20000 "CRF mass flow rate";
-  //parameter Modelica.SIunits.Position z=1.05 "Liquid level in Cavity";
-
+//parameter Modelica.SIunits.MassFlowRate QCRF = 20000 "CRF mass flow rate";
+  //parameter Modelica.SIunits.Position z=1.05 "Liquid level in Cavity";
   ThermoSysPro.WaterSteam.BoundaryConditions.SourceQ Source_Eau(
                 h0=50000, Q0=19000)
           annotation (Placement(transformation(extent={{-191,-27},{-133,29}},
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/SimpleExamples/HeatExchanger/TestSimpleDynamicCondenser.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/SimpleExamples/HeatExchanger/TestSimpleDynamicCondenser.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/SimpleExamples/HeatExchanger/TestSimpleDynamicCondenser.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/SimpleExamples/HeatExchanger/TestSimpleDynamicCondenser.mo"	2022-03-10 09:58:50.788153347 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.Examples.Book.SimpleExamples.HeatExchanger;
+within ThermoSysPro.Examples.Book.SimpleExamples.HeatExchanger;
 model TestSimpleDynamicCondenser
 
 parameter Real L1 = 425 "Longueur de la première chaine de capteurs";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/SimpleExamples/HeatExchanger/TestStaticCondenser.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/SimpleExamples/HeatExchanger/TestStaticCondenser.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/SimpleExamples/HeatExchanger/TestStaticCondenser.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/SimpleExamples/HeatExchanger/TestStaticCondenser.mo"	2022-03-10 09:58:50.772153344 +0000
@@ -1,11 +1,11 @@
 within ThermoSysPro.Examples.Book.SimpleExamples.HeatExchanger;
 model TestStaticCondenser
 
-  parameter Modelica.SIunits.AbsolutePressure Pin_1(fixed=false,start=20000)
+  parameter Modelica.Units.SI.AbsolutePressure Pin_1(fixed=false,start=20000)
     "Flow pressure at inlet 1 (sourceP)";
-  parameter Modelica.SIunits.AbsolutePressure Pin_2(fixed=false,start=20000)
+  parameter Modelica.Units.SI.AbsolutePressure Pin_2(fixed=false,start=20000)
     "Flow pressure at inlet 2 (sourceP1)";
-  parameter Modelica.SIunits.AbsolutePressure Pin_3(fixed=false,start=20000)
+  parameter Modelica.Units.SI.AbsolutePressure Pin_3(fixed=false,start=20000)
     "Flow pressure at inlet 3 (sourceP2)";
 
   WaterSteam.BoundaryConditions.SinkP Puit_condenseur(P0(fixed=false) = 100000)
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/SimpleExamples/SolarCollector/TestFresnelField.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/SimpleExamples/SolarCollector/TestFresnelField.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/SimpleExamples/SolarCollector/TestFresnelField.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/SimpleExamples/SolarCollector/TestFresnelField.mo"	2022-03-10 09:58:50.552153316 +0000
@@ -1,7 +1,5 @@
 within ThermoSysPro.Examples.Book.SimpleExamples.SolarCollector;
 model TestFresnelField
-
-public
   ThermoSysPro.Thermal.HeatTransfer.HeatExchangerWall heatExchangerWall(
     ntubes=1,
     steady_state=true,
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/SimpleExamples/Volume/TestDynamicDrum.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/SimpleExamples/Volume/TestDynamicDrum.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/SimpleExamples/Volume/TestDynamicDrum.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/SimpleExamples/Volume/TestDynamicDrum.mo"	2022-03-10 09:58:50.516153311 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Examples.Book.SimpleExamples.Volume;
 model TestDynamicDrum
-  //parameter Modelica.SIunits.MassFlowRate Qin(fixed=false,start=80)
-  //  "Mass flow rate";
+  //parameter Modelica.SIunits.MassFlowRate Qin(fixed=false,start=80)
+  //  "Mass flow rate";
   parameter ThermoSysPro.Units.Cv CvmaxWater(fixed=false,start=670)
     "Maximum CV (active if mode_caract=0)";
   parameter Real LambdaPipe(fixed=false,start=0.085)
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/SimpleExamples/Volume/TestPressurizer.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/SimpleExamples/Volume/TestPressurizer.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/SimpleExamples/Volume/TestPressurizer.mo"	2022-03-10 09:57:37.972144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Book/SimpleExamples/Volume/TestPressurizer.mo"	2022-03-10 09:58:50.476153307 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Examples.Book.SimpleExamples.Volume;
 model TestPressurizer
 
-  parameter Modelica.SIunits.Power Wch(fixed=false)=0.29e6
+  parameter Modelica.Units.SI.Power Wch(fixed=false)=0.29e6
     "Power released by the electrical heaters";
   parameter Real OUVfeedwaterValve( fixed=false)=0.01
     "OUV feed water valve";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Control/MassFlowControl.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Control/MassFlowControl.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Control/MassFlowControl.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Control/MassFlowControl.mo"	2022-03-10 09:58:50.072153255 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.Examples.Control;
+within ThermoSysPro.Examples.Control;
 model MassFlowControl "Pump_MassFlowControl"
   parameter Real k=1 "Gain";
   parameter Real Ti=1 "Time constant (s)";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Control/MassFlowRateAirCoalWater.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Control/MassFlowRateAirCoalWater.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Control/MassFlowRateAirCoalWater.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Control/MassFlowRateAirCoalWater.mo"	2022-03-10 09:58:50.044153253 +0000
@@ -2,11 +2,11 @@
 model MassFlowRateAirCoalWater "MassFlowRateAirCoalWater"
  // Modelica.SIunits.Power Welec
  //   "(Percent, max=100)Electrical power produced by the generator";
- Modelica.SIunits.Power Welec( start=804.461)
+ Modelica.Units.SI.Power Welec( start=804.461)
     "(MW)Electrical power produced by the generator";
- Modelica.SIunits.MassFlowRate Qair(start=710) "Air mass flow rate";
- Modelica.SIunits.MassFlowRate Qcoal(start=70) "Coal mass flow rate";
- Modelica.SIunits.MassFlowRate Qwater(start=600) "Water mass flow rate";
+ Modelica.Units.SI.MassFlowRate Qair(start=710) "Air mass flow rate";
+ Modelica.Units.SI.MassFlowRate Qcoal(start=70) "Coal mass flow rate";
+ Modelica.Units.SI.MassFlowRate Qwater(start=600) "Water mass flow rate";
 
   InstrumentationAndControl.Connectors.InputReal Electrical_power_MW
     annotation (Placement(transformation(extent={{-10,-10},{10,10}},   rotation=-90,
@@ -26,27 +26,22 @@
         origin={110,-89},
         extent={{10,-10},{-10,10}},
         rotation=180)));
-equation
-  //if (cardinality(Electrical_power_Percent) == 0) then
-  //  Electrical_power_Percent.signal = 100;
-  //end if;
-
-  if (cardinality(Electrical_power_MW) == 0) then
-    Electrical_power_MW.signal = 804.461;
+equation
+//if (cardinality(Electrical_power_Percent) == 0) then
+//  Electrical_power_Percent.signal = 100;
+//end if;
+  if cardinality(Electrical_power_MW) == 0 then
+    Electrical_power_MW.signal = 804.461;
   end if;
 
-  Welec = Electrical_power_MW.signal;
-  //Qair = 45.38 + 0.8249*Welec;
-  //Qcoal = - 2.4172 + 0.0849*Welec;
-
-  Qair = 46.0 + 0.8229*Welec;
-  Qcoal = - 2.3534 + 0.0847*Welec;
-
-  //Qwater = 23.484 + 0.7166*Welec;
-  Qwater = 23.524 + 0.7166*Welec;
-
-  //Qwater = 23.523 + 0.7166*Welec;
-
+  Welec = Electrical_power_MW.signal;
+//Qair = 45.38 + 0.8249*Welec;
+//Qcoal = - 2.4172 + 0.0849*Welec;
+  Qair = 46.0 + 0.8229 * Welec;
+  Qcoal = - 2.3534 + 0.0847*Welec;
+//Qwater = 23.484 + 0.7166*Welec;
+  Qwater = 23.524 + 0.7166 * Welec;
+//Qwater = 23.523 + 0.7166*Welec;
   Q_air.signal = Qair;
   Q_coal.signal = Qcoal;
   Q_water.signal = Qwater;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Control/Pump_VelocityControl.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Control/Pump_VelocityControl.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Control/Pump_VelocityControl.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Control/Pump_VelocityControl.mo"	2022-03-10 09:58:50.032153251 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.Examples.Control;
+within ThermoSysPro.Examples.Control;
 model Pump_VelocityControl "Drum level control"
   parameter Real k=1 "Gain";
   parameter Real Ti=1 "Time constant (s)";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Control/TemperatureControl.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Control/TemperatureControl.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Control/TemperatureControl.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/Control/TemperatureControl.mo"	2022-03-10 09:58:50.024153250 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.Examples.Control;
+within ThermoSysPro.Examples.Control;
 model TemperatureControl "Temperature_Control"
   parameter Real k=1 "Gain";
   parameter Real Ti=1 "Time constant (s)";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestDynamicDrum.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestDynamicDrum.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestDynamicDrum.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestDynamicDrum.mo"	2022-03-10 09:58:49.756153215 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Examples.SimpleExamples;
 model TestDynamicDrum
-  parameter Modelica.SIunits.MassFlowRate Qin(fixed=false,start=80)
+  parameter Modelica.Units.SI.MassFlowRate Qin(fixed=false,start=80)
     "Mass flow rate";
   parameter ThermoSysPro.Units.Cv CvmaxWater(fixed=false,start=670)
     "Maximum CV (active if mode_caract=0)";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestDynamicDrum2.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestDynamicDrum2.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestDynamicDrum2.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestDynamicDrum2.mo"	2022-03-10 09:58:49.724153211 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Examples.SimpleExamples;
 model TestDynamicDrum2
-  //parameter Modelica.SIunits.MassFlowRate Qin(fixed=false,start=80)
-  //  "Mass flow rate";
+  //parameter Modelica.SIunits.MassFlowRate Qin(fixed=false,start=80)
+  //  "Mass flow rate";
   parameter ThermoSysPro.Units.Cv CvmaxWater(fixed=false,start=670)
     "Maximum CV (active if mode_caract=0)";
   parameter Real LambdaPipe(fixed=false,start=0.085)
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestDynamicDrum3.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestDynamicDrum3.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestDynamicDrum3.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestDynamicDrum3.mo"	2022-03-10 09:58:49.704153209 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Examples.SimpleExamples;
 model TestDynamicDrum3
-  parameter Modelica.SIunits.MassFlowRate Qin(fixed=false,start=80)
+  parameter Modelica.Units.SI.MassFlowRate Qin(fixed=false,start=80)
     "Mass flow rate";
   parameter ThermoSysPro.Units.Cv CvmaxWater(fixed=false,start=670)
     "Maximum CV (active if mode_caract=0)";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestDynamicDrum_CC.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestDynamicDrum_CC.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestDynamicDrum_CC.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestDynamicDrum_CC.mo"	2022-03-10 09:58:49.664153205 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Examples.SimpleExamples;
 model TestDynamicDrum_CC
-  //parameter Modelica.SIunits.MassFlowRate Qin(fixed=false,start=80)
-  //  "Mass flow rate";
+  //parameter Modelica.SIunits.MassFlowRate Qin(fixed=false,start=80)
+  //  "Mass flow rate";
   parameter ThermoSysPro.Units.Cv CvmaxWater(fixed=false,start=670)
     "Maximum CV (active if mode_caract=0)";
   parameter Real LambdaPipe(fixed=false,start=0.085)
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestDynamicReliefValve.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestDynamicReliefValve.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestDynamicReliefValve.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestDynamicReliefValve.mo"	2022-03-10 09:58:49.600153197 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Examples.SimpleExamples;
 model TestDynamicReliefValve
   import ThermoSysPro;
-  parameter Modelica.SIunits.AbsolutePressure Pinitial=18e5 "Initial pressure";
-  parameter Modelica.SIunits.AbsolutePressure Pfinal=Pinitial "Final pressure";
-  parameter Modelica.SIunits.AbsolutePressure Pmax=21e5 "Maximum pressure";
+  parameter Modelica.Units.SI.AbsolutePressure Pinitial=18e5 "Initial pressure";
+  parameter Modelica.Units.SI.AbsolutePressure Pfinal=Pinitial "Final pressure";
+  parameter Modelica.Units.SI.AbsolutePressure Pmax=21e5 "Maximum pressure";
 
   ThermoSysPro.WaterSteam.PressureLosses.DynamicReliefValve reliefValve(
     mech_steady_state=false,
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestFresnelField.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestFresnelField.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestFresnelField.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestFresnelField.mo"	2022-03-10 09:58:49.372153168 +0000
@@ -1,7 +1,5 @@
 within ThermoSysPro.Examples.SimpleExamples;
 model TestFresnelField
-
-public
   ThermoSysPro.Thermal.HeatTransfer.HeatExchangerWall heatExchangerWall(
     ntubes=1,
     steady_state=true,
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestPressurizer.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestPressurizer.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestPressurizer.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestPressurizer.mo"	2022-03-10 09:58:49.140153138 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Examples.SimpleExamples;
 model TestPressurizer
 
-  parameter Modelica.SIunits.Power Wch(fixed=false)=0.29e6
+  parameter Modelica.Units.SI.Power Wch(fixed=false)=0.29e6
     "Power released by the electrical heaters";
   parameter Real OUVfeedwaterValve( fixed=false)=0.01
     "OUV feed water valve";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestPressurizer1.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestPressurizer1.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestPressurizer1.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestPressurizer1.mo"	2022-03-10 09:58:49.116153135 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Examples.SimpleExamples;
 model TestPressurizer1
 
-  parameter Modelica.SIunits.Power Wch(fixed=false)=0.29e6
+  parameter Modelica.Units.SI.Power Wch(fixed=false)=0.29e6
     "Power released by the electrical heaters";
   parameter Real OUVfeedwaterValve( fixed=false)=0.01
     "OUV feed water valve";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestPressurizer2.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestPressurizer2.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestPressurizer2.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestPressurizer2.mo"	2022-03-10 09:58:49.088153132 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Examples.SimpleExamples;
 model TestPressurizer2
 
-  parameter Modelica.SIunits.Power Wch(fixed=false)=0.29e6
+  parameter Modelica.Units.SI.Power Wch(fixed=false)=0.29e6
     "Power released by the electrical heaters";
   parameter Real OUVfeedwaterValve( fixed=false)=0.01
     "OUV feed water valve";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestPressurizer_CC.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestPressurizer_CC.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestPressurizer_CC.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestPressurizer_CC.mo"	2022-03-10 09:58:49.056153128 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Examples.SimpleExamples;
 model TestPressurizer_CC
 
-  parameter Modelica.SIunits.Power Wch(fixed=false)=0.29e6
+  parameter Modelica.Units.SI.Power Wch(fixed=false)=0.29e6
     "Power released by the electrical heaters";
   parameter Real OUVfeedwaterValve( fixed=false)=0.01
     "OUV feed water valve";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestStaticCondenser.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestStaticCondenser.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestStaticCondenser.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestStaticCondenser.mo"	2022-03-10 09:58:48.924153111 +0000
@@ -1,11 +1,11 @@
 within ThermoSysPro.Examples.SimpleExamples;
 model TestStaticCondenser
 
-  parameter Modelica.SIunits.AbsolutePressure Pin_1(fixed=false,start=20000)
+  parameter Modelica.Units.SI.AbsolutePressure Pin_1(fixed=false,start=20000)
     "Flow pressure at inlet 1 (sourceP)";
-  parameter Modelica.SIunits.AbsolutePressure Pin_2(fixed=false,start=20000)
+  parameter Modelica.Units.SI.AbsolutePressure Pin_2(fixed=false,start=20000)
     "Flow pressure at inlet 2 (sourceP1)";
-  parameter Modelica.SIunits.AbsolutePressure Pin_3(fixed=false,start=20000)
+  parameter Modelica.Units.SI.AbsolutePressure Pin_3(fixed=false,start=20000)
     "Flow pressure at inlet 3 (sourceP2)";
 
   WaterSteam.BoundaryConditions.SourceQ Source_condenseur(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestStodolaTurbine1.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestStodolaTurbine1.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestStodolaTurbine1.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Examples/SimpleExamples/TestStodolaTurbine1.mo"	2022-03-10 09:58:48.736153087 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Examples.SimpleExamples;
 model TestStodolaTurbine1
-   parameter Modelica.SIunits.AbsolutePressure PoutPump(fixed=false,start=13e5)
+   parameter Modelica.Units.SI.AbsolutePressure PoutPump(fixed=false,start=13e5)
     "Flow pressure at the outlet of the pump";
   ThermoSysPro.WaterSteam.Machines.StodolaTurbine stodolaTurbine(pros1(x(start=
             1)), Hrs(start=2931e3),
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/AirHumidity.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/AirHumidity.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/AirHumidity.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/AirHumidity.mo"	2022-03-10 09:58:48.588153067 +0000
@@ -5,19 +5,19 @@
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 protected
-  Modelica.SIunits.AbsolutePressure ppvap0(start=1e4)
+  Modelica.Units.SI.AbsolutePressure ppvap0(start=1e4)
     "Intermediate vapor partial pressure";
-  Modelica.SIunits.Density rho_vap0(start=200) "Intermediate H2O density";
+  Modelica.Units.SI.Density rho_vap0(start=200) "Intermediate H2O density";
 
 public
-  Modelica.SIunits.AbsolutePressure P "Air pressure";
-  Modelica.SIunits.Temperature T "Air temperature";
-  Modelica.SIunits.Density rho_vap(start=200) "H20 density";
-  Modelica.SIunits.Density rho_air(start=0.8) "Air density";
-  Modelica.SIunits.AbsolutePressure psvap(start=1e5)
+  Modelica.Units.SI.AbsolutePressure P "Air pressure";
+  Modelica.Units.SI.Temperature T "Air temperature";
+  Modelica.Units.SI.Density rho_vap(start=200) "H20 density";
+  Modelica.Units.SI.Density rho_air(start=0.8) "Air density";
+  Modelica.Units.SI.AbsolutePressure psvap(start=1e5)
     "Vapor stauration pressure in the air";
-  Modelica.SIunits.AbsolutePressure ppvap(start=1e4) "Vapor partial pressure";
-  Modelica.SIunits.AbsolutePressure ppair "Air partial pressure";
+  Modelica.Units.SI.AbsolutePressure ppvap(start=1e4) "Vapor partial pressure";
+  Modelica.Units.SI.AbsolutePressure ppair "Air partial pressure";
   Real hum "Air relative humidity";
   Real Xo2as(start=0.2) "O2 mass fraction in dry air";
   Real Xco2 "CO2 mass fraction at the outlet";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/Sink.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/Sink.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/Sink.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/Sink.mo"	2022-03-10 09:58:48.576153067 +0000
@@ -1,10 +1,8 @@
 within ThermoSysPro.FlueGases.BoundaryConditions;
 model Sink "Flue gas sink"
-
-public
-  Modelica.SIunits.AbsolutePressure P "Fluid pressure";
-  Modelica.SIunits.MassFlowRate Q "Mass flow";
-  Modelica.SIunits.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P "Fluid pressure";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
   Real Xco2 "CO2 mass fraction";
   Real Xh2o "H2O mass fraction";
   Real Xo2 "O2 mass fraction";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SinkG.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SinkG.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SinkG.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SinkG.mo"	2022-03-10 09:58:48.568153065 +0000
@@ -1,10 +1,8 @@
 within ThermoSysPro.FlueGases.BoundaryConditions;
 model SinkG "General flue gas sink"
-
-public
-  Modelica.SIunits.AbsolutePressure P "Fluid pressure";
-  Modelica.SIunits.MassFlowRate Q "Mass flow";
-  Modelica.SIunits.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P "Fluid pressure";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
   Real Xco2 "CO2 mass fraction";
   Real Xh2o "H2O mass fraction";
   Real Xo2 "O2 mass fraction";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SinkP.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SinkP.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SinkP.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SinkP.mo"	2022-03-10 09:58:48.556153063 +0000
@@ -1,11 +1,11 @@
 within ThermoSysPro.FlueGases.BoundaryConditions;
 model SinkP "Flue gas sink with fixed pressure"
-  parameter Modelica.SIunits.AbsolutePressure P0=100000 "Sink pressure";
+  parameter Modelica.Units.SI.AbsolutePressure P0=100000 "Sink pressure";
 
 public
-  Modelica.SIunits.AbsolutePressure P "Fluid pressure";
-  Modelica.SIunits.MassFlowRate Q "Mass flow";
-  Modelica.SIunits.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P "Fluid pressure";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
   Real Xco2 "CO2 mass fraction";
   Real Xh2o "H2O mass fraction";
   Real Xo2 "O2 mass fraction";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SinkPQ.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SinkPQ.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SinkPQ.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SinkPQ.mo"	2022-03-10 09:58:48.548153063 +0000
@@ -1,12 +1,12 @@
 within ThermoSysPro.FlueGases.BoundaryConditions;
 model SinkPQ "Flue gas sink with fixed pressure and mass flow rate"
-  parameter Modelica.SIunits.AbsolutePressure P0=100000 "Sink pressure";
-  parameter Modelica.SIunits.MassFlowRate Q0=100 "Sink mass flow rate";
+  parameter Modelica.Units.SI.AbsolutePressure P0=100000 "Sink pressure";
+  parameter Modelica.Units.SI.MassFlowRate Q0=100 "Sink mass flow rate";
 
 public
-  Modelica.SIunits.AbsolutePressure P "Fluid pressure";
-  Modelica.SIunits.MassFlowRate Q "Mass flow";
-  Modelica.SIunits.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P "Fluid pressure";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
   Real Xco2 "CO2 mass fraction";
   Real Xh2o "H2O mass fraction";
   Real Xo2 "O2 mass fraction";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SinkQ.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SinkQ.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SinkQ.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SinkQ.mo"	2022-03-10 09:58:48.536153061 +0000
@@ -1,11 +1,11 @@
 within ThermoSysPro.FlueGases.BoundaryConditions;
 model SinkQ "Flue gas sink with fixed mass flow rate"
-  parameter Modelica.SIunits.MassFlowRate Q0=100 "Sink mass flow rate";
+  parameter Modelica.Units.SI.MassFlowRate Q0=100 "Sink mass flow rate";
 
 public
-  Modelica.SIunits.AbsolutePressure P "Fluid pressure";
-  Modelica.SIunits.MassFlowRate Q "Mass flow";
-  Modelica.SIunits.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P "Fluid pressure";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
   Real Xco2 "CO2 mass fraction";
   Real Xh2o "H2O mass fraction";
   Real Xo2 "O2 mass fraction";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/Source.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/Source.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/Source.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/Source.mo"	2022-03-10 09:58:48.524153059 +0000
@@ -1,15 +1,15 @@
 within ThermoSysPro.FlueGases.BoundaryConditions;
 model Source "Flue gas source"
-  parameter Modelica.SIunits.Temperature T0=400 "Source temperature";
+  parameter Modelica.Units.SI.Temperature T0=400 "Source temperature";
   parameter Real Xco2=0.10 "CO2 mass fraction";
   parameter Real Xh2o=0.05 "H2O mass fraction";
   parameter Real Xo2=0.22 "O2 mass fraction";
   parameter Real Xso2=0.00 "SO2 mass fraction";
 
 public
-  Modelica.SIunits.AbsolutePressure P "Fluid pressure";
-  Modelica.SIunits.MassFlowRate Q "Mass flow";
-  Modelica.SIunits.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P "Fluid pressure";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
   Real Xn2 "N2 mas fraction";
 
 public
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SourceG.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SourceG.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SourceG.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SourceG.mo"	2022-03-10 09:58:48.508153058 +0000
@@ -6,9 +6,9 @@
   parameter Real Xso2=0.00 "SO2 mass fraction";
 
 public
-  Modelica.SIunits.AbsolutePressure P "Fluid pressure";
-  Modelica.SIunits.MassFlowRate Q "Mass flow";
-  Modelica.SIunits.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P "Fluid pressure";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
   Real Xn2 "N2 mas fraction";
 
 public
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SourceP.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SourceP.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SourceP.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SourceP.mo"	2022-03-10 09:58:48.476153054 +0000
@@ -1,16 +1,16 @@
 within ThermoSysPro.FlueGases.BoundaryConditions;
 model SourceP "Flue gas source with fixed pressure"
-  parameter Modelica.SIunits.AbsolutePressure P0=200000 "Source pressure";
-  parameter Modelica.SIunits.Temperature T0=400 "Source temperature";
+  parameter Modelica.Units.SI.AbsolutePressure P0=200000 "Source pressure";
+  parameter Modelica.Units.SI.Temperature T0=400 "Source temperature";
   parameter Real Xco2=0.10 "CO2 mass fraction";
   parameter Real Xh2o=0.05 "H2O mass fraction";
   parameter Real Xo2=0.22 "O2 mass fraction";
   parameter Real Xso2=0.00 "SO2 mass fraction";
 
 public
-  Modelica.SIunits.AbsolutePressure P "Fluid pressure";
-  Modelica.SIunits.MassFlowRate Q "Mass flow";
-  Modelica.SIunits.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P "Fluid pressure";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
   Real Xn2 "N2 mas fraction";
 
 public
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SourcePQ.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SourcePQ.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SourcePQ.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SourcePQ.mo"	2022-03-10 09:58:48.464153053 +0000
@@ -1,17 +1,17 @@
 within ThermoSysPro.FlueGases.BoundaryConditions;
 model SourcePQ "Flue gas source with fixed pressure and mass flow rate"
-  parameter Modelica.SIunits.AbsolutePressure P0=200000 "Source pressure";
-  parameter Modelica.SIunits.MassFlowRate Q0=100 "Sink mass flow rate";
-  parameter Modelica.SIunits.Temperature T0=400 "Source temperature";
+  parameter Modelica.Units.SI.AbsolutePressure P0=200000 "Source pressure";
+  parameter Modelica.Units.SI.MassFlowRate Q0=100 "Sink mass flow rate";
+  parameter Modelica.Units.SI.Temperature T0=400 "Source temperature";
   parameter Real Xco2=0.10 "CO2 mass fraction";
   parameter Real Xh2o=0.05 "H2O mass fraction";
   parameter Real Xo2=0.22 "O2 mass fraction";
   parameter Real Xso2=0.00 "SO2 mass fraction";
 
 public
-  Modelica.SIunits.AbsolutePressure P "Fluid pressure";
-  Modelica.SIunits.MassFlowRate Q "Mass flow";
-  Modelica.SIunits.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P "Fluid pressure";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
   Real Xn2 "N2 mas fraction";
 
 public
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SourceQ.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SourceQ.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SourceQ.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SourceQ.mo"	2022-03-10 09:58:48.452153051 +0000
@@ -1,16 +1,16 @@
 within ThermoSysPro.FlueGases.BoundaryConditions;
 model SourceQ "Flue gas source with fixed mass flow rate"
-  parameter Modelica.SIunits.MassFlowRate Q0=100 "Source mass flow rate";
-  parameter Modelica.SIunits.Temperature T0=400 "Source temperature";
+  parameter Modelica.Units.SI.MassFlowRate Q0=100 "Source mass flow rate";
+  parameter Modelica.Units.SI.Temperature T0=400 "Source temperature";
   parameter Real Xco2=0.10 "CO2 mass fraction";
   parameter Real Xh2o=0.05 "H2O mass fraction";
   parameter Real Xo2=0.22 "O2 mass fraction";
   parameter Real Xso2=0.00 "SO2 mass fraction";
 
 public
-  Modelica.SIunits.AbsolutePressure P "Fluid pressure";
-  Modelica.SIunits.MassFlowRate Q "Mass flow";
-  Modelica.SIunits.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P "Fluid pressure";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
   Real Xn2 "N2 mas fraction";
 
 public
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SourceQX.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SourceQX.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SourceQX.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/BoundaryConditions/SourceQX.mo"	2022-03-10 09:58:48.440153049 +0000
@@ -1,16 +1,16 @@
 within ThermoSysPro.FlueGases.BoundaryConditions;
 model SourceQX "Flue gas source with fixed mass flow rate"
-  parameter Modelica.SIunits.MassFlowRate Q0=100 "Source mass flow rate";
-  parameter Modelica.SIunits.Temperature T0=400 "Source temperature";
+  parameter Modelica.Units.SI.MassFlowRate Q0=100 "Source mass flow rate";
+  parameter Modelica.Units.SI.Temperature T0=400 "Source temperature";
   parameter Real Xco2=0.10 "CO2 mass fraction";
   parameter Real Xh2o=0.05 "H2O mass fraction";
   parameter Real Xo2=0.22 "O2 mass fraction";
   parameter Real Xso2=0.00 "SO2 mass fraction";
 
 public
-  Modelica.SIunits.AbsolutePressure P "Fluid pressure";
-  Modelica.SIunits.MassFlowRate Q "Mass flow";
-  Modelica.SIunits.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P "Fluid pressure";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
   Real Xn2 "N2 mas fraction";
 
 public
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Connectors.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Connectors.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Connectors.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Connectors.mo"	2022-03-10 09:58:48.428153047 +0000
@@ -1,11 +1,12 @@
 within ThermoSysPro.FlueGases;
 package Connectors "Connectors"
+
   connector FlueGasesOutlet "Flue gases outlet fluid connector"
-    Modelica.SIunits.AbsolutePressure P(start=1.e5)
+    Modelica.Units.SI.AbsolutePressure P(start=1.e5)
       "Fluid pressure in the control volume";
-    Modelica.SIunits.Temperature T(start=300)
+    Modelica.Units.SI.Temperature T(start=300)
       "Fluid temperature in the control volume";
-    Modelica.SIunits.MassFlowRate Q(start=100)
+    Modelica.Units.SI.MassFlowRate Q(start=100)
       "Mass flow of the fluid crossing the boundary of the control volume";
     Real Xco2(start=0.01)
       "CO2 mass fraction of the fluid crossing the boundary of the control volume";
@@ -51,11 +52,11 @@
   end FlueGasesOutlet;
 
   connector FlueGasesInlet "Flue gases inlet fluid connector"
-    Modelica.SIunits.AbsolutePressure P(start=1.e5)
+    Modelica.Units.SI.AbsolutePressure P(start=1.e5)
       "Fluid pressure in the control volume";
-    Modelica.SIunits.Temperature T(start=300)
+    Modelica.Units.SI.Temperature T(start=300)
       "Fluid temperature in the control volume";
-    Modelica.SIunits.MassFlowRate Q(start=100)
+    Modelica.Units.SI.MassFlowRate Q(start=100)
       "Mass flow of the fluid crossing the boundary of the control volume";
     Real Xco2(start=0.01)
       "CO2 mass fraction of the fluid crossing the boundary of the control volume";
@@ -101,11 +102,11 @@
   end FlueGasesInlet;
 
   connector FlueGasesInletI "Internal flue gases inlet fluid connector"
-    Modelica.SIunits.AbsolutePressure P(start=1.e5)
+    Modelica.Units.SI.AbsolutePressure P(start=1.e5)
       "Fluid pressure in the control volume";
-    Modelica.SIunits.Temperature T(start=300)
+    Modelica.Units.SI.Temperature T(start=300)
       "Fluid temperature in the control volume";
-    Modelica.SIunits.MassFlowRate Q(start=100)
+    Modelica.Units.SI.MassFlowRate Q(start=100)
       "Mass flow of the fluid crossing the boundary of the control volume";
     Real Xco2(start=0.01)
       "CO2 mass fraction of the fluid crossing the boundary of the control volume";
@@ -151,11 +152,11 @@
   end FlueGasesInletI;
 
   connector FlueGasesOutletI "Internal flue gases outlet fluid connector"
-    Modelica.SIunits.AbsolutePressure P(start=1.e5)
+    Modelica.Units.SI.AbsolutePressure P(start=1.e5)
       "Fluid pressure in the control volume";
-    Modelica.SIunits.Temperature T(start=300)
+    Modelica.Units.SI.Temperature T(start=300)
       "Fluid temperature in the control volume";
-    Modelica.SIunits.MassFlowRate Q(start=100)
+    Modelica.Units.SI.MassFlowRate Q(start=100)
       "Mass flow of the fluid crossing the boundary of the control volume";
     Real Xco2(start=0.01)
       "CO2 mass fraction of the fluid crossing the boundary of the control volume";
@@ -199,7 +200,6 @@
 </ul>
 </html>"));
   end FlueGasesOutletI;
-
   annotation (Icon(graphics={
         Text(
           extent={{-102,0},{24,-26}},
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/HeatExchangers/FlueGasesChamberEvaporator.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/HeatExchangers/FlueGasesChamberEvaporator.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/HeatExchangers/FlueGasesChamberEvaporator.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/HeatExchangers/FlueGasesChamberEvaporator.mo"	2022-03-10 09:58:48.392153043 +0000
@@ -1,71 +1,71 @@
-﻿within ThermoSysPro.FlueGases.HeatExchangers;
+within ThermoSysPro.FlueGases.HeatExchangers;
 model FlueGasesChamberEvaporator "Flue gases chamber  for water evaporation"
-  parameter Modelica.SIunits.Area Se=400
+  parameter Modelica.Units.SI.Area Se=400
     "Heat exchange surface on the flue gases side";
-  parameter Modelica.SIunits.Length rugosi=1e-5 "Pipe roughness";
+  parameter Modelica.Units.SI.Length rugosi=1e-5 "Pipe roughness";
   parameter Real rencrf=0.1
     "Fouling resistance on the flue gases side (m².K/m)";
   parameter Real rencrc=0.1 "Fouling resistance on the coolant side (m².K/m)";
   parameter Real FVN=0 "Ashes volume fraction";
-  parameter Modelica.SIunits.Height haut=15 "Flux wall height";
+  parameter Modelica.Units.SI.Height haut=15 "Flux wall height";
   parameter Real alpha=1 "Chamber width/depth ratio";
-  parameter Modelica.SIunits.Diameter dtex=0.06 "Pipe external diameter";
-  parameter Modelica.SIunits.Diameter dtin=0.05 "Pipe internal diameter";
-  parameter Modelica.SIunits.Length lailet=0.05 "Membrane length";
-  parameter Modelica.SIunits.Length eailet=0.001 "Membrane thickness";
-  parameter Modelica.SIunits.Length ebeton=0.01 "Concrete thickness";
-  parameter Modelica.SIunits.ThermalConductivity condt=10
+  parameter Modelica.Units.SI.Diameter dtex=0.06 "Pipe external diameter";
+  parameter Modelica.Units.SI.Diameter dtin=0.05 "Pipe internal diameter";
+  parameter Modelica.Units.SI.Length lailet=0.05 "Membrane length";
+  parameter Modelica.Units.SI.Length eailet=0.001 "Membrane thickness";
+  parameter Modelica.Units.SI.Length ebeton=0.01 "Concrete thickness";
+  parameter Modelica.Units.SI.ThermalConductivity condt=10
     "Pipes thermal conductivity";
-  parameter Modelica.SIunits.ThermalConductivity condm=10
+  parameter Modelica.Units.SI.ThermalConductivity condm=10
     "Membrane thermal conductivity";
-  parameter Modelica.SIunits.ThermalConductivity condb=10
+  parameter Modelica.Units.SI.ThermalConductivity condb=10
     "Concret thermal conductivity";
   parameter Real emimur=0.1 "Walls emissitivity";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer hi=10000
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer hi=10000
     "Coolant heat exchange coefficient";
 
 protected
-  Modelica.SIunits.ThermalConductivity c1(start=0.1)
+  Modelica.Units.SI.ThermalConductivity c1(start=0.1)
     "Variable for the computation of the flue gases thermal conductivity";
-  Modelica.SIunits.ThermalConductivity c2(start=0.1)
+  Modelica.Units.SI.ThermalConductivity c2(start=0.1)
     "Variable for the computation of the flue gases thermal conductivity";
   Real bb(start=0.1e-5)
     "Variable for the computation of the friction coefficient";
 
 public
-  Modelica.SIunits.Temperature Tef(start=800)
+  Modelica.Units.SI.Temperature Tef(start=800)
     "Flue gases temperature at the inlet";
-  Modelica.SIunits.Temperature Tsf(start=800)
+  Modelica.Units.SI.Temperature Tsf(start=800)
     "Flue gases temperature at the outlet";
-  Modelica.SIunits.AbsolutePressure Pef(start=1e5)
+  Modelica.Units.SI.AbsolutePressure Pef(start=1e5)
     "Flue gases pressure at the inlet";
-  Modelica.SIunits.AbsolutePressure Psf(start=1e5)
+  Modelica.Units.SI.AbsolutePressure Psf(start=1e5)
     "Flue gases pressure at the outlet";
-  Modelica.SIunits.MassFlowRate Qf(start=10) "Flue gases mass flow rate";
+  Modelica.Units.SI.MassFlowRate Qf(start=10) "Flue gases mass flow rate";
   Real XfCO2(start=0.1) "CO2 mass fraction";
   Real XfH2O(start=0.1) "H2O mass fraction";
   Real XfO2(start=0.1) "O2 mass fraction";
   Real XfN2(start=0.1) "N2 mass fraction";
   Real XfSO2(start=0.6) "SO2 mass fraction";
-  Modelica.SIunits.Power Wer(start=10e5) "Radiation power received";
-  Modelica.SIunits.Power Wech(start=1e6) "Power exchanged";
-  Modelica.SIunits.Temperature Ts(start=600)
+  Modelica.Units.SI.Power Wer(start=10e5) "Radiation power received";
+  Modelica.Units.SI.Power Wech(start=1e6) "Power exchanged";
+  Modelica.Units.SI.Temperature Ts(start=600)
     "Average surface temperature on the flue gases side";
-  Modelica.SIunits.Temperature Tpet(start=600)
+  Modelica.Units.SI.Temperature Tpet(start=600)
     "Average external fin wall temperature";
-  Modelica.SIunits.AbsolutePressure Pec0(start=1e5) "Coolant pressure";
-  Modelica.SIunits.AbsolutePressure Pec(start=1e5) "Coolant pressure";
-  Modelica.SIunits.Angle anglb(start=1.5)
+  Modelica.Units.SI.AbsolutePressure Pec0(start=1e5) "Coolant pressure";
+  Modelica.Units.SI.AbsolutePressure Pec(start=1e5) "Coolant pressure";
+  Modelica.Units.SI.Angle anglb(start=1.5)
     "Angle of the junction between the pipe and the membrane";
-  Modelica.SIunits.Angle angla(start=1.5)
+  Modelica.Units.SI.Angle angla(start=1.5)
     "Angle of the pipe exposed to the flue gases";
   Real rtube(start=100) "Number of coressponding pipes";
-  Modelica.SIunits.Length long(start=100) "Chamber length";
-  Modelica.SIunits.Length prof(start=10) "Chamber depth";
-  Modelica.SIunits.Temperature Tc(start=800) "Coolant saturation temperature";
-  Modelica.SIunits.AbsolutePressure Pmf(start=1e5)
+  Modelica.Units.SI.Length long(start=100) "Chamber length";
+  Modelica.Units.SI.Length prof(start=10) "Chamber depth";
+  Modelica.Units.SI.Temperature Tc(start=800) "Coolant saturation temperature";
+  Modelica.Units.SI.AbsolutePressure Pmf(start=1e5)
     "Flue gases average pressure";
-  Modelica.SIunits.Temperature Tmf(start=800) "Flue gases average temperature";
+  Modelica.Units.SI.Temperature Tmf(start=800) "Flue gases average temperature";
   Real Xcor(start=0.1)
     "Corrective coefficient for the flue gases mass fractions";
   Real XfH2O0(start=0.1) "H2O corrected mass fraction";
@@ -73,36 +73,36 @@
   Real XfO20(start=0.1) "O2 corrected mass fraction";
   Real XfSO20(start=0.1) "SO2 corrected mass fraction";
   Real XfN20(start=0.1) "N2 corrected mass fraction";
-  constant Modelica.SIunits.AbsolutePressure Pnorm=1.01325e5 "Normal pressure";
-  constant Modelica.SIunits.Temperature Tnorm=273.15 "Normal temperature";
-  Modelica.SIunits.Density rhonorm(start=100)
+  constant Modelica.Units.SI.AbsolutePressure Pnorm=1.01325e5 "Normal pressure";
+  constant Modelica.Units.SI.Temperature Tnorm=273.15 "Normal temperature";
+  Modelica.Units.SI.Density rhonorm(start=100)
     "Flue gases density at (Pnorm,Tnorm)";
-  Modelica.SIunits.ThermalConductivity condf(start=100)
+  Modelica.Units.SI.ThermalConductivity condf(start=100)
     "Flue gases thermal conductivity";
-  Modelica.SIunits.SpecificHeatCapacity cpf(start=1000)
+  Modelica.Units.SI.SpecificHeatCapacity cpf(start=1000)
     "Flue gases specific heat capacity";
-  Modelica.SIunits.DynamicViscosity muf(start=1e-5)
+  Modelica.Units.SI.DynamicViscosity muf(start=1e-5)
     "Flue gases dynamic viscosity";
-  Modelica.SIunits.Density rhof(start=100) "Flue gases density";
+  Modelica.Units.SI.Density rhof(start=100) "Flue gases density";
   Real fvd(start=0.5) "Ashes volume fraction";
-  Modelica.SIunits.Area Surf(start=50) "Flue gases cross-sectional area";
-  Modelica.SIunits.Length Perim(start=50) "Chamber perimeter";
-  Modelica.SIunits.Diameter Dh(start=50) "Chamber hydraulic diameter";
+  Modelica.Units.SI.Area Surf(start=50) "Flue gases cross-sectional area";
+  Modelica.Units.SI.Length Perim(start=50) "Chamber perimeter";
+  Modelica.Units.SI.Diameter Dh(start=50) "Chamber hydraulic diameter";
   Real Ref(start=10000) "Reynolds number";
   Real Prf(start=1) "Prandtl number";
-  Modelica.SIunits.CoefficientOfHeatTransfer hc(start=1)
+  Modelica.Units.SI.CoefficientOfHeatTransfer hc(start=1)
     "Convection heat exchange coefficient";
-  Modelica.SIunits.CoefficientOfHeatTransfer hr(start=50)
+  Modelica.Units.SI.CoefficientOfHeatTransfer hr(start=50)
     "Radiation heat exchange coefficient";
-  Modelica.SIunits.CoefficientOfHeatTransfer hf(start=50)
+  Modelica.Units.SI.CoefficientOfHeatTransfer hf(start=50)
     "Global heat exchange coefficient";
-  Modelica.SIunits.Volume volumg(start=500) "Gas volume";
-  Modelica.SIunits.Area senveng(start=500) "Gas envelope surface";
-  Modelica.SIunits.Length rop(start=5)
+  Modelica.Units.SI.Volume volumg(start=500) "Gas volume";
+  Modelica.Units.SI.Area senveng(start=500) "Gas envelope surface";
+  Modelica.Units.SI.Length rop(start=5)
     "Average optical radius between the pipes";
   Real Masmol(start=0.1) "Mixture molar mass";
-  Modelica.SIunits.AbsolutePressure PCO2R(start=0.5e5) "CO2 partial pressure";
-  Modelica.SIunits.AbsolutePressure PH2OR(start=0.5e5) "H2O partial pressure";
+  Modelica.Units.SI.AbsolutePressure PCO2R(start=0.5e5) "CO2 partial pressure";
+  Modelica.Units.SI.AbsolutePressure PH2OR(start=0.5e5) "H2O partial pressure";
   Real EG(start=0.5);
   Real ES(start=0.5);
   Real emigaz(start=0.5) "Gases emissivity";
@@ -136,8 +136,8 @@
   Real Rt(start=0.1) "Total surface thermal resistance (K/W)";
   Real U(start=50)
     "Global heat exchange coefficient per external surface unit (W/m²/K)";
-  Modelica.SIunits.Area Set(start=500) "Total external surface";
-  Modelica.SIunits.Velocity vit(start=1) "Gases veolicity";
+  Modelica.Units.SI.Area Set(start=500) "Total external surface";
+  Modelica.Units.SI.Velocity vit(start=1) "Gases veolicity";
 
   ThermoSysPro.FlueGases.Connectors.FlueGasesInlet C1
     annotation (Placement(transformation(extent={{-100,-10},{-80,10}}, rotation=
@@ -232,15 +232,12 @@
   rhof = ThermoSysPro.Properties.FlueGases.FlueGases_rho(Pmf, Tmf, XfCO2, XfH2O, XfO2, XfSO2);
 
   /* Ashes volume fraction */
-  fvd = FVN*rhof/rhonorm;
-
-  // Flue gases heat exchange coefficient
-  // ------------------------------------
-
-  // Convection
-
-  /* Geometry */
-  Surf = prof*long;
+  fvd = FVN*rhof/rhonorm;
+// Flue gases heat exchange coefficient
+// ------------------------------------
+// Convection
+/* Geometry */
+  Surf = prof * long;
   Perim = 2*(long + prof);
   Dh = 4*Surf/Perim;
 
@@ -251,12 +248,10 @@
   Prf = muf*cpf/condf;
 
   /* Heat exchange coefficient (turbulent regime, Mac Adams correlation, pipe flow, hydraulic diameter analogy)*/
-  hc = 0.023*(Ref^0.8)*(Prf^0.4)*condf/Dh;
-
-  // Radiation
-
-  /* Gas volume */
-  volumg = Dh*long*prof;
+  hc = 0.023*(Ref^0.8)*(Prf^0.4)*condf/Dh;
+// Radiation
+/* Gas volume */
+  volumg = Dh * long * prof;
 
   /* Total surface of the gase envelope */
   senveng = 2*Dh*long + 2*Dh*prof + 2*long*prof;
@@ -288,11 +283,9 @@
   hr = 5.68e-8/(1/emigaz + (1 - emimur)/emimur)*(Tmf^2 + Ts^2)*(Tmf + Ts);
 
   /* Global heat exchange coefficient */
-  hf = hc + hr;
-
-  // Pressure losses
-  //----------------
-
+  hf = hc + hr;
+// Pressure losses
+//----------------
   rugos = 0.15e-3;
 
   /* Dynamic pressure losses */
@@ -315,20 +308,18 @@
   dps = rhof*Modelica.Constants.g_n*haut;
 
   /* Total pressure losses */
-  Pdf = dpd + dps;
-
-  // Global heat exchange coefficient between the flue gaases and the coolant
-  //-------------------------------------------------------------------------
-
-  /* Thermal resistance for a half (pipe + membrane) */
-  if (hf <= 0) then
-    R1 = 0;
-    R4 = 0;
-    Rb1 = 0;
-  else
-    R1 = 1/(hf*angla*dtex/2*haut);
-    R4 = 1/(hf*lailet/2*haut);
-    Rb1 = 1/(hf*(lailet + dtex)/2*haut);
+  Pdf = dpd + dps;
+// Global heat exchange coefficient between the flue gaases and the coolant
+//-------------------------------------------------------------------------
+/* Thermal resistance for a half (pipe + membrane) */
+  if hf <= 0 then
+    R1 = 0;
+    R4 = 0;
+    Rb1 = 0;
+  else
+    R1 = 1 / (hf * angla * dtex / 2 * haut);
+    R4 = 1 / (hf * lailet / 2 * haut);
+    Rb1 = 1 / (hf * (lailet + dtex) / 2 * haut);
   end if;
 
   R3 = 1/(hi*angla*dtin/2*haut);
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/HeatExchangers/StaticFluegasesFluegasesExchangerKS.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/HeatExchangers/StaticFluegasesFluegasesExchangerKS.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/HeatExchangers/StaticFluegasesFluegasesExchangerKS.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/HeatExchangers/StaticFluegasesFluegasesExchangerKS.mo"	2022-03-10 09:58:48.324153035 +0000
@@ -1,32 +1,32 @@
 within ThermoSysPro.FlueGases.HeatExchangers;
 model StaticFluegasesFluegasesExchangerKS
   "Static flue gases/flue gases heat exchanger with fixed K and S"
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer K=100
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer K=100
     "Global heat exchange coefficient";
-  parameter Modelica.SIunits.Area S=10 "Heat exchange surface";
+  parameter Modelica.Units.SI.Area S=10 "Heat exchange surface";
   parameter Real DPc= 0.1
     "Pressure losses in the hot fluid as a percent of the pressure at the inlet";
   parameter Real DPf= 0.1
     "Pressure losses in the cold fluid as a percent of the pressure at the inlet";
 
 public
-  Modelica.SIunits.Power W "Power exchanged";
-  Modelica.SIunits.Temperature Tec(start=400)
+  Modelica.Units.SI.Power W "Power exchanged";
+  Modelica.Units.SI.Temperature Tec(start=400)
     "Temperature of the hot fluid at the inlet";
-  Modelica.SIunits.Temperature Tsc(start=300)
+  Modelica.Units.SI.Temperature Tsc(start=300)
     "Temperature of the hot fluid at the outlet";
-  Modelica.SIunits.Temperature Tef(start=300)
+  Modelica.Units.SI.Temperature Tef(start=300)
     "Temperature of the cold fluid at the inlet";
-  Modelica.SIunits.Temperature Tsf(start=400)
+  Modelica.Units.SI.Temperature Tsf(start=400)
     "Temperature of the cold fluid at the outlet";
   ThermoSysPro.Units.DifferentialTemperature DT1 "Delta T at the inlet";
   ThermoSysPro.Units.DifferentialTemperature DT2 "Delta T at the outlet";
-  Modelica.SIunits.SpecificHeatCapacity Cpf
+  Modelica.Units.SI.SpecificHeatCapacity Cpf
     "Specific heat capacity of the cold fluid";
-  Modelica.SIunits.SpecificHeatCapacity Cpc
+  Modelica.Units.SI.SpecificHeatCapacity Cpc
     "Specific heat capacity of the hot fluid";
-  Modelica.SIunits.MassFlowRate Qc(start=100) "Mass flow rate of the hot fluid";
-  Modelica.SIunits.MassFlowRate Qf(start=100)
+  Modelica.Units.SI.MassFlowRate Qc(start=100) "Mass flow rate of the hot fluid";
+  Modelica.Units.SI.MassFlowRate Qf(start=100)
     "Mass flow rate of the cold fluid";
   Real Kcor "Corrective term for the global heat exchange coefficient";
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/HeatExchangers/StaticWallFlueGasesExchanger.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/HeatExchangers/StaticWallFlueGasesExchanger.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/HeatExchangers/StaticWallFlueGasesExchanger.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/HeatExchangers/StaticWallFlueGasesExchanger.mo"	2022-03-10 09:58:48.312153034 +0000
@@ -3,25 +3,25 @@
   parameter Integer Ns=1 "Number of segments";
   parameter Integer NbTub=100 "Number of pipes";
   parameter Real DPc=0 "Pressure loss coefficient";
-  parameter Modelica.SIunits.Length L=2 "Exchanger length";
-  parameter Modelica.SIunits.Diameter Dext=0.022 "External pipe diameter";
-  parameter Modelica.SIunits.PathLength step_L=0.033 "Longitudinal length step";
-  parameter Modelica.SIunits.PathLength step_T=0.066 "Transverse length step";
-  parameter Modelica.SIunits.Area St=100 "Cross-sectional area";
-  parameter Modelica.SIunits.Area Surf_ext=pi*Dext*Ls*NbTub*CSailettes
+  parameter Modelica.Units.SI.Length L=2 "Exchanger length";
+  parameter Modelica.Units.SI.Diameter Dext=0.022 "External pipe diameter";
+  parameter Modelica.Units.SI.PathLength step_L=0.033 "Longitudinal length step";
+  parameter Modelica.Units.SI.PathLength step_T=0.066 "Transverse length step";
+  parameter Modelica.Units.SI.Area St=100 "Cross-sectional area";
+  parameter Modelica.Units.SI.Area Surf_ext=pi*Dext*Ls*NbTub*CSailettes
     "Heat exchange surface for one section";
   parameter Real Encras=1.00 "Corrective term for the heat exchange coefficient";
   parameter Real Fa=0.7 "Fouling factor (0.3 - 1.1)";
-  parameter Modelica.SIunits.MassFlowRate Qmin=1e-3
+  parameter Modelica.Units.SI.MassFlowRate Qmin=1e-3
     "Minimum flue gases mass flow rate";
   parameter Integer exchanger_type=1
     "Exchanger type - 1:crossed flux - 2:longitudinal flux";
-  parameter Modelica.SIunits.Temperature Tp0=500
+  parameter Modelica.Units.SI.Temperature Tp0=500
     "Wall temperature (active if the thermal connector is not connected)";
   parameter Real CSailettes=1
     "Increase factor of the heat exchange surface to to the fins";
   parameter Real Coeff=1 "Corrective coeffeicient";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
 
 protected
   parameter Real eps=1.e-1
@@ -32,36 +32,36 @@
   constant Real Mn2=28.014 "N2 molar mass";
   constant Real Mso2=64.063 "SO2 molar mass";
   constant Real pi=Modelica.Constants.pi;
-  constant Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  constant Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
-  parameter Modelica.SIunits.PathLength Ls=L/Ns "Section length";
-  parameter Modelica.SIunits.Area Surf_tot=Ns*Surf_ext
+  parameter Modelica.Units.SI.PathLength Ls=L/Ns "Section length";
+  parameter Modelica.Units.SI.Area Surf_tot=Ns*Surf_ext
     "Total heat exchange surface";
-  parameter Modelica.SIunits.Area Sgaz=St*(1 - Dext/step_T)
+  parameter Modelica.Units.SI.Area Sgaz=St*(1 - Dext/step_T)
     "Geometrical parameter";
   parameter Real PasLD=step_L/Dext "Geometrical parameter";
   parameter Real PasTD=step_T/Dext "Geometrical parameter";
   parameter Real Optl=ThermoSysPro.Correlations.Misc.WBCorrectiveDiameterCoefficient(PasTD,PasLD,Dext)
     "Geometrical parameter";
-  parameter Modelica.SIunits.Length Deq=4*Sgaz/Perb
+  parameter Modelica.Units.SI.Length Deq=4*Sgaz/Perb
     "Equivalent diameter for longitudinal flux";
-  parameter Modelica.SIunits.Length Perb=Surf_ext/Ls "Geometrical parameter";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer Kdef=50
+  parameter Modelica.Units.SI.Length Perb=Surf_ext/Ls "Geometrical parameter";
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer Kdef=50
     "Heat exchange coefficient in case of zero flow";
 
 public
-  Modelica.SIunits.Density rho(start=1) "Flue gases density";
-  Modelica.SIunits.Temperature T[Ns + 1](start=fill(900, Ns + 1))
+  Modelica.Units.SI.Density rho(start=1) "Flue gases density";
+  Modelica.Units.SI.Temperature T[Ns + 1](start=fill(900, Ns + 1))
     "Flue gases temperature at the inlet of section i";
-  Modelica.SIunits.Temperature Tm[Ns](start=fill(900, Ns))
+  Modelica.Units.SI.Temperature Tm[Ns](start=fill(900, Ns))
     "Average flue gases temperature in section i";
-  Modelica.SIunits.SpecificEnthalpy h[Ns + 1](start=fill(1e6, Ns + 1))
+  Modelica.Units.SI.SpecificEnthalpy h[Ns + 1](start=fill(1e6, Ns + 1))
     "Flue gases specific enthalpy at the inlet of section i";
-  Modelica.SIunits.Temperature Tp[Ns](start=fill(500, Ns)) "Wall temperature";
-  Modelica.SIunits.AbsolutePressure Pe(start=1e5)
+  Modelica.Units.SI.Temperature Tp[Ns](start=fill(500, Ns)) "Wall temperature";
+  Modelica.Units.SI.AbsolutePressure Pe(start=1e5)
     "Flue gases partial pressure at the inlet";
-  Modelica.SIunits.AbsolutePressure Pco2 "CO2 partial pressure";
-  Modelica.SIunits.AbsolutePressure Ph2o "H2O partial pressure";
+  Modelica.Units.SI.AbsolutePressure Pco2 "CO2 partial pressure";
+  Modelica.Units.SI.AbsolutePressure Ph2o "H2O partial pressure";
   Real Xh2o "H2O mass fraction";
   Real Xco2 "CO2 mass fraction";
   Real Xn2 "N2 mass fraction";
@@ -70,23 +70,23 @@
   Real Xvo2 "O2 volume fraction";
   Real Xvn2 "N2 volume fraction";
   Real Xvso2 "SO2 volume fraction";
-  Modelica.SIunits.MassFlowRate Q(start=1) "Flue gases mass flow rate";
-  Modelica.SIunits.CoefficientOfHeatTransfer K(start=0)
+  Modelica.Units.SI.MassFlowRate Q(start=1) "Flue gases mass flow rate";
+  Modelica.Units.SI.CoefficientOfHeatTransfer K(start=0)
     "Total heat exchange coefficient";
-  Modelica.SIunits.CoefficientOfHeatTransfer Kc(start=0)
+  Modelica.Units.SI.CoefficientOfHeatTransfer Kc(start=0)
     "Convective heat exchange coefficient";
-  Modelica.SIunits.CoefficientOfHeatTransfer Kr(start=0)
+  Modelica.Units.SI.CoefficientOfHeatTransfer Kr(start=0)
     "Radiative heat exchange coefficient";
-  Modelica.SIunits.CoefficientOfHeatTransfer Kcc[Ns](start=fill(0, Ns))
+  Modelica.Units.SI.CoefficientOfHeatTransfer Kcc[Ns](start=fill(0, Ns))
     "Intermedaite variable for the computation of the convective heat exchange coefficient";
-  Modelica.SIunits.CoefficientOfHeatTransfer Krr[Ns](start=fill(0, Ns))
+  Modelica.Units.SI.CoefficientOfHeatTransfer Krr[Ns](start=fill(0, Ns))
     "Intermedaite variable for the computation of the radiative heat exchange coefficient";
-  Modelica.SIunits.Power dW[Ns](start=fill(0, Ns))
+  Modelica.Units.SI.Power dW[Ns](start=fill(0, Ns))
     "Power exchange between the wall and the fluid in each section";
-  Modelica.SIunits.Power W(start=0) "Total power exchanged";
+  Modelica.Units.SI.Power W(start=0) "Total power exchanged";
   ThermoSysPro.Units.DifferentialTemperature DeltaT[Ns](start=fill(50, Ns))
     "Temperature difference between the fluid and the wall";
-  Modelica.SIunits.Temperature TFilm[Ns] "Film temperature";
+  Modelica.Units.SI.Temperature TFilm[Ns] "Film temperature";
   Real Mmt "Total flue gases molar mass";
 
 public
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Junctions/Mixer2.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Junctions/Mixer2.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Junctions/Mixer2.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Junctions/Mixer2.mo"	2022-03-10 09:58:48.252153025 +0000
@@ -1,22 +1,22 @@
-﻿within ThermoSysPro.FlueGases.Junctions;
+within ThermoSysPro.FlueGases.Junctions;
 model Mixer2 "Flue gases mixer with two inlets"
-  parameter Modelica.SIunits.SpecificEnthalpy hr=2501569 "Water/steam reference specific enthalpy at 0.01°C";
+  parameter Modelica.Units.SI.SpecificEnthalpy hr=2501569 "Water/steam reference specific enthalpy at 0.01°C";
 
 public
   Real alpha1 "Extraction coefficient for inlet 1 (<=1)";
-  Modelica.SIunits.AbsolutePressure P(start=1e5) "Fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
-  Modelica.SIunits.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P(start=1e5) "Fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
   Real Xco2 "CO2 mass fraction";
   Real Xh2o "H20 mass fraction";
   Real Xo2 "O2 mass fraction";
   Real Xso2 "SO2 mass fraction";
   Real Xn2 "N2 mass fraction";
-  Modelica.SIunits.SpecificEnthalpy he1(start=100000)
+  Modelica.Units.SI.SpecificEnthalpy he1(start=100000)
     "Fluid specific enthalpy at inlet #1";
-  Modelica.SIunits.SpecificEnthalpy he2(start=100000)
+  Modelica.Units.SI.SpecificEnthalpy he2(start=100000)
     "Fluid specific enthalpy at inlet #2";
-  Modelica.SIunits.SpecificEnthalpy hs(start=100000)
+  Modelica.Units.SI.SpecificEnthalpy hs(start=100000)
     "Fluid specific enthalpy at the outlet";
 
 public
@@ -60,7 +60,7 @@
   0 = Ce1.Q + Ce2.Q - Cs.Q;
 
   /* Energy balance equation */
-  //0 = Ce1.Q*he1 + Ce2.Q*he2 - Cs.Q*hs;
+//0 = Ce1.Q*he1 + Ce2.Q*he2 - Cs.Q*hs;
   0 = Ce1.Q*(he1 - Ce1.Xh2o*hr) + Ce2.Q*(he2 - Ce2.Xh2o*hr) - Cs.Q*(hs - Cs.Xh2o*hr);
 
   /* Fluid composition balance equations */
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Junctions/Splitter2.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Junctions/Splitter2.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Junctions/Splitter2.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Junctions/Splitter2.mo"	2022-03-10 09:58:48.236153024 +0000
@@ -1,24 +1,24 @@
-﻿within ThermoSysPro.FlueGases.Junctions;
+within ThermoSysPro.FlueGases.Junctions;
 model Splitter2 "Flue gases splitter with two outlets"
-  parameter Modelica.SIunits.SpecificEnthalpy hr=2501569 "Water/steam reference specific enthalpy at 0.01°C";
+  parameter Modelica.Units.SI.SpecificEnthalpy hr=2501569 "Water/steam reference specific enthalpy at 0.01°C";
 
 public
   Real alpha1 "Extraction coefficient for outlet 1 (<=1)";
-  Modelica.SIunits.AbsolutePressure P(start=1e5) "Fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=1e5) "Fluid specific enthalpy";
-  Modelica.SIunits.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P(start=1e5) "Fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=1e5) "Fluid specific enthalpy";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
   Real Xco2 "CO2 mass fraction";
   Real Xh2o "H20 mass fraction";
   Real Xo2 "O2 mass fraction";
   Real Xso2 "SO2 mass fraction";
   Real Xn2 "N2 mass fraction";
-  Modelica.SIunits.SpecificEnthalpy he(start=100000)
+
+  Modelica.Units.SI.SpecificEnthalpy he(start=100000)
     "Fluid specific enthalpy at the inlet";
-  Modelica.SIunits.SpecificEnthalpy hs1(start=100000)
+  Modelica.Units.SI.SpecificEnthalpy hs1(start=100000)
     "Fluid specific enthalpy at outlet #1";
-  Modelica.SIunits.SpecificEnthalpy hs2(start=100000)
+  Modelica.Units.SI.SpecificEnthalpy hs2(start=100000)
     "Fluid specific enthalpy at outlet #2";
-
 public
   Connectors.FlueGasesInlet Ce
     annotation (Placement(transformation(extent={{-110,-10},{-90,10}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Machines/CombustionTurbine.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Machines/CombustionTurbine.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Machines/CombustionTurbine.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Machines/CombustionTurbine.mo"	2022-03-10 09:58:48.212153020 +0000
@@ -11,28 +11,28 @@
 public
   Real tau(start=0.07) "Expansion rate";
   Real is_eff(start=0.85) "Isentropic efficiency";
-  Modelica.SIunits.Power Wcp(start=1e9) "Compressor power";
-  Modelica.SIunits.Power Wturb(start=2e9) "Turbine power";
-  Modelica.SIunits.Power Wmech(start=1e9) "Mechanical power";
-  Modelica.SIunits.AbsolutePressure Pe( start=1e5)
+  Modelica.Units.SI.Power Wcp(start=1e9) "Compressor power";
+  Modelica.Units.SI.Power Wturb(start=2e9) "Turbine power";
+  Modelica.Units.SI.Power Wmech(start=1e9) "Mechanical power";
+  Modelica.Units.SI.AbsolutePressure Pe( start=1e5)
     "Flue gases pressure at the inlet";
-  Modelica.SIunits.AbsolutePressure Ps(start=1e5)
+  Modelica.Units.SI.AbsolutePressure Ps(start=1e5)
     "Flue gases pressure at the outlet";
   Real Xtau(start=1) "Ratio between the actual and nominal expansion rate";
-  Modelica.SIunits.MassFlowRate Q(start=500) "Flue gases mass flow rate";
-  Modelica.SIunits.Temperature Te(start=1.4e3)
+  Modelica.Units.SI.MassFlowRate Q(start=500) "Flue gases mass flow rate";
+  Modelica.Units.SI.Temperature Te(start=1.4e3)
     "Flue gases temperature at the inlet";
-  Modelica.SIunits.Temperature Ts(start=900)
+  Modelica.Units.SI.Temperature Ts(start=900)
     "Flue gases temperature at the outlet";
-  Modelica.SIunits.Temperature Tis(start=750)
+  Modelica.Units.SI.Temperature Tis(start=750)
     "Isentropic air temperature at the outlet";
-  Modelica.SIunits.SpecificEnthalpy He(start=1.2e6)
+  Modelica.Units.SI.SpecificEnthalpy He(start=1.2e6)
     "Flue gases specific enthalpy at the inlet";
-  Modelica.SIunits.SpecificEnthalpy Hs(start=6e5)
+  Modelica.Units.SI.SpecificEnthalpy Hs(start=6e5)
     "Flue gases specific enthalpy at the outlet";
-  Modelica.SIunits.SpecificEnthalpy His(start=6e5)
+  Modelica.Units.SI.SpecificEnthalpy His(start=6e5)
     "Flue gases specific enthalpy after the isentropic expansion";
-  Modelica.SIunits.SpecificEntropy Se
+  Modelica.Units.SI.SpecificEntropy Se
     "Flue gases specific entropy at the inlet";
 public
   ThermoSysPro.FlueGases.Connectors.FlueGasesInlet Ce
@@ -102,8 +102,8 @@
   Hs = is_eff*(His - He) +  He;
 
   /* Temperature at the outlet */
-//  Ts = ThermoSysPro.Properties.FlueGases.FlueGases_T(Ps, Hs, Ce.Xco2, Ce.Xh2o, Ce.Xo2, Ce.Xso2);
-  // replace by a function that can be differentiated and call with unknown variable on right-hand side
+//  Ts = ThermoSysPro.Properties.FlueGases.FlueGases_T(Ps, Hs, Ce.Xco2, Ce.Xh2o, Ce.Xo2, Ce.Xso2);
+// replace by a function that can be differentiated and call with unknown variable on right-hand side
   Hs = ThermoSysPro.Properties.FlueGases.FlueGases_h(Ps, Ts, Ce.Xco2, Ce.Xh2o, Ce.Xo2, Ce.Xso2);
 
   annotation (
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Machines/Compressor.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Machines/Compressor.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Machines/Compressor.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Machines/Compressor.mo"	2022-03-10 09:58:48.200153018 +0000
@@ -2,7 +2,7 @@
 model Compressor "Gas compressor"
   parameter Integer mass_flow_rate_comp=1
     "Ways for computing the mass flow rate - 1: Q = rho*Qv - 2: Q = rho*f(T)";
-  parameter Modelica.SIunits.Temperature Tmax=284.16
+  parameter Modelica.Units.SI.Temperature Tmax=284.16
     "Air transition temperature between f1 = a*x + b and f2 = c*x + d for the computation of Q (active if mass_flow_rate_comp == 2)";
   parameter Real coef1_1=0.1164 "Coefficient a for f1 = a*x + b";
    parameter Real coef2_1=38.643 "Coefficient b for f1 = a*x + b";
@@ -22,30 +22,30 @@
   parameter Real is_eff_n=0.84752 "Nominal isentropic efficiency";
 
 protected
-  Modelica.SIunits.VolumeFlowRate Qv_cal(start=500)
+  Modelica.Units.SI.VolumeFlowRate Qv_cal(start=500)
     "Intermediate variable for the computation of Qv";
 
 public
   Real tau(start=15) "Compression rate";
   Real is_eff(start=0.85) "Isentropic efficiency";
-  Modelica.SIunits.Power Wcp(start=1e9) "Compressor power";
-  Modelica.SIunits.AbsolutePressure Pe( start=1e5) "Air pressure at the inlet";
-  Modelica.SIunits.AbsolutePressure Ps(start=15e5) "Air pressure at the outlet";
+  Modelica.Units.SI.Power Wcp(start=1e9) "Compressor power";
+  Modelica.Units.SI.AbsolutePressure Pe( start=1e5) "Air pressure at the inlet";
+  Modelica.Units.SI.AbsolutePressure Ps(start=15e5) "Air pressure at the outlet";
   Real Xtau( start=1) "Normal and nominal compression rates ratio";
-  Modelica.SIunits.MassFlowRate Q(start=500) "Air mass flow rate";
-  Modelica.SIunits.VolumeFlowRate Qv(start=500) "Air volumetric flow rate";
-  Modelica.SIunits.Temperature Te( start=300) "Air temperature at the inlet";
-  Modelica.SIunits.Temperature Ts(start=750) "Air temperature at the outlet";
-  Modelica.SIunits.Temperature Tis(start=750)
+  Modelica.Units.SI.MassFlowRate Q(start=500) "Air mass flow rate";
+  Modelica.Units.SI.VolumeFlowRate Qv(start=500) "Air volumetric flow rate";
+  Modelica.Units.SI.Temperature Te( start=300) "Air temperature at the inlet";
+  Modelica.Units.SI.Temperature Ts(start=750) "Air temperature at the outlet";
+  Modelica.Units.SI.Temperature Tis(start=750)
     "Isentropic air temperature at the outlet";
-  Modelica.SIunits.SpecificEnthalpy He(start=80e3)
+  Modelica.Units.SI.SpecificEnthalpy He(start=80e3)
     "Air specific enthalpy at the inlet";
-  Modelica.SIunits.SpecificEnthalpy Hs(start=500e3)
+  Modelica.Units.SI.SpecificEnthalpy Hs(start=500e3)
     "Air specific enthalpy at the outlet";
-  Modelica.SIunits.SpecificEnthalpy His(start=450e3)
+  Modelica.Units.SI.SpecificEnthalpy His(start=450e3)
     "Air specific enthalpy after the isentropic compression";
-  Modelica.SIunits.SpecificEntropy Se "Air specific entropy at the inlet";
-  Modelica.SIunits.Density rho_e(start=1) "Air density at the inlet";
+  Modelica.Units.SI.SpecificEntropy Se "Air specific entropy at the inlet";
+  Modelica.Units.SI.Density rho_e(start=1) "Air density at the inlet";
 
 public
   ThermoSysPro.FlueGases.Connectors.FlueGasesInlet Ce
@@ -109,8 +109,8 @@
   Hs = (His - He + is_eff*He)/is_eff;
 
   /* Temperature at the outlet */
-  //Ts = ThermoSysPro.Properties.FlueGases.FlueGases_T(Ps, Hs, Ce.Xco2, Ce.Xh2o, Ce.Xo2, Ce.Xso2);
-  // call implicitly to avoid function that can not be differentiated.
+//Ts = ThermoSysPro.Properties.FlueGases.FlueGases_T(Ps, Hs, Ce.Xco2, Ce.Xh2o, Ce.Xo2, Ce.Xso2);
+// call implicitly to avoid function that can not be differentiated.
   Hs = ThermoSysPro.Properties.FlueGases.FlueGases_h(Ps, Ts, Ce.Xco2, Ce.Xh2o, Ce.Xo2, Ce.Xso2);
 
   annotation (
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Machines/StaticFan.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Machines/StaticFan.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Machines/StaticFan.mo"	2022-03-10 09:57:37.976144122 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Machines/StaticFan.mo"	2022-03-10 09:58:48.180153016 +0000
@@ -7,7 +7,7 @@
     "Product of the pump mechanical and electrical efficiencies";
   parameter Boolean adiabatic_compression=false
     "true: adiabatic compression - false: non adiabatic compression";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
 
   parameter Real a1=-52.04
     "x^2 coef. of the pump characteristics hn = f(vol_flow) (s2/m5)";
@@ -24,32 +24,32 @@
     "Constant coef. of the pump efficiency characteristics rh = f(vol_flow) (s.u.)";
 
 protected
-  constant Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  constant Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
   parameter Real eps=1.e-6 "Small number";
   parameter Real rhmin=0.20 "Minimum efficiency to avoid zero crossings";
 
 public
   Real rh( start=0.5) "Hydraulic efficiency";
-  Modelica.SIunits.Length hn(start=10) "Pump head";
+  Modelica.Units.SI.Length hn(start=10) "Pump head";
   Real R "Ratio VRot/VRotn (s.u.)";
-  Modelica.SIunits.MassFlowRate Q(start=500) "Mass flow";
-  Modelica.SIunits.VolumeFlowRate Qv(start=0.5) "Volumetric flow";
-  Modelica.SIunits.Power Wh "Hydraulic power";
-  Modelica.SIunits.Power Wm "Motor power";
-   Modelica.SIunits.Density rho(start=998) "Fluid density";
+  Modelica.Units.SI.MassFlowRate Q(start=500) "Mass flow";
+  Modelica.Units.SI.VolumeFlowRate Qv(start=0.5) "Volumetric flow";
+  Modelica.Units.SI.Power Wh "Hydraulic power";
+  Modelica.Units.SI.Power Wm "Motor power";
+   Modelica.Units.SI.Density rho(start=998) "Fluid density";
   ThermoSysPro.Units.DifferentialPressure deltaP
     "Pressure variation between the outlet and the inlet";
-  Modelica.SIunits.SpecificEnthalpy deltaH
+  Modelica.Units.SI.SpecificEnthalpy deltaH
     "Specific enthalpy variation between the outlet and the inlet";
-  Modelica.SIunits.AbsolutePressure P(start=1.e5) "Fluid average pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=100000)
+  Modelica.Units.SI.AbsolutePressure P(start=1.e5) "Fluid average pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=100000)
     "Fluid average specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy h1(start=100000)
+  Modelica.Units.SI.SpecificEnthalpy h1(start=100000)
     "Fluid specific enthalpy in";
-  Modelica.SIunits.SpecificEnthalpy h2(start=100000)
+  Modelica.Units.SI.SpecificEnthalpy h2(start=100000)
     "Fluid specific enthalpy out";
-  Modelica.SIunits.Temperature T( start=500) "Fluid temperature";
+  Modelica.Units.SI.Temperature T( start=500) "Fluid temperature";
 
 public
   ThermoSysPro.InstrumentationAndControl.Connectors.InputLogical commandeFan
@@ -113,13 +113,11 @@
 
   /* Fluid thermodynamic properties */
   P = (C1.P + C2.P)/2;
-  h = (h1 + h2)/2;
-
-  // Temperature
-  h =  ThermoSysPro.Properties.FlueGases.FlueGases_h(P, T, C2.Xco2, C2.Xh2o, C2.Xo2, C2.Xso2);
-  h2 =  ThermoSysPro.Properties.FlueGases.FlueGases_h(P, C2.T, C2.Xco2, C2.Xh2o, C2.Xo2, C2.Xso2);
-
-  // Enthalpy
+  h = (h1 + h2)/2;
+// Temperature
+  h = ThermoSysPro.Properties.FlueGases.FlueGases_h(P, T, C2.Xco2, C2.Xh2o, C2.Xo2, C2.Xso2);
+  h2 =  ThermoSysPro.Properties.FlueGases.FlueGases_h(P, C2.T, C2.Xco2, C2.Xh2o, C2.Xo2, C2.Xso2);
+// Enthalpy
   h1 = ThermoSysPro.Properties.FlueGases.FlueGases_h(P, C1.T, C2.Xco2, C2.Xh2o, C2.Xo2, C2.Xso2);
 
   if (p_rho > 0) then
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/PressureLosses/CheckValve.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/PressureLosses/CheckValve.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/PressureLosses/CheckValve.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/PressureLosses/CheckValve.mo"	2022-03-10 09:58:48.128153010 +0000
@@ -6,9 +6,9 @@
     "Pressure difference when the valve closes";
   parameter ThermoSysPro.Units.PressureLossCoefficient k=1000
     "Pressure loss coefficient";
-  parameter Modelica.SIunits.MassFlowRate Qmin=1.e-6
+  parameter Modelica.Units.SI.MassFlowRate Qmin=1.e-6
     "Mass flow when the valve is closed";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
 
 protected
   parameter Real eps=1.e-3 "Small number for pressure loss equation";
@@ -17,12 +17,12 @@
   Boolean ouvert(start=true, fixed=true) "Valve state";
   discrete Boolean touvert(start=false, fixed=true);
   discrete Boolean tferme(start=false, fixed=true);
-  Modelica.SIunits.MassFlowRate Q(start=100) "Mass flow";
+  Modelica.Units.SI.MassFlowRate Q(start=100) "Mass flow";
   ThermoSysPro.Units.DifferentialPressure deltaP(start=10)
     "Singular pressure loss";
-  Modelica.SIunits.Density rho(start=1) "Fluid density";
-  Modelica.SIunits.Temperature T(start=300) "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure P(start=1.e5) "Fluid average pressure";
+  Modelica.Units.SI.Density rho(start=1) "Fluid density";
+  Modelica.Units.SI.Temperature T(start=300) "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P(start=1.e5) "Fluid average pressure";
 
   Connectors.FlueGasesInlet C1      annotation (Placement(transformation(extent=
            {{-120,-10},{-100,10}}, rotation=0)));
@@ -31,7 +31,7 @@
 equation
 
   C1.Q = C2.Q;
-  C1.T = C2.T; // Because the behaviour of the flue gas is close to an ideal gas
+  C1.T = C2.T; // Because the behaviour of the flue gas is close to an ideal gas
   Q = C1.Q;
   deltaP = C1.P - C2.P;
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/PressureLosses/ControlValve.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/PressureLosses/ControlValve.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/PressureLosses/ControlValve.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/PressureLosses/ControlValve.mo"	2022-03-10 09:58:48.116153009 +0000
@@ -8,19 +8,19 @@
     "0:linear characteristics - 1:characteristics is given by caract[]";
   parameter Integer option_interpolation=1
     "1: linear interpolation - 2: spline interpolation (active if mode_caract=1)";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
 
 protected
   parameter Real eps=1.e-3 "Small number for pressure loss equation";
 
 public
   ThermoSysPro.Units.Cv Cv(start=100) "Cv";
-  Modelica.SIunits.MassFlowRate Q(start=100) "Mass flow";
+  Modelica.Units.SI.MassFlowRate Q(start=100) "Mass flow";
   ThermoSysPro.Units.DifferentialPressure deltaP(start=10)
     "Singular pressure loss";
-  Modelica.SIunits.Density rho(start=1) "Fluid density";
-  Modelica.SIunits.Temperature T(start=300) "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure P(start=1.e5) "Fluid average pressure";
+  Modelica.Units.SI.Density rho(start=1) "Fluid density";
+  Modelica.Units.SI.Temperature T(start=300) "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P(start=1.e5) "Fluid average pressure";
 
 public
   ThermoSysPro.InstrumentationAndControl.Connectors.InputReal Ouv
@@ -36,7 +36,7 @@
             {110,-50}}, rotation=0)));
 equation
 
-  C1.T = C2.T; // Because the behaviour of the flue gas is close to an ideal gas
+  C1.T = C2.T; // Because the behaviour of the flue gas is close to an ideal gas
   C1.Q = C2.Q;
   Q = C1.Q;
   deltaP = C1.P - C2.P;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/PressureLosses/InvSingularPressureLoss.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/PressureLosses/InvSingularPressureLoss.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/PressureLosses/InvSingularPressureLoss.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/PressureLosses/InvSingularPressureLoss.mo"	2022-03-10 09:58:48.100153006 +0000
@@ -1,20 +1,20 @@
 within ThermoSysPro.FlueGases.PressureLosses;
 model InvSingularPressureLoss "Inverse singular pressure loss"
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
 
 protected
   parameter Real eps=1.e-0 "Small number for pressure loss equation";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3 "Small mass flow";
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3 "Small mass flow";
 
 public
   Real K(start=10) "Pressure loss coefficient";
   ThermoSysPro.Units.DifferentialPressure deltaP(start=1.e2)
     "Singular pressure loss";
-  Modelica.SIunits.MassFlowRate Q(start=500) "Mass flow";
-  Modelica.SIunits.Density rho(start=1) "Fluid density";
-  Modelica.SIunits.Temperature T(start=300) "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure P(start=1.e5) "Fluid average pressure";
 
+  Modelica.Units.SI.MassFlowRate Q(start=500) "Mass flow";
+  Modelica.Units.SI.Density rho(start=1) "Fluid density";
+  Modelica.Units.SI.Temperature T(start=300) "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P(start=1.e5) "Fluid average pressure";
 public
   ThermoSysPro.FlueGases.Connectors.FlueGasesInlet C1
                           annotation (Placement(transformation(extent={{-110,
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/PressureLosses/SingularPressureLoss.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/PressureLosses/SingularPressureLoss.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/PressureLosses/SingularPressureLoss.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/PressureLosses/SingularPressureLoss.mo"	2022-03-10 09:58:48.084153005 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.FlueGases.PressureLosses;
 model SingularPressureLoss "Singular pressure loss for flue gases"
   parameter Real K=1.e-3 "Friction pressure loss coefficient";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
 
 protected
   parameter Real eps=1.e-3 "Small number for pressure loss equation";
@@ -9,10 +9,10 @@
 public
   ThermoSysPro.Units.DifferentialPressure deltaPf(start=1.e2)
     "Friction pressure loss";
-  Modelica.SIunits.MassFlowRate Q(start=500) "Mass flow";
-  Modelica.SIunits.Density rho(start=1) "Fluid density";
-  Modelica.SIunits.Temperature T(start=290) "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure P(start=1.e5) "Average fluid pressure";
+  Modelica.Units.SI.MassFlowRate Q(start=500) "Mass flow";
+  Modelica.Units.SI.Density rho(start=1) "Fluid density";
+  Modelica.Units.SI.Temperature T(start=290) "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P(start=1.e5) "Average fluid pressure";
 
 public
   ThermoSysPro.FlueGases.Connectors.FlueGasesInlet C1
@@ -24,7 +24,7 @@
 
 equation
   C1.P - C2.P = deltaPf;
-  C1.T = C2.T; // Because the behaviour of the flue gas is close to an ideal gas
+  C1.T = C2.T; // Because the behaviour of the flue gas is close to an ideal gas
   C1.Q = C2.Q;
 
   C2.Xco2 = C1.Xco2;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Sensors/MassFlowSensor.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Sensors/MassFlowSensor.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Sensors/MassFlowSensor.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Sensors/MassFlowSensor.mo"	2022-03-10 09:58:48.064153002 +0000
@@ -1,7 +1,5 @@
 within ThermoSysPro.FlueGases.Sensors;
 model MassFlowSensor "Mass flow sensor"
-
-public
   ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal Mesure
     annotation (Placement(transformation(
         origin={0,102},
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Sensors/PressureSensor.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Sensors/PressureSensor.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Sensors/PressureSensor.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Sensors/PressureSensor.mo"	2022-03-10 09:58:48.056153000 +0000
@@ -1,7 +1,5 @@
 within ThermoSysPro.FlueGases.Sensors;
 model PressureSensor "Pressure sensor"
-
-public
   ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal Mesure
     annotation (Placement(transformation(
         origin={0,102},
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Sensors/TemperatureSensor.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Sensors/TemperatureSensor.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Sensors/TemperatureSensor.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Sensors/TemperatureSensor.mo"	2022-03-10 09:58:48.048152999 +0000
@@ -1,7 +1,5 @@
 within ThermoSysPro.FlueGases.Sensors;
 model TemperatureSensor "Temperature sensor"
-
-public
   ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal Mesure
     annotation (Placement(transformation(
         origin={0,102},
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/TAC/GTCICOBarilla.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/TAC/GTCICOBarilla.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/TAC/GTCICOBarilla.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/TAC/GTCICOBarilla.mo"	2022-03-10 09:58:48.032152997 +0000
@@ -6,7 +6,7 @@
   parameter Real exp_tau_n=0.079255386 "Turbine nominal expansion rate";
   parameter Real exp_eff_n=0.881225 "Turbine nominal efficiency";
   parameter Real TurbQred=0.00449194 "Turbine reduced mass flow rate";
-  parameter Modelica.SIunits.Power Wpth=50000
+  parameter Modelica.Units.SI.Power Wpth=50000
     "Combustion chamber thermal losses";
 
   BoundaryConditions.AirHumidity xAIR
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/TAC/GasTurbine.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/TAC/GasTurbine.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/TAC/GasTurbine.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/TAC/GasTurbine.mo"	2022-03-10 09:58:48.012152994 +0000
@@ -11,16 +11,16 @@
   parameter Real exp_tau_n=0.05 "Turbine nominal expansion rate";
   parameter Real exp_eff_n=0.9 "Turbine nominal efficiency";
   parameter Real TurbQred=0.01 "Turbine reduced mass flow rate";
-////old
-  //parameter Real B0 = 0.3735955;
-  //parameter Real B1 = 1.42460674;
-  //parameter Real B2 = -0.80865168;
+  ////old
+  //parameter Real B0 = 0.3735955;
+  //parameter Real B1 = 1.42460674;
+  //parameter Real B2 = -0.80865168;
   parameter Real B0 = 0.95223;
   parameter Real B1 = 0.09555;
   parameter Real B2 = -0.04778;
 
   parameter Real Kcham = 1 "Chamber pressure loss coefficient";
-  parameter Modelica.SIunits.Power Wpth=1e5 "Combustion chamber thermal losses";
+  parameter Modelica.Units.SI.Power Wpth=1e5 "Combustion chamber thermal losses";
 
   BoundaryConditions.AirHumidity xAIR
                     annotation (Placement(transformation(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Volumes/VolumeATh.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Volumes/VolumeATh.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Volumes/VolumeATh.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Volumes/VolumeATh.mo"	2022-03-10 09:58:47.988152993 +0000
@@ -1,10 +1,10 @@
-﻿within ThermoSysPro.FlueGases.Volumes;
+within ThermoSysPro.FlueGases.Volumes;
 model VolumeATh
   "Mixing flue gases volume with 2 inlets and 2 outlets and thermal input"
-  parameter Modelica.SIunits.Volume V=1 "Volume";
-  parameter Modelica.SIunits.AbsolutePressure P0=1e5
+  parameter Modelica.Units.SI.Volume V=1 "Volume";
+  parameter Modelica.Units.SI.AbsolutePressure P0=1e5
     "Initial fluid pressure (active if dynamic_mass_balance=true and steady_state=false)";
-  parameter Modelica.SIunits.Temperature T0=400
+  parameter Modelica.Units.SI.Temperature T0=400
     "Initial fluid temperature (active if steady_state=false)";
   parameter Boolean dynamic_mass_balance=false
     "true: dynamic mass balance equation - false: static mass balance equation";
@@ -12,43 +12,43 @@
     "true: dynamic fluid composition balance equation - false: static fluid composition balance equation";
   parameter Boolean steady_state=true
     "true: start from steady state - false: start from (P0, h0)";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
-  parameter Modelica.SIunits.SpecificEnthalpy hr=2501569 "Water/steam reference specific enthalpy at 0.01°C";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.SpecificEnthalpy hr=2501569 "Water/steam reference specific enthalpy at 0.01°C";
   parameter Real Xco20 = 0.0  "CO2 mass fraction (active if steady_state=false)";
   parameter Real Xh2o0 = 0.05 "H20 mass fraction (active if steady_state=false)";
   parameter Real Xo20 = 0.23 "O2 mass fraction (active if steady_state=false)";
   parameter Real Xso20 = 0 "SO2 mass fraction (active if steady_state=false)";
 
 public
-  Modelica.SIunits.Temperature T(start=500) "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure P(start=1.e5) "Fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
-  Modelica.SIunits.Density rho(start=1) "Fluid density";
-  Modelica.SIunits.SpecificHeatCapacity cp(start=1000)
+  Modelica.Units.SI.Temperature T(start=500) "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P(start=1.e5) "Fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
+  Modelica.Units.SI.Density rho(start=1) "Fluid density";
+  Modelica.Units.SI.SpecificHeatCapacity cp(start=1000)
     "Fluid spécific heat capacity";
   Real Xco2 "CO2 mass fraction";
   Real Xh2o "H20 mass fraction";
   Real Xo2 "O2 mass fraction";
   Real Xso2 "SO2 mass fraction";
   Real Xn2 "N2 mass fraction";
-  Modelica.SIunits.MassFlowRate BQ
+  Modelica.Units.SI.MassFlowRate BQ
     "Right hand side of the mass balance equation";
-  Modelica.SIunits.Power BH "Right hand side of the energybalance equation";
-  Modelica.SIunits.MassFlowRate BXco2
+  Modelica.Units.SI.Power BH "Right hand side of the energybalance equation";
+  Modelica.Units.SI.MassFlowRate BXco2
     "Right hand side of the CO2 balance equation";
-  Modelica.SIunits.MassFlowRate BXh2o
+  Modelica.Units.SI.MassFlowRate BXh2o
     "Right hand side of the H2O balance equation";
-  Modelica.SIunits.MassFlowRate BXo2
+  Modelica.Units.SI.MassFlowRate BXo2
     "Right hand side of the O2 balance equation";
-  Modelica.SIunits.MassFlowRate BXso2
+  Modelica.Units.SI.MassFlowRate BXso2
     "Right hand side of the SO2 balance equation";
-  Modelica.SIunits.SpecificEnthalpy he1(start=100000)
+  Modelica.Units.SI.SpecificEnthalpy he1(start=100000)
     "Fluid specific enthalpy at inlet #1";
-  Modelica.SIunits.SpecificEnthalpy he2(start=100000)
+  Modelica.Units.SI.SpecificEnthalpy he2(start=100000)
     "Fluid specific enthalpy at inlet #2";
-  Modelica.SIunits.SpecificEnthalpy hs1(start=100000)
+  Modelica.Units.SI.SpecificEnthalpy hs1(start=100000)
     "Fluid specific enthalpy at outlet #1";
-  Modelica.SIunits.SpecificEnthalpy hs2(start=100000)
+  Modelica.Units.SI.SpecificEnthalpy hs2(start=100000)
     "Fluid specific enthalpy at outlet #2";
 
   Connectors.FlueGasesInlet Ce1
@@ -191,8 +191,7 @@
   he2 = ThermoSysPro.Properties.FlueGases.FlueGases_h(P, Ce2.T, Ce2.Xco2, Ce2.Xh2o, Ce2.Xo2, Ce2.Xso2);
   hs1 = ThermoSysPro.Properties.FlueGases.FlueGases_h(P, Cs1.T, Cs1.Xco2, Cs1.Xh2o, Cs1.Xo2, Cs1.Xso2);
   hs2 = ThermoSysPro.Properties.FlueGases.FlueGases_h(P, Cs2.T, Cs2.Xco2, Cs2.Xh2o, Cs2.Xo2, Cs2.Xso2);
-
-  //T = ThermoSysPro.Properties.FlueGases.FlueGases_T(P, h, Xco2, Xh2o, Xo2, Xso2);
+//T = ThermoSysPro.Properties.FlueGases.FlueGases_T(P, h, Xco2, Xh2o, Xo2, Xso2);
   h = ThermoSysPro.Properties.FlueGases.FlueGases_h(P, T, Xco2, Xh2o, Xo2, Xso2);
 
   cp = ThermoSysPro.Properties.FlueGases.FlueGases_cp(P, T, Xco2, Xh2o, Xo2, Xso2);
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Volumes/VolumeBTh.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Volumes/VolumeBTh.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Volumes/VolumeBTh.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Volumes/VolumeBTh.mo"	2022-03-10 09:58:47.960152988 +0000
@@ -1,10 +1,10 @@
-﻿within ThermoSysPro.FlueGases.Volumes;
+within ThermoSysPro.FlueGases.Volumes;
 model VolumeBTh
   "Mixing flue gases volume with 2 inlets and 2 outlets and thermal input"
-  parameter Modelica.SIunits.Volume V=1 "Volume";
-  parameter Modelica.SIunits.AbsolutePressure P0=1e5
+  parameter Modelica.Units.SI.Volume V=1 "Volume";
+  parameter Modelica.Units.SI.AbsolutePressure P0=1e5
     "Initial fluid pressure (active if dynamic_mass_balance=true and steady_state=false)";
-  parameter Modelica.SIunits.Temperature T0=400
+  parameter Modelica.Units.SI.Temperature T0=400
     "Initial fluid temperature (active if steady_state=false)";
   parameter Boolean dynamic_mass_balance=false
     "true: dynamic mass balance equation - false: static mass balance equation";
@@ -12,43 +12,43 @@
     "true: dynamic fluid composition balance equation - false: static fluid composition balance equation";
   parameter Boolean steady_state=true
     "true: start from steady state - false: start from (P0, h0)";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
-  parameter Modelica.SIunits.SpecificEnthalpy hr=2501569 "Water/steam reference specific enthalpy at 0.01°C";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.SpecificEnthalpy hr=2501569 "Water/steam reference specific enthalpy at 0.01°C";
   parameter Real Xco20 = 0.0  "CO2 mass fraction (active if steady_state=false)";
   parameter Real Xh2o0 = 0.05 "H20 mass fraction (active if steady_state=false)";
   parameter Real Xo20 = 0.23 "O2 mass fraction (active if steady_state=false)";
   parameter Real Xso20 = 0 "SO2 mass fraction (active if steady_state=false)";
 
 public
-  Modelica.SIunits.Temperature T(start=500) "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure P(start=1.e5) "Fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
-  Modelica.SIunits.Density rho(start=1) "Fluid density";
-  Modelica.SIunits.SpecificHeatCapacity cp(start=1000)
+  Modelica.Units.SI.Temperature T(start=500) "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P(start=1.e5) "Fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
+  Modelica.Units.SI.Density rho(start=1) "Fluid density";
+  Modelica.Units.SI.SpecificHeatCapacity cp(start=1000)
     "Fluid spécific heat capacity";
   Real Xco2 "CO2 mass fraction";
   Real Xh2o "H20 mass fraction";
   Real Xo2 "O2 mass fraction";
   Real Xso2 "SO2 mass fraction";
   Real Xn2 "N2 mass fraction";
-  Modelica.SIunits.MassFlowRate BQ
+  Modelica.Units.SI.MassFlowRate BQ
     "Right hand side of the mass balance equation";
-  Modelica.SIunits.Power BH "Right hand side of the energybalance equation";
-  Modelica.SIunits.MassFlowRate BXco2
+  Modelica.Units.SI.Power BH "Right hand side of the energybalance equation";
+  Modelica.Units.SI.MassFlowRate BXco2
     "Right hand side of the CO2 balance equation";
-  Modelica.SIunits.MassFlowRate BXh2o
+  Modelica.Units.SI.MassFlowRate BXh2o
     "Right hand side of the H2O balance equation";
-  Modelica.SIunits.MassFlowRate BXo2
+  Modelica.Units.SI.MassFlowRate BXo2
     "Right hand side of the O2 balance equation";
-  Modelica.SIunits.MassFlowRate BXso2
+  Modelica.Units.SI.MassFlowRate BXso2
     "Right hand side of the SO2 balance equation";
-  Modelica.SIunits.SpecificEnthalpy he1(start=100000)
+  Modelica.Units.SI.SpecificEnthalpy he1(start=100000)
     "Fluid specific enthalpy at inlet #1";
-  Modelica.SIunits.SpecificEnthalpy he2(start=100000)
+  Modelica.Units.SI.SpecificEnthalpy he2(start=100000)
     "Fluid specific enthalpy at inlet #2";
-  Modelica.SIunits.SpecificEnthalpy hs1(start=100000)
+  Modelica.Units.SI.SpecificEnthalpy hs1(start=100000)
     "Fluid specific enthalpy at outlet #1";
-  Modelica.SIunits.SpecificEnthalpy hs2(start=100000)
+  Modelica.Units.SI.SpecificEnthalpy hs2(start=100000)
     "Fluid specific enthalpy at outlet #2";
 
   Connectors.FlueGasesInlet Ce1
@@ -191,8 +191,7 @@
   he2 = ThermoSysPro.Properties.FlueGases.FlueGases_h(P, Ce2.T, Ce2.Xco2, Ce2.Xh2o, Ce2.Xo2, Ce2.Xso2);
   hs1 = ThermoSysPro.Properties.FlueGases.FlueGases_h(P, Cs1.T, Cs1.Xco2, Cs1.Xh2o, Cs1.Xo2, Cs1.Xso2);
   hs2 = ThermoSysPro.Properties.FlueGases.FlueGases_h(P, Cs2.T, Cs2.Xco2, Cs2.Xh2o, Cs2.Xo2, Cs2.Xso2);
-
-  //T = ThermoSysPro.Properties.FlueGases.FlueGases_T(P, h, Xco2, Xh2o, Xo2, Xso2);
+//T = ThermoSysPro.Properties.FlueGases.FlueGases_T(P, h, Xco2, Xh2o, Xo2, Xso2);
   h = ThermoSysPro.Properties.FlueGases.FlueGases_h(P, T, Xco2, Xh2o, Xo2, Xso2);
 
   cp = ThermoSysPro.Properties.FlueGases.FlueGases_cp(P, T, Xco2, Xh2o, Xo2, Xso2);
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Volumes/VolumeCTh.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Volumes/VolumeCTh.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Volumes/VolumeCTh.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Volumes/VolumeCTh.mo"	2022-03-10 09:58:47.932152986 +0000
@@ -1,10 +1,10 @@
-﻿within ThermoSysPro.FlueGases.Volumes;
+within ThermoSysPro.FlueGases.Volumes;
 model VolumeCTh
   "Mixing flue gases volume with 3 inlets and 1 outlet and thermal input"
-  parameter Modelica.SIunits.Volume V=1 "Volume";
-  parameter Modelica.SIunits.AbsolutePressure P0=1e5
+  parameter Modelica.Units.SI.Volume V=1 "Volume";
+  parameter Modelica.Units.SI.AbsolutePressure P0=1e5
     "Initial fluid pressure (active if dynamic_mass_balance=true and steady_state=false)";
-  parameter Modelica.SIunits.Temperature T0=400
+  parameter Modelica.Units.SI.Temperature T0=400
     "Initial fluid temperature (active if steady_state=false)";
   parameter Boolean dynamic_mass_balance=false
     "true: dynamic mass balance equation - false: static mass balance equation";
@@ -12,43 +12,43 @@
     "true: dynamic fluid composition balance equation - false: static fluid composition balance equation";
   parameter Boolean steady_state=true
     "true: start from steady state - false: start from (P0, h0)";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
-  parameter Modelica.SIunits.SpecificEnthalpy hr=2501569 "Water/steam reference specific enthalpy at 0.01°C";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.SpecificEnthalpy hr=2501569 "Water/steam reference specific enthalpy at 0.01°C";
   parameter Real Xco20 = 0.0  "CO2 mass fraction (active if steady_state=false)";
   parameter Real Xh2o0 = 0.05 "H20 mass fraction (active if steady_state=false)";
   parameter Real Xo20 = 0.23 "O2 mass fraction (active if steady_state=false)";
   parameter Real Xso20 = 0 "SO2 mass fraction (active if steady_state=false)";
 
 public
-  Modelica.SIunits.Temperature T(start=500) "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure P(start=1.e5) "Fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
-  Modelica.SIunits.Density rho(start=1) "Fluid density";
-  Modelica.SIunits.SpecificHeatCapacity cp(start=1000)
+  Modelica.Units.SI.Temperature T(start=500) "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P(start=1.e5) "Fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
+  Modelica.Units.SI.Density rho(start=1) "Fluid density";
+  Modelica.Units.SI.SpecificHeatCapacity cp(start=1000)
     "Fluid spécific heat capacity";
   Real Xco2 "CO2 mass fraction";
   Real Xh2o "H20 mass fraction";
   Real Xo2 "O2 mass fraction";
   Real Xso2 "SO2 mass fraction";
   Real Xn2 "N2 mass fraction";
-  Modelica.SIunits.MassFlowRate BQ
+  Modelica.Units.SI.MassFlowRate BQ
     "Right hand side of the mass balance equation";
-  Modelica.SIunits.Power BH "Right hand side of the energybalance equation";
-  Modelica.SIunits.MassFlowRate BXco2
+  Modelica.Units.SI.Power BH "Right hand side of the energybalance equation";
+  Modelica.Units.SI.MassFlowRate BXco2
     "Right hand side of the CO2 balance equation";
-  Modelica.SIunits.MassFlowRate BXh2o
+  Modelica.Units.SI.MassFlowRate BXh2o
     "Right hand side of the H2O balance equation";
-  Modelica.SIunits.MassFlowRate BXo2
+  Modelica.Units.SI.MassFlowRate BXo2
     "Right hand side of the O2 balance equation";
-  Modelica.SIunits.MassFlowRate BXso2
+  Modelica.Units.SI.MassFlowRate BXso2
     "Right hand side of the SO2 balance equation";
-  Modelica.SIunits.SpecificEnthalpy he1(start=100000)
+  Modelica.Units.SI.SpecificEnthalpy he1(start=100000)
     "Fluid specific enthalpy at inlet #1";
-  Modelica.SIunits.SpecificEnthalpy he2(start=100000)
+  Modelica.Units.SI.SpecificEnthalpy he2(start=100000)
     "Fluid specific enthalpy at inlet #2";
-  Modelica.SIunits.SpecificEnthalpy he3(start=100000)
+  Modelica.Units.SI.SpecificEnthalpy he3(start=100000)
     "Fluid specific enthalpy at inlet #3";
-  Modelica.SIunits.SpecificEnthalpy hs(start=100000)
+  Modelica.Units.SI.SpecificEnthalpy hs(start=100000)
     "Fluid specific enthalpy at the outlet";
 
   Connectors.FlueGasesInlet Ce1
@@ -190,8 +190,7 @@
   he2 = ThermoSysPro.Properties.FlueGases.FlueGases_h(P, Ce2.T, Ce2.Xco2, Ce2.Xh2o, Ce2.Xo2, Ce2.Xso2);
   he3 = ThermoSysPro.Properties.FlueGases.FlueGases_h(P, Ce3.T, Ce3.Xco2, Ce3.Xh2o, Ce3.Xo2, Ce3.Xso2);
   hs = ThermoSysPro.Properties.FlueGases.FlueGases_h(P, Cs.T, Cs.Xco2, Cs.Xh2o, Cs.Xo2, Cs.Xso2);
-
-  //T = ThermoSysPro.Properties.FlueGases.FlueGases_T(P, h, Xco2, Xh2o, Xo2, Xso2);
+//T = ThermoSysPro.Properties.FlueGases.FlueGases_T(P, h, Xco2, Xh2o, Xo2, Xso2);
   h = ThermoSysPro.Properties.FlueGases.FlueGases_h(P, T, Xco2, Xh2o, Xo2, Xso2);
 
   cp = ThermoSysPro.Properties.FlueGases.FlueGases_cp(P, T, Xco2, Xh2o, Xo2, Xso2);
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Volumes/VolumeDTh.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Volumes/VolumeDTh.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Volumes/VolumeDTh.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/FlueGases/Volumes/VolumeDTh.mo"	2022-03-10 09:58:47.900152982 +0000
@@ -1,10 +1,10 @@
-﻿within ThermoSysPro.FlueGases.Volumes;
+within ThermoSysPro.FlueGases.Volumes;
 model VolumeDTh
   "Mixing flue gases volume with 1 inlets and 3 outlets and thermal input"
-  parameter Modelica.SIunits.Volume V=1 "Volume";
-  parameter Modelica.SIunits.AbsolutePressure P0=1e5
+  parameter Modelica.Units.SI.Volume V=1 "Volume";
+  parameter Modelica.Units.SI.AbsolutePressure P0=1e5
     "Initial fluid pressure (active if dynamic_mass_balance=true and steady_state=false)";
-  parameter Modelica.SIunits.Temperature T0=400
+  parameter Modelica.Units.SI.Temperature T0=400
     "Initial fluid temperature (active if steady_state=false)";
   parameter Boolean dynamic_mass_balance=false
     "true: dynamic mass balance equation - false: static mass balance equation";
@@ -12,43 +12,43 @@
     "true: dynamic fluid composition balance equation - false: static fluid composition balance equation";
   parameter Boolean steady_state=true
     "true: start from steady state - false: start from (P0, h0)";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
-  parameter Modelica.SIunits.SpecificEnthalpy hr=2501569 "Water/steam reference specific enthalpy at 0.01°C";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.SpecificEnthalpy hr=2501569 "Water/steam reference specific enthalpy at 0.01°C";
   parameter Real Xco20 = 0.0  "CO2 mass fraction (active if steady_state=false)";
   parameter Real Xh2o0 = 0.05 "H20 mass fraction (active if steady_state=false)";
   parameter Real Xo20 = 0.23 "O2 mass fraction (active if steady_state=false)";
   parameter Real Xso20 = 0 "SO2 mass fraction (active if steady_state=false)";
 
 public
-  Modelica.SIunits.Temperature T(start=500) "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure P(start=1.e5) "Fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
-  Modelica.SIunits.Density rho(start=1) "Fluid density";
-  Modelica.SIunits.SpecificHeatCapacity cp(start=1000)
+  Modelica.Units.SI.Temperature T(start=500) "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P(start=1.e5) "Fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
+  Modelica.Units.SI.Density rho(start=1) "Fluid density";
+  Modelica.Units.SI.SpecificHeatCapacity cp(start=1000)
     "Fluid specific heat capacity";
   Real Xco2 "CO2 mass fraction";
   Real Xh2o "H20 mass fraction";
   Real Xo2 "O2 mass fraction";
   Real Xso2 "SO2 mass fraction";
   Real Xn2 "N2 mass fraction";
-  Modelica.SIunits.MassFlowRate BQ
+  Modelica.Units.SI.MassFlowRate BQ
     "Right hand side of the mass balance equation";
-  Modelica.SIunits.Power BH "Right hand side of the energybalance equation";
-  Modelica.SIunits.MassFlowRate BXco2
+  Modelica.Units.SI.Power BH "Right hand side of the energybalance equation";
+  Modelica.Units.SI.MassFlowRate BXco2
     "Right hand side of the CO2 balance equation";
-  Modelica.SIunits.MassFlowRate BXh2o
+  Modelica.Units.SI.MassFlowRate BXh2o
     "Right hand side of the H2O balance equation";
-  Modelica.SIunits.MassFlowRate BXo2
+  Modelica.Units.SI.MassFlowRate BXo2
     "Right hand side of the O2 balance equation";
-  Modelica.SIunits.MassFlowRate BXso2
+  Modelica.Units.SI.MassFlowRate BXso2
     "Right hand side of the SO2 balance equation";
-  Modelica.SIunits.SpecificEnthalpy he(start=100000)
+  Modelica.Units.SI.SpecificEnthalpy he(start=100000)
     "Fluid specific enthalpy at inlet";
-  Modelica.SIunits.SpecificEnthalpy hs1(start=100000)
+  Modelica.Units.SI.SpecificEnthalpy hs1(start=100000)
     "Fluid specific enthalpy at outlet #1";
-  Modelica.SIunits.SpecificEnthalpy hs2(start=100000)
+  Modelica.Units.SI.SpecificEnthalpy hs2(start=100000)
     "Fluid specific enthalpy at outlet #2";
-  Modelica.SIunits.SpecificEnthalpy hs3(start=100000)
+  Modelica.Units.SI.SpecificEnthalpy hs3(start=100000)
     "Fluid specific enthalpy at outlet #3";
 
   Connectors.FlueGasesInlet Ce
@@ -192,8 +192,7 @@
   hs1 = ThermoSysPro.Properties.FlueGases.FlueGases_h(P, Cs1.T, Cs1.Xco2, Cs1.Xh2o, Cs1.Xo2, Cs1.Xso2);
   hs2 = ThermoSysPro.Properties.FlueGases.FlueGases_h(P, Cs2.T, Cs2.Xco2, Cs2.Xh2o, Cs2.Xo2, Cs2.Xso2);
   hs3 = ThermoSysPro.Properties.FlueGases.FlueGases_h(P, Cs3.T, Cs3.Xco2, Cs3.Xh2o, Cs3.Xo2, Cs3.Xso2);
-
-  //T = ThermoSysPro.Properties.FlueGases.FlueGases_T(P, h, Xco2, Xh2o, Xo2, Xso2);
+//T = ThermoSysPro.Properties.FlueGases.FlueGases_T(P, h, Xco2, Xh2o, Xo2, Xso2);
   h = ThermoSysPro.Properties.FlueGases.FlueGases_h(P, T, Xco2, Xh2o, Xo2, Xso2);
 
   cp = ThermoSysPro.Properties.FlueGases.FlueGases_cp(P, T, Xco2, Xh2o, Xo2, Xso2);
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Functions/SplineInterpolation.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Functions/SplineInterpolation.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Functions/SplineInterpolation.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Functions/SplineInterpolation.mo"	2022-03-10 09:58:47.780152966 +0000
@@ -2,7 +2,7 @@
 function SplineInterpolation "Spline interpolation"
   input Real TabX[:] "References table";
   input Real TabY[:] "Results table";
-  input Real X "Reference value"; // index in table
+  input Real X "Reference value";   // index in table
   input Real t(max = 1) = 0.5 "Stiffness parameter";
   output Real Y "Interpolated result";
 
@@ -28,67 +28,59 @@
     assert(false, "Only one data point in table");
   end if;
 
-  IndXcal := false;
-
-  // Find index in table:
-  if (X > TabX[1]) then
-    for i in 2:dimX loop
-      if ((X <= TabX[i]) and (not IndXcal)) then // IndX => x2
-        IndX := i;
-        IndXcal := true;
-      end if;
-    end for;
-  end if;
-
-  // If index is outside of table => Linear extrapolation
-  if (not IndXcal) then
-    if (X <= 2) then
-      IndX := 2;
-    else
-      IndX := dimX;
-    end if;
-  end if;
-
-  // Relevant data points:
+  IndXcal := false;
+// Find index in table:
+  if X > TabX[1] then
+    for i in 2:dimX loop
+      if X <= TabX[i] and not IndXcal then
+        IndX := i;
+        IndXcal := true;
+      end if;
+    end for;
+  end if;
+// IndX => x2
+// If index is outside of table => Linear extrapolation
+  if not IndXcal then
+    if X <= 2 then
+      IndX := 2;
+    else
+      IndX := dimX;
+    end if;
+  end if;
+// Relevant data points:
   y1 := TabY[IndX - 1];
   y2 := TabY[IndX];
   x1 := TabX[IndX - 1];
   x2 := TabX[IndX];
-  y2d := (y2-y1)/(x2-x1); // Approximating derivative
-
-  // Use spline interpolation if X i contained in the table interval,
-  //  If NOT contained: Use linear extrapolation.
-  if (not IndXcal) then
-    // Linear Extrapolation
-    if (IndX == dimX) then
-      Y := y2d*(X - x2) + y2;
-    else
-      Y := y2d*(X-x1)+y1;
-    end if;
-  else
-    // Spline interpolation:
-    if (IndX == 2) then
-      y1d := y2d; // Approximating derivative
-    else
-      // In table (genral case)
-      y0 := TabY[IndX - 2];
-      x0 := TabX[IndX - 2];
-      y1d := (1 - t)*0.5*(y2d + (y1 - y0)/(x1 - x0)); // Approximating derivative
-      if (IndX < dimX) then
-        y2d := (1 - t)*0.5*(y2d + (TabY[IndX + 1] - y2)/(TabX[IndX + 1] - x2));
-      end if;
-    end if;
-
-    // Compute Y using CubicHermite, spline interpolation
-    Y := ThermoSysPro.Functions.Utilities.CubicHermite(
-      x=X,
-      x1=x1,
-      x2=x2,
-      y1=y1,
-      y2=y2,
-      y1d=y1d,
-      y2d=y2d);
+  y2d := (y2-y1)/(x2-x1);
+// Approximating derivative
+// Use spline interpolation if X i contained in the table interval,
+//  If NOT contained: Use linear extrapolation.
+  if not IndXcal then
+    if IndX == dimX then
+      Y := y2d * (X - x2) + y2;
+    else
+      Y := y2d * (X - x1) + y1;
+    end if;
+  else
+    if IndX == 2 then
+      y1d := y2d;
+    else
+      y0 := TabY[IndX - 2];
+      x0 := TabX[IndX - 2];
+      y1d := (1 - t) * 0.5 * (y2d + (y1 - y0) / (x1 - x0));
+      if IndX < dimX then
+        y2d := (1 - t) * 0.5 * (y2d + (TabY[IndX + 1] - y2) / (TabX[IndX + 1] - x2));
+      end if;
+    end if;
+    Y := ThermoSysPro.Functions.Utilities.CubicHermite(x = X, x1 = x1, x2 = x2, y1 = y1, y2 = y2, y1d = y1d, y2d = y2d);
   end if;
+// Linear Extrapolation
+// Spline interpolation:
+// Approximating derivative
+// In table (genral case)
+// Approximating derivative
+// Compute Y using CubicHermite, spline interpolation
   annotation (
     smoothOrder=1,
      Icon(graphics),       Documentation(info="<html>
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Functions/TableSplineInterpolation.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Functions/TableSplineInterpolation.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Functions/TableSplineInterpolation.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Functions/TableSplineInterpolation.mo"	2022-03-10 09:58:47.764152963 +0000
@@ -32,43 +32,27 @@
       IndP := i;
       IndPcal := true;
     end if;
-  end for;
-
-   // If P is not contained in the table:
-  if (not IndPcal) then
-    IndP := dimP;
-    if integer(P)<=2 then
-      IndP :=2;
-    end if;
-  end if;
-
-  // Find corresponding table for IndP (p1, p2)
-  Y1 := ThermoSysPro.Functions.SplineInterpolation(
-    TabX=TabX,
-    TabY=TabY[IndP - 1, :],
-    X=X, t= t);
+  end for;
+// If P is not contained in the table:
+  if not IndPcal then
+    IndP := dimP;
+    if integer(P) <= 2 then
+      IndP := 2;
+    end if;
+  end if;
+// Find corresponding table for IndP (p1, p2)
+  Y1 := ThermoSysPro.Functions.SplineInterpolation(TabX = TabX, TabY = TabY[IndP - 1, :], X = X, t = t);
   Y2 := ThermoSysPro.Functions.SplineInterpolation(
     TabX=TabX,
     TabY=TabY[IndP, :],
-    X=X, t = t);
-
- // If possible to use three points (p0,p1,p2):
- if ((IndP > 2) and IndPcal) then
-    Y0 := ThermoSysPro.Functions.SplineInterpolation(
-      TabX=TabX,
-      TabY=TabY[IndP - 2, :],
-      X=X, t= t);
-    Y := ThermoSysPro.Functions.SplineInterpolation(
-      TabX=TabP[IndP - 2:IndP],
-      TabY={Y0,Y1,Y2},
-      X=P, t= t);
- else
-    Y := ThermoSysPro.Functions.SplineInterpolation(
-      TabX=TabP[IndP - 1:IndP],
-      TabY={Y1,Y2},
-      X=P, t= t);
- end if;
-
+    X=X, t = t);
+// If possible to use three points (p0,p1,p2):
+  if IndP > 2 and IndPcal then
+    Y0 := ThermoSysPro.Functions.SplineInterpolation(TabX = TabX, TabY = TabY[IndP - 2, :], X = X, t = t);
+    Y := ThermoSysPro.Functions.SplineInterpolation(TabX = TabP[IndP - 2:IndP], TabY = {Y0, Y1, Y2}, X = P, t = t);
+  else
+    Y := ThermoSysPro.Functions.SplineInterpolation(TabX = TabP[IndP - 1:IndP], TabY = {Y1, Y2}, X = P, t = t);
+  end if;
   annotation (
     smoothOrder=2,
     Icon(graphics),        Documentation(info="<html>
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Functions/Utilities/CubicHermite.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Functions/Utilities/CubicHermite.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Functions/Utilities/CubicHermite.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Functions/Utilities/CubicHermite.mo"	2022-03-10 09:58:47.732152959 +0000
@@ -1,46 +1,47 @@
-within ThermoSysPro.Functions.Utilities;
-function CubicHermite "Evaluate a cubic Hermite spline"
-  input Real x "Abscissa value";
-  input Real x1 "Lower abscissa value";
-  input Real x2 "Upper abscissa value";
-  input Real y1 "Lower ordinate value";
-  input Real y2 "Upper ordinate value";
-  input Real y1d "Lower gradient";
-  input Real y2d "Upper gradient";
-  output Real y "Interpolated ordinate value";
-protected
-  Real h "Distance between x1 and x2";
-  Real t "abscissa scaled with h, i.e., t=[0..1] within x=[x1..x2]";
-  Real h00 "Basis function 00 of cubic Hermite spline";
-  Real h10 "Basis function 10 of cubic Hermite spline";
-  Real h01 "Basis function 01 of cubic Hermite spline";
-  Real h11 "Basis function 11 of cubic Hermite spline";
-  Real aux3 "t cube";
-  Real aux2 "t square";
-algorithm
-  h := x2 - x1;
-  if abs(h)>0 then
-    // Regular case
-    t := (x - x1)/h;
-
-    aux3 :=t^3;
-    aux2 :=t^2;
-
-    h00 := 2*aux3 - 3*aux2 + 1;
-    h10 := aux3 - 2*aux2 + t;
-    h01 := -2*aux3 + 3*aux2;
-    h11 := aux3 - aux2;
-    y := y1*h00 + h*y1d*h10 + y2*h01 + h*y2d*h11;
-  else
-    // Degenerate case, x1 and x2 are identical, return step function
-    y := (y1 + y2)/2;
-  end if;
-  annotation(smoothOrder=3, Documentation(revisions="<html>
+within ThermoSysPro.Functions.Utilities;
+
+function CubicHermite "Evaluate a cubic Hermite spline"
+  input Real x "Abscissa value";
+  input Real x1 "Lower abscissa value";
+  input Real x2 "Upper abscissa value";
+  input Real y1 "Lower ordinate value";
+  input Real y2 "Upper ordinate value";
+  input Real y1d "Lower gradient";
+  input Real y2d "Upper gradient";
+  output Real y "Interpolated ordinate value";
+protected
+  Real h "Distance between x1 and x2";
+  Real t "abscissa scaled with h, i.e., t=[0..1] within x=[x1..x2]";
+  Real h00 "Basis function 00 of cubic Hermite spline";
+  Real h10 "Basis function 10 of cubic Hermite spline";
+  Real h01 "Basis function 01 of cubic Hermite spline";
+  Real h11 "Basis function 11 of cubic Hermite spline";
+  Real aux3 "t cube";
+  Real aux2 "t square";
+algorithm
+  h := x2 - x1;
+  if abs(h) > 0 then
+    t := (x - x1) / h;
+    aux3 := t ^ 3;
+    aux2 := t ^ 2;
+    h00 := 2 * aux3 - 3 * aux2 + 1;
+    h10 := aux3 - 2 * aux2 + t;
+    h01 := (-2 * aux3) + 3 * aux2;
+    h11 := aux3 - aux2;
+    y := y1 * h00 + h * y1d * h10 + y2 * h01 + h * y2d * h11;
+  else
+    y := (y1 + y2) / 2;
+  end if;
+// Regular case
+// Degenerate case, x1 and x2 are identical, return step function
+  annotation(
+    smoothOrder = 3,
+    Documentation(revisions = "<html>
 <p><u><b>Author</b></u></p>
 <ul>
 <li><i>May 2008</i> by <a href=\"mailto:Michael.Sielemann@dlr.de\">Michael Sielemann</a></li>
 </ul>
-</html>", info="<html>
+</html>", info = "<html>
 <p><b>ThermoSysPro Version 3.1</h4>
-</html>"));
-end CubicHermite;
+</html>"));
+end CubicHermite;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Functions/Utilities: CubicHermite.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Functions/Utilities: CubicHermite.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/HeatNetworksCooling/AbsorberWaterLiBr.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/HeatNetworksCooling/AbsorberWaterLiBr.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/HeatNetworksCooling/AbsorberWaterLiBr.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/HeatNetworksCooling/AbsorberWaterLiBr.mo"	2022-03-10 09:58:47.704152957 +0000
@@ -5,7 +5,7 @@
     "Pressure losses in the cold fluid a a percent of the pressure at the inlet";
 
 public
-  Modelica.SIunits.Power W(start=1e6) "Power exchanged";
+  Modelica.Units.SI.Power W(start=1e6) "Power exchanged";
   Real DPc(start=10)
     "Pressure losses in the hot fluid a a percent of the pressure at the inlet";
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/HeatNetworksCooling/AbsorptionRefrigeratorSystem.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/HeatNetworksCooling/AbsorptionRefrigeratorSystem.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/HeatNetworksCooling/AbsorptionRefrigeratorSystem.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/HeatNetworksCooling/AbsorptionRefrigeratorSystem.mo"	2022-03-10 09:58:47.688152954 +0000
@@ -5,8 +5,8 @@
   parameter Real Pth=0.33 "Desorber thermal losses (0-1 %W)";
   parameter Real ExchEff=0.99 "Exchanger water LiBr efficiency";
   parameter Real EvapEff=0.99 "Evaporator efficiency";
-  parameter Modelica.SIunits.MassFlowRate Qsol=8.856 "Solution mass flow rate";
-  parameter Modelica.SIunits.MassFlowRate Qnom=8.856
+  parameter Modelica.Units.SI.MassFlowRate Qsol=8.856 "Solution mass flow rate";
+  parameter Modelica.Units.SI.MassFlowRate Qnom=8.856
     "Pump solution nominal mass flow rate";
   parameter ThermoSysPro.Units.DifferentialPressure DPnom=3386.05
     "Pump solution nominal delta pressure";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/HeatNetworksCooling/DesorberWaterLiBr.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/HeatNetworksCooling/DesorberWaterLiBr.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/HeatNetworksCooling/DesorberWaterLiBr.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/HeatNetworksCooling/DesorberWaterLiBr.mo"	2022-03-10 09:58:47.656152950 +0000
@@ -6,23 +6,23 @@
   parameter Real Pth=0.15 "Thermal losses fraction (=losses/W)";
 
 public
-  Modelica.SIunits.Power W(start=1e6) "Power exchnaged with the solution";
-  Modelica.SIunits.Power Wpth(start=1e6) "Thermal losses power";
-  Modelica.SIunits.Power Wtot(start=1e6) "Hot water total power";
-  Modelica.SIunits.Power Wmaxf(start=1e6)
+  Modelica.Units.SI.Power W(start=1e6) "Power exchnaged with the solution";
+  Modelica.Units.SI.Power Wpth(start=1e6) "Thermal losses power";
+  Modelica.Units.SI.Power Wtot(start=1e6) "Hot water total power";
+  Modelica.Units.SI.Power Wmaxf(start=1e6)
     "Maximum power acceptable by the solution";
-  Modelica.SIunits.Power Wmaxc(start=1e6)
+  Modelica.Units.SI.Power Wmaxc(start=1e6)
     "Maximum power releasable by the hot water";
-  Modelica.SIunits.Temperature Tsatc(start=400)
+  Modelica.Units.SI.Temperature Tsatc(start=400)
     "Hot water saturation temperature at the outlet";
-  Modelica.SIunits.SpecificEnthalpy Hminc(start=1e5)
+  Modelica.Units.SI.SpecificEnthalpy Hminc(start=1e5)
     "Minimum specific enthalpy reachable by the hot water";
   Real Xmin "Minimum mass fraction reachable by the solution";
-  Modelica.SIunits.MassFlowRate Qs_min(start=100)
+  Modelica.Units.SI.MassFlowRate Qs_min(start=100)
     "Minimum solution mass flow rate at the outlet";
-  Modelica.SIunits.MassFlowRate Qv_max(start=100)
+  Modelica.Units.SI.MassFlowRate Qv_max(start=100)
     "Maximum steam mass flow rate at the outlet";
-  Modelica.SIunits.Power Wmax(start=1e6) "Maximum power exchangeable";
+  Modelica.Units.SI.Power Wmax(start=1e6) "Maximum power exchangeable";
   ThermoSysPro.Units.DifferentialTemperature DTm(start=40)
     "Differences of the average temperatures between the hot and cold sides";
 
@@ -50,9 +50,7 @@
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph provap
     annotation (Placement(transformation(extent={{80,80},{100,100}}, rotation=0)));
 equation
-
-  // Hypothesis : counter-current exchange
-
+// Hypothesis : counter-current exchange
   Sc.Q = Ec.Q;
   Ef.P = Sf.P;
   Svap.P = Sf.P;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/HeatNetworksCooling/HeatNetworkPipe.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/HeatNetworksCooling/HeatNetworkPipe.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/HeatNetworksCooling/HeatNetworkPipe.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/HeatNetworksCooling/HeatNetworkPipe.mo"	2022-03-10 09:58:47.632152946 +0000
@@ -1,47 +1,47 @@
 within ThermoSysPro.HeatNetworksCooling;
 model HeatNetworkPipe
   "Static pipe with thermal losses and singular pressure losses"
-  parameter Modelica.SIunits.Length L=10 "Pipe length";
-  parameter Modelica.SIunits.Diameter D=0.2 "Pipe internal diameter";
-  parameter Modelica.SIunits.Length e=0.05 "Wall thickness";
+  parameter Modelica.Units.SI.Length L=10 "Pipe length";
+  parameter Modelica.Units.SI.Diameter D=0.2 "Pipe internal diameter";
+  parameter Modelica.Units.SI.Length e=0.05 "Wall thickness";
   parameter Real rugosrel=0 "Pipe roughness";
-  parameter Modelica.SIunits.Length z1=0 "Pipe altitude at the inlet";
-  parameter Modelica.SIunits.Length z2=0 "Pipe altitude at the outlet";
-  parameter Modelica.SIunits.Temperature Tamb=293 "Ambient temperature";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer K=0.1
+  parameter Modelica.Units.SI.Length z1=0 "Pipe altitude at the inlet";
+  parameter Modelica.Units.SI.Length z2=0 "Pipe altitude at the outlet";
+  parameter Modelica.Units.SI.Temperature Tamb=293 "Ambient temperature";
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer K=0.1
     "Heat exchange coefficient with ambient";
   parameter ThermoSysPro.Units.PressureLossCoefficient Ks=
                                                          1000
     "Singular pressure losses coefficient";
   parameter Boolean continuous_flow_reversal=false
     "true: continuous flow reversal - false: discontinuous flow reversal";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 protected
-  constant Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  constant Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
   constant Real pi=Modelica.Constants.pi "pi";
   parameter Real eps=1.e-0 "Small number for pressure loss equation";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow for continuous flow reversal";
 
 public
-  Modelica.SIunits.Power Wloss "Thermal losses at ambient conditions";
+  Modelica.Units.SI.Power Wloss "Thermal losses at ambient conditions";
   Real khi "Hydraulic pressure loss coefficient";
   ThermoSysPro.Units.DifferentialPressure deltaPr "Regular pressure losses";
   ThermoSysPro.Units.DifferentialPressure deltaP "Total pressure losses";
   ThermoSysPro.Units.DifferentialPressure deltaPs "Singular pressure losses";
-  Modelica.SIunits.MassFlowRate Q "Mass flow rate";
-  Modelica.SIunits.ReynoldsNumber Re "Reynolds number";
-  Modelica.SIunits.ReynoldsNumber Relim "Limit Reynolds number";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow rate";
+  Modelica.Units.SI.ReynoldsNumber Re "Reynolds number";
+  Modelica.Units.SI.ReynoldsNumber Relim "Limit Reynolds number";
   Real lambda "Friction pressure loss coefficient";
-  Modelica.SIunits.Density rho "Fluid density";
-  Modelica.SIunits.DynamicViscosity mu "Fluid dynamic viscosity";
-  Modelica.SIunits.Temperature T "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure Pm "Fluid average pressure";
-  Modelica.SIunits.SpecificEnthalpy hm "Fluid average specific enthalpy";
+  Modelica.Units.SI.Density rho "Fluid density";
+  Modelica.Units.SI.DynamicViscosity mu "Fluid dynamic viscosity";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure Pm "Fluid average pressure";
+  Modelica.Units.SI.SpecificEnthalpy hm "Fluid average specific enthalpy";
 public
   ThermoSysPro.WaterSteam.Connectors.FluidInlet C1
                           annotation (Placement(transformation(extent={{-90,80},
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/HeatNetworksCooling/LatentHeatStorage.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/HeatNetworksCooling/LatentHeatStorage.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/HeatNetworksCooling/LatentHeatStorage.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/HeatNetworksCooling/LatentHeatStorage.mo"	2022-03-10 09:58:47.616152946 +0000
@@ -1,30 +1,30 @@
-﻿within ThermoSysPro.HeatNetworksCooling;
+within ThermoSysPro.HeatNetworksCooling;
 model LatentHeatStorage "Latent heat storage"
-  parameter Modelica.SIunits.Area S=1 "Exchange surface";
-  parameter Modelica.SIunits.Area Samb=1
+  parameter Modelica.Units.SI.Area S=1 "Exchange surface";
+  parameter Modelica.Units.SI.Area Samb=1
     "Exchange surface with the ambient air";
-  parameter Modelica.SIunits.Volume V=1 "Storage volume";
-  parameter Modelica.SIunits.SpecificHeatCapacity CpL=4.18
+  parameter Modelica.Units.SI.Volume V=1 "Storage volume";
+  parameter Modelica.Units.SI.SpecificHeatCapacity CpL=4.18
     "Fluid specific heat capacity";
-  parameter Modelica.SIunits.SpecificHeatCapacity CpS=4.18
+  parameter Modelica.Units.SI.SpecificHeatCapacity CpS=4.18
     "Storage specific heat capacity";
-  parameter Modelica.SIunits.ThermalConductivity Lambda=0.585
+  parameter Modelica.Units.SI.ThermalConductivity Lambda=0.585
     "PCM (phase change material) thermal conductivity";
-  parameter Modelica.SIunits.ThermalConductivity LambdaC=0.585
+  parameter Modelica.Units.SI.ThermalConductivity LambdaC=0.585
     "Insulation thermal conductivity";
-  parameter Modelica.SIunits.Length ep=0.1 "PCM thickness";
-  parameter Modelica.SIunits.Length epC=0.1 "Insulation thickness";
-  parameter Modelica.SIunits.Density rhom=1000 "PCM density";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer h=20
+  parameter Modelica.Units.SI.Length ep=0.1 "PCM thickness";
+  parameter Modelica.Units.SI.Length epC=0.1 "Insulation thickness";
+  parameter Modelica.Units.SI.Density rhom=1000 "PCM density";
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer h=20
     "Convective heat exchange coefficient with the water";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer ha=20
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer ha=20
     "Convective heat exchange coefficient with the ambient air";
-  parameter Modelica.SIunits.Temperature Tamb "Ambient air temperature";
-  parameter Modelica.SIunits.Temperature Tsl0
+  parameter Modelica.Units.SI.Temperature Tamb "Ambient air temperature";
+  parameter Modelica.Units.SI.Temperature Tsl0
     "Initial storage temperature (active if steady_state=false)";
   parameter Real xL0=0.5 "Initial liquid PCM fraction";
-  parameter Modelica.SIunits.Temperature Tfusion=293 "PCM fusion temperature";
-  parameter Modelica.SIunits.SpecificEnergy hfus "PCM fusion specific enthalpy";
+  parameter Modelica.Units.SI.Temperature Tfusion=293 "PCM fusion temperature";
+  parameter Modelica.Units.SI.SpecificEnergy hfus "PCM fusion specific enthalpy";
   parameter Real Fremp=0.5 "Volume fraction of the storage filled by the PCM";
   parameter Boolean steady_state=false
     "true: start from steady state - false: start from Tsl0";
@@ -35,27 +35,27 @@
 
 protected
   constant Real pi=Modelica.Constants.pi "pi";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow for continuous flow reversal";
 
 public
-  Modelica.SIunits.MassFlowRate Q "Water mass flow rate";
-  Modelica.SIunits.Mass m "PCM mass";
-  Modelica.SIunits.Temperature Tsl "Storage average temperature";
+  Modelica.Units.SI.MassFlowRate Q "Water mass flow rate";
+  Modelica.Units.SI.Mass m "PCM mass";
+  Modelica.Units.SI.Temperature Tsl "Storage average temperature";
   Real xL "Liquid PCM fraction in the storage";
-  Modelica.SIunits.Temperature T1 "Water temperature at the inlet";
-  Modelica.SIunits.Temperature T2 "Water temperature at the outlet";
-  Modelica.SIunits.Power Ws "Stored power";
-  Modelica.SIunits.Power We "Power exchanged with the water";
-  Modelica.SIunits.Power Wa "Power exchanged with the ambient air";
-  Modelica.SIunits.SpecificEnthalpy Hsl "Storage specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy HsatL
+  Modelica.Units.SI.Temperature T1 "Water temperature at the inlet";
+  Modelica.Units.SI.Temperature T2 "Water temperature at the outlet";
+  Modelica.Units.SI.Power Ws "Stored power";
+  Modelica.Units.SI.Power We "Power exchanged with the water";
+  Modelica.Units.SI.Power Wa "Power exchanged with the ambient air";
+  Modelica.Units.SI.SpecificEnthalpy Hsl "Storage specific enthalpy";
+  Modelica.Units.SI.SpecificEnthalpy HsatL
     "Storage specific enthalpy at the liquid saturation temperature";
-  Modelica.SIunits.SpecificEnthalpy HsatS
+  Modelica.Units.SI.SpecificEnthalpy HsatS
     "Storage specific enthalpy at the solid saturation temperature";
-  Modelica.SIunits.Temperature Tm(start=293) "Water average temperature";
-  Modelica.SIunits.AbsolutePressure Pm(start=1.e5) "Water average pressure";
-  Modelica.SIunits.SpecificEnthalpy hm(start=100000)
+  Modelica.Units.SI.Temperature Tm(start=293) "Water average temperature";
+  Modelica.Units.SI.AbsolutePressure Pm(start=1.e5) "Water average pressure";
+  Modelica.Units.SI.SpecificEnthalpy hm(start=100000)
     "Water average specific enthalpy";
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proe
     "Propriétés de l'eau"
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/HeatNetworksCooling/SensibleHeatStorage.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/HeatNetworksCooling/SensibleHeatStorage.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/HeatNetworksCooling/SensibleHeatStorage.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/HeatNetworksCooling/SensibleHeatStorage.mo"	2022-03-10 09:58:47.572152940 +0000
@@ -1,24 +1,24 @@
-﻿within ThermoSysPro.HeatNetworksCooling;
+within ThermoSysPro.HeatNetworksCooling;
 model SensibleHeatStorage "Sensible heat storage"
-  parameter Modelica.SIunits.Area S=1
+  parameter Modelica.Units.SI.Area S=1
     "Exchange surface between the water and the surface";
-  parameter Modelica.SIunits.Area Samb=1 "Echange surface with the ambient air";
-  parameter Modelica.SIunits.Volume V=1 "Storage volume";
-  parameter Modelica.SIunits.SpecificHeatCapacity Cp=4000
+  parameter Modelica.Units.SI.Area Samb=1 "Echange surface with the ambient air";
+  parameter Modelica.Units.SI.Volume V=1 "Storage volume";
+  parameter Modelica.Units.SI.SpecificHeatCapacity Cp=4000
     "PCM specific heat capacity";
-  parameter Modelica.SIunits.ThermalConductivity Lambda=20
+  parameter Modelica.Units.SI.ThermalConductivity Lambda=20
     "PCM thermal conductivity";
-  parameter Modelica.SIunits.ThermalConductivity LambdaC=0.04
+  parameter Modelica.Units.SI.ThermalConductivity LambdaC=0.04
     "Insulation thermal conductivity";
-  parameter Modelica.SIunits.Length ep=0.1 "PCM thickness";
-  parameter Modelica.SIunits.Length epC=0.1 "Insulation thickness";
-  parameter Modelica.SIunits.Density rhom=2000 "PCM density";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer h=20
+  parameter Modelica.Units.SI.Length ep=0.1 "PCM thickness";
+  parameter Modelica.Units.SI.Length epC=0.1 "Insulation thickness";
+  parameter Modelica.Units.SI.Density rhom=2000 "PCM density";
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer h=20
     "Convective heat exchange coefficient with the water";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer ha=20
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer ha=20
     "Convective heat exchange coefficient with the ambient air";
-  parameter Modelica.SIunits.Temperature Tamb "Ambient air temperature";
-  parameter Modelica.SIunits.Temperature Tss0
+  parameter Modelica.Units.SI.Temperature Tamb "Ambient air temperature";
+  parameter Modelica.Units.SI.Temperature Tss0
     "Initial storage temperature (active if steady_state=false)";
   parameter Real Fremp=0.5 "Volume fraction of the solid matrix in the storage";
   parameter Boolean steady_state=false
@@ -29,17 +29,17 @@
     "IF97 region at the outlet. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 public
-  Modelica.SIunits.MassFlowRate Q "Water mass flow rate";
-  Modelica.SIunits.Mass m "PCM mass";
-  Modelica.SIunits.Temperature Tss(start=293) "Storage average temperature";
-  Modelica.SIunits.Temperature T1 "Water temperature at the inlet";
-  Modelica.SIunits.Temperature T2 "Water temperature at the outlet";
-  Modelica.SIunits.Power Ws "Stored power";
-  Modelica.SIunits.Power We "Power exchanged with the water";
-  Modelica.SIunits.Power Wa "Power exchanged with the ambient air";
-  Modelica.SIunits.Temperature Tm(start=293) "Average temperature";
-  Modelica.SIunits.AbsolutePressure Pm(start=1.e5) "Average pressure";
-  Modelica.SIunits.SpecificEnthalpy hm(start=100000)
+  Modelica.Units.SI.MassFlowRate Q "Water mass flow rate";
+  Modelica.Units.SI.Mass m "PCM mass";
+  Modelica.Units.SI.Temperature Tss(start=293) "Storage average temperature";
+  Modelica.Units.SI.Temperature T1 "Water temperature at the inlet";
+  Modelica.Units.SI.Temperature T2 "Water temperature at the outlet";
+  Modelica.Units.SI.Power Ws "Stored power";
+  Modelica.Units.SI.Power We "Power exchanged with the water";
+  Modelica.Units.SI.Power Wa "Power exchanged with the ambient air";
+  Modelica.Units.SI.Temperature Tm(start=293) "Average temperature";
+  Modelica.Units.SI.AbsolutePressure Pm(start=1.e5) "Average pressure";
+  Modelica.Units.SI.SpecificEnthalpy hm(start=100000)
     "Average specific enthalpy";
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proe
     "Propriétés de l'eau"
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Continu/FctTrans.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Continu/FctTrans.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Continu/FctTrans.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Continu/FctTrans.mo"	2022-03-10 09:58:47.444152922 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Continu;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Continu;
 block FctTrans
   parameter Real b[:]={1}
     "Coefficients numérateurs de la fonction de transfert (par puissances décroissantes)";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Continu/Integrateur.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Continu/Integrateur.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Continu/Integrateur.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Continu/Integrateur.mo"	2022-03-10 09:58:47.436152922 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Continu;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Continu;
 block Integrateur
   parameter Real k=1 "Gain";
   parameter Real ureset0=0
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Continu/IntegrateurSat.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Continu/IntegrateurSat.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Continu/IntegrateurSat.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Continu/IntegrateurSat.mo"	2022-03-10 09:58:47.432152922 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Continu;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Continu;
 block IntegrateurSat
   parameter Real k=1 "Gain";
   parameter Real maxval=1 "Valeur maximale de la sortie";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Continu/PI.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Continu/PI.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Continu/PI.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Continu/PI.mo"	2022-03-10 09:58:47.424152920 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Continu;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Continu;
 block PI
   parameter Real k=1 "Gain";
   parameter Real Ti=1 "Constante de temps (s)";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Continu/PIsat.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Continu/PIsat.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Continu/PIsat.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Continu/PIsat.mo"	2022-03-10 09:58:47.412152918 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Continu;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Continu;
 block PIsat
   parameter Real k=1 "Gain";
   parameter Real Ti=1 "Constante de temps (s)";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Continu/PT1.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Continu/PT1.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Continu/PT1.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Continu/PT1.mo"	2022-03-10 09:58:47.400152917 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Continu;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Continu;
 block PT1
   parameter Real k=1 "Gain";
   parameter Real Ti=1 "Constante de temps (s)";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Continu/PT2.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Continu/PT2.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Continu/PT2.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Continu/PT2.mo"	2022-03-10 09:58:47.392152916 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Continu;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Continu;
 block PT2
   parameter Real k=1 "Gain";
   parameter Real w=1 "Fréquence angulaire";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/ConvAD.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/ConvAD.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/ConvAD.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/ConvAD.mo"	2022-03-10 09:58:47.372152914 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Discret;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Discret;
 block ConvAD
   parameter Real maxval=1 "Valeur maximale en entrée";
   parameter Real minval=-maxval "Valeur minimale en entrée";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/ConvDA.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/ConvDA.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/ConvDA.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/ConvDA.mo"	2022-03-10 09:58:47.364152914 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Discret;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Discret;
 block ConvDA
   parameter Real maxval=1 "Valeur maximale en entrée";
   parameter Real minval=-maxval "Valeur minimale en entrée";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/Echant.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/Echant.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/Echant.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/Echant.mo"	2022-03-10 09:58:47.340152910 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Discret;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Discret;
 block Echant
   parameter Real Gain=1 "Gain";
   parameter Real SampleOffset=0 "Instant de départ de l'échantillonnage (s)";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/FctTrans.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/FctTrans.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/FctTrans.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/FctTrans.mo"	2022-03-10 09:58:47.332152910 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Discret;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Discret;
 block FctTrans
   parameter Real b[:]={1}
     "Coefficients numérateurs de la fonction de transfert";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/PI.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/PI.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/PI.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/PI.mo"	2022-03-10 09:58:47.324152907 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Discret;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Discret;
 block PI
   parameter Real k=1 "Gain";
   parameter Real Ti=1 "Constante de temps";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/PIsat.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/PIsat.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/PIsat.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/PIsat.mo"	2022-03-10 09:58:47.316152906 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Discret;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Discret;
 block PIsat
   parameter Real Kp=1 "Gain";
   parameter Real Ti=1 "Constante de temps";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/PT1.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/PT1.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/PT1.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/PT1.mo"	2022-03-10 09:58:47.308152906 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Discret;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Discret;
 block PT1
   parameter Real k=1 "Gain";
   parameter Real Ti=1 "Constante de temps (s)";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/Pre.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/Pre.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/Pre.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Discret/Pre.mo"	2022-03-10 09:58:47.300152906 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Discret;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Discret;
 block Pre
   parameter Real Gain=1 "Gain";
   parameter Real initialCond=0 "Condition initiale";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Logique/Pulse.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Logique/Pulse.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Logique/Pulse.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Logique/Pulse.mo"	2022-03-10 09:58:47.220152894 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Logique;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Logique;
 block Pulse
   parameter Real width=0.5 "Largeur des impulsions (s)";
   parameter Real period=1 "Periode des impulsions (s)";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Logique/SampleTrigger.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Logique/SampleTrigger.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Logique/SampleTrigger.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Logique/SampleTrigger.mo"	2022-03-10 09:58:47.208152893 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Logique;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Logique;
 block SampleTrigger
   parameter Real period=1 "Periode des impulsions (s)";
   parameter Real startTime=0 "Instant de départ des impulsions";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/EgEntier.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/EgEntier.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/EgEntier.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/EgEntier.mo"	2022-03-10 09:58:47.088152878 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Math;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Math;
 block EgEntier
   parameter Integer C1=1 "Valeur de u1 si u1 non connecté";
   parameter Integer C2=2 "Valeur de u2 si u2 non connecté";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/Feedback.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/Feedback.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/Feedback.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/Feedback.mo"	2022-03-10 09:58:47.072152877 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Math;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Math;
 block Feedback "Différence entre la commande et le feedback"
 
   ThermoSysPro.InstrumentationAndControl.Connectors.InputReal u2
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/Inf.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/Inf.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/Inf.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/Inf.mo"	2022-03-10 09:58:47.060152875 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Math;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Math;
 block Inf
   parameter Real C1=0 "Valeur de u1 si u1 non connecté";
   parameter Real C2=0 "Valeur de u2 si u2 non connecté";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/InfEntier.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/InfEntier.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/InfEntier.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/InfEntier.mo"	2022-03-10 09:58:47.044152872 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Math;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Math;
 block InfEntier
   parameter Integer C1=0 "Valeur de u1 si u1 non connecté";
   parameter Integer C2=0 "Valeur de u2 si u2 non connecté";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/Infeg.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/Infeg.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/Infeg.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/Infeg.mo"	2022-03-10 09:58:47.028152871 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Math;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Math;
 block Infeg
   parameter Real C1=0 "Valeur de u1 si u1 non connecté";
   parameter Real C2=0 "Valeur de u2 si u2 non connecté";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/InfegEntier.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/InfegEntier.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/InfegEntier.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/InfegEntier.mo"	2022-03-10 09:58:47.020152869 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Math;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Math;
 block InfegEntier
   parameter Integer C1=0 "Valeur de u1 si u1 non connecté";
   parameter Integer C2=0 "Valeur de u2 si u2 non connecté";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/Sup.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/Sup.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/Sup.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/Sup.mo"	2022-03-10 09:58:46.900152854 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Math;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Math;
 block Sup
   parameter Real C1=0 "Valeur de u1 si u1 non connecté";
   parameter Real C2=0 "Valeur de u2 si u2 non connecté";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/SupEntier.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/SupEntier.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/SupEntier.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/SupEntier.mo"	2022-03-10 09:58:46.892152853 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Math;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Math;
 block SupEntier
   parameter Integer C1=0 "Valeur de u1 si u1 non connecté";
   parameter Integer C2=0 "Valeur de u2 si u2 non connecté";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/Supeg.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/Supeg.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/Supeg.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/Supeg.mo"	2022-03-10 09:58:46.884152853 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Math;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Math;
 block Supeg
   parameter Real C1=0 "Valeur de u1 si u1 non connecté";
   parameter Real C2=0 "Valeur de u2 si u2 non connecté";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/SupegEntier.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/SupegEntier.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/SupegEntier.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/SupegEntier.mo"	2022-03-10 09:58:46.876152852 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Math;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Math;
 block SupegEntier
   parameter Integer C1=0 "Valeur de u1 si u1 non connecté";
   parameter Integer C2=0 "Valeur de u2 si u2 non connecté";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/package.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/package.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/package.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Math/package.mo"	2022-03-10 09:58:47.160152888 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks;
+within ThermoSysPro.InstrumentationAndControl.Blocks;
 package Math "Bibliothèque de blocs mathématiques"
 
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/BandeMorte.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/BandeMorte.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/BandeMorte.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/BandeMorte.mo"	2022-03-10 09:58:46.848152847 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.NonLineaire;
+within ThermoSysPro.InstrumentationAndControl.Blocks.NonLineaire;
 block BandeMorte
   parameter Real uMax=1 "Limite supérieure de la bande morte";
   parameter Real uMin=-uMax "Limite inférieure de la bande morte";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/Limiteur.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/Limiteur.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/Limiteur.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/Limiteur.mo"	2022-03-10 09:58:46.840152846 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.NonLineaire;
+within ThermoSysPro.InstrumentationAndControl.Blocks.NonLineaire;
 block Limiteur
   parameter Real maxval=1 "Valeur maximale de la sortie";
   parameter Real minval=-1 "Valeur minimale de la sortie";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/LimiteurVar.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/LimiteurVar.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/LimiteurVar.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/LimiteurVar.mo"	2022-03-10 09:58:46.832152846 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.NonLineaire;
+within ThermoSysPro.InstrumentationAndControl.Blocks.NonLineaire;
 block LimiteurVar
   parameter Real maxval=1
     "Valeur maximale de la sortie si limit1 n'est pas connecté";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/LimiteurVitesse.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/LimiteurVitesse.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/LimiteurVitesse.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/LimiteurVitesse.mo"	2022-03-10 09:58:46.816152843 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.NonLineaire;
+within ThermoSysPro.InstrumentationAndControl.Blocks.NonLineaire;
 block LimiteurVitesse
   parameter Real dmax=1 "Valeur maximale de la dérivée de la sortie";
   parameter Real dmin=-1 "Valeur minimale de la dérivée de la sortie";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/RetardFixe.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/RetardFixe.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/RetardFixe.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/RetardFixe.mo"	2022-03-10 09:58:46.808152843 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.NonLineaire;
+within ThermoSysPro.InstrumentationAndControl.Blocks.NonLineaire;
 block RetardFixe
   parameter Real retard=1 "Retard de la sortie sur l'entrée (s)";
   ThermoSysPro.InstrumentationAndControl.Connectors.InputReal u
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/Selecteur.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/Selecteur.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/Selecteur.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/Selecteur.mo"	2022-03-10 09:58:46.780152838 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.NonLineaire;
+within ThermoSysPro.InstrumentationAndControl.Blocks.NonLineaire;
 block Selecteur
   parameter Real C1=-1 "Valeur de la sortie pour uCond=true si u1 non connecté";
   parameter Real C2=+1
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/SelecteurEntier.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/SelecteurEntier.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/SelecteurEntier.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/SelecteurEntier.mo"	2022-03-10 09:58:46.764152837 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.NonLineaire;
+within ThermoSysPro.InstrumentationAndControl.Blocks.NonLineaire;
 block SelecteurEntier "Sélection entre deux entiers"
   parameter Integer C1=-1
     "Valeur de la sortie pour uCond=true si u1 non connecté";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/Switch.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/Switch.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/Switch.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/Switch.mo"	2022-03-10 09:58:46.752152835 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.NonLineaire;
+within ThermoSysPro.InstrumentationAndControl.Blocks.NonLineaire;
 block Switch
   parameter Real C1=1 "Valeur de la sortie pour sel=1 si u1 non connecté";
   parameter Real C2=1 "Valeur de la sortie pour sel=2 si u2 non connecté";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/package.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/package.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/package.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/NonLineaire/package.mo"	2022-03-10 09:58:46.860152849 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks;
+within ThermoSysPro.InstrumentationAndControl.Blocks;
 package NonLineaire "Bibliothèque des blocs non-linéaires"
 
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Echelon.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Echelon.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Echelon.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Echelon.mo"	2022-03-10 09:58:46.680152827 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Sources;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Sources;
 block Echelon
   parameter Real hauteur=1 "Hauteur de l'échelon";
   parameter Real offset=0 "Décalage de la sortie";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Exp.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Exp.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Exp.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Exp.mo"	2022-03-10 09:58:46.668152825 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Sources;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Sources;
 block Exp
   parameter Real ymax=1 "Hauteur de la sortie pour riseTime infini";
   parameter Real riseTime(min=0) = 0.5 "Durée du front montant";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Horloge.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Horloge.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Horloge.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Horloge.mo"	2022-03-10 09:58:46.656152824 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Sources;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Sources;
 block Horloge
   parameter Real offset=0 "Décalage de la sortie";
   parameter Real startTime=0 "Instant de départ de l'horloge";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Pulse.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Pulse.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Pulse.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Pulse.mo"	2022-03-10 09:58:46.648152823 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Sources;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Sources;
 block Pulse
   parameter Real amplitude=1 "Amplitude des impulsions";
   parameter Real width=0.5 "Largeur des impulsions (s)";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Rampe.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Rampe.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Rampe.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Rampe.mo"	2022-03-10 09:58:46.636152821 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Sources;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Sources;
 block Rampe
   parameter Real Starttime=1 "Instant de départ de la rampe (s)";
   parameter Real Duration=2 "Durée de la rampe (s)";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Random.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Random.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Random.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Random.mo"	2022-03-10 09:58:46.624152820 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Sources;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Sources;
 block Random
   parameter Integer seed=1 "Source du générateur aléatoire";
   parameter Real SampleOffset=0 "Instant de départ de l'échantillonnage (s)";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/RandomLineaire.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/RandomLineaire.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/RandomLineaire.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/RandomLineaire.mo"	2022-03-10 09:58:46.612152818 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Sources;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Sources;
 block RandomLineaire
   parameter Integer seed=1 "Source du générateur aléatoire";
   parameter Real SampleOffset=0 "Instant de départ de l'échantillonnage";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/SinusExp.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/SinusExp.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/SinusExp.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/SinusExp.mo"	2022-03-10 09:58:46.600152816 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Sources;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Sources;
 block SinusExp
   parameter Real amplitude=1 "Amplitude du sinus";
   parameter Real frequence=2 "Fréquence du sinus (Hz)";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Sinusoide.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Sinusoide.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Sinusoide.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Sinusoide.mo"	2022-03-10 09:58:46.584152814 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Sources;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Sources;
 block Sinusoide
   parameter Real amplitude=1 "Amplitude";
   parameter Real period=1 "Periode (s)";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Trapezoide.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Trapezoide.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Trapezoide.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/Trapezoide.mo"	2022-03-10 09:58:46.572152812 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Sources;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Sources;
 block Trapezoide
   parameter Real amplitude=1 "Amplitude du trapèze";
   parameter Real rising(final min=0) = 0.5 "Durée du front montant (s)";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/package.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/package.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/package.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Sources/package.mo"	2022-03-10 09:58:46.712152831 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks;
+within ThermoSysPro.InstrumentationAndControl.Blocks;
 package Sources "Bibliothèque des blocs sources"
 
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Tables/Table1D.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Tables/Table1D.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Tables/Table1D.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Tables/Table1D.mo"	2022-03-10 09:58:46.544152809 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Tables;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Tables;
 block Table1D
   parameter Real Table[:, 2]=[0, 0; 0, 0]
     "Table (entrées = première colonne, sorties = deuxième colonne)";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Tables/Table1DTemps.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Tables/Table1DTemps.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Tables/Table1DTemps.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Tables/Table1DTemps.mo"	2022-03-10 09:58:46.536152809 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Tables;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Tables;
 block Table1DTemps
   parameter Real Table[:, 2]=[0, 0; 1, 0] "Table (temps = première colonne)";
   parameter Integer option_interpolation=1
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Tables/Table1DTempsBool.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Tables/Table1DTempsBool.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Tables/Table1DTempsBool.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Tables/Table1DTempsBool.mo"	2022-03-10 09:58:46.528152808 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Tables;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Tables;
 block Table1DTempsBool
   parameter Real Table[:, 2]=[0, 0]
     "Table (temps = première colonne, sequence strictement croissante).";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Tables/Table2D.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Tables/Table2D.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Tables/Table2D.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Blocks/Tables/Table2D.mo"	2022-03-10 09:58:46.520152806 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl.Blocks.Tables;
+within ThermoSysPro.InstrumentationAndControl.Blocks.Tables;
 block Table2D
   parameter Real Tu1[:,1]=[0; 0] "Entrées lignes de la table";
   parameter Real Tu2[1,:]=[0, 0] "Entrées colonnes de la table";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Common.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Common.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Common.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/InstrumentationAndControl/Common.mo"	2022-03-10 09:58:46.484152802 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.InstrumentationAndControl;
+within ThermoSysPro.InstrumentationAndControl;
 package Common
 
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/Boilers/BoilerSystem.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/Boilers/BoilerSystem.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/Boilers/BoilerSystem.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/Boilers/BoilerSystem.mo"	2022-03-10 09:58:46.444152796 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.MultiFluids.Boilers;
 model BoilerSystem
-  parameter Modelica.SIunits.Temperature Tair=300 "Source air temperature";
-  parameter Modelica.SIunits.Temperature Tsf=423.16
+  parameter Modelica.Units.SI.Temperature Tair=300 "Source air temperature";
+  parameter Modelica.Units.SI.Temperature Tsf=423.16
     "Flue gases temperature at the outlet";
-  parameter Modelica.SIunits.Power Wloss=1e5 "Thermal losses";
+  parameter Modelica.Units.SI.Power Wloss=1e5 "Thermal losses";
 
   ThermoSysPro.Combustion.BoundaryConditions.FuelSourcePQ Fuel(
     Xashes=0.011,
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/Boilers/FossilFuelBoiler.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/Boilers/FossilFuelBoiler.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/Boilers/FossilFuelBoiler.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/Boilers/FossilFuelBoiler.mo"	2022-03-10 09:58:46.428152795 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.MultiFluids.Boilers;
 model FossilFuelBoiler "Fossil fuel boiler"
-  parameter Modelica.SIunits.Temperature Tsf=400
+  parameter Modelica.Units.SI.Temperature Tsf=400
     "Flue gases temperature at the outlet";
   parameter Integer Boiler_efficiency_type = 1
     "1: Taking into account LHV only - 2: Using the total incoming power";
@@ -9,7 +9,7 @@
   parameter ThermoSysPro.Units.PressureLossCoefficient Ke=1e4
     "Water/steam pressure loss coefficient";
   parameter Real etacomb=1 "Combustion efficiency (between 0 and 1)";
-  parameter Modelica.SIunits.Power Wloss=1e5 "Thermal losses";
+  parameter Modelica.Units.SI.Power Wloss=1e5 "Thermal losses";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
@@ -27,70 +27,70 @@
     "Intermediate variable for the computation of the O2 mass fraction";
 
 public
-  Modelica.SIunits.MassFlowRate Qea(start=400)
+  Modelica.Units.SI.MassFlowRate Qea(start=400)
     "Air mass flow rate at the inlet";
-  Modelica.SIunits.AbsolutePressure Pea(start=1e5) "Air pressure at the inlet";
-  Modelica.SIunits.Temperature Tea(start=400) "Air temperature at the inlet";
-  Modelica.SIunits.SpecificEnthalpy Hea(start=50e3)
+  Modelica.Units.SI.AbsolutePressure Pea(start=1e5) "Air pressure at the inlet";
+  Modelica.Units.SI.Temperature Tea(start=400) "Air temperature at the inlet";
+  Modelica.Units.SI.SpecificEnthalpy Hea(start=50e3)
     "Air specific enthalpy at the inlet";
-  Modelica.SIunits.SpecificEnthalpy Hrair(start=10e3)
+  Modelica.Units.SI.SpecificEnthalpy Hrair(start=10e3)
     "Air reference specific enthalpy";
   Real XeaCO2(start=0) "CO2 mass fraction at the inlet";
   Real XeaH2O(start=0.1) "H2O mass fraction at the inlet";
   Real XeaO2(start=0.2) "O2 mass fraction at the inlet";
   Real XeaSO2(start=0) "SO2 mass fraction at the inlet";
 
-  Modelica.SIunits.MassFlowRate Qcomb(start=5) "Fuel mass flow rate";
-  Modelica.SIunits.Temperature Tcomb(start=300) "Fuel temperature";
-  Modelica.SIunits.SpecificEnthalpy Hcomb(start=10e3) "Fuel specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy Hrcomb(start=10e3)
+  Modelica.Units.SI.MassFlowRate Qcomb(start=5) "Fuel mass flow rate";
+  Modelica.Units.SI.Temperature Tcomb(start=300) "Fuel temperature";
+  Modelica.Units.SI.SpecificEnthalpy Hcomb(start=10e3) "Fuel specific enthalpy";
+  Modelica.Units.SI.SpecificEnthalpy Hrcomb(start=10e3)
     "Fuel reference specific enthalpy";
   Real XCcomb(start=0.8) "Carbon mass fraction";
   Real XHcomb(start=0.2) "Hydrogen mass fraction";
   Real XOcomb(start=0) "Oxygen mass fraction";
   Real XScomb(start=0) "Sulfur mass fraction";
   Real PCIcomb(start=5e7) "Fuel PCI (J/kg)";
-  Modelica.SIunits.SpecificHeatCapacity Cpcomb(start=2000)
+  Modelica.Units.SI.SpecificHeatCapacity Cpcomb(start=2000)
     "Fuel specific heat capacity";
 
-  Modelica.SIunits.MassFlowRate Qe(start=100) "Water/steam mass flow rate";
-  Modelica.SIunits.AbsolutePressure Pee(start=50e5)
+  Modelica.Units.SI.MassFlowRate Qe(start=100) "Water/steam mass flow rate";
+  Modelica.Units.SI.AbsolutePressure Pee(start=50e5)
     "Water/steam pressure at the inlet";
-  Modelica.SIunits.AbsolutePressure Pse(start=50e5)
+  Modelica.Units.SI.AbsolutePressure Pse(start=50e5)
     "Water/steam pressure at the outlet";
   ThermoSysPro.Units.DifferentialPressure deltaPe(start=1e5)
     "Water/steam pressure losses";
-  Modelica.SIunits.Temperature Tse(start=500)
+  Modelica.Units.SI.Temperature Tse(start=500)
     "Water/steam temperature at the outlet";
-  Modelica.SIunits.SpecificEnthalpy Hee(start=400e3)
+  Modelica.Units.SI.SpecificEnthalpy Hee(start=400e3)
     "Water/steam specific enthalpy at the inlet";
-  Modelica.SIunits.SpecificEnthalpy Hse(start=400e3)
+  Modelica.Units.SI.SpecificEnthalpy Hse(start=400e3)
     "Water/steam specific enthalpy at the outlet";
-  Modelica.SIunits.Density rhoe(start=998) "Average water/steam density";
+  Modelica.Units.SI.Density rhoe(start=998) "Average water/steam density";
 
-  Modelica.SIunits.MassFlowRate Qsf(start=400)
+  Modelica.Units.SI.MassFlowRate Qsf(start=400)
     "Flue gases mass flow rate at the outlet";
-  Modelica.SIunits.AbsolutePressure Psf(start=1e5)
+  Modelica.Units.SI.AbsolutePressure Psf(start=1e5)
     "Flue gases pressure at the outlet";
-  Modelica.SIunits.Temperature Tf(start=1500)
+  Modelica.Units.SI.Temperature Tf(start=1500)
     "Flue gases temperature after combustion";
-  Modelica.SIunits.SpecificEnthalpy Hsf(start=50e3)
+  Modelica.Units.SI.SpecificEnthalpy Hsf(start=50e3)
     "Flue gases specific enthalpy at the outlet";
-  Modelica.SIunits.SpecificEnthalpy Hf(start=100e3)
+  Modelica.Units.SI.SpecificEnthalpy Hf(start=100e3)
     "Flue gases specific enthalpy after combustion";
-  Modelica.SIunits.SpecificEnthalpy Hrfum(start=10e3)
+  Modelica.Units.SI.SpecificEnthalpy Hrfum(start=10e3)
     "Flue gases reference specific enthalpy";
   ThermoSysPro.Units.DifferentialPressure deltaPf(start=1e3)
     "Pressure losses in the combusiton chamber";
-  Modelica.SIunits.Density rhof(start=0.05) "Flue gases density";
+  Modelica.Units.SI.Density rhof(start=0.05) "Flue gases density";
   Real XsfCO2(start=0.2) "CO2 mass fraction at the outlet";
   Real XsfH2O(start=0.15) "H2O mass fraction at the outlet";
   Real XsfO2(start=0) "O2 mass fraction at the outlet";
   Real XsfSO2(start=0) "SO2 mass fraction at the outlet";
 
-  Modelica.SIunits.Power Wfuel(start=5e8) "Fuel available power PCI";
-  Modelica.SIunits.Power Wtot(start=5e8) "Total incoming power";
-  Modelica.SIunits.Power Wboil(start=5e9) "Power exchanged in the boiler";
+  Modelica.Units.SI.Power Wfuel(start=5e8) "Fuel available power PCI";
+  Modelica.Units.SI.Power Wtot(start=5e8) "Total incoming power";
+  Modelica.Units.SI.Power Wboil(start=5e9) "Power exchanged in the boiler";
   Real eta_boil(start=90) "Boiler efficiency (%) ";
   Real exc(start=1) "Air combustion ratio";
   Real exc_air(start=0.1) "Pertcentage of air in excess";
@@ -219,7 +219,7 @@
   Hea = ThermoSysPro.Properties.FlueGases.FlueGases_h(Pea, Tea, XeaCO2, XeaH2O, XeaO2c, XeaSO2);
 
   /* Flue gases tempretaure after combustion */
-  // Changed from FlueGases_T to FlueGases_h to provide a differentiable function
+// Changed from FlueGases_T to FlueGases_h to provide a differentiable function
   Hf = ThermoSysPro.Properties.FlueGases.FlueGases_h(Pea, Tf, XsfCO2, XsfH2O, XsfO2, XsfSO2);
 
   /* Flue gases specific enthalpy at the outlet */
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/HeatExchangers/DynamicExchangerWaterSteamFlueGases.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/HeatExchangers/DynamicExchangerWaterSteamFlueGases.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/HeatExchangers/DynamicExchangerWaterSteamFlueGases.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/HeatExchangers/DynamicExchangerWaterSteamFlueGases.mo"	2022-03-10 09:58:46.368152786 +0000
@@ -2,11 +2,11 @@
 model DynamicExchangerWaterSteamFlueGases
   "Dynamic exchanger water/steam - flue gases "
 
-  parameter Modelica.SIunits.Length L=1 "Exchanger length";
-  parameter Modelica.SIunits.Position z1=0 "Exchanger inlet altitude";
-  parameter Modelica.SIunits.Position z2=0 "Exchanger outlet altitude";
+  parameter Modelica.Units.SI.Length L=1 "Exchanger length";
+  parameter Modelica.Units.SI.Position z1=0 "Exchanger inlet altitude";
+  parameter Modelica.Units.SI.Position z2=0 "Exchanger outlet altitude";
   parameter Integer Ns=1 "Numver of segments";
-  parameter Modelica.SIunits.Diameter Dint=0.1 "Pipe internal diameter";
+  parameter Modelica.Units.SI.Diameter Dint=0.1 "Pipe internal diameter";
   parameter Integer Ntubes=1 "Number of pipes in parallel";
 
   ThermoSysPro.FlueGases.HeatExchangers.StaticWallFlueGasesExchanger
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/HeatExchangers/ExchangerWaterC3H3F5W.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/HeatExchangers/ExchangerWaterC3H3F5W.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/HeatExchangers/ExchangerWaterC3H3F5W.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/HeatExchangers/ExchangerWaterC3H3F5W.mo"	2022-03-10 09:58:46.356152785 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.MultiFluids.HeatExchangers;
 model ExchangerWaterC3H3F5W
   "Static water - C3H3F5 heat exchanger with fixed delta power"
-  parameter Modelica.SIunits.Power DW = 0
+  parameter Modelica.Units.SI.Power DW = 0
     "Power exchanged between the hot and the cold fluids";
   parameter ThermoSysPro.Units.DifferentialPressure DPc
     "Total pressure loss for the hot fluid (% of the fluid pressure at the inlet)";
@@ -14,21 +14,21 @@
 
 protected
   constant Real pi=Modelica.Constants.pi "pi";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow for continuous flow reversal";
 
 public
-  Modelica.SIunits.Temperature Tec
+
+  Modelica.Units.SI.Temperature Tec
     "Fluid temperature at the inlet of the hot side";
-  Modelica.SIunits.Temperature Tsc
+  Modelica.Units.SI.Temperature Tsc
     "Fluid temperature at the outlet of the hot side";
-  Modelica.SIunits.Temperature Tef
+  Modelica.Units.SI.Temperature Tef
     "Fluid temperature at the inlet of the cold side";
-  Modelica.SIunits.Temperature Tsf
+  Modelica.Units.SI.Temperature Tsf
     "Fluid temperature at the outlet of the cold side";
-  Modelica.SIunits.MassFlowRate Qc(start=100) "Hot fluid mass flow rate";
-  Modelica.SIunits.MassFlowRate Qf(start=100) "Cold fluid mass flow rate";
-
+  Modelica.Units.SI.MassFlowRate Qc(start=100) "Hot fluid mass flow rate";
+  Modelica.Units.SI.MassFlowRate Qf(start=100) "Cold fluid mass flow rate";
 public
   WaterSteam.Connectors.FluidInlet Ec
                           annotation (Placement(transformation(extent={{-68,-70},
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/HeatExchangers/SimpleEvaporatorWaterSteamFlueGases.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/HeatExchangers/SimpleEvaporatorWaterSteamFlueGases.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/HeatExchangers/SimpleEvaporatorWaterSteamFlueGases.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/HeatExchangers/SimpleEvaporatorWaterSteamFlueGases.mo"	2022-03-10 09:58:46.344152783 +0000
@@ -10,33 +10,33 @@
   parameter Real eps=1.e-0 "Small number for pressure loss equation";
 
 public
-  Modelica.SIunits.AbsolutePressure Pef(start=3e5)
+  Modelica.Units.SI.AbsolutePressure Pef(start=3e5)
     "Flue gases pressure at the inlet";
-  Modelica.SIunits.AbsolutePressure Psf(start=2.5e5)
+  Modelica.Units.SI.AbsolutePressure Psf(start=2.5e5)
     "Flue gases pressure at the outlet";
-  Modelica.SIunits.Temperature Tef(start=600)
+  Modelica.Units.SI.Temperature Tef(start=600)
     "Flue gases temperature at the inlet";
-  Modelica.SIunits.Temperature Tsf(start=400)
+  Modelica.Units.SI.Temperature Tsf(start=400)
     "Flue gases temperature at the outlet";
-  Modelica.SIunits.SpecificEnthalpy Hsf(start=3e5)
+  Modelica.Units.SI.SpecificEnthalpy Hsf(start=3e5)
     "Flue gases specific enthalpy at the outlet";
-  Modelica.SIunits.SpecificEnthalpy Hef(start=6e5)
+  Modelica.Units.SI.SpecificEnthalpy Hef(start=6e5)
     "Flue gases specific enthalpy at the inlet";
-  Modelica.SIunits.MassFlowRate Qf(start=10) "Flue gases mass flow rate";
-  Modelica.SIunits.AbsolutePressure Pee(start=2e6)
+  Modelica.Units.SI.MassFlowRate Qf(start=10) "Flue gases mass flow rate";
+  Modelica.Units.SI.AbsolutePressure Pee(start=2e6)
     "Water pressure at the inlet";
-  Modelica.SIunits.AbsolutePressure Pse(start=2e6)
+  Modelica.Units.SI.AbsolutePressure Pse(start=2e6)
     "Water pressure at the outlet";
-  Modelica.SIunits.Temperature Tee(start=400) "Water temperature at the inlet";
-  Modelica.SIunits.Temperature Tse(start=450) "Water temperature at the outlet";
-  Modelica.SIunits.SpecificEnthalpy Hee(start=3e5)
+  Modelica.Units.SI.Temperature Tee(start=400) "Water temperature at the inlet";
+  Modelica.Units.SI.Temperature Tse(start=450) "Water temperature at the outlet";
+  Modelica.Units.SI.SpecificEnthalpy Hee(start=3e5)
     "Water specific enthalpy at the inlet";
-  Modelica.SIunits.SpecificEnthalpy Hse(start=20e5)
+  Modelica.Units.SI.SpecificEnthalpy Hse(start=20e5)
     "Water specific enthalpy at the outlet";
-  Modelica.SIunits.MassFlowRate Qe(start=10) "Water mass flow rate";
-  Modelica.SIunits.Density rhof(start=0.9) "Flue gases density";
-  Modelica.SIunits.Density rhoe(start=700) "Water density";
-  Modelica.SIunits.Power W(start=1e8) "Power exchanged";
+  Modelica.Units.SI.MassFlowRate Qe(start=10) "Water mass flow rate";
+  Modelica.Units.SI.Density rhof(start=0.9) "Flue gases density";
+  Modelica.Units.SI.Density rhoe(start=700) "Water density";
+  Modelica.Units.SI.Power W(start=1e8) "Power exchanged";
 
   ThermoSysPro.WaterSteam.Connectors.FluidOutlet Cws2
     annotation (Placement(transformation(extent={{90,-10},{110,10}}, rotation=0)));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/HeatExchangers/StaticAerocondenser.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/HeatExchangers/StaticAerocondenser.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/HeatExchangers/StaticAerocondenser.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/HeatExchangers/StaticAerocondenser.mo"	2022-03-10 09:58:46.324152781 +0000
@@ -1,10 +1,10 @@
-﻿within ThermoSysPro.MultiFluids.HeatExchangers;
+within ThermoSysPro.MultiFluids.HeatExchangers;
 model StaticAerocondenser "Static aerocondenser"
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer Uref=50
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer Uref=50
     "Reference heat transfer coefficient between the air and the condenser external wall";
   parameter Real UCOR=1. "Heat transfer corrective coefficient";
-  parameter Modelica.SIunits.Area Se=1.e4 "Condenser external wall area";
-  parameter Modelica.SIunits.Height z=0 "Water level in the condenser";
+  parameter Modelica.Units.SI.Area Se=1.e4 "Condenser external wall area";
+  parameter Modelica.Units.SI.Height z=0 "Water level in the condenser";
   parameter Real K=0.02
     "Pressure loss coefficient for the water/steam pipe (Pa.s²/(kg.m**3))";
   parameter Real Ka=0.00
@@ -15,49 +15,49 @@
     "Région IAPWS en entrée. 1:liquide - 2:vapeur - 4:saturation - 0:calcul automatique";
 
 protected
-  constant Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  constant Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
 
 public
-  Modelica.SIunits.SpecificEnthalpy hv(start=2500000)
+  Modelica.Units.SI.SpecificEnthalpy hv(start=2500000)
     "Fluid specific enthalpy at the inlet of the condenser";
-  Modelica.SIunits.SpecificEnthalpy he(start=370000)
+  Modelica.Units.SI.SpecificEnthalpy he(start=370000)
     "Fluid specific enthalpy at the outlet of the condenser";
-  Modelica.SIunits.SpecificEnthalpy hae(start=75000)
+  Modelica.Units.SI.SpecificEnthalpy hae(start=75000)
     "Air specific enthalpy at the inlet of the condenser";
-  Modelica.SIunits.SpecificEnthalpy has(start=100000)
+  Modelica.Units.SI.SpecificEnthalpy has(start=100000)
     "Air specific enthalpy at the outlet of the condenser";
-  Modelica.SIunits.MassFlowRate Q(start=1.5e2)
+  Modelica.Units.SI.MassFlowRate Q(start=1.5e2)
     "Fluid mass flow rate in the water/steam pipe";
-  Modelica.SIunits.MassFlowRate Qa(start=1.4e3)
+  Modelica.Units.SI.MassFlowRate Qa(start=1.4e3)
     "Air mass flow rate in the condenser";
-  Modelica.SIunits.Temperature Tae(start=290)
+  Modelica.Units.SI.Temperature Tae(start=290)
     "Air temperature at the inlet of the condenser";
-  Modelica.SIunits.Temperature Tas(start=360)
+  Modelica.Units.SI.Temperature Tas(start=360)
     "Air temperature at the outlet of the condenser";
-  Modelica.SIunits.AbsolutePressure Pae(start=1.e5)
+  Modelica.Units.SI.AbsolutePressure Pae(start=1.e5)
     "Air pressure at the inlet of the condenser";
-  Modelica.SIunits.AbsolutePressure Pas(start=1.e5)
+  Modelica.Units.SI.AbsolutePressure Pas(start=1.e5)
     "Air pressure at the outlet of the condenser";
-  Modelica.SIunits.AbsolutePressure Pv(start=30000)
+  Modelica.Units.SI.AbsolutePressure Pv(start=30000)
     "Fluid pressure at the inlet of the condenser";
-  Modelica.SIunits.AbsolutePressure Pe(start=30000)
+  Modelica.Units.SI.AbsolutePressure Pe(start=30000)
     "Fluid pressure at the outlet of the condenser";
-  Modelica.SIunits.AbsolutePressure Pcond(start=17000)
+  Modelica.Units.SI.AbsolutePressure Pcond(start=17000)
     "Condensation pressure (vacuum)";
-  Modelica.SIunits.Temperature Tcond(start=360) "Condensation temperature";
-  Modelica.SIunits.CoefficientOfHeatTransfer U(start=50)
+  Modelica.Units.SI.Temperature Tcond(start=360) "Condensation temperature";
+  Modelica.Units.SI.CoefficientOfHeatTransfer U(start=50)
     "Heat transfer coefficient";
-  Modelica.SIunits.SpecificHeatCapacity cp_a(start=1000)
+  Modelica.Units.SI.SpecificHeatCapacity cp_a(start=1000)
     "Air specific heat capacity at constant pressure";
   Real Nut(start=2.) "Number of transfer units";
   Real Ef(start=0.8) "Efficiency in two-phase flow regime";
-  Modelica.SIunits.Power W "Heat power transfered to the cooling air";
-  Modelica.SIunits.Density rho_v(start=500)
+  Modelica.Units.SI.Power W "Heat power transfered to the cooling air";
+  Modelica.Units.SI.Density rho_v(start=500)
     "Fluid density at the inlet of the condenser";
-  Modelica.SIunits.Density rho_e(start=998)
+  Modelica.Units.SI.Density rho_e(start=998)
     "Fluid density at the outlet of the condenser";
-  Modelica.SIunits.Density rho_a(start=1) "Air density";
+  Modelica.Units.SI.Density rho_a(start=1) "Air density";
 public
   WaterSteam.Connectors.FluidInlet Cws1
     annotation (Placement(transformation(extent={{-110,-50},{-90,-30}},
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/HeatExchangers/StaticExchangerWaterSteamFlueGases.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/HeatExchangers/StaticExchangerWaterSteamFlueGases.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/HeatExchangers/StaticExchangerWaterSteamFlueGases.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/HeatExchangers/StaticExchangerWaterSteamFlueGases.mo"	2022-03-10 09:58:46.300152778 +0000
@@ -4,11 +4,11 @@
   parameter Integer exchanger_type=1
     "Exchanger type - 1: Efficiency is fixed - 2: delta power is fixed - 3: heat transfer is fixed";
   parameter Real EffEch = 0.9 "Thermal exchange efficiency";
-  parameter Modelica.SIunits.Power W0=0
+  parameter Modelica.Units.SI.Power W0=0
     "Power exchanged (active if exchanger_type=2)";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer K = 100
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer K = 100
     "Global heat transfer coefficient (active if exchanger_type=3)";
-  parameter Modelica.SIunits.Area S = 10
+  parameter Modelica.Units.SI.Area S = 10
     "Global heat exchange surface (active if exchanger_type=3)";
   parameter Real Kdpf = 10 "Pressure loss coefficient on the flue gas side";
   parameter Real Kdpe = 10 "Pressure loss coefficient on the water/steam side";
@@ -21,40 +21,40 @@
   parameter Real eps=1.e-0 "Small number for pressure loss equation";
 
 public
-  Modelica.SIunits.AbsolutePressure Pef(start=3e5)
+  Modelica.Units.SI.AbsolutePressure Pef(start=3e5)
     "Flue gas pressure at the inlet";
-  Modelica.SIunits.AbsolutePressure Psf(start=2.5e5)
+  Modelica.Units.SI.AbsolutePressure Psf(start=2.5e5)
     "Flue gas pressure at the outlet";
-  Modelica.SIunits.Temperature Tef(start=600)
+  Modelica.Units.SI.Temperature Tef(start=600)
     "Flue gas temperature at the inlet";
-  Modelica.SIunits.Temperature Tsf(start=400)
+  Modelica.Units.SI.Temperature Tsf(start=400)
     "Flue gas temperature at the outlet";
-  Modelica.SIunits.SpecificEnthalpy Hef(start=6e5)
+  Modelica.Units.SI.SpecificEnthalpy Hef(start=6e5)
     "Flue gas specific enthalpy at the inlet";
-  Modelica.SIunits.SpecificEnthalpy Hsf(start=3e5)
+  Modelica.Units.SI.SpecificEnthalpy Hsf(start=3e5)
     "Flue gas specific enthalpy at the outlet";
-  Modelica.SIunits.MassFlowRate Qf(start=10) "Flue gas mass flow rate";
-  Modelica.SIunits.AbsolutePressure Pee(start=2e6)
+  Modelica.Units.SI.MassFlowRate Qf(start=10) "Flue gas mass flow rate";
+  Modelica.Units.SI.AbsolutePressure Pee(start=2e6)
     "Water pressure at the inlet";
-  Modelica.SIunits.AbsolutePressure Pse(start=2e6)
+  Modelica.Units.SI.AbsolutePressure Pse(start=2e6)
     "Water pressure at the outlet";
-  Modelica.SIunits.Temperature Tee(start=400) "Water temperature at the inlet";
-  Modelica.SIunits.Temperature Tse( start=450)
+  Modelica.Units.SI.Temperature Tee(start=400) "Water temperature at the inlet";
+  Modelica.Units.SI.Temperature Tse( start=450)
     "Water temperature at the outlet";
   ThermoSysPro.Units.DifferentialTemperature DT1 "Delta T at the inlet";
   ThermoSysPro.Units.DifferentialTemperature DT2 "Delta T at the outlet";
-  Modelica.SIunits.SpecificEnthalpy Hse(start=20e5)
+  Modelica.Units.SI.SpecificEnthalpy Hse(start=20e5)
     "Water specific enthalpy at the inlet";
-  Modelica.SIunits.SpecificEnthalpy Hee(start=3e5)
+  Modelica.Units.SI.SpecificEnthalpy Hee(start=3e5)
     "Water specific enthalpy at the outlet";
-  Modelica.SIunits.MassFlowRate Qe(start=10) "Water mass flow rate";
-  Modelica.SIunits.Density rhoe(start=700) "Water density";
-  Modelica.SIunits.Density rhof(start=0.9) "Fluie gas density";
-  Modelica.SIunits.SpecificHeatCapacity Cpf(start=1000)
+  Modelica.Units.SI.MassFlowRate Qe(start=10) "Water mass flow rate";
+  Modelica.Units.SI.Density rhoe(start=700) "Water density";
+  Modelica.Units.SI.Density rhof(start=0.9) "Fluie gas density";
+  Modelica.Units.SI.SpecificHeatCapacity Cpf(start=1000)
     "Flue gas specific heat capacity";
-  Modelica.SIunits.SpecificHeatCapacity Cpe(start=4200)
+  Modelica.Units.SI.SpecificHeatCapacity Cpe(start=4200)
     "Water specific heat capacity";
-  Modelica.SIunits.Power W(start=1e8) "Exchanger power";
+  Modelica.Units.SI.Power W(start=1e8) "Exchanger power";
 
   ThermoSysPro.WaterSteam.Connectors.FluidOutlet Cws2 "Water outlet"
     annotation (Placement(transformation(extent={{90,-10},{110,10}}, rotation=0)));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/Machines/AlternatingEngine.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/Machines/AlternatingEngine.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/Machines/AlternatingEngine.mo"	2022-03-10 09:57:37.980144123 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/Machines/AlternatingEngine.mo"	2022-03-10 09:58:46.264152774 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.MultiFluids.Machines;
+within ThermoSysPro.MultiFluids.Machines;
 model AlternatingEngine "Internal combustion engine with electrical output"
   parameter Integer mechanical_efficiency_type = 1
     "1: fixed nominal efficiency - 2: Linear efficiency using Coef_Rm_a, Coef_Rm_b and Coef_Rm_c - 3: Beau de Rochas cycle efficiency";
@@ -34,63 +34,63 @@
   constant Real amSO2=amS+2*amO "SO2 molecular mass";
 
 public
-  Modelica.SIunits.MassFlowRate Qsf(start=400)
+  Modelica.Units.SI.MassFlowRate Qsf(start=400)
     "Flue gases mass flow rate at the outlet";
-  Modelica.SIunits.AbsolutePressure Psf(start=12e5)
+  Modelica.Units.SI.AbsolutePressure Psf(start=12e5)
     "Flue gases pressure at the outlet";
-  Modelica.SIunits.Temperature Tsf(start=1500)
+  Modelica.Units.SI.Temperature Tsf(start=1500)
     "Flue gases temperature at the outlet";
   Real XsfCO2(start=0.5) "Flue gases CO2 mass fraction at the outlet";
   Real XsfH2O(start=0.1) "Flue gases H2O mass fraction at the outlet";
   Real XsfO2(start=0) "Flue gases O2 mass fraction at the outlet";
   Real XsfSO2(start=0) "Flue gases SO2 mass fraction at the outlet";
   Real Rmeca(start=0.3) "Engine mechanical efficiency";
-  Modelica.SIunits.Power Wmeca(start=5e8) "Engine mechanical power";
-  Modelica.SIunits.Power Welec(start=5e8) "Engine electrical power";
-  Modelica.SIunits.Power Wact(start=5e8) "Active power";
-  Modelica.SIunits.Power Wcomb(start=5e8) "Fuel power available (Q.PCS)";
-  Modelica.SIunits.Power Wpth_ref(start=1e6)
+  Modelica.Units.SI.Power Wmeca(start=5e8) "Engine mechanical power";
+  Modelica.Units.SI.Power Welec(start=5e8) "Engine electrical power";
+  Modelica.Units.SI.Power Wact(start=5e8) "Active power";
+  Modelica.Units.SI.Power Wcomb(start=5e8) "Fuel power available (Q.PCS)";
+  Modelica.Units.SI.Power Wpth_ref(start=1e6)
     "Power of thermal losses + cooling";
   Real exc(start=1) "Combustion air ratio";
   Real PCScomb "Pouvoir Calorifique Supérieur du combustible sur brut(en J/kg)";
-  Modelica.SIunits.Temperature Tm(start=500) "Air-gas mixture temperature";
-  Modelica.SIunits.Temperature Tfcp(start=500)
+  Modelica.Units.SI.Temperature Tm(start=500) "Air-gas mixture temperature";
+  Modelica.Units.SI.Temperature Tfcp(start=500)
     "Temperature at the end of the compression phase";
-  Modelica.SIunits.AbsolutePressure Pfcp(start=12e5)
+  Modelica.Units.SI.AbsolutePressure Pfcp(start=12e5)
     "Pressure at the end of the compression phase";
-  Modelica.SIunits.Temperature Tfcb(start=500)
+  Modelica.Units.SI.Temperature Tfcb(start=500)
     "Temperature at the end of the combustion phase";
-  Modelica.SIunits.AbsolutePressure Pfcb(start=12e5)
+  Modelica.Units.SI.AbsolutePressure Pfcb(start=12e5)
     "Pressure at the end of the combustion phase";
-  Modelica.SIunits.Temperature Tfd(start=500)
+  Modelica.Units.SI.Temperature Tfd(start=500)
     "Temperature at the end of the expansion phase";
-  Modelica.SIunits.AbsolutePressure Pfd(start=12e5)
+  Modelica.Units.SI.AbsolutePressure Pfd(start=12e5)
     "Pressure at the end of the expansion phase";
-  Modelica.SIunits.Temperature Tfe(start=500) "Temperature at the exhaust";
-  Modelica.SIunits.SpecificEnthalpy Hea(start=50e3)
+  Modelica.Units.SI.Temperature Tfe(start=500) "Temperature at the exhaust";
+  Modelica.Units.SI.SpecificEnthalpy Hea(start=50e3)
     "Air specific enthalpy at the inlet";
-  Modelica.SIunits.SpecificEnthalpy Hsf(start=50e4)
+  Modelica.Units.SI.SpecificEnthalpy Hsf(start=50e4)
     "Flue gases specific enthalpy at the outlet";
-  Modelica.SIunits.SpecificEnthalpy Hcomb(start=10e3)
+  Modelica.Units.SI.SpecificEnthalpy Hcomb(start=10e3)
     "Fuel specific enthalpy at the inlet";
-  Modelica.SIunits.SpecificEnthalpy Hrfum(start=10e3)
+  Modelica.Units.SI.SpecificEnthalpy Hrfum(start=10e3)
     "Flue gases reference specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy Hrair(start=10e3)
+  Modelica.Units.SI.SpecificEnthalpy Hrair(start=10e3)
     "Air reference specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy Hrcomb(start=10e3)
+  Modelica.Units.SI.SpecificEnthalpy Hrcomb(start=10e3)
     "Fuel reference specific enthalpy";
-  Modelica.SIunits.MassFlowRate Qea(start=400)
+  Modelica.Units.SI.MassFlowRate Qea(start=400)
     "Air mass flow rate at the inlet";
-  Modelica.SIunits.AbsolutePressure Pea(start=1e5) "Air pressure at the inlet";
-  Modelica.SIunits.Temperature Tea(start=600) "Air temperature at the inlet";
+  Modelica.Units.SI.AbsolutePressure Pea(start=1e5) "Air pressure at the inlet";
+  Modelica.Units.SI.Temperature Tea(start=600) "Air temperature at the inlet";
   Real XeaCO2(start=0) "Air CO2 mass fraction at the inlet";
   Real XeaH2O(start=0.1) "Air H2O mass fraction at the inlet";
   Real XeaO2(start=0.2) "Air O2 mass fraction at the inlet";
   Real XeaSO2(start=0) "Air SO2 mass fraction at the inlet";
-  Modelica.SIunits.SpecificHeatCapacity Cpair(start=1000)
+  Modelica.Units.SI.SpecificHeatCapacity Cpair(start=1000)
     "Air specific heat capacity";
-  Modelica.SIunits.MassFlowRate Qcomb(start=5) "Fuel mass flow rate";
-  Modelica.SIunits.Temperature Tcomb(start=300) "Fuel temperature";
+  Modelica.Units.SI.MassFlowRate Qcomb(start=5) "Fuel mass flow rate";
+  Modelica.Units.SI.Temperature Tcomb(start=300) "Fuel temperature";
   Real XCcomb(start=0.8) "Fuel carbon fraction";
   Real XHcomb(start=0.2) "Fuel hydrogen fraction";
   Real XOcomb(start=0) "Fuel oxygen fraction";
@@ -98,15 +98,15 @@
   Real XEAUcomb(start=0) "Fuel H2O fraction";
   Real XCDcomb(start=0) "Fuel ashes fraction";
   Real PCIcomb(start=5e7) "Fuel PCI (J/kg)";
-  Modelica.SIunits.SpecificHeatCapacity Cpcomb(start=1000)
+  Modelica.Units.SI.SpecificHeatCapacity Cpcomb(start=1000)
     "Fuel specific heat capacity";
-  Modelica.SIunits.MassFlowRate Qe(start=1) "Water mass flow rate";
-  Modelica.SIunits.SpecificEnthalpy Hev(start=10e3)
+  Modelica.Units.SI.MassFlowRate Qe(start=1) "Water mass flow rate";
+  Modelica.Units.SI.SpecificEnthalpy Hev(start=10e3)
     "Water specific enthalpy at the inlet";
-  Modelica.SIunits.Density rhoea(start=0.001) "Air density at the inlet";
-  Modelica.SIunits.Density rhosf(start=0.001)
+  Modelica.Units.SI.Density rhoea(start=0.001) "Air density at the inlet";
+  Modelica.Units.SI.Density rhosf(start=0.001)
     "Flue gases density at the outlet";
-  Modelica.SIunits.SpecificEnthalpy Hsv(start=10e3)
+  Modelica.Units.SI.SpecificEnthalpy Hsv(start=10e3)
     "Water specific enthalpy at the outlet";
   Real MMairgaz(start=30) "Air/gas mixture molecular mass (g/mol)";
   Real MMfumees(start=30) "Flue gases molecular mass (g/mol)";
@@ -198,13 +198,11 @@
 
   /* Flue gases thermodynamic properties at the outlet */
   Hsf = ThermoSysPro.Properties.FlueGases.FlueGases_h(Psf, Tsf, XsfCO2, XsfH2O, XsfO2, XsfSO2);
-  rhosf = ThermoSysPro.Properties.FlueGases.FlueGases_rho(Psf, Tsf, XsfCO2, XsfH2O, XsfO2, XsfSO2);
-
-  //---------------------
-  //  BEAU DE ROCHAS CYCLE
-
-  /* (1) Air and gas mixing at constant pressure Pea */
-  Tm = (Qcomb*Cpcomb*Tcomb + Qea*Cpair*Tea)/(Qcomb*Cpcomb + Qea*Cpair);
+  rhosf = ThermoSysPro.Properties.FlueGases.FlueGases_rho(Psf, Tsf, XsfCO2, XsfH2O, XsfO2, XsfSO2);
+//---------------------
+//  BEAU DE ROCHAS CYCLE
+/* (1) Air and gas mixing at constant pressure Pea */
+  Tm = (Qcomb * Cpcomb * Tcomb + Qea * Cpair * Tea) / (Qcomb * Cpcomb + Qea * Cpair);
 
   /* (2) Polytropic compression */
   Tfcp = Tm*RV^(Kc - 1);
@@ -213,28 +211,24 @@
   /* (3) Constant volume combustion (point mort haut) */
   MMairgaz = (Qea*28.9 + Qcomb*MMg)/(Qea + Qcomb);
   MMfumees = (1 - XsfCO2 - XsfH2O - XsfO2 - XsfSO2)*28 + XsfCO2*44 + XsfH2O*18 + XsfO2*32 + XsfSO2*64;
-  Pfcb = Pfcp*Tfcb/Tfcp*MMairgaz/MMfumees;
-  //Tfcb = (Wcomb - Wpth_ref)/ThermoSysPro.Properties.FlueGases.FlueGases_cp(Pfcp, (Tfcp + Tfcb)/2, XsfCO2, XsfH2O, XsfO2, XsfSO2)/0.75/Qsf + Tfcp;
-  Tfcb = Wcomb/ThermoSysPro.Properties.FlueGases.FlueGases_cp(Pfcp, (Tfcp + Tfcb)/2, XsfCO2, XsfH2O, XsfO2, XsfSO2)/Qsf + Tfcp;
+  Pfcb = Pfcp*Tfcb/Tfcp*MMairgaz/MMfumees;
+//Tfcb = (Wcomb - Wpth_ref)/ThermoSysPro.Properties.FlueGases.FlueGases_cp(Pfcp, (Tfcp + Tfcb)/2, XsfCO2, XsfH2O, XsfO2, XsfSO2)/0.75/Qsf + Tfcp;
+  Tfcb = Wcomb / ThermoSysPro.Properties.FlueGases.FlueGases_cp(Pfcp, (Tfcp + Tfcb) / 2, XsfCO2, XsfH2O, XsfO2, XsfSO2) / Qsf + Tfcp;
 
   /* (4) Polytropic expansion */
   Tfd = Tfcb *(1/RV)^(Kd - 1);
   Pfd = Pfcb *(1/RV)^Kd;
 
   /* (5) Echappement */
-  Tfe = Tfd*(Psf/Pfd)^((Gamma - 1)/Gamma);
-
-  //---------------------
-
-  /* Efficiency and mechanical power */
-  if (mechanical_efficiency_type == 1) then
-    Rmeca = Rmeca_nom;
-  elseif (mechanical_efficiency_type == 2) then
-    Rmeca = Coef_Rm_a * Wcomb/1000*Wcomb/1000 + Coef_Rm_b*Wcomb/1000 + Coef_Rm_c;
-  else
-    Rmeca = ((Qcomb*(Hcomb - Hrcomb + PCIcomb) + Qea*(Hea - Hrair))
-            -(Qsf*(ThermoSysPro.Properties.FlueGases.FlueGases_h(Psf, Tfe, XsfCO2, XsfH2O, XsfO2, XsfSO2)
-            -Hrfum) + Wpth_ref))/Wcomb;
+  Tfe = Tfd*(Psf/Pfd)^((Gamma - 1)/Gamma);
+//---------------------
+/* Efficiency and mechanical power */
+  if mechanical_efficiency_type == 1 then
+    Rmeca = Rmeca_nom;
+  elseif mechanical_efficiency_type == 2 then
+    Rmeca = Coef_Rm_a * Wcomb / 1000 * Wcomb / 1000 + Coef_Rm_b * Wcomb / 1000 + Coef_Rm_c;
+  else
+    Rmeca = (Qcomb * (Hcomb - Hrcomb + PCIcomb) + Qea * (Hea - Hrair) - (Qsf * (ThermoSysPro.Properties.FlueGases.FlueGases_h(Psf, Tfe, XsfCO2, XsfH2O, XsfO2, XsfSO2) - Hrfum) + Wpth_ref)) / Wcomb;
   end if;
 
   Wmeca = Rmeca*Wcomb;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/Machines/CHPEngineBarkantineSystem.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/Machines/CHPEngineBarkantineSystem.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/Machines/CHPEngineBarkantineSystem.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/Machines/CHPEngineBarkantineSystem.mo"	2022-03-10 09:58:46.172152762 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.MultiFluids.Machines;
 model CHPEngineBarkantineSystem
-  parameter Modelica.SIunits.Temperature Tair=300 "Temperature inlet air";
+  parameter Modelica.Units.SI.Temperature Tair=300 "Temperature inlet air";
   parameter Real RechFumEff=0.73 "Flue gases heater efficiency";
   parameter Real RechWaterEff=0.9 "Water heater efficiency";
   parameter Integer mechanical_efficiency_type=3 "Engine efficiency type"
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/Machines/CHPEngineBarkantineSystem_NewQair.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/Machines/CHPEngineBarkantineSystem_NewQair.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/Machines/CHPEngineBarkantineSystem_NewQair.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/Machines/CHPEngineBarkantineSystem_NewQair.mo"	2022-03-10 09:58:46.148152758 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.MultiFluids.Machines;
 model CHPEngineBarkantineSystem_NewQair
-  parameter Modelica.SIunits.Temperature Tair=300 "Temperature inlet air";
+  parameter Modelica.Units.SI.Temperature Tair=300 "Temperature inlet air";
   parameter Real RechFumEff=0.73 "Flue gases heater efficiency";
   parameter Real RechWaterEff=0.9 "Water heater efficiency";
   parameter Integer mechanical_efficiency_type=3 "Engine efficiency type"
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/Machines/CHPEngineTriGenPredSystem.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/Machines/CHPEngineTriGenPredSystem.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/Machines/CHPEngineTriGenPredSystem.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/Machines/CHPEngineTriGenPredSystem.mo"	2022-03-10 09:58:46.124152757 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.MultiFluids.Machines;
 model CHPEngineTriGenPredSystem
-  parameter Modelica.SIunits.Temperature Tair=298 "Temperature inlet air";
+  parameter Modelica.Units.SI.Temperature Tair=298 "Temperature inlet air";
   parameter Real RechFumEff=0.717833 "Flue gases heater efficiency";
   parameter Real RechWaterEff=0.837865 "Water heater efficiency";
   parameter Integer mechanical_efficiency_type=3 "Engine efficiency type"
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/Machines/CHPEngineTrigenParamSystem.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/Machines/CHPEngineTrigenParamSystem.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/Machines/CHPEngineTrigenParamSystem.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/MultiFluids/Machines/CHPEngineTrigenParamSystem.mo"	2022-03-10 09:58:46.100152753 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.MultiFluids.Machines;
 model CHPEngineTrigenParamSystem
-  parameter Modelica.SIunits.Temperature Tair=298 "Temperature inlet air";
+  parameter Modelica.Units.SI.Temperature Tair=298 "Temperature inlet air";
   parameter Real RechFumEff=0.725576 "Flue gases heater efficiency";
   parameter Real RechWaterEff=0.910767 "Water heater efficiency";
   parameter Integer mechanical_efficiency_type=3 "Engine efficiency type"
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/C3H3F5/C3H3F5_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/C3H3F5/C3H3F5_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/C3H3F5/C3H3F5_Ph.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/C3H3F5/C3H3F5_Ph.mo"	2022-03-10 09:58:46.040152745 +0000
@@ -1,21 +1,21 @@
 within ThermoSysPro.Properties.C3H3F5;
 function C3H3F5_Ph "11133-C3H3F5 physical properties as a function of P and h"
-  input Modelica.SIunits.AbsolutePressure P "Pressure";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+  input Modelica.Units.SI.AbsolutePressure P "Pressure";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
 
 protected
-  Modelica.SIunits.Temperature Tsat "Saturation temperature";
-  Modelica.SIunits.AbsolutePressure Psc "Critical pressure";
-  Modelica.SIunits.AbsolutePressure Pcalc
+  Modelica.Units.SI.Temperature Tsat "Saturation temperature";
+  Modelica.Units.SI.AbsolutePressure Psc "Critical pressure";
+  Modelica.Units.SI.AbsolutePressure Pcalc
     "Variable for the computation of the pressure";
-  Modelica.SIunits.SpecificEnthalpy hcalc
+  Modelica.Units.SI.SpecificEnthalpy hcalc
     "Variable for the computation of the specific  enthalpy";
-  Modelica.SIunits.SpecificEnthalpy hsatL "Boiling specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy hsatV "Condensation specific enthalpy";
-  Modelica.SIunits.SpecificEntropy ssatL "Boiling specific entropy";
-  Modelica.SIunits.SpecificEntropy ssatV "Condensation specific entropy";
-  Modelica.SIunits.Density rhoSatL "Boiling density";
-  Modelica.SIunits.Density rhoSatV "Condensation density";
+  Modelica.Units.SI.SpecificEnthalpy hsatL "Boiling specific enthalpy";
+  Modelica.Units.SI.SpecificEnthalpy hsatV "Condensation specific enthalpy";
+  Modelica.Units.SI.SpecificEntropy ssatL "Boiling specific entropy";
+  Modelica.Units.SI.SpecificEntropy ssatV "Condensation specific entropy";
+  Modelica.Units.SI.Density rhoSatL "Boiling density";
+  Modelica.Units.SI.Density rhoSatV "Condensation density";
   Real A1;
   Real B1;
   Real C1;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/C3H3F5/C3H3F5_Ps.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/C3H3F5/C3H3F5_Ps.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/C3H3F5/C3H3F5_Ps.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/C3H3F5/C3H3F5_Ps.mo"	2022-03-10 09:58:46.024152744 +0000
@@ -1,19 +1,19 @@
 within ThermoSysPro.Properties.C3H3F5;
 function C3H3F5_Ps "11133-C3H3F5 physical properties as a function of P and s"
-  input Modelica.SIunits.AbsolutePressure P "Pressure";
-  input Modelica.SIunits.SpecificEntropy s "Specific entropy";
+  input Modelica.Units.SI.AbsolutePressure P "Pressure";
+  input Modelica.Units.SI.SpecificEntropy s "Specific entropy";
 
 protected
-  Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
-  Modelica.SIunits.AbsolutePressure Psc "Critical pressure";
-  Modelica.SIunits.AbsolutePressure Pcalc
+  Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+  Modelica.Units.SI.AbsolutePressure Psc "Critical pressure";
+  Modelica.Units.SI.AbsolutePressure Pcalc
     "Variable for the computation of the pressure";
-  Modelica.SIunits.SpecificEntropy scalc
+  Modelica.Units.SI.SpecificEntropy scalc
     "Variable for the computation of the specific entropy";
-  Modelica.SIunits.SpecificEnthalpy hsatL "Boiling specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy hsatV "Condensation specific enthalpy";
-  Modelica.SIunits.SpecificEntropy ssatL "Boiling specific entropy";
-  Modelica.SIunits.SpecificEntropy ssatV "Condensation specific entropy";
+  Modelica.Units.SI.SpecificEnthalpy hsatL "Boiling specific enthalpy";
+  Modelica.Units.SI.SpecificEnthalpy hsatV "Condensation specific enthalpy";
+  Modelica.Units.SI.SpecificEntropy ssatL "Boiling specific entropy";
+  Modelica.Units.SI.SpecificEntropy ssatV "Condensation specific entropy";
   Real x "Vapor mass fraction";
   Real A;
   Real B;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/Density_PT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/Density_PT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/Density_PT.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/Density_PT.mo"	2022-03-10 09:58:46.004152741 +0000
@@ -2,17 +2,16 @@
 function Density_PT "Density computation for Dry Air Ideal Gas (input P, T)"
   // STEPHANIE Dry Air Ideal Gas
 
-  input Modelica.SIunits.Pressure P;
-  input Modelica.SIunits.Temperature T "Temperature (K)";
+  input Modelica.Units.SI.Pressure P;
+  input Modelica.Units.SI.Temperature T "Temperature (K)";
 
-  output Modelica.SIunits.Density rho;
+  output Modelica.Units.SI.Density rho;
 
 protected
   ThermoSysPro.Properties.DryAirIdealGas.DryAirIdealGas Data;
 
 algorithm
   rho := P / (Data.specificGasConstant * T);
-
-//annotation(inverse(p = Pressure_rhot_calc(rho,temp), temp = Temperature_rhop_calc(rho,p)), derivative = Density_derpt_calc);
-annotation(derivative = derDensity_derP_derT);
+//annotation(inverse(p = Pressure_rhot_calc(rho,temp), temp = Temperature_rhop_calc(rho,p)), derivative = Density_derpt_calc);
+  annotation(derivative = derDensity_derP_derT);
 end Density_PT;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/DryAirIdealGas.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/DryAirIdealGas.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/DryAirIdealGas.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/DryAirIdealGas.mo"	2022-03-10 09:58:46.000152740 +0000
@@ -1,13 +1,12 @@
-﻿within ThermoSysPro.Properties.DryAirIdealGas;
+within ThermoSysPro.Properties.DryAirIdealGas;
 record DryAirIdealGas "Data for Dry Air Ideal Gas from STEPHANIE Library"
-  // STEPHANIE Dry Air Ideal Gas
-  // "Air Data Package - valid temperature ranges 200K - 1000K and 1000K - 6000K. Source: NASA/TP-2002-211556 Coefficients for Calculating Thermodynamic Properties"
-
-// Data package
+  // STEPHANIE Dry Air Ideal Gas
+  // "Air Data Package - valid temperature ranges 200K - 1000K and 1000K - 6000K. Source: NASA/TP-2002-211556 Coefficients for Calculating Thermodynamic Properties"
+  // Data package
   String idealGasName = "Air -N2 78.08 -O2 20.95 -Ar 0.94 -CO2 0.03 percent";
   Real molarMass = 0.0289651;
-  Modelica.SIunits.SpecificEnthalpy enthalpyOfFormation = -4333.836;
-  Modelica.SIunits.SpecificEnthalpy enthalpyReference = 298609.8443;
+  Modelica.Units.SI.SpecificEnthalpy enthalpyOfFormation = -4333.836;
+  Modelica.Units.SI.SpecificEnthalpy enthalpyReference = 298609.8443;
   Real limitTemperature = 1000;
   Real alow[:] = {10099.5016,-196.827561,5.00915511,-0.00576101373,1.06685993e-5,-7.94029797e-9,2.18523191e-12};
   Real blow[:] = {-176.796731,-3.921504225};
@@ -15,14 +14,14 @@
   Real bhigh[:] = {6462.26319,-8.147411905};
   Real specificGasConstant = 287.051225;
 
-// extends PartialIdealSingleGas (ie: ajouté à PartialIdealSingleGas)
+// extends PartialIdealSingleGas (ie: ajouté à PartialIdealSingleGas)
   String mediumName = "Dry Air";
   Boolean compressible = true;
-  Modelica.SIunits.Temperature maximum_temperature = 1000;
-  Modelica.SIunits.Temperature minimum_temperature = 200;
-  Modelica.SIunits.Temperature reference_temperature = 302.45;
-  Modelica.SIunits.Pressure pressure_default = 101325;
-  Modelica.SIunits.SpecificEnthalpy enthalpy_default = 300415.551249572
+  Modelica.Units.SI.Temperature maximum_temperature = 1000;
+  Modelica.Units.SI.Temperature minimum_temperature = 200;
+  Modelica.Units.SI.Temperature reference_temperature = 302.45;
+  Modelica.Units.SI.Pressure pressure_default = 101325;
+  Modelica.Units.SI.SpecificEnthalpy enthalpy_default = 300415.551249572
     "Default value for enthalpy (@ 323ºC) of medium (for initialization)";
     //=ThermoSysPro.Properties.DryAirIdealGas.SpecificEnthalpy_T(T=(323+273.15))
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/DynamicViscosity_Trho.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/DynamicViscosity_Trho.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/DynamicViscosity_Trho.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/DynamicViscosity_Trho.mo"	2022-03-10 09:58:45.992152740 +0000
@@ -4,14 +4,14 @@
   //valid up to 100MPa and 2000K, according to Kadoya et al. 1985 (Viscosity and Thermal Conductivity of Dry Air in the Gaseous Phase), Journal of Physical and Chemical Reference Data"
   // STEPHANIE Dry Air Ideal Gas
 
-  input Modelica.SIunits.Temperature T "Temperature (K)";
-  input Modelica.SIunits.Density rho "Density (kg/m3)";
+  input Modelica.Units.SI.Temperature T "Temperature (K)";
+  input Modelica.Units.SI.Density rho "Density (kg/m3)";
 
-  output Modelica.SIunits.DynamicViscosity mu "Dynamic Viscosity (Pa.s)";
+  output Modelica.Units.SI.DynamicViscosity mu "Dynamic Viscosity (Pa.s)";
 
 protected
-  constant Modelica.SIunits.Temperature tnorm = 132.5 "kritikal temperature";
-  constant Modelica.SIunits.Density rhonorm = 314.3 "critical density";
+  constant Modelica.Units.SI.Temperature tnorm = 132.5 "kritikal temperature";
+  constant Modelica.Units.SI.Density rhonorm = 314.3 "critical density";
   constant Real H = 6.1609e-6;
   constant Real A1 = 0.128517;
   constant Real A05 = 2.60661;
@@ -25,16 +25,16 @@
   constant Real B3 = -0.511425;
   constant Real B4 = 0.2746;
   Real viscosityZeroDensity;
-  Modelica.SIunits.Temperature tReduced "dimensionless temperature";
-  Modelica.SIunits.Density rhoReduced "dimensionless density";
+  Modelica.Units.SI.Temperature tReduced "dimensionless temperature";
+  Modelica.Units.SI.Density rhoReduced "dimensionless density";
   Real residualViscosity;
 
-algorithm
- //viscosityZeroDensity:
-  tReduced := T/tnorm;
-  viscosityZeroDensity := A1*tReduced + A05*sqrt(tReduced) + A0 + A_1*tReduced^(-1) + A_2*tReduced^(-2) + A_3*tReduced^(-3) + A_4*tReduced^(-4);
- //residualViscosity:
-  rhoReduced := rho/rhonorm;
+algorithm
+//viscosityZeroDensity:
+  tReduced := T / tnorm;
+  viscosityZeroDensity := A1*tReduced + A05*sqrt(tReduced) + A0 + A_1*tReduced^(-1) + A_2*tReduced^(-2) + A_3*tReduced^(-3) + A_4*tReduced^(-4);
+//residualViscosity:
+  rhoReduced := rho / rhonorm;
   residualViscosity := B1*rhoReduced + B2*rhoReduced^2 + B3*rhoReduced^3 + B4*rhoReduced^4;
 
   mu := (viscosityZeroDensity + residualViscosity)*H;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/IsobaricExpansionCoefficient_T.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/IsobaricExpansionCoefficient_T.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/IsobaricExpansionCoefficient_T.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/IsobaricExpansionCoefficient_T.mo"	2022-03-10 09:58:45.984152738 +0000
@@ -2,10 +2,10 @@
 function IsobaricExpansionCoefficient_T
   "Isobaric Expansion Coefficient computation for Dry Air Ideal Gas (input T)"
 
-  input Modelica.SIunits.Temperature T "Temperature (K)";
-  output Modelica.SIunits.CubicExpansionCoefficient Beta
-    "Isobaric Expansion Coefficient (1/K)";
 
+  input Modelica.Units.SI.Temperature T "Temperature (K)";
+  output Modelica.Units.SI.CubicExpansionCoefficient Beta
+    "Isobaric Expansion Coefficient (1/K)";
 algorithm
   Beta := 1/T;
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/SpecificEnthalpy_T.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/SpecificEnthalpy_T.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/SpecificEnthalpy_T.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/SpecificEnthalpy_T.mo"	2022-03-10 09:58:45.980152738 +0000
@@ -3,14 +3,14 @@
   "Specific Enthalpy computation for Dry Air Ideal Gas (input T)"
   // STEPHANIE Dry Air Ideal Gas
 
-  input Modelica.SIunits.Temperature T "Temperature (K)";
-  output Modelica.SIunits.SpecificEnthalpy h "Specific Enthalpy (J/kg)";
+  input Modelica.Units.SI.Temperature T "Temperature (K)";
+  output Modelica.Units.SI.SpecificEnthalpy h "Specific Enthalpy (J/kg)";
 
 protected
   ThermoSysPro.Properties.DryAirIdealGas.DryAirIdealGas Data;
 
 algorithm
- //H(T)/RT = -a1*T^(-2) + a2*lnT/T + a3 + a4*T/2 + a5*T^(2)/3 + a6*T^(3)/4 + a7*T^(4)/5 + b1/T
+//H(T)/RT = -a1*T^(-2) + a2*lnT/T + a3 + a4*T/2 + a5*T^(2)/3 + a6*T^(3)/4 + a7*T^(4)/5 + b1/T
    h := (-Data.alow[1]*T^(-2) + Data.alow[2]*Modelica.Math.log(T)/T + Data.alow[3] + Data.alow[4]*T/2 + Data.alow[5]*T^(2)/3 + Data.alow[6]*T^(3)/4 + Data.alow[7]*T^(4)/5 + Data.blow[1]/T)*T*Data.specificGasConstant;
 
   annotation(derivative = derSpecificEnthalpy_derT, inverse(T = Temperature_h(h)));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/SpecificHeatCp_T.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/SpecificHeatCp_T.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/SpecificHeatCp_T.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/SpecificHeatCp_T.mo"	2022-03-10 09:58:45.976152737 +0000
@@ -3,15 +3,15 @@
   "Specific Heat Capacity at fixed P computation for Dry Air Ideal Gas (input T)"
   // STEPHANIE Dry Air Ideal Gas
 
-  input Modelica.SIunits.Temperature T "Temperature (K)";
-  output Modelica.SIunits.SpecificHeatCapacity Cp
+  input Modelica.Units.SI.Temperature T "Temperature (K)";
+  output Modelica.Units.SI.SpecificHeatCapacity Cp
     "Specific Heat Capacity (J/kg/K)";
 
 protected
   ThermoSysPro.Properties.DryAirIdealGas.DryAirIdealGas Data;
 
 algorithm
-  //Cp(T)/R = a1*T^(-2) + a2*T^(-1) + a3 + a4*T + a5*T^(2) + a6*T^(3) + a7*T^(4)
+//Cp(T)/R = a1*T^(-2) + a2*T^(-1) + a3 + a4*T + a5*T^(2) + a6*T^(3) + a7*T^(4)
   Cp := Data.specificGasConstant*(Data.alow[1]*T^(-2) + Data.alow[2]*T^(-1) + Data.alow[3] + Data.alow[4]*T + Data.alow[5]*T^(2) + Data.alow[6]*T^(3) + Data.alow[7]*T^(4));
 
   //annotation(inverse(temp = Temperature_cp(cp)), derivative = SpecificHeatCp_dert);
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/SpecificHeatCp_derT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/SpecificHeatCp_derT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/SpecificHeatCp_derT.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/SpecificHeatCp_derT.mo"	2022-03-10 09:58:45.968152736 +0000
@@ -2,7 +2,7 @@
 function SpecificHeatCp_derT
   "der(Specific Heat Capacity at fixed P) computation for Dry Air Ideal Gas (inputs: T, der(T))"
 
-  input Modelica.SIunits.Temperature T "Temperature (K)";
+  input Modelica.Units.SI.Temperature T "Temperature (K)";
   input Real der_T "Temperature time derivative (K/s)";
 
   output Real der_Cp "Specific Heat Capacity time derivative (J/kg/K/s)";
@@ -11,7 +11,7 @@
   ThermoSysPro.Properties.DryAirIdealGas.DryAirIdealGas Data;
 
 algorithm
-  //der_Cp(T) = (-2*a1*T^(-3) - a2*T^(-2) + a4 + 2*a5*T + 3*a6*T^(2) + 4*a7*T^(3))*R*der_temp;
+//der_Cp(T) = (-2*a1*T^(-3) - a2*T^(-2) + a4 + 2*a5*T + 3*a6*T^(2) + 4*a7*T^(3))*R*der_temp;
   der_Cp := (-2*Data.alow[1]*T^(-3) - Data.alow[2]*T^(-2) + Data.alow[4] + 2*Data.alow[5]*T + 3*Data.alow[6]*T^(2) + 4*Data.alow[7]*T^(3))*Data.specificGasConstant*der_T;
 
 end SpecificHeatCp_derT;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/Temperature_h.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/Temperature_h.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/Temperature_h.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/Temperature_h.mo"	2022-03-10 09:58:45.964152735 +0000
@@ -3,13 +3,12 @@
   "Temperature computation for Dry Air Ideal Gas (input h)"
   // STEPHANIE Dry Air Ideal Gas
 
-  input Modelica.SIunits.SpecificEnthalpy h "Specific Enthalpy (J/kg)";
-  output Modelica.SIunits.Temperature T "Temperature (K)";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific Enthalpy (J/kg)";
+  output Modelica.Units.SI.Temperature T "Temperature (K)";
 
 protected
   constant Real C[6] = {302.45170074922396, 0.0009955239553877519,-2.3667518904940937e-11,-1.6218505689880788e-16,1.5436079535175405e-22,-4.4309458281550505e-29};
-  //constants C[6] obtained from inverting SpecificEnthalpy_t (through polynomial fitting) it's not the exact inverse function!
-
+  //constants C[6] obtained from inverting SpecificEnthalpy_t (through polynomial fitting) it's not the exact inverse function!
 algorithm
   T := C[1] + C[2]*h + C[3]*h^2 + C[4]*h^3 + C[5]*h^4 + C[6]*h^5;
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/ThermalConductivity_Trho.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/ThermalConductivity_Trho.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/ThermalConductivity_Trho.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/ThermalConductivity_Trho.mo"	2022-03-10 09:58:45.956152734 +0000
@@ -4,15 +4,15 @@
   //valid up to 100MPa and 2000K, according to Kadoya et al. 1985 (Viscosity and Thermal Conductivity of Dry Air in the Gaseous Phase), Journal of Physical and Chemical Reference Data
   // STEPHANIE Dry Air Ideal Gas
 
-    input Modelica.SIunits.Temperature T "Temperature (K)";
-    input Modelica.SIunits.Density rho "Density (kg/m3)";
+    input Modelica.Units.SI.Temperature T "Temperature (K)";
+    input Modelica.Units.SI.Density rho "Density (kg/m3)";
 
-    output Modelica.SIunits.ThermalConductivity k
+    output Modelica.Units.SI.ThermalConductivity k
     "Thermal Conductivity (W/m/K)";
 
 protected
-    constant Modelica.SIunits.Temperature tnorm = 132.5 "critical temperature";
-    constant Modelica.SIunits.Density rhonorm = 314.3 "critical density";
+    constant Modelica.Units.SI.Temperature tnorm = 132.5 "critical temperature";
+    constant Modelica.Units.SI.Density rhonorm = 314.3 "critical density";
     constant Real lambda = 25.9778e-3;
     constant Real C1 = 0.239503;
     constant Real C05 = 0.00649768;
@@ -26,17 +26,17 @@
     constant Real D3 = -0.163159;
     constant Real D4 = 0.138059;
     constant Real D5 = -0.0201725;
-    Modelica.SIunits.Temperature tReduced "dimensionless temperature";
-    Modelica.SIunits.Density rhoReduced "dimensionless density";
+    Modelica.Units.SI.Temperature tReduced "dimensionless temperature";
+    Modelica.Units.SI.Density rhoReduced "dimensionless density";
     Real diluteConductivity;
     Real residualConductivity;
 
-algorithm
-     //dilute conductivity
-     tReduced := T/tnorm;
-     diluteConductivity := C1*tReduced + C05*sqrt(tReduced) + C0 + C_1*tReduced^(-1) + C_2*tReduced^(-2) + C_3*tReduced^(-3) + C_4*tReduced^(-4);
-     //residual conductivity
-     rhoReduced := rho/rhonorm;
+algorithm
+//dilute conductivity
+  tReduced := T / tnorm;
+     diluteConductivity := C1*tReduced + C05*sqrt(tReduced) + C0 + C_1*tReduced^(-1) + C_2*tReduced^(-2) + C_3*tReduced^(-3) + C_4*tReduced^(-4);
+//residual conductivity
+  rhoReduced := rho / rhonorm;
      residualConductivity := D1*rhoReduced + D2*rhoReduced^2 + D3*rhoReduced^3 + D4*rhoReduced^4 + D5*rhoReduced^5;
 
      k := (diluteConductivity + residualConductivity)*lambda;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/derDensity_derP_derT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/derDensity_derP_derT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/derDensity_derP_derT.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/derDensity_derP_derT.mo"	2022-03-10 09:58:45.948152734 +0000
@@ -3,8 +3,8 @@
   "der(Density) computation for Dry Air Ideal Gas (inputs: P, T, der(P), der(T))"
   // STEPHANIE Dry Air Ideal Gas
 
-  input Modelica.SIunits.Pressure P;
-  input Modelica.SIunits.Temperature T "Temperature (K)";
+  input Modelica.Units.SI.Pressure P;
+  input Modelica.Units.SI.Temperature T "Temperature (K)";
   input Real der_P "pressure time derivative (Pa/s)";
   input Real der_T "Temperature time derivative (K/s)";
 
@@ -14,8 +14,8 @@
   ThermoSysPro.Properties.DryAirIdealGas.DryAirIdealGas Data;
 
 algorithm
-//-> der_density = partial derivative of density with respect to pressure * der_pressure +
-//                 partial derivative of density with respect to temperature *der_temperature
+//-> der_density = partial derivative of density with respect to pressure * der_pressure +
+//                 partial derivative of density with respect to temperature *der_temperature
   der_rho := (1 / (Data.specificGasConstant * T)) * der_P + (- P / (Data.specificGasConstant * T^2)) * der_T;
 
 end derDensity_derP_derT;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/derDynamicViscosity_derT_derrho.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/derDynamicViscosity_derT_derrho.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/derDynamicViscosity_derT_derrho.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/derDynamicViscosity_derT_derrho.mo"	2022-03-10 09:58:45.944152733 +0000
@@ -3,16 +3,16 @@
   "der(Dynamic Viscosity) computation for Dry Air Ideal Gas (inputs: T, rho, der(T), der(rho))"
   // STEPHANIE Dry Air Ideal Gas
 
-  input Modelica.SIunits.Temperature T "Temperature (K)";
-  input Modelica.SIunits.Density rho "Density (kg/m3)";
+  input Modelica.Units.SI.Temperature T "Temperature (K)";
+  input Modelica.Units.SI.Density rho "Density (kg/m3)";
   input Real der_T "Temperature time derivative (K/s)";
   input Real der_rho "Density time derivative (kg/m3/s)";
 
   output Real der_mu "Dynamic Viscosity time derivative (Pa)";
 
 protected
-  constant Modelica.SIunits.Temperature tnorm = 132.5 "kritikal temperature";
-  constant Modelica.SIunits.Density rhonorm = 314.3 "critical density";
+  constant Modelica.Units.SI.Temperature tnorm = 132.5 "kritikal temperature";
+  constant Modelica.Units.SI.Density rhonorm = 314.3 "critical density";
   constant Real H = 6.1609e-6;
   constant Real A1 = 0.128517;
   constant Real A05 = 2.60661;
@@ -27,9 +27,8 @@
   constant Real B4 = 0.2746;
 
 algorithm
-    // der_mu = partial derivative of mu with respect to T times der_T + partial derivative of mu with respect to rho times der_rho
-    // der_mu = derivative of viscosityZeroDensity*H with respect to T times der_T + derivative of residualViscosity*H with respect to rho times der_rho
-
+// der_mu = partial derivative of mu with respect to T times der_T + partial derivative of mu with respect to rho times der_rho
+// der_mu = derivative of viscosityZeroDensity*H with respect to T times der_T + derivative of residualViscosity*H with respect to rho times der_rho
     der_mu := (H*(A1/tnorm + A05/(2*sqrt(T/tnorm)*tnorm) - (A_1*tnorm)/T^2 - (2*A_2*tnorm^2)/T^3 - (3*A_3*tnorm^3)/T^4 - (4*A_4*tnorm^4)/T^5))*der_T +
               (H*((4*B4*rho^3)/rhonorm^4 + (3*B3*rho^2)/rhonorm^3 + (2*B2*rho)/rhonorm^2 + B1/rhonorm))*der_rho;
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/derIsobaricExpansionCoefficient_derT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/derIsobaricExpansionCoefficient_derT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/derIsobaricExpansionCoefficient_derT.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/derIsobaricExpansionCoefficient_derT.mo"	2022-03-10 09:58:45.916152730 +0000
@@ -2,7 +2,7 @@
 function derIsobaricExpansionCoefficient_derT
   "der(Isobaric Expansion Coefficient) computation for Dry Air Ideal Gas (input T, der(T))"
 
-  input Modelica.SIunits.Temperature T "Temperature (K)";
+  input Modelica.Units.SI.Temperature T "Temperature (K)";
   input Real der_T "Temperature time derivative (K/s)";
 
   output Real der_Beta "isobaric expansion coefficient time derivative (1/Ks)";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/derSpecificEnthalpy_derT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/derSpecificEnthalpy_derT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/derSpecificEnthalpy_derT.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/derSpecificEnthalpy_derT.mo"	2022-03-10 09:58:45.912152729 +0000
@@ -3,7 +3,7 @@
   "der(SpecificEnthalpy) computation for Dry Air Ideal Gas (inputs: T, der(T))"
   // STEPHANIE Dry Air Ideal Gas
 
-    input Modelica.SIunits.Temperature T "Temperature (K)";
+    input Modelica.Units.SI.Temperature T "Temperature (K)";
     input Real der_T "Temperature time derivative (K/s)";
 
     output Real der_h "Specific Enthalpy time derivative (J/(kg*s))";
@@ -12,7 +12,7 @@
     ThermoSysPro.Properties.DryAirIdealGas.DryAirIdealGas Data;
 
 algorithm
-   // ideal gas: dh/dT = cp     ->  der_h = cp(T)*der_T
+// ideal gas: dh/dT = cp     ->  der_h = cp(T)*der_T
    der_h := Data.specificGasConstant*(Data.alow[1]*T^(-2) + Data.alow[2]*T^(-1) + Data.alow[3] + Data.alow[4]*T + Data.alow[5]*T^(2) + Data.alow[6]*T^(3) + Data.alow[7]*T^(4))*der_T;
 
 end derSpecificEnthalpy_derT;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/derTemperature_derh.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/derTemperature_derh.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/derTemperature_derh.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/derTemperature_derh.mo"	2022-03-10 09:58:45.904152729 +0000
@@ -3,7 +3,7 @@
   "der(Temperature) computation for Dry Air Ideal Gas (inputs: h, der(h))"
   // STEPHANIE Dry Air Ideal Gas
 
-  input Modelica.SIunits.SpecificEnthalpy h "Specific Enthalpy (J/kg)";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific Enthalpy (J/kg)";
   input Real der_h "Specific Enthalpy time derivative (J/(kg*s))";
 
   output Real der_T "Fluid temperature time derivative (K/s)";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/derThermalConductivity_derT_derrho.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/derThermalConductivity_derT_derrho.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/derThermalConductivity_derT_derrho.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/DryAirIdealGas/derThermalConductivity_derT_derrho.mo"	2022-03-10 09:58:45.900152727 +0000
@@ -3,16 +3,16 @@
   "der(Thermal Conductivity) computation for Dry Air Ideal Gas (inputs: T, rho, der(T), der(rho))"
   // STEPHANIE Dry Air Ideal Gas
 
-  input Modelica.SIunits.Temperature T "Temperature (K)";
-  input Modelica.SIunits.Density rho "Density (kg/m3)";
+  input Modelica.Units.SI.Temperature T "Temperature (K)";
+  input Modelica.Units.SI.Density rho "Density (kg/m3)";
   input Real der_T "Temperature time derivative (K/s)";
   input Real der_rho "Density time derivative (kg/m3/s)";
 
   output Real der_k "thermal conductivity time derivative (W/m/K/s)";
 
 protected
-    constant Modelica.SIunits.Temperature tnorm = 132.5 "critical temperature";
-    constant Modelica.SIunits.Density rhonorm = 314.3 "critical density";
+    constant Modelica.Units.SI.Temperature tnorm = 132.5 "critical temperature";
+    constant Modelica.Units.SI.Density rhonorm = 314.3 "critical density";
     constant Real lambda = 25.9778e-3;
     constant Real C1 = 0.239503;
     constant Real C05 = 0.00649768;
@@ -28,9 +28,8 @@
     constant Real D5 = -0.0201725;
 
 algorithm
-  // der_k = partial derivative of k with respect to T times der_T + partial derivative of k with respect to rho times der_rho
-  // der_k = derivative of diluteConductivity*lambda with respect to T times der_T + derivative of residualConductivity*lambda with respect to rho times der_rho
-
+// der_k = partial derivative of k with respect to T times der_T + partial derivative of k with respect to rho times der_rho
+// der_k = derivative of diluteConductivity*lambda with respect to T times der_T + derivative of residualConductivity*lambda with respect to rho times der_rho
     der_k := (lambda*(C1/tnorm + C05/(2*sqrt(T/tnorm)*tnorm) - (C_1*tnorm)/T^2 - (2*C_2*tnorm^2)/T^3 - (3*C_3*tnorm^3)/T^4 - (4*C_4*tnorm^4)/T^5))*der_T +
              (lambda*((5*D5*rho^4)/rhonorm^5 + (4*D4*rho^3)/rhonorm^4 + (3*D3*rho^2)/rhonorm^3 + (2*D2*rho)/rhonorm^2 + D1/rhonorm))*der_rho;
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/Absorb.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/Absorb.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/Absorb.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/Absorb.mo"	2022-03-10 09:58:45.884152726 +0000
@@ -1,11 +1,11 @@
 within ThermoSysPro.Properties.FlueGases;
 function Absorb "Flue gases - particles emissivity"
   extends ThermoSysPro.Properties.FlueGases.unsafeForJacobian;
-  input Modelica.SIunits.AbsolutePressure PC "CO2 partial pressure";
-  input Modelica.SIunits.AbsolutePressure PW "H2O partial pressure";
+  input Modelica.Units.SI.AbsolutePressure PC "CO2 partial pressure";
+  input Modelica.Units.SI.AbsolutePressure PW "H2O partial pressure";
   input Real FV "Volume concentration of the particules";
-  input Modelica.SIunits.Length L "Optical path";
-  input Modelica.SIunits.Temperature T "Temperature";
+  input Modelica.Units.SI.Length L "Optical path";
+  input Modelica.Units.SI.Temperature T "Temperature";
   output Real EG " ";
   output Real ES " ";
   output Real emigaz "Gas emissivity";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/EmissivGP.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/EmissivGP.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/EmissivGP.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/EmissivGP.mo"	2022-03-10 09:58:45.876152724 +0000
@@ -1,14 +1,14 @@
 within ThermoSysPro.Properties.FlueGases;
 function EmissivGP "Flue gases - particles emissivity"
   extends ThermoSysPro.Properties.FlueGases.unsafeForJacobian;
-  input Modelica.SIunits.Length AL "Equivalent length (radiation)";
-  input Modelica.SIunits.Temperature TMF "Flue gases average temperature";
-  input Modelica.SIunits.Temperature TPE "Wall temperature";
-  input Modelica.SIunits.AbsolutePressure PMEL "Mixture pressure";
-  input Modelica.SIunits.AbsolutePressure PH2O "H2O partial pressure";
-  input Modelica.SIunits.AbsolutePressure PCO2 "PCO2 partial pressure";
+  input Modelica.Units.SI.Length AL "Equivalent length (radiation)";
+  input Modelica.Units.SI.Temperature TMF "Flue gases average temperature";
+  input Modelica.Units.SI.Temperature TPE "Wall temperature";
+  input Modelica.Units.SI.AbsolutePressure PMEL "Mixture pressure";
+  input Modelica.Units.SI.AbsolutePressure PH2O "H2O partial pressure";
+  input Modelica.Units.SI.AbsolutePressure PCO2 "PCO2 partial pressure";
   input Real FV "Volume concentration of the particles in the flue gases";
-  input Modelica.SIunits.Length DP "Particles average diameter";
+  input Modelica.Units.SI.Length DP "Particles average diameter";
   input Real EPSPAR "Wall emissivity";
   output Real EPSFP "Particles/flue gases emissivity";
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_Absorb.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_Absorb.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_Absorb.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_Absorb.mo"	2022-03-10 09:58:45.872152725 +0000
@@ -1,11 +1,11 @@
 within ThermoSysPro.Properties.FlueGases;
 function FlueGases_Absorb "Flue gases - particles emissivity"
   extends ThermoSysPro.Properties.FlueGases.unsafeForJacobian;
-  input Modelica.SIunits.AbsolutePressure PC "CO2 partial pressure";
-  input Modelica.SIunits.AbsolutePressure PW "H2O partial pressure";
+  input Modelica.Units.SI.AbsolutePressure PC "CO2 partial pressure";
+  input Modelica.Units.SI.AbsolutePressure PW "H2O partial pressure";
   input Real FV "Volume concentration of the particles in the flue gases";
-  input Modelica.SIunits.Length L "Optical path";
-  input Modelica.SIunits.Temperature T "Temperature";
+  input Modelica.Units.SI.Length L "Optical path";
+  input Modelica.Units.SI.Temperature T "Temperature";
 
   output Real EG " ";
   output Real ES " ";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_T.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_T.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_T.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_T.mo"	2022-03-10 09:58:45.860152723 +0000
@@ -1,19 +1,19 @@
 within ThermoSysPro.Properties.FlueGases;
 function FlueGases_T "Temperature"
   //extends ThermoSysPro.Properties.FlueGases.unSafeForJacobian;
-  input Modelica.SIunits.AbsolutePressure PMF "Flue gases average pressure";
-  input Modelica.SIunits.SpecificEnthalpy HMF "Flue gases specific enthalpy";
+  input Modelica.Units.SI.AbsolutePressure PMF "Flue gases average pressure";
+  input Modelica.Units.SI.SpecificEnthalpy HMF "Flue gases specific enthalpy";
   input Real Xco2 "CO2 mass fraction";
   input Real Xh2o "H2O mass fraction";
   input Real Xo2 "O2 mass fraction";
   input Real Xso2 "SO2 mass fraction";
 
-  output Modelica.SIunits.Temperature T "Temperature";
+  output Modelica.Units.SI.Temperature T "Temperature";
 
 protected
   ThermoSysPro.Properties.ModelicaMediaFlueGases.ThermodynamicState state;
   ThermoSysPro.Properties.ModelicaMediaFlueGases.ThermodynamicState state0;
-  Modelica.SIunits.SpecificEnthalpy H0
+  Modelica.Units.SI.SpecificEnthalpy H0
     "Flue gases specific enthalpy at the reference state";
   Real Xn2 "N2 mass fraction";
   constant Real Hlat=2501.5999019e3 "Phase transition energy";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_Xtot.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_Xtot.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_Xtot.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_Xtot.mo"	2022-03-10 09:58:45.844152720 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Properties.FlueGases;
 function FlueGases_Xtot "Density"
-  input Modelica.SIunits.AbsolutePressure PMF "Flue gases average pressure";
-  input Modelica.SIunits.Temperature TMF "Flue gases average temperature";
+  input Modelica.Units.SI.AbsolutePressure PMF "Flue gases average pressure";
+  input Modelica.Units.SI.Temperature TMF "Flue gases average temperature";
   input Real Xco2 "CO2 mass fraction";
   input Real Xh2o "H2O mass fraction";
   input Real Xo2 "O2 mass fraction";
@@ -17,7 +17,7 @@
   Xn2 := 1 - Xco2 - Xh2o - Xo2 - Xso2;
 
   /* Computation of the thermodynamic state */
-  // state :=ThermoSysPro.Properties.ModelicaMediaFlueGases.setState_pTX(PMF, TMF, {Xn2,Xo2,Xh2o,Xco2,Xso2});
+// state :=ThermoSysPro.Properties.ModelicaMediaFlueGases.setState_pTX(PMF, TMF, {Xn2,Xo2,Xh2o,Xco2,Xso2});
   state.p := PMF;
   state.T := TMF;
   state.X := {Xn2,Xo2,Xh2o,Xco2,Xso2};
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_a.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_a.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_a.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_a.mo"	2022-03-10 09:58:45.832152718 +0000
@@ -1,13 +1,13 @@
 within ThermoSysPro.Properties.FlueGases;
 function FlueGases_a "Velocity of sound"
-  input Modelica.SIunits.AbsolutePressure PMF "Flue gases average pressure";
-  input Modelica.SIunits.Temperature TMF "Flue gases average temperature";
+  input Modelica.Units.SI.AbsolutePressure PMF "Flue gases average pressure";
+  input Modelica.Units.SI.Temperature TMF "Flue gases average temperature";
   input Real Xco2 "CO2 mass fraction";
   input Real Xh2o "H2O mass fraction";
   input Real Xo2 "O2 mass fraction";
   input Real Xso2 "SO2 mass fraction";
 
-  output Modelica.SIunits.Velocity a "Velocity of sound";
+  output Modelica.Units.SI.Velocity a "Velocity of sound";
 
 protected
   ThermoSysPro.Properties.ModelicaMediaFlueGases.ThermodynamicState state;
@@ -20,9 +20,8 @@
   state.p :=PMF;
   state.T :=TMF;
   state.X :={Xn2,Xo2,Xh2o,Xco2,Xso2};
-//  state := ThermoSysPro.Properties.ModelicaMediaFlueGases.setState_pTX(PMF, TMF, {Xn2,Xo2,Xh2o,Xco2,Xso2});
-
-  /* Computation of the velocity of sound */
+//  state := ThermoSysPro.Properties.ModelicaMediaFlueGases.setState_pTX(PMF, TMF, {Xn2,Xo2,Xh2o,Xco2,Xso2});
+/* Computation of the velocity of sound */
   a := ThermoSysPro.Properties.ModelicaMediaFlueGases.velocityOfSound(state);
 
   annotation (smoothOrder=2,Icon(graphics={
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_cp.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_cp.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_cp.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_cp.mo"	2022-03-10 09:58:45.820152717 +0000
@@ -1,13 +1,13 @@
 within ThermoSysPro.Properties.FlueGases;
 function FlueGases_cp "Specific heat capacity"
-  input Modelica.SIunits.AbsolutePressure PMF "Flue gases average pressure";
-  input Modelica.SIunits.Temperature TMF "Flue gases average temperature";
+  input Modelica.Units.SI.AbsolutePressure PMF "Flue gases average pressure";
+  input Modelica.Units.SI.Temperature TMF "Flue gases average temperature";
   input Real Xco2 "CO2 mass fraction";
   input Real Xh2o "H2O mass fraction";
   input Real Xo2 "O2 mass fraction";
   input Real Xso2 "SO2 mass fraction";
 
-  output Modelica.SIunits.SpecificHeatCapacity cp "Specific heat capacity";
+  output Modelica.Units.SI.SpecificHeatCapacity cp "Specific heat capacity";
 
 protected
   ThermoSysPro.Properties.ModelicaMediaFlueGases.ThermodynamicState state;
@@ -20,9 +20,8 @@
   state.p :=PMF;
   state.T :=TMF;
   state.X :={Xn2,Xo2,Xh2o,Xco2,Xso2};
-//  state := ThermoSysPro.Properties.ModelicaMediaFlueGases.setState_pTX(PMF, TMF, {Xn2,Xo2,Xh2o,Xco2,Xso2});
-
-  /* Computation of the specific heat capacity */
+//  state := ThermoSysPro.Properties.ModelicaMediaFlueGases.setState_pTX(PMF, TMF, {Xn2,Xo2,Xh2o,Xco2,Xso2});
+/* Computation of the specific heat capacity */
   cp := ThermoSysPro.Properties.ModelicaMediaFlueGases.specificHeatCapacityCp(state);
 
   annotation (smoothOrder=2,Icon(graphics={
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_cv.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_cv.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_cv.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_cv.mo"	2022-03-10 09:58:45.812152716 +0000
@@ -1,15 +1,15 @@
 within ThermoSysPro.Properties.FlueGases;
 function FlueGases_cv "Specific heat capacity at constant volume"
-  input Modelica.SIunits.AbsolutePressure PMF "Flue gases average pressure";
-  input Modelica.SIunits.Temperature TMF "Flue gases average temperature";
+  input Modelica.Units.SI.AbsolutePressure PMF "Flue gases average pressure";
+  input Modelica.Units.SI.Temperature TMF "Flue gases average temperature";
   input Real Xco2 "CO2 mass fraction";
   input Real Xh2o "H2O mass fraction";
   input Real Xo2 "O2 mass fraction";
   input Real Xso2 "SO2 mass fraction";
 
-  output Modelica.SIunits.SpecificHeatCapacity cv
-    "Specific heat capacity at constant volume";
 
+  output Modelica.Units.SI.SpecificHeatCapacity cv
+    "Specific heat capacity at constant volume";
 protected
   ThermoSysPro.Properties.ModelicaMediaFlueGases.ThermodynamicState state;
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_drhodh.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_drhodh.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_drhodh.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_drhodh.mo"	2022-03-10 09:58:45.804152715 +0000
@@ -1,22 +1,22 @@
 within ThermoSysPro.Properties.FlueGases;
 function FlueGases_drhodh
   "Derivative of the density wrt. the specific enthalpy at constant pressure"
-  input Modelica.SIunits.AbsolutePressure PMF "Flue gases average pressure";
-  input Modelica.SIunits.Temperature TMF "Flue gases average temperature";
+  input Modelica.Units.SI.AbsolutePressure PMF "Flue gases average pressure";
+  input Modelica.Units.SI.Temperature TMF "Flue gases average temperature";
   input Real Xco2 "CO2 mass fraction";
   input Real Xh2o "H2O mass fraction";
   input Real Xo2 "O2 mass fraction";
   input Real Xso2 "SO2 mass fraction";
 
-  output Modelica.SIunits.DerDensityByEnthalpy drhodh
+  output Modelica.Units.SI.DerDensityByEnthalpy drhodh
     "Derivative of the density wrt. the specific enthalpy at constant pressure";
 
 protected
   ThermoSysPro.Properties.ModelicaMediaFlueGases.ThermodynamicState state;
-  Modelica.SIunits.SpecificEntropy s "Flue gases specific entropy";
-  Modelica.SIunits.Density rho "Flue gaases density";
-  Modelica.SIunits.SpecificHeatCapacity cp "Specific heat capacity";
-  Modelica.SIunits.SpecificHeatCapacity R "gas constant";
+  Modelica.Units.SI.SpecificEntropy s "Flue gases specific entropy";
+  Modelica.Units.SI.Density rho "Flue gaases density";
+  Modelica.Units.SI.SpecificHeatCapacity cp "Specific heat capacity";
+  Modelica.Units.SI.SpecificHeatCapacity R "gas constant";
 
   Real Xn2 "N2 mass fraction";
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_drhodp.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_drhodp.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_drhodp.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_drhodp.mo"	2022-03-10 09:58:45.800152714 +0000
@@ -1,22 +1,22 @@
 within ThermoSysPro.Properties.FlueGases;
 function FlueGases_drhodp
   "Derivative of the density wrt. the pressure at constant specific enthalpy"
-  input Modelica.SIunits.AbsolutePressure PMF "Flue gases average pressure";
-  input Modelica.SIunits.Temperature TMF "Flue gases average temperature";
+  input Modelica.Units.SI.AbsolutePressure PMF "Flue gases average pressure";
+  input Modelica.Units.SI.Temperature TMF "Flue gases average temperature";
   input Real Xco2 "CO2 mass fraction";
   input Real Xh2o "H2O mass fraction";
   input Real Xo2 "O2 mass fraction";
   input Real Xso2 "SO2 mass fraction";
 
-  output Modelica.SIunits.DerDensityByPressure drhodp
+  output Modelica.Units.SI.DerDensityByPressure drhodp
     "Derivative of the density wrt. the pressure at constant specific enthalpy";
 
 protected
   ThermoSysPro.Properties.ModelicaMediaFlueGases.ThermodynamicState state;
-  Modelica.SIunits.SpecificEntropy s "Flue gases specific entropy";
-  Modelica.SIunits.Density rho "Flue gaases density";
-  Modelica.SIunits.SpecificHeatCapacity cp "Specific heat capacity";
-  Modelica.SIunits.SpecificHeatCapacity R "gas constant";
+  Modelica.Units.SI.SpecificEntropy s "Flue gases specific entropy";
+  Modelica.Units.SI.Density rho "Flue gaases density";
+  Modelica.Units.SI.SpecificHeatCapacity cp "Specific heat capacity";
+  Modelica.Units.SI.SpecificHeatCapacity R "gas constant";
 
   Real Xn2 "N2 mass fraction";
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_h.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_h.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_h.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_h.mo"	2022-03-10 09:58:45.792152714 +0000
@@ -1,13 +1,13 @@
-﻿within ThermoSysPro.Properties.FlueGases;
+within ThermoSysPro.Properties.FlueGases;
 function FlueGases_h "Specific enthalpy"
-  input Modelica.SIunits.AbsolutePressure PMF "Flue gases average pressure";
-  input Modelica.SIunits.Temperature TMF "Flue gases average temperature";
+  input Modelica.Units.SI.AbsolutePressure PMF "Flue gases average pressure";
+  input Modelica.Units.SI.Temperature TMF "Flue gases average temperature";
   input Real Xco2 "CO2 mass fraction";
   input Real Xh2o "H2O mass fraction";
   input Real Xo2 "O2 mass fraction";
   input Real Xso2 "SO2 mass fraction";
 
-  output Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+  output Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
 
 protected
   ThermoSysPro.Properties.ModelicaMediaFlueGases.ThermodynamicState state;
@@ -20,19 +20,15 @@
   /* Computation of the thermodynamic state */
   state.p :=PMF;
   state.T :=TMF;
-  state.X :={Xn2,Xo2,Xh2o,Xco2,Xso2};
-  //state := ThermoSysPro.Properties.ModelicaMediaFlueGases.setState_pTX(PMF, TMF, {Xn2,Xo2,Xh2o,Xco2,Xso2});
-
-  /* Computation of the reference thermodynamic state */
-  state0.p :=0.006112*1e5;
+  state.X :={Xn2,Xo2,Xh2o,Xco2,Xso2};
+//state := ThermoSysPro.Properties.ModelicaMediaFlueGases.setState_pTX(PMF, TMF, {Xn2,Xo2,Xh2o,Xco2,Xso2});
+/* Computation of the reference thermodynamic state */
+  state0.p := 0.006112 * 1e5;
   state0.T :=273.16;
-  state0.X :={Xn2,Xo2,Xh2o,Xco2,Xso2};
-  //state0 := ThermoSysPro.Properties.ModelicaMediaFlueGases.setState_pTX(0.006112*1e5, 273.16, {Xn2,Xo2,Xh2o,Xco2,Xso2});
-
-  /* Computation of the specific enthalpy minus a reference at (0.006112 bars, 0.01°C) */
-  h := ThermoSysPro.Properties.ModelicaMediaFlueGases.specificEnthalpy(state)
-       - ThermoSysPro.Properties.ModelicaMediaFlueGases.specificEnthalpy(state0) + Xh2o*Hlat;
-
+  state0.X :={Xn2,Xo2,Xh2o,Xco2,Xso2};
+//state0 := ThermoSysPro.Properties.ModelicaMediaFlueGases.setState_pTX(0.006112*1e5, 273.16, {Xn2,Xo2,Xh2o,Xco2,Xso2});
+/* Computation of the specific enthalpy minus a reference at (0.006112 bars, 0.01°C) */
+  h := ThermoSysPro.Properties.ModelicaMediaFlueGases.specificEnthalpy(state) - ThermoSysPro.Properties.ModelicaMediaFlueGases.specificEnthalpy(state0) + Xh2o * Hlat;
   annotation (smoothOrder=2,  Icon(graphics={
         Text(extent={{-136,102},{140,42}}, textString=
                                                "%name"),
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_h_Ps.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_h_Ps.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_h_Ps.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_h_Ps.mo"	2022-03-10 09:58:45.784152713 +0000
@@ -1,21 +1,21 @@
-﻿within ThermoSysPro.Properties.FlueGases;
+within ThermoSysPro.Properties.FlueGases;
 function FlueGases_h_Ps "Specific enthalpy"
   //extends ThermoSysPro.Properties.FlueGases.unSafeForJacobian;
 
-  input Modelica.SIunits.AbsolutePressure PMF "Flue gases average pressure";
-  input Modelica.SIunits.SpecificEntropy SMF
+  input Modelica.Units.SI.AbsolutePressure PMF "Flue gases average pressure";
+  input Modelica.Units.SI.SpecificEntropy SMF
     "Flue gases average specific entropy";
   input Real Xco2 "CO2 mass fraction";
   input Real Xh2o "H2O mass fraction";
   input Real Xo2 "O2 mass fraction";
   input Real Xso2 "SO2 mass fraction";
 
-  output Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+  output Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
 
 protected
   ThermoSysPro.Properties.ModelicaMediaFlueGases.ThermodynamicState state;
   ThermoSysPro.Properties.ModelicaMediaFlueGases.ThermodynamicState state0;
-  Modelica.SIunits.SpecificEntropy S0;
+  Modelica.Units.SI.SpecificEntropy S0;
   Real Xn2 "N2 mass fraction";
   constant Real Hlat=2501.5999019e3 "Phase transition energy";
   constant Real Slat=9.157461e3 "Phase transition entropy";
@@ -27,7 +27,7 @@
   state0.p :=0.006112*1e5;
   state0.T :=273.16;
   state0.X :={Xn2,Xo2,Xh2o,Xco2,Xso2};
-//  state0 := ThermoSysPro.Properties.ModelicaMediaFlueGases.setState_pTX(0.006112*1e5, 273.16, {Xn2,Xo2,Xh2o,Xco2,Xso2});
+//  state0 := ThermoSysPro.Properties.ModelicaMediaFlueGases.setState_pTX(0.006112*1e5, 273.16, {Xn2,Xo2,Xh2o,Xco2,Xso2});
   S0 :=ThermoSysPro.Properties.ModelicaMediaFlueGases.specificEntropy(state0);
 
   /* Computation of the thermodynamic state */
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_k.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_k.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_k.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_k.mo"	2022-03-10 09:58:45.776152713 +0000
@@ -1,13 +1,13 @@
 within ThermoSysPro.Properties.FlueGases;
 function FlueGases_k "Thermal conductivity"
-  input Modelica.SIunits.AbsolutePressure PMF "Flue gases average pressure";
-  input Modelica.SIunits.Temperature TMF "Flue gases average temperature";
+  input Modelica.Units.SI.AbsolutePressure PMF "Flue gases average pressure";
+  input Modelica.Units.SI.Temperature TMF "Flue gases average temperature";
   input Real Xco2 "CO2 mass fraction";
   input Real Xh2o "H2O mass fraction";
   input Real Xo2 "O2 mass fraction";
   input Real Xso2 "SO2 mass fraction";
 
-  output Modelica.SIunits.ThermalConductivity k "Thermal conductivity";
+  output Modelica.Units.SI.ThermalConductivity k "Thermal conductivity";
 
 protected
   ThermoSysPro.Properties.ModelicaMediaFlueGases.ThermodynamicState state;
@@ -20,9 +20,8 @@
   state.p :=PMF;
   state.T :=TMF;
   state.X :={Xn2,Xo2,Xh2o,Xco2,Xso2};
-//  state :=ThermoSysPro.Properties.ModelicaMediaFlueGases.setState_pTX(PMF, TMF, {Xn2,Xo2,Xh2o,Xco2,Xso2});
-
-  /* Computation of the thermal conductivity */
+//  state :=ThermoSysPro.Properties.ModelicaMediaFlueGases.setState_pTX(PMF, TMF, {Xn2,Xo2,Xh2o,Xco2,Xso2});
+/* Computation of the thermal conductivity */
   k := ThermoSysPro.Properties.ModelicaMediaFlueGases.thermalConductivity(state);
 
   annotation (smoothOrder=2,Icon(graphics={
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_mu.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_mu.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_mu.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_mu.mo"	2022-03-10 09:58:45.772152711 +0000
@@ -1,13 +1,13 @@
 within ThermoSysPro.Properties.FlueGases;
 function FlueGases_mu "Dynamic viscosity"
-  input Modelica.SIunits.AbsolutePressure PMF "Flue gases average pressure";
-  input Modelica.SIunits.Temperature TMF "Flue gases average temperature";
+  input Modelica.Units.SI.AbsolutePressure PMF "Flue gases average pressure";
+  input Modelica.Units.SI.Temperature TMF "Flue gases average temperature";
   input Real Xco2 "CO2 mass fraction";
   input Real Xh2o "H2O mass fraction";
   input Real Xo2 "O2 mass fraction";
   input Real Xso2 "SO2 mass fraction";
 
-  output Modelica.SIunits.DynamicViscosity mu "Dynamic viscosity";
+  output Modelica.Units.SI.DynamicViscosity mu "Dynamic viscosity";
 
 protected
   ThermoSysPro.Properties.ModelicaMediaFlueGases.ThermodynamicState state;
@@ -20,9 +20,8 @@
   state.p :=PMF;
   state.T :=TMF;
   state.X :={Xn2,Xo2,Xh2o,Xco2,Xso2};
-//  state :=ThermoSysPro.Properties.ModelicaMediaFlueGases.setState_pTX(PMF, TMF, {Xn2,Xo2,Xh2o,Xco2,Xso2});
-
-  /* Computation of the dynamic viscosity */
+//  state :=ThermoSysPro.Properties.ModelicaMediaFlueGases.setState_pTX(PMF, TMF, {Xn2,Xo2,Xh2o,Xco2,Xso2});
+/* Computation of the dynamic viscosity */
   mu := ThermoSysPro.Properties.ModelicaMediaFlueGases.dynamicViscosity(state);
 
   annotation (smoothOrder=2,Icon(graphics={
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_rho.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_rho.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_rho.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_rho.mo"	2022-03-10 09:58:45.764152711 +0000
@@ -1,49 +1,35 @@
 within ThermoSysPro.Properties.FlueGases;
 function FlueGases_rho "Density"
-  input Modelica.SIunits.AbsolutePressure PMF "Flue gases average pressure";
-  input Modelica.SIunits.Temperature TMF "Flue gases average temperature";
+  input Modelica.Units.SI.AbsolutePressure PMF "Flue gases average pressure";
+  input Modelica.Units.SI.Temperature TMF "Flue gases average temperature";
   input Real Xco2 "CO2 mass fraction";
   input Real Xh2o "H2O mass fraction";
   input Real Xo2 "O2 mass fraction";
   input Real Xso2 "SO2 mass fraction";
 
-  output Modelica.SIunits.Density rho "Density";
+  output Modelica.Units.SI.Density rho "Density";
 
 protected
   ThermoSysPro.Properties.ModelicaMediaFlueGases.ThermodynamicState state;
   Real Xn2 "N2 mass fraction";
 
 algorithm
-  Xn2 := 1 - Xco2 - Xh2o - Xo2 - Xso2;
-
-  /* Computation of the thermodynamic state */
-//  state :=ThermoSysPro.Properties.ModelicaMediaFlueGases.setState_pTX(PMF, TMF, {Xn2,Xo2,Xh2o,Xco2,Xso2});
+  Xn2 := 1 - Xco2 - Xh2o - Xo2 - Xso2;
+/* Computation of the thermodynamic state */
+//  state :=ThermoSysPro.Properties.ModelicaMediaFlueGases.setState_pTX(PMF, TMF, {Xn2,Xo2,Xh2o,Xco2,Xso2});
   state.p := PMF;
   state.T := TMF;
-  state.X := {Xn2,Xo2,Xh2o,Xco2,Xso2};
-
-  /* Computation of the density */
-  //rho := state.p/((state.X*ThermoSysPro.Properties.ModelicaMediaFlueGases.data.R)*state.T);
-  rho := ThermoSysPro.Properties.ModelicaMediaFlueGases.density(state)
-  annotation (smoothOrder=2,  Icon(graphics={
-        Text(extent={{-136,102},{140,42}}, textString=
-                                               "%name"),
-        Ellipse(
-          extent={{-100,40},{100,-100}},
-          lineColor={255,127,0},
-          fillColor={255,255,255},
-          fillPattern=FillPattern.Solid),
-        Text(
-          extent={{-84,-4},{84,-52}},
-          lineColor={255,127,0},
-          textString=
-               "function")}),
-                           Documentation(info="<html>
+  state.X := {Xn2,Xo2,Xh2o,Xco2,Xso2};
+/* Computation of the density */
+//rho := state.p/((state.X*ThermoSysPro.Properties.ModelicaMediaFlueGases.data.R)*state.T);
+  rho := ThermoSysPro.Properties.ModelicaMediaFlueGases.density(state) annotation(
+    smoothOrder = 2,
+    Icon(graphics = {Text(extent = {{-136, 102}, {140, 42}}, textString = "%name"), Ellipse(extent = {{-100, 40}, {100, -100}}, lineColor = {255, 127, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-84, -4}, {84, -52}}, lineColor = {255, 127, 0}, textString = "function")}),
+    Documentation(info = "<html>
 <p><b>Copyright &copy; EDF 2002 - 2010</b></p>
 </HTML>
 <html>
 <p><b>ThermoSysPro Version 2.0</b></p>
 </HTML>
-"));
-
+    "));
 end FlueGases_rho;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_s.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_s.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_s.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/FlueGases_s.mo"	2022-03-10 09:58:45.756152709 +0000
@@ -1,13 +1,13 @@
-﻿within ThermoSysPro.Properties.FlueGases;
+within ThermoSysPro.Properties.FlueGases;
 function FlueGases_s "Specific entropy"
-  input Modelica.SIunits.AbsolutePressure PMF "Flue gases average pressure";
-  input Modelica.SIunits.Temperature TMF "Flue gases average temperature";
+  input Modelica.Units.SI.AbsolutePressure PMF "Flue gases average pressure";
+  input Modelica.Units.SI.Temperature TMF "Flue gases average temperature";
   input Real Xco2 "CO2 mass fraction";
   input Real Xh2o "H2O mass fraction";
   input Real Xo2 "O2 mass fraction";
   input Real Xso2 "SO2 mass fraction";
 
-  output Modelica.SIunits.SpecificEntropy s "Specific entropy";
+  output Modelica.Units.SI.SpecificEntropy s "Specific entropy";
 
 protected
   ThermoSysPro.Properties.ModelicaMediaFlueGases.ThermodynamicState state;
@@ -21,19 +21,15 @@
   /* Computation of the thermodynamic state */
   state.p :=PMF;
   state.T :=TMF;
-  state.X :={Xn2,Xo2,Xh2o,Xco2,Xso2};
-//  state :=ThermoSysPro.Properties.ModelicaMediaFlueGases.setState_pTX(PMF, TMF, {Xn2,Xo2,Xh2o,Xco2,Xso2});
-
-  /* Computation of the reference thermodynamic state */
-  state0.p :=0.006112*1e5;
+  state.X :={Xn2,Xo2,Xh2o,Xco2,Xso2};
+//  state :=ThermoSysPro.Properties.ModelicaMediaFlueGases.setState_pTX(PMF, TMF, {Xn2,Xo2,Xh2o,Xco2,Xso2});
+/* Computation of the reference thermodynamic state */
+  state0.p := 0.006112 * 1e5;
   state0.T :=273.16;
-  state0.X :={Xn2,Xo2,Xh2o,Xco2,Xso2};
-//  state0 := ThermoSysPro.Properties.ModelicaMediaFlueGases.setState_pTX(0.006112*1e5, 273.16, {Xn2,Xo2,Xh2o,Xco2,Xso2});
-
-  /* Computation of the specific entropy minus a reference at (0.006112 bars, 0.01°C) */
-  s := ThermoSysPro.Properties.ModelicaMediaFlueGases.specificEntropy(state)
-       -ThermoSysPro.Properties.ModelicaMediaFlueGases.specificEntropy(state0) + Xh2o*Slat;
-
+  state0.X :={Xn2,Xo2,Xh2o,Xco2,Xso2};
+//  state0 := ThermoSysPro.Properties.ModelicaMediaFlueGases.setState_pTX(0.006112*1e5, 273.16, {Xn2,Xo2,Xh2o,Xco2,Xso2});
+/* Computation of the specific entropy minus a reference at (0.006112 bars, 0.01°C) */
+  s := ThermoSysPro.Properties.ModelicaMediaFlueGases.specificEntropy(state) - ThermoSysPro.Properties.ModelicaMediaFlueGases.specificEntropy(state0) + Xh2o * Slat;
   annotation (smoothOrder=2,Icon(graphics={
         Text(extent={{-136,102},{140,42}}, textString=
                                                "%name"),
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/XSat.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/XSat.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/XSat.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/FlueGases/XSat.mo"	2022-03-10 09:58:45.748152708 +0000
@@ -1,11 +1,11 @@
-﻿within ThermoSysPro.Properties.FlueGases;
+within ThermoSysPro.Properties.FlueGases;
 function XSat
 //---------------------------------------------------------------------------
 // Fonction  de l'humidité absolue a saturation xs(T)
 // Tair en °K, attention formule avec T en °C
 //---------------------------------------------------------------------------
-  input Modelica.SIunits.Temperature Tair "Air temperature";
-  input Modelica.SIunits.AbsolutePressure Patm "Atmospheric pressure";
+  input Modelica.Units.SI.Temperature Tair "Air temperature";
+  input Modelica.Units.SI.AbsolutePressure Patm "Atmospheric pressure";
 
 public
   output Real xs "Humidity at the saturation point";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Density_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Density_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Density_Ph.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Density_Ph.mo"	2022-03-10 09:58:45.720152705 +0000
@@ -1,82 +1,51 @@
-﻿within ThermoSysPro.Properties.Fluid;
-function Density_Ph "Density computation for all fluids (inputs: P, h, fluid)"
-
-  input Modelica.SIunits.AbsolutePressure P "Pressure (Pa)";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
-  input Integer fluid
-    "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
-  input Integer mode "IF97 region - 0:automatic computation";
-  input Real Xco2 "CO2 mass fraction";
-  input Real Xh2o "H2O mass fraction";
-  input Real Xo2 "O2 mass fraction";
-  input Real Xso2 "SO2 mass fraction";
-
-  output Modelica.SIunits.Density rho "Density (kg/m3)";
-
-// fluid==1 - Water/Steam
-protected
-  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation (Placement(
-        transformation(extent={{-80,40},{-40,80}}, rotation=0)));
-
-algorithm
-  // Water/Steam
-  if fluid==1 then
-    pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(
-      P,
-      h,
-      mode);
-    rho:=pro.d;
-
-  // C3H3F5
-  elseif fluid==2 then
-    pro := ThermoSysPro.Properties.Fluid.Ph(P, h, mode,fluid);
-    rho := pro.d;
-
-  // FlueGas
-  elseif fluid==3 then
-    assert(Xco2+Xh2o+Xo2+Xso2>0, "Wrong mass fraction definition");  /// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
-    rho := ThermoSysPro.Properties.FlueGases.FlueGases_rho(
-      PMF=P,
-      TMF=ThermoSysPro.Properties.FlueGases.FlueGases_T(
-        PMF=P,
-        HMF=h,
-        Xco2=Xco2,
-        Xh2o=Xh2o,
-        Xo2=Xo2,
-        Xso2=Xso2),
-      Xco2=Xco2,
-      Xh2o=Xh2o,
-      Xo2=Xo2,
-      Xso2=Xso2);
-
-  // MoltenSalt
-  elseif fluid==4 then
-    rho := ThermoSysPro.Properties.MoltenSalt.Density_T(T=
-      ThermoSysPro.Properties.MoltenSalt.Temperature_h(h=h));
-
-  // Oil
-  elseif fluid==5 then
-    rho := ThermoSysPro.Properties.Oil_TherminolVP1.Density_T(temp=
-      ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h));
-
-  // Dry Air Ideal Gas
-  elseif fluid==6 then
-    rho := ThermoSysPro.Properties.DryAirIdealGas.Density_PT(P=P,
-      T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h));
-
-  // Water/Steam Simple
-  elseif  fluid==7 then
-    pro := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph(
-      P,
-      h,
-      mode);
-    rho:=pro.d;
-
-  else
-    assert(false, "incorrect fluid number");  ///
-  end if;
-
-  //LogVariable(P);
-
-  annotation(derivative=derDensity_derP_derh);
-end Density_Ph;
+within ThermoSysPro.Properties.Fluid;
+
+function Density_Ph "Density computation for all fluids (inputs: P, h, fluid)"
+  input Modelica.Units.SI.AbsolutePressure P "Pressure (Pa)";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+  input Integer fluid "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
+  input Integer mode "IF97 region - 0:automatic computation";
+  input Real Xco2 "CO2 mass fraction";
+  input Real Xh2o "H2O mass fraction";
+  input Real Xo2 "O2 mass fraction";
+  input Real Xso2 "SO2 mass fraction";
+  output Modelica.Units.SI.Density rho "Density (kg/m3)";
+  // fluid==1 - Water/Steam
+protected
+  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation(
+    Placement(transformation(extent = {{-80, 40}, {-40, 80}}, rotation = 0)));
+algorithm
+// Water/Steam
+  if fluid == 1 then
+    pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(P, h, mode);
+    rho := pro.d;
+  elseif fluid == 2 then
+    pro := ThermoSysPro.Properties.Fluid.Ph(P, h, mode, fluid);
+    rho := pro.d;
+  elseif fluid == 3 then
+    assert(Xco2 + Xh2o + Xo2 + Xso2 > 0, "Wrong mass fraction definition");
+    rho := ThermoSysPro.Properties.FlueGases.FlueGases_rho(PMF = P, TMF = ThermoSysPro.Properties.FlueGases.FlueGases_T(PMF = P, HMF = h, Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2), Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2);
+  elseif fluid == 4 then
+    rho := ThermoSysPro.Properties.MoltenSalt.Density_T(T = ThermoSysPro.Properties.MoltenSalt.Temperature_h(h = h));
+  elseif fluid == 5 then
+    rho := ThermoSysPro.Properties.Oil_TherminolVP1.Density_T(temp = ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h = h));
+  elseif fluid == 6 then
+    rho := ThermoSysPro.Properties.DryAirIdealGas.Density_PT(P = P, T = ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h = h));
+  elseif fluid == 7 then
+    pro := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph(P, h, mode);
+    rho := pro.d;
+  else
+    assert(false, "incorrect fluid number");
+  end if;
+// C3H3F5
+// FlueGas
+/// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
+// MoltenSalt
+// Oil
+// Dry Air Ideal Gas
+// Water/Steam Simple
+///
+//LogVariable(P);
+  annotation(
+    derivative = derDensity_derP_derh);
+end Density_Ph;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: Density_Ph.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: Density_Ph.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Density_derh_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Density_derh_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Density_derh_Ph.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Density_derh_Ph.mo"	2022-03-10 09:58:45.704152702 +0000
@@ -1,97 +1,59 @@
-﻿within ThermoSysPro.Properties.Fluid;
-function Density_derh_Ph
-  "Density derivative w.r.t enthalpy computation for all fluids (inputs: P, h, fluid)"
-
-  input Modelica.SIunits.AbsolutePressure P "Pressure (Pa)";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
-  input Integer fluid
-    "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
-  input Integer mode "IF97 region - 0:automatic computation";
-  input Real Xco2 "CO2 mass fraction";
-  input Real Xh2o "H2O mass fraction";
-  input Real Xo2 "O2 mass fraction";
-  input Real Xso2 "SO2 mass fraction";
-
-  output Modelica.SIunits.DerDensityByEnthalpy ddhp
-    "density derivative by enthalpy";
-
-// fluid==1 - Water/Steam
-protected
-  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation (Placement(
-        transformation(extent={{-80,40},{-40,80}}, rotation=0)));
-
-protected
-  Modelica.SIunits.SpecificEnthalpy delta_h = 0.01*h;
-
-///annotation(derivative=derDensity_derh_derP_derh);
-
-algorithm
-  // Water/Steam
-  if fluid==1 then
-    pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(
-      P,
-      h,
-      mode);
-    ddhp:=pro.ddhp;
-
-  // C3H3F5
-  elseif fluid==2 then
-    // u := ThermoSysPro.Properties.C3H3F5.SpecificInternalEnergy_Ph__NonFonctionnel(
-    //   P=P, h=h);
-    ddhp := -1e6;
-
-  // FlueGas
-  elseif fluid==3 then
-    assert(Xco2+Xh2o+Xo2+Xso2>0, "Wrong mass fraction definition");  /// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
-    ddhp := ThermoSysPro.Properties.FlueGases.FlueGases_drhodh(
-      PMF=P,
-      TMF=ThermoSysPro.Properties.FlueGases.FlueGases_T(
-        PMF=P,
-        HMF=h,
-        Xco2=Xco2,
-        Xh2o=Xh2o,
-        Xo2=Xo2,
-        Xso2=Xso2),
-      Xco2=Xco2,
-      Xh2o=Xh2o,
-      Xo2=Xo2,
-      Xso2=Xso2);
-
-   //ddhp := -1e6;
-
-  // MoltenSalt
-  elseif fluid==4 then
-    //ddhp := -1e6;
-    // u := ThermoSysPro.Properties.MoltenSalt.SpecificInternalEnergy_T__NonFonctionnel(
-    //   T=ThermoSysPro.Properties.MoltenSalt.Temperature_h(h=h));
-    ddhp := (ThermoSysPro.Properties.MoltenSalt.Density_T(T=ThermoSysPro.Properties.MoltenSalt.Temperature_h(h=h+delta_h))
-        -ThermoSysPro.Properties.MoltenSalt.Density_T(T=ThermoSysPro.Properties.MoltenSalt.Temperature_h(h=h-delta_h)))
-      /(2*delta_h);
-//  //
-
-  // Oil
-  elseif fluid==5 then
-//   ddhp := -1e2;
-   ddhp := (ThermoSysPro.Properties.Oil_TherminolVP1.Density_T(temp=ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h+delta_h))
-        -ThermoSysPro.Properties.Oil_TherminolVP1.Density_T(temp=ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h-delta_h)))
-      /(2*delta_h);
-//  //
-  // DryAirIdealGas
-  elseif fluid==6 then
-    ddhp := (ThermoSysPro.Properties.DryAirIdealGas.Density_PT(P=P, T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h+delta_h))
-        -ThermoSysPro.Properties.DryAirIdealGas.Density_PT(P=P, T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h-delta_h)))
-      /(2*delta_h);
-
-  // Water/Steam Simple
-  elseif  fluid==7 then
-    pro := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph(
-      P,
-      h,
-      mode);
-    ddhp:=pro.ddhp;
-
-  else
-    assert(false, "incorrect fluid number");  ///
-  end if;
-
-end Density_derh_Ph;
+within ThermoSysPro.Properties.Fluid;
+
+function Density_derh_Ph "Density derivative w.r.t enthalpy computation for all fluids (inputs: P, h, fluid)"
+  input Modelica.Units.SI.AbsolutePressure P "Pressure (Pa)";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+  input Integer fluid "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
+  input Integer mode "IF97 region - 0:automatic computation";
+  input Real Xco2 "CO2 mass fraction";
+  input Real Xh2o "H2O mass fraction";
+  input Real Xo2 "O2 mass fraction";
+  input Real Xso2 "SO2 mass fraction";
+  output Modelica.Units.SI.DerDensityByEnthalpy ddhp "density derivative by enthalpy";
+  // fluid==1 - Water/Steam
+protected
+  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation(
+    Placement(transformation(extent = {{-80, 40}, {-40, 80}}, rotation = 0)));
+protected
+  Modelica.Units.SI.SpecificEnthalpy delta_h = 0.01 * h;
+  ///annotation(derivative=derDensity_derh_derP_derh);
+algorithm
+// Water/Steam
+  if fluid == 1 then
+    pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(P, h, mode);
+    ddhp := pro.ddhp;
+  elseif fluid == 2 then
+    ddhp := -1e6;
+  elseif fluid == 3 then
+    assert(Xco2 + Xh2o + Xo2 + Xso2 > 0, "Wrong mass fraction definition");
+    ddhp := ThermoSysPro.Properties.FlueGases.FlueGases_drhodh(PMF = P, TMF = ThermoSysPro.Properties.FlueGases.FlueGases_T(PMF = P, HMF = h, Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2), Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2);
+  elseif fluid == 4 then
+    ddhp := (ThermoSysPro.Properties.MoltenSalt.Density_T(T = ThermoSysPro.Properties.MoltenSalt.Temperature_h(h = h + delta_h)) - ThermoSysPro.Properties.MoltenSalt.Density_T(T = ThermoSysPro.Properties.MoltenSalt.Temperature_h(h = h - delta_h))) / (2 * delta_h);
+  elseif fluid == 5 then
+    ddhp := (ThermoSysPro.Properties.Oil_TherminolVP1.Density_T(temp = ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h = h + delta_h)) - ThermoSysPro.Properties.Oil_TherminolVP1.Density_T(temp = ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h = h - delta_h))) / (2 * delta_h);
+  elseif fluid == 6 then
+    ddhp := (ThermoSysPro.Properties.DryAirIdealGas.Density_PT(P = P, T = ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h = h + delta_h)) - ThermoSysPro.Properties.DryAirIdealGas.Density_PT(P = P, T = ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h = h - delta_h))) / (2 * delta_h);
+  elseif fluid == 7 then
+    pro := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph(P, h, mode);
+    ddhp := pro.ddhp;
+  else
+    assert(false, "incorrect fluid number");
+  end if;
+// C3H3F5
+// u := ThermoSysPro.Properties.C3H3F5.SpecificInternalEnergy_Ph__NonFonctionnel(
+//   P=P, h=h);
+// FlueGas
+/// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
+//ddhp := -1e6;
+// MoltenSalt
+//ddhp := -1e6;
+// u := ThermoSysPro.Properties.MoltenSalt.SpecificInternalEnergy_T__NonFonctionnel(
+//   T=ThermoSysPro.Properties.MoltenSalt.Temperature_h(h=h));
+//  //
+// Oil
+//   ddhp := -1e2;
+//  //
+// DryAirIdealGas
+// Water/Steam Simple
+///
+end Density_derh_Ph;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: Density_derh_Ph.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: Density_derh_Ph.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Density_derp_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Density_derp_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Density_derp_Ph.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Density_derp_Ph.mo"	2022-03-10 09:58:45.652152696 +0000
@@ -1,96 +1,63 @@
-﻿within ThermoSysPro.Properties.Fluid;
-function Density_derp_Ph
-  "Density derivative w.r.t pressure computation for all fluids (inputs: P, h, fluid)"
-
-  input Modelica.SIunits.AbsolutePressure P "Pressure (Pa)";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
-  input Integer fluid
-    "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
-  input Integer mode "IF97 region - 0:automatic computation";
-  input Real Xco2 "CO2 mass fraction";
-  input Real Xh2o "H2O mass fraction";
-  input Real Xo2 "O2 mass fraction";
-  input Real Xso2 "SO2 mass fraction";
-
-  output Modelica.SIunits.DerDensityByPressure ddph
-    "density derivative by pressure";
-
-protected
-  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation (Placement(
-        transformation(extent={{-80,40},{-40,80}}, rotation=0)));
-
-protected
-  Modelica.SIunits.AbsolutePressure delta_P = 0.0001*P;
-
-algorithm
-  // Water/Steam
-  if fluid==1 then
-    pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(
-      P,
-      h,
-      mode);
-    ddph:=pro.ddph;
-
-  // C3H3F5
-
-  elseif fluid==2 then
-    // The properties are independents of the pressure
-    // **********************************************
-    // u := ThermoSysPro.Properties.C3H3F5.SpecificInternalEnergy_Ph__NonFonctionnel(
-    //   P=P, h=h);
-    ddph := 1e-8;
-
-  // FlueGas
-  elseif fluid==3 then
-    assert(Xco2+Xh2o+Xo2+Xso2>0, "Wrong mass fraction definition");  /// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
-    ddph := ThermoSysPro.Properties.FlueGases.FlueGases_drhodp(
-      PMF=P,
-      TMF=ThermoSysPro.Properties.FlueGases.FlueGases_T(
-        PMF=P,
-        HMF=h,
-        Xco2=Xco2,
-        Xh2o=Xh2o,
-        Xo2=Xo2,
-        Xso2=Xso2),
-      Xco2=Xco2,
-      Xh2o=Xh2o,
-      Xo2=Xo2,
-      Xso2=Xso2);
-
-  // MoltenSalt
-  elseif fluid==4 then
-    // The properties are independents of the pressure
-    // **********************************************
-    //ddph := 1/h;
-    ddph := 1e-8;
-    // u := ThermoSysPro.Properties.MoltenSalt.SpecificInternalEnergy_T__NonFonctionnel(
-    //   T=ThermoSysPro.Properties.MoltenSalt.Temperature_h(h=h));
-//
-  // Oil
-  elseif fluid==5 then
-    // The properties are independent of the pressure
-    // **********************************************
-    ddph := 1e-8;
-//    ddph := (ThermoSysPro.Properties.Oil_TherminolVP1.Density_t(temp=ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h))
-//        -ThermoSysPro.Properties.Oil_TherminolVP1.Density_t(temp=ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h)))
-//      /(2*delta_P) + 0.000001;
-
-  // DryAirIdealGas
-  elseif fluid==6 then
-    ddph := (ThermoSysPro.Properties.DryAirIdealGas.Density_PT(P=P+delta_P, T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h))
-        -ThermoSysPro.Properties.DryAirIdealGas.Density_PT(P=P-delta_P, T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h)))
-      /(2*delta_P);
-
-  // Water/Steam Simple
-  elseif  fluid==7 then
-    pro := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph(
-      P,
-      h,
-      mode);
-    ddph:=pro.ddph;
-
-  else
-    assert(false, "incorrect fluid number");  ///
-  end if;
-
-end Density_derp_Ph;
+within ThermoSysPro.Properties.Fluid;
+
+function Density_derp_Ph "Density derivative w.r.t pressure computation for all fluids (inputs: P, h, fluid)"
+  input Modelica.Units.SI.AbsolutePressure P "Pressure (Pa)";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+  input Integer fluid "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
+  input Integer mode "IF97 region - 0:automatic computation";
+  input Real Xco2 "CO2 mass fraction";
+  input Real Xh2o "H2O mass fraction";
+  input Real Xo2 "O2 mass fraction";
+  input Real Xso2 "SO2 mass fraction";
+  output Modelica.Units.SI.DerDensityByPressure ddph "density derivative by pressure";
+protected
+  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation(
+    Placement(transformation(extent = {{-80, 40}, {-40, 80}}, rotation = 0)));
+protected
+  Modelica.Units.SI.AbsolutePressure delta_P = 0.0001 * P;
+algorithm
+// Water/Steam
+  if fluid == 1 then
+    pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(P, h, mode);
+    ddph := pro.ddph;
+  elseif fluid == 2 then
+    ddph := 1e-8;
+  elseif fluid == 3 then
+    assert(Xco2 + Xh2o + Xo2 + Xso2 > 0, "Wrong mass fraction definition");
+    ddph := ThermoSysPro.Properties.FlueGases.FlueGases_drhodp(PMF = P, TMF = ThermoSysPro.Properties.FlueGases.FlueGases_T(PMF = P, HMF = h, Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2), Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2);
+  elseif fluid == 4 then
+    ddph := 1e-8;
+  elseif fluid == 5 then
+    ddph := 1e-8;
+  elseif fluid == 6 then
+    ddph := (ThermoSysPro.Properties.DryAirIdealGas.Density_PT(P = P + delta_P, T = ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h = h)) - ThermoSysPro.Properties.DryAirIdealGas.Density_PT(P = P - delta_P, T = ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h = h))) / (2 * delta_P);
+  elseif fluid == 7 then
+    pro := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph(P, h, mode);
+    ddph := pro.ddph;
+  else
+    assert(false, "incorrect fluid number");
+  end if;
+// C3H3F5
+// The properties are independents of the pressure
+// **********************************************
+// u := ThermoSysPro.Properties.C3H3F5.SpecificInternalEnergy_Ph__NonFonctionnel(
+//   P=P, h=h);
+// FlueGas
+/// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
+// MoltenSalt
+// The properties are independents of the pressure
+// **********************************************
+//ddph := 1/h;
+// u := ThermoSysPro.Properties.MoltenSalt.SpecificInternalEnergy_T__NonFonctionnel(
+//   T=ThermoSysPro.Properties.MoltenSalt.Temperature_h(h=h));
+//
+// Oil
+// The properties are independent of the pressure
+// **********************************************
+//    ddph := (ThermoSysPro.Properties.Oil_TherminolVP1.Density_t(temp=ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h))
+//        -ThermoSysPro.Properties.Oil_TherminolVP1.Density_t(temp=ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h)))
+//      /(2*delta_P) + 0.000001;
+// DryAirIdealGas
+// Water/Steam Simple
+///
+end Density_derp_Ph;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: Density_derp_Ph.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: Density_derp_Ph.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/DynamicViscosity_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/DynamicViscosity_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/DynamicViscosity_Ph.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/DynamicViscosity_Ph.mo"	2022-03-10 09:58:45.640152694 +0000
@@ -1,86 +1,53 @@
-﻿within ThermoSysPro.Properties.Fluid;
-function DynamicViscosity_Ph
-  "Dynamic Viscosity computation for all fluids (inputs: P, h, fluid)"
-
-  input Modelica.SIunits.AbsolutePressure P "Pressure (Pa)";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
-  input Integer fluid
-    "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
-  input Integer mode "IF97 region - 0:automatic computation";
-  input Real Xco2 "CO2 mass fraction";
-  input Real Xh2o "H2O mass fraction";
-  input Real Xo2 "O2 mass fraction";
-  input Real Xso2 "SO2 mass fraction";
-
-  output Modelica.SIunits.DynamicViscosity mu "Dynamic Viscosity (Pa.s)";
-
-// fluid==1 - Water/Steam
-protected
-  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation (Placement(
-        transformation(extent={{-80,40},{-40,80}}, rotation=0)));
-
-algorithm
-  // Water/Steam  /// FONCTIONNE EN DIPHASIQUE ???
-  if fluid==1 then
-    pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(
-      P,
-      h,
-      mode);
-    mu := ThermoSysPro.Properties.WaterSteam.IF97.DynamicViscosity_rhoT(rho=pro.d,T=pro.T);
-
-  // C3H3F5
-  elseif fluid==2 then
-    pro := ThermoSysPro.Properties.C3H3F5.C3H3F5_Ph(P=P, h=h);
-    //LogVariable(pro.x);
-    mu:= if pro.x < 1 then 0.0004 else 0.00001;
-    //assert(false, "??????????  fluid = 2: the function DynamicViscosity_Ph is not available; incorrect option ?????????");
-    //mu := 0.00001;
-
-  // FlueGas
-  elseif fluid==3 then
-    assert(Xco2+Xh2o+Xo2+Xso2>0, "Wrong mass fraction definition");  /// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
-    mu := ThermoSysPro.Properties.FlueGases.FlueGases_mu(
-      PMF=P,
-      TMF=ThermoSysPro.Properties.FlueGases.FlueGases_T(
-        PMF=P,
-        HMF=h,
-        Xco2=Xco2,
-        Xh2o=Xh2o,
-        Xo2=Xo2,
-        Xso2=Xso2),
-      Xco2=Xco2,
-      Xh2o=Xh2o,
-      Xo2=Xo2,
-      Xso2=Xso2);
-
-  // MoltenSalt
-  elseif fluid==4 then
-    mu := ThermoSysPro.Properties.MoltenSalt.DynamicViscosity_T(T=
-      ThermoSysPro.Properties.MoltenSalt.Temperature_h(h=h));
-
-  // Oil
-  elseif fluid==5 then
-    mu := ThermoSysPro.Properties.Oil_TherminolVP1.DynamicViscosity_T(temp=
-      ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h));
-
-  // Dry Air Ideal Gas
-  elseif fluid==6 then
-    mu := ThermoSysPro.Properties.DryAirIdealGas.DynamicViscosity_Trho(
-      T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h),
-      rho=ThermoSysPro.Properties.DryAirIdealGas.Density_PT(
-        P=P, T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h)));
-
-  // Water/Steam  /// Simple
-  elseif fluid==7 then
-    pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(
-      P,
-      h,
-      mode);
-    mu := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.DynamicViscosity_rhoT(rho=pro.d,T=pro.T);
-
-  else
-    assert(false, "incorrect fluid number");  ///
-  end if;
-
-  annotation(derivative=derDynamicViscosity_derP_derh);
-end DynamicViscosity_Ph;
+within ThermoSysPro.Properties.Fluid;
+
+function DynamicViscosity_Ph "Dynamic Viscosity computation for all fluids (inputs: P, h, fluid)"
+  input Modelica.Units.SI.AbsolutePressure P "Pressure (Pa)";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+  input Integer fluid "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
+  input Integer mode "IF97 region - 0:automatic computation";
+  input Real Xco2 "CO2 mass fraction";
+  input Real Xh2o "H2O mass fraction";
+  input Real Xo2 "O2 mass fraction";
+  input Real Xso2 "SO2 mass fraction";
+  output Modelica.Units.SI.DynamicViscosity mu "Dynamic Viscosity (Pa.s)";
+  // fluid==1 - Water/Steam
+protected
+  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation(
+    Placement(transformation(extent = {{-80, 40}, {-40, 80}}, rotation = 0)));
+algorithm
+// Water/Steam  /// FONCTIONNE EN DIPHASIQUE ???
+  if fluid == 1 then
+    pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(P, h, mode);
+    mu := ThermoSysPro.Properties.WaterSteam.IF97.DynamicViscosity_rhoT(rho = pro.d, T = pro.T);
+  elseif fluid == 2 then
+    pro := ThermoSysPro.Properties.C3H3F5.C3H3F5_Ph(P = P, h = h);
+    mu := if pro.x < 1 then 0.0004 else 0.00001;
+  elseif fluid == 3 then
+    assert(Xco2 + Xh2o + Xo2 + Xso2 > 0, "Wrong mass fraction definition");
+    mu := ThermoSysPro.Properties.FlueGases.FlueGases_mu(PMF = P, TMF = ThermoSysPro.Properties.FlueGases.FlueGases_T(PMF = P, HMF = h, Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2), Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2);
+  elseif fluid == 4 then
+    mu := ThermoSysPro.Properties.MoltenSalt.DynamicViscosity_T(T = ThermoSysPro.Properties.MoltenSalt.Temperature_h(h = h));
+  elseif fluid == 5 then
+    mu := ThermoSysPro.Properties.Oil_TherminolVP1.DynamicViscosity_T(temp = ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h = h));
+  elseif fluid == 6 then
+    mu := ThermoSysPro.Properties.DryAirIdealGas.DynamicViscosity_Trho(T = ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h = h), rho = ThermoSysPro.Properties.DryAirIdealGas.Density_PT(P = P, T = ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h = h)));
+  elseif fluid == 7 then
+    pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(P, h, mode);
+    mu := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.DynamicViscosity_rhoT(rho = pro.d, T = pro.T);
+  else
+    assert(false, "incorrect fluid number");
+  end if;
+// C3H3F5
+//LogVariable(pro.x);
+//assert(false, "??????????  fluid = 2: the function DynamicViscosity_Ph is not available; incorrect option ?????????");
+//mu := 0.00001;
+// FlueGas
+/// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
+// MoltenSalt
+// Oil
+// Dry Air Ideal Gas
+// Water/Steam  /// Simple
+///
+  annotation(
+    derivative = derDynamicViscosity_derP_derh);
+end DynamicViscosity_Ph;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: DynamicViscosity_Ph.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: DynamicViscosity_Ph.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/DynamicViscosity_rhoT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/DynamicViscosity_rhoT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/DynamicViscosity_rhoT.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/DynamicViscosity_rhoT.mo"	2022-03-10 09:58:45.628152693 +0000
@@ -1,33 +1,25 @@
-within ThermoSysPro.Properties.Fluid;
-function DynamicViscosity_rhoT
-  "Dynamic Viscosity computation for all fluids (inputs: rho,T,fluid)"
-
-  input Modelica.SIunits.Density rho "Density";
-  input Modelica.SIunits.Temperature T "Temperature";
-  input Integer fluid
-    "<html>Fluid number: <br>1 - Water/Steam  <br>7 - WaterSteamSimple </html>";
-
-  output Modelica.SIunits.DynamicViscosity mu "Dynamic Viscosity (Pa.s)";
-protected
-  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation (Placement(
-        transformation(extent={{-80,40},{-40,80}}, rotation=0)));
-
-algorithm
-  // Water/Steam  ///
-  if fluid==1 then
-    mu := ThermoSysPro.Properties.WaterSteam.IF97.DynamicViscosity_rhoT(rho=rho,T=T);
-
-   //LogVariable(mu);
-
-  // Water/Steam  /// Simple
-  elseif fluid==7 then
-    mu := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.DynamicViscosity_rhoT(rho=rho,T=T);
-    //LogVariable(mu);
-
-  else
-    assert(false, "incorrect fluid number");  ///
-
-  end if;
-
-  //annotation(derivative=derDynamicViscosity_derT_derrho);
-end DynamicViscosity_rhoT;
+within ThermoSysPro.Properties.Fluid;
+
+function DynamicViscosity_rhoT "Dynamic Viscosity computation for all fluids (inputs: rho,T,fluid)"
+  input Modelica.Units.SI.Density rho "Density";
+  input Modelica.Units.SI.Temperature T "Temperature";
+  input Integer fluid "<html>Fluid number: <br>1 - Water/Steam  <br>7 - WaterSteamSimple </html>";
+  output Modelica.Units.SI.DynamicViscosity mu "Dynamic Viscosity (Pa.s)";
+protected
+  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation(
+    Placement(transformation(extent = {{-80, 40}, {-40, 80}}, rotation = 0)));
+algorithm
+// Water/Steam  ///
+  if fluid == 1 then
+    mu := ThermoSysPro.Properties.WaterSteam.IF97.DynamicViscosity_rhoT(rho = rho, T = T);
+  elseif fluid == 7 then
+    mu := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.DynamicViscosity_rhoT(rho = rho, T = T);
+  else
+    assert(false, "incorrect fluid number");
+  end if;
+//LogVariable(mu);
+// Water/Steam  /// Simple
+//LogVariable(mu);
+///
+//annotation(derivative=derDynamicViscosity_derT_derrho);
+end DynamicViscosity_rhoT;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: DynamicViscosity_rhoT.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: DynamicViscosity_rhoT.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/IsentropicExponent_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/IsentropicExponent_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/IsentropicExponent_Ph.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/IsentropicExponent_Ph.mo"	2022-03-10 09:58:45.620152693 +0000
@@ -1,52 +1,42 @@
-within ThermoSysPro.Properties.Fluid;
-function IsentropicExponent_Ph
-  "Isentropic Exponent computation for all fluids (inputs: P, h, fluid)"
-
-  input Modelica.SIunits.AbsolutePressure P "Pressure (Pa)";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
-  input Integer fluid
-    "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
-  input Integer mode "IF97 region - 0:automatic computation";
-  input Real Xco2 "CO2 mass fraction";
-  input Real Xh2o "H2O mass fraction";
-  input Real Xo2 "O2 mass fraction";
-  input Real Xso2 "SO2 mass fraction";
-
-  output Modelica.SIunits.IsentropicExponent Kappa "Isentropic Exponent (1)";
-
-protected
-  ThermoSysPro.Properties.DryAirIdealGas.DryAirIdealGas Data6
-    annotation (Placement(transformation(extent={{-20,40},{0,60}}, rotation=0)));
-
-algorithm
-  // Water/Steam
-  if fluid==1 then
-    Kappa := ThermoSysPro.Properties.WaterSteam.IF97_Utilities.Standard.isentropicExponent_ph(p=P, h=h);
-
-  // // C3H3F5
-  // elseif fluid==2 then
-  //
-  // // FlueGas
-  // elseif fluid==3 then
-  //
-  // // MoltenSalt
-  // elseif fluid==4 then
-  //
-  // Oil
-  elseif fluid==5 then
-    Kappa := 1;
-
-  // Dry Air Ideal Gas
-  elseif fluid==6 then
-    Kappa := ThermoSysPro.Properties.DryAirIdealGas.SpecificHeatCp_T(T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h))
-      / (ThermoSysPro.Properties.DryAirIdealGas.SpecificHeatCp_T(T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h)) - Data6.specificGasConstant);
-
-  // Water/Steam  /// Simple
-  elseif fluid==7 then
-    //
-
-  else
-    assert(false, "incorrect fluid number");  ///
-  end if;
-
-end IsentropicExponent_Ph;
+within ThermoSysPro.Properties.Fluid;
+
+function IsentropicExponent_Ph "Isentropic Exponent computation for all fluids (inputs: P, h, fluid)"
+  input Modelica.Units.SI.AbsolutePressure P "Pressure (Pa)";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+  input Integer fluid "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
+  input Integer mode "IF97 region - 0:automatic computation";
+  input Real Xco2 "CO2 mass fraction";
+  input Real Xh2o "H2O mass fraction";
+  input Real Xo2 "O2 mass fraction";
+  input Real Xso2 "SO2 mass fraction";
+  output Modelica.Units.SI.IsentropicExponent Kappa "Isentropic Exponent (1)";
+protected
+  ThermoSysPro.Properties.DryAirIdealGas.DryAirIdealGas Data6 annotation(
+    Placement(transformation(extent = {{-20, 40}, {0, 60}}, rotation = 0)));
+algorithm
+// Water/Steam
+  if fluid == 1 then
+    Kappa := ThermoSysPro.Properties.WaterSteam.IF97_Utilities.Standard.isentropicExponent_ph(p = P, h = h);
+  elseif fluid == 5 then
+    Kappa := 1;
+  elseif fluid == 6 then
+    Kappa := ThermoSysPro.Properties.DryAirIdealGas.SpecificHeatCp_T(T = ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h = h)) / (ThermoSysPro.Properties.DryAirIdealGas.SpecificHeatCp_T(T = ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h = h)) - Data6.specificGasConstant);
+  elseif fluid == 7 then
+  else
+    assert(false, "incorrect fluid number");
+  end if;
+// // C3H3F5
+// elseif fluid==2 then
+//
+// // FlueGas
+// elseif fluid==3 then
+//
+// // MoltenSalt
+// elseif fluid==4 then
+//
+// Oil
+// Dry Air Ideal Gas
+// Water/Steam  /// Simple
+//
+///
+end IsentropicExponent_Ph;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: IsentropicExponent_Ph.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: IsentropicExponent_Ph.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/IsobaricExpansionCoefficient_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/IsobaricExpansionCoefficient_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/IsobaricExpansionCoefficient_Ph.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/IsobaricExpansionCoefficient_Ph.mo"	2022-03-10 09:58:45.612152692 +0000
@@ -1,48 +1,39 @@
-within ThermoSysPro.Properties.Fluid;
-function IsobaricExpansionCoefficient_Ph
-  "Isobaric Expansion Coefficient computation for all fluids (inputs: P, h, fluid)"
-
-  input Modelica.SIunits.AbsolutePressure P "Pressure (Pa)";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
-  input Integer fluid
-    "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
-  input Integer mode "IF97 region - 0:automatic computation";
-  input Real Xco2 "CO2 mass fraction";
-  input Real Xh2o "H2O mass fraction";
-  input Real Xo2 "O2 mass fraction";
-  input Real Xso2 "SO2 mass fraction";
-
-  output Modelica.SIunits.CubicExpansionCoefficient Beta
-    "Isobaric Expansion Coefficient (1/K)";
-
-algorithm
-  // // Water/Steam
-  // if fluid==1 then
-  //
-  // // C3H3F5
-  // elseif fluid==2 then
-  //
-  // // FlueGas
-  // elseif fluid==3 then
-  //
-  // // MoltenSalt
-  // elseif fluid==4 then
-  //
-  // // Oil
-  // elseif fluid==5 then
-
-  // Dry Air Ideal Gas
-  //elseif fluid==6 then
-  if fluid==6 then
-    Beta := ThermoSysPro.Properties.DryAirIdealGas.IsobaricExpansionCoefficient_T(
-      T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h));
-
-  // Water/Steam  /// Simple
-  //elseif fluid==7 then
-    //
-
-  else
-    assert(false, "incorrect fluid number");  ///
-  end if;
-
-end IsobaricExpansionCoefficient_Ph;
+within ThermoSysPro.Properties.Fluid;
+
+function IsobaricExpansionCoefficient_Ph "Isobaric Expansion Coefficient computation for all fluids (inputs: P, h, fluid)"
+  input Modelica.Units.SI.AbsolutePressure P "Pressure (Pa)";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+  input Integer fluid "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
+  input Integer mode "IF97 region - 0:automatic computation";
+  input Real Xco2 "CO2 mass fraction";
+  input Real Xh2o "H2O mass fraction";
+  input Real Xo2 "O2 mass fraction";
+  input Real Xso2 "SO2 mass fraction";
+  output Modelica.Units.SI.CubicExpansionCoefficient Beta "Isobaric Expansion Coefficient (1/K)";
+algorithm
+// // Water/Steam
+// if fluid==1 then
+//
+// // C3H3F5
+// elseif fluid==2 then
+//
+// // FlueGas
+// elseif fluid==3 then
+//
+// // MoltenSalt
+// elseif fluid==4 then
+//
+// // Oil
+// elseif fluid==5 then
+// Dry Air Ideal Gas
+//elseif fluid==6 then
+  if fluid == 6 then
+    Beta := ThermoSysPro.Properties.DryAirIdealGas.IsobaricExpansionCoefficient_T(T = ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h = h));
+  else
+    assert(false, "incorrect fluid number");
+  end if;
+// Water/Steam  /// Simple
+//elseif fluid==7 then
+//
+///
+end IsobaricExpansionCoefficient_Ph;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: IsobaricExpansionCoefficient_Ph.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: IsobaricExpansionCoefficient_Ph.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/PT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/PT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/PT.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/PT.mo"	2022-03-10 09:58:45.604152690 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Properties.Fluid;
 function PT
-  input Modelica.SIunits.AbsolutePressure P "Pressure";
-  input Modelica.SIunits.Temperature T "Temperature";
+  input Modelica.Units.SI.AbsolutePressure P "Pressure";
+  input Modelica.Units.SI.Temperature T "Temperature";
   input Integer mode = 0 "IF97 region - 0:automatic computation";
   input Integer fluid = 1 "Fluid number - 1: IF97 - 7: SimpleWater";
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/P_sat.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/P_sat.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/P_sat.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/P_sat.mo"	2022-03-10 09:58:45.600152690 +0000
@@ -1,10 +1,10 @@
 within ThermoSysPro.Properties.Fluid;
 function P_sat
-  input  Modelica.SIunits.Temperature T "Temperature (K)";
+  input  Modelica.Units.SI.Temperature T "Temperature (K)";
   input Integer fluid  "Fluid number - 1: IF97 - 7: SimpleWater";
 
-  output Modelica.SIunits.AbsolutePressure P "Pressure";
 
+  output Modelica.Units.SI.AbsolutePressure P "Pressure";
 algorithm
 
   if (fluid == 1) then
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Ph.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Ph.mo"	2022-03-10 09:58:45.592152688 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Properties.Fluid;
 function Ph
-  input Modelica.SIunits.AbsolutePressure P "Pressure";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+  input Modelica.Units.SI.AbsolutePressure P "Pressure";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
   input Integer mode = 0 "IF97 region - 0:automatic computation";
   input Integer fluid = 1 "Fluid number - 1: IF97 - 2: C3H3F5 - 7: SimpleWater";
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Prandtl_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Prandtl_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Prandtl_Ph.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Prandtl_Ph.mo"	2022-03-10 09:58:45.584152687 +0000
@@ -1,94 +1,54 @@
-﻿within ThermoSysPro.Properties.Fluid;
-function Prandtl_Ph
-  "Prandtl number computation for all fluids (inputs: P, h, fluid)"
-
-  input Modelica.SIunits.AbsolutePressure P "Pressure (Pa)";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy (J/kg)";
-  input Integer fluid
-    "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
-  input Integer mode "IF97 region - 0:automatic computation";
-  input Real Xco2 "CO2 mass fraction";
-  input Real Xh2o "H2O mass fraction";
-  input Real Xo2 "O2 mass fraction";
-  input Real Xso2 "SO2 mass fraction";
-
-  output Modelica.SIunits.PrandtlNumber Pr "Prandtl number";
-
-// fluid==1 - Water/Steam
-protected
-  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation (Placement(
-        transformation(extent={{-80,40},{-40,80}}, rotation=0)));
-
-/// Pr = mu * Cp / k
-algorithm
-  // Water/Steam  /// FONCTIONNE EN DIPHASIQUE ???
-  if fluid==1 then
-    pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(
-      P,
-      h,
-      mode);
-    Pr := ThermoSysPro.Properties.WaterSteam.IF97.DynamicViscosity_rhoT(rho=pro.d,T=pro.T) * pro.cp
-      / ThermoSysPro.Properties.WaterSteam.IF97.ThermalConductivity_rhoT(rho=pro.d,T=pro.T,P=P,region=mode);
-
-  // // C3H3F5
-  // elseif fluid==2 then
-  //   T := ThermoSysPro.Properties.C3H3F5.Temperature_Ph(P=P, h=h);
-  //
-  // // FlueGas
-  // elseif fluid==3 then
-  //   assert(Xco2+Xh2o+Xo2+Xso2>0, "Wrong mass fraction definition");  /// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
-  //   T := ThermoSysPro.Properties.FlueGases.FlueGases_T(
-  //     PMF=P,
-  //     HMF=h,
-  //     Xco2=Xco2,
-  //     Xh2o=Xh2o,
-  //     Xo2=Xo2,
-  //     Xso2=Xso2);
-
-  // MoltenSalt
-  elseif fluid==4 then
-    Pr := ThermoSysPro.Properties.MoltenSalt.DynamicViscosity_T(
-      T=ThermoSysPro.Properties.MoltenSalt.Temperature_h(h=h))
-      *ThermoSysPro.Properties.MoltenSalt.SpecificHeatCapacityCp_T(
-      T=ThermoSysPro.Properties.MoltenSalt.Temperature_h(h=h))
-      /ThermoSysPro.Properties.MoltenSalt.ThermalConductivity_T(
-      T=ThermoSysPro.Properties.MoltenSalt.Temperature_h(h=h));
-
-  // Oil
-  elseif fluid==5 then
-    Pr := ThermoSysPro.Properties.Oil_TherminolVP1.DynamicViscosity_T(
-      temp=ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h))
-      *ThermoSysPro.Properties.Oil_TherminolVP1.SpecificHeatCp_T(
-      temp=ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h))
-      /ThermoSysPro.Properties.Oil_TherminolVP1.ThermalConductivity_T(
-      temp=ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h));
-
-  // Dry Air Ideal Gas
-  elseif fluid==6 then
-    Pr := ThermoSysPro.Properties.DryAirIdealGas.DynamicViscosity_Trho(
-      T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h),
-      rho=ThermoSysPro.Properties.DryAirIdealGas.Density_PT(
-        P=P,
-        T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h)))
-      *ThermoSysPro.Properties.DryAirIdealGas.SpecificHeatCp_T(
-        T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h))
-      /ThermoSysPro.Properties.DryAirIdealGas.ThermalConductivity_Trho(
-        T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h),
-        rho=ThermoSysPro.Properties.DryAirIdealGas.Density_PT(
-          P=P,
-          T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h)));
-    /// Utiliser variables intermédiaires (ie: protected) pour T et rho
-
-  elseif fluid==7 then
-    pro := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph(
-      P,
-      h,
-      mode);
-     Pr := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.DynamicViscosity_rhoT(rho=pro.d,T=pro.T) * pro.cp
-      /  ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.ThermalConductivity_rhoT(rho=pro.d,T=pro.T);
-
-  else
-    assert(false, "incorrect fluid number");  ///
-  end if;
-
-end Prandtl_Ph;
+within ThermoSysPro.Properties.Fluid;
+
+function Prandtl_Ph "Prandtl number computation for all fluids (inputs: P, h, fluid)"
+  input Modelica.Units.SI.AbsolutePressure P "Pressure (Pa)";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy (J/kg)";
+  input Integer fluid "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
+  input Integer mode "IF97 region - 0:automatic computation";
+  input Real Xco2 "CO2 mass fraction";
+  input Real Xh2o "H2O mass fraction";
+  input Real Xo2 "O2 mass fraction";
+  input Real Xso2 "SO2 mass fraction";
+  output Modelica.Units.SI.PrandtlNumber Pr "Prandtl number";
+  // fluid==1 - Water/Steam
+protected
+  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation(
+    Placement(transformation(extent = {{-80, 40}, {-40, 80}}, rotation = 0)));
+  /// Pr = mu * Cp / k
+algorithm
+// Water/Steam  /// FONCTIONNE EN DIPHASIQUE ???
+  if fluid == 1 then
+    pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(P, h, mode);
+    Pr := ThermoSysPro.Properties.WaterSteam.IF97.DynamicViscosity_rhoT(rho = pro.d, T = pro.T) * pro.cp / ThermoSysPro.Properties.WaterSteam.IF97.ThermalConductivity_rhoT(rho = pro.d, T = pro.T, P = P, region = mode);
+  elseif fluid == 4 then
+    Pr := ThermoSysPro.Properties.MoltenSalt.DynamicViscosity_T(T = ThermoSysPro.Properties.MoltenSalt.Temperature_h(h = h)) * ThermoSysPro.Properties.MoltenSalt.SpecificHeatCapacityCp_T(T = ThermoSysPro.Properties.MoltenSalt.Temperature_h(h = h)) / ThermoSysPro.Properties.MoltenSalt.ThermalConductivity_T(T = ThermoSysPro.Properties.MoltenSalt.Temperature_h(h = h));
+  elseif fluid == 5 then
+    Pr := ThermoSysPro.Properties.Oil_TherminolVP1.DynamicViscosity_T(temp = ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h = h)) * ThermoSysPro.Properties.Oil_TherminolVP1.SpecificHeatCp_T(temp = ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h = h)) / ThermoSysPro.Properties.Oil_TherminolVP1.ThermalConductivity_T(temp = ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h = h));
+  elseif fluid == 6 then
+    Pr := ThermoSysPro.Properties.DryAirIdealGas.DynamicViscosity_Trho(T = ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h = h), rho = ThermoSysPro.Properties.DryAirIdealGas.Density_PT(P = P, T = ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h = h))) * ThermoSysPro.Properties.DryAirIdealGas.SpecificHeatCp_T(T = ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h = h)) / ThermoSysPro.Properties.DryAirIdealGas.ThermalConductivity_Trho(T = ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h = h), rho = ThermoSysPro.Properties.DryAirIdealGas.Density_PT(P = P, T = ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h = h)));
+  elseif fluid == 7 then
+    pro := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph(P, h, mode);
+    Pr := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.DynamicViscosity_rhoT(rho = pro.d, T = pro.T) * pro.cp / ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.ThermalConductivity_rhoT(rho = pro.d, T = pro.T);
+  else
+    assert(false, "incorrect fluid number");
+  end if;
+// // C3H3F5
+// elseif fluid==2 then
+//   T := ThermoSysPro.Properties.C3H3F5.Temperature_Ph(P=P, h=h);
+//
+// // FlueGas
+// elseif fluid==3 then
+//   assert(Xco2+Xh2o+Xo2+Xso2>0, "Wrong mass fraction definition");  /// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
+//   T := ThermoSysPro.Properties.FlueGases.FlueGases_T(
+//     PMF=P,
+//     HMF=h,
+//     Xco2=Xco2,
+//     Xh2o=Xh2o,
+//     Xo2=Xo2,
+//     Xso2=Xso2);
+// MoltenSalt
+// Oil
+// Dry Air Ideal Gas
+/// Utiliser variables intermédiaires (ie: protected) pour T et rho
+///
+end Prandtl_Ph;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: Prandtl_Ph.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: Prandtl_Ph.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Ps.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Ps.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Ps.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Ps.mo"	2022-03-10 09:58:45.572152686 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Properties.Fluid;
 function Ps
-  input Modelica.SIunits.AbsolutePressure P "Pressure";
-  input Modelica.SIunits.SpecificEntropy s "Specific entropy";
+  input Modelica.Units.SI.AbsolutePressure P "Pressure";
+  input Modelica.Units.SI.SpecificEntropy s "Specific entropy";
   input Integer mode = 0 "IF97 region - 0:automatic computation";
   input Integer fluid = 1 "Fluid number - 1: IF97 - 2: C3H3F5 - 7: SimpleWater";
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Reynolds_PhvD.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Reynolds_PhvD.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Reynolds_PhvD.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Reynolds_PhvD.mo"	2022-03-10 09:58:45.564152685 +0000
@@ -1,72 +1,57 @@
-﻿within ThermoSysPro.Properties.Fluid;
-function Reynolds_PhvD
-  "Reynolds number computation for all fluids (inputs: P, h, fluid, v, D)"
-
-  input Modelica.SIunits.AbsolutePressure P "Pressure (Pa)";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy (J/kg)";
-  input Integer fluid
-    "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
-  input Integer mode "IF97 region - 0:automatic computation";
-  input Real Xco2 "CO2 mass fraction";
-  input Real Xh2o "H2O mass fraction";
-  input Real Xo2 "O2 mass fraction";
-  input Real Xso2 "SO2 mass fraction";
-  input Modelica.SIunits.Velocity v "Mean velocity of fluid flow";
-  input Modelica.SIunits.Length D
-    "Characteristic dimension (hydraulic diameter of pipes)";
-
-  output Modelica.SIunits.ReynoldsNumber Re "Reynolds number";
-
-// fluid==1 - Water/Steam
-protected
-  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation (Placement(
-        transformation(extent={{-80,40},{-40,80}}, rotation=0)));
-
-algorithm
-  // Water/Steam  /// FONCTIONNE EN DIPHASIQUE ???
-  if fluid==1 then
-    pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(
-      P,
-      h,
-      mode);
-  Re := abs(v)*pro.d*D / ThermoSysPro.Properties.WaterSteam.IF97.DynamicViscosity_rhoT(rho=pro.d,T=pro.T);
-
-  // // C3H3F5
-  // elseif fluid==2 then
-  //   T := ThermoSysPro.Properties.C3H3F5.Temperature_Ph(P=P, h=h);
-  //
-  // // FlueGas
-  // elseif fluid==3 then
-  //   assert(Xco2+Xh2o+Xo2+Xso2>0, "Wrong mass fraction definition");  /// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
-  //   T := ThermoSysPro.Properties.FlueGases.FlueGases_T(
-  //     PMF=P,
-  //     HMF=h,
-  //     Xco2=Xco2,
-  //     Xh2o=Xh2o,
-  //     Xo2=Xo2,
-  //     Xso2=Xso2);
-  //
-  // // MoltenSalt
-  // elseif fluid==4 then
-  //   T := ThermoSysPro.Properties.MoltenSalt.Temperature_h(h=h);
-  //
-  // // Oil
-  // elseif fluid==5 then
-  //   T := ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h);
-  //
-  // // Dry Air Ideal Gas
-  // elseif fluid==6 then
-  //   T := ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h);
-
-  elseif fluid==7 then
-    pro := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph(
-      P,
-      h,
-      mode);
-    Re := abs(v)*pro.d*D / ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.DynamicViscosity_rhoT(rho=pro.d,T=pro.T);
-
-  else
-    assert(false, "incorrect fluid number");  ///
-  end if;
-
-end Reynolds_PhvD;
+within ThermoSysPro.Properties.Fluid;
+
+function Reynolds_PhvD "Reynolds number computation for all fluids (inputs: P, h, fluid, v, D)"
+  input Modelica.Units.SI.AbsolutePressure P "Pressure (Pa)";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy (J/kg)";
+  input Integer fluid "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
+  input Integer mode "IF97 region - 0:automatic computation";
+  input Real Xco2 "CO2 mass fraction";
+  input Real Xh2o "H2O mass fraction";
+  input Real Xo2 "O2 mass fraction";
+  input Real Xso2 "SO2 mass fraction";
+  input Modelica.Units.SI.Velocity v "Mean velocity of fluid flow";
+  input Modelica.Units.SI.Length D "Characteristic dimension (hydraulic diameter of pipes)";
+  output Modelica.Units.SI.ReynoldsNumber Re "Reynolds number";
+  // fluid==1 - Water/Steam
+protected
+  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation(
+    Placement(transformation(extent = {{-80, 40}, {-40, 80}}, rotation = 0)));
+algorithm
+// Water/Steam  /// FONCTIONNE EN DIPHASIQUE ???
+  if fluid == 1 then
+    pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(P, h, mode);
+    Re := abs(v) * pro.d * D / ThermoSysPro.Properties.WaterSteam.IF97.DynamicViscosity_rhoT(rho = pro.d, T = pro.T);
+  elseif fluid == 7 then
+    pro := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph(P, h, mode);
+    Re := abs(v) * pro.d * D / ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.DynamicViscosity_rhoT(rho = pro.d, T = pro.T);
+  else
+    assert(false, "incorrect fluid number");
+  end if;
+// // C3H3F5
+// elseif fluid==2 then
+//   T := ThermoSysPro.Properties.C3H3F5.Temperature_Ph(P=P, h=h);
+//
+// // FlueGas
+// elseif fluid==3 then
+//   assert(Xco2+Xh2o+Xo2+Xso2>0, "Wrong mass fraction definition");  /// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
+//   T := ThermoSysPro.Properties.FlueGases.FlueGases_T(
+//     PMF=P,
+//     HMF=h,
+//     Xco2=Xco2,
+//     Xh2o=Xh2o,
+//     Xo2=Xo2,
+//     Xso2=Xso2);
+//
+// // MoltenSalt
+// elseif fluid==4 then
+//   T := ThermoSysPro.Properties.MoltenSalt.Temperature_h(h=h);
+//
+// // Oil
+// elseif fluid==5 then
+//   T := ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h);
+//
+// // Dry Air Ideal Gas
+// elseif fluid==6 then
+//   T := ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h);
+///
+end Reynolds_PhvD;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: Reynolds_PhvD.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: Reynolds_PhvD.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Reynolds_vrhoDmu.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Reynolds_vrhoDmu.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Reynolds_vrhoDmu.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Reynolds_vrhoDmu.mo"	2022-03-10 09:58:45.556152685 +0000
@@ -2,11 +2,11 @@
 function Reynolds_vrhoDmu
   "Reynolds number computation for all fluids (inputs: v, rho, D, mu, fluid)"
 
-  input Modelica.SIunits.Velocity v "Mean velocity of fluid flow";
-  input Modelica.SIunits.Density rho "Fluid density";
-  input Modelica.SIunits.Length D
+  input Modelica.Units.SI.Velocity v "Mean velocity of fluid flow";
+  input Modelica.Units.SI.Density rho "Fluid density";
+  input Modelica.Units.SI.Length D
     "Characteristic dimension (hydraulic diameter of pipes)";
-  input Modelica.SIunits.DynamicViscosity mu "Dynamic (absolute) viscosity";
+  input Modelica.Units.SI.DynamicViscosity mu "Dynamic (absolute) viscosity";
 
   //  input Integer fluid
   //  "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
@@ -16,10 +16,10 @@
   // input Real Xo2=0 "O2 mass fraction";
   // input Real Xso2=0 "SO2 mass fraction";
 
-  output Modelica.SIunits.ReynoldsNumber Re "Reynolds number";
+  output Modelica.Units.SI.ReynoldsNumber Re "Reynolds number";
 
 algorithm
-  ///////////////////////////////////// FONCTIONNE EN DIPHASIQUE ???
+///////////////////////////////////// FONCTIONNE EN DIPHASIQUE ???
   Re := abs(v)*rho*D/mu;
 
 end Reynolds_vrhoDmu;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/SpecificEnthalpy_PT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/SpecificEnthalpy_PT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/SpecificEnthalpy_PT.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/SpecificEnthalpy_PT.mo"	2022-03-10 09:58:45.548152682 +0000
@@ -1,36 +1,41 @@
-﻿within ThermoSysPro.Properties.Fluid;
-function SpecificEnthalpy_PT
-  "Specific Enthalpy computation for all fluids (inputs: P, T, fluid)"
-
-  input Modelica.SIunits.AbsolutePressure P "Pressure (Pa)";
-  input Modelica.SIunits.Temperature T "Temperature (K)";
-  input Integer fluid
-    "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
-  input Integer mode "IF97 region - 0:automatic computation";
-  input Real Xco2 "CO2 mass fraction";
-  input Real Xh2o "H2O mass fraction";
-  input Real Xo2 "O2 mass fraction";
-  input Real Xso2 "SO2 mass fraction";
-
-  output Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy (J/kg)";
-
-algorithm
-  // Water/Steam
-  if fluid==1 then
-    h := ThermoSysPro.Properties.WaterSteam.IF97.SpecificEnthalpy_PT(p=P, T=T, mode=mode);
-
-  // C3H3F5
-   elseif fluid==2 then
-    assert(false, "?????????? fluid = 2: the function SpecificEnthalpy_PT is not available; incorrect option ?????????");
-    //h := ThermoSysPro.Properties.C3H3F5.Enthalpy_PT(P=P, T=T);
-
-    //assert(fluid =2, "Wrong: fluid = 2 ");  /// fluid = 2: the function is not available en Input)
-
-  //
-  // FlueGas
-   elseif fluid==3 then
-
-    /*
+within ThermoSysPro.Properties.Fluid;
+
+function SpecificEnthalpy_PT "Specific Enthalpy computation for all fluids (inputs: P, T, fluid)"
+  input Modelica.Units.SI.AbsolutePressure P "Pressure (Pa)";
+  input Modelica.Units.SI.Temperature T "Temperature (K)";
+  input Integer fluid "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
+  input Integer mode "IF97 region - 0:automatic computation";
+  input Real Xco2 "CO2 mass fraction";
+  input Real Xh2o "H2O mass fraction";
+  input Real Xo2 "O2 mass fraction";
+  input Real Xso2 "SO2 mass fraction";
+  output Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy (J/kg)";
+algorithm
+// Water/Steam
+  if fluid == 1 then
+    h := ThermoSysPro.Properties.WaterSteam.IF97.SpecificEnthalpy_PT(p = P, T = T, mode = mode);
+  elseif fluid == 2 then
+    assert(false, "?????????? fluid = 2: the function SpecificEnthalpy_PT is not available; incorrect option ?????????");
+  elseif fluid == 3 then
+    assert(Xco2 + Xh2o + Xo2 + Xso2 > 0, "Wrong mass fraction definition");
+    h := ThermoSysPro.Properties.FlueGases.FlueGases_h(PMF = P, TMF = T, Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2);
+  elseif fluid == 4 then
+    h := ThermoSysPro.Properties.MoltenSalt.SpecificEnthalpy_T(T = T);
+  elseif fluid == 5 then
+    h := ThermoSysPro.Properties.Oil_TherminolVP1.Enthalpy_T(temp = T);
+  elseif fluid == 6 then
+    h := ThermoSysPro.Properties.DryAirIdealGas.SpecificEnthalpy_T(T = T);
+  elseif fluid == 7 then
+    h := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.SpecificEnthalpy_PT(p = P, T = T, mode = mode);
+  else
+    assert(false, "incorrect fluid number");
+  end if;
+// C3H3F5
+//h := ThermoSysPro.Properties.C3H3F5.Enthalpy_PT(P=P, T=T);
+//assert(fluid =2, "Wrong: fluid = 2 ");  /// fluid = 2: the function is not available en Input)
+//
+// FlueGas
+/*
     LogVariable(mode);
     LogVariable(P);
     LogVariable(h);
@@ -38,35 +43,13 @@
     LogVariable(Xh2o);
     LogVariable(Xo2);
     LogVariable(Xso2);
-   */
-     assert(Xco2+Xh2o+Xo2+Xso2>0, "Wrong mass fraction definition");  /// Commentaire ajouté (si fluid==3, vérifie que les fractions massiques sont bien fournies en Input)
-     h := ThermoSysPro.Properties.FlueGases.FlueGases_h(
-       PMF=P,
-       TMF=T,
-       Xco2=Xco2,
-       Xh2o=Xh2o,
-       Xo2=Xo2,
-       Xso2=Xso2);
-
-  // MoltenSalt
-  elseif fluid==4 then
-    h := ThermoSysPro.Properties.MoltenSalt.SpecificEnthalpy_T(T=T);
-
-  // Oil
-  elseif fluid==5 then
-    h := ThermoSysPro.Properties.Oil_TherminolVP1.Enthalpy_T(temp=T);
-
-  // Dry Air Ideal Gas
-  elseif fluid==6 then
-    h := ThermoSysPro.Properties.DryAirIdealGas.SpecificEnthalpy_T(T=T);
-
-  // Water/Steam
-  elseif fluid==7 then
-    h := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.SpecificEnthalpy_PT(p=P, T=T, mode=mode);
-
-  else
-    assert(false, "incorrect fluid number");  ///
-  end if;
-
-  annotation(derivative=derSpecificEnthalpy_derP_derT);
-end SpecificEnthalpy_PT;
+   */
+/// Commentaire ajouté (si fluid==3, vérifie que les fractions massiques sont bien fournies en Input)
+// MoltenSalt
+// Oil
+// Dry Air Ideal Gas
+// Water/Steam
+///
+  annotation(
+    derivative = derSpecificEnthalpy_derP_derT);
+end SpecificEnthalpy_PT;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: SpecificEnthalpy_PT.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: SpecificEnthalpy_PT.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/SpecificHeatCapacityCp_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/SpecificHeatCapacityCp_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/SpecificHeatCapacityCp_Ph.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/SpecificHeatCapacityCp_Ph.mo"	2022-03-10 09:58:45.536152682 +0000
@@ -1,78 +1,47 @@
-﻿within ThermoSysPro.Properties.Fluid;
-function SpecificHeatCapacityCp_Ph
-  "Specific Heat Capacity at constant P computation for all fluids (inputs: P, h, fluid)"
-
-  input Modelica.SIunits.AbsolutePressure P "Pressure (Pa)";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
-  input Integer fluid
-    "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
-  input Integer mode "IF97 region - 0:automatic computation";
-  input Real Xco2 "CO2 mass fraction";
-  input Real Xh2o "H2O mass fraction";
-  input Real Xo2 "O2 mass fraction";
-  input Real Xso2 "SO2 mass fraction";
-
-  output Modelica.SIunits.SpecificHeatCapacity cp
-    "Specific Heat Capacity at constant P (J/kg/K)";
-
-// fluid==1 - Water/Steam
-protected
-  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation (Placement(
-        transformation(extent={{-80,40},{-40,80}}, rotation=0)));
-
-algorithm
-  // Water/Steam
-  if fluid==1 then
-    pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(
-      P,
-      h,
-      mode);
-    cp:=pro.cp;
-
-  // C3H3F5
-  elseif fluid==2 then
-  //   cp :=
-  //     ThermoSysPro.Properties.C3H3F5.SpecificHeatCapacityCp_Ph__NonFonctionnel(
-  //     P=P, h=h);
-    assert(false, "?????????? fluid = 2: the function SpecificHeatCapacityCp_Ph is not available; incorrect option ?????????");
-
-  // FlueGas
-  elseif fluid==3 then
-    assert(Xco2+Xh2o+Xo2+Xso2>0, "Wrong mass fraction definition");  /// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
-    cp := ThermoSysPro.Properties.FlueGases.FlueGases_cp(
-      PMF=P,
-      TMF=ThermoSysPro.Properties.FlueGases.FlueGases_T(
-        PMF=P,
-        HMF=h,
-        Xco2=Xco2,
-        Xh2o=Xh2o,
-        Xo2=Xo2,
-        Xso2=Xso2),
-      Xco2=Xco2,
-      Xh2o=Xh2o,
-      Xo2=Xo2,
-      Xso2=Xso2);
-
-  // MoltenSalt
-  elseif fluid==4 then
-    cp := ThermoSysPro.Properties.MoltenSalt.SpecificHeatCapacityCp_T(T=
-      ThermoSysPro.Properties.MoltenSalt.Temperature_h(h=h));
-
-  // Oil
-  elseif fluid==5 then
-    cp := ThermoSysPro.Properties.Oil_TherminolVP1.SpecificHeatCp_T(temp=
-      ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h));
-
-  // Water/Steam
-  elseif fluid==7 then
-    pro := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph(
-      P,
-      h,
-      mode);
-    cp:=pro.cp;
-
-  else
-    assert(false, "incorrect fluid number");  ///
-  end if;
-
-end SpecificHeatCapacityCp_Ph;
+within ThermoSysPro.Properties.Fluid;
+
+function SpecificHeatCapacityCp_Ph "Specific Heat Capacity at constant P computation for all fluids (inputs: P, h, fluid)"
+  input Modelica.Units.SI.AbsolutePressure P "Pressure (Pa)";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+  input Integer fluid "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
+  input Integer mode "IF97 region - 0:automatic computation";
+  input Real Xco2 "CO2 mass fraction";
+  input Real Xh2o "H2O mass fraction";
+  input Real Xo2 "O2 mass fraction";
+  input Real Xso2 "SO2 mass fraction";
+  output Modelica.Units.SI.SpecificHeatCapacity cp "Specific Heat Capacity at constant P (J/kg/K)";
+  // fluid==1 - Water/Steam
+protected
+  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation(
+    Placement(transformation(extent = {{-80, 40}, {-40, 80}}, rotation = 0)));
+algorithm
+// Water/Steam
+  if fluid == 1 then
+    pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(P, h, mode);
+    cp := pro.cp;
+  elseif fluid == 2 then
+    assert(false, "?????????? fluid = 2: the function SpecificHeatCapacityCp_Ph is not available; incorrect option ?????????");
+  elseif fluid == 3 then
+    assert(Xco2 + Xh2o + Xo2 + Xso2 > 0, "Wrong mass fraction definition");
+    cp := ThermoSysPro.Properties.FlueGases.FlueGases_cp(PMF = P, TMF = ThermoSysPro.Properties.FlueGases.FlueGases_T(PMF = P, HMF = h, Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2), Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2);
+  elseif fluid == 4 then
+    cp := ThermoSysPro.Properties.MoltenSalt.SpecificHeatCapacityCp_T(T = ThermoSysPro.Properties.MoltenSalt.Temperature_h(h = h));
+  elseif fluid == 5 then
+    cp := ThermoSysPro.Properties.Oil_TherminolVP1.SpecificHeatCp_T(temp = ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h = h));
+  elseif fluid == 7 then
+    pro := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph(P, h, mode);
+    cp := pro.cp;
+  else
+    assert(false, "incorrect fluid number");
+  end if;
+// C3H3F5
+//   cp :=
+//     ThermoSysPro.Properties.C3H3F5.SpecificHeatCapacityCp_Ph__NonFonctionnel(
+//     P=P, h=h);
+// FlueGas
+/// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
+// MoltenSalt
+// Oil
+// Water/Steam
+///
+end SpecificHeatCapacityCp_Ph;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: SpecificHeatCapacityCp_Ph.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: SpecificHeatCapacityCp_Ph.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/SpecificInternalEnergy_Ph_DO_NOT_USE.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/SpecificInternalEnergy_Ph_DO_NOT_USE.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/SpecificInternalEnergy_Ph_DO_NOT_USE.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/SpecificInternalEnergy_Ph_DO_NOT_USE.mo"	2022-03-10 09:58:45.524152681 +0000
@@ -1,96 +1,66 @@
-﻿within ThermoSysPro.Properties.Fluid;
-function SpecificInternalEnergy_Ph_DO_NOT_USE
-  "Specific Internal Energy computation for all fluids (inputs: P, h, fluid). DO NOT USE (does not work with use-case 'DistributedVolumePartialModel'. Use u = h - P/rho instead)"
-
-  input Modelica.SIunits.AbsolutePressure P "Pressure (Pa)";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
-  input Integer fluid
-    "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
-  input Integer mode "IF97 region - 0:automatic computation";
-  input Real Xco2 "CO2 mass fraction";
-  input Real Xh2o "H2O mass fraction";
-  input Real Xo2 "O2 mass fraction";
-  input Real Xso2 "SO2 mass fraction";
-
-  output Modelica.SIunits.SpecificEnergy u "Specific Internal Energy (J/kg)";
-
-protected
-  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro
-    annotation (Placement(transformation(extent={{-80,40},{-40,80}}, rotation=0)));
-  ThermoSysPro.Properties.DryAirIdealGas.DryAirIdealGas Data6
-    annotation (Placement(transformation(extent={{-20,40},{0,60}}, rotation=0)));
-
-algorithm
-  // Water/Steam
-  if fluid==1 then
-    pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(
-      P,
-      h,
-      mode);
-    u:=pro.u;
-
-  // // C3H3F5
-  // elseif fluid==2 then
-  //   u := ThermoSysPro.Properties.C3H3F5.SpecificInternalEnergy_Ph__NonFonctionnel(
-  //     P=P, h=h);
-  //
-
-  // // FlueGas
-   elseif fluid==3 then
-     assert(Xco2+Xh2o+Xo2+Xso2>0, "Wrong mass fraction definition");  /// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
-  //   u := ThermoSysPro.Properties.FlueGases.FlueGases_u__NonFonctionnel(
-  //     PMF=P,
-  //     TMF=ThermoSysPro.Properties.FlueGases.FlueGases_T(
-  //       PMF=P,
-  //       HMF=h,
-  //       Xco2=Xco2,
-  //       Xh2o=Xh2o,
-  //       Xo2=Xo2,
-  //       Xso2=Xso2),
-  //     Xco2=Xco2,
-  //     Xh2o=Xh2o,
-  //     Xo2=Xo2,
-  //     Xso2=Xso2);
-    u := h - P/( ThermoSysPro.Properties.FlueGases.FlueGases_rho(
-      PMF=P,
-      TMF=ThermoSysPro.Properties.FlueGases.FlueGases_T(
-        PMF=P,
-        HMF=h,
-        Xco2=Xco2,
-        Xh2o=Xh2o,
-        Xo2=Xo2,
-        Xso2=Xso2),
-      Xco2=Xco2,
-      Xh2o=Xh2o,
-      Xo2=Xo2,
-      Xso2=Xso2));
-
-  // MoltenSalt
-  elseif fluid==4 then
-    u := h - P/( ThermoSysPro.Properties.MoltenSalt.Density_T(T=
-      ThermoSysPro.Properties.MoltenSalt.Temperature_h(h=h)));
-
-  // Oil
-  elseif fluid==5 then
-    u := h - P/( ThermoSysPro.Properties.Oil_TherminolVP1.Density_T(
-      temp=ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h)));
-
-  // DryAirIdealGas
-  elseif fluid==6 then
-    //u := h - P/( ThermoSysPro.Properties.DryAirIdealGas.Density_PT(
-    //  P=P,T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h)));  /// Solution 1
-    u := h - Data6.specificGasConstant * ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h);
-
-  elseif  fluid==7 then
-    pro := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph(
-      P,
-      h,
-      mode);
-    u:=pro.u;
-
-  else
-    assert(false, "incorrect fluid number");  ///
-  end if;
-
-annotation(derivative=derSpecificInternalEnergy_derP_derh);
-end SpecificInternalEnergy_Ph_DO_NOT_USE;
+within ThermoSysPro.Properties.Fluid;
+
+function SpecificInternalEnergy_Ph_DO_NOT_USE "Specific Internal Energy computation for all fluids (inputs: P, h, fluid). DO NOT USE (does not work with use-case 'DistributedVolumePartialModel'. Use u = h - P/rho instead)"
+  input Modelica.Units.SI.AbsolutePressure P "Pressure (Pa)";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+  input Integer fluid "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
+  input Integer mode "IF97 region - 0:automatic computation";
+  input Real Xco2 "CO2 mass fraction";
+  input Real Xh2o "H2O mass fraction";
+  input Real Xo2 "O2 mass fraction";
+  input Real Xso2 "SO2 mass fraction";
+  output Modelica.Units.SI.SpecificEnergy u "Specific Internal Energy (J/kg)";
+protected
+  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation(
+    Placement(transformation(extent = {{-80, 40}, {-40, 80}}, rotation = 0)));
+  ThermoSysPro.Properties.DryAirIdealGas.DryAirIdealGas Data6 annotation(
+    Placement(transformation(extent = {{-20, 40}, {0, 60}}, rotation = 0)));
+algorithm
+// Water/Steam
+  if fluid == 1 then
+    pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(P, h, mode);
+    u := pro.u;
+  elseif fluid == 3 then
+    assert(Xco2 + Xh2o + Xo2 + Xso2 > 0, "Wrong mass fraction definition");
+    u := h - P / ThermoSysPro.Properties.FlueGases.FlueGases_rho(PMF = P, TMF = ThermoSysPro.Properties.FlueGases.FlueGases_T(PMF = P, HMF = h, Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2), Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2);
+  elseif fluid == 4 then
+    u := h - P / ThermoSysPro.Properties.MoltenSalt.Density_T(T = ThermoSysPro.Properties.MoltenSalt.Temperature_h(h = h));
+  elseif fluid == 5 then
+    u := h - P / ThermoSysPro.Properties.Oil_TherminolVP1.Density_T(temp = ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h = h));
+  elseif fluid == 6 then
+    u := h - Data6.specificGasConstant * ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h = h);
+  elseif fluid == 7 then
+    pro := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph(P, h, mode);
+    u := pro.u;
+  else
+    assert(false, "incorrect fluid number");
+  end if;
+// // C3H3F5
+// elseif fluid==2 then
+//   u := ThermoSysPro.Properties.C3H3F5.SpecificInternalEnergy_Ph__NonFonctionnel(
+//     P=P, h=h);
+//
+// // FlueGas
+/// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
+//   u := ThermoSysPro.Properties.FlueGases.FlueGases_u__NonFonctionnel(
+//     PMF=P,
+//     TMF=ThermoSysPro.Properties.FlueGases.FlueGases_T(
+//       PMF=P,
+//       HMF=h,
+//       Xco2=Xco2,
+//       Xh2o=Xh2o,
+//       Xo2=Xo2,
+//       Xso2=Xso2),
+//     Xco2=Xco2,
+//     Xh2o=Xh2o,
+//     Xo2=Xo2,
+//     Xso2=Xso2);
+// MoltenSalt
+// Oil
+// DryAirIdealGas
+//u := h - P/( ThermoSysPro.Properties.DryAirIdealGas.Density_PT(
+//  P=P,T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h)));  /// Solution 1
+///
+  annotation(
+    derivative = derSpecificInternalEnergy_derP_derh);
+end SpecificInternalEnergy_Ph_DO_NOT_USE;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: SpecificInternalEnergy_Ph_DO_NOT_USE.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: SpecificInternalEnergy_Ph_DO_NOT_USE.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/T_sat.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/T_sat.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/T_sat.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/T_sat.mo"	2022-03-10 09:58:45.516152678 +0000
@@ -1,10 +1,10 @@
 within ThermoSysPro.Properties.Fluid;
 function T_sat
-  input Modelica.SIunits.AbsolutePressure P "Pressure";
+  input Modelica.Units.SI.AbsolutePressure P "Pressure";
   input Integer fluid  "Fluid number - 1: IF97 - 7: SimpleWater";
 
-  output Modelica.SIunits.Temperature T "Temperature (K)";
 
+  output Modelica.Units.SI.Temperature T "Temperature (K)";
 algorithm
 
   if (fluid == 1) then
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Temperature_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Temperature_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Temperature_Ph.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Temperature_Ph.mo"	2022-03-10 09:58:45.504152677 +0000
@@ -1,42 +1,46 @@
-﻿within ThermoSysPro.Properties.Fluid;
-function Temperature_Ph
-  "Temperature computation for all fluids (inputs: P, h, fluid)"
-
-  input Modelica.SIunits.AbsolutePressure P "Pressure (Pa)";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
-  input Integer fluid
-    "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
-  input Integer mode "IF97 region - 0:automatic computation";
-  input Real Xco2 "CO2 mass fraction";
-  input Real Xh2o "H2O mass fraction";
-  input Real Xo2 "O2 mass fraction";
-  input Real Xso2 "SO2 mass fraction";
-
-  output Modelica.SIunits.Temperature T "Temperature (K)";
-
-// fluid==1 - Water/Steam
-protected
-  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation (Placement(
-        transformation(extent={{-80,40},{-40,80}}, rotation=0)));
-
-algorithm
-  // Water/Steam
-  if fluid==1 then
-    pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(
-      P,
-      h,
-      mode);
-    T:=pro.T;
-
-  // C3H3F5
-  elseif fluid==2 then
-    pro := ThermoSysPro.Properties.C3H3F5.C3H3F5_Ph(P=P, h=h);
-    //LogVariable(pro.x);
-    T:=pro.T;
-
-  // FlueGas
-  elseif fluid==3 then
-    /*
+within ThermoSysPro.Properties.Fluid;
+
+function Temperature_Ph "Temperature computation for all fluids (inputs: P, h, fluid)"
+  input Modelica.Units.SI.AbsolutePressure P "Pressure (Pa)";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+  input Integer fluid "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
+  input Integer mode "IF97 region - 0:automatic computation";
+  input Real Xco2 "CO2 mass fraction";
+  input Real Xh2o "H2O mass fraction";
+  input Real Xo2 "O2 mass fraction";
+  input Real Xso2 "SO2 mass fraction";
+  output Modelica.Units.SI.Temperature T "Temperature (K)";
+  // fluid==1 - Water/Steam
+protected
+  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation(
+    Placement(transformation(extent = {{-80, 40}, {-40, 80}}, rotation = 0)));
+algorithm
+// Water/Steam
+  if fluid == 1 then
+    pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(P, h, mode);
+    T := pro.T;
+  elseif fluid == 2 then
+    pro := ThermoSysPro.Properties.C3H3F5.C3H3F5_Ph(P = P, h = h);
+    T := pro.T;
+  elseif fluid == 3 then
+    assert(Xco2 + Xh2o + Xo2 + Xso2 > 0, "Wrong mass fraction definition");
+    T := ThermoSysPro.Properties.FlueGases.FlueGases_T(PMF = P, HMF = h, Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2);
+  elseif fluid == 4 then
+    T := ThermoSysPro.Properties.MoltenSalt.Temperature_h(h = h);
+  elseif fluid == 5 then
+    T := ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h = h);
+  elseif fluid == 6 then
+    T := ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h = h);
+  elseif fluid == 7 then
+    pro := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph(P, h, mode);
+    T := pro.T;
+  else
+    assert(false, "incorrect fluid number");
+  end if;
+// C3H3F5
+//LogVariable(pro.x);
+// FlueGas
+/*
     LogVariable(mode);
     LogVariable(P);
     LogVariable(h);
@@ -44,42 +48,14 @@
     LogVariable(Xh2o);
     LogVariable(Xo2);
     LogVariable(Xso2);
-   */
-    assert(Xco2+Xh2o+Xo2+Xso2>0, "Wrong mass fraction definition");  /// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
-
-    T := ThermoSysPro.Properties.FlueGases.FlueGases_T(
-      PMF=P,
-      HMF=h,
-      Xco2=Xco2,
-      Xh2o=Xh2o,
-      Xo2=Xo2,
-      Xso2=Xso2);
-
-//    T := ThermoSysPro.Properties.FlueGases.FlueGases_T(P,h,Xco2,Xh2o,Xo2,Xso2);
-
-  // MoltenSalt
-  elseif fluid==4 then
-    T := ThermoSysPro.Properties.MoltenSalt.Temperature_h(h=h);
-
-  // Oil
-  elseif fluid==5 then
-    T := ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h);
-
-  // Dry Air Ideal Gas
-  elseif fluid==6 then
-    T := ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h);
-
-  // Water/Steam Simple
-  elseif  fluid==7 then
-    pro := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph(
-      P,
-      h,
-      mode);
-    T:=pro.T;
-
-  else
-    assert(false, "incorrect fluid number");  ///
-  end if;
-
-  annotation(derivative=derTemperature_derP_derh);
-end Temperature_Ph;
+   */
+/// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
+//    T := ThermoSysPro.Properties.FlueGases.FlueGases_T(P,h,Xco2,Xh2o,Xo2,Xso2);
+// MoltenSalt
+// Oil
+// Dry Air Ideal Gas
+// Water/Steam Simple
+///
+  annotation(
+    derivative = derTemperature_derP_derh);
+end Temperature_Ph;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: Temperature_Ph.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: Temperature_Ph.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/ThermalConductivity_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/ThermalConductivity_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/ThermalConductivity_Ph.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/ThermalConductivity_Ph.mo"	2022-03-10 09:58:45.488152675 +0000
@@ -1,81 +1,48 @@
-﻿within ThermoSysPro.Properties.Fluid;
-function ThermalConductivity_Ph
-  "Thermal Conductivity computation for all fluids (inputs: P, h, fluid)"
-
-  input Modelica.SIunits.AbsolutePressure P "Pressure (Pa)";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
-  input Integer fluid
-    "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
-  input Integer mode "IF97 region - 0:automatic computation";
-  input Real Xco2 "CO2 mass fraction";
-  input Real Xh2o "H2O mass fraction";
-  input Real Xo2 "O2 mass fraction";
-  input Real Xso2 "SO2 mass fraction";
-
-  output Modelica.SIunits.ThermalConductivity k "Thermal Conductivity (W/m/K)";
-protected
-  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation (Placement(
-        transformation(extent={{-80,40},{-40,80}}, rotation=0)));
-
-algorithm
-  // Water/Steam  /// FONCTIONNE EN DIPHASIQUE ???
-  if fluid==1 then
-    pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(
-      P,
-      h,
-      mode);
-    k := ThermoSysPro.Properties.WaterSteam.IF97.ThermalConductivity_rhoT(rho=pro.d,T=pro.T,P=P,region=mode);
-
-  // C3H3F5
-  elseif fluid==2 then
-  //   k := ThermoSysPro.Properties.C3H3F5.ThermalConductivity_Ph__NonFonctionnel(
-  //     P=P, h=h);
-    assert(false, "?????????? fluid = 2: the function ThermalConductivity_Ph is not available; incorrect option ?????????");
-
-  // FlueGas
-  elseif fluid==3 then
-    assert(Xco2+Xh2o+Xo2+Xso2>0, "Wrong mass fraction definition");  /// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
-    k := ThermoSysPro.Properties.FlueGases.FlueGases_k(
-      PMF=P,
-      TMF=ThermoSysPro.Properties.FlueGases.FlueGases_T(
-        PMF=P,
-        HMF=h,
-        Xco2=Xco2,
-        Xh2o=Xh2o,
-        Xo2=Xo2,
-        Xso2=Xso2),
-      Xco2=Xco2,
-      Xh2o=Xh2o,
-      Xo2=Xo2,
-      Xso2=Xso2);
-
-  // MoltenSalt
-  elseif fluid==4 then
-    k := ThermoSysPro.Properties.MoltenSalt.ThermalConductivity_T(T=
-      ThermoSysPro.Properties.MoltenSalt.Temperature_h(h=h));
-
-  // Oil
-  elseif fluid==5 then
-    k := ThermoSysPro.Properties.Oil_TherminolVP1.ThermalConductivity_T(temp=
-      ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h));
-
-  // Dry Air Ideal Gas
-  elseif fluid==6 then
-    k := ThermoSysPro.Properties.DryAirIdealGas.ThermalConductivity_Trho(
-      T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h),
-      rho=ThermoSysPro.Properties.DryAirIdealGas.Density_PT(
-        P=P, T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h)));
-
-  // Water/Steam Simple
-  elseif  fluid==7 then
-    pro := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph(
-      P,
-      h,
-      mode);
-    k := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.ThermalConductivity_rhoT(rho=pro.d,T=pro.T);
-
-  else
-    assert(false, "incorrect fluid number");  ///
-  end if;
-
-end ThermalConductivity_Ph;
+within ThermoSysPro.Properties.Fluid;
+
+function ThermalConductivity_Ph "Thermal Conductivity computation for all fluids (inputs: P, h, fluid)"
+  input Modelica.Units.SI.AbsolutePressure P "Pressure (Pa)";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+  input Integer fluid "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
+  input Integer mode "IF97 region - 0:automatic computation";
+  input Real Xco2 "CO2 mass fraction";
+  input Real Xh2o "H2O mass fraction";
+  input Real Xo2 "O2 mass fraction";
+  input Real Xso2 "SO2 mass fraction";
+  output Modelica.Units.SI.ThermalConductivity k "Thermal Conductivity (W/m/K)";
+protected
+  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation(
+    Placement(transformation(extent = {{-80, 40}, {-40, 80}}, rotation = 0)));
+algorithm
+// Water/Steam  /// FONCTIONNE EN DIPHASIQUE ???
+  if fluid == 1 then
+    pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(P, h, mode);
+    k := ThermoSysPro.Properties.WaterSteam.IF97.ThermalConductivity_rhoT(rho = pro.d, T = pro.T, P = P, region = mode);
+  elseif fluid == 2 then
+    assert(false, "?????????? fluid = 2: the function ThermalConductivity_Ph is not available; incorrect option ?????????");
+  elseif fluid == 3 then
+    assert(Xco2 + Xh2o + Xo2 + Xso2 > 0, "Wrong mass fraction definition");
+    k := ThermoSysPro.Properties.FlueGases.FlueGases_k(PMF = P, TMF = ThermoSysPro.Properties.FlueGases.FlueGases_T(PMF = P, HMF = h, Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2), Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2);
+  elseif fluid == 4 then
+    k := ThermoSysPro.Properties.MoltenSalt.ThermalConductivity_T(T = ThermoSysPro.Properties.MoltenSalt.Temperature_h(h = h));
+  elseif fluid == 5 then
+    k := ThermoSysPro.Properties.Oil_TherminolVP1.ThermalConductivity_T(temp = ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h = h));
+  elseif fluid == 6 then
+    k := ThermoSysPro.Properties.DryAirIdealGas.ThermalConductivity_Trho(T = ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h = h), rho = ThermoSysPro.Properties.DryAirIdealGas.Density_PT(P = P, T = ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h = h)));
+  elseif fluid == 7 then
+    pro := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph(P, h, mode);
+    k := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.ThermalConductivity_rhoT(rho = pro.d, T = pro.T);
+  else
+    assert(false, "incorrect fluid number");
+  end if;
+// C3H3F5
+//   k := ThermoSysPro.Properties.C3H3F5.ThermalConductivity_Ph__NonFonctionnel(
+//     P=P, h=h);
+// FlueGas
+/// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
+// MoltenSalt
+// Oil
+// Dry Air Ideal Gas
+// Water/Steam Simple
+///
+end ThermalConductivity_Ph;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: ThermalConductivity_Ph.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: ThermalConductivity_Ph.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/ThermalConductivity_rhoT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/ThermalConductivity_rhoT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/ThermalConductivity_rhoT.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/ThermalConductivity_rhoT.mo"	2022-03-10 09:58:45.476152674 +0000
@@ -1,32 +1,25 @@
-within ThermoSysPro.Properties.Fluid;
-function ThermalConductivity_rhoT
-  "Thermal Conductivity computation for all fluids (inputs: rho,T, fluid)"
-
-  input Modelica.SIunits.Density rho "Density";
-  input Modelica.SIunits.Temperature T "Temperature";
-  input Modelica.SIunits.AbsolutePressure P "Pressure (Pa)";
-  input Integer region "region (valid values: 1,2,4)";
-  input Integer fluid
-    "<html>Fluid number: <br>1 - Water/Steam  <br>7 - WaterSteamSimple </html>";
-
-  output Modelica.SIunits.ThermalConductivity k "Thermal Conductivity (W/m/K)";
-
-protected
-  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation (Placement(
-        transformation(extent={{-80,40},{-40,80}}, rotation=0)));
-
-algorithm
-  // Water/Steam  ///
-  if fluid==1 then
-    k := ThermoSysPro.Properties.WaterSteam.IF97.ThermalConductivity_rhoT(rho=rho,T=T,P=P,region=region);
-
-  // Water/Steam Simple
-  elseif  fluid==7 then
-    k := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.ThermalConductivity_rhoT(rho=rho,T=T);
-    //LogVariable(k);
-
-  else
-    assert(false, "incorrect fluid number");  ///
-  end if;
-
-end ThermalConductivity_rhoT;
+within ThermoSysPro.Properties.Fluid;
+
+function ThermalConductivity_rhoT "Thermal Conductivity computation for all fluids (inputs: rho,T, fluid)"
+  input Modelica.Units.SI.Density rho "Density";
+  input Modelica.Units.SI.Temperature T "Temperature";
+  input Modelica.Units.SI.AbsolutePressure P "Pressure (Pa)";
+  input Integer region "region (valid values: 1,2,4)";
+  input Integer fluid "<html>Fluid number: <br>1 - Water/Steam  <br>7 - WaterSteamSimple </html>";
+  output Modelica.Units.SI.ThermalConductivity k "Thermal Conductivity (W/m/K)";
+protected
+  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation(
+    Placement(transformation(extent = {{-80, 40}, {-40, 80}}, rotation = 0)));
+algorithm
+// Water/Steam  ///
+  if fluid == 1 then
+    k := ThermoSysPro.Properties.WaterSteam.IF97.ThermalConductivity_rhoT(rho = rho, T = T, P = P, region = region);
+  elseif fluid == 7 then
+    k := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.ThermalConductivity_rhoT(rho = rho, T = T);
+  else
+    assert(false, "incorrect fluid number");
+  end if;
+// Water/Steam Simple
+//LogVariable(k);
+///
+end ThermalConductivity_rhoT;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: ThermalConductivity_rhoT.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: ThermalConductivity_rhoT.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Water_sat_P.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Water_sat_P.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Water_sat_P.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/Water_sat_P.mo"	2022-03-10 09:58:45.468152673 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.Fluid;
 function Water_sat_P
-  input Modelica.SIunits.AbsolutePressure P "Pressure";
+  input Modelica.Units.SI.AbsolutePressure P "Pressure";
   input Integer fluid  "Fluid number - 1: IF97 - 7: SimpleWater";
 
   output ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat lsat
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derDensity_derP_derh.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derDensity_derP_derh.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derDensity_derP_derh.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derDensity_derP_derh.mo"	2022-03-10 09:58:45.460152673 +0000
@@ -1,90 +1,76 @@
-﻿within ThermoSysPro.Properties.Fluid;
-function derDensity_derP_derh
-  "der(Density) computation for all fluids (inputs: P, h, der(P), der(h), fluid)"
-
-  input Modelica.SIunits.AbsolutePressure P "Pressure (Pa)";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
-  input Integer fluid
-    "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
-  input Integer mode "IF97 region - 0:automatic computation";
-  input Real Xco2 "CO2 mass fraction";
-  input Real Xh2o "H2O mass fraction";
-  input Real Xo2 "O2 mass fraction";
-  input Real Xso2 "SO2 mass fraction";
-  input Real der_P "Pressure time derivative (J/(kg*s))";
-  input Real der_h "Specific Enthalpy time derivative (J/(kg*s))";
-  input Real der_Xco2=0 "CO2 mass fraction";
-  input Real der_Xh2o=0 "H2O mass fraction";
-  input Real der_Xo2=0 "O2 mass fraction";
-  input Real der_Xso2=0 "SO2 mass fraction";
-
-  output Real der_rho "Density time derivative (kg/(m3*s))";
-
-protected
-  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph der_pro annotation (Placement(
-        transformation(extent={{-80,40},{-40,80}}, rotation=0)));
-protected
-  Modelica.SIunits.Temperature T "Temperature (K)";
-  Real der_T "Temperature time derivative (K/s)";
-
-///annotation(derivative(order=2)=derderDensity_derderP_derderh);
-
-algorithm
-  // Water/Steam
-  if fluid==1 then
-    der_pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph_der(p=P,h=h,mode=mode,p_der=der_P,h_der=der_h);
-    der_rho := der_pro.d;
-
-  // // C3H3F5
-  // elseif fluid==2 then
-  //   rho := ThermoSysPro.Properties.C3H3F5.Density_Ph(P=P, h=h);
-  //
-  // // FlueGas
-   elseif fluid==3 then
-     assert(Xco2+Xh2o+Xo2+Xso2>0, "Wrong mass fraction definition");  /// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
-  //   rho := ThermoSysPro.Properties.FlueGases.FlueGases_rho(
-  //     PMF=P,
-  //     TMF=ThermoSysPro.Properties.FlueGases.FlueGases_T(
-  //       PMF=P,
-  //       HMF=h,
-  //       Xco2=Xco2,
-  //       Xh2o=Xh2o,
-  //       Xo2=Xo2,
-  //       Xso2=Xso2),
-  //     Xco2=Xco2,
-  //     Xh2o=Xh2o,
-  //     Xo2=Xo2,
-  //     Xso2=Xso2);
-
-  // MoltenSalt
-  //elseif fluid==4 then
-  elseif fluid==4 then
-    der_T := ThermoSysPro.Properties.MoltenSalt.derTemperature_derh(h=h, der_h=der_h);
-    der_rho := ThermoSysPro.Properties.MoltenSalt.derDensity_derT(T=T, der_T=der_T);
-
-  // Oil
-  elseif fluid==5 then
-    // der_rho := ThermoSysPro.Properties.Oil_TherminolVP1.Density_dert(
-    //   temp=ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h),
-    //   der_temp=ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_derh(h=h,der_h=der_h));
-    T := ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h);
-    der_T := ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_derh(h=h,der_h=der_h);
-    der_rho := ThermoSysPro.Properties.Oil_TherminolVP1.Density_derT(temp=T, der_temp=der_T);
-
-  // Dry Air Ideal Gas
-  elseif fluid==6 then
-    der_rho := ThermoSysPro.Properties.DryAirIdealGas.derDensity_derP_derT(P=P,
-      T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h),
-      der_P=der_P,
-      der_T=ThermoSysPro.Properties.DryAirIdealGas.derTemperature_derh(h=h,der_h=der_h));
-
-  // Water/Steam Simple
-  elseif  fluid==7 then
-    der_pro := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph_der( p=P,h=h,mode=mode,p_der=der_P,h_der=der_h);
-    der_rho := der_pro.d;
-
-  else
-    assert(false, "incorrect fluid number");  ///
-  end if;
-
-end derDensity_derP_derh;
+within ThermoSysPro.Properties.Fluid;
+
+function derDensity_derP_derh "der(Density) computation for all fluids (inputs: P, h, der(P), der(h), fluid)"
+  input Modelica.Units.SI.AbsolutePressure P "Pressure (Pa)";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+  input Integer fluid "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
+  input Integer mode "IF97 region - 0:automatic computation";
+  input Real Xco2 "CO2 mass fraction";
+  input Real Xh2o "H2O mass fraction";
+  input Real Xo2 "O2 mass fraction";
+  input Real Xso2 "SO2 mass fraction";
+  input Real der_P "Pressure time derivative (J/(kg*s))";
+  input Real der_h "Specific Enthalpy time derivative (J/(kg*s))";
+  input Real der_Xco2 = 0 "CO2 mass fraction";
+  input Real der_Xh2o = 0 "H2O mass fraction";
+  input Real der_Xo2 = 0 "O2 mass fraction";
+  input Real der_Xso2 = 0 "SO2 mass fraction";
+  output Real der_rho "Density time derivative (kg/(m3*s))";
+protected
+  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph der_pro annotation(
+    Placement(transformation(extent = {{-80, 40}, {-40, 80}}, rotation = 0)));
+protected
+  Modelica.Units.SI.Temperature T "Temperature (K)";
+  Real der_T "Temperature time derivative (K/s)";
+  ///annotation(derivative(order=2)=derderDensity_derderP_derderh);
+algorithm
+// Water/Steam
+  if fluid == 1 then
+    der_pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph_der(p = P, h = h, mode = mode, p_der = der_P, h_der = der_h);
+    der_rho := der_pro.d;
+  elseif fluid == 3 then
+    assert(Xco2 + Xh2o + Xo2 + Xso2 > 0, "Wrong mass fraction definition");
+  elseif fluid == 4 then
+    der_T := ThermoSysPro.Properties.MoltenSalt.derTemperature_derh(h = h, der_h = der_h);
+    der_rho := ThermoSysPro.Properties.MoltenSalt.derDensity_derT(T = T, der_T = der_T);
+  elseif fluid == 5 then
+    T := ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h = h);
+    der_T := ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_derh(h = h, der_h = der_h);
+    der_rho := ThermoSysPro.Properties.Oil_TherminolVP1.Density_derT(temp = T, der_temp = der_T);
+  elseif fluid == 6 then
+    der_rho := ThermoSysPro.Properties.DryAirIdealGas.derDensity_derP_derT(P = P, T = ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h = h), der_P = der_P, der_T = ThermoSysPro.Properties.DryAirIdealGas.derTemperature_derh(h = h, der_h = der_h));
+  elseif fluid == 7 then
+    der_pro := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph_der(p = P, h = h, mode = mode, p_der = der_P, h_der = der_h);
+    der_rho := der_pro.d;
+  else
+    assert(false, "incorrect fluid number");
+  end if;
+// // C3H3F5
+// elseif fluid==2 then
+//   rho := ThermoSysPro.Properties.C3H3F5.Density_Ph(P=P, h=h);
+//
+// // FlueGas
+/// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
+//   rho := ThermoSysPro.Properties.FlueGases.FlueGases_rho(
+//     PMF=P,
+//     TMF=ThermoSysPro.Properties.FlueGases.FlueGases_T(
+//       PMF=P,
+//       HMF=h,
+//       Xco2=Xco2,
+//       Xh2o=Xh2o,
+//       Xo2=Xo2,
+//       Xso2=Xso2),
+//     Xco2=Xco2,
+//     Xh2o=Xh2o,
+//     Xo2=Xo2,
+//     Xso2=Xso2);
+// MoltenSalt
+//elseif fluid==4 then
+// Oil
+// der_rho := ThermoSysPro.Properties.Oil_TherminolVP1.Density_dert(
+//   temp=ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h),
+//   der_temp=ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_derh(h=h,der_h=der_h));
+// Dry Air Ideal Gas
+// Water/Steam Simple
+///
+end derDensity_derP_derh;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: derDensity_derP_derh.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: derDensity_derP_derh.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derDensity_derh_derP_derh.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derDensity_derh_derP_derh.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derDensity_derh_derP_derh.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derDensity_derh_derP_derh.mo"	2022-03-10 09:58:45.444152670 +0000
@@ -1,66 +1,55 @@
-﻿within ThermoSysPro.Properties.Fluid;
-function derDensity_derh_derP_derh
-  "der(Density derivative w.r.t enthalpy) computation for all fluids (inputs: P, h, der(P), der(h), fluid)"
-
-  input Modelica.SIunits.AbsolutePressure P "Pressure (Pa)";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
-  input Integer fluid
-    "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
-  input Integer mode "IF97 region - 0:automatic computation";
-  input Real Xco2 "CO2 mass fraction";
-  input Real Xh2o "H2O mass fraction";
-  input Real Xo2 "O2 mass fraction";
-  input Real Xso2 "SO2 mass fraction";
-  input Real der_P "Pressure time derivative (J/(kg*s))";
-  input Real der_h "Specific Enthalpy time derivative (J/(kg*s))";
-  input Real der_Xco2=0 "CO2 mass fraction";
-  input Real der_Xh2o=0 "H2O mass fraction";
-  input Real der_Xo2=0 "O2 mass fraction";
-  input Real der_Xso2=0 "SO2 mass fraction";
-
-  output Real der_ddhp "Time derivative of Density derivative by enthalpy";
-
-protected
-  Modelica.SIunits.Duration dt=1;
-  Modelica.SIunits.AbsolutePressure delta_P = 0.01*P;
-  Modelica.SIunits.SpecificEnthalpy delta_h = 0.01*h;
-
-///annotation(derivative(order=2)=derderDensity_derh_derderP_derderh);
-
-algorithm
-  // Water/Steam
-  if fluid==1 then
-    //
-
-  // C3H3F5
-  elseif fluid==2 then
-    //
-
-  // FlueGas
-  elseif fluid==3 then
-    assert(Xco2+Xh2o+Xo2+Xso2>0, "Wrong mass fraction definition");  /// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
-    //
-
-  // MoltenSalt
-  elseif fluid==4 then
-    //
-
-  // Oil
-  elseif fluid==5 then
-    der_ddhp := (ThermoSysPro.Properties.Fluid.Density_derh_Ph(P=P+delta_P,h=h+delta_h,fluid=fluid,mode=mode,Xco2=Xco2,Xh2o=Xh2o,Xo2=Xo2,Xso2=Xso2)
-      - ThermoSysPro.Properties.Fluid.Density_derh_Ph(P=P-delta_P,h=h-delta_h,fluid=fluid,mode=mode,Xco2=Xco2,Xh2o=Xh2o,Xo2=Xo2,Xso2=Xso2))
-      / dt;
-
-  // Dry Air Ideal Gas
-  elseif fluid==6 then
-    //
-
-  // Water/Steam Simple
-  elseif  fluid==7 then
-   //
-
-  else
-    assert(false, "incorrect fluid number");  ///
-  end if;
-
-end derDensity_derh_derP_derh;
+within ThermoSysPro.Properties.Fluid;
+
+function derDensity_derh_derP_derh "der(Density derivative w.r.t enthalpy) computation for all fluids (inputs: P, h, der(P), der(h), fluid)"
+  input Modelica.Units.SI.AbsolutePressure P "Pressure (Pa)";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+  input Integer fluid "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
+  input Integer mode "IF97 region - 0:automatic computation";
+  input Real Xco2 "CO2 mass fraction";
+  input Real Xh2o "H2O mass fraction";
+  input Real Xo2 "O2 mass fraction";
+  input Real Xso2 "SO2 mass fraction";
+  input Real der_P "Pressure time derivative (J/(kg*s))";
+  input Real der_h "Specific Enthalpy time derivative (J/(kg*s))";
+  input Real der_Xco2 = 0 "CO2 mass fraction";
+  input Real der_Xh2o = 0 "H2O mass fraction";
+  input Real der_Xo2 = 0 "O2 mass fraction";
+  input Real der_Xso2 = 0 "SO2 mass fraction";
+  output Real der_ddhp "Time derivative of Density derivative by enthalpy";
+protected
+  Modelica.Units.SI.Duration dt = 1;
+  Modelica.Units.SI.AbsolutePressure delta_P = 0.01 * P;
+  Modelica.Units.SI.SpecificEnthalpy delta_h = 0.01 * h;
+  ///annotation(derivative(order=2)=derderDensity_derh_derderP_derderh);
+algorithm
+// Water/Steam
+  if fluid == 1 then
+  elseif fluid == 2 then
+
+  elseif fluid == 3 then
+    assert(Xco2 + Xh2o + Xo2 + Xso2 > 0, "Wrong mass fraction definition");
+  elseif fluid == 4 then
+
+  elseif fluid == 5 then
+    der_ddhp := (ThermoSysPro.Properties.Fluid.Density_derh_Ph(P = P + delta_P, h = h + delta_h, fluid = fluid, mode = mode, Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2) - ThermoSysPro.Properties.Fluid.Density_derh_Ph(P = P - delta_P, h = h - delta_h, fluid = fluid, mode = mode, Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2)) / dt;
+  elseif fluid == 6 then
+
+  elseif fluid == 7 then
+  else
+    assert(false, "incorrect fluid number");
+  end if;
+//
+// C3H3F5
+//
+// FlueGas
+/// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
+//
+// MoltenSalt
+//
+// Oil
+// Dry Air Ideal Gas
+//
+// Water/Steam Simple
+//
+///
+end derDensity_derh_derP_derh;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: derDensity_derh_derP_derh.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: derDensity_derh_derP_derh.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derDynamicViscosity_derP_derh.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derDynamicViscosity_derP_derh.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derDynamicViscosity_derP_derh.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derDynamicViscosity_derP_derh.mo"	2022-03-10 09:58:45.412152666 +0000
@@ -1,118 +1,90 @@
-﻿within ThermoSysPro.Properties.Fluid;
-function derDynamicViscosity_derP_derh
-  "Dynamic Viscosity computation for all fluids (inputs: P, h, fluid)"
-
-  input Modelica.SIunits.AbsolutePressure P "Pressure (Pa)";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
-  input Integer fluid
-    "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
-  input Integer mode "IF97 region - 0:automatic computation";
-  input Real Xco2 "CO2 mass fraction";
-  input Real Xh2o "H2O mass fraction";
-  input Real Xo2 "O2 mass fraction";
-  input Real Xso2 "SO2 mass fraction";
-  input Real der_rho "Density time derivative";
-  input Real der_T "Temperature time derivative";
-  input Real der_Xco2=0 "CO2 mass fraction";
-  input Real der_Xh2o=0 "H2O mass fraction";
-  input Real der_Xo2=0 "O2 mass fraction";
-  input Real der_Xso2=0 "SO2 mass fraction";
-
-  output Real der_mu "Dynamic Viscosity time derivative";
-
-    constant Real Viscosity_c0 = 0.07551475951333098;
-    constant Real Viscosity_c1 = - 0.00027760397992950003;
-    constant Real Viscosity_c2 = 0.00000034888693;
-    constant Real Viscosity_c3 = - 0.00000000014739999;
-
-protected
-  Modelica.SIunits.Duration dt=1;
-  Modelica.SIunits.AbsolutePressure delta_P = 0.001*P;
-  Modelica.SIunits.SpecificEnthalpy delta_h = 0.001*h;
-
-protected
-  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation (Placement(
-        transformation(extent={{-80,40},{-40,80}}, rotation=0)));
-
-algorithm
-  // Water/Steam  /// FONCTIONNE EN DIPHASIQUE ???
-  if fluid==1 then
-
-    //der_mu := 0.0;
-
-     der_mu :=(ThermoSysPro.Properties.Fluid.DynamicViscosity_Ph(
-     P=P + delta_P,
-     h=h + delta_h,
-     fluid=fluid,
-     mode=mode,
-     Xco2=Xco2,
-     Xh2o=Xh2o,
-     Xo2=Xo2,
-     Xso2=Xso2) - ThermoSysPro.Properties.Fluid.DynamicViscosity_Ph(
-     P=P - delta_P,
-     h=h - delta_h,
-     fluid=fluid,
-     mode=mode,
-     Xco2=Xco2,
-     Xh2o=Xh2o,
-     Xo2=Xo2,
-     Xso2=Xso2))/dt;
-
-  // C3H3F5
-  // elseif fluid==2 then
-  //   mu := ThermoSysPro.Properties.C3H3F5.DynamicViscosity_Ph__NonFonctionnel(P=
-  //     P, h=h);
-
-  // FlueGas
-  elseif fluid==3 then
-  // if fluid==3 then
-     assert(Xco2+Xh2o+Xo2+Xso2>0, "Wrong mass fraction definition");  /// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
-  //   mu := ThermoSysPro.Properties.FlueGases.FlueGases_mu(
-  //     PMF=P,
-  //     TMF=ThermoSysPro.Properties.FlueGases.FlueGases_T(
-  //       PMF=P,
-  //       HMF=h,
-  //       Xco2=Xco2,
-  //       Xh2o=Xh2o,
-  //       Xo2=Xo2,
-  //       Xso2=Xso2),
-  //     Xco2=Xco2,
-  //     Xh2o=Xh2o,
-  //     Xo2=Xo2,
-  //     Xso2=Xso2);
-
-  // MoltenSalt
-  // elseif fluid==4 then
-  //   mu := ThermoSysPro.Properties.MoltenSalt.DynamicViscosity_T(T=
-  //     ThermoSysPro.Properties.MoltenSalt.Temperature_h(h=h));
-
-  // Oil
-  //elseif fluid==5 then
-  elseif fluid==4 then
-    //der_mu := Viscosity_c1*ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_derh(h=h,der_h=der_h) + 2*Viscosity_c2*ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h)*ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_derh(h=h,der_h=der_h) + 3*Viscosity_c3*(ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h))^2*ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_derh(h=h,der_h=der_h);
+within ThermoSysPro.Properties.Fluid;
+
+function derDynamicViscosity_derP_derh "Dynamic Viscosity computation for all fluids (inputs: P, h, fluid)"
+  input Modelica.Units.SI.AbsolutePressure P "Pressure (Pa)";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+  input Integer fluid "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
+  input Integer mode "IF97 region - 0:automatic computation";
+  input Real Xco2 "CO2 mass fraction";
+  input Real Xh2o "H2O mass fraction";
+  input Real Xo2 "O2 mass fraction";
+  input Real Xso2 "SO2 mass fraction";
+  input Real der_rho "Density time derivative";
+  input Real der_T "Temperature time derivative";
+  input Real der_Xco2 = 0 "CO2 mass fraction";
+  input Real der_Xh2o = 0 "H2O mass fraction";
+  input Real der_Xo2 = 0 "O2 mass fraction";
+  input Real der_Xso2 = 0 "SO2 mass fraction";
+  output Real der_mu "Dynamic Viscosity time derivative";
+  constant Real Viscosity_c0 = 0.07551475951333098;
+  constant Real Viscosity_c1 = -0.00027760397992950003;
+  constant Real Viscosity_c2 = 0.00000034888693;
+  constant Real Viscosity_c3 = -0.00000000014739999;
+protected
+  Modelica.Units.SI.Duration dt = 1;
+  Modelica.Units.SI.AbsolutePressure delta_P = 0.001 * P;
+  Modelica.Units.SI.SpecificEnthalpy delta_h = 0.001 * h;
+protected
+  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation(
+    Placement(transformation(extent = {{-80, 40}, {-40, 80}}, rotation = 0)));
+algorithm
+// Water/Steam  /// FONCTIONNE EN DIPHASIQUE ???
+  if fluid == 1 then
+    der_mu := (ThermoSysPro.Properties.Fluid.DynamicViscosity_Ph(P = P + delta_P, h = h + delta_h, fluid = fluid, mode = mode, Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2) - ThermoSysPro.Properties.Fluid.DynamicViscosity_Ph(P = P - delta_P, h = h - delta_h, fluid = fluid, mode = mode, Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2)) / dt;
+  elseif fluid == 3 then
+    assert(Xco2 + Xh2o + Xo2 + Xso2 > 0, "Wrong mass fraction definition");
+  elseif fluid == 4 then
+
+  elseif fluid == 5 then
+
+  elseif fluid == 7 then
+  else
+    assert(false, "incorrect fluid number");
+  end if;
+//der_mu := 0.0;
+// C3H3F5
+// elseif fluid==2 then
+//   mu := ThermoSysPro.Properties.C3H3F5.DynamicViscosity_Ph__NonFonctionnel(P=
+//     P, h=h);
+// FlueGas
+// if fluid==3 then
+/// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
+//   mu := ThermoSysPro.Properties.FlueGases.FlueGases_mu(
+//     PMF=P,
+//     TMF=ThermoSysPro.Properties.FlueGases.FlueGases_T(
+//       PMF=P,
+//       HMF=h,
+//       Xco2=Xco2,
+//       Xh2o=Xh2o,
+//       Xo2=Xo2,
+//       Xso2=Xso2),
+//     Xco2=Xco2,
+//     Xh2o=Xh2o,
+//     Xo2=Xo2,
+//     Xso2=Xso2);
+// MoltenSalt
+// elseif fluid==4 then
+//   mu := ThermoSysPro.Properties.MoltenSalt.DynamicViscosity_T(T=
+//     ThermoSysPro.Properties.MoltenSalt.Temperature_h(h=h));
+// Oil
+//elseif fluid==5 then
+//der_mu := Viscosity_c1*ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_derh(h=h,der_h=der_h) + 2*Viscosity_c2*ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h)*ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_derh(h=h,der_h=der_h) + 3*Viscosity_c3*(ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h))^2*ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_derh(h=h,der_h=der_h);
 /*    der_mu := ThermoSysPro.Properties.MoltenSalt.DynamicViscosity_dert(
       temp=ThermoSysPro.Properties.MoltenSalt.Temperature_h(h=h),
       der_temp=ThermoSysPro.Properties.MoltenSalt.Temperature_derh(h=h,der_h=der_h));
-*/
-  elseif fluid==5 then
+*/
 /*    der_mu := ThermoSysPro.Properties.Oil_TherminolVP1.DynamicViscosity_dert(
       temp=ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h),
       der_temp=ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_derh(h=h,der_h=der_h));
-*/
-  // Dry Air Ideal Gas
-  // elseif fluid==6 then
-  //   mu := ThermoSysPro.Properties.DryAirIdealGas.DynamicViscosity_Trho(
-  //     T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h),
-  //     rho=ThermoSysPro.Properties.DryAirIdealGas.Density_PT(
-  //       P=P, T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h)));
-
-  elseif fluid==7 then
-    //der_mu := 0.0001;
-    //
-
-   //LogVariable(der_mu);
-  else
-    assert(false, "incorrect fluid number");  ///
-  end if;
-
-end derDynamicViscosity_derP_derh;
+*/
+// Dry Air Ideal Gas
+// elseif fluid==6 then
+//   mu := ThermoSysPro.Properties.DryAirIdealGas.DynamicViscosity_Trho(
+//     T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h),
+//     rho=ThermoSysPro.Properties.DryAirIdealGas.Density_PT(
+//       P=P, T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h)));
+//der_mu := 0.0001;
+//
+//LogVariable(der_mu);
+///
+end derDynamicViscosity_derP_derh;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: derDynamicViscosity_derP_derh.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: derDynamicViscosity_derP_derh.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derDynamicViscosity_derP_derh_old.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derDynamicViscosity_derP_derh_old.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derDynamicViscosity_derP_derh_old.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derDynamicViscosity_derP_derh_old.mo"	2022-03-10 09:58:45.388152662 +0000
@@ -1,82 +1,68 @@
-﻿within ThermoSysPro.Properties.Fluid;
-function derDynamicViscosity_derP_derh_old
-  "Dynamic Viscosity computation for all fluids (inputs: P, h, fluid)"
-
-  input Modelica.SIunits.AbsolutePressure P "Pressure (Pa)";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
-  input Integer fluid
-    "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
-  input Integer mode "IF97 region - 0:automatic computation";
-  input Real Xco2 "CO2 mass fraction";
-  input Real Xh2o "H2O mass fraction";
-  input Real Xo2 "O2 mass fraction";
-  input Real Xso2 "SO2 mass fraction";
-  input Real der_P "Pressure time derivative";
-  input Real der_h "Specific Enthalpy time derivative";
-  input Real der_Xco2=0 "CO2 mass fraction";
-  input Real der_Xh2o=0 "H2O mass fraction";
-  input Real der_Xo2=0 "O2 mass fraction";
-  input Real der_Xso2=0 "SO2 mass fraction";
-
-  output Real der_mu "Dynamic Viscosity time derivative";
-
-protected
-  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation (Placement(
-        transformation(extent={{-80,40},{-40,80}}, rotation=0)));
-
-algorithm
-  // Water/Steam  /// FONCTIONNE EN DIPHASIQUE ???
-//   if fluid==1 then
-//    der_mu := ThermoSysPro.Properties.Oil_TherminolVP1.DynamicViscosity_dert(
-//      temp=ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h),
-//      der_temp=ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_derh(h=h,der_h=der_h));
-
-  //   pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(P, h, mode);
-  //   mu := ThermoSysPro.Properties.WaterSteam.IF97.DynamicViscosity_rhoT(rho=pro.d,T=pro.T);
-
-  // C3H3F5
-  // elseif fluid==2 then
-  //   mu := ThermoSysPro.Properties.C3H3F5.DynamicViscosity_Ph__NonFonctionnel(P=
-  //     P, h=h);
-
-  // FlueGas
-  // elseif fluid==3 then
-  //   assert(Xco2+Xh2o+Xo2+Xso2>0, "Wrong mass fraction definition");  /// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
-  //   mu := ThermoSysPro.Properties.FlueGases.FlueGases_mu(
-  //     PMF=P,
-  //     TMF=ThermoSysPro.Properties.FlueGases.FlueGases_T(
-  //       PMF=P,
-  //       HMF=h,
-  //       Xco2=Xco2,
-  //       Xh2o=Xh2o,
-  //       Xo2=Xo2,
-  //       Xso2=Xso2),
-  //     Xco2=Xco2,
-  //     Xh2o=Xh2o,
-  //     Xo2=Xo2,
-  //     Xso2=Xso2);
-
-  // MoltenSalt
-  // elseif fluid==4 then
-  //   mu := ThermoSysPro.Properties.MoltenSalt.DynamicViscosity_T(T=
-  //     ThermoSysPro.Properties.MoltenSalt.Temperature_h(h=h));
-
-  // Oil
-  //elseif fluid==5 then
-  if fluid==5 then
-    der_mu := ThermoSysPro.Properties.Oil_TherminolVP1.DynamicViscosity_derT(
-      temp=ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h),
-      der_temp=ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_derh(h=h,der_h=der_h));
-
-  // Dry Air Ideal Gas
-  // elseif fluid==6 then
-  //   mu := ThermoSysPro.Properties.DryAirIdealGas.DynamicViscosity_Trho(
-  //     T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h),
-  //     rho=ThermoSysPro.Properties.DryAirIdealGas.Density_PT(
-  //       P=P, T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h)));
-
-  else
-    assert(false, "incorrect fluid number");  ///
-  end if;
-
-end derDynamicViscosity_derP_derh_old;
+within ThermoSysPro.Properties.Fluid;
+
+function derDynamicViscosity_derP_derh_old "Dynamic Viscosity computation for all fluids (inputs: P, h, fluid)"
+  input Modelica.Units.SI.AbsolutePressure P "Pressure (Pa)";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+  input Integer fluid "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
+  input Integer mode "IF97 region - 0:automatic computation";
+  input Real Xco2 "CO2 mass fraction";
+  input Real Xh2o "H2O mass fraction";
+  input Real Xo2 "O2 mass fraction";
+  input Real Xso2 "SO2 mass fraction";
+  input Real der_P "Pressure time derivative";
+  input Real der_h "Specific Enthalpy time derivative";
+  input Real der_Xco2 = 0 "CO2 mass fraction";
+  input Real der_Xh2o = 0 "H2O mass fraction";
+  input Real der_Xo2 = 0 "O2 mass fraction";
+  input Real der_Xso2 = 0 "SO2 mass fraction";
+  output Real der_mu "Dynamic Viscosity time derivative";
+protected
+  ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation(
+    Placement(transformation(extent = {{-80, 40}, {-40, 80}}, rotation = 0)));
+algorithm
+// Water/Steam  /// FONCTIONNE EN DIPHASIQUE ???
+//   if fluid==1 then
+//    der_mu := ThermoSysPro.Properties.Oil_TherminolVP1.DynamicViscosity_dert(
+//      temp=ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h),
+//      der_temp=ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_derh(h=h,der_h=der_h));
+//   pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(P, h, mode);
+//   mu := ThermoSysPro.Properties.WaterSteam.IF97.DynamicViscosity_rhoT(rho=pro.d,T=pro.T);
+// C3H3F5
+// elseif fluid==2 then
+//   mu := ThermoSysPro.Properties.C3H3F5.DynamicViscosity_Ph__NonFonctionnel(P=
+//     P, h=h);
+// FlueGas
+// elseif fluid==3 then
+//   assert(Xco2+Xh2o+Xo2+Xso2>0, "Wrong mass fraction definition");  /// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
+//   mu := ThermoSysPro.Properties.FlueGases.FlueGases_mu(
+//     PMF=P,
+//     TMF=ThermoSysPro.Properties.FlueGases.FlueGases_T(
+//       PMF=P,
+//       HMF=h,
+//       Xco2=Xco2,
+//       Xh2o=Xh2o,
+//       Xo2=Xo2,
+//       Xso2=Xso2),
+//     Xco2=Xco2,
+//     Xh2o=Xh2o,
+//     Xo2=Xo2,
+//     Xso2=Xso2);
+// MoltenSalt
+// elseif fluid==4 then
+//   mu := ThermoSysPro.Properties.MoltenSalt.DynamicViscosity_T(T=
+//     ThermoSysPro.Properties.MoltenSalt.Temperature_h(h=h));
+// Oil
+//elseif fluid==5 then
+  if fluid == 5 then
+    der_mu := ThermoSysPro.Properties.Oil_TherminolVP1.DynamicViscosity_derT(temp = ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h = h), der_temp = ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_derh(h = h, der_h = der_h));
+  else
+    assert(false, "incorrect fluid number");
+  end if;
+// Dry Air Ideal Gas
+// elseif fluid==6 then
+//   mu := ThermoSysPro.Properties.DryAirIdealGas.DynamicViscosity_Trho(
+//     T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h),
+//     rho=ThermoSysPro.Properties.DryAirIdealGas.Density_PT(
+//       P=P, T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h)));
+///
+end derDynamicViscosity_derP_derh_old;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: derDynamicViscosity_derP_derh_old.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: derDynamicViscosity_derP_derh_old.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derDynamicViscosity_derT_derrho.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derDynamicViscosity_derT_derrho.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derDynamicViscosity_derT_derrho.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derDynamicViscosity_derT_derrho.mo"	2022-03-10 09:58:45.376152661 +0000
@@ -1,101 +1,85 @@
-﻿within ThermoSysPro.Properties.Fluid;
-function derDynamicViscosity_derT_derrho
-  "Dynamic Viscosity computation for all fluids"
-
-  input Modelica.SIunits.Density rho "Density";
-  input Modelica.SIunits.Temperature T "Temperature";
-  input Integer fluid
-    "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
-  input Integer mode "IF97 region - 0:automatic computation";
-  input Real Xco2 "CO2 mass fraction";
-  input Real Xh2o "H2O mass fraction";
-  input Real Xo2 "O2 mass fraction";
-  input Real Xso2 "SO2 mass fraction";
-  input Real der_rho "Density time derivative";
-  input Real der_T "Temperature time derivative";
-  input Real der_Xco2=0 "CO2 mass fraction";
-  input Real der_Xh2o=0 "H2O mass fraction";
-  input Real der_Xo2=0 "O2 mass fraction";
-  input Real der_Xso2=0 "SO2 mass fraction";
-
-  output Real der_mu "Dynamic Viscosity time derivative";
-
-  constant Real Viscosity_c0 = 0.07551475951333098;
-  constant Real Viscosity_c1 = - 0.00027760397992950003;
-  constant Real Viscosity_c2 = 0.00000034888693;
-  constant Real Viscosity_c3 = - 0.00000000014739999;
-
-  //Modelica.SIunits.Duration dt=1;
-  //Modelica.SIunits.AbsolutePressure delta_rho = 0.01*rho;
-  //Modelica.SIunits.SpecificEnthalpy delta_T = 0.01*T;
-
-algorithm
-  // Water/Steam  /// FONCTIONNE EN DIPHASIQUE ???
-  //if fluid==1 then
-
-
-
-
-    //der_mu := 0.0;
-
-
-
-
-  // C3H3F5
-  // elseif fluid==2 then
-  //   mu := ThermoSysPro.Properties.C3H3F5.DynamicViscosity_Ph__NonFonctionnel(P=
-  //     P, h=h);
-
-  // FlueGas
-  // elseif fluid==3 then
-  if fluid==3 then
-     assert(Xco2+Xh2o+Xo2+Xso2>0, "Wrong mass fraction definition");  /// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
-  //   mu := ThermoSysPro.Properties.FlueGases.FlueGases_mu(
-  //     PMF=P,
-  //     TMF=ThermoSysPro.Properties.FlueGases.FlueGases_T(
-  //       PMF=P,
-  //       HMF=h,
-  //       Xco2=Xco2,
-  //       Xh2o=Xh2o,
-  //       Xo2=Xo2,
-  //       Xso2=Xso2),
-  //     Xco2=Xco2,
-  //     Xh2o=Xh2o,
-  //     Xo2=Xo2,
-  //     Xso2=Xso2);
-
-  // MoltenSalt
-  // elseif fluid==4 then
-  //   mu := ThermoSysPro.Properties.MoltenSalt.DynamicViscosity_T(T=
-  //     ThermoSysPro.Properties.MoltenSalt.Temperature_h(h=h));
-
-  // Oil
-  //elseif fluid==5 then
-  elseif fluid==4 then
-    //der_mu := Viscosity_c1*ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_derh(h=h,der_h=der_h) + 2*Viscosity_c2*ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h)*ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_derh(h=h,der_h=der_h) + 3*Viscosity_c3*(ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h))^2*ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_derh(h=h,der_h=der_h);
+within ThermoSysPro.Properties.Fluid;
+
+function derDynamicViscosity_derT_derrho "Dynamic Viscosity computation for all fluids"
+  input Modelica.Units.SI.Density rho "Density";
+  input Modelica.Units.SI.Temperature T "Temperature";
+  input Integer fluid "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
+  input Integer mode "IF97 region - 0:automatic computation";
+  input Real Xco2 "CO2 mass fraction";
+  input Real Xh2o "H2O mass fraction";
+  input Real Xo2 "O2 mass fraction";
+  input Real Xso2 "SO2 mass fraction";
+  input Real der_rho "Density time derivative";
+  input Real der_T "Temperature time derivative";
+  input Real der_Xco2 = 0 "CO2 mass fraction";
+  input Real der_Xh2o = 0 "H2O mass fraction";
+  input Real der_Xo2 = 0 "O2 mass fraction";
+  input Real der_Xso2 = 0 "SO2 mass fraction";
+  output Real der_mu "Dynamic Viscosity time derivative";
+  constant Real Viscosity_c0 = 0.07551475951333098;
+  constant Real Viscosity_c1 = -0.00027760397992950003;
+  constant Real Viscosity_c2 = 0.00000034888693;
+  constant Real Viscosity_c3 = -0.00000000014739999;
+  //Modelica.SIunits.Duration dt=1;
+  //Modelica.SIunits.AbsolutePressure delta_rho = 0.01*rho;
+  //Modelica.SIunits.SpecificEnthalpy delta_T = 0.01*T;
+algorithm
+// Water/Steam  /// FONCTIONNE EN DIPHASIQUE ???
+//if fluid==1 then
+//der_mu := 0.0;
+// C3H3F5
+// elseif fluid==2 then
+//   mu := ThermoSysPro.Properties.C3H3F5.DynamicViscosity_Ph__NonFonctionnel(P=
+//     P, h=h);
+// FlueGas
+// elseif fluid==3 then
+  if fluid == 3 then
+    assert(Xco2 + Xh2o + Xo2 + Xso2 > 0, "Wrong mass fraction definition");
+  elseif fluid == 4 then
+
+  elseif fluid == 5 then
+
+  elseif fluid == 7 then
+  else
+    assert(false, "incorrect fluid number");
+  end if;
+/// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
+//   mu := ThermoSysPro.Properties.FlueGases.FlueGases_mu(
+//     PMF=P,
+//     TMF=ThermoSysPro.Properties.FlueGases.FlueGases_T(
+//       PMF=P,
+//       HMF=h,
+//       Xco2=Xco2,
+//       Xh2o=Xh2o,
+//       Xo2=Xo2,
+//       Xso2=Xso2),
+//     Xco2=Xco2,
+//     Xh2o=Xh2o,
+//     Xo2=Xo2,
+//     Xso2=Xso2);
+// MoltenSalt
+// elseif fluid==4 then
+//   mu := ThermoSysPro.Properties.MoltenSalt.DynamicViscosity_T(T=
+//     ThermoSysPro.Properties.MoltenSalt.Temperature_h(h=h));
+// Oil
+//elseif fluid==5 then
+//der_mu := Viscosity_c1*ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_derh(h=h,der_h=der_h) + 2*Viscosity_c2*ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h)*ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_derh(h=h,der_h=der_h) + 3*Viscosity_c3*(ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h))^2*ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_derh(h=h,der_h=der_h);
 /*    der_mu := ThermoSysPro.Properties.MoltenSalt.DynamicViscosity_dert(
       temp=ThermoSysPro.Properties.MoltenSalt.Temperature_h(h=h),
       der_temp=ThermoSysPro.Properties.MoltenSalt.Temperature_derh(h=h,der_h=der_h));
-*/
-  elseif fluid==5 then
+*/
 /*    der_mu := ThermoSysPro.Properties.Oil_TherminolVP1.DynamicViscosity_dert(
       temp=ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=h),
       der_temp=ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_derh(h=h,der_h=der_h));
-*/
-  // Dry Air Ideal Gas
-  // elseif fluid==6 then
-  //   mu := ThermoSysPro.Properties.DryAirIdealGas.DynamicViscosity_Trho(
-  //     T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h),
-  //     rho=ThermoSysPro.Properties.DryAirIdealGas.Density_PT(
-  //       P=P, T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h)));
-
-  elseif fluid==7 then
-    //der_mu := 0.0001;
-    //
-
-   //LogVariable(der_mu);
-  else
-    assert(false, "incorrect fluid number");  ///
-  end if;
-
-end derDynamicViscosity_derT_derrho;
+*/
+// Dry Air Ideal Gas
+// elseif fluid==6 then
+//   mu := ThermoSysPro.Properties.DryAirIdealGas.DynamicViscosity_Trho(
+//     T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h),
+//     rho=ThermoSysPro.Properties.DryAirIdealGas.Density_PT(
+//       P=P, T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h)));
+//der_mu := 0.0001;
+//
+//LogVariable(der_mu);
+///
+end derDynamicViscosity_derT_derrho;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: derDynamicViscosity_derT_derrho.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: derDynamicViscosity_derT_derrho.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derDynamicViscosity_derrho_derT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derDynamicViscosity_derrho_derT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derDynamicViscosity_derrho_derT.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derDynamicViscosity_derrho_derT.mo"	2022-03-10 09:58:45.364152659 +0000
@@ -1,51 +1,42 @@
-within ThermoSysPro.Properties.Fluid;
-function derDynamicViscosity_derrho_derT
-  "Dynamic Viscosity computation for all fluids"
-
-  input Modelica.SIunits.Density rho "Density";
-  input Modelica.SIunits.Temperature T "Temperature";
-  input Integer fluid
-    "<html>Fluid number: <br>1 - Water/Steam  <br>7 - WaterSteamSimple </html>";
-  input Real der_rho "Density time derivative";
-  input Real der_T "Temperature time derivative";
-
-  output Real der_mu "Dynamic Viscosity time derivative";
-
-  //Modelica.SIunits.Duration dt=1;
-  //Modelica.SIunits.AbsolutePressure delta_rho = 0.01*rho;
-  //Modelica.SIunits.SpecificEnthalpy delta_T = 0.01*T;
-
-algorithm
-  // Water/Steam  /// FONCTIONNE EN DIPHASIQUE ???
-  if fluid==1 then
-
-    der_mu := 0.0;
-
-//     der_mu :=(ThermoSysPro.Properties.Fluid.DynamicViscosity_Ph(
-//     P=P + delta_P,
-//     h=h + delta_h,
-//     fluid=fluid,
-//     mode=mode,
-//     Xco2=Xco2,
-//     Xh2o=Xh2o,
-//     Xo2=Xo2,
-//     Xso2=Xso2) - ThermoSysPro.Properties.Fluid.DynamicViscosity_Ph(
-//     P=P - delta_P,
-//     h=h - delta_h,
-//     fluid=fluid,
-//     mode=mode,
-//     Xco2=Xco2,
-//     Xh2o=Xh2o,
-//     Xo2=Xo2,
-//     Xso2=Xso2))/dt;
-
-  elseif fluid==7 then
-    //der_mu := 0.0001;
-    //
-
-   //LogVariable(der_mu);
-  else
-    assert(false, "incorrect fluid number");  ///
-  end if;
-
-end derDynamicViscosity_derrho_derT;
+within ThermoSysPro.Properties.Fluid;
+
+function derDynamicViscosity_derrho_derT "Dynamic Viscosity computation for all fluids"
+  input Modelica.Units.SI.Density rho "Density";
+  input Modelica.Units.SI.Temperature T "Temperature";
+  input Integer fluid "<html>Fluid number: <br>1 - Water/Steam  <br>7 - WaterSteamSimple </html>";
+  input Real der_rho "Density time derivative";
+  input Real der_T "Temperature time derivative";
+  output Real der_mu "Dynamic Viscosity time derivative";
+  //Modelica.SIunits.Duration dt=1;
+  //Modelica.SIunits.AbsolutePressure delta_rho = 0.01*rho;
+  //Modelica.SIunits.SpecificEnthalpy delta_T = 0.01*T;
+algorithm
+// Water/Steam  /// FONCTIONNE EN DIPHASIQUE ???
+  if fluid == 1 then
+    der_mu := 0.0;
+  elseif fluid == 7 then
+  else
+    assert(false, "incorrect fluid number");
+  end if;
+//     der_mu :=(ThermoSysPro.Properties.Fluid.DynamicViscosity_Ph(
+//     P=P + delta_P,
+//     h=h + delta_h,
+//     fluid=fluid,
+//     mode=mode,
+//     Xco2=Xco2,
+//     Xh2o=Xh2o,
+//     Xo2=Xo2,
+//     Xso2=Xso2) - ThermoSysPro.Properties.Fluid.DynamicViscosity_Ph(
+//     P=P - delta_P,
+//     h=h - delta_h,
+//     fluid=fluid,
+//     mode=mode,
+//     Xco2=Xco2,
+//     Xh2o=Xh2o,
+//     Xo2=Xo2,
+//     Xso2=Xso2))/dt;
+//der_mu := 0.0001;
+//
+//LogVariable(der_mu);
+///
+end derDynamicViscosity_derrho_derT;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: derDynamicViscosity_derrho_derT.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: derDynamicViscosity_derrho_derT.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derSpecificEnthalpy_derP_derT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derSpecificEnthalpy_derP_derT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derSpecificEnthalpy_derP_derT.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derSpecificEnthalpy_derP_derT.mo"	2022-03-10 09:58:45.356152658 +0000
@@ -1,110 +1,63 @@
-﻿within ThermoSysPro.Properties.Fluid;
-function derSpecificEnthalpy_derP_derT
-  "der(Specific enthalpy) computation for all fluids (inputs: P, h, der(P), der(T), fluid)"
-
-  input Modelica.SIunits.AbsolutePressure P "Pressure (Pa)";
-  input Modelica.SIunits.Temperature T "Temperature (K)";
-  input Integer fluid
-    "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
-  input Integer mode "IF97 region - 0:automatic computation";
-  input Real Xco2 "CO2 mass fraction";
-  input Real Xh2o "H2O mass fraction";
-  input Real Xo2 "O2 mass fraction";
-  input Real Xso2 "SO2 mass fraction";
-  input Real der_P "Pressure time derivative";
-  input Real der_T "Temperature time derivative";
-  input Real der_Xco2=0 "CO2 mass fraction";
-  input Real der_Xh2o=0 "H2O mass fraction";
-  input Real der_Xo2=0 "O2 mass fraction";
-  input Real der_Xso2=0 "SO2 mass fraction";
-
-  output Real der_h "Specific enthalpy time derivative";
-
-protected
-  Modelica.SIunits.Duration dt=1;
-  Modelica.SIunits.AbsolutePressure delta_P = 0.001*P;
-  Modelica.SIunits.TemperatureDifference delta_T = 0.01*T;
-
-/////////////////////////////////////////////////////////////////
-  // Water/Steam, C3H3F5, FlueGas, MoltenSalt, Oil, DryAirIdealGas
-
-algorithm
-  // // Water/Steam
-  if fluid == 1 then
-  //   h := ThermoSysPro.Properties.WaterSteam.IF97.SpecificEnthalpy_PT(p=P, T=T, mode=mode);
-
-    der_h :=(ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(
-    P=P + delta_P,
-    T=T + delta_T,
-    fluid=fluid,
-    mode=mode,
-    Xco2=Xco2,
-    Xh2o=Xh2o,
-    Xo2=Xo2,
-    Xso2=Xso2) - ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(
-    P=P - delta_P,
-    T=T - delta_T,
-    fluid=fluid,
-    mode=mode,
-    Xco2=Xco2,
-    Xh2o=Xh2o,
-    Xo2=Xo2,
-    Xso2=Xso2))/dt;
-
-  //  LogVariable(der_h);
-
-  // // C3H3F5
-  // elseif fluid==2 then
-  //   T := ThermoSysPro.Properties.C3H3F5.Temperature_Ph(P=P, h=h);
-  //
-
-  // // FlueGas
-  elseif fluid==3 then
-  //if fluid==3 then
-     assert(Xco2+Xh2o+Xo2+Xso2>0, "Wrong mass fraction definition");  /// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
-  //   T := ThermoSysPro.Properties.FlueGases.FlueGases_T(
-  //     PMF=P,
-  //     HMF=h,
-  //     Xco2=Xco2,
-  //     Xh2o=Xh2o,
-  //     Xo2=Xo2,
-  //     Xso2=Xso2);
-
-    der_h :=(ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(
-    P=P + delta_P,
-    T=T + delta_T,
-    fluid=fluid,
-    mode=mode,
-    Xco2=Xco2,
-    Xh2o=Xh2o,
-    Xo2=Xo2,
-    Xso2=Xso2) - ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(
-    P=P - delta_P,
-    T=T - delta_T,
-    fluid=fluid,
-    mode=mode,
-    Xco2=Xco2,
-    Xh2o=Xh2o,
-    Xo2=Xo2,
-    Xso2=Xso2))/dt;
-
-  // // MoltenSalt
-  // elseif fluid==4 then
-  //   h := ThermoSysPro.Properties.MoltenSalt.SpecificEnthalpy_T(T=T);
-    //der_h :=  1e-9;
-
-  // Oil
-  //elseif fluid==5 then
-  elseif fluid==5 then
-    der_h :=ThermoSysPro.Properties.Oil_TherminolVP1.Enthalpy_derT(temp=T,
-      der_temp=der_T);
-
-  // // Dry Air Ideal Gas
-  // elseif fluid==6 then
-  //   h := ThermoSysPro.Properties.DryAirIdealGas.SpecificEnthalpy_T(T=T);
-
-  else
-    assert(false, "incorrect fluid number");  ///
-  end if;
-
-end derSpecificEnthalpy_derP_derT;
+within ThermoSysPro.Properties.Fluid;
+
+function derSpecificEnthalpy_derP_derT "der(Specific enthalpy) computation for all fluids (inputs: P, h, der(P), der(T), fluid)"
+  input Modelica.Units.SI.AbsolutePressure P "Pressure (Pa)";
+  input Modelica.Units.SI.Temperature T "Temperature (K)";
+  input Integer fluid "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
+  input Integer mode "IF97 region - 0:automatic computation";
+  input Real Xco2 "CO2 mass fraction";
+  input Real Xh2o "H2O mass fraction";
+  input Real Xo2 "O2 mass fraction";
+  input Real Xso2 "SO2 mass fraction";
+  input Real der_P "Pressure time derivative";
+  input Real der_T "Temperature time derivative";
+  input Real der_Xco2 = 0 "CO2 mass fraction";
+  input Real der_Xh2o = 0 "H2O mass fraction";
+  input Real der_Xo2 = 0 "O2 mass fraction";
+  input Real der_Xso2 = 0 "SO2 mass fraction";
+  output Real der_h "Specific enthalpy time derivative";
+protected
+  Modelica.Units.SI.Duration dt = 1;
+  Modelica.Units.SI.AbsolutePressure delta_P = 0.001 * P;
+  Modelica.Units.SI.TemperatureDifference delta_T = 0.01 * T;
+  /////////////////////////////////////////////////////////////////
+  // Water/Steam, C3H3F5, FlueGas, MoltenSalt, Oil, DryAirIdealGas
+algorithm
+// // Water/Steam
+  if fluid == 1 then
+    der_h := (ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(P = P + delta_P, T = T + delta_T, fluid = fluid, mode = mode, Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2) - ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(P = P - delta_P, T = T - delta_T, fluid = fluid, mode = mode, Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2)) / dt;
+  elseif fluid == 3 then
+    assert(Xco2 + Xh2o + Xo2 + Xso2 > 0, "Wrong mass fraction definition");
+    der_h := (ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(P = P + delta_P, T = T + delta_T, fluid = fluid, mode = mode, Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2) - ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(P = P - delta_P, T = T - delta_T, fluid = fluid, mode = mode, Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2)) / dt;
+  elseif fluid == 5 then
+    der_h := ThermoSysPro.Properties.Oil_TherminolVP1.Enthalpy_derT(temp = T, der_temp = der_T);
+  else
+    assert(false, "incorrect fluid number");
+  end if;
+//   h := ThermoSysPro.Properties.WaterSteam.IF97.SpecificEnthalpy_PT(p=P, T=T, mode=mode);
+//  LogVariable(der_h);
+// // C3H3F5
+// elseif fluid==2 then
+//   T := ThermoSysPro.Properties.C3H3F5.Temperature_Ph(P=P, h=h);
+//
+// // FlueGas
+//if fluid==3 then
+/// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
+//   T := ThermoSysPro.Properties.FlueGases.FlueGases_T(
+//     PMF=P,
+//     HMF=h,
+//     Xco2=Xco2,
+//     Xh2o=Xh2o,
+//     Xo2=Xo2,
+//     Xso2=Xso2);
+// // MoltenSalt
+// elseif fluid==4 then
+//   h := ThermoSysPro.Properties.MoltenSalt.SpecificEnthalpy_T(T=T);
+//der_h :=  1e-9;
+// Oil
+//elseif fluid==5 then
+// // Dry Air Ideal Gas
+// elseif fluid==6 then
+//   h := ThermoSysPro.Properties.DryAirIdealGas.SpecificEnthalpy_T(T=T);
+///
+end derSpecificEnthalpy_derP_derT;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: derSpecificEnthalpy_derP_derT.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: derSpecificEnthalpy_derP_derT.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derSpecificInternalEnergy_derP_derh.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derSpecificInternalEnergy_derP_derh.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derSpecificInternalEnergy_derP_derh.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derSpecificInternalEnergy_derP_derh.mo"	2022-03-10 09:58:45.344152657 +0000
@@ -2,8 +2,8 @@
 function derSpecificInternalEnergy_derP_derh
   "der(Specific Internal Energy) computation for all fluids (inputs: P, h, der(P), der(h), fluid)"
 
-  input Modelica.SIunits.AbsolutePressure P "Pressure (Pa)";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+  input Modelica.Units.SI.AbsolutePressure P "Pressure (Pa)";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
   input Integer fluid
     "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
   input Integer mode "IF97 region - 0:automatic computation";
@@ -21,13 +21,12 @@
   output Real der_u "Specific Internal Energy time derivative (J/kg/s)";
 
 protected
-  Modelica.SIunits.Duration dt=1;
-  Modelica.SIunits.AbsolutePressure delta_P = 0.01*P;
-  Modelica.SIunits.SpecificEnthalpy delta_h = 0.01*h;
+  Modelica.Units.SI.Duration dt=1;
+  Modelica.Units.SI.AbsolutePressure delta_P = 0.01*P;
+  Modelica.Units.SI.SpecificEnthalpy delta_h = 0.01*h;
 
 algorithm
-  // Water/Steam, C3H3F5, FlueGas, MoltenSalt, Oil, DryAirIdealGas
-
+// Water/Steam, C3H3F5, FlueGas, MoltenSalt, Oil, DryAirIdealGas
     der_u :=(ThermoSysPro.Properties.Fluid.SpecificInternalEnergy_Ph_DO_NOT_USE(
     P=P + delta_P,
     h=h + delta_h,
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derTemperature_derP_derh.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derTemperature_derP_derh.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derTemperature_derP_derh.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derTemperature_derP_derh.mo"	2022-03-10 09:58:45.336152656 +0000
@@ -1,68 +1,59 @@
-﻿within ThermoSysPro.Properties.Fluid;
-function derTemperature_derP_derh
-  "der(Temperature) computation for all fluids (inputs: P, h, fluid, der(P), der(h))"
-
-  input Modelica.SIunits.AbsolutePressure P "Pressure (Pa)";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
-  input Integer fluid
-    "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
-  input Integer mode "IF97 region - 0:automatic computation";
-  input Real Xco2 "CO2 mass fraction";
-  input Real Xh2o "H2O mass fraction";
-  input Real Xo2 "O2 mass fraction";
-  input Real Xso2 "SO2 mass fraction";
-  input Real der_P "Pressure time derivative (J/(kg*s))";
-  input Real der_h "Specific Enthalpy time derivative (J/(kg*s))";
-  input Real der_Xco2=0 "CO2 mass fraction";
-  input Real der_Xh2o=0 "H2O mass fraction";
-  input Real der_Xo2=0 "O2 mass fraction";
-  input Real der_Xso2=0 "SO2 mass fraction";
-
-  output Real der_T "Temperature time derivative (K/s)";
-
-  //ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation (extent=[-80,40; -40,80]);
-
-///annotation(derivative(order=2)=derderTemperature_derderP_derderh);
-
-algorithm
-//   // Water/Steam
-//   if fluid==1 then
-//     pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(
-//       P,
-//       h,
-//       mode);
-//     T:=pro.T;
-//
-//   // C3H3F5
-//   elseif fluid==2 then
-//     T := ThermoSysPro.Properties.C3H3F5.Temperature_Ph(P=P, h=h);
-//
-//   // FlueGas
-//   elseif fluid==3 then
-//     assert(Xco2+Xh2o+Xo2+Xso2>0, "Wrong mass fraction definition");  /// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
-//     T := ThermoSysPro.Properties.FlueGases.FlueGases_T(
-//       PMF=P,
-//       HMF=h,
-//       Xco2=Xco2,
-//       Xh2o=Xh2o,
-//       Xo2=Xo2,
-//       Xso2=Xso2);
-//
-//   // MoltenSalt
-//   elseif fluid==4 then
-//     T := ThermoSysPro.Properties.MoltenSalt.Temperature_h(h=h);
-
-  // Oil
-  //elseif fluid==5 then
-  if fluid==5 then
-    der_T := ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_derh(h=h,der_h=der_h);
-
-//   // Dry Air Ideal Gas
-//   elseif fluid==6 then
-//     T := ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h);
-
-  else
-    assert(false, "incorrect fluid number");  ///
-  end if;
-
-end derTemperature_derP_derh;
+within ThermoSysPro.Properties.Fluid;
+
+function derTemperature_derP_derh "der(Temperature) computation for all fluids (inputs: P, h, fluid, der(P), der(h))"
+  input Modelica.Units.SI.AbsolutePressure P "Pressure (Pa)";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+  input Integer fluid "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
+  input Integer mode "IF97 region - 0:automatic computation";
+  input Real Xco2 "CO2 mass fraction";
+  input Real Xh2o "H2O mass fraction";
+  input Real Xo2 "O2 mass fraction";
+  input Real Xso2 "SO2 mass fraction";
+  input Real der_P "Pressure time derivative (J/(kg*s))";
+  input Real der_h "Specific Enthalpy time derivative (J/(kg*s))";
+  input Real der_Xco2 = 0 "CO2 mass fraction";
+  input Real der_Xh2o = 0 "H2O mass fraction";
+  input Real der_Xo2 = 0 "O2 mass fraction";
+  input Real der_Xso2 = 0 "SO2 mass fraction";
+  output Real der_T "Temperature time derivative (K/s)";
+  //ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation (extent=[-80,40; -40,80]);
+  ///annotation(derivative(order=2)=derderTemperature_derderP_derderh);
+algorithm
+//   // Water/Steam
+//   if fluid==1 then
+//     pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(
+//       P,
+//       h,
+//       mode);
+//     T:=pro.T;
+//
+//   // C3H3F5
+//   elseif fluid==2 then
+//     T := ThermoSysPro.Properties.C3H3F5.Temperature_Ph(P=P, h=h);
+//
+//   // FlueGas
+//   elseif fluid==3 then
+//     assert(Xco2+Xh2o+Xo2+Xso2>0, "Wrong mass fraction definition");  /// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
+//     T := ThermoSysPro.Properties.FlueGases.FlueGases_T(
+//       PMF=P,
+//       HMF=h,
+//       Xco2=Xco2,
+//       Xh2o=Xh2o,
+//       Xo2=Xo2,
+//       Xso2=Xso2);
+//
+//   // MoltenSalt
+//   elseif fluid==4 then
+//     T := ThermoSysPro.Properties.MoltenSalt.Temperature_h(h=h);
+// Oil
+//elseif fluid==5 then
+  if fluid == 5 then
+    der_T := ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_derh(h = h, der_h = der_h);
+  else
+    assert(false, "incorrect fluid number");
+  end if;
+//   // Dry Air Ideal Gas
+//   elseif fluid==6 then
+//     T := ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h=h);
+///
+end derTemperature_derP_derh;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: derTemperature_derP_derh.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: derTemperature_derP_derh.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derderDensity_derderP_derderh.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derderDensity_derderP_derderh.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derderDensity_derderP_derderh.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derderDensity_derderP_derderh.mo"	2022-03-10 09:58:45.324152654 +0000
@@ -1,71 +1,60 @@
-﻿within ThermoSysPro.Properties.Fluid;
-function derderDensity_derderP_derderh
-  "der(der(Density)) computation for all fluids (inputs: P, h, der(P), der(h), der(der(P)), der(der(h)), fluid)"
-
-  input Modelica.SIunits.AbsolutePressure P "Pressure (Pa)";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
-  input Integer fluid
-    "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
-  input Integer mode "IF97 region - 0:automatic computation";
-  input Real Xco2 "CO2 mass fraction";
-  input Real Xh2o "H2O mass fraction";
-  input Real Xo2 "O2 mass fraction";
-  input Real Xso2 "SO2 mass fraction";
-  input Real der_P "Pressure time derivative (J/(kg*s))";
-  input Real der_h "Specific Enthalpy time derivative (J/(kg*s))";
-  input Real der_Xco2=0 "CO2 mass fraction";
-  input Real der_Xh2o=0 "H2O mass fraction";
-  input Real der_Xo2=0 "O2 mass fraction";
-  input Real der_Xso2=0 "SO2 mass fraction";
-  input Real der_2_P;
-  input Real der_2_h;
-  input Real der_2_Xco2=0;
-  input Real der_2_Xh2o=0;
-  input Real der_2_Xo2=0;
-  input Real der_2_Xso2=0;
-
-  output Real der_2_rho
-    "Time derivative of Density time derivative (kg/(m3*s2))";
-
-protected
-  Modelica.SIunits.Duration dt=1;
-  Modelica.SIunits.AbsolutePressure delta_P = 0.01*P;
-  Modelica.SIunits.SpecificEnthalpy delta_h = 0.01*h;
-
-algorithm
-  // Water/Steam
-  if fluid==1 then
-    //
-
-  // C3H3F5
-  elseif fluid==2 then
-    //
-
-  // FlueGas
-  elseif fluid==3 then
-    assert(Xco2+Xh2o+Xo2+Xso2>0, "Wrong mass fraction definition");  /// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
-    //
-
-  // MoltenSalt
-  elseif fluid==4 then
-    //
-
-  // Oil
-  elseif fluid==5 then
-    der_2_rho := (ThermoSysPro.Properties.Fluid.derDensity_derP_derh(P=P+delta_P,h=h+delta_h,der_P=der_P,der_h=der_h,fluid=fluid,mode=mode,Xco2=Xco2,Xh2o=Xh2o,Xo2=Xo2,Xso2=Xso2)
-      - ThermoSysPro.Properties.Fluid.derDensity_derP_derh(P=P-delta_P,h=h-delta_h,der_P=der_P,der_h=der_h,fluid=fluid,mode=mode,Xco2=Xco2,Xh2o=Xh2o,Xo2=Xo2,Xso2=Xso2))
-      / dt;
-
-  // Dry Air Ideal Gas
-  elseif fluid==6 then
-    //
-
-  // Water/Steam Simple
-  elseif  fluid==7 then
-   //
-
-  else
-    assert(false, "incorrect fluid number");  ///
-  end if;
-
-end derderDensity_derderP_derderh;
+within ThermoSysPro.Properties.Fluid;
+
+function derderDensity_derderP_derderh "der(der(Density)) computation for all fluids (inputs: P, h, der(P), der(h), der(der(P)), der(der(h)), fluid)"
+  input Modelica.Units.SI.AbsolutePressure P "Pressure (Pa)";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+  input Integer fluid "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
+  input Integer mode "IF97 region - 0:automatic computation";
+  input Real Xco2 "CO2 mass fraction";
+  input Real Xh2o "H2O mass fraction";
+  input Real Xo2 "O2 mass fraction";
+  input Real Xso2 "SO2 mass fraction";
+  input Real der_P "Pressure time derivative (J/(kg*s))";
+  input Real der_h "Specific Enthalpy time derivative (J/(kg*s))";
+  input Real der_Xco2 = 0 "CO2 mass fraction";
+  input Real der_Xh2o = 0 "H2O mass fraction";
+  input Real der_Xo2 = 0 "O2 mass fraction";
+  input Real der_Xso2 = 0 "SO2 mass fraction";
+  input Real der_2_P;
+  input Real der_2_h;
+  input Real der_2_Xco2 = 0;
+  input Real der_2_Xh2o = 0;
+  input Real der_2_Xo2 = 0;
+  input Real der_2_Xso2 = 0;
+  output Real der_2_rho "Time derivative of Density time derivative (kg/(m3*s2))";
+protected
+  Modelica.Units.SI.Duration dt = 1;
+  Modelica.Units.SI.AbsolutePressure delta_P = 0.01 * P;
+  Modelica.Units.SI.SpecificEnthalpy delta_h = 0.01 * h;
+algorithm
+// Water/Steam
+  if fluid == 1 then
+  elseif fluid == 2 then
+
+  elseif fluid == 3 then
+    assert(Xco2 + Xh2o + Xo2 + Xso2 > 0, "Wrong mass fraction definition");
+  elseif fluid == 4 then
+
+  elseif fluid == 5 then
+    der_2_rho := (ThermoSysPro.Properties.Fluid.derDensity_derP_derh(P = P + delta_P, h = h + delta_h, der_P = der_P, der_h = der_h, fluid = fluid, mode = mode, Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2) - ThermoSysPro.Properties.Fluid.derDensity_derP_derh(P = P - delta_P, h = h - delta_h, der_P = der_P, der_h = der_h, fluid = fluid, mode = mode, Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2)) / dt;
+  elseif fluid == 6 then
+
+  elseif fluid == 7 then
+  else
+    assert(false, "incorrect fluid number");
+  end if;
+//
+// C3H3F5
+//
+// FlueGas
+/// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
+//
+// MoltenSalt
+//
+// Oil
+// Dry Air Ideal Gas
+//
+// Water/Steam Simple
+//
+///
+end derderDensity_derderP_derderh;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: derderDensity_derderP_derderh.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: derderDensity_derderP_derderh.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derderDensity_derh_derderP_derderh.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derderDensity_derh_derderP_derderh.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derderDensity_derh_derderP_derderh.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derderDensity_derh_derderP_derderh.mo"	2022-03-10 09:58:45.308152652 +0000
@@ -1,71 +1,60 @@
-﻿within ThermoSysPro.Properties.Fluid;
-function derderDensity_derh_derderP_derderh
-  "der(der(Density derivative w.r.t enthalpy)) computation for all fluids (inputs: P, h, der(P), der(h), der(der(P)), der(der(h)), fluid)"
-
-  input Modelica.SIunits.AbsolutePressure P "Pressure (Pa)";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
-  input Integer fluid
-    "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
-  input Integer mode "IF97 region - 0:automatic computation";
-  input Real Xco2 "CO2 mass fraction";
-  input Real Xh2o "H2O mass fraction";
-  input Real Xo2 "O2 mass fraction";
-  input Real Xso2 "SO2 mass fraction";
-  input Real der_P "Pressure time derivative (J/(kg*s))";
-  input Real der_h "Specific Enthalpy time derivative (J/(kg*s))";
-  input Real der_Xco2=0 "CO2 mass fraction";
-  input Real der_Xh2o=0 "H2O mass fraction";
-  input Real der_Xo2=0 "O2 mass fraction";
-  input Real der_Xso2=0 "SO2 mass fraction";
-  input Real der_2_P;
-  input Real der_2_h;
-  input Real der_2_Xco2=0;
-  input Real der_2_Xh2o=0;
-  input Real der_2_Xo2=0;
-  input Real der_2_Xso2=0;
-
-  output Real der_2_ddhp
-    "Time derivative of time derivative of Density derivative by enthalpy";
-
-protected
-  Modelica.SIunits.Duration dt=1;
-  Modelica.SIunits.AbsolutePressure delta_P = 0.01*P;
-  Modelica.SIunits.SpecificEnthalpy delta_h = 0.01*h;
-
-algorithm
-  // Water/Steam
-  if fluid==1 then
-    //
-
-  // C3H3F5
-  elseif fluid==2 then
-    //
-
-  // FlueGas
-  elseif fluid==3 then
-    assert(Xco2+Xh2o+Xo2+Xso2>0, "Wrong mass fraction definition");  /// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
-    //
-
-  // MoltenSalt
-  elseif fluid==4 then
-    //
-
-  // Oil
-  elseif fluid==5 then
-    der_2_ddhp := (ThermoSysPro.Properties.Fluid.derDensity_derh_derP_derh(P=P+delta_P,h=h+delta_h,der_P=der_P,der_h=der_h,fluid=fluid,mode=mode,Xco2=Xco2,Xh2o=Xh2o,Xo2=Xo2,Xso2=Xso2)
-      - ThermoSysPro.Properties.Fluid.derDensity_derh_derP_derh(P=P-delta_P,h=h-delta_h,der_P=der_P,der_h=der_h,fluid=fluid,mode=mode,Xco2=Xco2,Xh2o=Xh2o,Xo2=Xo2,Xso2=Xso2))
-      / dt;
-
-  // Dry Air Ideal Gas
-  elseif fluid==6 then
-    //
-
-  // Water/Steam Simple
-  elseif  fluid==7 then
-   //
-
-  else
-    assert(false, "incorrect fluid number");  ///
-  end if;
-
-end derderDensity_derh_derderP_derderh;
+within ThermoSysPro.Properties.Fluid;
+
+function derderDensity_derh_derderP_derderh "der(der(Density derivative w.r.t enthalpy)) computation for all fluids (inputs: P, h, der(P), der(h), der(der(P)), der(der(h)), fluid)"
+  input Modelica.Units.SI.AbsolutePressure P "Pressure (Pa)";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+  input Integer fluid "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
+  input Integer mode "IF97 region - 0:automatic computation";
+  input Real Xco2 "CO2 mass fraction";
+  input Real Xh2o "H2O mass fraction";
+  input Real Xo2 "O2 mass fraction";
+  input Real Xso2 "SO2 mass fraction";
+  input Real der_P "Pressure time derivative (J/(kg*s))";
+  input Real der_h "Specific Enthalpy time derivative (J/(kg*s))";
+  input Real der_Xco2 = 0 "CO2 mass fraction";
+  input Real der_Xh2o = 0 "H2O mass fraction";
+  input Real der_Xo2 = 0 "O2 mass fraction";
+  input Real der_Xso2 = 0 "SO2 mass fraction";
+  input Real der_2_P;
+  input Real der_2_h;
+  input Real der_2_Xco2 = 0;
+  input Real der_2_Xh2o = 0;
+  input Real der_2_Xo2 = 0;
+  input Real der_2_Xso2 = 0;
+  output Real der_2_ddhp "Time derivative of time derivative of Density derivative by enthalpy";
+protected
+  Modelica.Units.SI.Duration dt = 1;
+  Modelica.Units.SI.AbsolutePressure delta_P = 0.01 * P;
+  Modelica.Units.SI.SpecificEnthalpy delta_h = 0.01 * h;
+algorithm
+// Water/Steam
+  if fluid == 1 then
+  elseif fluid == 2 then
+
+  elseif fluid == 3 then
+    assert(Xco2 + Xh2o + Xo2 + Xso2 > 0, "Wrong mass fraction definition");
+  elseif fluid == 4 then
+
+  elseif fluid == 5 then
+    der_2_ddhp := (ThermoSysPro.Properties.Fluid.derDensity_derh_derP_derh(P = P + delta_P, h = h + delta_h, der_P = der_P, der_h = der_h, fluid = fluid, mode = mode, Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2) - ThermoSysPro.Properties.Fluid.derDensity_derh_derP_derh(P = P - delta_P, h = h - delta_h, der_P = der_P, der_h = der_h, fluid = fluid, mode = mode, Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2)) / dt;
+  elseif fluid == 6 then
+
+  elseif fluid == 7 then
+  else
+    assert(false, "incorrect fluid number");
+  end if;
+//
+// C3H3F5
+//
+// FlueGas
+/// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
+//
+// MoltenSalt
+//
+// Oil
+// Dry Air Ideal Gas
+//
+// Water/Steam Simple
+//
+///
+end derderDensity_derh_derderP_derderh;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: derderDensity_derh_derderP_derderh.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: derderDensity_derh_derderP_derderh.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derderTemperature_derderP_derderh.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derderTemperature_derderP_derderh.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derderTemperature_derderP_derderh.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid/derderTemperature_derderP_derderh.mo"	2022-03-10 09:58:45.296152652 +0000
@@ -1,70 +1,60 @@
-﻿within ThermoSysPro.Properties.Fluid;
-function derderTemperature_derderP_derderh
-  "der(der(Temperature)) computation for all fluids (inputs: P, h, der(P), der(h), der(der(P)), der(der(h)), fluid)"
-
-  input Modelica.SIunits.AbsolutePressure P "Pressure (Pa)";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
-  input Integer fluid
-    "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
-  input Integer mode "IF97 region - 0:automatic computation";
-  input Real Xco2 "CO2 mass fraction";
-  input Real Xh2o "H2O mass fraction";
-  input Real Xo2 "O2 mass fraction";
-  input Real Xso2 "SO2 mass fraction";
-  input Real der_P "Pressure time derivative (J/(kg*s))";
-  input Real der_h "Specific Enthalpy time derivative (J/(kg*s))";
-  input Real der_Xco2=0 "CO2 mass fraction";
-  input Real der_Xh2o=0 "H2O mass fraction";
-  input Real der_Xo2=0 "O2 mass fraction";
-  input Real der_Xso2=0 "SO2 mass fraction";
-  input Real der_2_P;
-  input Real der_2_h;
-  input Real der_2_Xco2=0;
-  input Real der_2_Xh2o=0;
-  input Real der_2_Xo2=0;
-  input Real der_2_Xso2=0;
-
-  output Real der_2_T "Time derivative of Temperature time derivative (K/s2)";
-
-protected
-  Modelica.SIunits.Duration dt=1;
-  Modelica.SIunits.AbsolutePressure delta_P = 0.01*P;
-  Modelica.SIunits.SpecificEnthalpy delta_h = 0.01*h;
-
-algorithm
-  // Water/Steam
-  if fluid==1 then
-    //
-
-  // C3H3F5
-  elseif fluid==2 then
-    //
-
-  // FlueGas
-  elseif fluid==3 then
-    assert(Xco2+Xh2o+Xo2+Xso2>0, "Wrong mass fraction definition");  /// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
-    //
-
-  // MoltenSalt
-  elseif fluid==4 then
-    //
-
-  // Oil
-  elseif fluid==5 then
-    der_2_T := (ThermoSysPro.Properties.Fluid.derTemperature_derP_derh(P=P+delta_P,h=h+delta_h,der_P=der_P,der_h=der_h,fluid=fluid,mode=mode,Xco2=Xco2,Xh2o=Xh2o,Xo2=Xo2,Xso2=Xso2)
-      - ThermoSysPro.Properties.Fluid.derTemperature_derP_derh(P=P-delta_P,h=h-delta_h,der_P=der_P,der_h=der_h,fluid=fluid,mode=mode,Xco2=Xco2,Xh2o=Xh2o,Xo2=Xo2,Xso2=Xso2))
-      / dt;
-
-  // Dry Air Ideal Gas
-  elseif fluid==6 then
-    //
-
-  // Water/Steam Simple
-  elseif  fluid==7 then
-   //
-
-  else
-    assert(false, "incorrect fluid number");  ///
-  end if;
-
-end derderTemperature_derderP_derderh;
+within ThermoSysPro.Properties.Fluid;
+
+function derderTemperature_derderP_derderh "der(der(Temperature)) computation for all fluids (inputs: P, h, der(P), der(h), der(der(P)), der(der(h)), fluid)"
+  input Modelica.Units.SI.AbsolutePressure P "Pressure (Pa)";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+  input Integer fluid "<html>Fluid number: <br>1 - Water/Steam <br>2 - C3H3F5 <br>3 - FlueGases <br>4 - MoltenSalt <br>5 - Oil <br>6 - DryAirIdealGas <br>7 - WaterSteamSimple </html>";
+  input Integer mode "IF97 region - 0:automatic computation";
+  input Real Xco2 "CO2 mass fraction";
+  input Real Xh2o "H2O mass fraction";
+  input Real Xo2 "O2 mass fraction";
+  input Real Xso2 "SO2 mass fraction";
+  input Real der_P "Pressure time derivative (J/(kg*s))";
+  input Real der_h "Specific Enthalpy time derivative (J/(kg*s))";
+  input Real der_Xco2 = 0 "CO2 mass fraction";
+  input Real der_Xh2o = 0 "H2O mass fraction";
+  input Real der_Xo2 = 0 "O2 mass fraction";
+  input Real der_Xso2 = 0 "SO2 mass fraction";
+  input Real der_2_P;
+  input Real der_2_h;
+  input Real der_2_Xco2 = 0;
+  input Real der_2_Xh2o = 0;
+  input Real der_2_Xo2 = 0;
+  input Real der_2_Xso2 = 0;
+  output Real der_2_T "Time derivative of Temperature time derivative (K/s2)";
+protected
+  Modelica.Units.SI.Duration dt = 1;
+  Modelica.Units.SI.AbsolutePressure delta_P = 0.01 * P;
+  Modelica.Units.SI.SpecificEnthalpy delta_h = 0.01 * h;
+algorithm
+// Water/Steam
+  if fluid == 1 then
+  elseif fluid == 2 then
+
+  elseif fluid == 3 then
+    assert(Xco2 + Xh2o + Xo2 + Xso2 > 0, "Wrong mass fraction definition");
+  elseif fluid == 4 then
+
+  elseif fluid == 5 then
+    der_2_T := (ThermoSysPro.Properties.Fluid.derTemperature_derP_derh(P = P + delta_P, h = h + delta_h, der_P = der_P, der_h = der_h, fluid = fluid, mode = mode, Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2) - ThermoSysPro.Properties.Fluid.derTemperature_derP_derh(P = P - delta_P, h = h - delta_h, der_P = der_P, der_h = der_h, fluid = fluid, mode = mode, Xco2 = Xco2, Xh2o = Xh2o, Xo2 = Xo2, Xso2 = Xso2)) / dt;
+  elseif fluid == 6 then
+
+  elseif fluid == 7 then
+  else
+    assert(false, "incorrect fluid number");
+  end if;
+//
+// C3H3F5
+//
+// FlueGas
+/// Commentaire ajouté (si fluid==2, vérifie que les fractions massiques sont bien fournies en Input)
+//
+// MoltenSalt
+//
+// Oil
+// Dry Air Ideal Gas
+//
+// Water/Steam Simple
+//
+///
+end derderTemperature_derderP_derderh;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: derderTemperature_derderP_derderh.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Fluid: derderTemperature_derderP_derderh.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/Density_T.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/Density_T.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/Density_T.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/Density_T.mo"	2022-03-10 09:58:45.276152648 +0000
@@ -1,12 +1,11 @@
 within ThermoSysPro.Properties.MoltenSalt;
 function Density_T "Density computation for Salt (input T)"
 
-  input Modelica.SIunits.Temperature T "Temperature (K)";
-  output Modelica.SIunits.Density rho "Density (kg/m3)";
+  input Modelica.Units.SI.Temperature T "Temperature (K)";
+  output Modelica.Units.SI.Density rho "Density (kg/m3)";
 
 algorithm
-  rho := 2263.87142553064 - 0.636188210739603*T;  // Stephanie SQMSolarSalt
-  //rho := 2263.7234 - 0.636*T;  // Stephanie SolarSalt
-
+  rho := 2263.87142553064 - 0.636188210739603*T;  // Stephanie SQMSolarSalt
+//rho := 2263.7234 - 0.636*T;  // Stephanie SolarSalt
   annotation(derivative = derDensity_derT);
 end Density_T;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/DynamicViscosity_T.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/DynamicViscosity_T.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/DynamicViscosity_T.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/DynamicViscosity_T.mo"	2022-03-10 09:58:45.268152647 +0000
@@ -1,14 +1,13 @@
-﻿within ThermoSysPro.Properties.MoltenSalt;
+within ThermoSysPro.Properties.MoltenSalt;
 function DynamicViscosity_T "Dynamic Viscosity computation for Salt (input T)"
 
-  input Modelica.SIunits.Temperature T "Temperature (K)";
-  output Modelica.SIunits.DynamicViscosity mu "Dynamic Viscosity (Pa.s)";
+  input Modelica.Units.SI.Temperature T "Temperature (K)";
+  output Modelica.Units.SI.DynamicViscosity mu "Dynamic Viscosity (Pa.s)";
 
 algorithm
-  //mu :=( 0.0755147595 - 0.00027760398*T + 3.4888693*1e-7*T^2 - 1.4739999*1e-10*T^3);   // temperature in °K
-
-  //New
-//    mu := (22.714 - 0.12*(T - 273.15) + 2.281*1e-7*(T - 273.15)**2 - 1.474*1e-10*(T - 273.15)**3);   // temperature in °C
+//mu :=( 0.0755147595 - 0.00027760398*T + 3.4888693*1e-7*T^2 - 1.4739999*1e-10*T^3);   // temperature in °K
+//New
+//    mu := (22.714 - 0.12*(T - 273.15) + 2.281*1e-7*(T - 273.15)**2 - 1.474*1e-10*(T - 273.15)**3);   // temperature in °C
   mu :=if (T<=873.15) then ( 0.0755147595 - 0.00027760398*T + 3.4888693*1e-7*T^2 - 1.4739999*1e-10*T^3) else 0.0009916065819282893;      // temperature in °K
 
 end DynamicViscosity_T;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/DynamicViscosity_dert.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/DynamicViscosity_dert.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/DynamicViscosity_dert.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/DynamicViscosity_dert.mo"	2022-03-10 09:58:45.264152648 +0000
@@ -2,7 +2,7 @@
 function DynamicViscosity_dert
   "der Dynamic Viscosity computation for Salt (input T)"
 
-  input Modelica.SIunits.Temperature temp "Temperature (K)";
+  input Modelica.Units.SI.Temperature temp "Temperature (K)";
   input Real der_temp "Fluid temperature time derivative (K/s)";
   output Real der_mu "Dynamic Viscosity time derivative(Pa)";
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/HitecLimits.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/HitecLimits.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/HitecLimits.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/HitecLimits.mo"	2022-03-10 09:58:45.260152646 +0000
@@ -4,33 +4,33 @@
   constant Real MINPOS=1.0e-9
     "minimal value for physical variables which are always > 0.0";
 
-  constant Modelica.SIunits.Density DMIN=1690.584 "Minimum density";
-  constant Modelica.SIunits.Density DMAX=1975.332 "Maximum densitye";
-  constant Modelica.SIunits.Density DNOM=1938.0 "Nominal density";
-  constant Modelica.SIunits.ThermalConductivity LAMMIN=0.239466
+
+  constant Modelica.Units.SI.Density DMIN=1690.584 "Minimum density";
+  constant Modelica.Units.SI.Density DMAX=1975.332 "Maximum densitye";
+  constant Modelica.Units.SI.Density DNOM=1938.0 "Nominal density";
+  constant Modelica.Units.SI.ThermalConductivity LAMMIN=0.239466
     "Minimum thermal conductivity";
-  constant Modelica.SIunits.ThermalConductivity LAMNOM=0.46018
+  constant Modelica.Units.SI.ThermalConductivity LAMNOM=0.46018
     "Nominal thermal conductivity";
-  constant Modelica.SIunits.ThermalConductivity LAMMAX=0.493483
+  constant Modelica.Units.SI.ThermalConductivity LAMMAX=0.493483
     "Maximum thermal conductivity";
-  constant Modelica.SIunits.DynamicViscosity ETAMIN=9.93e-4
+  constant Modelica.Units.SI.DynamicViscosity ETAMIN=9.93e-4
     "Minimum dynamic viscosity";
-  constant Modelica.SIunits.DynamicViscosity ETAMAX=1.3e-2
+  constant Modelica.Units.SI.DynamicViscosity ETAMAX=1.3e-2
     "Maximum dynamic viscosity";
-  constant Modelica.SIunits.DynamicViscosity ETANOM=7.29e-3
+  constant Modelica.Units.SI.DynamicViscosity ETANOM=7.29e-3
     "Nominal dynamic viscosity";
 
-  constant Modelica.SIunits.SpecificHeatCapacity CPMIN=MINPOS
+  constant Modelica.Units.SI.SpecificHeatCapacity CPMIN=MINPOS
     "Minimum specific heat capacity";
-  constant Modelica.SIunits.SpecificHeatCapacity CPMAX=Modelica.Constants.inf
+  constant Modelica.Units.SI.SpecificHeatCapacity CPMAX=Modelica.Constants.inf
     "Maximum specific heat capacity";
-  constant Modelica.SIunits.SpecificHeatCapacity CPNOM=1.571e3
+  constant Modelica.Units.SI.SpecificHeatCapacity CPNOM=1.571e3
     "Nominal specific heat capacity";
 
-  constant Modelica.SIunits.Temperature TMIN=200 "Minimum temperature";
-  constant Modelica.SIunits.Temperature TMAX=10000 "Maximum temperature";
-  constant Modelica.SIunits.Temperature TNOM=800 "Nominal temperature";
-
+  constant Modelica.Units.SI.Temperature TMIN=200 "Minimum temperature";
+  constant Modelica.Units.SI.Temperature TMAX=10000 "Maximum temperature";
+  constant Modelica.Units.SI.Temperature TNOM=800 "Nominal temperature";
   annotation (Icon(graphics={
       Text(
         extent={{-102,0},{24,-26}},
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/SpecificEnthalpy_T.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/SpecificEnthalpy_T.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/SpecificEnthalpy_T.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/SpecificEnthalpy_T.mo"	2022-03-10 09:58:45.244152644 +0000
@@ -1,10 +1,10 @@
 within ThermoSysPro.Properties.MoltenSalt;
 function SpecificEnthalpy_T "Specific Enthalpy computation for Salt (input T)"
 
-  input Modelica.SIunits.Temperature T "Temperature (K)";
-  output Modelica.SIunits.SpecificEnthalpy h "Specific Enthalpy (J/kg)";
+  input Modelica.Units.SI.Temperature T "Temperature (K)";
+  output Modelica.Units.SI.SpecificEnthalpy h "Specific Enthalpy (J/kg)";
 
-// STEPHANIE SQMSolarSalt
+// STEPHANIE SQMSolarSalt
 protected
   constant Real Enthalpy_c0 = -809884.394575425;
   constant Real Enthalpy_c1 = 1516.31623195732;
@@ -13,26 +13,23 @@
   constant Real enthC2 = 0.086;
 
 algorithm
-  // T in K; h in J/kg ;
-
-  // h = 43801 for T=563K => Error For T= 505 h= -44000
-  //  STEPHANIE SQMSolarSalt: properties from manufacturer tables
-  // h:=Enthalpy_c0 + Enthalpy_c1 * T;
-
-  //New h = 14919.9 for T=563K => Error For T= 505 h= - ????
-  //h := -798297.6386 + 1396.0182*T + 0.086*T^2;
-  //h := enthC0 + enthC1*T + enthC2*T^2;
-
-  // T  in K and h in J/kg ;
-  //Sam
-  ///////////////////////////////////////////////////////////////////////////////////////
-  //case(18)    !Nitrate Salt, [kg/m3]
-  //xlo=493.; xhi=866.;     : Reduced freezing temp to 220C (493.15K),
-  //reference http://www.nrel.gov/csp/troughnet/pdfs/40028.pdf
-  //
-  ///////////   ********************* Nitrate Salt ***********************   ///////////
-  //
-  //H_salt = ......;
+// T in K; h in J/kg ;
+// h = 43801 for T=563K => Error For T= 505 h= -44000
+//  STEPHANIE SQMSolarSalt: properties from manufacturer tables
+// h:=Enthalpy_c0 + Enthalpy_c1 * T;
+//New h = 14919.9 for T=563K => Error For T= 505 h= - ????
+//h := -798297.6386 + 1396.0182*T + 0.086*T^2;
+//h := enthC0 + enthC1*T + enthC2*T^2;
+// T  in K and h in J/kg ;
+//Sam
+///////////////////////////////////////////////////////////////////////////////////////
+//case(18)    !Nitrate Salt, [kg/m3]
+//xlo=493.; xhi=866.;     : Reduced freezing temp to 220C (493.15K),
+//reference http://www.nrel.gov/csp/troughnet/pdfs/40028.pdf
+//
+///////////   ********************* Nitrate Salt ***********************   ///////////
+//
+//H_salt = ......;
   h :=1443*(T - 273.16) + 0.086*(T - 273.16)*(T - 273.16);
 
 annotation(derivative = derSpecificEnthalpy_derT, inverse(T = Temperature_h(h)));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/SpecificHeatCapacityCp_T.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/SpecificHeatCapacityCp_T.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/SpecificHeatCapacityCp_T.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/SpecificHeatCapacityCp_T.mo"	2022-03-10 09:58:45.236152643 +0000
@@ -2,14 +2,13 @@
 function SpecificHeatCapacityCp_T
   "Specific Heat Capacity at fixed P computation for Salt (input T)"
 
-  input Modelica.SIunits.Temperature T "Temperature (K)";
-  output Modelica.SIunits.SpecificHeatCapacity Cp
+  input Modelica.Units.SI.Temperature T "Temperature (K)";
+  output Modelica.Units.SI.SpecificHeatCapacity Cp
     "Specific Heat Capacity (J/kg/K)";
 
 algorithm
-  //Cp := 1396.11639230963 + 0.171740545944394*T;              // temperature in K
-
-  // New
+//Cp := 1396.11639230963 + 0.171740545944394*T;              // temperature in K
+// New
     Cp := 1443 + 0.172*(T - 273.15);
     //Cp := 1448;
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/Temperature_derh.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/Temperature_derh.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/Temperature_derh.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/Temperature_derh.mo"	2022-03-10 09:58:45.232152642 +0000
@@ -2,7 +2,7 @@
 function Temperature_derh
   "derh(Temperature) computation for Salt (input der(h))"
 
-  input Modelica.SIunits.SpecificEnthalpy h "Specific Enthalpy (J/kg)";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific Enthalpy (J/kg)";
   input Real der_h "Specific Enthalpy time derivative (J/(kg*s))";
   output Real der_temp "Fluid temperature time derivative (K/s)";
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/Temperature_h.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/Temperature_h.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/Temperature_h.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/Temperature_h.mo"	2022-03-10 09:58:45.228152643 +0000
@@ -1,38 +1,35 @@
 within ThermoSysPro.Properties.MoltenSalt;
 function Temperature_h "Temperature computation for Salt (input h)"
 
-  input Modelica.SIunits.SpecificEnthalpy h "Specific Enthalpy (J/kg)";
-  output Modelica.SIunits.Temperature T "Temperature (K)";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific Enthalpy (J/kg)";
+  output Modelica.Units.SI.Temperature T "Temperature (K)";
 
-// STEPHANIE SolarSalt
+// STEPHANIE SolarSalt
 protected
   constant Real enthC0 = -798297.6386;
   constant Real enthC1 = 1396.02;
   constant Real enthC2 = 0.086;
 
-// STEPHANIE SQMSolarSalt
+// STEPHANIE SQMSolarSalt
   constant Real Temperature_c0 = 534.117625216440;
   constant Real Temperature_c1 = 0.000659475113943680;
 
 algorithm
-  // T in K; h in J/kg ;
-  // STEPHANIE SQMSolarSalt: properties from manufacturer tables
-  //T := Temperature_c0 + Temperature_c1 * h;  //  STEPHANIE SQMSolarSalt
-
-  //Error T= 563K for h= 43801 => T calculated with the function = 582.3 K(>>)
-  //T := (-enthC1 + sqrt(enthC1^2 - 4*enthC0*enthC2 + 4*enthC2*h))/(2*enthC2);  // STEPHANIE SolarSalt
-  //T := max((-enthC1 + sqrt(enthC1^2 - 4*enthC0*enthC2 + 4*enthC2*h))/(2*enthC2), 300);  // STEPHANIE SolarSalt
-
-  // T  in K and h in J/kg ;
-  //Sam
-  ///////////////////////////////////////////////////////////////////////////////////////
-  //case(18)    !Nitrate Salt, [kg/m3]
-  //xlo=493.; xhi=866.;     : Reduced freezing temp to 220C (493.15K),
-  //reference http://www.nrel.gov/csp/troughnet/pdfs/40028.pdf
-  //
-  ///////////   ********************* Nitrate Salt ***********************   ///////////
-  //
-
+// T in K; h in J/kg ;
+// STEPHANIE SQMSolarSalt: properties from manufacturer tables
+//T := Temperature_c0 + Temperature_c1 * h;  //  STEPHANIE SQMSolarSalt
+//Error T= 563K for h= 43801 => T calculated with the function = 582.3 K(>>)
+//T := (-enthC1 + sqrt(enthC1^2 - 4*enthC0*enthC2 + 4*enthC2*h))/(2*enthC2);  // STEPHANIE SolarSalt
+//T := max((-enthC1 + sqrt(enthC1^2 - 4*enthC0*enthC2 + 4*enthC2*h))/(2*enthC2), 300);  // STEPHANIE SolarSalt
+// T  in K and h in J/kg ;
+//Sam
+///////////////////////////////////////////////////////////////////////////////////////
+//case(18)    !Nitrate Salt, [kg/m3]
+//xlo=493.; xhi=866.;     : Reduced freezing temp to 220C (493.15K),
+//reference http://www.nrel.gov/csp/troughnet/pdfs/40028.pdf
+//
+///////////   ********************* Nitrate Salt ***********************   ///////////
+//
   T := (-0.0000000000262 * h^2 + 0.0006923 * h + 0.03058) + 273.16;
 
   annotation(derivative = derTemperature_derh);
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/TestTabSalt.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/TestTabSalt.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/TestTabSalt.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/TestTabSalt.mo"	2022-03-10 09:58:45.220152642 +0000
@@ -1,27 +1,27 @@
 within ThermoSysPro.Properties.MoltenSalt;
 model TestTabSalt "TestTabSalt"
 
-  parameter Modelica.SIunits.Temperature T0=800
+  parameter Modelica.Units.SI.Temperature T0=800
     "initial temperature of the fluid";
 
 public
-  Modelica.SIunits.Density rho1(start=1800) "Fluid density ";
+  Modelica.Units.SI.Density rho1(start=1800) "Fluid density ";
 
-  Modelica.SIunits.ThermalConductivity k(start=0.3)
+  Modelica.Units.SI.ThermalConductivity k(start=0.3)
     "Fluid thermal conductivity";
-  Modelica.SIunits.DynamicViscosity mu1(start=6.e-3) "Fluid dynamic viscosity ";
+  Modelica.Units.SI.DynamicViscosity mu1(start=6.e-3) "Fluid dynamic viscosity ";
 
-  Modelica.SIunits.SpecificHeatCapacity cp(start=1571)
+  Modelica.Units.SI.SpecificHeatCapacity cp(start=1571)
     "Fluid specific heat capacity";
 
-  Modelica.SIunits.Density rho11(start=1800) "Fluid density ";
+  Modelica.Units.SI.Density rho11(start=1800) "Fluid density ";
 
-  Modelica.SIunits.ThermalConductivity k1(start=0.3)
+  Modelica.Units.SI.ThermalConductivity k1(start=0.3)
     "Fluid thermal conductivity";
-  Modelica.SIunits.DynamicViscosity mu11(start=6.e-3)
+  Modelica.Units.SI.DynamicViscosity mu11(start=6.e-3)
     "Fluid dynamic viscosity ";
 
-  Modelica.SIunits.SpecificHeatCapacity cp1(start=1571)
+  Modelica.Units.SI.SpecificHeatCapacity cp1(start=1571)
     "Fluid specific heat capacity";
 
   Properties.MoltenSalt.ThermoProperties_T pro1
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/ThermalConductivity_T.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/ThermalConductivity_T.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/ThermalConductivity_T.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/ThermalConductivity_T.mo"	2022-03-10 09:58:45.204152639 +0000
@@ -1,11 +1,10 @@
-﻿within ThermoSysPro.Properties.MoltenSalt;
+within ThermoSysPro.Properties.MoltenSalt;
 function ThermalConductivity_T
   "Thermal Conductivity computation for Salt (input T)"
 
-  input Modelica.SIunits.Temperature T "Temperature (K)";
-  output Modelica.SIunits.ThermalConductivity k "Thermal Conductivity (W/m/K)";
+  input Modelica.Units.SI.Temperature T "Temperature (K)";
+  output Modelica.Units.SI.ThermalConductivity k "Thermal Conductivity (W/m/K)";
 
 algorithm
-  k := 0.3911015 + 0.00019*T;                                // temperature in °K
-
+  k := 0.3911015 + 0.00019*T;                                // temperature in °K
 end ThermalConductivity_T;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/ThermoPropertiesFunction_T_1.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/ThermoPropertiesFunction_T_1.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/ThermoPropertiesFunction_T_1.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/ThermoPropertiesFunction_T_1.mo"	2022-03-10 09:58:45.192152638 +0000
@@ -1,46 +1,34 @@
-within ThermoSysPro.Properties.MoltenSalt;
-function ThermoPropertiesFunction_T_1 "ThermoPropertiesFunction"
-  input Modelica.SIunits.Temperature T
-    "dimensionless derivatives of the Gibbs function";
-  output ThermoSysPro.Properties.MoltenSalt.ThermoProperties_T pro;
-//protected
-  //Real vt;
-  //Real vp;
-
-algorithm
-  //if (T-273)>538 then
-  if (T-273)>838 then
-    assert(false, "Molten salt_T: Temperature is too high (" + String(T-273) + ")");
-  elseif (T-273)<149 then
-    assert(false, "Molten salt_T: Temperature is too low (" + String(T-273) + ")");
-  else
-    pro.d := 1938.0-(0.732*(T-273-200));
-    pro.cp := 1561.7;
-    pro.k := 0.421-6.53e-4*(T-273-260);
-    pro.mu := Modelica.Math.exp(-4.343-2.0143*(Modelica.Math.log(T-273)-5.011));
-    //pro.mu :=(2.5-((T-273)-300)/(450-300))*0.001;
-    pro.ddpT := 1e-6;
-    pro.ddTp := -0.732;
-  end if;
-
-  annotation (smoothOrder=2,Icon(graphics={
-        Text(extent={{-136,102},{140,42}}, textString=
-                                               "%name"),
-        Ellipse(
-          extent={{-100,40},{100,-100}},
-          lineColor={255,127,0},
-          fillColor={255,255,255},
-          fillPattern=FillPattern.Solid),
-        Text(
-          extent={{-84,-4},{84,-52}},
-          lineColor={255,127,0},
-          textString=
-               "function")}),
-                           Documentation(info="<html>
+within ThermoSysPro.Properties.MoltenSalt;
+
+function ThermoPropertiesFunction_T_1 "ThermoPropertiesFunction"
+  input Modelica.Units.SI.Temperature T "dimensionless derivatives of the Gibbs function";
+  output ThermoSysPro.Properties.MoltenSalt.ThermoProperties_T pro;
+  //protected
+  //Real vt;
+  //Real vp;
+algorithm
+//if (T-273)>538 then
+  if T - 273 > 838 then
+    assert(false, "Molten salt_T: Temperature is too high (" + String(T - 273) + ")");
+  elseif T - 273 < 149 then
+    assert(false, "Molten salt_T: Temperature is too low (" + String(T - 273) + ")");
+  else
+    pro.d := 1938.0 - 0.732 * (T - 273 - 200);
+    pro.cp := 1561.7;
+    pro.k := 0.421 - 6.53e-4 * (T - 273 - 260);
+    pro.mu := Modelica.Math.exp((-4.343) - 2.0143 * (Modelica.Math.log(T - 273) - 5.011));
+    pro.ddpT := 1e-6;
+    pro.ddTp := -0.732;
+  end if;
+//pro.mu :=(2.5-((T-273)-300)/(450-300))*0.001;
+  annotation(
+    smoothOrder = 2,
+    Icon(graphics = {Text(extent = {{-136, 102}, {140, 42}}, textString = "%name"), Ellipse(extent = {{-100, 40}, {100, -100}}, lineColor = {255, 127, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-84, -4}, {84, -52}}, lineColor = {255, 127, 0}, textString = "function")}),
+    Documentation(info = "<html>
 <p><b>Copyright &copy; EDF 2002 - 2010</b></p>
 </HTML>
 <html>
 <p><b>ThermoSysPro Version 2.0</b></p>
 </HTML>
-"));
-end ThermoPropertiesFunction_T_1;
+    "));
+end ThermoPropertiesFunction_T_1;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt: ThermoPropertiesFunction_T_1.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt: ThermoPropertiesFunction_T_1.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/ThermoPropertiesFunction_T_1_ErrT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/ThermoPropertiesFunction_T_1_ErrT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/ThermoPropertiesFunction_T_1_ErrT.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/ThermoPropertiesFunction_T_1_ErrT.mo"	2022-03-10 09:58:45.152152633 +0000
@@ -1,27 +1,27 @@
 within ThermoSysPro.Properties.MoltenSalt;
 function ThermoPropertiesFunction_T_1_ErrT "ThermoPropertiesFunction"
-  input Modelica.SIunits.Temperature T
+  input Modelica.Units.SI.Temperature T
     "dimensionless derivatives of the Gibbs function";
   output ThermoSysPro.Properties.MoltenSalt.ThermoProperties_T pro;
-//protected
-  //Real vt;
-  //Real vp;
+  //protected
+  //Real vt;
 
-algorithm
-  //if (T-273)>538 then
-  if (T-273)>838 then
-    assert(false, "Molten salt_T: Temperature is too high (" + String(T-273) + ")");
-  elseif (T-273)<149 then
-    assert(false, "Molten salt_T: Temperature is too low (" + String(T-273) + ")");
-  else
-    pro.d := 1938.0-(0.732*(T-273-200));
-    pro.cp := 1561.7;
-    pro.k := 0.421-6.53e-4*(T-273-260);
-    pro.mu := Modelica.Math.exp(-4.343-2.0143*(Modelica.Math.log(T-273)-5.011));
-    //pro.mu :=(2.5-((T-273)-300)/(450-300))*0.001;
-    pro.ddpT := 1e-6;
-    pro.ddTp := -0.732;
-  end if;
+//Real vp;
+algorithm
+//if (T-273)>538 then
+  if T - 273 > 838 then
+    assert(false, "Molten salt_T: Temperature is too high (" + String(T - 273) + ")");
+  elseif T - 273 < 149 then
+    assert(false, "Molten salt_T: Temperature is too low (" + String(T - 273) + ")");
+  else
+    pro.d := 1938.0 - 0.732 * (T - 273 - 200);
+    pro.cp := 1561.7;
+    pro.k := 0.421 - 6.53e-4 * (T - 273 - 260);
+    pro.mu := Modelica.Math.exp((-4.343) - 2.0143 * (Modelica.Math.log(T - 273) - 5.011));
+    pro.ddpT := 1e-6;
+    pro.ddTp := -0.732;
+  end if;
+//pro.mu :=(2.5-((T-273)-300)/(450-300))*0.001;
   LogVariable(T);
   annotation (smoothOrder=2,Icon(graphics={
         Text(extent={{-136,102},{140,42}}, textString=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/ThermoPropertiesFunction_T_2.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/ThermoPropertiesFunction_T_2.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/ThermoPropertiesFunction_T_2.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/ThermoPropertiesFunction_T_2.mo"	2022-03-10 09:58:45.140152631 +0000
@@ -1,87 +1,65 @@
-﻿within ThermoSysPro.Properties.MoltenSalt;
+within ThermoSysPro.Properties.MoltenSalt;
+
 function ThermoPropertiesFunction_T_2 "ThermoPropertiesFunction of Solt: KNO3-NaNO3
-"
-  input Modelica.SIunits.Temperature T
-    "dimensionless derivatives of the Gibbs function";
-  output ThermoSysPro.Properties.MoltenSalt.ThermoProperties_T pro;
-//protected
-  //Real vt;
-  //Real vp;
-
-algorithm
-  //if (T-273)>538 then
-  if (T-273)>838 then
-    assert(false, "Molten salt_T: Temperature is too high (" + String(T-273) + ")");
-  elseif (T-273)<149 then
-    assert(false, "Molten salt_T: Temperature is too low (" + String(T-273) + ")");
-  else
-
-//////////////////////////////////
-
-    //pro.cp := 1417.54 + 0.172*T;        // = 1561.7 à T=838.16
-    //pro.cp := 1464.84 + 0.172*T;        // = 1561.7 à T=563.15
-
-    //pro.cp := 1396.0182 + 0.172*T;      //Stephanie = 1539.84 à T=838.16
-
-    //pro.cp := 976.78 + 1.0634*T;        // Williams et al. [2006]   range of 770?1040 K
-    //pro.cp := 5806 - 10.833*T + 0.0072413*T*T;   //Janz et al     range of 426?776 K
-    //pro.cp := 1721.86;                  //moyenne  Williams et al. [2006]   div
-
-//////////////////////////////////
-
-//Stephanie  // for T= 500 °C or 773 °K => cp= 1529 J ke-1 K-1
-//Specific Heat Capacity
-//    pro.cp := 1443 + 0.172*(T - 273.15);                           // temperature in °C
-//    pro.cp := 1396.11639230963 + 0.171740545944394*T;              // temperature in °K
-//Thermal Conductivity
-//    pro.k := 0.443 + 0.00019*(T - 273.15);                         // temperature in °C
-//    pro.k := 0.3911015 + 0.00019*T;                                // temperature in °K
-//Dynamic Viscosity
-//    pro.mu := (22.714 - 0.12*(T - 273.15) + 2.281*1e-7*(T - 273.15)**2 - 1.474*1e-10*(T - 273.15)**3);   // temperature in °C
-//    pro.mu :=( 0.0755147595 - 0.00027760398*T + 3.4888693*1e-7*T^2 - 1.4739999*1e-10*T^3);   // temperature in °K
-//Density
-//    pro.d := 2090 - 0.636*(T - 273.15);                             // temperature in °C
-//    pro.d := 2263.7234- 0.636*T;                                    // temperature in °C
-
-//////////////////////////////////
-// CAS
-//    pro.d := 2090-0.636*T;      // kg m-3
-//    pro.cp := 1443+0.172*T;     // J ke-1 K-1
-//    pro.k := 0.443+0.00019*T;   // W m-1 k-1
-//    pro.mu := (22.714-0.12*T+2.281*T*0.0001*T-1.474*T*0.0001*T*0.001*T)/1000;    //Pa s(kg m-1 s-1)
-
-//////////////////////////////////
-//PHD
-    pro.d := 1938.0-(0.732*(T-273-200));
-
-    pro.cp := 1561.7;
-
-    pro.k := 0.421-6.53e-4*(T-273-260);
-    pro.mu := Modelica.Math.exp(-4.343-2.0143*(Modelica.Math.log(T-273)-5.011));
-    //pro.mu :=(2.5-((T-273)-300)/(450-300))*0.001;
-//
-    pro.ddpT := 1e-6;
-    pro.ddTp := -0.732;
-  end if;
-
-  annotation (smoothOrder=2,Icon(graphics={
-        Text(extent={{-136,102},{140,42}}, textString=
-                                               "%name"),
-        Ellipse(
-          extent={{-100,40},{100,-100}},
-          lineColor={255,127,0},
-          fillColor={255,255,255},
-          fillPattern=FillPattern.Solid),
-        Text(
-          extent={{-84,-4},{84,-52}},
-          lineColor={255,127,0},
-          textString=
-               "function")}),
-                           Documentation(info="<html>
+"
+  input Modelica.Units.SI.Temperature T "dimensionless derivatives of the Gibbs function";
+  output ThermoSysPro.Properties.MoltenSalt.ThermoProperties_T pro;
+  //protected
+  //Real vt;
+  //Real vp;
+algorithm
+//if (T-273)>538 then
+  if T - 273 > 838 then
+    assert(false, "Molten salt_T: Temperature is too high (" + String(T - 273) + ")");
+  elseif T - 273 < 149 then
+    assert(false, "Molten salt_T: Temperature is too low (" + String(T - 273) + ")");
+  else
+    pro.d := 1938.0 - 0.732 * (T - 273 - 200);
+    pro.cp := 1561.7;
+    pro.k := 0.421 - 6.53e-4 * (T - 273 - 260);
+    pro.mu := Modelica.Math.exp((-4.343) - 2.0143 * (Modelica.Math.log(T - 273) - 5.011));
+    pro.ddpT := 1e-6;
+    pro.ddTp := -0.732;
+  end if;
+//////////////////////////////////
+//pro.cp := 1417.54 + 0.172*T;        // = 1561.7 à T=838.16
+//pro.cp := 1464.84 + 0.172*T;        // = 1561.7 à T=563.15
+//pro.cp := 1396.0182 + 0.172*T;      //Stephanie = 1539.84 à T=838.16
+//pro.cp := 976.78 + 1.0634*T;        // Williams et al. [2006]   range of 770?1040 K
+//pro.cp := 5806 - 10.833*T + 0.0072413*T*T;   //Janz et al     range of 426?776 K
+//pro.cp := 1721.86;                  //moyenne  Williams et al. [2006]   div
+//////////////////////////////////
+//Stephanie  // for T= 500 °C or 773 °K => cp= 1529 J ke-1 K-1
+//Specific Heat Capacity
+//    pro.cp := 1443 + 0.172*(T - 273.15);                           // temperature in °C
+//    pro.cp := 1396.11639230963 + 0.171740545944394*T;              // temperature in °K
+//Thermal Conductivity
+//    pro.k := 0.443 + 0.00019*(T - 273.15);                         // temperature in °C
+//    pro.k := 0.3911015 + 0.00019*T;                                // temperature in °K
+//Dynamic Viscosity
+//    pro.mu := (22.714 - 0.12*(T - 273.15) + 2.281*1e-7*(T - 273.15)**2 - 1.474*1e-10*(T - 273.15)**3);   // temperature in °C
+//    pro.mu :=( 0.0755147595 - 0.00027760398*T + 3.4888693*1e-7*T^2 - 1.4739999*1e-10*T^3);   // temperature in °K
+//Density
+//    pro.d := 2090 - 0.636*(T - 273.15);                             // temperature in °C
+//    pro.d := 2263.7234- 0.636*T;                                    // temperature in °C
+//////////////////////////////////
+// CAS
+//    pro.d := 2090-0.636*T;      // kg m-3
+//    pro.cp := 1443+0.172*T;     // J ke-1 K-1
+//    pro.k := 0.443+0.00019*T;   // W m-1 k-1
+//    pro.mu := (22.714-0.12*T+2.281*T*0.0001*T-1.474*T*0.0001*T*0.001*T)/1000;    //Pa s(kg m-1 s-1)
+//////////////////////////////////
+//PHD
+//pro.mu :=(2.5-((T-273)-300)/(450-300))*0.001;
+//
+  annotation(
+    smoothOrder = 2,
+    Icon(graphics = {Text(extent = {{-136, 102}, {140, 42}}, textString = "%name"), Ellipse(extent = {{-100, 40}, {100, -100}}, lineColor = {255, 127, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-84, -4}, {84, -52}}, lineColor = {255, 127, 0}, textString = "function")}),
+    Documentation(info = "<html>
 <p><b>Copyright &copy; EDF 2002 - 2010</b></p>
 </HTML>
 <html>
 <p><b>ThermoSysPro Version 2.0</b></p>
 </HTML>
-"));
-end ThermoPropertiesFunction_T_2;
+    "));
+end ThermoPropertiesFunction_T_2;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt: ThermoPropertiesFunction_T_2.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt: ThermoPropertiesFunction_T_2.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/ThermoProperties_T.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/ThermoProperties_T.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/ThermoProperties_T.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/ThermoProperties_T.mo"	2022-03-10 09:58:45.132152631 +0000
@@ -4,7 +4,7 @@
     //min=ThermoSysPro.Properties.WaterSteam.InitLimits.TMIN,
     //max=ThermoSysPro.Properties.WaterSteam.InitLimits.TMAX,
     //nominal=ThermoSysPro.Properties.WaterSteam.InitLimits.TNOM) "Temperature";
-  Modelica.SIunits.Density d(
+  Modelica.Units.SI.Density d(
     min=HitecLimits.DMIN,
     max=HitecLimits.DMAX,
     nominal=HitecLimits.DNOM) "Density";
@@ -18,7 +18,7 @@
     //max=ThermoSysPro.Properties.WaterSteam.InitLimits.SSMAX,
     //nominal=ThermoSysPro.Properties.WaterSteam.InitLimits.SSNOM)
     //"Specific entropy";
-  Modelica.SIunits.SpecificHeatCapacity cp(
+  Modelica.Units.SI.SpecificHeatCapacity cp(
     min=HitecLimits.CPMIN,
     max=HitecLimits.CPMAX,
     nominal=HitecLimits.CPNOM) "Specific heat capacity at constant presure";
@@ -32,16 +32,16 @@
   //Real duhp(unit = "1")
     //"Derivative of specific inner energy wrt. specific enthalpy at constant pressure";
   //ThermoSysPro.Units.MassFraction x "Vapor mass fraction";
-  Modelica.SIunits.ThermalConductivity k(
+  Modelica.Units.SI.ThermalConductivity k(
     min=HitecLimits.LAMMIN,
     max=HitecLimits.LAMMAX,
     nominal=HitecLimits.LAMNOM);
-  Modelica.SIunits.DynamicViscosity mu(
+  Modelica.Units.SI.DynamicViscosity mu(
     min=HitecLimits.ETAMIN,
     max=HitecLimits.ETAMAX,
     nominal=HitecLimits.ETANOM);
-  Modelica.SIunits.DerDensityByTemperature ddTp;
-  Modelica.SIunits.DerDensityByPressure ddpT;
+  Modelica.Units.SI.DerDensityByTemperature ddTp;
+  Modelica.Units.SI.DerDensityByPressure ddpT;
   annotation (Icon(graphics={
         Rectangle(
           extent={{-100,60},{100,-90}},
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/ThermoProperties_h.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/ThermoProperties_h.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/ThermoProperties_h.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/ThermoProperties_h.mo"	2022-03-10 09:58:45.128152630 +0000
@@ -4,7 +4,7 @@
     //min=ThermoSysPro.Properties.WaterSteam.InitLimits.TMIN,
     //max=ThermoSysPro.Properties.WaterSteam.InitLimits.TMAX,
     //nominal=ThermoSysPro.Properties.WaterSteam.InitLimits.TNOM) "Temperature";
-  Modelica.SIunits.Density d(
+  Modelica.Units.SI.Density d(
     min=HitecLimits.DMIN,
     max=HitecLimits.DMAX,
     nominal=HitecLimits.DNOM) "Density";
@@ -18,7 +18,7 @@
     //max=ThermoSysPro.Properties.WaterSteam.InitLimits.SSMAX,
     //nominal=ThermoSysPro.Properties.WaterSteam.InitLimits.SSNOM)
     //"Specific entropy";
-  Modelica.SIunits.SpecificHeatCapacity cp(
+  Modelica.Units.SI.SpecificHeatCapacity cp(
     min=HitecLimits.CPMIN,
     max=HitecLimits.CPMAX,
     nominal=HitecLimits.CPNOM) "Specific heat capacity at constant presure";
@@ -32,16 +32,16 @@
   //Real duhp(unit = "1")
     //"Derivative of specific inner energy wrt. specific enthalpy at constant pressure";
   //ThermoSysPro.Units.MassFraction x "Vapor mass fraction";
-  Modelica.SIunits.ThermalConductivity k(
+  Modelica.Units.SI.ThermalConductivity k(
     min=HitecLimits.LAMMIN,
     max=HitecLimits.LAMMAX,
     nominal=HitecLimits.LAMNOM);
-  Modelica.SIunits.DynamicViscosity mu(
+  Modelica.Units.SI.DynamicViscosity mu(
     min=HitecLimits.ETAMIN,
     max=HitecLimits.ETAMAX,
     nominal=HitecLimits.ETANOM);
-  Modelica.SIunits.DerDensityByTemperature ddTp;
-  Modelica.SIunits.DerDensityByPressure ddpT;
+  Modelica.Units.SI.DerDensityByTemperature ddTp;
+  Modelica.Units.SI.DerDensityByPressure ddpT;
   annotation (Icon(graphics={
         Rectangle(
           extent={{-100,60},{100,-90}},
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/derDensity_derT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/derDensity_derT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/derDensity_derT.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/derDensity_derT.mo"	2022-03-10 09:58:45.120152629 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Properties.MoltenSalt;
 function derDensity_derT "der(Density) computation for Salt (input der(T))"
 
-  input Modelica.SIunits.Temperature T "Temperature (K)";
+  input Modelica.Units.SI.Temperature T "Temperature (K)";
   input Real der_T "Temperature time derivative (K/s)";
   output Real der_rho "Density time derivative (kg/(m3*s))";
 
@@ -10,6 +10,5 @@
     constant Real Density_c1 = -0.636188210739603;
 
 algorithm
-  der_rho:= Density_c1 * der_T;  // STEPHANIE SQMSolarSalt
-
+  der_rho:= Density_c1 * der_T;  // STEPHANIE SQMSolarSalt
 end derDensity_derT;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/derSpecificEnthalpy_derT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/derSpecificEnthalpy_derT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/derSpecificEnthalpy_derT.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/derSpecificEnthalpy_derT.mo"	2022-03-10 09:58:45.116152628 +0000
@@ -2,7 +2,7 @@
 function derSpecificEnthalpy_derT
   "der(Specific Enthalpy) computation for Salt (inputs: T, der(T))"
 
-  input Modelica.SIunits.Temperature T "Temperature (K)";
+  input Modelica.Units.SI.Temperature T "Temperature (K)";
   input Real der_temp "Temperature time derivative (K/s)";
 
   output Real der_h "Specific Enthalpy time derivative (J/(kg*s))";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/derTemperature_derh.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/derTemperature_derh.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/derTemperature_derh.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/MoltenSalt/derTemperature_derh.mo"	2022-03-10 09:58:45.108152628 +0000
@@ -2,7 +2,7 @@
 function derTemperature_derh
   "der(Temperature) computation for Salt (input der(h))"
 
-  input Modelica.SIunits.SpecificEnthalpy h "Specific Enthalpy (J/kg)";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific Enthalpy (J/kg)";
   input Real der_h "Specific Enthalpy time derivative (J/(kg*s))";
   output Real der_T "Fluid temperature time derivative (K/s)";
 
@@ -11,5 +11,5 @@
     constant Real Temperature_c1 = 0.000659475113943680;
 
 algorithm
-      der_T:= Temperature_c1 * der_h;  // STEPHANIE SQMSolarSalt
+      der_T:= Temperature_c1 * der_h;  // STEPHANIE SQMSolarSalt
 end derTemperature_derh;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Density_T.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Density_T.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Density_T.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Density_T.mo"	2022-03-10 09:58:45.096152626 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Properties.Oil_TherminolVP1;
 function Density_T "Density as function of temperature"
-    input Modelica.SIunits.Temperature temp "Fluid temperature (K)";
-    output Modelica.SIunits.Density rho "Density (kg/m3)";
+    input Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
+    output Modelica.Units.SI.Density rho "Density (kg/m3)";
 protected
     constant Real Density_c0 = 1156.4064882506063;
     constant Real Density_c1 = 0.6335655001350703;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Density_derT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Density_derT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Density_derT.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Density_derT.mo"	2022-03-10 09:58:45.092152625 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Properties.Oil_TherminolVP1;
 function Density_derT
   "Returns density time derivative as function of temperature and its derivative"
-    input Modelica.SIunits.Temperature temp "Fluid temperature (K)";
+    input Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
     input Real der_temp "Fluid temperature time derivative (K/s)";
     output Real der_rho "Density time derivative (kg/(m3*s))";
 protected
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/DynamicViscosity_T.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/DynamicViscosity_T.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/DynamicViscosity_T.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/DynamicViscosity_T.mo"	2022-03-10 09:58:45.084152624 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.Oil_TherminolVP1;
 function DynamicViscosity_T
-    input Modelica.SIunits.Temperature temp "Fluid temperature (K)";
-    output Modelica.SIunits.DynamicViscosity mu "Viscosity (Pa.s)";
 
+    input Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
+    output Modelica.Units.SI.DynamicViscosity mu "Viscosity (Pa.s)";
 protected
     constant Real Viscosity_cm2 = 66476.1563165124;
     constant Real Viscosity_cm1 = -816.2382525469754;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/DynamicViscosity_derT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/DynamicViscosity_derT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/DynamicViscosity_derT.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/DynamicViscosity_derT.mo"	2022-03-10 09:58:45.080152623 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.Oil_TherminolVP1;
 function DynamicViscosity_derT
-  input Modelica.SIunits.Temperature temp "Fluid temperature (K)";
+  input Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
   input Real der_temp "Fluid temperature time derivative (K/S)";
   output Real der_mu "dynamic viscosity time derivative (Pa)";
 protected
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Enthalpy_T.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Enthalpy_T.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Enthalpy_T.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Enthalpy_T.mo"	2022-03-10 09:58:45.076152624 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Properties.Oil_TherminolVP1;
 function Enthalpy_T
-    input Modelica.SIunits.Temperature temp "Fluid temperature (K)";
-    output Modelica.SIunits.SpecificEnthalpy h "Enthalpy (J/kg)";
+    input Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
+    output Modelica.Units.SI.SpecificEnthalpy h "Enthalpy (J/kg)";
 protected
     constant Real Enthalpy_c0 = -293286.3733909648;
     constant Real Enthalpy_c1 = 431.97125303499524;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Enthalpy_derT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Enthalpy_derT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Enthalpy_derT.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Enthalpy_derT.mo"	2022-03-10 09:58:45.072152622 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.Oil_TherminolVP1;
 function Enthalpy_derT
-    input Modelica.SIunits.Temperature temp "Fluid temperature (K)";
+    input Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
     input Real der_temp "Fluid temperature time derivative (K/s)";
     output Real der_h "Enthalpy time derivative (J/(kg*s))";
 protected
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/SpecificHeatCp_T.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/SpecificHeatCp_T.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/SpecificHeatCp_T.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/SpecificHeatCp_T.mo"	2022-03-10 09:58:45.064152622 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.Oil_TherminolVP1;
 function SpecificHeatCp_T
   "Specific heat capacity as function of temperature"
-    input Modelica.SIunits.Temperature temp "Fluid temperature (K)";
-    output Modelica.SIunits.SpecificHeatCapacity cp "Viscosity (Pa s)";
+    input Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
+    output Modelica.Units.SI.SpecificHeatCapacity cp "Viscosity (Pa s)";
 protected
     constant Real Cp_c0 = 1981.3598157651504;
     constant Real Cp_c1 = -9.777411226193031;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/SpecificHeatCp_derT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/SpecificHeatCp_derT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/SpecificHeatCp_derT.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/SpecificHeatCp_derT.mo"	2022-03-10 09:58:45.060152621 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.Oil_TherminolVP1;
 function SpecificHeatCp_derT "derivative of SpecificHeatCp_t"
-  input Modelica.SIunits.Temperature temp "Fluid temperature (K)";
+  input Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
   input Real der_temp "fluid temperature time derivative (K/s)";
   output Real der_cp "specific heat capacity time derivative (J/kgKs)";
 protected
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_cp.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_cp.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_cp.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_cp.mo"	2022-03-10 09:58:45.056152621 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.Oil_TherminolVP1;
 function Temperature_cp "inverse function of SpecificHeatCp_t"
-  input Modelica.SIunits.SpecificHeatCapacity cp
+  input Modelica.Units.SI.SpecificHeatCapacity cp
     "Specific Heat Capacity (J/kgK)";
-  output Modelica.SIunits.Temperature temp "Fluid temperature (K)";
+  output Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
 protected
   constant Real temp_c0 = -1550.799964717781;
   constant Real temp_c1 = 3.2657321743494627;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_dercp.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_dercp.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_dercp.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_dercp.mo"	2022-03-10 09:58:45.048152619 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.Oil_TherminolVP1;
 function Temperature_dercp "derivative of Temperature_cp"
-  input Modelica.SIunits.SpecificHeatCapacity cp
+  input Modelica.Units.SI.SpecificHeatCapacity cp
     "Specific Heat Capacity (J/kgK)";
   input Real der_cp "specific heat capacity time derivative (J/kgKs)";
   output Real der_temp "fluid temperature time derivative (K/s)";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_derh.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_derh.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_derh.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_derh.mo"	2022-03-10 09:58:45.044152620 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.Oil_TherminolVP1;
 function Temperature_derh
-    input Modelica.SIunits.SpecificEnthalpy h "Enthalpy (J/kg)";
+    input Modelica.Units.SI.SpecificEnthalpy h "Enthalpy (J/kg)";
     input Real der_h "Enthalpy time derivative (J/(kg*s))";
     output Real der_temp "Fluid temperature time derivative (K/s)";
 protected
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_derk.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_derk.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_derk.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_derk.mo"	2022-03-10 09:58:45.040152618 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.Oil_TherminolVP1;
 function Temperature_derk "derivative of Temperature_k"
-  input Modelica.SIunits.ThermalConductivity k "Thermal Conductivity (W/mK)";
+  input Modelica.Units.SI.ThermalConductivity k "Thermal Conductivity (W/mK)";
   input Real der_k "thermal conductivity time derivative (W/mKs)";
   output Real der_temp "fluid temperature time derivative";
 protected
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_derrho.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_derrho.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_derrho.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_derrho.mo"	2022-03-10 09:58:45.032152618 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.Oil_TherminolVP1;
 function Temperature_derrho "derivative of Temperature_rho"
-  input Modelica.SIunits.Density rho "Density (kg/m3)";
+  input Modelica.Units.SI.Density rho "Density (kg/m3)";
   input Real der_rho "Density time derivative (kg/(m3*s))";
   output Real der_temp "Fluid temperature time derivative (K/s)";
 protected
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_h.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_h.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_h.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_h.mo"	2022-03-10 09:58:45.028152617 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Properties.Oil_TherminolVP1;
 function Temperature_h
-    input Modelica.SIunits.SpecificEnthalpy h "Enthalpy (J/kg)";
-    output Modelica.SIunits.Temperature temp "Fluid temperature (K)";
+    input Modelica.Units.SI.SpecificEnthalpy h "Enthalpy (J/kg)";
+    output Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
 protected
     constant Real Temperature_c0 = 285.5140346333899;
     constant Real Temperature_c1 = 0.0006466731366692376;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_k.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_k.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_k.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_k.mo"	2022-03-10 09:58:45.020152616 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Properties.Oil_TherminolVP1;
 function Temperature_k "inverse function of ThermalConductivity_t"
-  input Modelica.SIunits.ThermalConductivity k "Thermal Conductivity";
-  output Modelica.SIunits.Temperature temp "Fluid temperature (K)";
+  input Modelica.Units.SI.ThermalConductivity k "Thermal Conductivity";
+  output Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
 protected
     constant Real Temp_c0 = 475.2525031233294;
     constant Real Temp_c1 = 18070.362425348725;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_rho.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_rho.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_rho.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/Temperature_rho.mo"	2022-03-10 09:58:45.008152614 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Properties.Oil_TherminolVP1;
 function Temperature_rho "inverse of function Density_t"
-  input Modelica.SIunits.Density rho "Density (kg/m3)";
-  output Modelica.SIunits.Temperature temp "Fluid temperature (K)";
+  input Modelica.Units.SI.Density rho "Density (kg/m3)";
+  output Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
 protected
   constant Real Temp_c0 = 829.2269319387954;
   constant Real Temp_c1 = -0.6032830735166413;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/ThermalConductivity_T.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/ThermalConductivity_T.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/ThermalConductivity_T.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/ThermalConductivity_T.mo"	2022-03-10 09:58:45.000152614 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.Oil_TherminolVP1;
 function ThermalConductivity_T
   "thermal conductivity as function of fluid temperature"
-    input Modelica.SIunits.Temperature temp "Fluid temperature (K)";
-    output Modelica.SIunits.ThermalConductivity k "Viscosity (Pa s)";
+    input Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
+    output Modelica.Units.SI.ThermalConductivity k "Viscosity (Pa s)";
 protected
     constant Real Conductivity_c0 = 0.1511294630021525;
     constant Real Conductivity_c1 = -0.000010409515731161305;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/ThermalConductivity_derT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/ThermalConductivity_derT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/ThermalConductivity_derT.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/ThermalConductivity_derT.mo"	2022-03-10 09:58:44.992152612 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.Oil_TherminolVP1;
 function ThermalConductivity_derT "derivative of ThermalConductivity_T"
-  input Modelica.SIunits.Temperature temp "Fluid temperature (K)";
+  input Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
   input Real der_temp "fluid temperature time derivative (K/s)";
   output Real der_k "thermal conductivity time derivative (W/mKs)";
 protected
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/TherminolVP1_Data.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/TherminolVP1_Data.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/TherminolVP1_Data.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/Oil_TherminolVP1/TherminolVP1_Data.mo"	2022-03-10 09:58:44.984152611 +0000
@@ -1,32 +1,32 @@
-﻿within ThermoSysPro.Properties.Oil_TherminolVP1;
+within ThermoSysPro.Properties.Oil_TherminolVP1;
 record TherminolVP1_Data "Data for Oil from STEPHANIE Library"
 
-// STEPHANIE TherminolVP1
+// STEPHANIE TherminolVP1
   String mediumName = "TherminolVP1" "Name of the medium";
  // Temperature limits
-  Modelica.SIunits.Temperature maximum_temperature = 405+273.15
+  Modelica.Units.SI.Temperature maximum_temperature = 405+273.15
     "maximum fluid operating temperature allowed (K)";
-  Modelica.SIunits.Temperature minimum_temperature = 15+273.15
+  Modelica.Units.SI.Temperature minimum_temperature = 15+273.15
     "minimum fluid operating temperature allowed (K)";
  // Reference State
-  Modelica.SIunits.AbsolutePressure reference_pressure = 101325
+  Modelica.Units.SI.AbsolutePressure reference_pressure = 101325
     "Reference pressure of Medium: default 1 atmosphere";
-  Modelica.SIunits.SpecificEnthalpy reference_enthalpy = 0
+  Modelica.Units.SI.SpecificEnthalpy reference_enthalpy = 0
     "Reference enthalpy of Medium: default @ 0 deg Celsius";
-  Modelica.SIunits.Temperature reference_temperature = 323+273.15
+  Modelica.Units.SI.Temperature reference_temperature = 323+273.15
     "Reference Temperature of Medium: default 0 deg Celsius";
  // Default values (for initialization)
-  Modelica.SIunits.AbsolutePressure pressure_default = 101325
+  Modelica.Units.SI.AbsolutePressure pressure_default = 101325
     "Default value for pressure of medium (for initialization)";
-  Modelica.SIunits.SpecificEnthalpy enthalpy_default = ThermoSysPro.Properties.Oil_TherminolVP1.Enthalpy_T(temp=323+273.15)
+  Modelica.Units.SI.SpecificEnthalpy enthalpy_default = ThermoSysPro.Properties.Oil_TherminolVP1.Enthalpy_T(temp=323+273.15)
     "Default value for enthalpy (@ 323ºC) of medium (for initialization)";
-  Modelica.SIunits.Temperature temperature_default = ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=enthalpy_default)
+  Modelica.Units.SI.Temperature temperature_default = ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h=enthalpy_default)
     "Default value for temperature of medium (for initialization)";
-  Modelica.SIunits.Density density_default = ThermoSysPro.Properties.Oil_TherminolVP1.Density_T(temp=temperature_default)
+  Modelica.Units.SI.Density density_default = ThermoSysPro.Properties.Oil_TherminolVP1.Density_T(temp=temperature_default)
     "Default value for density of medium (for initialization)";
-  Modelica.SIunits.DynamicViscosity dynamicViscosity_default = ThermoSysPro.Properties.Oil_TherminolVP1.DynamicViscosity_T(temp=temperature_default)
+  Modelica.Units.SI.DynamicViscosity dynamicViscosity_default = ThermoSysPro.Properties.Oil_TherminolVP1.DynamicViscosity_T(temp=temperature_default)
     "Default value for dynamic viscosity of medium (for initialization)";
- //
+ //
   Boolean compressible = false "Wheter density depends on pressure or not";
   Boolean usePartialDensityDerivatives = false
     "=true if partial density derivatives with respect to state variables (e.g. pressure and enthalpy) are explicitely given as functions";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Density_T.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Density_T.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Density_T.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Density_T.mo"	2022-03-10 09:58:44.944152606 +0000
@@ -1,11 +1,11 @@
 within ThermoSysPro.Properties.SolarSalt;
 function Density_T
-    input Modelica.SIunits.Temperature temp "Fluid temperature (K)";
-    output Modelica.SIunits.Density rho "Density (kg/m3)";
+    input Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
+    output Modelica.Units.SI.Density rho "Density (kg/m3)";
 protected
-    constant Real Density_c0 = 2263.7234;                //2090 - 0.636 (-273.15 + T)  = 2090 + 173.7234 - 0.636*T = 2263.7234 - 0.636*T
+    constant Real Density_c0 = 2263.7234;
+                  //2090 - 0.636 (-273.15 + T)  = 2090 + 173.7234 - 0.636*T = 2263.7234 - 0.636*T
     constant Real Density_c1 = - 0.636;
-
 algorithm
       rho := Density_c0 + Density_c1 * temp;
   annotation(derivative = Density_derT, inverse(temp = Temperature_rho(rho)));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Density_derT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Density_derT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Density_derT.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Density_derT.mo"	2022-03-10 09:58:44.936152606 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.SolarSalt;
 function Density_derT
-    input Modelica.SIunits.Temperature temp "Fluid temperature (K)";
+    input Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
     input Real der_temp "Fluid temperature time derivative (K/s)";
     output Real der_rho "Density time derivative (kg/(m3*s))";
 protected
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/DynamicViscosity_T.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/DynamicViscosity_T.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/DynamicViscosity_T.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/DynamicViscosity_T.mo"	2022-03-10 09:58:44.932152605 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Properties.SolarSalt;
 function DynamicViscosity_T
-    input Modelica.SIunits.Temperature temp "Fluid temperature (K)";   //(22.714 - 0.12*(T - 273.15) + 2.281*10^(-4)*(T - 273.15)^2)/1000 - (1.474*10^(-7)*(T - 273.15)^3)/1000
-    output Modelica.SIunits.DynamicViscosity mu "Viscosity (Pa.s)";
+    input Modelica.Units.SI.Temperature temp "Fluid temperature (K)";   //(22.714 - 0.12*(T - 273.15) + 2.281*10^(-4)*(T - 273.15)^2)/1000 - (1.474*10^(-7)*(T - 273.15)^3)/1000
+    output Modelica.Units.SI.DynamicViscosity mu "Viscosity (Pa.s)";
 protected
     constant Real Viscosity_c0 = 0.07551475951333098;
     constant Real Viscosity_c1 = - 0.00027760397992950003;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/DynamicViscosity_derT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/DynamicViscosity_derT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/DynamicViscosity_derT.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/DynamicViscosity_derT.mo"	2022-03-10 09:58:44.928152604 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.SolarSalt;
 function DynamicViscosity_derT
-  input Modelica.SIunits.Temperature temp "Fluid temperature (K)";
+  input Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
   input Real der_temp "Fluid temperature time derivative (K/S)";
   output Real der_mu "dynamic viscosity time derivative (Pa)";
 protected
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Enthalpy_T.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Enthalpy_T.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Enthalpy_T.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Enthalpy_T.mo"	2022-03-10 09:58:44.924152605 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Properties.SolarSalt;
 function Enthalpy_T
-    input Modelica.SIunits.Temperature temp "Fluid temperature (K)";
-    output Modelica.SIunits.SpecificEnthalpy h "Enthalpy (J/kg)";
+    input Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
+    output Modelica.Units.SI.SpecificEnthalpy h "Enthalpy (J/kg)";
 protected
     constant Real Enthalpy_c0 = -798297.6386;
     constant Real Enthalpy_c1 = 1396.0182;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Enthalpy_derT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Enthalpy_derT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Enthalpy_derT.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Enthalpy_derT.mo"	2022-03-10 09:58:44.920152603 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.SolarSalt;
 function Enthalpy_derT
-    input Modelica.SIunits.Temperature temp "Fluid temperature (K)";
+    input Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
     input Real der_temp "Fluid temperature time derivative (K/s)";
     output Real der_h "Enthalpy time derivative (J/(kg*s))";
 protected
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/IsobaricExpansionCoefficient_T.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/IsobaricExpansionCoefficient_T.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/IsobaricExpansionCoefficient_T.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/IsobaricExpansionCoefficient_T.mo"	2022-03-10 09:58:44.912152603 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.SolarSalt;
 function IsobaricExpansionCoefficient_T
   "beta as function of temperature"
-  input Modelica.SIunits.Temperature temp "Fluid temperature (K)";
-  output Modelica.SIunits.CubicExpansionCoefficient beta
+  input Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
+  output Modelica.Units.SI.CubicExpansionCoefficient beta
     "isobaric expansion coefficient (1/K)";
 protected
   constant Real betaC0 = 0.636;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/IsobaricExpansionCoefficient_derT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/IsobaricExpansionCoefficient_derT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/IsobaricExpansionCoefficient_derT.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/IsobaricExpansionCoefficient_derT.mo"	2022-03-10 09:58:44.908152602 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Properties.SolarSalt;
 function IsobaricExpansionCoefficient_derT
   "derivative of IsobaricExpansionCoefficient_T"
-  input Modelica.SIunits.Temperature temp "Fluid temperature (K)";
+  input Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
   input Real der_temp "fluid temperature time derivative (K/s)";
   output Real der_beta "isobaric expansion coefficient time derivative (1/Ks)";
 protected
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/SpecificHeatCp_T.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/SpecificHeatCp_T.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/SpecificHeatCp_T.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/SpecificHeatCp_T.mo"	2022-03-10 09:58:44.904152602 +0000
@@ -1,10 +1,10 @@
 within ThermoSysPro.Properties.SolarSalt;
 function SpecificHeatCp_T
-    input Modelica.SIunits.Temperature temp "Fluid temperature (K)";
-    output Modelica.SIunits.SpecificHeatCapacity cp
+    input Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
+    output Modelica.Units.SI.SpecificHeatCapacity cp
     "Specific Heat Capacity (J/kgK)";
 protected
-    constant Real Cp_c0 = 1396.0182;                                     //1443 + 0.172 (-273.15 + T)
+    constant Real Cp_c0 = 1396.0182;                                       //1443 + 0.172 (-273.15 + T)
     constant Real Cp_c1 = 0.172;
 algorithm
       cp := Cp_c0 + Cp_c1*temp;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/SpecificHeatCp_derT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/SpecificHeatCp_derT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/SpecificHeatCp_derT.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/SpecificHeatCp_derT.mo"	2022-03-10 09:58:44.900152601 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.SolarSalt;
 function SpecificHeatCp_derT "derivative of SpecificHeatCp_T"
-  input Modelica.SIunits.Temperature temp "Fluid temperature (K)";
+  input Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
   input Real der_temp "fluid temperature time derivative (K/s)";
   output Real der_cp "specific heat capacity time derivative (J/kgKs)";
 protected
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_beta.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_beta.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_beta.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_beta.mo"	2022-03-10 09:58:44.896152600 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.SolarSalt;
 function Temperature_beta "inverse function of IsobaricExpansionCoefficient_t"
-  input Modelica.SIunits.CubicExpansionCoefficient beta
+  input Modelica.Units.SI.CubicExpansionCoefficient beta
     "isobaric expansion coefficient (1/K)";
-  output Modelica.SIunits.Temperature temp "Fluid temperature (K)";
+  output Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
 protected
   constant Real betaC0 = 0.636;
   constant Real betaC1 = 2263.72;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_cp.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_cp.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_cp.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_cp.mo"	2022-03-10 09:58:44.892152601 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.SolarSalt;
 function Temperature_cp "inverse function of SpecificHeatCp_t"
-  input Modelica.SIunits.SpecificHeatCapacity cp
+  input Modelica.Units.SI.SpecificHeatCapacity cp
     "Specific Heat Capacity (J/kgK)";
-  output Modelica.SIunits.Temperature temp "Fluid temperature (K)";
+  output Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
 protected
   constant Real tempC0 = -8116.38;
   constant Real tempC1 = 5.81395;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_derbeta.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_derbeta.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_derbeta.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_derbeta.mo"	2022-03-10 09:58:44.888152599 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.SolarSalt;
 function Temperature_derbeta "derivative of Temperature_beta"
-  input Modelica.SIunits.CubicExpansionCoefficient beta
+  input Modelica.Units.SI.CubicExpansionCoefficient beta
     "isobaric expansion coefficient (1/K)";
   input Real der_beta "isobaric expansion coefficient time derivative (1/Ks)";
   output Real der_temp "fluid temperature time derivative (K/s)";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_dercp.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_dercp.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_dercp.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_dercp.mo"	2022-03-10 09:58:44.880152599 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.SolarSalt;
 function Temperature_dercp "derivative of Temperature_cp"
-  input Modelica.SIunits.SpecificHeatCapacity cp
+  input Modelica.Units.SI.SpecificHeatCapacity cp
     "Specific Heat Capacity (J/kgK)";
   input Real der_cp "specific heat capacity time derivative (J/kgKs)";
   output Real der_temp "fluid temperature time derivative (K/s)";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_derh.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_derh.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_derh.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_derh.mo"	2022-03-10 09:58:44.876152598 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.SolarSalt;
 function Temperature_derh
-    input Modelica.SIunits.SpecificEnthalpy h "Enthalpy (J/kg)";
+    input Modelica.Units.SI.SpecificEnthalpy h "Enthalpy (J/kg)";
     input Real der_h "Enthalpy time derivative (J/(kg*s))";
     output Real der_temp "Fluid temperature time derivative (K/s)";
 protected
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_derk.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_derk.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_derk.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_derk.mo"	2022-03-10 09:58:44.872152597 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.SolarSalt;
 function Temperature_derk "derivative of Temperature_k"
-  input Modelica.SIunits.ThermalConductivity k "Thermal Conductivity (W/mK)";
+  input Modelica.Units.SI.ThermalConductivity k "Thermal Conductivity (W/mK)";
   input Real der_k "thermal conductivity time derivative (W/mKs)";
   output Real der_temp "fluid temperature time derivative";
 protected
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_dermu.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_dermu.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_dermu.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_dermu.mo"	2022-03-10 09:58:44.868152597 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.SolarSalt;
 function Temperature_dermu "derivative of Temperature_mu"
-  input Modelica.SIunits.DynamicViscosity mu "Viscosity (Pa.s)";
+  input Modelica.Units.SI.DynamicViscosity mu "Viscosity (Pa.s)";
   input Real der_mu "Viscosity time derivative (Pa)";
   output Real der_temp "Fluid temperature time derivative (K/s)";
 protected
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_derrho.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_derrho.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_derrho.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_derrho.mo"	2022-03-10 09:58:44.860152597 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.SolarSalt;
 function Temperature_derrho "derivative of Temperature_rho"
-  input Modelica.SIunits.Density rho "Density (kg/m3)";
+  input Modelica.Units.SI.Density rho "Density (kg/m3)";
   input Real der_rho "Density time derivative (kg/(m3*s))";
   output Real der_temp "Fluid temperature time derivative (K/s)";
 protected
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_h.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_h.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_h.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_h.mo"	2022-03-10 09:58:44.856152595 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Properties.SolarSalt;
 function Temperature_h
-    input Modelica.SIunits.SpecificEnthalpy h "Enthalpy (J/kg)";
-    output Modelica.SIunits.Temperature temp "Fluid temperature (K)";
+    input Modelica.Units.SI.SpecificEnthalpy h "Enthalpy (J/kg)";
+    output Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
 protected
     constant Real enthC0 = -798297.6386;
     constant Real enthC1 = 1396.02;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_k.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_k.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_k.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_k.mo"	2022-03-10 09:58:44.848152595 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Properties.SolarSalt;
 function Temperature_k "inverse function of ThermalConductivity_t"
-  input Modelica.SIunits.ThermalConductivity k "Thermal Conductivity";
-  output Modelica.SIunits.Temperature temp "Fluid temperature (K)";
+  input Modelica.Units.SI.ThermalConductivity k "Thermal Conductivity";
+  output Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
 protected
   constant Real tempC0 = -2058.43;
   constant Real tempC1 = 5263.16;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_mu.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_mu.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_mu.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_mu.mo"	2022-03-10 09:58:44.840152593 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Properties.SolarSalt;
 function Temperature_mu "inverse of DynamicViscosity_t"
-  input Modelica.SIunits.DynamicViscosity mu "Viscosity (Pa.s)";
-  output Modelica.SIunits.Temperature temp "Fluid temperature (K)";
+  input Modelica.Units.SI.DynamicViscosity mu "Viscosity (Pa.s)";
+  output Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
 protected
     constant Real viscC0 = 0.07551475951333098;
     constant Real viscC1 = - 0.00027760397992950003;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_rho.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_rho.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_rho.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/Temperature_rho.mo"	2022-03-10 09:58:44.832152592 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Properties.SolarSalt;
 function Temperature_rho "inverse of function Density_t"
-  input Modelica.SIunits.Density rho "Density (kg/m3)";
-  output Modelica.SIunits.Temperature temp "Fluid temperature (K)";
+  input Modelica.Units.SI.Density rho "Density (kg/m3)";
+  output Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
 protected
   constant Real Temp_c0 = 3559.31;
   constant Real Temp_c1 = - 1.57233;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/ThermalConductivity_T.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/ThermalConductivity_T.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/ThermalConductivity_T.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/ThermalConductivity_T.mo"	2022-03-10 09:58:44.824152591 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.SolarSalt;
 function ThermalConductivity_T
-    input Modelica.SIunits.Temperature temp "Fluid temperature (K)";
-    output Modelica.SIunits.ThermalConductivity k "Thermal Conductivity";
+    input Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
+    output Modelica.Units.SI.ThermalConductivity k "Thermal Conductivity";
 protected
-    constant Real Conductivity_c0 = 0.3911015;               // 0.443 + 0.00019 (-273.15 + T)
+    constant Real Conductivity_c0 = 0.3911015;                 // 0.443 + 0.00019 (-273.15 + T)
     constant Real Conductivity_c1 = 0.00019;
 algorithm
       k := Conductivity_c0 + Conductivity_c1*temp;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/ThermalConductivity_derT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/ThermalConductivity_derT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/ThermalConductivity_derT.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/SolarSalt/ThermalConductivity_derT.mo"	2022-03-10 09:58:44.820152590 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.SolarSalt;
 function ThermalConductivity_derT "derivative of ThermalConductivity_T"
-  input Modelica.SIunits.Temperature temp "Fluid temperature (K)";
+  input Modelica.Units.SI.Temperature temp "Fluid temperature (K)";
   input Real der_temp "fluid temperature time derivative (K/s)";
   output Real der_k "thermal conductivity time derivative (W/mKs)";
 protected
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSolution/DTcristal_TX.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSolution/DTcristal_TX.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSolution/DTcristal_TX.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSolution/DTcristal_TX.mo"	2022-03-10 09:58:44.804152589 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Properties.WaterSolution;
 function DTcristal_TX
   "Temperature difference with the cristallisation of the H2O/LiBr solution as a function of T et Xh2o"
-  input Modelica.SIunits.Temperature T "Temperature";
+  input Modelica.Units.SI.Temperature T "Temperature";
   input Real X "Water mass fraction in the solution";
 
   output ThermoSysPro.Units.DifferentialTemperature DTc
@@ -9,9 +9,9 @@
 
 protected
   Real Xi "LiBr mass fraction in the solution";
-  Modelica.SIunits.Temperature Tc "Temperature in Celsius";
-  Modelica.SIunits.Temperature Tcrist "Cristallisation temperature in Celsius";
 
+  Modelica.Units.SI.Temperature Tc "Temperature in Celsius";
+  Modelica.Units.SI.Temperature Tcrist "Cristallisation temperature in Celsius";
 algorithm
   /* Units conversions */
   Tc := T - 273.15;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSolution/MassFraction_eq_PT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSolution/MassFraction_eq_PT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSolution/MassFraction_eq_PT.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSolution/MassFraction_eq_PT.mo"	2022-03-10 09:58:44.800152588 +0000
@@ -1,8 +1,8 @@
-﻿within ThermoSysPro.Properties.WaterSolution;
+within ThermoSysPro.Properties.WaterSolution;
 function MassFraction_eq_PT
   "Equilibrium mass fraction of the H2O/LiBr solution as a function of T et Xh2o"
-  input Modelica.SIunits.AbsolutePressure P "Pressure";
-  input Modelica.SIunits.Temperature T "Temperature";
+  input Modelica.Units.SI.AbsolutePressure P "Pressure";
+  input Modelica.Units.SI.Temperature T "Temperature";
 
   output Real Xe "Equilibrium mass fraction";
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSolution/Pressure_eq_TX.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSolution/Pressure_eq_TX.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSolution/Pressure_eq_TX.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSolution/Pressure_eq_TX.mo"	2022-03-10 09:58:44.792152588 +0000
@@ -1,10 +1,10 @@
-﻿within ThermoSysPro.Properties.WaterSolution;
+within ThermoSysPro.Properties.WaterSolution;
 function Pressure_eq_TX
   "Equilibrium pressure of the H2O/LiBr solution as a funciton of T and Xh2o"
-  input Modelica.SIunits.Temperature T "Temperature";
+  input Modelica.Units.SI.Temperature T "Temperature";
   input Real X "Water mass fraction in the solution";
 
-  output Modelica.SIunits.AbsolutePressure Pe
+  output Modelica.Units.SI.AbsolutePressure Pe
     "Equilibrium pressure of the solution";
 
 protected
@@ -15,17 +15,25 @@
   Real A2 "Coefficient directeur borne supérieure";
   Real B2 "Ordonnée à l'origine borne supérieure";
 
-// Table utilisée extraite d'un diagramme de Oldham
-// Xh2o     a               b
-// 1        5467.383523        26.36790788
-// 0.6        5379.103071        25.44182656
-// 0.55        5304.170432        24.93793936
-// 0.5        5438.215285        24.96552904
-// 0.45        5624.954368        25.04073086
-// 0.4        5862.125101        25.2166991
-// 0.35        6036.317803        25.22194134
-// 0.3        5904.887091        24.38414762
+// Table utilisée extraite d'un diagramme de Oldham
 
+// Xh2o     a               b
+
+// 1        5467.383523        26.36790788
+
+// 0.6        5379.103071        25.44182656
+
+// 0.55        5304.170432        24.93793936
+
+// 0.5        5438.215285        24.96552904
+
+// 0.45        5624.954368        25.04073086
+
+// 0.4        5862.125101        25.2166991
+
+// 0.35        6036.317803        25.22194134
+
+// 0.3        5904.887091        24.38414762
 algorithm
   /* Cristallisaiton temperature */
   if (X>0.6) then
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSolution/SpecificEnthalpy_TX.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSolution/SpecificEnthalpy_TX.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSolution/SpecificEnthalpy_TX.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSolution/SpecificEnthalpy_TX.mo"	2022-03-10 09:58:44.784152587 +0000
@@ -1,10 +1,10 @@
 within ThermoSysPro.Properties.WaterSolution;
 function SpecificEnthalpy_TX
   "Specific enthalpy of the H2O/LiBr solution as a function of T and Xh2o"
-  input Modelica.SIunits.Temperature T "Temperature";
+  input Modelica.Units.SI.Temperature T "Temperature";
   input Real X "Water mass fraction in the solution";
 
-  output Modelica.SIunits.SpecificEnthalpy h
+  output Modelica.Units.SI.SpecificEnthalpy h
     "Specific enthalpy of the solution";
 
 protected
@@ -15,14 +15,14 @@
   Real C5;
   Real DXi;
   Real Xi "LiBr mass fraction in the solution";
-  Modelica.SIunits.Temperature Tc "Temperature in Celsius";
-  Modelica.SIunits.SpecificEnthalpy H1
+
+  Modelica.Units.SI.Temperature Tc "Temperature in Celsius";
+  Modelica.Units.SI.SpecificEnthalpy H1
     "Liquid LiBr specific enthalpy on the saturation line";
-  Modelica.SIunits.SpecificEnthalpy Hliq
+  Modelica.Units.SI.SpecificEnthalpy Hliq
     "Liquid H2O specific enthalpy on the saturation line";
-  Modelica.SIunits.SpecificEnthalpy Dh
+  Modelica.Units.SI.SpecificEnthalpy Dh
     "Difference in specific enthalpy wrt. ideal mixing";
-
 algorithm
   /* Liquid H2O specific enthalpy */
   Hliq := ThermoSysPro.Properties.WaterSteam.IF97.SpecificEnthalpy_PT(15e5, T, 1);
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSolution/Temperature_hX.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSolution/Temperature_hX.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSolution/Temperature_hX.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSolution/Temperature_hX.mo"	2022-03-10 09:58:44.756152582 +0000
@@ -1,11 +1,11 @@
 within ThermoSysPro.Properties.WaterSolution;
 function Temperature_hX
   "Temperature of the H2O/LiBr solution as a function of h et Xh2o"
-  input Modelica.SIunits.SpecificEnthalpy h
+  input Modelica.Units.SI.SpecificEnthalpy h
     "Specific enthazlpy of the solution";
   input Real X "Water mass fraction in the solution";
 
-  output Modelica.SIunits.Temperature T "Temperature";
+  output Modelica.Units.SI.Temperature T "Temperature";
 
 protected
   Real A0;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam/BaseIF97.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam/BaseIF97.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam/BaseIF97.mo"	2022-03-10 09:57:37.984144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam/BaseIF97.mo"	2022-03-10 09:58:44.540152555 +0000
@@ -1,71 +1,48 @@
-﻿within ThermoSysPro.Properties.WaterSteam;
-package BaseIF97
-  "Modelica Physical Property Model: the new industrial formulation IAPWS-IF97"
-
-  import SI = Modelica.SIunits;
-  record IterationData "constants for iterations internal to some functions"
-
-    extends Modelica.Icons.Record;
-    constant Integer IMAX=50
-      "maximum number of iterations for inverse functions";
-    constant Real DELP=1.0e-6 "maximum iteration error in pressure, Pa";
-    constant Real DELS=1.0e-8
-      "maximum iteration error in specific entropy, J/{kg.K}";
-    constant Real DELH=1.0e-8
-      "maximum iteration error in specific entthalpy, J/kg";
-    constant Real DELD=1.0e-8 "maximum iteration error in density, kg/m^3";
-  end IterationData;
-  //===================================================================
-  //                      Constant declarations
-
-  //===================================================================
-  record data "constant IF97 data and region limits"
-    extends Modelica.Icons.Record;
-    constant Modelica.SIunits.SpecificHeatCapacity RH2O=461.526
-      "specific gas constant of water vapour";
-    constant Modelica.SIunits.MolarMass MH2O=0.01801528 "molar weight of water";
-    constant Modelica.SIunits.Temperature TSTAR1=1386.0
-      "normalization temperature for region 1 IF97";
-    constant Modelica.SIunits.Pressure PSTAR1=16.53e6
-      "normalization pressure for region 1 IF97";
-    constant Modelica.SIunits.Temperature TSTAR2=540.0
-      "normalization temperature for region 2 IF97";
-    constant Modelica.SIunits.Pressure PSTAR2=1.0e6
-      "normalization pressure for region 2 IF97";
-    constant Modelica.SIunits.Temperature TSTAR5=1000.0
-      "normalization temperature for region 5 IF97";
-    constant Modelica.SIunits.Pressure PSTAR5=1.0e6
-      "normalization pressure for region 5 IF97";
-    constant Modelica.SIunits.SpecificEnthalpy HSTAR1=2.5e6
-      "normalization specific enthalpy for region 1 IF97";
-    constant Real IPSTAR=1.0e-6
-      "normalization pressure for inverse function in region 2 IF97";
-    constant Real IHSTAR=5.0e-7
-      "normalization specific enthalpy for inverse function in region 2 IF97";
-    constant Modelica.SIunits.Temperature TLIMIT1=623.15
-      "temperature limit between regions 1 and 3";
-    constant Modelica.SIunits.Temperature TLIMIT2=1073.15
-      "temperature limit between regions 2 and 5";
-    constant Modelica.SIunits.Temperature TLIMIT5=2273.15
-      "upper temperature limit of 5";
-    constant Modelica.SIunits.Pressure PLIMIT1=100.0e6
-      "upper pressure limit for regions 1, 2 and 3";
-    constant Modelica.SIunits.Pressure PLIMIT4A=16.5292e6
-      "pressure limit between regions 1 and 2, important for for two-phase (region 4)";
-    constant Modelica.SIunits.Pressure PLIMIT5=10.0e6
-      "upper limit of valid pressure in region 5";
-    constant Modelica.SIunits.Pressure PCRIT=22064000.0 "the critical pressure";
-    constant Modelica.SIunits.Temperature TCRIT=647.096
-      "the critical temperature";
-    constant Modelica.SIunits.Density DCRIT=322.0 "the critical density";
-    constant Modelica.SIunits.SpecificEntropy SCRIT=4412.02148223476
-      "the calculated specific entropy at the critical point";
-    constant Modelica.SIunits.SpecificEnthalpy HCRIT=2087546.84511715
-      "the calculated specific enthalpy at the critical point";
-    constant Real[5] n=array(0.34805185628969e3, -0.11671859879975e1,
-        0.10192970039326e-2, 0.57254459862746e3, 0.13918839778870e2)
-      "polynomial coefficients for boundary between regions 2 and 3";
-    annotation (Documentation(info="<HTML>
+within ThermoSysPro.Properties.WaterSteam;
+
+package BaseIF97 "Modelica Physical Property Model: the new industrial formulation IAPWS-IF97"
+  import Modelica.Units.SI;
+
+  record IterationData "constants for iterations internal to some functions"
+    extends Modelica.Icons.Record;
+    constant Integer IMAX = 50 "maximum number of iterations for inverse functions";
+    constant Real DELP = 1.0e-6 "maximum iteration error in pressure, Pa";
+    constant Real DELS = 1.0e-8 "maximum iteration error in specific entropy, J/{kg.K}";
+    constant Real DELH = 1.0e-8 "maximum iteration error in specific entthalpy, J/kg";
+    constant Real DELD = 1.0e-8 "maximum iteration error in density, kg/m^3";
+  end IterationData;
+
+  //===================================================================
+  //                      Constant declarations
+  //===================================================================
+
+  record data "constant IF97 data and region limits"
+    extends Modelica.Icons.Record;
+    constant Modelica.Units.SI.SpecificHeatCapacity RH2O = 461.526 "specific gas constant of water vapour";
+    constant Modelica.Units.SI.MolarMass MH2O = 0.01801528 "molar weight of water";
+    constant Modelica.Units.SI.Temperature TSTAR1 = 1386.0 "normalization temperature for region 1 IF97";
+    constant Modelica.Units.SI.Pressure PSTAR1 = 16.53e6 "normalization pressure for region 1 IF97";
+    constant Modelica.Units.SI.Temperature TSTAR2 = 540.0 "normalization temperature for region 2 IF97";
+    constant Modelica.Units.SI.Pressure PSTAR2 = 1.0e6 "normalization pressure for region 2 IF97";
+    constant Modelica.Units.SI.Temperature TSTAR5 = 1000.0 "normalization temperature for region 5 IF97";
+    constant Modelica.Units.SI.Pressure PSTAR5 = 1.0e6 "normalization pressure for region 5 IF97";
+    constant Modelica.Units.SI.SpecificEnthalpy HSTAR1 = 2.5e6 "normalization specific enthalpy for region 1 IF97";
+    constant Real IPSTAR = 1.0e-6 "normalization pressure for inverse function in region 2 IF97";
+    constant Real IHSTAR = 5.0e-7 "normalization specific enthalpy for inverse function in region 2 IF97";
+    constant Modelica.Units.SI.Temperature TLIMIT1 = 623.15 "temperature limit between regions 1 and 3";
+    constant Modelica.Units.SI.Temperature TLIMIT2 = 1073.15 "temperature limit between regions 2 and 5";
+    constant Modelica.Units.SI.Temperature TLIMIT5 = 2273.15 "upper temperature limit of 5";
+    constant Modelica.Units.SI.Pressure PLIMIT1 = 100.0e6 "upper pressure limit for regions 1, 2 and 3";
+    constant Modelica.Units.SI.Pressure PLIMIT4A = 16.5292e6 "pressure limit between regions 1 and 2, important for for two-phase (region 4)";
+    constant Modelica.Units.SI.Pressure PLIMIT5 = 10.0e6 "upper limit of valid pressure in region 5";
+    constant Modelica.Units.SI.Pressure PCRIT = 22064000.0 "the critical pressure";
+    constant Modelica.Units.SI.Temperature TCRIT = 647.096 "the critical temperature";
+    constant Modelica.Units.SI.Density DCRIT = 322.0 "the critical density";
+    constant Modelica.Units.SI.SpecificEntropy SCRIT = 4412.02148223476 "the calculated specific entropy at the critical point";
+    constant Modelica.Units.SI.SpecificEnthalpy HCRIT = 2087546.84511715 "the calculated specific enthalpy at the critical point";
+    constant Real[5] n = array(0.34805185628969e3, -0.11671859879975e1, 0.10192970039326e-2, 0.57254459862746e3, 0.13918839778870e2) "polynomial coefficients for boundary between regions 2 and 3";
+    annotation(
+      Documentation(info = "<HTML>
  <h4>Record description</h4>
                            <p>Constants needed in the international steam properties IF97.
                            SCRIT and HCRIT are calculated from Helmholtz function for region 3.</p>
@@ -87,20 +64,18 @@
  <li>Documentation added: December 2002</li>
 </ul>
 </HTML>
-"));
-  end data;
-
-  record critical "critical point data"
-    extends Modelica.Icons.Record;
-    constant Modelica.SIunits.Pressure PCRIT=22064000.0 "the critical pressure";
-    constant Modelica.SIunits.Temperature TCRIT=647.096
-      "the critical temperature";
-    constant Modelica.SIunits.Density DCRIT=322.0 "the critical density";
-    constant Modelica.SIunits.SpecificEnthalpy HCRIT=2087546.84511715
-      "the calculated specific enthalpy at the critical point";
-    constant Modelica.SIunits.SpecificEntropy SCRIT=4412.02148223476
-      "the calculated specific entropy at the critical point";
-    annotation (Documentation(info="<HTML>
+      "));
+  end data;
+
+  record critical "critical point data"
+    extends Modelica.Icons.Record;
+    constant Modelica.Units.SI.Pressure PCRIT = 22064000.0 "the critical pressure";
+    constant Modelica.Units.SI.Temperature TCRIT = 647.096 "the critical temperature";
+    constant Modelica.Units.SI.Density DCRIT = 322.0 "the critical density";
+    constant Modelica.Units.SI.SpecificEnthalpy HCRIT = 2087546.84511715 "the calculated specific enthalpy at the critical point";
+    constant Modelica.Units.SI.SpecificEntropy SCRIT = 4412.02148223476 "the calculated specific entropy at the critical point";
+    annotation(
+      Documentation(info = "<HTML>
  <h4>Record description</h4>
  <p>Critical point data for IF97 steam properties. SCRIT and HCRIT are calculated from helmholtz function for region 3 </p>
 <h4>Version Info and Revision history
@@ -121,20 +96,17 @@
  <li>Documentation added: December 2002</li>
 </ul>
 </HTML>
-"));
-  end critical;
-
-  record triple "triple point data"
-    extends Modelica.Icons.Record;
-    constant Modelica.SIunits.Temperature Ttriple=273.16
-      "the triple point temperature";
-    constant Modelica.SIunits.Pressure ptriple=611.657
-      "the triple point temperature";
-    constant Modelica.SIunits.Density dltriple=999.792520031617642
-      "the triple point liquid density";
-    constant Modelica.SIunits.Density dvtriple=0.485457572477861372e-2
-      "the triple point vapour density";
-    annotation (Documentation(info="<HTML>
+      "));
+  end critical;
+
+  record triple "triple point data"
+    extends Modelica.Icons.Record;
+    constant Modelica.Units.SI.Temperature Ttriple = 273.16 "the triple point temperature";
+    constant Modelica.Units.SI.Pressure ptriple = 611.657 "the triple point temperature";
+    constant Modelica.Units.SI.Density dltriple = 999.792520031617642 "the triple point liquid density";
+    constant Modelica.Units.SI.Density dvtriple = 0.485457572477861372e-2 "the triple point vapour density";
+    annotation(
+      Documentation(info = "<HTML>
  <h4>Record description</h4>
  <p>Vapour/liquid/ice triple point data for IF97 steam properties.</p>
 <h4>Version Info and Revision history
@@ -155,1282 +127,991 @@
  <li>Documentation added: December 2002</li>
 </ul>
 </HTML>
-"));
-  end triple;
-
-  package Regions
-    "functions to find the current region for given pairs of input variables"
-
-    //===================================================================
-    //                      "Public" functions
-
-    //===================================================================
-
-    function boundary23ofT
-      "boundary function for region boundary between regions 2 and 3 (input temperature)"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Temperature t "temperature (K)";
-      output Modelica.SIunits.Pressure p "pressure";
-    protected
-      constant Real[5] n=data.n;
-    algorithm
-      p := 1.0e6*(n[1] + t*(n[2] + t*n[3]));
-    end boundary23ofT;
-
-    function boundary23ofp
-      "boundary function for region boundary between regions 2 and 3 (input pressure)"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output Modelica.SIunits.Temperature t "temperature (K)";
-    protected
-      constant Real[5] n=data.n;
-      Real pi "dimensionless pressure";
-    algorithm
-      pi := p/1.0e6;
-      assert(p > triple.ptriple,
-        "IF97 medium function boundary23ofp called with too low pressure\n" +
-        "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
-      t := n[4] + ((pi - n[5])/n[3])^0.5;
-    end boundary23ofp;
-
-    function hlowerofp5
-      "explicit lower specific enthalpy limit of region 5 as function of pressure"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    protected
-      Real pi "dimensionless pressure";
-    algorithm
-      pi := p/data.PSTAR5;
-      assert(p > triple.ptriple,
-        "IF97 medium function hlowerofp5 called with too low pressure\n" +
-        "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
-      h := 461526.*(9.01505286876203 + pi*(-0.00979043490246092 + (-0.0000203245575263501
-         + 3.36540214679088e-7*pi)*pi));
-    end hlowerofp5;
-
-    function hupperofp5
-      "explicit upper specific enthalpy limit of region 5 as function of pressure"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    protected
-      Real pi "dimensionless pressure";
-    algorithm
-      pi := p/data.PSTAR5;
-      assert(p > triple.ptriple,
-        "IF97 medium function hupperofp5 called with too low pressure\n" +
-        "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
-      h := 461526.*(15.9838891400332 + pi*(-0.000489898813722568 + (-5.01510211858761e-8
-         + 7.5006972718273e-8*pi)*pi));
-    end hupperofp5;
-
-    function slowerofp5
-      "explicit lower specific entropy limit of region 5 as function of pressure"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output Modelica.SIunits.SpecificEntropy s "specific entropy";
-    protected
-      Real pi "dimensionless pressure";
-    algorithm
-      pi := p/data.PSTAR5;
-      assert(p > triple.ptriple,
-        "IF97 medium function slowerofp5 called with too low pressure\n" +
-        "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
-      s := 461.526*(18.4296209980112 + pi*(-0.00730911805860036 + (-0.0000168348072093888
-         + 2.09066899426354e-7*pi)*pi) - Modelica.Math.log(pi));
-    end slowerofp5;
-
-    function supperofp5
-      "explicit upper specific entropy limit of region 5 as function of pressure"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output Modelica.SIunits.SpecificEntropy s "specific entropy";
-    protected
-      Real pi "dimensionless pressure";
-    algorithm
-      pi := p/data.PSTAR5;
-      assert(p > triple.ptriple,
-        "IF97 medium function supperofp5 called with too low pressure\n" +
-        "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
-      s := 461.526*(22.7281531474243 + pi*(-0.000656650220627603 + (-1.96109739782049e-8
-         + 2.19979537113031e-8*pi)*pi) - Modelica.Math.log(pi));
-    end supperofp5;
-
-    function hlowerofp1
-      "explicit lower specific enthalpy limit of region 1 as function of pressure"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    protected
-      Real pi1 "dimensionless pressure";
-      Real[3] o "vector of auxiliary variables";
-    algorithm
-      pi1 := 7.1 - p/data.PSTAR1;
-      assert(p > triple.ptriple,
-        "IF97 medium function hlowerofp1 called with too low pressure\n" +
-        "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
-      o[1] := pi1*pi1;
-      o[2] := o[1]*o[1];
-      o[3] := o[2]*o[2];
-
-      h := 639675.036*(0.173379420894777 + pi1*(-0.022914084306349 + pi1*(-0.00017146768241932
-         + pi1*(-4.18695814670391e-6 + pi1*(-2.41630417490008e-7 + pi1*(
-        1.73545618580828e-11 + o[1]*pi1*(8.43755552264362e-14 + o[2]*o[3]*pi1
-        *(5.35429206228374e-35 + o[1]*(-8.12140581014818e-38 + o[1]*o[2]*(-1.43870236842915e-44
-         + pi1*(1.73894459122923e-45 + (-7.06381628462585e-47 +
-        9.64504638626269e-49*pi1)*pi1)))))))))));
-    end hlowerofp1;
-
-    function hupperofp1
-      "explicit upper specific enthalpy limit of region 1 as function of pressure (meets region 4 saturation pressure curve at 623.15 K)"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    protected
-      Real pi1 "dimensionless pressure";
-      Real[3] o "vector of auxiliary variables";
-    algorithm
-      pi1 := 7.1 - p/data.PSTAR1;
-      assert(p > triple.ptriple,
-        "IF97 medium function hupperofp1 called with too low pressure\n" +
-        "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
-      o[1] := pi1*pi1;
-      o[2] := o[1]*o[1];
-      o[3] := o[2]*o[2];
-      h := 639675.036*(2.42896927729349 + pi1*(-0.00141131225285294 + pi1*(
-        0.00143759406818289 + pi1*(0.000125338925082983 + pi1*(
-        0.0000123617764767172 + pi1*(3.17834967400818e-6 + o[1]*pi1*(
-        1.46754947271665e-8 + o[2]*o[3]*pi1*(1.86779322717506e-17 + o[1]*(-4.18568363667416e-19
-         + o[1]*o[2]*(-9.19148577641497e-22 + pi1*(4.27026404402408e-22 + (-6.66749357417962e-23
-         + 3.49930466305574e-24*pi1)*pi1)))))))))));
-    end hupperofp1;
-
-    function slowerofp1
-      "explicit lower specific entropy limit of region 1 as function of pressure"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output Modelica.SIunits.SpecificEntropy s "specific entropy";
-    protected
-      Real pi1 "dimensionless pressure";
-      Real[3] o "vector of auxiliary variables";
-    algorithm
-      pi1 := 7.1 - p/data.PSTAR1;
-      assert(p > triple.ptriple,
-        "IF97 medium function slowerofp1 called with too low pressure\n" +
-        "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
-      o[1] := pi1*pi1;
-      o[2] := o[1]*o[1];
-      o[3] := o[2]*o[2];
-      s := 461.526*(-0.0268080988194267 + pi1*(0.00834795890110168 + pi1*(-0.000486470924668433
-         + pi1*(-0.0000154902045012264 + pi1*(-1.07631751351358e-6 + pi1*(
-        9.64159058957115e-11 + o[1]*pi1*(4.81921078863103e-13 + o[2]*o[3]*pi1
-        *(2.7879623870968e-34 + o[1]*(-4.22182957646226e-37 + o[1]*o[2]*(-7.44601427465175e-44
-         + pi1*(8.99540001407168e-45 + (-3.65230274480299e-46 +
-        4.98464639687285e-48*pi1)*pi1)))))))))));
-    end slowerofp1;
-
-    function supperofp1
-      "explicit upper specific entropy limit of region 1 as function of pressure (meets region 4 saturation pressure curve at 623.15 K)"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output Modelica.SIunits.SpecificEntropy s "specific entropy";
-    protected
-      Real pi1 "dimensionless pressure";
-      Real[3] o "vector of auxiliary variables";
-    algorithm
-      pi1 := 7.1 - p/data.PSTAR1;
-      assert(p > triple.ptriple,
-        "IF97 medium function supperofp1 called with too low pressure\n" +
-        "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
-      o[1] := pi1*pi1;
-      o[2] := o[1]*o[1];
-      o[3] := o[2]*o[2];
-      s := 461.526*(7.28316418503422 + pi1*(0.070602197808399 + pi1*(
-        0.0039229343647356 + pi1*(0.000313009170788845 + pi1*(
-        0.0000303619398631619 + pi1*(7.46739440045781e-6 + o[1]*pi1*(
-        3.40562176858676e-8 + o[2]*o[3]*pi1*(4.21886233340801e-17 + o[1]*(-9.44504571473549e-19
-         + o[1]*o[2]*(-2.06859611434475e-21 + pi1*(9.60758422254987e-22 + (-1.49967810652241e-22
-         + 7.86863124555783e-24*pi1)*pi1)))))))))));
-    end supperofp1;
-
-    function hlowerofp2
-      "explicit lower specific enthalpy limit of region 2 as function of pressure (meets region 4 saturation pressure curve at 623.15 K)"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    protected
-      Real pi "dimensionless pressure";
-      Real q1 "auxiliary variable";
-      Real q2 "auxiliary variable";
-      Real[18] o "vector of auxiliary variables";
-    algorithm
-      pi := p/data.PSTAR2;
-      assert(p > triple.ptriple,
-        "IF97 medium function hlowerofp2 called with too low pressure\n" +
-        "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
-      q1 := 572.54459862746 + 31.3220101646784*(-13.91883977887 + pi)^0.5;
-      q2 := -0.5 + 540./q1;
-      o[1] := q1*q1;
-      o[2] := o[1]*o[1];
-      o[3] := o[2]*o[2];
-      o[4] := pi*pi;
-      o[5] := o[4]*o[4];
-      o[6] := q2*q2;
-      o[7] := o[6]*o[6];
-      o[8] := o[6]*o[7];
-      o[9] := o[5]*o[5];
-      o[10] := o[7]*o[7];
-      o[11] := o[9]*o[9];
-      o[12] := o[10]*o[10];
-      o[13] := o[12]*o[12];
-      o[14] := o[7]*q2;
-      o[15] := o[6]*q2;
-      o[16] := o[10]*o[6];
-      o[17] := o[13]*o[6];
-      o[18] := o[13]*o[6]*q2;
-      h := (4.63697573303507e9 + 3.74686560065793*o[2] + 3.57966647812489e-6*
-        o[1]*o[2] + 2.81881548488163e-13*o[3] - 7.64652332452145e7*q1 -
-        0.00450789338787835*o[2]*q1 - 1.55131504410292e-9*o[1]*o[2]*q1 + o[1]
-        *(2.51383707870341e6 - 4.78198198764471e6*o[10]*o[11]*o[12]*o[13]*o[4]
-         + 49.9651389369988*o[11]*o[12]*o[13]*o[4]*o[5]*o[7] + o[15]*o[4]*(
-        1.03746636552761e-13 - 0.00349547959376899*o[16] -
-        2.55074501962569e-7*o[8])*o[9] + (-242662.235426958*o[10]*o[12] -
-        3.46022402653609*o[16])*o[4]*o[5]*pi + o[4]*(0.109336249381227 -
-        2248.08924686956*o[14] - 354742.725841972*o[17] - 24.1331193696374*o[
-        6])*pi - 3.09081828396912e-19*o[11]*o[12]*o[5]*o[7]*pi -
-        1.24107527851371e-8*o[11]*o[13]*o[4]*o[5]*o[6]*o[7]*pi +
-        3.99891272904219*o[5]*o[8]*pi + 0.0641817365250892*o[10]*o[7]*o[9]*pi
-         + pi*(-4444.87643334512 - 75253.6156722047*o[14] - 43051.9020511789*
-        o[6] - 22926.6247146068*q2) + o[4]*(-8.23252840892034 -
-        3927.0508365636*o[15] - 239.325789467604*o[18] - 76407.3727417716*o[8]
-         - 94.4508644545118*q2) + 0.360567666582363*o[5]*(-0.0161221195808321
-         + q2)*(0.0338039844460968 + q2) + o[11]*(-0.000584580992538624*o[10]
-        *o[12]*o[7] + 1.33248030241755e6*o[12]*o[13]*q2) + o[9]*(-7.38502736990986e7
-        *o[18] + 0.0000224425477627799*o[6]*o[7]*q2) + o[4]*o[5]*(-2.08438767026518e8
-        *o[17] - 0.0000124971648677697*o[6] - 8442.30378348203*o[10]*o[6]*o[7]
-        *q2) + o[11]*o[9]*(4.73594929247646e-22*o[10]*o[12]*q2 -
-        13.6411358215175*o[10]*o[12]*o[13]*q2 + 5.52427169406836e-10*o[13]*o[
-        6]*o[7]*q2) + o[11]*o[5]*(2.67174673301715e-6*o[17] +
-        4.44545133805865e-18*o[12]*o[6]*q2 - 50.2465185106411*o[10]*o[13]*o[6]
-        *o[7]*q2)))/o[1];
-    end hlowerofp2;
-
-    function hupperofp2
-      "explicit upper specific enthalpy limit of region 2 as function of pressure"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    protected
-      Real pi "dimensionless pressure";
-      Real[2] o "vector of auxiliary variables";
-    algorithm
-      pi := p/data.PSTAR2;
-      assert(p > triple.ptriple,
-        "IF97 medium function hupperofp2 called with too low pressure\n" +
-        "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
-      o[1] := pi*pi;
-      o[2] := o[1]*o[1]*o[1];
-      h := 4.16066337647071e6 + pi*(-4518.48617188327 + pi*(-8.53409968320258
-         + pi*(0.109090430596056 + pi*(-0.000172486052272327 + pi*(
-        4.2261295097284e-15 + pi*(-1.27295130636232e-10 + pi*(-3.79407294691742e-25
-         + pi*(7.56960433802525e-23 + pi*(7.16825117265975e-32 + pi*(
-        3.37267475986401e-21 + (-7.5656940729795e-74 + o[1]*(-8.00969737237617e-134
-         + (1.6746290980312e-65 + pi*(-3.71600586812966e-69 + pi*(
-        8.06630589170884e-129 + (-1.76117969553159e-103 +
-        1.88543121025106e-84*pi)*pi)))*o[1]))*o[2]))))))))));
-    end hupperofp2;
-
-    function slowerofp2
-      "explicit lower specific entropy limit of region 2 as function of pressure (meets region 4 saturation pressure curve at 623.15 K)"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output Modelica.SIunits.SpecificEntropy s "specific entropy";
-    protected
-      Real pi "dimensionless pressure";
-      Real q1 "auxiliary variable";
-      Real q2 "auxiliary variable";
-      Real[40] o "vector of auxiliary variables";
-    algorithm
-      pi := p/data.PSTAR2;
-      assert(p > triple.ptriple,
-        "IF97 medium function slowerofp2 called with too low pressure\n" +
-        "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
-      q1 := 572.54459862746 + 31.3220101646784*(-13.91883977887 + pi)^0.5;
-      q2 := -0.5 + 540.0/q1;
-      o[1] := pi*pi;
-      o[2] := o[1]*pi;
-      o[3] := o[1]*o[1];
-      o[4] := o[1]*o[3]*pi;
-      o[5] := q1*q1;
-      o[6] := o[5]*q1;
-      o[7] := 1/o[5];
-      o[8] := 1/q1;
-      o[9] := o[5]*o[5];
-      o[10] := o[9]*q1;
-      o[11] := q2*q2;
-      o[12] := o[11]*q2;
-      o[13] := o[1]*o[3];
-      o[14] := o[11]*o[11];
-      o[15] := o[3]*o[3];
-      o[16] := o[1]*o[15];
-      o[17] := o[11]*o[14];
-      o[18] := o[11]*o[14]*q2;
-      o[19] := o[3]*pi;
-      o[20] := o[14]*o[14];
-      o[21] := o[11]*o[20];
-      o[22] := o[15]*pi;
-      o[23] := o[14]*o[20]*q2;
-      o[24] := o[20]*o[20];
-      o[25] := o[15]*o[15];
-      o[26] := o[25]*o[3];
-      o[27] := o[14]*o[24];
-      o[28] := o[25]*o[3]*pi;
-      o[29] := o[20]*o[24]*q2;
-      o[30] := o[15]*o[25];
-      o[31] := o[24]*o[24];
-      o[32] := o[11]*o[31]*q2;
-      o[33] := o[14]*o[31];
-      o[34] := o[1]*o[25]*o[3]*pi;
-      o[35] := o[11]*o[14]*o[31]*q2;
-      o[36] := o[1]*o[25]*o[3];
-      o[37] := o[1]*o[25];
-      o[38] := o[20]*o[24]*o[31]*q2;
-      o[39] := o[14]*q2;
-      o[40] := o[11]*o[31];
-
-      s := 461.526*(9.692768600217 + 1.22151969114703e-16*o[10] +
-        0.00018948987516315*o[1]*o[11] + 1.6714766451061e-11*o[12]*o[13] +
-        0.0039392777243355*o[1]*o[14] - 1.0406965210174e-19*o[14]*o[16] +
-        0.043797295650573*o[1]*o[18] - 2.2922076337661e-6*o[18]*o[19] -
-        2.0481737692309e-8*o[2] + 0.00003227767723857*o[12]*o[2] +
-        0.0015033924542148*o[17]*o[2] - 1.1256211360459e-11*o[15]*o[20] +
-        1.0018179379511e-9*o[11]*o[14]*o[16]*o[20] + 1.0234747095929e-13*o[16]
-        *o[21] - 1.9809712802088e-8*o[22]*o[23] + 0.0021171472321355*o[13]*o[
-        24] - 8.9185845355421e-25*o[26]*o[27] - 1.2790717852285e-8*o[11]*o[3]
-         - 4.8225372718507e-7*o[12]*o[3] - 7.3087610595061e-29*o[11]*o[20]*o[
-        24]*o[30] - 0.10693031879409*o[11]*o[24]*o[25]*o[31] +
-        4.2002467698208e-6*o[24]*o[26]*o[31] - 5.5414715350778e-17*o[20]*o[30]
-        *o[31] + 9.436970724121e-7*o[11]*o[20]*o[24]*o[30]*o[31] +
-        23.895741934104*o[13]*o[32] + 0.040668253562649*o[2]*o[32] -
-        3.0629316876232e-13*o[26]*o[32] + 0.000026674547914087*o[1]*o[33] +
-        8.2311340897998*o[15]*o[33] + 1.2768608934681e-15*o[34]*o[35] +
-        0.33662250574171*o[37]*o[38] + 5.905956432427e-18*o[4] +
-        0.038946842435739*o[29]*o[4] - 4.88368302964335e-6*o[5] -
-        3.34901734177133e6/o[6] + 2.58538448402683e-9*o[6] + 82839.5726841115
-        *o[7] - 5446.7940672972*o[8] - 8.40318337484194e-13*o[9] +
-        0.0017731742473213*pi + 0.045996013696365*o[11]*pi +
-        0.057581259083432*o[12]*pi + 0.05032527872793*o[17]*pi + o[8]*pi*(
-        9.63082563787332 - 0.008917431146179*q1) + 0.00811842799898148*q1 +
-        0.000033032641670203*o[1]*q2 - 4.3870667284435e-7*o[2]*q2 +
-        8.0882908646985e-11*o[14]*o[20]*o[24]*o[25]*q2 + 5.9056029685639e-26*
-        o[14]*o[24]*o[28]*q2 + 7.8847309559367e-10*o[3]*q2 -
-        3.7826947613457e-6*o[14]*o[24]*o[31]*o[36]*q2 + 1.2621808899101e-6*o[
-        11]*o[20]*o[4]*q2 + 540.*o[8]*(10.08665568018 - 0.000033032641670203*
-        o[1] - 6.2245802776607e-15*o[10] - 0.015757110897342*o[1]*o[12] -
-        5.0144299353183e-11*o[11]*o[13] + 4.1627860840696e-19*o[12]*o[16] -
-        0.306581069554011*o[1]*o[17] + 9.0049690883672e-11*o[15]*o[18] +
-        0.0000160454534363627*o[17]*o[19] + 4.3870667284435e-7*o[2] -
-        0.00009683303171571*o[11]*o[2] + 2.57526266427144e-7*o[14]*o[20]*o[22]
-         - 1.40254511313154e-8*o[16]*o[23] - 2.34560435076256e-9*o[14]*o[20]*
-        o[24]*o[25] - 1.24017662339842e-24*o[27]*o[28] - 7.8847309559367e-10*
-        o[3] + 1.44676118155521e-6*o[11]*o[3] + 1.90027787547159e-27*o[29]*o[
-        30] - 0.000960283724907132*o[1]*o[32] - 296.320827232793*o[15]*o[32]
-         - 4.97975748452559e-14*o[11]*o[14]*o[31]*o[34] +
-        2.21658861403112e-15*o[30]*o[35] + 0.000200482822351322*o[14]*o[24]*o[
-        31]*o[36] - 19.1874828272775*o[20]*o[24]*o[31]*o[37] -
-        0.0000547344301999018*o[30]*o[38] - 0.0090203547252888*o[2]*o[39] -
-        0.0000138839897890111*o[21]*o[4] - 0.973671060893475*o[20]*o[24]*o[4]
-         - 836.35096769364*o[13]*o[40] - 1.42338887469272*o[2]*o[40] +
-        1.07202609066812e-11*o[26]*o[40] + 0.0000150341259240398*o[5] -
-        1.8087714924605e-8*o[6] + 18605.6518987296*o[7] - 306.813232163376*o[
-        8] + 1.43632471334824e-11*o[9] + 1.13103675106207e-18*o[5]*o[9] -
-        0.017834862292358*pi - 0.172743777250296*o[11]*pi - 0.30195167236758*
-        o[39]*pi + o[8]*pi*(-49.6756947920742 + 0.045996013696365*q1) -
-        0.0003789797503263*o[1]*q2 - 0.033874355714168*o[11]*o[13]*o[14]*o[20]
-        *q2 - 1.0234747095929e-12*o[16]*o[20]*q2 + 1.78371690710842e-23*o[11]
-        *o[24]*o[26]*q2 + 2.558143570457e-8*o[3]*q2 + 5.3465159397045*o[24]*o[
-        25]*o[31]*q2 - 0.000201611844951398*o[11]*o[14]*o[20]*o[26]*o[31]*q2)
-         - Modelica.Math.log(pi));
-    end slowerofp2;
-
-    function supperofp2
-      "explicit upper specific entropy limit of region 2 as function of pressure"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output Modelica.SIunits.SpecificEntropy s "specific entropy";
-    protected
-      Real pi "dimensionless pressure";
-      Real[2] o "vector of auxiliary variables";
-    algorithm
-      pi := p/data.PSTAR2;
-      assert(p > triple.ptriple,
-        "IF97 medium function supperofp2 called with too low pressure\n" +
-        "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
-      o[1] := pi*pi;
-      o[2] := o[1]*o[1]*o[1];
-      s := 8505.73409708683 - 461.526*Modelica.Math.log(pi) + pi*(-3.36563543302584
-         + pi*(-0.00790283552165338 + pi*(0.0000915558349202221 + pi*(-1.59634706513e-7
-         + pi*(3.93449217595397e-18 + pi*(-1.18367426347994e-13 + pi*(
-        2.72575244843195e-15 + pi*(7.04803892603536e-26 + pi*(
-        6.67637687381772e-35 + pi*(3.1377970315132e-24 + (-7.04844558482265e-77
-         + o[1]*(-7.46289531275314e-137 + (1.55998511254305e-68 + pi*(-3.46166288915497e-72
-         + pi*(7.51557618628583e-132 + (-1.64086406733212e-106 +
-        1.75648443097063e-87*pi)*pi)))*o[1]))*o[2]*o[2]))))))))));
-    end supperofp2;
-
-    function d1n "density in region 1 as function of p and T"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      output Modelica.SIunits.Density d "density";
-    protected
-      Real pi "dimensionless pressure";
-      Real pi1 "dimensionless pressure";
-      Real tau "dimensionless temperature";
-      Real tau1 "dimensionless temperature";
-      Real gpi "dimensionless Gibbs-derivative w.r.t. pi";
-      Real[11] o "auxiliary variables";
-    algorithm
-      pi := p/data.PSTAR1;
-      tau := data.TSTAR1/T;
-      pi1 := 7.1 - pi;
-      tau1 := tau - 1.222;
-      o[1] := tau1*tau1;
-      o[2] := o[1]*o[1];
-      o[3] := o[2]*o[2];
-      o[4] := o[1]*o[2];
-      o[5] := o[1]*tau1;
-      o[6] := o[2]*tau1;
-      o[7] := pi1*pi1;
-      o[8] := o[7]*o[7];
-      o[9] := o[8]*o[8];
-      o[10] := o[3]*o[3];
-      o[11] := o[10]*o[10];
-      gpi := pi1*(pi1*((0.000095038934535162 + o[2]*(8.4812393955936e-6 +
-        2.55615384360309e-9*o[4]))/o[2] + pi1*((8.9701127632e-6 + (
-        2.60684891582404e-6 + 5.7366919751696e-13*o[2]*o[3])*o[5])/o[6] + pi1
-        *(2.02584984300585e-6/o[3] + o[7]*pi1*(o[8]*o[9]*pi1*(o[7]*(o[7]*o[8]
-        *(-7.63737668221055e-22/(o[1]*o[11]*o[2]) + pi1*(pi1*(-5.65070932023524e-23
-        /(o[11]*o[3]) + (2.99318679335866e-24*pi1)/(o[11]*o[3]*tau1)) +
-        3.5842867920213e-22/(o[1]*o[11]*o[2]*tau1))) - 3.33001080055983e-19/(
-        o[1]*o[10]*o[2]*o[3]*tau1)) + 1.44400475720615e-17/(o[10]*o[2]*o[3]*
-        tau1)) + (1.01874413933128e-8 + 1.39398969845072e-9*o[6])/(o[1]*o[3]*
-        tau1))))) + (0.00094368642146534 + o[5]*(0.00060003561586052 + (-0.000095322787813974
-         + o[1]*(8.8283690661692e-6 + 1.45389992595188e-15*o[1]*o[2]*o[3]))*
-        tau1))/o[5]) + (-0.00028319080123804 + o[1]*(0.00060706301565874 + o[
-        4]*(0.018990068218419 + tau1*(0.032529748770505 + (0.021841717175414
-         + 0.00005283835796993*o[1])*tau1))))/(o[3]*tau1);
-      d := p/(data.RH2O*T*pi*gpi);
-    end d1n;
-
-    function d2n "density in region 2  as function of p and T"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      output Modelica.SIunits.Density d "density";
-    protected
-      Real pi "dimensionless pressure";
-      Real tau "dimensionless temperature";
-      Real tau2 "dimensionless temperature";
-      Real gpi "dimensionless Gibbs-derivative w.r.t. pi";
-      Real[12] o "auxiliary variables";
-    algorithm
-      pi := p/data.PSTAR2;
-      tau := data.TSTAR2/T;
-      tau2 := tau - 0.5;
-      o[1] := tau2*tau2;
-      o[2] := o[1]*tau2;
-      o[3] := o[1]*o[1];
-      o[4] := o[3]*o[3];
-      o[5] := o[4]*o[4];
-      o[6] := o[3]*o[4]*o[5]*tau2;
-      o[7] := o[3]*o[4]*tau2;
-      o[8] := o[1]*o[3]*o[4];
-      o[9] := pi*pi;
-      o[10] := o[9]*o[9];
-      o[11] := o[3]*o[5]*tau2;
-      o[12] := o[5]*o[5];
-      gpi := (1. + pi*(-0.0017731742473213 + tau2*(-0.017834862292358 + tau2*
-        (-0.045996013696365 + (-0.057581259083432 - 0.05032527872793*o[2])*
-        tau2)) + pi*(tau2*(-0.000066065283340406 + (-0.0003789797503263 + o[1]
-        *(-0.007878555448671 + o[2]*(-0.087594591301146 -
-        0.000053349095828174*o[6])))*tau2) + pi*(6.1445213076927e-8 + (
-        1.31612001853305e-6 + o[1]*(-0.00009683303171571 + o[2]*(-0.0045101773626444
-         - 0.122004760687947*o[6])))*tau2 + pi*(tau2*(-3.15389238237468e-9 +
-        (5.116287140914e-8 + 1.92901490874028e-6*tau2)*tau2) + pi*(
-        0.0000114610381688305*o[1]*o[3]*tau2 + pi*(o[2]*(-1.00288598706366e-10
-         + o[7]*(-0.012702883392813 - 143.374451604624*o[1]*o[5]*tau2)) + pi*
-        (-4.1341695026989e-17 + o[1]*o[4]*(-8.8352662293707e-6 -
-        0.272627897050173*o[8])*tau2 + pi*(o[4]*(9.0049690883672e-11 -
-        65.8490727183984*o[3]*o[4]*o[5]) + pi*(1.78287415218792e-7*o[7] + pi*
-        (o[3]*(1.0406965210174e-18 + o[1]*(-1.0234747095929e-12 -
-        1.0018179379511e-8*o[3])*o[3]) + o[10]*o[9]*((-1.29412653835176e-9 +
-        1.71088510070544*o[11])*o[6] + o[9]*(-6.05920510335078*o[12]*o[4]*o[5]
-        *tau2 + o[9]*(o[3]*o[5]*(1.78371690710842e-23 + o[1]*o[3]*o[4]*(
-        6.1258633752464e-12 - 0.000084004935396416*o[7])*tau2) + pi*(-1.24017662339842e-24
-        *o[11] + pi*(0.0000832192847496054*o[12]*o[3]*o[5]*tau2 + pi*(o[1]*o[
-        4]*o[5]*(1.75410265428146e-27 + (1.32995316841867e-15 -
-        0.0000226487297378904*o[1]*o[5])*o[8])*pi - 2.93678005497663e-14*o[1]
-        *o[12]*o[3]*tau2)))))))))))))))))/pi;
-      d := p/(data.RH2O*T*pi*gpi);
-    end d2n;
-
-    function dhot1ofp "density at upper temperature limit of region 1"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output Modelica.SIunits.Density d "density";
-    protected
-      Real pi "dimensionless pressure";
-      Real pi1 "dimensionless pressure";
-      Real[4] o "auxiliary variables";
-    algorithm
-      pi := p/data.PSTAR1;
-      pi1 := 7.1 - pi;
-      o[1] := pi1*pi1;
-      o[2] := o[1]*o[1];
-      o[3] := o[2]*o[2];
-      o[4] := o[3]*o[3];
-      d := 57.4756752485113/(0.0737412153522555 + 0.000102697173772229*o[1]
-         + 1.99080616601101e-6*o[2] + 1.35549330686006e-17*o[2]*o[4] -
-        3.11228834832975e-19*o[1]*o[2]*o[4] - 7.02987180039442e-22*o[2]*o[3]*
-        o[4] - 5.17859076694812e-23*o[1]*o[2]*o[3]*o[4] + 0.00145092247736023
-        *pi1 + 0.0000114683182476084*o[1]*pi1 + 1.13217858826367e-8*o[1]*o[2]
-        *pi1 + 3.29199117056433e-22*o[2]*o[3]*o[4]*pi1 + 2.73712834080283e-24
-        *o[1]*o[2]*o[3]*o[4]*pi1);
-    end dhot1ofp;
-
-    function dupper1ofT "density at upper pressure limit of region 1"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      output Modelica.SIunits.Density d "density";
-    protected
-      Real tau "dimensionless temperature";
-      Real[4] o "auxiliary variables";
-    algorithm
-      tau := 1386.0/T;
-      o[1] := tau*tau;
-      o[2] := o[1]*o[1];
-      o[3] := o[2]*o[2];
-      o[4] := o[3]*o[3];
-      d := 57.4756752485113/(2.24144616859917 + 40.9288231166229*o[1] +
-        106.47246463213*o[2] + 88.4481480270751*o[1]*o[2] + 31.3207272417546*
-        o[3] + 5.47811738891798*o[1]*o[3] + 0.515626225030717*o[2]*o[3] +
-        0.0274905057899089*o[1]*o[2]*o[3] + 0.000853742979250503*o[4] +
-        0.0000155932210492199*o[1]*o[4] + 1.6621051480279e-7*o[2]*o[4] +
-        1.00606771839976e-9*o[1]*o[2]*o[4] + 3.27598951831994e-12*o[3]*o[4]
-         + 5.20162317530099e-15*o[1]*o[3]*o[4] + 3.33501889800275e-18*o[2]*o[
-        3]*o[4] + 5.50656040141221e-22*o[1]*o[2]*o[3]*o[4] - 13.5354267762204
-        *tau - 78.3629702507642*o[1]*tau - 109.374479648652*o[2]*tau -
-        57.9035658513312*o[1]*o[2]*tau - 14.215347150565*o[3]*tau -
-        1.80906759985501*o[1]*o[3]*tau - 0.127542214693871*o[2]*o[3]*tau -
-        0.0051779458313163*o[1]*o[2]*o[3]*tau - 0.000123304142684848*o[4]*tau
-         - 1.72405791469972e-6*o[1]*o[4]*tau - 1.39155695911655e-8*o[2]*o[4]*
-        tau - 6.23333356847138e-11*o[1]*o[2]*o[4]*tau - 1.44056015732082e-13*
-        o[3]*o[4]*tau - 1.50201626932938e-16*o[1]*o[3]*o[4]*tau -
-        5.34588682252967e-20*o[2]*o[3]*o[4]*tau - 2.73712834080283e-24*o[1]*o[
-        2]*o[3]*o[4]*tau);
-    end dupper1ofT;
-
-    function hl_p_R4b
-      "explicit approximation of liquid specific enthalpy on the boundary between regions 4 and 3"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    protected
-      Real x "auxiliary variable";
-    algorithm
-        // documentation of accuray in notebook ~hubertus/props/IAPWS/R3Approx.nb
-      // boundary between region IVa and III
-      x := Modelica.Math.acos(p/data.PCRIT);
-      h := (1 + x*(-0.4945586958175176 + x*(1.346800016564904 + x*(-3.889388153209752
-         + x*(6.679385472887931 + x*(-6.75820241066552 + x*(3.558919744656498
-         + (-0.7179818554978939 - 0.0001152032945617821*x)*x)))))))*data.
-        HCRIT;
-      annotation(smoothOrder=5);
-    end hl_p_R4b;
-
-    function hv_p_R4b
-      "explicit approximation of vapour specific enthalpy on the boundary between regions 4 and 3"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    protected
-      Real x "auxiliary variable";
-    algorithm
-      // boundary between region IVa and III
-      x := Modelica.Math.acos(p/data.PCRIT);
-      h := (1 + x*(0.4880153718655694 + x*(0.2079670746250689 + x*(-6.084122698421623
-         + x*(25.08887602293532 + x*(-48.38215180269516 + x*(
-        45.66489164833212 + (-16.98555442961553 + 0.0006616936460057691*x)*x)))))))
-        *data.HCRIT;
-      annotation(smoothOrder=5);
-    end hv_p_R4b;
-
-    function sl_p_R4b
-      "explicit approximation of liquid specific entropy on the boundary between regions 4 and 3"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output Modelica.SIunits.SpecificEntropy s "specific entropy";
-    protected
-      Real x "auxiliary variable";
-    algorithm
-      // boundary between region IVa and III
-      x := Modelica.Math.acos(p/data.PCRIT);
-      s := (1 + x*(-0.36160692245648063 + x*(0.9962778630486647 + x*(-2.8595548144171103
-         + x*(4.906301159555333 + x*(-4.974092309614206 + x*(
-        2.6249651699204457 + (-0.5319954375299023 - 0.00008064497431880644*x)
-        *x)))))))*data.SCRIT;
-      annotation(smoothOrder=5);
-    end sl_p_R4b;
-
-    function sv_p_R4b
-      "explicit approximation of vapour specific entropy on the boundary between regions 4 and 3"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output Modelica.SIunits.SpecificEntropy s;
-    protected
-      Real x "auxiliary variable";
-    algorithm
-        // documentation of accuray in notebook ~hubertus/props/IAPWS/R3Approx.nb
-      // boundary between region IVa and III
-      x := Modelica.Math.acos(p/data.PCRIT);
-      s := (1 + x*(0.35682641826674344 + x*(0.1642457027815487 + x*(-4.425350377422446
-         + x*(18.324477859983133 + x*(-35.338631625948665 + x*(
-        33.36181025816282 + (-12.408711490585757 + 0.0004810049834109226*x)*x)))))))
-        *data.SCRIT;
-      annotation(smoothOrder=5);
-    end sv_p_R4b;
-
-    function rhol_p_R4b
-      "explicit approximation of liquid density on the boundary between regions 4 and 3"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output Modelica.SIunits.Density dl "liquid density";
-    protected
-      Real x "auxiliary variable";
-    algorithm
-      if (p < data.PCRIT) then
-        x := Modelica.Math.acos(p/data.PCRIT);
-        dl := (1 + x*(1.903224079094824 + x*(-2.5314861802401123 + x*(-8.191449323843552
-           + x*(94.34196116778385 + x*(-369.3676833623383 + x*(
-          796.6627910598293 + x*(-994.5385383600702 + x*(673.2581177021598 +
-          (-191.43077336405156 + 0.00052536560808895*x)*x)))))))))*data.DCRIT;
-      else
-        dl := data.DCRIT;
-      end if;
-      annotation(smoothOrder=5);
-    end rhol_p_R4b;
-
-    function rhov_p_R4b
-      "explicit approximation of vapour density on the boundary between regions 4 and 2"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output Modelica.SIunits.Density dv "vapour density";
-    protected
-      Real x "auxiliary variable";
-    algorithm
-      if (p < data.PCRIT) then
-        x := Modelica.Math.acos(p/data.PCRIT);
-        dv := (1 + x*(-1.8463850803362596 + x*(-1.1447872718878493 + x*(
-          59.18702203076563 + x*(-403.5391431811611 + x*(1437.2007245332388
-           + x*(-3015.853540307519 + x*(3740.5790348670057 + x*(-2537.375817253895
-           + (725.8761975803782 - 0.0011151111658332337*x)*x)))))))))*data.
-          DCRIT;
-      else
-        dv := data.DCRIT;
-      end if;
-      annotation(smoothOrder=5);
-    end rhov_p_R4b;
-
-    function boilingcurve_p "properties on the boiling curve"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output
-        ThermoSysPro.Properties.WaterSteam.Common.IF97PhaseBoundaryProperties
-                                                bpro "property record";
-    protected
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs
-                         g "dimensionless Gibbs funcion and dervatives";
-      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs
-                             f
-        "dimensionless Helmholtz function and dervatives";
-      Modelica.SIunits.Pressure plim=min(p, data.PCRIT - 1e-7)
-        "pressure limited to critical pressure - epsilon";
-      Boolean region3boundary "true if boundary between 2-phase and region 3";
-      Real pv "partial derivative of p w.r.t v";
-    algorithm
-      bpro.R := data.RH2O;
-      bpro.T := Basic.tsat(plim);
-      bpro.dpT := Basic.dptofT(bpro.T);
-      region3boundary := bpro.T > data.TLIMIT1;
-      if not region3boundary then
-        g := Basic.g1(p, bpro.T);
-        bpro.d := p/(bpro.R*bpro.T*g.pi*g.gpi);
-        bpro.h := if p > plim then data.HCRIT else bpro.R*bpro.T*g.tau*g.gtau;
-        bpro.s := g.R*(g.tau*g.gtau - g.g);
-        bpro.cp := -bpro.R*g.tau*g.tau*g.gtautau;
-        bpro.vt := bpro.R/p*(g.pi*g.gpi - g.tau*g.pi*g.gtaupi);
-        bpro.vp := bpro.R*bpro.T/(p*p)*g.pi*g.pi*g.gpipi;
-        bpro.pt := -p/bpro.T*(g.gpi - g.tau*g.gtaupi)/(g.gpipi*g.pi);
-        bpro.pd := -bpro.R*bpro.T*g.gpi*g.gpi/(g.gpipi);
-      else
-        bpro.d := rhol_p_R4b(plim);
-        f := Basic.f3(bpro.d, bpro.T);
-        bpro.h := hl_p_R4b(plim);
-        // bpro.R*bpro.T*(f.tau*f.ftau + f.delta*f.fdelta);
-        bpro.s := f.R*(f.tau*f.ftau - f.f);
-        bpro.cv := bpro.R*(-f.tau*f.tau*f.ftautau);
-        bpro.pt := bpro.R*bpro.d*f.delta*(f.fdelta - f.tau*f.fdeltatau);
-        bpro.pd := bpro.R*bpro.T*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta);
-        pv := (-f.d*f.d*bpro.pd);
-        bpro.vp := 1/pv;
-        bpro.vt := -bpro.pt/pv;
-      end if;
-    end boilingcurve_p;
-
-    function dewcurve_p "properties on the dew curve"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output
-        ThermoSysPro.Properties.WaterSteam.Common.IF97PhaseBoundaryProperties
-                                                bpro "property record";
-    protected
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs
-                         g "dimensionless Gibbs funcion and dervatives";
-      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs
-                             f
-        "dimensionless Helmholtz function and dervatives";
-      Modelica.SIunits.Pressure plim=min(p, data.PCRIT - 1e-7)
-        "pressure limited to critical pressure - epsilon";
-      Boolean region3boundary "true if boundary between 2-phase and region 3";
-      Real pv "partial derivative of p w.r.t v";
-    algorithm
-      bpro.R := data.RH2O;
-      bpro.T := Basic.tsat(plim);
-      bpro.dpT := Basic.dptofT(bpro.T);
-      region3boundary := bpro.T > data.TLIMIT1;
-      if not region3boundary then
-        g := Basic.g2(p, bpro.T);
-        bpro.d := p/(bpro.R*bpro.T*g.pi*g.gpi);
-        bpro.h := if p > plim then data.HCRIT else bpro.R*bpro.T*g.tau*g.gtau;
-        bpro.s := g.R*(g.tau*g.gtau - g.g);
-        bpro.cp := -bpro.R*g.tau*g.tau*g.gtautau;
-        bpro.vt := bpro.R/p*(g.pi*g.gpi - g.tau*g.pi*g.gtaupi);
-        bpro.vp := bpro.R*bpro.T/(p*p)*g.pi*g.pi*g.gpipi;
-        bpro.pt := -p/bpro.T*(g.gpi - g.tau*g.gtaupi)/(g.gpipi*g.pi);
-        bpro.pd := -bpro.R*bpro.T*g.gpi*g.gpi/(g.gpipi);
-      else
-        bpro.d := rhov_p_R4b(plim);
-        f := Basic.f3(bpro.d, bpro.T);
-        bpro.h := hv_p_R4b(plim);
-        // bpro.R*bpro.T*(f.tau*f.ftau + f.delta*f.fdelta);
-        bpro.s := f.R*(f.tau*f.ftau - f.f);
-        bpro.cv := bpro.R*(-f.tau*f.tau*f.ftautau);
-        bpro.pt := bpro.R*bpro.d*f.delta*(f.fdelta - f.tau*f.fdeltatau);
-        bpro.pd := bpro.R*bpro.T*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta);
-        pv := (-f.d*f.d*bpro.pd);
-        bpro.vp := 1/pv;
-        bpro.vt := -bpro.pt/pv;
-      end if;
-    end dewcurve_p;
-
-    function hvl_p
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input
-        ThermoSysPro.Properties.WaterSteam.Common.IF97PhaseBoundaryProperties
-                                               bpro "property record";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    algorithm
-      h := bpro.h;
-      annotation (
-        derivative(noDerivative=bpro) = hvl_p_der,
-        Inline=false,
-        LateInline=true);
-    end hvl_p;
-
-    function hl_p
-      "liquid specific enthalpy on the boundary between regions 4 and 3 or 1"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    algorithm
-      h := hvl_p(p, boilingcurve_p(p));
-    end hl_p;
-
-    function hv_p
-      "vapour specific enthalpy on the boundary between regions 4 and 3 or 2"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    algorithm
-      h := hvl_p(p, dewcurve_p(p));
-    end hv_p;
-
-    function hvl_p_der
-      "derivative function for the specific enthalpy along the phase boundary"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input
-        ThermoSysPro.Properties.WaterSteam.Common.IF97PhaseBoundaryProperties
-                                               bpro "property record";
-      input Real p_der "derivative of pressure";
-      output Real h_der
-        "time derivative of specific enthalpy along the phase boundary";
-    algorithm
-      h_der := (1/bpro.d - bpro.T*bpro.vt)*p_der + bpro.cp/bpro.dpT*p_der;
-    end hvl_p_der;
-
-    function rhovl_p
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input
-        ThermoSysPro.Properties.WaterSteam.Common.IF97PhaseBoundaryProperties
-                                               bpro "property record";
-      output Modelica.SIunits.Density rho "density";
-    algorithm
-      rho := bpro.d;
-      annotation (
-        derivative(noDerivative=bpro) = rhovl_p_der,
-        Inline=false,
-        LateInline=true);
-    end rhovl_p;
-
-    function rhol_p "density of saturated water"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "saturation pressure";
-      output Modelica.SIunits.Density rho
-        "density of steam at the condensation point";
-    algorithm
-      rho := rhovl_p(p, boilingcurve_p(p));
-    end rhol_p;
-
-    function rhov_p "density of saturated vapour"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "saturation pressure";
-      output Modelica.SIunits.Density rho
-        "density of steam at the condensation point";
-    algorithm
-      rho := rhovl_p(p, dewcurve_p(p));
-    end rhov_p;
-
-    function rhovl_p_der
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "saturation pressure";
-      input
-        ThermoSysPro.Properties.WaterSteam.Common.IF97PhaseBoundaryProperties
-                                               bpro "property record";
-      input Real p_der "derivative of pressure";
-      output Real d_der "time derivative of density along the phase boundary";
-    algorithm
-      d_der := -bpro.d*bpro.d*(bpro.vp + bpro.vt/bpro.dpT)*p_der;
-    end rhovl_p_der;
-
-    function sl_p
-      "liquid specific entropy on the boundary between regions 4 and 3 or 1"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output Modelica.SIunits.SpecificEntropy s "specific entropy";
-    protected
-      Modelica.SIunits.Temperature Tsat "saturation temperature";
-      Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    algorithm
-      if (p < data.PLIMIT4A) then
-        Tsat := Basic.tsat(p);
-        (h,s) := Isentropic.handsofpT1(p, Tsat);
-      elseif (p < data.PCRIT) then
-        s := sl_p_R4b(p);
-      else
-        s := data.SCRIT;
-      end if;
-    end sl_p;
-
-    function sv_p
-      "vapour specific entropy on the boundary between regions 4 and 3 or 2"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output Modelica.SIunits.SpecificEntropy s "specific entropy";
-    protected
-      Modelica.SIunits.Temperature Tsat "saturation temperature";
-      Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    algorithm
-      if (p < data.PLIMIT4A) then
-        Tsat := Basic.tsat(p);
-        (h,s) := Isentropic.handsofpT2(p, Tsat);
-      elseif (p < data.PCRIT) then
-        s := sv_p_R4b(p);
-      else
-        s := data.SCRIT;
-      end if;
-    end sv_p;
-
-    function rhol_T "density of saturated water"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Temperature T "temperature";
-      output Modelica.SIunits.Density d "density of water at the boiling point";
-    protected
-      Modelica.SIunits.Pressure p "saturation pressure";
-    algorithm
-      p := Basic.psat(T);
-      if T < data.TLIMIT1 then
-        d := d1n(p, T);
-      elseif T < data.TCRIT then
-        d := rhol_p_R4b(p);
-      else
-        d := data.DCRIT;
-      end if;
-    end rhol_T;
-
-    function rhov_T "density of saturated vapour"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Temperature T "temperature";
-      output Modelica.SIunits.Density d
-        "density of steam at the condensation point";
-    protected
-      Modelica.SIunits.Pressure p "saturation pressure";
-    algorithm
-
-        // assert(T <= data.TCRIT,"input temperature has to be below the critical temperature");
-      p := Basic.psat(T);
-      if T < data.TLIMIT1 then
-        d := d2n(p, T);
-      elseif T < data.TCRIT then
-        d := rhov_p_R4b(p);
-      else
-        d := data.DCRIT;
-      end if;
-    end rhov_T;
-
-    function region_ph
-      "return the current region (valid values: 1,2,3,4,5) in IF97 for given pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-     input Modelica.SIunits.Pressure p "pressure";
-     input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-     input Integer phase=0
-        "phase: 2 for two-phase, 1 for one phase, 0 if not known";
-     input Integer mode=0 "mode: 0 means check, otherwise assume region=mode";
-      output Integer region "region (valid values: 1,2,3,4,5) in IF97";
-      // If mode is different from 0, no checking for the region is done and
-      // the mode is assumed to be the correct region. This can be used to
-      // implement e.g. water-only steamtables when mode == 1
-    protected
-      Boolean hsubcrit;
-      Modelica.SIunits.Temperature Ttest;
-      constant Real[5] n=data.n;
-      Modelica.SIunits.SpecificEnthalpy hl "bubble enthalpy";
-      Modelica.SIunits.SpecificEnthalpy hv "dew enthalpy";
-    algorithm
-      if (mode <> 0) then
-        region := mode;
-      else
-        // check for regions 1, 2, 3 and 4
-        hl := hl_p(p);
-        hv := hv_p(p);
-        if (phase == 2) then
-          region := 4;
-        else
-          // phase == 1 or 0, now check if we are in the legal area
-          if
-            (p < triple.ptriple) or (p > data.PLIMIT1) or (h < hlowerofp1(p)) or
-            ((p < 10.0e6) and (h > hupperofp5(p)))
-            or ((p >= 10.0e6) and (h > hupperofp2(p))) then
-            // outside of valid range
-            region := -1;
-          else
-            //region 5 and -1 check complete
-            hsubcrit := (h < data.HCRIT);
-            // simple precheck: very simple if pressure < PLIMIT4A
-            if (p < data.PLIMIT4A) then
-              // we can never be in region 3, so test for others
-              if hsubcrit then
-                if (phase == 1) then
-                  region := 1;
-                else
-                  if (h < Isentropic.hofpT1(p,Basic.tsat(p))) then
-                    region := 1;
-                  else
-                    region := 4;
-                  end if;
-                end if;
-                // external or internal phase check
-              else
-                if (h > hlowerofp5(p)) then
-                  // check for region 5
-                  if ((p < data.PLIMIT5) and (h < hupperofp5(p))) then
-                    region := 5;
-                  else
-                    region := -2;
-                    // pressure and specific enthalpy too high, but this should
-                  end if;
-                  // never happen
-                else
-                  if (phase == 1) then
-                    region := 2;
-                  else
-                    if (h > Isentropic.hofpT2(p,Basic.tsat(p))) then
-                      region := 2;
-                    else
-                      region := 4;
-                    end if;
-                  end if;  // external or internal phase check
-                end if;
-                // tests for region 2 or 5
-              end if;
-              // tests for sub or supercritical
-            else
-              // the pressure is over data.PLIMIT4A
-              if hsubcrit then
-                // region 1 or 3 or 4
-                if h < hupperofp1(p) then
-                  region := 1;
-                else
-                  if h < hl  or p > data.PCRIT then
-                    region := 3;
-                  else
-                    region :=4;
-                  end if;
-                end if;
-                // enf of test for region 1, 3 or 4
-              else
-                // region 2, 3 or 4
-                if (h > hlowerofp2(p)) then
-                  region := 2;
-                else
-                  if h > hv  or p > data.PCRIT then
-                    region := 3;
-                  else
-                    region := 4;
-                  end if;
-                end if;
-                // test for 2 and 3
-              end if;
-              // tests above PLIMIT4A
-            end if;
-            // above or below PLIMIT4A
-          end if;
-          // check for grand limits of p and h
-        end if;
-        // all tests with phase == 1
-      end if;
-      // mode was == 0
-      // assert(region > 0,"IF97 function called outside the valid range!");
-    end region_ph;
-
-    function region_ps
-      "return the current region (valid values: 1,2,3,4,5) in IF97 for given pressure and specific entropy"
-      extends Modelica.Icons.Function;
-     input Modelica.SIunits.Pressure p "pressure";
-     input Modelica.SIunits.SpecificEntropy s "specific entropy";
-     input Integer phase=
-                    0 "phase: 2 for two-phase, 1 for one phase, 0 if unknown";
-     input Integer mode=
-                   0 "mode: 0 means check, otherwise assume region=mode";
-      output Integer region "region (valid values: 1,2,3,4,5) in IF97";
-      //  If mode is different from 0, no checking for the region is done and
-      //    the mode is assumed to be the correct region. This can be used to
-      //    implement e.g. water-only steamtables when mode == 1
-    protected
-      Boolean ssubcrit;
-      Modelica.SIunits.Temperature Ttest;
-      constant Real[5] n=data.n;
-      Modelica.SIunits.SpecificEntropy sl "bubble entropy";
-      Modelica.SIunits.SpecificEntropy sv "dew entropy";
-    algorithm
-      if (mode <> 0) then
-        region := mode;
-      else
-        // check for regions 1, 2, 3, and 4
-        sl := sl_p(p);
-        sv := sv_p(p);
-        // check all cases two-phase
-        if (phase == 2) or (phase == 0 and s > sl and s < sv and p < data.PCRIT) then
-          region := 4;
-        else
-          // phase == 1
-          region := 0;
-          if (p < triple.ptriple) then
-            region := -2;
-          end if;
-          if (p > data.PLIMIT1) then
-            region := -3;
-          end if;
-          if ((p < 10.0e6) and (s > supperofp5(p))) then
-            region := -5;
-          end if;
-          if ((p >= 10.0e6) and (s > supperofp2(p))) then
-            region := -6;
-          end if;
-          if region < 0 then
-            assert(false, "region computation from p and s failed: function called outside the legal region");
-          else
-            ssubcrit := (s < data.SCRIT);
-            // simple precheck: very simple if pressure < PLIMIT4A
-            if (p < data.PLIMIT4A) then
-              // we can never be in region 3, so test for 1 and 2
-              if ssubcrit then
-                region := 1;
-              else
-                if (s > slowerofp5(p)) then
-                  // check for region 5
-                  if ((p < data.PLIMIT5) and (s < supperofp5(p))) then
-                    region := 5;
-                  else
-                    region := -1;
-                    // pressure and specific entropy too high, should never happen!
-                  end if;
-                else
-                  region := 2;
-                end if;
-                // tests for region 2 or 5
-              end if;
-              // tests for sub or supercritical
-            else
-              // the pressure is over data.PLIMIT4A
-              if ssubcrit then
-                // region 1 or 3
-                if s < supperofp1(p) then
-                  region := 1;
-                else
-                  if s < sl  or p > data.PCRIT then
-                    region := 3;
-                  else
-                    region := 4;
-                  end if;
-                end if;
-                // test for region 1, 3 or 4
-              else
-                // region 2, 3 or 4
-                if (s > slowerofp2(p)) then
-                  region := 2;
-                else
-                  if s > sv  or p > data.PCRIT then
-                    region := 3;
-                  else
-                    region := 4;
-                  end if;
-                end if;
-                // test for 2,3 and 4
-              end if;
-              // tests above PLIMIT4A
-            end if;
-            // above or below PLIMIT4A
-          end if;
-          // grand test for limits of p and s
-        end if;
-        // all tests with phase == 1
-      end if;
-      // mode was == 0
-    end region_ps;
-
-    function region_pT
-      "return the current region (valid values: 1,2,3,5) in IF97, given pressure and temperature"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      input Integer mode=0 "mode: 0 means check, otherwise assume region=mode";
-      output Integer region
-        "region (valid values: 1,2,3,5) in IF97, region 4 is impossible!";
-    algorithm
-      if (mode <> 0) then
-        region := mode;
-      else
-        if p < data.PLIMIT4A then
-          //test for regions 1,2,5
-          if T > data.TLIMIT2 then
-            region := 5;
-          elseif T > Basic.tsat(p) then
-            region := 2;
-          else
-            region := 1;
-          end if;
-        else
-          //test for regions 1,2,3
-          if T < data.TLIMIT1 then
-            region := 1;
-          elseif T < boundary23ofp(p) then
-            region := 3;
-          else
-            region := 2;
-          end if;
-        end if;
-      end if;
-      // mode was == 0
-    end region_pT;
-
-    function region_dT
-      "return the current region (valid values: 1,2,3,4,5) in IF97, given density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      input Integer phase= 0
-        "phase: 2 for two-phase, 1 for one phase, 0 if not known";
-      input Integer mode= 0 "mode: 0 means check, otherwise assume region=mode";
-      output Integer region "(valid values: 1,2,3,4,5) in IF97";
-    protected
-      Boolean Tovercrit "flag if overcritical temperature";
-      Modelica.SIunits.Pressure p23 "pressure needed to know if region 2 or 3";
-    algorithm
-      Tovercrit := T > data.TCRIT;
-      if (mode <> 0) then
-        region := mode;
-      else
-        p23 := boundary23ofT(T);
-        if T > data.TLIMIT2 then
-          if d < 20.5655874106483 then
-            // check for the density in the upper corner of validity!
-            region := 5;
-          else
-            assert(false,"out of valid region for IF97, pressure above region 5!");
-          end if;
-        elseif Tovercrit then
-          //check for regions 1, 2 or 3
-          if d > d2n(p23, T) and T > data.TLIMIT1 then
-            region := 3;
-          elseif T < data.TLIMIT1 then
-            region := 1;
-          else // d  < d2n(p23, T) and T > data.TLIMIT1
-            region := 2;
-          end if;
-          // below critical, check for regions 1, 2, 3 or 4
-        elseif (d > rhol_T(T)) then
-          // either 1 or 3
-          if T < data.TLIMIT1 then
-            region := 1;
-          else
-            region := 3;
-          end if;
-        elseif (d < rhov_T(T)) then
-          // not liquid, not 2-phase, and not region 5, so either 2 or 3 or illegal
-          if (d > d2n(p23, T) and T > data.TLIMIT1) then
-            region := 3;
-          else
-            region := 2;
-          end if;
-        else
-          region := 4;
-        end if;
-      end if;
-    end region_dT;
-
-    annotation (Documentation(info="<HTML><h4>Package description</h4>
+      "));
+  end triple;
+
+  package Regions "functions to find the current region for given pairs of input variables"
+    //===================================================================
+    //                      "Public" functions
+    //===================================================================
+
+    function boundary23ofT "boundary function for region boundary between regions 2 and 3 (input temperature)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Temperature t "temperature (K)";
+      output Modelica.Units.SI.Pressure p "pressure";
+    protected
+      constant Real[5] n = data.n;
+    algorithm
+      p := 1.0e6 * (n[1] + t * (n[2] + t * n[3]));
+    end boundary23ofT;
+
+    function boundary23ofp "boundary function for region boundary between regions 2 and 3 (input pressure)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output Modelica.Units.SI.Temperature t "temperature (K)";
+    protected
+      constant Real[5] n = data.n;
+      Real pi "dimensionless pressure";
+    algorithm
+      pi := p / 1.0e6;
+      assert(p > triple.ptriple, "IF97 medium function boundary23ofp called with too low pressure\n" + "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
+      t := n[4] + ((pi - n[5]) / n[3]) ^ 0.5;
+    end boundary23ofp;
+
+    function hlowerofp5 "explicit lower specific enthalpy limit of region 5 as function of pressure"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    protected
+      Real pi "dimensionless pressure";
+    algorithm
+      pi := p / data.PSTAR5;
+      assert(p > triple.ptriple, "IF97 medium function hlowerofp5 called with too low pressure\n" + "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
+      h := 461526. * (9.01505286876203 + pi * ((-0.00979043490246092) + ((-0.0000203245575263501) + 3.36540214679088e-7 * pi) * pi));
+    end hlowerofp5;
+
+    function hupperofp5 "explicit upper specific enthalpy limit of region 5 as function of pressure"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    protected
+      Real pi "dimensionless pressure";
+    algorithm
+      pi := p / data.PSTAR5;
+      assert(p > triple.ptriple, "IF97 medium function hupperofp5 called with too low pressure\n" + "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
+      h := 461526. * (15.9838891400332 + pi * ((-0.000489898813722568) + ((-5.01510211858761e-8) + 7.5006972718273e-8 * pi) * pi));
+    end hupperofp5;
+
+    function slowerofp5 "explicit lower specific entropy limit of region 5 as function of pressure"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output Modelica.Units.SI.SpecificEntropy s "specific entropy";
+    protected
+      Real pi "dimensionless pressure";
+    algorithm
+      pi := p / data.PSTAR5;
+      assert(p > triple.ptriple, "IF97 medium function slowerofp5 called with too low pressure\n" + "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
+      s := 461.526 * (18.4296209980112 + pi * ((-0.00730911805860036) + ((-0.0000168348072093888) + 2.09066899426354e-7 * pi) * pi) - Modelica.Math.log(pi));
+    end slowerofp5;
+
+    function supperofp5 "explicit upper specific entropy limit of region 5 as function of pressure"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output Modelica.Units.SI.SpecificEntropy s "specific entropy";
+    protected
+      Real pi "dimensionless pressure";
+    algorithm
+      pi := p / data.PSTAR5;
+      assert(p > triple.ptriple, "IF97 medium function supperofp5 called with too low pressure\n" + "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
+      s := 461.526 * (22.7281531474243 + pi * ((-0.000656650220627603) + ((-1.96109739782049e-8) + 2.19979537113031e-8 * pi) * pi) - Modelica.Math.log(pi));
+    end supperofp5;
+
+    function hlowerofp1 "explicit lower specific enthalpy limit of region 1 as function of pressure"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    protected
+      Real pi1 "dimensionless pressure";
+      Real[3] o "vector of auxiliary variables";
+    algorithm
+      pi1 := 7.1 - p / data.PSTAR1;
+      assert(p > triple.ptriple, "IF97 medium function hlowerofp1 called with too low pressure\n" + "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
+      o[1] := pi1 * pi1;
+      o[2] := o[1] * o[1];
+      o[3] := o[2] * o[2];
+      h := 639675.036 * (0.173379420894777 + pi1 * ((-0.022914084306349) + pi1 * ((-0.00017146768241932) + pi1 * ((-4.18695814670391e-6) + pi1 * ((-2.41630417490008e-7) + pi1 * (1.73545618580828e-11 + o[1] * pi1 * (8.43755552264362e-14 + o[2] * o[3] * pi1 * (5.35429206228374e-35 + o[1] * ((-8.12140581014818e-38) + o[1] * o[2] * ((-1.43870236842915e-44) + pi1 * (1.73894459122923e-45 + ((-7.06381628462585e-47) + 9.64504638626269e-49 * pi1) * pi1)))))))))));
+    end hlowerofp1;
+
+    function hupperofp1 "explicit upper specific enthalpy limit of region 1 as function of pressure (meets region 4 saturation pressure curve at 623.15 K)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    protected
+      Real pi1 "dimensionless pressure";
+      Real[3] o "vector of auxiliary variables";
+    algorithm
+      pi1 := 7.1 - p / data.PSTAR1;
+      assert(p > triple.ptriple, "IF97 medium function hupperofp1 called with too low pressure\n" + "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
+      o[1] := pi1 * pi1;
+      o[2] := o[1] * o[1];
+      o[3] := o[2] * o[2];
+      h := 639675.036 * (2.42896927729349 + pi1 * ((-0.00141131225285294) + pi1 * (0.00143759406818289 + pi1 * (0.000125338925082983 + pi1 * (0.0000123617764767172 + pi1 * (3.17834967400818e-6 + o[1] * pi1 * (1.46754947271665e-8 + o[2] * o[3] * pi1 * (1.86779322717506e-17 + o[1] * ((-4.18568363667416e-19) + o[1] * o[2] * ((-9.19148577641497e-22) + pi1 * (4.27026404402408e-22 + ((-6.66749357417962e-23) + 3.49930466305574e-24 * pi1) * pi1)))))))))));
+    end hupperofp1;
+
+    function slowerofp1 "explicit lower specific entropy limit of region 1 as function of pressure"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output Modelica.Units.SI.SpecificEntropy s "specific entropy";
+    protected
+      Real pi1 "dimensionless pressure";
+      Real[3] o "vector of auxiliary variables";
+    algorithm
+      pi1 := 7.1 - p / data.PSTAR1;
+      assert(p > triple.ptriple, "IF97 medium function slowerofp1 called with too low pressure\n" + "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
+      o[1] := pi1 * pi1;
+      o[2] := o[1] * o[1];
+      o[3] := o[2] * o[2];
+      s := 461.526 * ((-0.0268080988194267) + pi1 * (0.00834795890110168 + pi1 * ((-0.000486470924668433) + pi1 * ((-0.0000154902045012264) + pi1 * ((-1.07631751351358e-6) + pi1 * (9.64159058957115e-11 + o[1] * pi1 * (4.81921078863103e-13 + o[2] * o[3] * pi1 * (2.7879623870968e-34 + o[1] * ((-4.22182957646226e-37) + o[1] * o[2] * ((-7.44601427465175e-44) + pi1 * (8.99540001407168e-45 + ((-3.65230274480299e-46) + 4.98464639687285e-48 * pi1) * pi1)))))))))));
+    end slowerofp1;
+
+    function supperofp1 "explicit upper specific entropy limit of region 1 as function of pressure (meets region 4 saturation pressure curve at 623.15 K)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output Modelica.Units.SI.SpecificEntropy s "specific entropy";
+    protected
+      Real pi1 "dimensionless pressure";
+      Real[3] o "vector of auxiliary variables";
+    algorithm
+      pi1 := 7.1 - p / data.PSTAR1;
+      assert(p > triple.ptriple, "IF97 medium function supperofp1 called with too low pressure\n" + "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
+      o[1] := pi1 * pi1;
+      o[2] := o[1] * o[1];
+      o[3] := o[2] * o[2];
+      s := 461.526 * (7.28316418503422 + pi1 * (0.070602197808399 + pi1 * (0.0039229343647356 + pi1 * (0.000313009170788845 + pi1 * (0.0000303619398631619 + pi1 * (7.46739440045781e-6 + o[1] * pi1 * (3.40562176858676e-8 + o[2] * o[3] * pi1 * (4.21886233340801e-17 + o[1] * ((-9.44504571473549e-19) + o[1] * o[2] * ((-2.06859611434475e-21) + pi1 * (9.60758422254987e-22 + ((-1.49967810652241e-22) + 7.86863124555783e-24 * pi1) * pi1)))))))))));
+    end supperofp1;
+
+    function hlowerofp2 "explicit lower specific enthalpy limit of region 2 as function of pressure (meets region 4 saturation pressure curve at 623.15 K)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    protected
+      Real pi "dimensionless pressure";
+      Real q1 "auxiliary variable";
+      Real q2 "auxiliary variable";
+      Real[18] o "vector of auxiliary variables";
+    algorithm
+      pi := p / data.PSTAR2;
+      assert(p > triple.ptriple, "IF97 medium function hlowerofp2 called with too low pressure\n" + "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
+      q1 := 572.54459862746 + 31.3220101646784 * ((-13.91883977887) + pi) ^ 0.5;
+      q2 := (-0.5) + 540. / q1;
+      o[1] := q1 * q1;
+      o[2] := o[1] * o[1];
+      o[3] := o[2] * o[2];
+      o[4] := pi * pi;
+      o[5] := o[4] * o[4];
+      o[6] := q2 * q2;
+      o[7] := o[6] * o[6];
+      o[8] := o[6] * o[7];
+      o[9] := o[5] * o[5];
+      o[10] := o[7] * o[7];
+      o[11] := o[9] * o[9];
+      o[12] := o[10] * o[10];
+      o[13] := o[12] * o[12];
+      o[14] := o[7] * q2;
+      o[15] := o[6] * q2;
+      o[16] := o[10] * o[6];
+      o[17] := o[13] * o[6];
+      o[18] := o[13] * o[6] * q2;
+      h := (4.63697573303507e9 + 3.74686560065793 * o[2] + 3.57966647812489e-6 * o[1] * o[2] + 2.81881548488163e-13 * o[3] - 7.64652332452145e7 * q1 - 0.00450789338787835 * o[2] * q1 - 1.55131504410292e-9 * o[1] * o[2] * q1 + o[1] * (2.51383707870341e6 - 4.78198198764471e6 * o[10] * o[11] * o[12] * o[13] * o[4] + 49.9651389369988 * o[11] * o[12] * o[13] * o[4] * o[5] * o[7] + o[15] * o[4] * (1.03746636552761e-13 - 0.00349547959376899 * o[16] - 2.55074501962569e-7 * o[8]) * o[9] + ((-242662.235426958 * o[10] * o[12]) - 3.46022402653609 * o[16]) * o[4] * o[5] * pi + o[4] * (0.109336249381227 - 2248.08924686956 * o[14] - 354742.725841972 * o[17] - 24.1331193696374 * o[6]) * pi - 3.09081828396912e-19 * o[11] * o[12] * o[5] * o[7] * pi - 1.24107527851371e-8 * o[11] * o[13] * o[4] * o[5] * o[6] * o[7] * pi + 3.99891272904219 * o[5] * o[8] * pi + 0.0641817365250892 * o[10] * o[7] * o[9] * pi + pi * ((-4444.87643334512) - 75253.6156722047 * o[14] - 43051.9020511789 * o[6] - 22926.6247146068 * q2) + o[4] * ((-8.23252840892034) - 3927.0508365636 * o[15] - 239.325789467604 * o[18] - 76407.3727417716 * o[8] - 94.4508644545118 * q2) + 0.360567666582363 * o[5] * ((-0.0161221195808321) + q2) * (0.0338039844460968 + q2) + o[11] * ((-0.000584580992538624 * o[10] * o[12] * o[7]) + 1.33248030241755e6 * o[12] * o[13] * q2) + o[9] * ((-7.38502736990986e7 * o[18]) + 0.0000224425477627799 * o[6] * o[7] * q2) + o[4] * o[5] * ((-2.08438767026518e8 * o[17]) - 0.0000124971648677697 * o[6] - 8442.30378348203 * o[10] * o[6] * o[7] * q2) + o[11] * o[9] * (4.73594929247646e-22 * o[10] * o[12] * q2 - 13.6411358215175 * o[10] * o[12] * o[13] * q2 + 5.52427169406836e-10 * o[13] * o[6] * o[7] * q2) + o[11] * o[5] * (2.67174673301715e-6 * o[17] + 4.44545133805865e-18 * o[12] * o[6] * q2 - 50.2465185106411 * o[10] * o[13] * o[6] * o[7] * q2))) / o[1];
+    end hlowerofp2;
+
+    function hupperofp2 "explicit upper specific enthalpy limit of region 2 as function of pressure"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    protected
+      Real pi "dimensionless pressure";
+      Real[2] o "vector of auxiliary variables";
+    algorithm
+      pi := p / data.PSTAR2;
+      assert(p > triple.ptriple, "IF97 medium function hupperofp2 called with too low pressure\n" + "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
+      o[1] := pi * pi;
+      o[2] := o[1] * o[1] * o[1];
+      h := 4.16066337647071e6 + pi * ((-4518.48617188327) + pi * ((-8.53409968320258) + pi * (0.109090430596056 + pi * ((-0.000172486052272327) + pi * (4.2261295097284e-15 + pi * ((-1.27295130636232e-10) + pi * ((-3.79407294691742e-25) + pi * (7.56960433802525e-23 + pi * (7.16825117265975e-32 + pi * (3.37267475986401e-21 + ((-7.5656940729795e-74) + o[1] * ((-8.00969737237617e-134) + (1.6746290980312e-65 + pi * ((-3.71600586812966e-69) + pi * (8.06630589170884e-129 + ((-1.76117969553159e-103) + 1.88543121025106e-84 * pi) * pi))) * o[1])) * o[2]))))))))));
+    end hupperofp2;
+
+    function slowerofp2 "explicit lower specific entropy limit of region 2 as function of pressure (meets region 4 saturation pressure curve at 623.15 K)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output Modelica.Units.SI.SpecificEntropy s "specific entropy";
+    protected
+      Real pi "dimensionless pressure";
+      Real q1 "auxiliary variable";
+      Real q2 "auxiliary variable";
+      Real[40] o "vector of auxiliary variables";
+    algorithm
+      pi := p / data.PSTAR2;
+      assert(p > triple.ptriple, "IF97 medium function slowerofp2 called with too low pressure\n" + "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
+      q1 := 572.54459862746 + 31.3220101646784 * ((-13.91883977887) + pi) ^ 0.5;
+      q2 := (-0.5) + 540.0 / q1;
+      o[1] := pi * pi;
+      o[2] := o[1] * pi;
+      o[3] := o[1] * o[1];
+      o[4] := o[1] * o[3] * pi;
+      o[5] := q1 * q1;
+      o[6] := o[5] * q1;
+      o[7] := 1 / o[5];
+      o[8] := 1 / q1;
+      o[9] := o[5] * o[5];
+      o[10] := o[9] * q1;
+      o[11] := q2 * q2;
+      o[12] := o[11] * q2;
+      o[13] := o[1] * o[3];
+      o[14] := o[11] * o[11];
+      o[15] := o[3] * o[3];
+      o[16] := o[1] * o[15];
+      o[17] := o[11] * o[14];
+      o[18] := o[11] * o[14] * q2;
+      o[19] := o[3] * pi;
+      o[20] := o[14] * o[14];
+      o[21] := o[11] * o[20];
+      o[22] := o[15] * pi;
+      o[23] := o[14] * o[20] * q2;
+      o[24] := o[20] * o[20];
+      o[25] := o[15] * o[15];
+      o[26] := o[25] * o[3];
+      o[27] := o[14] * o[24];
+      o[28] := o[25] * o[3] * pi;
+      o[29] := o[20] * o[24] * q2;
+      o[30] := o[15] * o[25];
+      o[31] := o[24] * o[24];
+      o[32] := o[11] * o[31] * q2;
+      o[33] := o[14] * o[31];
+      o[34] := o[1] * o[25] * o[3] * pi;
+      o[35] := o[11] * o[14] * o[31] * q2;
+      o[36] := o[1] * o[25] * o[3];
+      o[37] := o[1] * o[25];
+      o[38] := o[20] * o[24] * o[31] * q2;
+      o[39] := o[14] * q2;
+      o[40] := o[11] * o[31];
+      s := 461.526 * (9.692768600217 + 1.22151969114703e-16 * o[10] + 0.00018948987516315 * o[1] * o[11] + 1.6714766451061e-11 * o[12] * o[13] + 0.0039392777243355 * o[1] * o[14] - 1.0406965210174e-19 * o[14] * o[16] + 0.043797295650573 * o[1] * o[18] - 2.2922076337661e-6 * o[18] * o[19] - 2.0481737692309e-8 * o[2] + 0.00003227767723857 * o[12] * o[2] + 0.0015033924542148 * o[17] * o[2] - 1.1256211360459e-11 * o[15] * o[20] + 1.0018179379511e-9 * o[11] * o[14] * o[16] * o[20] + 1.0234747095929e-13 * o[16] * o[21] - 1.9809712802088e-8 * o[22] * o[23] + 0.0021171472321355 * o[13] * o[24] - 8.9185845355421e-25 * o[26] * o[27] - 1.2790717852285e-8 * o[11] * o[3] - 4.8225372718507e-7 * o[12] * o[3] - 7.3087610595061e-29 * o[11] * o[20] * o[24] * o[30] - 0.10693031879409 * o[11] * o[24] * o[25] * o[31] + 4.2002467698208e-6 * o[24] * o[26] * o[31] - 5.5414715350778e-17 * o[20] * o[30] * o[31] + 9.436970724121e-7 * o[11] * o[20] * o[24] * o[30] * o[31] + 23.895741934104 * o[13] * o[32] + 0.040668253562649 * o[2] * o[32] - 3.0629316876232e-13 * o[26] * o[32] + 0.000026674547914087 * o[1] * o[33] + 8.2311340897998 * o[15] * o[33] + 1.2768608934681e-15 * o[34] * o[35] + 0.33662250574171 * o[37] * o[38] + 5.905956432427e-18 * o[4] + 0.038946842435739 * o[29] * o[4] - 4.88368302964335e-6 * o[5] - 3.34901734177133e6 / o[6] + 2.58538448402683e-9 * o[6] + 82839.5726841115 * o[7] - 5446.7940672972 * o[8] - 8.40318337484194e-13 * o[9] + 0.0017731742473213 * pi + 0.045996013696365 * o[11] * pi + 0.057581259083432 * o[12] * pi + 0.05032527872793 * o[17] * pi + o[8] * pi * (9.63082563787332 - 0.008917431146179 * q1) + 0.00811842799898148 * q1 + 0.000033032641670203 * o[1] * q2 - 4.3870667284435e-7 * o[2] * q2 + 8.0882908646985e-11 * o[14] * o[20] * o[24] * o[25] * q2 + 5.9056029685639e-26 * o[14] * o[24] * o[28] * q2 + 7.8847309559367e-10 * o[3] * q2 - 3.7826947613457e-6 * o[14] * o[24] * o[31] * o[36] * q2 + 1.2621808899101e-6 * o[11] * o[20] * o[4] * q2 + 540. * o[8] * (10.08665568018 - 0.000033032641670203 * o[1] - 6.2245802776607e-15 * o[10] - 0.015757110897342 * o[1] * o[12] - 5.0144299353183e-11 * o[11] * o[13] + 4.1627860840696e-19 * o[12] * o[16] - 0.306581069554011 * o[1] * o[17] + 9.0049690883672e-11 * o[15] * o[18] + 0.0000160454534363627 * o[17] * o[19] + 4.3870667284435e-7 * o[2] - 0.00009683303171571 * o[11] * o[2] + 2.57526266427144e-7 * o[14] * o[20] * o[22] - 1.40254511313154e-8 * o[16] * o[23] - 2.34560435076256e-9 * o[14] * o[20] * o[24] * o[25] - 1.24017662339842e-24 * o[27] * o[28] - 7.8847309559367e-10 * o[3] + 1.44676118155521e-6 * o[11] * o[3] + 1.90027787547159e-27 * o[29] * o[30] - 0.000960283724907132 * o[1] * o[32] - 296.320827232793 * o[15] * o[32] - 4.97975748452559e-14 * o[11] * o[14] * o[31] * o[34] + 2.21658861403112e-15 * o[30] * o[35] + 0.000200482822351322 * o[14] * o[24] * o[31] * o[36] - 19.1874828272775 * o[20] * o[24] * o[31] * o[37] - 0.0000547344301999018 * o[30] * o[38] - 0.0090203547252888 * o[2] * o[39] - 0.0000138839897890111 * o[21] * o[4] - 0.973671060893475 * o[20] * o[24] * o[4] - 836.35096769364 * o[13] * o[40] - 1.42338887469272 * o[2] * o[40] + 1.07202609066812e-11 * o[26] * o[40] + 0.0000150341259240398 * o[5] - 1.8087714924605e-8 * o[6] + 18605.6518987296 * o[7] - 306.813232163376 * o[8] + 1.43632471334824e-11 * o[9] + 1.13103675106207e-18 * o[5] * o[9] - 0.017834862292358 * pi - 0.172743777250296 * o[11] * pi - 0.30195167236758 * o[39] * pi + o[8] * pi * ((-49.6756947920742) + 0.045996013696365 * q1) - 0.0003789797503263 * o[1] * q2 - 0.033874355714168 * o[11] * o[13] * o[14] * o[20] * q2 - 1.0234747095929e-12 * o[16] * o[20] * q2 + 1.78371690710842e-23 * o[11] * o[24] * o[26] * q2 + 2.558143570457e-8 * o[3] * q2 + 5.3465159397045 * o[24] * o[25] * o[31] * q2 - 0.000201611844951398 * o[11] * o[14] * o[20] * o[26] * o[31] * q2) - Modelica.Math.log(pi));
+    end slowerofp2;
+
+    function supperofp2 "explicit upper specific entropy limit of region 2 as function of pressure"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output Modelica.Units.SI.SpecificEntropy s "specific entropy";
+    protected
+      Real pi "dimensionless pressure";
+      Real[2] o "vector of auxiliary variables";
+    algorithm
+      pi := p / data.PSTAR2;
+      assert(p > triple.ptriple, "IF97 medium function supperofp2 called with too low pressure\n" + "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
+      o[1] := pi * pi;
+      o[2] := o[1] * o[1] * o[1];
+      s := 8505.73409708683 - 461.526 * Modelica.Math.log(pi) + pi * ((-3.36563543302584) + pi * ((-0.00790283552165338) + pi * (0.0000915558349202221 + pi * ((-1.59634706513e-7) + pi * (3.93449217595397e-18 + pi * ((-1.18367426347994e-13) + pi * (2.72575244843195e-15 + pi * (7.04803892603536e-26 + pi * (6.67637687381772e-35 + pi * (3.1377970315132e-24 + ((-7.04844558482265e-77) + o[1] * ((-7.46289531275314e-137) + (1.55998511254305e-68 + pi * ((-3.46166288915497e-72) + pi * (7.51557618628583e-132 + ((-1.64086406733212e-106) + 1.75648443097063e-87 * pi) * pi))) * o[1])) * o[2] * o[2]))))))))));
+    end supperofp2;
+
+    function d1n "density in region 1 as function of p and T"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      output Modelica.Units.SI.Density d "density";
+    protected
+      Real pi "dimensionless pressure";
+      Real pi1 "dimensionless pressure";
+      Real tau "dimensionless temperature";
+      Real tau1 "dimensionless temperature";
+      Real gpi "dimensionless Gibbs-derivative w.r.t. pi";
+      Real[11] o "auxiliary variables";
+    algorithm
+      pi := p / data.PSTAR1;
+      tau := data.TSTAR1 / T;
+      pi1 := 7.1 - pi;
+      tau1 := tau - 1.222;
+      o[1] := tau1 * tau1;
+      o[2] := o[1] * o[1];
+      o[3] := o[2] * o[2];
+      o[4] := o[1] * o[2];
+      o[5] := o[1] * tau1;
+      o[6] := o[2] * tau1;
+      o[7] := pi1 * pi1;
+      o[8] := o[7] * o[7];
+      o[9] := o[8] * o[8];
+      o[10] := o[3] * o[3];
+      o[11] := o[10] * o[10];
+      gpi := pi1 * (pi1 * ((0.000095038934535162 + o[2] * (8.4812393955936e-6 + 2.55615384360309e-9 * o[4])) / o[2] + pi1 * ((8.9701127632e-6 + (2.60684891582404e-6 + 5.7366919751696e-13 * o[2] * o[3]) * o[5]) / o[6] + pi1 * (2.02584984300585e-6 / o[3] + o[7] * pi1 * (o[8] * o[9] * pi1 * (o[7] * (o[7] * o[8] * ((-7.63737668221055e-22 / (o[1] * o[11] * o[2])) + pi1 * (pi1 * ((-5.65070932023524e-23 / (o[11] * o[3])) + 2.99318679335866e-24 * pi1 / (o[11] * o[3] * tau1)) + 3.5842867920213e-22 / (o[1] * o[11] * o[2] * tau1))) - 3.33001080055983e-19 / (o[1] * o[10] * o[2] * o[3] * tau1)) + 1.44400475720615e-17 / (o[10] * o[2] * o[3] * tau1)) + (1.01874413933128e-8 + 1.39398969845072e-9 * o[6]) / (o[1] * o[3] * tau1))))) + (0.00094368642146534 + o[5] * (0.00060003561586052 + ((-0.000095322787813974) + o[1] * (8.8283690661692e-6 + 1.45389992595188e-15 * o[1] * o[2] * o[3])) * tau1)) / o[5]) + ((-0.00028319080123804) + o[1] * (0.00060706301565874 + o[4] * (0.018990068218419 + tau1 * (0.032529748770505 + (0.021841717175414 + 0.00005283835796993 * o[1]) * tau1)))) / (o[3] * tau1);
+      d := p / (data.RH2O * T * pi * gpi);
+    end d1n;
+
+    function d2n "density in region 2  as function of p and T"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      output Modelica.Units.SI.Density d "density";
+    protected
+      Real pi "dimensionless pressure";
+      Real tau "dimensionless temperature";
+      Real tau2 "dimensionless temperature";
+      Real gpi "dimensionless Gibbs-derivative w.r.t. pi";
+      Real[12] o "auxiliary variables";
+    algorithm
+      pi := p / data.PSTAR2;
+      tau := data.TSTAR2 / T;
+      tau2 := tau - 0.5;
+      o[1] := tau2 * tau2;
+      o[2] := o[1] * tau2;
+      o[3] := o[1] * o[1];
+      o[4] := o[3] * o[3];
+      o[5] := o[4] * o[4];
+      o[6] := o[3] * o[4] * o[5] * tau2;
+      o[7] := o[3] * o[4] * tau2;
+      o[8] := o[1] * o[3] * o[4];
+      o[9] := pi * pi;
+      o[10] := o[9] * o[9];
+      o[11] := o[3] * o[5] * tau2;
+      o[12] := o[5] * o[5];
+      gpi := (1. + pi * ((-0.0017731742473213) + tau2 * ((-0.017834862292358) + tau2 * ((-0.045996013696365) + ((-0.057581259083432) - 0.05032527872793 * o[2]) * tau2)) + pi * (tau2 * ((-0.000066065283340406) + ((-0.0003789797503263) + o[1] * ((-0.007878555448671) + o[2] * ((-0.087594591301146) - 0.000053349095828174 * o[6]))) * tau2) + pi * (6.1445213076927e-8 + (1.31612001853305e-6 + o[1] * ((-0.00009683303171571) + o[2] * ((-0.0045101773626444) - 0.122004760687947 * o[6]))) * tau2 + pi * (tau2 * ((-3.15389238237468e-9) + (5.116287140914e-8 + 1.92901490874028e-6 * tau2) * tau2) + pi * (0.0000114610381688305 * o[1] * o[3] * tau2 + pi * (o[2] * ((-1.00288598706366e-10) + o[7] * ((-0.012702883392813) - 143.374451604624 * o[1] * o[5] * tau2)) + pi * ((-4.1341695026989e-17) + o[1] * o[4] * ((-8.8352662293707e-6) - 0.272627897050173 * o[8]) * tau2 + pi * (o[4] * (9.0049690883672e-11 - 65.8490727183984 * o[3] * o[4] * o[5]) + pi * (1.78287415218792e-7 * o[7] + pi * (o[3] * (1.0406965210174e-18 + o[1] * ((-1.0234747095929e-12) - 1.0018179379511e-8 * o[3]) * o[3]) + o[10] * o[9] * (((-1.29412653835176e-9) + 1.71088510070544 * o[11]) * o[6] + o[9] * ((-6.05920510335078 * o[12] * o[4] * o[5] * tau2) + o[9] * (o[3] * o[5] * (1.78371690710842e-23 + o[1] * o[3] * o[4] * (6.1258633752464e-12 - 0.000084004935396416 * o[7]) * tau2) + pi * ((-1.24017662339842e-24 * o[11]) + pi * (0.0000832192847496054 * o[12] * o[3] * o[5] * tau2 + pi * (o[1] * o[4] * o[5] * (1.75410265428146e-27 + (1.32995316841867e-15 - 0.0000226487297378904 * o[1] * o[5]) * o[8]) * pi - 2.93678005497663e-14 * o[1] * o[12] * o[3] * tau2))))))))))))))))) / pi;
+      d := p / (data.RH2O * T * pi * gpi);
+    end d2n;
+
+    function dhot1ofp "density at upper temperature limit of region 1"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output Modelica.Units.SI.Density d "density";
+    protected
+      Real pi "dimensionless pressure";
+      Real pi1 "dimensionless pressure";
+      Real[4] o "auxiliary variables";
+    algorithm
+      pi := p / data.PSTAR1;
+      pi1 := 7.1 - pi;
+      o[1] := pi1 * pi1;
+      o[2] := o[1] * o[1];
+      o[3] := o[2] * o[2];
+      o[4] := o[3] * o[3];
+      d := 57.4756752485113 / (0.0737412153522555 + 0.000102697173772229 * o[1] + 1.99080616601101e-6 * o[2] + 1.35549330686006e-17 * o[2] * o[4] - 3.11228834832975e-19 * o[1] * o[2] * o[4] - 7.02987180039442e-22 * o[2] * o[3] * o[4] - 5.17859076694812e-23 * o[1] * o[2] * o[3] * o[4] + 0.00145092247736023 * pi1 + 0.0000114683182476084 * o[1] * pi1 + 1.13217858826367e-8 * o[1] * o[2] * pi1 + 3.29199117056433e-22 * o[2] * o[3] * o[4] * pi1 + 2.73712834080283e-24 * o[1] * o[2] * o[3] * o[4] * pi1);
+    end dhot1ofp;
+
+    function dupper1ofT "density at upper pressure limit of region 1"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      output Modelica.Units.SI.Density d "density";
+    protected
+      Real tau "dimensionless temperature";
+      Real[4] o "auxiliary variables";
+    algorithm
+      tau := 1386.0 / T;
+      o[1] := tau * tau;
+      o[2] := o[1] * o[1];
+      o[3] := o[2] * o[2];
+      o[4] := o[3] * o[3];
+      d := 57.4756752485113 / (2.24144616859917 + 40.9288231166229 * o[1] + 106.47246463213 * o[2] + 88.4481480270751 * o[1] * o[2] + 31.3207272417546 * o[3] + 5.47811738891798 * o[1] * o[3] + 0.515626225030717 * o[2] * o[3] + 0.0274905057899089 * o[1] * o[2] * o[3] + 0.000853742979250503 * o[4] + 0.0000155932210492199 * o[1] * o[4] + 1.6621051480279e-7 * o[2] * o[4] + 1.00606771839976e-9 * o[1] * o[2] * o[4] + 3.27598951831994e-12 * o[3] * o[4] + 5.20162317530099e-15 * o[1] * o[3] * o[4] + 3.33501889800275e-18 * o[2] * o[3] * o[4] + 5.50656040141221e-22 * o[1] * o[2] * o[3] * o[4] - 13.5354267762204 * tau - 78.3629702507642 * o[1] * tau - 109.374479648652 * o[2] * tau - 57.9035658513312 * o[1] * o[2] * tau - 14.215347150565 * o[3] * tau - 1.80906759985501 * o[1] * o[3] * tau - 0.127542214693871 * o[2] * o[3] * tau - 0.0051779458313163 * o[1] * o[2] * o[3] * tau - 0.000123304142684848 * o[4] * tau - 1.72405791469972e-6 * o[1] * o[4] * tau - 1.39155695911655e-8 * o[2] * o[4] * tau - 6.23333356847138e-11 * o[1] * o[2] * o[4] * tau - 1.44056015732082e-13 * o[3] * o[4] * tau - 1.50201626932938e-16 * o[1] * o[3] * o[4] * tau - 5.34588682252967e-20 * o[2] * o[3] * o[4] * tau - 2.73712834080283e-24 * o[1] * o[2] * o[3] * o[4] * tau);
+    end dupper1ofT;
+
+    function hl_p_R4b "explicit approximation of liquid specific enthalpy on the boundary between regions 4 and 3"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    protected
+      Real x "auxiliary variable";
+    algorithm
+// documentation of accuray in notebook ~hubertus/props/IAPWS/R3Approx.nb
+// boundary between region IVa and III
+      x := Modelica.Math.acos(p / data.PCRIT);
+      h := (1 + x * ((-0.4945586958175176) + x * (1.346800016564904 + x * ((-3.889388153209752) + x * (6.679385472887931 + x * ((-6.75820241066552) + x * (3.558919744656498 + ((-0.7179818554978939) - 0.0001152032945617821 * x) * x))))))) * data.HCRIT;
+      annotation(
+        smoothOrder = 5);
+    end hl_p_R4b;
+
+    function hv_p_R4b "explicit approximation of vapour specific enthalpy on the boundary between regions 4 and 3"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    protected
+      Real x "auxiliary variable";
+    algorithm
+// boundary between region IVa and III
+      x := Modelica.Math.acos(p / data.PCRIT);
+      h := (1 + x * (0.4880153718655694 + x * (0.2079670746250689 + x * ((-6.084122698421623) + x * (25.08887602293532 + x * ((-48.38215180269516) + x * (45.66489164833212 + ((-16.98555442961553) + 0.0006616936460057691 * x) * x))))))) * data.HCRIT;
+      annotation(
+        smoothOrder = 5);
+    end hv_p_R4b;
+
+    function sl_p_R4b "explicit approximation of liquid specific entropy on the boundary between regions 4 and 3"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output Modelica.Units.SI.SpecificEntropy s "specific entropy";
+    protected
+      Real x "auxiliary variable";
+    algorithm
+// boundary between region IVa and III
+      x := Modelica.Math.acos(p / data.PCRIT);
+      s := (1 + x * ((-0.36160692245648063) + x * (0.9962778630486647 + x * ((-2.8595548144171103) + x * (4.906301159555333 + x * ((-4.974092309614206) + x * (2.6249651699204457 + ((-0.5319954375299023) - 0.00008064497431880644 * x) * x))))))) * data.SCRIT;
+      annotation(
+        smoothOrder = 5);
+    end sl_p_R4b;
+
+    function sv_p_R4b "explicit approximation of vapour specific entropy on the boundary between regions 4 and 3"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output Modelica.Units.SI.SpecificEntropy s;
+    protected
+      Real x "auxiliary variable";
+    algorithm
+// documentation of accuray in notebook ~hubertus/props/IAPWS/R3Approx.nb
+// boundary between region IVa and III
+      x := Modelica.Math.acos(p / data.PCRIT);
+      s := (1 + x * (0.35682641826674344 + x * (0.1642457027815487 + x * ((-4.425350377422446) + x * (18.324477859983133 + x * ((-35.338631625948665) + x * (33.36181025816282 + ((-12.408711490585757) + 0.0004810049834109226 * x) * x))))))) * data.SCRIT;
+      annotation(
+        smoothOrder = 5);
+    end sv_p_R4b;
+
+    function rhol_p_R4b "explicit approximation of liquid density on the boundary between regions 4 and 3"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output Modelica.Units.SI.Density dl "liquid density";
+    protected
+      Real x "auxiliary variable";
+    algorithm
+      if p < data.PCRIT then
+        x := Modelica.Math.acos(p / data.PCRIT);
+        dl := (1 + x * (1.903224079094824 + x * ((-2.5314861802401123) + x * ((-8.191449323843552) + x * (94.34196116778385 + x * ((-369.3676833623383) + x * (796.6627910598293 + x * ((-994.5385383600702) + x * (673.2581177021598 + ((-191.43077336405156) + 0.00052536560808895 * x) * x))))))))) * data.DCRIT;
+      else
+        dl := data.DCRIT;
+      end if;
+      annotation(
+        smoothOrder = 5);
+    end rhol_p_R4b;
+
+    function rhov_p_R4b "explicit approximation of vapour density on the boundary between regions 4 and 2"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output Modelica.Units.SI.Density dv "vapour density";
+    protected
+      Real x "auxiliary variable";
+    algorithm
+      if p < data.PCRIT then
+        x := Modelica.Math.acos(p / data.PCRIT);
+        dv := (1 + x * ((-1.8463850803362596) + x * ((-1.1447872718878493) + x * (59.18702203076563 + x * ((-403.5391431811611) + x * (1437.2007245332388 + x * ((-3015.853540307519) + x * (3740.5790348670057 + x * ((-2537.375817253895) + (725.8761975803782 - 0.0011151111658332337 * x) * x))))))))) * data.DCRIT;
+      else
+        dv := data.DCRIT;
+      end if;
+      annotation(
+        smoothOrder = 5);
+    end rhov_p_R4b;
+
+    function boilingcurve_p "properties on the boiling curve"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output ThermoSysPro.Properties.WaterSteam.Common.IF97PhaseBoundaryProperties bpro "property record";
+    protected
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs g "dimensionless Gibbs funcion and dervatives";
+      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs f "dimensionless Helmholtz function and dervatives";
+      Modelica.Units.SI.Pressure plim = min(p, data.PCRIT - 1e-7) "pressure limited to critical pressure - epsilon";
+      Boolean region3boundary "true if boundary between 2-phase and region 3";
+      Real pv "partial derivative of p w.r.t v";
+    algorithm
+      bpro.R := data.RH2O;
+      bpro.T := Basic.tsat(plim);
+      bpro.dpT := Basic.dptofT(bpro.T);
+      region3boundary := bpro.T > data.TLIMIT1;
+      if not region3boundary then
+        g := Basic.g1(p, bpro.T);
+        bpro.d := p / (bpro.R * bpro.T * g.pi * g.gpi);
+        bpro.h := if p > plim then data.HCRIT else bpro.R * bpro.T * g.tau * g.gtau;
+        bpro.s := g.R * (g.tau * g.gtau - g.g);
+        bpro.cp := -bpro.R * g.tau * g.tau * g.gtautau;
+        bpro.vt := bpro.R / p * (g.pi * g.gpi - g.tau * g.pi * g.gtaupi);
+        bpro.vp := bpro.R * bpro.T / (p * p) * g.pi * g.pi * g.gpipi;
+        bpro.pt := -p / bpro.T * (g.gpi - g.tau * g.gtaupi) / (g.gpipi * g.pi);
+        bpro.pd := -bpro.R * bpro.T * g.gpi * g.gpi / g.gpipi;
+      else
+        bpro.d := rhol_p_R4b(plim);
+        f := Basic.f3(bpro.d, bpro.T);
+        bpro.h := hl_p_R4b(plim);
+        bpro.s := f.R * (f.tau * f.ftau - f.f);
+        bpro.cv := bpro.R * (-f.tau * f.tau * f.ftautau);
+        bpro.pt := bpro.R * bpro.d * f.delta * (f.fdelta - f.tau * f.fdeltatau);
+        bpro.pd := bpro.R * bpro.T * f.delta * (2.0 * f.fdelta + f.delta * f.fdeltadelta);
+        pv := -f.d * f.d * bpro.pd;
+        bpro.vp := 1 / pv;
+        bpro.vt := -bpro.pt / pv;
+      end if;
+// bpro.R*bpro.T*(f.tau*f.ftau + f.delta*f.fdelta);
+    end boilingcurve_p;
+
+    function dewcurve_p "properties on the dew curve"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output ThermoSysPro.Properties.WaterSteam.Common.IF97PhaseBoundaryProperties bpro "property record";
+    protected
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs g "dimensionless Gibbs funcion and dervatives";
+      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs f "dimensionless Helmholtz function and dervatives";
+      Modelica.Units.SI.Pressure plim = min(p, data.PCRIT - 1e-7) "pressure limited to critical pressure - epsilon";
+      Boolean region3boundary "true if boundary between 2-phase and region 3";
+      Real pv "partial derivative of p w.r.t v";
+    algorithm
+      bpro.R := data.RH2O;
+      bpro.T := Basic.tsat(plim);
+      bpro.dpT := Basic.dptofT(bpro.T);
+      region3boundary := bpro.T > data.TLIMIT1;
+      if not region3boundary then
+        g := Basic.g2(p, bpro.T);
+        bpro.d := p / (bpro.R * bpro.T * g.pi * g.gpi);
+        bpro.h := if p > plim then data.HCRIT else bpro.R * bpro.T * g.tau * g.gtau;
+        bpro.s := g.R * (g.tau * g.gtau - g.g);
+        bpro.cp := -bpro.R * g.tau * g.tau * g.gtautau;
+        bpro.vt := bpro.R / p * (g.pi * g.gpi - g.tau * g.pi * g.gtaupi);
+        bpro.vp := bpro.R * bpro.T / (p * p) * g.pi * g.pi * g.gpipi;
+        bpro.pt := -p / bpro.T * (g.gpi - g.tau * g.gtaupi) / (g.gpipi * g.pi);
+        bpro.pd := -bpro.R * bpro.T * g.gpi * g.gpi / g.gpipi;
+      else
+        bpro.d := rhov_p_R4b(plim);
+        f := Basic.f3(bpro.d, bpro.T);
+        bpro.h := hv_p_R4b(plim);
+        bpro.s := f.R * (f.tau * f.ftau - f.f);
+        bpro.cv := bpro.R * (-f.tau * f.tau * f.ftautau);
+        bpro.pt := bpro.R * bpro.d * f.delta * (f.fdelta - f.tau * f.fdeltatau);
+        bpro.pd := bpro.R * bpro.T * f.delta * (2.0 * f.fdelta + f.delta * f.fdeltadelta);
+        pv := -f.d * f.d * bpro.pd;
+        bpro.vp := 1 / pv;
+        bpro.vt := -bpro.pt / pv;
+      end if;
+// bpro.R*bpro.T*(f.tau*f.ftau + f.delta*f.fdelta);
+    end dewcurve_p;
+
+    function hvl_p
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97PhaseBoundaryProperties bpro "property record";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    algorithm
+      h := bpro.h;
+      annotation(
+        derivative(noDerivative = bpro) = hvl_p_der,
+        Inline = false,
+        LateInline = true);
+    end hvl_p;
+
+    function hl_p "liquid specific enthalpy on the boundary between regions 4 and 3 or 1"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    algorithm
+      h := hvl_p(p, boilingcurve_p(p));
+    end hl_p;
+
+    function hv_p "vapour specific enthalpy on the boundary between regions 4 and 3 or 2"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    algorithm
+      h := hvl_p(p, dewcurve_p(p));
+    end hv_p;
+
+    function hvl_p_der "derivative function for the specific enthalpy along the phase boundary"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97PhaseBoundaryProperties bpro "property record";
+      input Real p_der "derivative of pressure";
+      output Real h_der "time derivative of specific enthalpy along the phase boundary";
+    algorithm
+      h_der := (1 / bpro.d - bpro.T * bpro.vt) * p_der + bpro.cp / bpro.dpT * p_der;
+    end hvl_p_der;
+
+    function rhovl_p
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97PhaseBoundaryProperties bpro "property record";
+      output Modelica.Units.SI.Density rho "density";
+    algorithm
+      rho := bpro.d;
+      annotation(
+        derivative(noDerivative = bpro) = rhovl_p_der,
+        Inline = false,
+        LateInline = true);
+    end rhovl_p;
+
+    function rhol_p "density of saturated water"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "saturation pressure";
+      output Modelica.Units.SI.Density rho "density of steam at the condensation point";
+    algorithm
+      rho := rhovl_p(p, boilingcurve_p(p));
+    end rhol_p;
+
+    function rhov_p "density of saturated vapour"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "saturation pressure";
+      output Modelica.Units.SI.Density rho "density of steam at the condensation point";
+    algorithm
+      rho := rhovl_p(p, dewcurve_p(p));
+    end rhov_p;
+
+    function rhovl_p_der
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "saturation pressure";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97PhaseBoundaryProperties bpro "property record";
+      input Real p_der "derivative of pressure";
+      output Real d_der "time derivative of density along the phase boundary";
+    algorithm
+      d_der := -bpro.d * bpro.d * (bpro.vp + bpro.vt / bpro.dpT) * p_der;
+    end rhovl_p_der;
+
+    function sl_p "liquid specific entropy on the boundary between regions 4 and 3 or 1"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output Modelica.Units.SI.SpecificEntropy s "specific entropy";
+    protected
+      Modelica.Units.SI.Temperature Tsat "saturation temperature";
+      Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    algorithm
+      if p < data.PLIMIT4A then
+        Tsat := Basic.tsat(p);
+        (h, s) := Isentropic.handsofpT1(p, Tsat);
+      elseif p < data.PCRIT then
+        s := sl_p_R4b(p);
+      else
+        s := data.SCRIT;
+      end if;
+    end sl_p;
+
+    function sv_p "vapour specific entropy on the boundary between regions 4 and 3 or 2"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output Modelica.Units.SI.SpecificEntropy s "specific entropy";
+    protected
+      Modelica.Units.SI.Temperature Tsat "saturation temperature";
+      Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    algorithm
+      if p < data.PLIMIT4A then
+        Tsat := Basic.tsat(p);
+        (h, s) := Isentropic.handsofpT2(p, Tsat);
+      elseif p < data.PCRIT then
+        s := sv_p_R4b(p);
+      else
+        s := data.SCRIT;
+      end if;
+    end sv_p;
+
+    function rhol_T "density of saturated water"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Temperature T "temperature";
+      output Modelica.Units.SI.Density d "density of water at the boiling point";
+    protected
+      Modelica.Units.SI.Pressure p "saturation pressure";
+    algorithm
+      p := Basic.psat(T);
+      if T < data.TLIMIT1 then
+        d := d1n(p, T);
+      elseif T < data.TCRIT then
+        d := rhol_p_R4b(p);
+      else
+        d := data.DCRIT;
+      end if;
+    end rhol_T;
+
+    function rhov_T "density of saturated vapour"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Temperature T "temperature";
+      output Modelica.Units.SI.Density d "density of steam at the condensation point";
+    protected
+      Modelica.Units.SI.Pressure p "saturation pressure";
+    algorithm
+// assert(T <= data.TCRIT,"input temperature has to be below the critical temperature");
+      p := Basic.psat(T);
+      if T < data.TLIMIT1 then
+        d := d2n(p, T);
+      elseif T < data.TCRIT then
+        d := rhov_p_R4b(p);
+      else
+        d := data.DCRIT;
+      end if;
+    end rhov_T;
+
+    function region_ph "return the current region (valid values: 1,2,3,4,5) in IF97 for given pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Integer phase = 0 "phase: 2 for two-phase, 1 for one phase, 0 if not known";
+      input Integer mode = 0 "mode: 0 means check, otherwise assume region=mode";
+      output Integer region "region (valid values: 1,2,3,4,5) in IF97";
+      // If mode is different from 0, no checking for the region is done and
+      // the mode is assumed to be the correct region. This can be used to
+      // implement e.g. water-only steamtables when mode == 1
+    protected
+      Boolean hsubcrit;
+      Modelica.Units.SI.Temperature Ttest;
+      constant Real[5] n = data.n;
+      Modelica.Units.SI.SpecificEnthalpy hl "bubble enthalpy";
+      Modelica.Units.SI.SpecificEnthalpy hv "dew enthalpy";
+    algorithm
+      if mode <> 0 then
+        region := mode;
+      else
+        hl := hl_p(p);
+        hv := hv_p(p);
+        if phase == 2 then
+          region := 4;
+        else
+          if p < triple.ptriple or p > data.PLIMIT1 or h < hlowerofp1(p) or p < 10.0e6 and h > hupperofp5(p) or p >= 10.0e6 and h > hupperofp2(p) then
+            region := -1;
+          else
+            hsubcrit := h < data.HCRIT;
+            if p < data.PLIMIT4A then
+              if hsubcrit then
+                if phase == 1 then
+                  region := 1;
+                else
+                  if h < Isentropic.hofpT1(p, Basic.tsat(p)) then
+                    region := 1;
+                  else
+                    region := 4;
+                  end if;
+                end if;
+              else
+                if h > hlowerofp5(p) then
+                  if p < data.PLIMIT5 and h < hupperofp5(p) then
+                    region := 5;
+                  else
+                    region := -2;
+                  end if;
+                else
+                  if phase == 1 then
+                    region := 2;
+                  else
+                    if h > Isentropic.hofpT2(p, Basic.tsat(p)) then
+                      region := 2;
+                    else
+                      region := 4;
+                    end if;
+                  end if;
+                end if;
+              end if;
+            else
+              if hsubcrit then
+                if h < hupperofp1(p) then
+                  region := 1;
+                else
+                  if h < hl or p > data.PCRIT then
+                    region := 3;
+                  else
+                    region := 4;
+                  end if;
+                end if;
+              else
+                if h > hlowerofp2(p) then
+                  region := 2;
+                else
+                  if h > hv or p > data.PCRIT then
+                    region := 3;
+                  else
+                    region := 4;
+                  end if;
+                end if;
+              end if;
+            end if;
+          end if;
+        end if;
+      end if;
+// check for regions 1, 2, 3 and 4
+// phase == 1 or 0, now check if we are in the legal area
+// outside of valid range
+//region 5 and -1 check complete
+// simple precheck: very simple if pressure < PLIMIT4A
+// we can never be in region 3, so test for others
+// external or internal phase check
+// check for region 5
+// pressure and specific enthalpy too high, but this should
+// never happen
+// external or internal phase check
+// tests for region 2 or 5
+// tests for sub or supercritical
+// the pressure is over data.PLIMIT4A
+// region 1 or 3 or 4
+// enf of test for region 1, 3 or 4
+// region 2, 3 or 4
+// test for 2 and 3
+// tests above PLIMIT4A
+// above or below PLIMIT4A
+// check for grand limits of p and h
+// all tests with phase == 1
+// mode was == 0
+// assert(region > 0,"IF97 function called outside the valid range!");
+    end region_ph;
+
+    function region_ps "return the current region (valid values: 1,2,3,4,5) in IF97 for given pressure and specific entropy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      input Integer phase = 0 "phase: 2 for two-phase, 1 for one phase, 0 if unknown";
+      input Integer mode = 0 "mode: 0 means check, otherwise assume region=mode";
+      output Integer region "region (valid values: 1,2,3,4,5) in IF97";
+      //  If mode is different from 0, no checking for the region is done and
+      //    the mode is assumed to be the correct region. This can be used to
+      //    implement e.g. water-only steamtables when mode == 1
+    protected
+      Boolean ssubcrit;
+      Modelica.Units.SI.Temperature Ttest;
+      constant Real[5] n = data.n;
+      Modelica.Units.SI.SpecificEntropy sl "bubble entropy";
+      Modelica.Units.SI.SpecificEntropy sv "dew entropy";
+    algorithm
+      if mode <> 0 then
+        region := mode;
+      else
+        sl := sl_p(p);
+        sv := sv_p(p);
+        if phase == 2 or phase == 0 and s > sl and s < sv and p < data.PCRIT then
+          region := 4;
+        else
+          region := 0;
+          if p < triple.ptriple then
+            region := -2;
+          end if;
+          if p > data.PLIMIT1 then
+            region := -3;
+          end if;
+          if p < 10.0e6 and s > supperofp5(p) then
+            region := -5;
+          end if;
+          if p >= 10.0e6 and s > supperofp2(p) then
+            region := -6;
+          end if;
+          if region < 0 then
+            assert(false, "region computation from p and s failed: function called outside the legal region");
+          else
+            ssubcrit := s < data.SCRIT;
+            if p < data.PLIMIT4A then
+              if ssubcrit then
+                region := 1;
+              else
+                if s > slowerofp5(p) then
+                  if p < data.PLIMIT5 and s < supperofp5(p) then
+                    region := 5;
+                  else
+                    region := -1;
+                  end if;
+                else
+                  region := 2;
+                end if;
+              end if;
+            else
+              if ssubcrit then
+                if s < supperofp1(p) then
+                  region := 1;
+                else
+                  if s < sl or p > data.PCRIT then
+                    region := 3;
+                  else
+                    region := 4;
+                  end if;
+                end if;
+              else
+                if s > slowerofp2(p) then
+                  region := 2;
+                else
+                  if s > sv or p > data.PCRIT then
+                    region := 3;
+                  else
+                    region := 4;
+                  end if;
+                end if;
+              end if;
+            end if;
+          end if;
+        end if;
+      end if;
+// check for regions 1, 2, 3, and 4
+// check all cases two-phase
+// phase == 1
+// simple precheck: very simple if pressure < PLIMIT4A
+// we can never be in region 3, so test for 1 and 2
+// check for region 5
+// pressure and specific entropy too high, should never happen!
+// tests for region 2 or 5
+// tests for sub or supercritical
+// the pressure is over data.PLIMIT4A
+// region 1 or 3
+// test for region 1, 3 or 4
+// region 2, 3 or 4
+// test for 2,3 and 4
+// tests above PLIMIT4A
+// above or below PLIMIT4A
+// grand test for limits of p and s
+// all tests with phase == 1
+// mode was == 0
+    end region_ps;
+
+    function region_pT "return the current region (valid values: 1,2,3,5) in IF97, given pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      input Integer mode = 0 "mode: 0 means check, otherwise assume region=mode";
+      output Integer region "region (valid values: 1,2,3,5) in IF97, region 4 is impossible!";
+    algorithm
+      if mode <> 0 then
+        region := mode;
+      else
+        if p < data.PLIMIT4A then
+          if T > data.TLIMIT2 then
+            region := 5;
+          elseif T > Basic.tsat(p) then
+            region := 2;
+          else
+            region := 1;
+          end if;
+        else
+          if T < data.TLIMIT1 then
+            region := 1;
+          elseif T < boundary23ofp(p) then
+            region := 3;
+          else
+            region := 2;
+          end if;
+        end if;
+      end if;
+//test for regions 1,2,5
+//test for regions 1,2,3
+// mode was == 0
+    end region_pT;
+
+    function region_dT "return the current region (valid values: 1,2,3,4,5) in IF97, given density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      input Integer phase = 0 "phase: 2 for two-phase, 1 for one phase, 0 if not known";
+      input Integer mode = 0 "mode: 0 means check, otherwise assume region=mode";
+      output Integer region "(valid values: 1,2,3,4,5) in IF97";
+    protected
+      Boolean Tovercrit "flag if overcritical temperature";
+      Modelica.Units.SI.Pressure p23 "pressure needed to know if region 2 or 3";
+    algorithm
+      Tovercrit := T > data.TCRIT;
+      if mode <> 0 then
+        region := mode;
+      else
+        p23 := boundary23ofT(T);
+        if T > data.TLIMIT2 then
+          if d < 20.5655874106483 then
+            region := 5;
+          else
+            assert(false, "out of valid region for IF97, pressure above region 5!");
+          end if;
+        elseif Tovercrit then
+          if d > d2n(p23, T) and T > data.TLIMIT1 then
+            region := 3;
+          elseif T < data.TLIMIT1 then
+            region := 1;
+          else
+            region := 2;
+          end if;
+        elseif d > rhol_T(T) then
+          if T < data.TLIMIT1 then
+            region := 1;
+          else
+            region := 3;
+          end if;
+        elseif d < rhov_T(T) then
+          if d > d2n(p23, T) and T > data.TLIMIT1 then
+            region := 3;
+          else
+            region := 2;
+          end if;
+        else
+          region := 4;
+        end if;
+      end if;
+// check for the density in the upper corner of validity!
+//check for regions 1, 2 or 3
+// d  < d2n(p23, T) and T > data.TLIMIT1
+// below critical, check for regions 1, 2, 3 or 4
+// either 1 or 3
+// not liquid, not 2-phase, and not region 5, so either 2 or 3 or illegal
+    end region_dT;
+    annotation(
+      Documentation(info = "<HTML><h4>Package description</h4>
  <p>Package <b>Regions</b> contains a large number of auxiliary functions which are neede to compute the current region
  of the IAPWS/IF97 for a given pair of input variables as quickly as possible. The focus of this implementation was on
  computational efficiency, not on compact code. Many of the function values calulated in these functions could be obtained
@@ -1512,1711 +1193,991 @@
  <li>Revised and extended for inclusion in Modelica.Thermal: December 2002</li>
 </ul>
 </HTML>
-"), Icon(graphics={
-          Text(
-            extent={{-102,0},{24,-26}},
-            lineColor={242,148,0},
-            textString=
-                 "Thermo"),
-          Text(
-            extent={{-4,8},{68,-34}},
-            lineColor={46,170,220},
-            textString=
-                 "SysPro"),
-          Polygon(
-            points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},{
-                42,8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},{
-                -50,6},{-62,2}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{-46,
-                8},{-42,22},{-42,30},{-44,38}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{-12,
-                12},{-26,12},{-28,12},{-26,20}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,30},{-6,26}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,36},{-6,32}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,42},{-6,38}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,48},{-6,44}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,32},{-2,28}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,38},{-2,34}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,44},{-2,40}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,50},{-2,46}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{-2,
-                20}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},{
-                42,6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},{
-                -50,6},{-62,2}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Line(
-            points={{22,12},{22,14},{22,16},{24,14},{20,18}},
-            color={46,170,220},
-            thickness=0.5),
-          Line(
-            points={{26,12},{26,14},{26,16},{28,14},{24,18}},
-            color={46,170,220},
-            thickness=0.5),
-          Line(
-            points={{30,10},{30,12},{30,14},{32,12},{28,16}},
-            color={46,170,220},
-            thickness=0.5),
-          Polygon(
-            points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}),
-          Line(
-            points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}},
-            color={0,0,255},
-            smooth=Smooth.None),
-          Line(
-            points={{80,80},{100,100}},
-            color={0,0,255},
-            smooth=Smooth.None)}));
-  end Regions;
-  //===================================================================
-  //                      Base functions
-
-  //===================================================================
-
-  package Basic "Base functions as described in IAWPS/IF97"
-
-    function g1 "Gibbs function for region 1: g(p,T)"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      output ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs
-                                g
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-    protected
-      Real pi1 "dimensionless pressure";
-      Real tau1 "dimensionless temperature";
-      Real[45] o "vector of auxiliary variables";
-    algorithm
-    //   assert(p > triple.ptriple,
-    //     "IF97 medium function g1 called with too low pressure\n" +
-    //     "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
-    //   assert(p <= 100.0e6,
-    //     "IF97 medium function g1: the input pressure (= " + String(p) + " Pa) is higher than 100 Mpa");
-    //   assert(T >= 273.15,
-    //     "IF97 medium function g1: the temperature (= " + String(T) + " K)  is lower than 273.15 K!");
-      g.p := p;
-      g.T := T;
-      g.R := data.RH2O;
-      g.pi := max(p,triple.ptriple)/data.PSTAR1;
-      g.tau := data.TSTAR1/max(T,triple.Ttriple);
-      pi1 := 7.1000000000000 - g.pi;
-      tau1 := -1.22200000000000 + g.tau;
-      o[1] := tau1*tau1;
-      o[2] := o[1]*o[1];
-      o[3] := o[2]*o[2];
-      o[4] := o[3]*tau1;
-      o[5] := 1/o[4];
-      o[6] := o[1]*o[2];
-      o[7] := o[1]*tau1;
-      o[8] := 1/o[7];
-      o[9] := o[1]*o[2]*o[3];
-      o[10] := 1/o[2];
-      o[11] := o[2]*tau1;
-      o[12] := 1/o[11];
-      o[13] := o[2]*o[3];
-      o[14] := 1/o[3];
-      o[15] := pi1*pi1;
-      o[16] := o[15]*pi1;
-      o[17] := o[15]*o[15];
-      o[18] := o[17]*o[17];
-      o[19] := o[17]*o[18]*pi1;
-      o[20] := o[15]*o[17];
-      o[21] := o[3]*o[3];
-      o[22] := o[21]*o[21];
-      o[23] := o[22]*o[3]*tau1;
-      o[24] := 1/o[23];
-      o[25] := o[22]*o[3];
-      o[26] := 1/o[25];
-      o[27] := o[1]*o[2]*o[22]*tau1;
-      o[28] := 1/o[27];
-      o[29] := o[1]*o[2]*o[22];
-      o[30] := 1/o[29];
-      o[31] := o[1]*o[2]*o[21]*o[3]*tau1;
-      o[32] := 1/o[31];
-      o[33] := o[2]*o[21]*o[3]*tau1;
-      o[34] := 1/o[33];
-      o[35] := o[1]*o[3]*tau1;
-      o[36] := 1/o[35];
-      o[37] := o[1]*o[3];
-      o[38] := 1/o[37];
-      o[39] := 1/o[6];
-      o[40] := o[1]*o[22]*o[3];
-      o[41] := 1/o[40];
-      o[42] := 1/o[22];
-      o[43] := o[1]*o[2]*o[21]*o[3];
-      o[44] := 1/o[43];
-      o[45] := 1/o[13];
-      g.g := pi1*(pi1*(pi1*(o[10]*(-0.000031679644845054 + o[2]*(-2.82707979853120e-6
-         - 8.5205128120103e-10*o[6])) + pi1*(o[12]*(-2.24252819080000e-6 + (-6.5171222895601e-7
-         - 1.43417299379240e-13*o[13])*o[7]) + pi1*(-4.0516996860117e-7*o[14]
-         + o[16]*((-1.27343017416410e-9 - 1.74248712306340e-10*o[11])*o[36]
-         + o[19]*(-6.8762131295531e-19*o[34] + o[15]*(1.44783078285210e-20*o[
-        32] + o[20]*(2.63357816627950e-23*o[30] + pi1*(-1.19476226400710e-23*
-        o[28] + pi1*(1.82280945814040e-24*o[26] - 9.3537087292458e-26*o[24]*
-        pi1))))))))) + o[8]*(-0.00047184321073267 + o[7]*(-0.000300017807930260
-         + (0.000047661393906987 + o[1]*(-4.4141845330846e-6 -
-        7.2694996297594e-16*o[9]))*tau1))) + o[5]*(0.000283190801238040 + o[1]
-        *(-0.00060706301565874 + o[6]*(-0.0189900682184190 + tau1*(-0.032529748770505
-         + (-0.0218417171754140 - 0.000052838357969930*o[1])*tau1))))) + (
-        0.146329712131670 + tau1*(-0.84548187169114 + tau1*(-3.7563603672040
-         + tau1*(3.3855169168385 + tau1*(-0.95791963387872 + tau1*(
-        0.157720385132280 + (-0.0166164171995010 + 0.00081214629983568*tau1)*
-        tau1))))))/o[1];
-
-      g.gpi := pi1*(pi1*(o[10]*(0.000095038934535162 + o[2]*(
-        8.4812393955936e-6 + 2.55615384360309e-9*o[6])) + pi1*(o[12]*(
-        8.9701127632000e-6 + (2.60684891582404e-6 + 5.7366919751696e-13*o[13])
-        *o[7]) + pi1*(2.02584984300585e-6*o[14] + o[16]*((1.01874413933128e-8
-         + 1.39398969845072e-9*o[11])*o[36] + o[19]*(1.44400475720615e-17*o[
-        34] + o[15]*(-3.3300108005598e-19*o[32] + o[20]*(-7.6373766822106e-22
-        *o[30] + pi1*(3.5842867920213e-22*o[28] + pi1*(-5.6507093202352e-23*o[
-        26] + 2.99318679335866e-24*o[24]*pi1))))))))) + o[8]*(
-        0.00094368642146534 + o[7]*(0.00060003561586052 + (-0.000095322787813974
-         + o[1]*(8.8283690661692e-6 + 1.45389992595188e-15*o[9]))*tau1))) + o[
-        5]*(-0.000283190801238040 + o[1]*(0.00060706301565874 + o[6]*(
-        0.0189900682184190 + tau1*(0.032529748770505 + (0.0218417171754140 +
-        0.000052838357969930*o[1])*tau1))));
-
-      g.gpipi := pi1*(o[10]*(-0.000190077869070324 + o[2]*(-0.0000169624787911872
-         - 5.1123076872062e-9*o[6])) + pi1*(o[12]*(-0.0000269103382896000 + (
-        -7.8205467474721e-6 - 1.72100759255088e-12*o[13])*o[7]) + pi1*(-8.1033993720234e-6
-        *o[14] + o[16]*((-7.1312089753190e-8 - 9.7579278891550e-9*o[11])*o[36]
-         + o[19]*(-2.88800951441230e-16*o[34] + o[15]*(7.3260237612316e-18*o[
-        32] + o[20]*(2.13846547101895e-20*o[30] + pi1*(-1.03944316968618e-20*
-        o[28] + pi1*(1.69521279607057e-21*o[26] - 9.2788790594118e-23*o[24]*
-        pi1))))))))) + o[8]*(-0.00094368642146534 + o[7]*(-0.00060003561586052
-         + (0.000095322787813974 + o[1]*(-8.8283690661692e-6 -
-        1.45389992595188e-15*o[9]))*tau1));
-
-      g.gtau := pi1*(o[38]*(-0.00254871721114236 + o[1]*(0.0042494411096112
-         + (0.0189900682184190 + (-0.0218417171754140 - 0.000158515073909790*
-        o[1])*o[1])*o[6])) + pi1*(o[10]*(0.00141552963219801 + o[2]*(
-        0.000047661393906987 + o[1]*(-0.0000132425535992538 -
-        1.23581493705910e-14*o[9]))) + pi1*(o[12]*(0.000126718579380216 -
-        5.1123076872062e-9*o[37]) + pi1*(o[39]*(0.0000112126409540000 + (
-        1.30342445791202e-6 - 1.43417299379240e-12*o[13])*o[7]) + pi1*(
-        3.2413597488094e-6*o[5] + o[16]*((1.40077319158051e-8 +
-        1.04549227383804e-9*o[11])*o[45] + o[19]*(1.99410180757040e-17*o[44]
-         + o[15]*(-4.4882754268415e-19*o[42] + o[20]*(-1.00075970318621e-21*o[
-        28] + pi1*(4.6595728296277e-22*o[26] + pi1*(-7.2912378325616e-23*o[24]
-         + 3.8350205789908e-24*o[41]*pi1))))))))))) + o[8]*(-0.292659424263340
-         + tau1*(0.84548187169114 + o[1]*(3.3855169168385 + tau1*(-1.91583926775744
-         + tau1*(0.47316115539684 + (-0.066465668798004 + 0.0040607314991784*
-        tau1)*tau1)))));
-
-      g.gtautau := pi1*(o[36]*(0.0254871721114236 + o[1]*(-0.033995528876889
-         + (-0.037980136436838 - 0.00031703014781958*o[2])*o[6])) + pi1*(o[12]
-        *(-0.0056621185287920 + o[6]*(-0.0000264851071985076 -
-        1.97730389929456e-13*o[9])) + pi1*((-0.00063359289690108 -
-        2.55615384360309e-8*o[37])*o[39] + pi1*(pi1*(-0.0000291722377392842*o[
-        38] + o[16]*(o[19]*(-5.9823054227112e-16*o[32] + o[15]*(o[20]*(
-        3.9029628424262e-20*o[26] + pi1*(-1.86382913185108e-20*o[24] + pi1*(
-        2.98940751135026e-21*o[41] - (1.61070864317613e-22*pi1)/(o[1]*o[22]*o[
-        3]*tau1)))) + 1.43624813658928e-17/(o[22]*tau1))) + (-1.68092782989661e-7
-         - 7.3184459168663e-9*o[11])/(o[2]*o[3]*tau1))) + (-0.000067275845724000
-         + (-3.9102733737361e-6 - 1.29075569441316e-11*o[13])*o[7])/(o[1]*o[2]
-        *tau1))))) + o[10]*(0.87797827279002 + tau1*(-1.69096374338228 + o[7]
-        *(-1.91583926775744 + tau1*(0.94632231079368 + (-0.199397006394012 +
-        0.0162429259967136*tau1)*tau1))));
-
-      g.gtaupi := o[38]*(0.00254871721114236 + o[1]*(-0.0042494411096112 + (-0.0189900682184190
-         + (0.0218417171754140 + 0.000158515073909790*o[1])*o[1])*o[6])) +
-        pi1*(o[10]*(-0.00283105926439602 + o[2]*(-0.000095322787813974 + o[1]
-        *(0.0000264851071985076 + 2.47162987411820e-14*o[9]))) + pi1*(o[12]*(
-        -0.00038015573814065 + 1.53369230616185e-8*o[37]) + pi1*(o[39]*(-0.000044850563816000
-         + (-5.2136978316481e-6 + 5.7366919751696e-12*o[13])*o[7]) + pi1*(-0.0000162067987440468
-        *o[5] + o[16]*((-1.12061855326441e-7 - 8.3639381907043e-9*o[11])*o[45]
-         + o[19]*(-4.1876137958978e-16*o[44] + o[15]*(1.03230334817355e-17*o[
-        42] + o[20]*(2.90220313924001e-20*o[28] + pi1*(-1.39787184888831e-20*
-        o[26] + pi1*(2.26028372809410e-21*o[24] - 1.22720658527705e-22*o[41]*
-        pi1))))))))));
-    end g1;
-
-    function g2 "Gibbs function for region 2: g(p,T)"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      output ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs
-                                g
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-    protected
-      Real tau2 "dimensionless temperature";
-      Real[55] o "vector of auxiliary variables";
-    algorithm
-      g.p := p;
-      g.T := T;
-      g.R := data.RH2O;
-    //   assert(p > triple.ptriple,
-    //     "IF97 medium function g2 called with too low pressure\n" +
-    //     "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
-    //   assert(p <= 100.0e6,
-    //     "IF97 medium function g2: the input pressure (= " + String(p) + " Pa) is higher than 100 Mpa");
-    //   assert(T >= 273.15,
-    //     "IF97 medium function g2: the temperature (= " + String(T) + " K) is lower than 273.15 K!");
-    //   assert(T <= 1073.15,
-    //     "IF97 medium function g2: the input temperature (= " + String(T) + " K) is higher than the limit of 1073.15 K");
-      g.pi := max(p,triple.ptriple)/data.PSTAR2;
-      g.tau := data.TSTAR2/max(T,triple.Ttriple);
-      tau2 := -0.5 + g.tau;
-      o[1] := tau2*tau2;
-      o[2] := o[1]*tau2;
-      o[3] := -0.050325278727930*o[2];
-      o[4] := -0.057581259083432 + o[3];
-      o[5] := o[4]*tau2;
-      o[6] := -0.045996013696365 + o[5];
-      o[7] := o[6]*tau2;
-      o[8] := -0.0178348622923580 + o[7];
-      o[9] := o[8]*tau2;
-      o[10] := o[1]*o[1];
-      o[11] := o[10]*o[10];
-      o[12] := o[11]*o[11];
-      o[13] := o[10]*o[11]*o[12]*tau2;
-      o[14] := o[1]*o[10]*tau2;
-      o[15] := o[10]*o[11]*tau2;
-      o[16] := o[1]*o[12]*tau2;
-      o[17] := o[1]*o[11]*tau2;
-      o[18] := o[1]*o[10]*o[11];
-      o[19] := o[10]*o[11]*o[12];
-      o[20] := o[1]*o[10];
-      o[21] := g.pi*g.pi;
-      o[22] := o[21]*o[21];
-      o[23] := o[21]*o[22];
-      o[24] := o[10]*o[12]*tau2;
-      o[25] := o[12]*o[12];
-      o[26] := o[11]*o[12]*o[25]*tau2;
-      o[27] := o[10]*o[12];
-      o[28] := o[1]*o[10]*o[11]*tau2;
-      o[29] := o[10]*o[12]*o[25]*tau2;
-      o[30] := o[1]*o[10]*o[25]*tau2;
-      o[31] := o[1]*o[11]*o[12];
-      o[32] := o[1]*o[12];
-      o[33] := g.tau*g.tau;
-      o[34] := o[33]*o[33];
-      o[35] := -0.000053349095828174*o[13];
-      o[36] := -0.087594591301146 + o[35];
-      o[37] := o[2]*o[36];
-      o[38] := -0.0078785554486710 + o[37];
-      o[39] := o[1]*o[38];
-      o[40] := -0.00037897975032630 + o[39];
-      o[41] := o[40]*tau2;
-      o[42] := -0.000066065283340406 + o[41];
-      o[43] := o[42]*tau2;
-      o[44] := 5.7870447262208e-6*tau2;
-      o[45] := -0.301951672367580*o[2];
-      o[46] := -0.172743777250296 + o[45];
-      o[47] := o[46]*tau2;
-      o[48] := -0.091992027392730 + o[47];
-      o[49] := o[48]*tau2;
-      o[50] := o[1]*o[11];
-      o[51] := o[10]*o[11];
-      o[52] := o[11]*o[12]*o[25];
-      o[53] := o[10]*o[12]*o[25];
-      o[54] := o[1]*o[10]*o[25];
-      o[55] := o[11]*o[12]*tau2;
-
-      g.g := g.pi*(-0.00177317424732130 + o[9] + g.pi*(tau2*(-0.000033032641670203
-         + (-0.000189489875163150 + o[1]*(-0.0039392777243355 + (-0.043797295650573
-         - 0.0000266745479140870*o[13])*o[2]))*tau2) + g.pi*(
-        2.04817376923090e-8 + (4.3870667284435e-7 + o[1]*(-0.000032277677238570
-         + (-0.00150339245421480 - 0.040668253562649*o[13])*o[2]))*tau2 + g.
-        pi*(g.pi*(2.29220763376610e-6*o[14] + g.pi*((-1.67147664510610e-11 +
-        o[15]*(-0.00211714723213550 - 23.8957419341040*o[16]))*o[2] + g.pi*(-5.9059564324270e-18
-         + o[17]*(-1.26218088991010e-6 - 0.038946842435739*o[18]) + g.pi*(o[
-        11]*(1.12562113604590e-11 - 8.2311340897998*o[19]) + g.pi*(
-        1.98097128020880e-8*o[15] + g.pi*(o[10]*(1.04069652101740e-19 + (-1.02347470959290e-13
-         - 1.00181793795110e-9*o[10])*o[20]) + o[23]*(o[13]*(-8.0882908646985e-11
-         + 0.106930318794090*o[24]) + o[21]*(-0.33662250574171*o[26] + o[21]*
-        (o[27]*(8.9185845355421e-25 + (3.06293168762320e-13 -
-        4.2002467698208e-6*o[15])*o[28]) + g.pi*(-5.9056029685639e-26*o[24]
-         + g.pi*(3.7826947613457e-6*o[29] + g.pi*(-1.27686089346810e-15*o[30]
-         + o[31]*(7.3087610595061e-29 + o[18]*(5.5414715350778e-17 -
-        9.4369707241210e-7*o[32]))*g.pi)))))))))))) + tau2*(-7.8847309559367e-10
-         + (1.27907178522850e-8 + 4.8225372718507e-7*tau2)*tau2))))) + (-0.0056087911830200
-         + g.tau*(0.071452738814550 + g.tau*(-0.40710498239280 + g.tau*(
-        1.42408197144400 + g.tau*(-4.3839511194500 + g.tau*(-9.6927686002170
-         + g.tau*(10.0866556801800 + (-0.284086326077200 + 0.0212684635330700
-        *g.tau)*g.tau) + Modelica.Math.log(g.pi)))))))/(o[34]*g.tau);
-
-      g.gpi := (1.00000000000000 + g.pi*(-0.00177317424732130 + o[9] + g.pi*(
-        o[43] + g.pi*(6.1445213076927e-8 + (1.31612001853305e-6 + o[1]*(-0.000096833031715710
-         + (-0.0045101773626444 - 0.122004760687947*o[13])*o[2]))*tau2 + g.pi
-        *(g.pi*(0.0000114610381688305*o[14] + g.pi*((-1.00288598706366e-10 +
-        o[15]*(-0.0127028833928130 - 143.374451604624*o[16]))*o[2] + g.pi*(-4.1341695026989e-17
-         + o[17]*(-8.8352662293707e-6 - 0.272627897050173*o[18]) + g.pi*(o[11]
-        *(9.0049690883672e-11 - 65.849072718398*o[19]) + g.pi*(
-        1.78287415218792e-7*o[15] + g.pi*(o[10]*(1.04069652101740e-18 + (-1.02347470959290e-12
-         - 1.00181793795110e-8*o[10])*o[20]) + o[23]*(o[13]*(-1.29412653835176e-9
-         + 1.71088510070544*o[24]) + o[21]*(-6.0592051033508*o[26] + o[21]*(o[
-        27]*(1.78371690710842e-23 + (6.1258633752464e-12 -
-        0.000084004935396416*o[15])*o[28]) + g.pi*(-1.24017662339842e-24*o[24]
-         + g.pi*(0.000083219284749605*o[29] + g.pi*(-2.93678005497663e-14*o[
-        30] + o[31]*(1.75410265428146e-27 + o[18]*(1.32995316841867e-15 -
-        0.0000226487297378904*o[32]))*g.pi)))))))))))) + tau2*(-3.15389238237468e-9
-         + (5.1162871409140e-8 + 1.92901490874028e-6*tau2)*tau2))))))/g.pi;
-
-      g.gpipi := (-1.00000000000000 + o[21]*(o[43] + g.pi*(
-        1.22890426153854e-7 + (2.63224003706610e-6 + o[1]*(-0.000193666063431420
-         + (-0.0090203547252888 - 0.244009521375894*o[13])*o[2]))*tau2 + g.pi
-        *(g.pi*(0.000045844152675322*o[14] + g.pi*((-5.0144299353183e-10 + o[
-        15]*(-0.063514416964065 - 716.87225802312*o[16]))*o[2] + g.pi*(-2.48050170161934e-16
-         + o[17]*(-0.000053011597376224 - 1.63576738230104*o[18]) + g.pi*(o[
-        11]*(6.3034783618570e-10 - 460.94350902879*o[19]) + g.pi*(
-        1.42629932175034e-6*o[15] + g.pi*(o[10]*(9.3662686891566e-18 + (-9.2112723863361e-12
-         - 9.0163614415599e-8*o[10])*o[20]) + o[23]*(o[13]*(-1.94118980752764e-8
-         + 25.6632765105816*o[24]) + o[21]*(-103.006486756963*o[26] + o[21]*(
-        o[27]*(3.3890621235060e-22 + (1.16391404129682e-10 -
-        0.00159609377253190*o[15])*o[28]) + g.pi*(-2.48035324679684e-23*o[24]
-         + g.pi*(0.00174760497974171*o[29] + g.pi*(-6.4609161209486e-13*o[30]
-         + o[31]*(4.0344361048474e-26 + o[18]*(3.05889228736295e-14 -
-        0.00052092078397148*o[32]))*g.pi)))))))))))) + tau2*(-9.4616771471240e-9
-         + (1.53488614227420e-7 + o[44])*tau2)))))/o[21];
-
-      g.gtau := (0.0280439559151000 + g.tau*(-0.285810955258200 + g.tau*(
-        1.22131494717840 + g.tau*(-2.84816394288800 + g.tau*(4.3839511194500
-         + o[33]*(10.0866556801800 + (-0.56817265215440 + 0.063805390599210*g.
-         tau)*g.tau))))))/(o[33]*o[34]) + g.pi*(-0.0178348622923580 + o[49]
-         + g.pi*(-0.000033032641670203 + (-0.00037897975032630 + o[1]*(-0.0157571108973420
-         + (-0.306581069554011 - 0.00096028372490713*o[13])*o[2]))*tau2 + g.
-        pi*(4.3870667284435e-7 + o[1]*(-0.000096833031715710 + (-0.0090203547252888
-         - 1.42338887469272*o[13])*o[2]) + g.pi*(-7.8847309559367e-10 + g.pi*
-        (0.0000160454534363627*o[20] + g.pi*(o[1]*(-5.0144299353183e-11 + o[
-        15]*(-0.033874355714168 - 836.35096769364*o[16])) + g.pi*((-0.0000138839897890111
-         - 0.97367106089347*o[18])*o[50] + g.pi*(o[14]*(9.0049690883672e-11
-         - 296.320827232793*o[19]) + g.pi*(2.57526266427144e-7*o[51] + g.pi*(
-        o[2]*(4.1627860840696e-19 + (-1.02347470959290e-12 -
-        1.40254511313154e-8*o[10])*o[20]) + o[23]*(o[19]*(-2.34560435076256e-9
-         + 5.3465159397045*o[24]) + o[21]*(-19.1874828272775*o[52] + o[21]*(o[
-        16]*(1.78371690710842e-23 + (1.07202609066812e-11 -
-        0.000201611844951398*o[15])*o[28]) + g.pi*(-1.24017662339842e-24*o[27]
-         + g.pi*(0.000200482822351322*o[53] + g.pi*(-4.9797574845256e-14*o[54]
-         + (1.90027787547159e-27 + o[18]*(2.21658861403112e-15 -
-        0.000054734430199902*o[32]))*o[55]*g.pi)))))))))))) + (
-        2.55814357045700e-8 + 1.44676118155521e-6*tau2)*tau2))));
-
-      g.gtautau := (-0.168263735490600 + g.tau*(1.42905477629100 + g.tau*(-4.8852597887136
-         + g.tau*(8.5444918286640 + g.tau*(-8.7679022389000 + o[33]*(-0.56817265215440
-         + 0.127610781198420*g.tau)*g.tau)))))/(o[33]*o[34]*g.tau) + g.pi*(-0.091992027392730
-         + (-0.34548755450059 - 1.50975836183790*o[2])*tau2 + g.pi*(-0.00037897975032630
-         + o[1]*(-0.047271332692026 + (-1.83948641732407 - 0.033609930371750*
-        o[13])*o[2]) + g.pi*((-0.000193666063431420 + (-0.045101773626444 -
-        48.395221739552*o[13])*o[2])*tau2 + g.pi*(2.55814357045700e-8 +
-        2.89352236311042e-6*tau2 + g.pi*(0.000096272720618176*o[10]*tau2 + g.
-        pi*((-1.00288598706366e-10 + o[15]*(-0.50811533571252 -
-        28435.9329015838*o[16]))*tau2 + g.pi*(o[11]*(-0.000138839897890111 -
-        23.3681054614434*o[18])*tau2 + g.pi*((6.3034783618570e-10 -
-        10371.2289531477*o[19])*o[20] + g.pi*(3.09031519712573e-6*o[17] + g.
-        pi*(o[1]*(1.24883582522088e-18 + (-9.2112723863361e-12 -
-        1.82330864707100e-7*o[10])*o[20]) + o[23]*(o[1]*o[11]*o[12]*(-6.5676921821352e-8
-         + 261.979281045521*o[24])*tau2 + o[21]*(-1074.49903832754*o[1]*o[10]
-        *o[12]*o[25]*tau2 + o[21]*((3.3890621235060e-22 + (
-        3.6448887082716e-10 - 0.0094757567127157*o[15])*o[28])*o[32] + g.pi*(
-        -2.48035324679684e-23*o[16] + g.pi*(0.0104251067622687*o[1]*o[12]*o[
-        25]*tau2 + g.pi*(o[11]*o[12]*(4.7506946886790e-26 + o[18]*(
-        8.6446955947214e-14 - 0.00311986252139440*o[32]))*g.pi -
-        1.89230784411972e-12*o[10]*o[25]*tau2))))))))))))))));
-
-      g.gtaupi := -0.0178348622923580 + o[49] + g.pi*(-0.000066065283340406
-         + (-0.00075795950065260 + o[1]*(-0.0315142217946840 + (-0.61316213910802
-         - 0.00192056744981426*o[13])*o[2]))*tau2 + g.pi*(1.31612001853305e-6
-         + o[1]*(-0.000290499095147130 + (-0.0270610641758664 -
-        4.2701666240781*o[13])*o[2]) + g.pi*(-3.15389238237468e-9 + g.pi*(
-        0.000080227267181813*o[20] + g.pi*(o[1]*(-3.00865796119098e-10 + o[15]
-        *(-0.203246134285008 - 5018.1058061618*o[16])) + g.pi*((-0.000097187928523078
-         - 6.8156974262543*o[18])*o[50] + g.pi*(o[14]*(7.2039752706938e-10 -
-        2370.56661786234*o[19]) + g.pi*(2.31773639784430e-6*o[51] + g.pi*(o[2]
-        *(4.1627860840696e-18 + (-1.02347470959290e-11 - 1.40254511313154e-7*
-        o[10])*o[20]) + o[23]*(o[19]*(-3.7529669612201e-8 + 85.544255035272*o[
-        24]) + o[21]*(-345.37469089099*o[52] + o[21]*(o[16]*(
-        3.5674338142168e-22 + (2.14405218133624e-10 - 0.0040322368990280*o[15])
-        *o[28]) + g.pi*(-2.60437090913668e-23*o[27] + g.pi*(
-        0.0044106220917291*o[53] + g.pi*(-1.14534422144089e-12*o[54] + (
-        4.5606669011318e-26 + o[18]*(5.3198126736747e-14 -
-        0.00131362632479764*o[32]))*o[55]*g.pi)))))))))))) + (
-        1.02325742818280e-7 + o[44])*tau2)));
-    end g2;
-
-    function g2metastable
-      "Gibbs function for metastable part of region 2: g(p,T)"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      output ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs
-                                g
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-    protected
-      Real pi "dimensionless pressure";
-      Real tau "dimensionless temperature";
-      Real tau2 "dimensionless temperature";
-      Real[27] o "vector of auxiliary variables";
-    algorithm
-      assert(p > triple.ptriple,
-        "IF97 medium function g2metastable called with too low pressure\n" +
-        "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
-      assert(p <= 100.0e6,
-        "IF97 medium function g2metastable: the input pressure (= " + String(p) + " Pa) is higher than 100 Mpa");
-      assert(T >= 273.15,
-        "IF97 medium function g2metastable: the temperature (= " + String(T) + " K) is lower than 273.15 K!");
-      assert(T <= 1073.15,
-        "IF97 medium function g2metastable: the input temperature (= " + String(T) + " K) is higher than the limit of 1073.15 K");
-      g.p := p;
-      g.T := T;
-      g.R := data.RH2O;
-      g.pi := p/data.PSTAR2;
-      g.tau := data.TSTAR2/T;
-      tau2 := -0.5 + g.tau;
-      o[1] := tau2*tau2;
-      o[2] := o[1]*tau2;
-      o[3] := o[1]*o[1];
-      o[4] := o[1]*o[3];
-      o[5] := -0.0040813178534455*o[4];
-      o[6] := -0.072334555213245 + o[5];
-      o[7] := o[2]*o[6];
-      o[8] := -0.088223831943146 + o[7];
-      o[9] := o[1]*o[8];
-      o[10] := o[3]*o[3];
-      o[11] := o[10]*tau2;
-      o[12] := o[10]*o[3];
-      o[13] := o[1]*o[3]*tau2;
-      o[14] := g.tau*g.tau;
-      o[15] := o[14]*o[14];
-      o[16] := -0.015238081817394*o[11];
-      o[17] := -0.106091843797284 + o[16];
-      o[18] := o[17]*o[4];
-      o[19] := 0.0040195606760414 + o[18];
-      o[20] := o[19]*tau2;
-      o[21] := g.pi*g.pi;
-      o[22] := -0.0448944963879005*o[4];
-      o[23] := -0.361672776066225 + o[22];
-      o[24] := o[2]*o[23];
-      o[25] := -0.176447663886292 + o[24];
-      o[26] := o[25]*tau2;
-      o[27] := o[3]*tau2;
-
-      g.g := g.pi*(-0.0073362260186506 + o[9] + g.pi*(g.pi*((-0.0063498037657313
-         - 0.086043093028588*o[12])*o[3] + g.pi*(o[13]*(0.007532158152277 -
-        0.0079238375446139*o[2]) + o[11]*g.pi*(-0.00022888160778447 -
-        0.002645650148281*tau2))) + (0.0020097803380207 + (-0.053045921898642
-         - 0.007619040908697*o[11])*o[4])*tau2)) + (-0.00560879118302 + g.tau
-        *(0.07145273881455 + g.tau*(-0.4071049823928 + g.tau*(1.424081971444
-         + g.tau*(-4.38395111945 + g.tau*(-9.6937268393049 + g.tau*(
-        10.087275970006 + (-0.2840863260772 + 0.02126846353307*g.tau)*g.tau)
-         + Modelica.Math.log(g.pi)))))))/(o[15]*g.tau);
-
-      g.gpi := (1.0 + g.pi*(-0.0073362260186506 + o[9] + g.pi*(o[20] + g.pi*(
-        (-0.0190494112971939 - 0.258129279085764*o[12])*o[3] + g.pi*(o[13]*(
-        0.030128632609108 - 0.0316953501784556*o[2]) + o[11]*g.pi*(-0.00114440803892235
-         - 0.013228250741405*tau2))))))/g.pi;
-
-      g.gpipi := (-1. + o[21]*(o[20] + g.pi*((-0.0380988225943878 -
-        0.516258558171528*o[12])*o[3] + g.pi*(o[13]*(0.090385897827324 -
-        0.0950860505353668*o[2]) + o[11]*g.pi*(-0.0045776321556894 -
-        0.05291300296562*tau2)))))/o[21];
-
-      g.gtau := (0.0280439559151 + g.tau*(-0.2858109552582 + g.tau*(
-        1.2213149471784 + g.tau*(-2.848163942888 + g.tau*(4.38395111945 + o[
-        14]*(10.087275970006 + (-0.5681726521544 + 0.06380539059921*g.tau)*g.
-        tau))))))/(o[14]*o[15]) + g.pi*(o[26] + g.pi*(0.0020097803380207 + (-0.371321453290494
-         - 0.121904654539152*o[11])*o[4] + g.pi*((-0.0253992150629252 -
-        1.37668948845741*o[12])*o[2] + g.pi*((0.052725107065939 -
-        0.079238375446139*o[2])*o[4] + o[10]*g.pi*(-0.00205993447006023 -
-        0.02645650148281*tau2)))));
-
-      g.gtautau := (-0.1682637354906 + g.tau*(1.429054776291 + g.tau*(-4.8852597887136
-         + g.tau*(8.544491828664 + g.tau*(-8.7679022389 + o[14]*(-0.5681726521544
-         + 0.12761078119842*g.tau)*g.tau)))))/(o[14]*o[15]*g.tau) + g.pi*(-0.176447663886292
-         + o[2]*(-1.4466911042649 - 0.448944963879005*o[4]) + g.pi*((-2.22792871974296
-         - 1.82856981808728*o[11])*o[27] + g.pi*(o[1]*(-0.0761976451887756 -
-        20.6503423268611*o[12]) + g.pi*((0.316350642395634 -
-        0.713145379015251*o[2])*o[27] + o[13]*g.pi*(-0.0164794757604818 -
-        0.23810851334529*tau2)))));
-
-      g.gtaupi := o[26] + g.pi*(0.0040195606760414 + (-0.742642906580988 -
-        0.243809309078304*o[11])*o[4] + g.pi*((-0.0761976451887756 -
-        4.13006846537222*o[12])*o[2] + g.pi*((0.210900428263756 -
-        0.316953501784556*o[2])*o[4] + o[10]*g.pi*(-0.0102996723503012 -
-        0.13228250741405*tau2))));
-    end g2metastable;
-
-    function f3 "Helmholtz function for region 3: f(d,T)"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      output ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs
-                                    f
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-    protected
-      Real[40] o "vector of auxiliary variables";
-    algorithm
-      f.T := T;
-      f.d := d;
-      f.R := data.RH2O;
-      f.tau := data.TCRIT/T;
-      f.delta := if (d == data.DCRIT and T == data.TCRIT) then 1 - Modelica.
-        Constants.eps else abs(d/data.DCRIT);
-      o[1] := f.tau*f.tau;
-      o[2] := o[1]*o[1];
-      o[3] := o[2]*f.tau;
-      o[4] := o[1]*f.tau;
-      o[5] := o[2]*o[2];
-      o[6] := o[1]*o[5]*f.tau;
-      o[7] := o[5]*f.tau;
-      o[8] := -0.64207765181607*o[1];
-      o[9] := 0.88521043984318 + o[8];
-      o[10] := o[7]*o[9];
-      o[11] := -1.15244078066810 + o[10];
-      o[12] := o[11]*o[2];
-      o[13] := -1.26543154777140 + o[12];
-      o[14] := o[1]*o[13];
-      o[15] := o[1]*o[2]*o[5]*f.tau;
-      o[16] := o[2]*o[5];
-      o[17] := o[1]*o[5];
-      o[18] := o[5]*o[5];
-      o[19] := o[1]*o[18]*o[2];
-      o[20] := o[1]*o[18]*o[2]*f.tau;
-      o[21] := o[18]*o[5];
-      o[22] := o[1]*o[18]*o[5];
-      o[23] := 0.251168168486160*o[2];
-      o[24] := 0.078841073758308 + o[23];
-      o[25] := o[15]*o[24];
-      o[26] := -6.1005234513930 + o[25];
-      o[27] := o[26]*f.tau;
-      o[28] := 9.7944563083754 + o[27];
-      o[29] := o[2]*o[28];
-      o[30] := -1.70429417648412 + o[29];
-      o[31] := o[1]*o[30];
-      o[32] := f.delta*f.delta;
-      o[33] := -10.9153200808732*o[1];
-      o[34] := 13.2781565976477 + o[33];
-      o[35] := o[34]*o[7];
-      o[36] := -6.9146446840086 + o[35];
-      o[37] := o[2]*o[36];
-      o[38] := -2.53086309554280 + o[37];
-      o[39] := o[38]*f.tau;
-      o[40] := o[18]*o[5]*f.tau;
-
-      f.f := -15.7328452902390 + f.tau*(20.9443969743070 + (-7.6867707878716
-         + o[3]*(2.61859477879540 + o[4]*(-2.80807811486200 + o[1]*(
-        1.20533696965170 - 0.0084566812812502*o[6]))))*f.tau) + f.delta*(o[14]
-         + f.delta*(0.38493460186671 + o[1]*(-0.85214708824206 + o[2]*(
-        4.8972281541877 + (-3.05026172569650 + o[15]*(0.039420536879154 +
-        0.125584084243080*o[2]))*f.tau)) + f.delta*(-0.279993296987100 + o[1]
-        *(1.38997995694600 + o[1]*(-2.01899150235700 + o[16]*(-0.0082147637173963
-         - 0.47596035734923*o[17]))) + f.delta*(0.043984074473500 + o[1]*(-0.44476435428739
-         + o[1]*(0.90572070719733 + 0.70522450087967*o[19])) + f.delta*(f.
-        delta*(-0.0221754008730960 + o[1]*(0.094260751665092 +
-        0.164362784479610*o[21]) + f.delta*(-0.0135033722413480*o[1] + f.
-        delta*(-0.0148343453524720*o[22] + f.delta*(o[1]*(0.00057922953628084
-         + 0.0032308904703711*o[21]) + f.delta*(0.000080964802996215 -
-        0.000044923899061815*f.delta*o[22] - 0.000165576797950370*f.tau)))))
-         + (0.107705126263320 + o[1]*(-0.32913623258954 - 0.50871062041158*o[
-        20]))*f.tau))))) + 1.06580700285130*Modelica.Math.log(f.delta);
-
-      f.fdelta := (1.06580700285130 + f.delta*(o[14] + f.delta*(
-        0.76986920373342 + o[31] + f.delta*(-0.83997989096130 + o[1]*(
-        4.1699398708380 + o[1]*(-6.0569745070710 + o[16]*(-0.0246442911521889
-         - 1.42788107204769*o[17]))) + f.delta*(0.175936297894000 + o[1]*(-1.77905741714956
-         + o[1]*(3.6228828287893 + 2.82089800351868*o[19])) + f.delta*(f.
-        delta*(-0.133052405238576 + o[1]*(0.56556450999055 + 0.98617670687766
-        *o[21]) + f.delta*(-0.094523605689436*o[1] + f.delta*(-0.118674762819776
-        *o[22] + f.delta*(o[1]*(0.0052130658265276 + 0.0290780142333399*o[21])
-         + f.delta*(0.00080964802996215 - 0.00049416288967996*f.delta*o[22]
-         - 0.00165576797950370*f.tau))))) + (0.53852563131660 + o[1]*(-1.64568116294770
-         - 2.54355310205790*o[20]))*f.tau))))))/f.delta;
-
-      f.fdeltadelta := (-1.06580700285130 + o[32]*(0.76986920373342 + o[31]
-         + f.delta*(-1.67995978192260 + o[1]*(8.3398797416760 + o[1]*(-12.1139490141420
-         + o[16]*(-0.049288582304378 - 2.85576214409538*o[17]))) + f.delta*(
-        0.52780889368200 + o[1]*(-5.3371722514487 + o[1]*(10.8686484863680 +
-        8.4626940105560*o[19])) + f.delta*(f.delta*(-0.66526202619288 + o[1]*
-        (2.82782254995276 + 4.9308835343883*o[21]) + f.delta*(-0.56714163413662
-        *o[1] + f.delta*(-0.83072333973843*o[22] + f.delta*(o[1]*(
-        0.041704526612220 + 0.232624113866719*o[21]) + f.delta*(
-        0.0072868322696594 - 0.0049416288967996*f.delta*o[22] -
-        0.0149019118155333*f.tau))))) + (2.15410252526640 + o[1]*(-6.5827246517908
-         - 10.1742124082316*o[20]))*f.tau)))))/o[32];
-
-      f.ftau := 20.9443969743070 + (-15.3735415757432 + o[3]*(
-        18.3301634515678 + o[4]*(-28.0807811486200 + o[1]*(14.4640436358204
-         - 0.194503669468755*o[6]))))*f.tau + f.delta*(o[39] + f.delta*(f.tau
-        *(-1.70429417648412 + o[2]*(29.3833689251262 + (-21.3518320798755 + o[
-        15]*(0.86725181134139 + 3.2651861903201*o[2]))*f.tau)) + f.delta*((
-        2.77995991389200 + o[1]*(-8.0759660094280 + o[16]*(-0.131436219478341
-         - 12.3749692910800*o[17])))*f.tau + f.delta*((-0.88952870857478 + o[
-        1]*(3.6228828287893 + 18.3358370228714*o[19]))*f.tau + f.delta*(
-        0.107705126263320 + o[1]*(-0.98740869776862 - 13.2264761307011*o[20])
-         + f.delta*((0.188521503330184 + 4.2734323964699*o[21])*f.tau + f.
-        delta*(-0.0270067444826960*f.tau + f.delta*(-0.38569297916427*o[40]
-         + f.delta*(f.delta*(-0.000165576797950370 - 0.00116802137560719*f.
-        delta*o[40]) + (0.00115845907256168 + 0.084003152229649*o[21])*f.tau)))))))));
-
-      f.ftautau := -15.3735415757432 + o[3]*(109.980980709407 + o[4]*(-252.727030337580
-         + o[1]*(159.104479994024 - 4.2790807283126*o[6]))) + f.delta*(-2.53086309554280
-         + o[2]*(-34.573223420043 + (185.894192367068 - 174.645121293971*o[1])
-        *o[7]) + f.delta*(-1.70429417648412 + o[2]*(146.916844625631 + (-128.110992479253
-         + o[15]*(18.2122880381691 + 81.629654758002*o[2]))*f.tau) + f.delta*
-        (2.77995991389200 + o[1]*(-24.2278980282840 + o[16]*(-1.97154329217511
-         - 309.374232277000*o[17])) + f.delta*(-0.88952870857478 + o[1]*(
-        10.8686484863680 + 458.39592557179*o[19]) + f.delta*(f.delta*(
-        0.188521503330184 + 106.835809911747*o[21] + f.delta*(-0.0270067444826960
-         + f.delta*(-9.6423244791068*o[21] + f.delta*(0.00115845907256168 +
-        2.10007880574121*o[21] - 0.0292005343901797*o[21]*o[32])))) + (-1.97481739553724
-         - 330.66190326753*o[20])*f.tau)))));
-
-      f.fdeltatau := o[39] + f.delta*(f.tau*(-3.4085883529682 + o[2]*(
-        58.766737850252 + (-42.703664159751 + o[15]*(1.73450362268278 +
-        6.5303723806402*o[2]))*f.tau)) + f.delta*((8.3398797416760 + o[1]*(-24.2278980282840
-         + o[16]*(-0.39430865843502 - 37.124907873240*o[17])))*f.tau + f.
-        delta*((-3.5581148342991 + o[1]*(14.4915313151573 + 73.343348091486*o[
-        19]))*f.tau + f.delta*(0.53852563131660 + o[1]*(-4.9370434888431 -
-        66.132380653505*o[20]) + f.delta*((1.13112901998110 +
-        25.6405943788192*o[21])*f.tau + f.delta*(-0.189047211378872*f.tau + f.
-         delta*(-3.08554383331418*o[40] + f.delta*(f.delta*(-0.00165576797950370
-         - 0.0128482351316791*f.delta*o[40]) + (0.0104261316530551 +
-        0.75602837006684*o[21])*f.tau))))))));
-    end f3;
-
-    function g5 "base function for region 5: g(p,T)"
-            extends Modelica.Icons.Function;
-            input Modelica.SIunits.Pressure p "pressure";
-            input Modelica.SIunits.Temperature T "temperature (K)";
-            output Modelica.Media.Common.GibbsDerivs g
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-    protected
-            Real[11] o "vector of auxiliary variables";
-    algorithm
-    //         assert(p > triple.ptriple,
-    //           "IF97 medium function g5 called with too low pressure\n" +
-    //           "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
-    //         assert(p <= data.PLIMIT5,
-    //           "IF97 medium function g5: input pressure (= " + String(p) + " Pa) is higher than 10 Mpa in region 5");
-    //         assert(T <= 2273.15,
-    //           "IF97 medium function g5: input temperature (= " + String(T) + " K) is higher than limit of 2273.15K in region 5");
-            g.p := p;
-            g.T := T;
-            g.R := data.RH2O;
-            g.pi := max(p,triple.ptriple)/data.PSTAR5;
-            g.tau := data.TSTAR5/max(T,triple.Ttriple);
-            o[1] := g.tau*g.tau;
-            o[2] := -0.0045942820899910*o[1];
-            o[3] := 0.00217746787145710 + o[2];
-            o[4] := o[3]*g.tau;
-            o[5] := o[1]*g.tau;
-            o[6] := o[1]*o[1];
-            o[7] := o[6]*o[6];
-            o[8] := o[7]*g.tau;
-            o[9] := -7.9449656719138e-6*o[8];
-            o[10] := g.pi*g.pi;
-            o[11] := -0.0137828462699730*o[1];
-
-            g.g := g.pi*(-0.000125631835895920 + o[4] + g.pi*(-3.9724828359569e-6*o[
-              8] + 1.29192282897840e-7*o[5]*g.pi)) + (-0.0248051489334660 + g.tau*(
-              0.36901534980333 + g.tau*(-3.11613182139250 + g.tau*(-13.1799836742010
-               + (6.8540841634434 - 0.32961626538917*g.tau)*g.tau +
-              Modelica.Math.log(g.pi)))))/o[5];
-
-            g.gpi := (1.0 + g.pi*(-0.000125631835895920 + o[4] + g.pi*(o[9] +
-              3.8757684869352e-7*o[5]*g.pi)))/g.pi;
-
-            g.gpipi := (-1.00000000000000 + o[10]*(o[9] + 7.7515369738704e-7*o[5]*g.
-               pi))/o[10];
-
-            g.gtau := g.pi*(0.00217746787145710 + o[11] + g.pi*(-0.000035752345523612
-              *o[7] + 3.8757684869352e-7*o[1]*g.pi)) + (0.074415446800398 + g.tau*(
-              -0.73803069960666 + (3.11613182139250 + o[1]*(6.8540841634434 -
-              0.65923253077834*g.tau))*g.tau))/o[6];
-
-            g.gtautau := (-0.297661787201592 + g.tau*(2.21409209881998 + (-6.2322636427850
-               - 0.65923253077834*o[5])*g.tau))/(o[6]*g.tau) + g.pi*(-0.0275656925399460
-              *g.tau + g.pi*(-0.000286018764188897*o[1]*o[6]*g.tau +
-              7.7515369738704e-7*g.pi*g.tau));
-
-            g.gtaupi := 0.00217746787145710 + o[11] + g.pi*(-0.000071504691047224*o[
-              7] + 1.16273054608056e-6*o[1]*g.pi);
-    end g5;
-
-    function gibbs "Gibbs function for region 1, 2 or 5: g(p,T,region)"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature (K)";
-     input Integer region "IF97 region, 1, 2 or 5";
-      output Real g "dimensionless Gibbs funcion";
-    protected
-      Modelica.Media.Common.GibbsDerivs gibbs
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-    algorithm
-      assert(region == 1 or region == 2 or region == 5,
-        "IF97 medium function gibbs called with wrong region (= " + String(region) + ").\n" +
-        "Only regions 1, 2 or 5 are possible");
-      if region
-         == 1 then
-        gibbs
-       := g1(p,T);
-      elseif
-      region == 2 then
-        gibbs
-       := g2(p,T);
-      else
-        gibbs
-       := g5(p,T);
-      end if;
-      g :=
-    gibbs.g;
-    end gibbs;
-
-    function g1pitau "derivative of g wrt pi and tau"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      output Real pi "dimensionless pressure";
-      output Real tau "dimensionless temperature";
-      output Real gpi "dimensionless dervative of Gibbs function wrt pi";
-      output Real gtau "dimensionless dervative of Gibbs function wrt tau";
-    protected
-      Real pi1 "dimensionless pressure";
-      Real tau1 "dimensionless temperature";
-      Real[28] o "vector of auxiliary variables";
-    algorithm
-      assert(p > triple.ptriple,
-        "IF97 medium function g1pitau called with too low pressure\n" +
-        "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
-      assert(p <= 100.0e6,
-        "IF97 medium function g1pitau: the input pressure (= " + String(p) + " Pa) is higher than 100 Mpa");
-      assert(T >= 273.15,
-        "IF97 medium function g1pitau: the temperature (= " + String(T) + " K) is lower than 273.15 K!");
-      pi := p/data.PSTAR1;
-      tau := data.TSTAR1/T;
-      pi1 := 7.1 - pi;
-      tau1 := -1.222 + tau;
-      o[1] := tau1*tau1;
-      o[2] := o[1]*tau1;
-      o[3] := 1/o[2];
-      o[4] := o[1]*o[1];
-      o[5] := o[4]*o[4];
-      o[6] := o[1]*o[5];
-      o[7] := o[1]*o[4];
-      o[8] := 1/o[4];
-      o[9] := o[1]*o[4]*o[5];
-      o[10] := o[4]*tau1;
-      o[11] := 1/o[10];
-      o[12] := o[4]*o[5];
-      o[13] := o[5]*tau1;
-      o[14] := 1/o[13];
-      o[15] := pi1*pi1;
-      o[16] := o[15]*pi1;
-      o[17] := o[15]*o[15];
-      o[18] := o[17]*o[17];
-      o[19] := o[17]*o[18]*pi1;
-      o[20] := o[15]*o[17];
-      o[21] := o[5]*o[5];
-      o[22] := o[21]*o[21];
-      o[23] := o[22]*o[5]*tau1;
-      o[24] := 1/o[23];
-      o[25] := o[22]*o[5];
-      o[26] := 1/o[25];
-      o[27] := o[1]*o[22]*o[4]*tau1;
-      o[28] := 1/o[27];
-      gtau := pi1*((-0.00254871721114236 + o[1]*(0.00424944110961118 + (
-        0.018990068218419 + (-0.021841717175414 - 0.00015851507390979*o[1])*o[
-        1])*o[7]))/o[6] + pi1*(o[8]*(0.00141552963219801 + o[4]*(
-        0.000047661393906987 + o[1]*(-0.0000132425535992538 -
-        1.2358149370591e-14*o[9]))) + pi1*(o[11]*(0.000126718579380216 -
-        5.11230768720618e-9*o[6]) + pi1*((0.000011212640954 + (
-        1.30342445791202e-6 - 1.4341729937924e-12*o[12])*o[2])/o[7] + pi1*(
-        3.24135974880936e-6*o[14] + o[16]*((1.40077319158051e-8 +
-        1.04549227383804e-9*o[10])/o[12] + o[19]*(1.9941018075704e-17/(o[1]*o[
-        21]*o[4]*o[5]) + o[15]*(-4.48827542684151e-19/o[22] + o[20]*(-1.00075970318621e-21
-        *o[28] + pi1*(4.65957282962769e-22*o[26] + pi1*(-7.2912378325616e-23*
-        o[24] + (3.83502057899078e-24*pi1)/(o[1]*o[22]*o[5])))))))))))) + o[3]
-        *(-0.29265942426334 + tau1*(0.84548187169114 + o[1]*(3.3855169168385
-         + tau1*(-1.91583926775744 + tau1*(0.47316115539684 + (-0.066465668798004
-         + 0.0040607314991784*tau1)*tau1)))));
-      gpi := pi1*(pi1*((0.000095038934535162 + o[4]*(8.4812393955936e-6 +
-        2.55615384360309e-9*o[7]))*o[8] + pi1*(o[11]*(8.9701127632e-6 + (
-        2.60684891582404e-6 + 5.7366919751696e-13*o[12])*o[2]) + pi1*(
-        2.02584984300585e-6/o[5] + o[16]*(o[19]*(o[15]*(o[20]*(-7.63737668221055e-22
-        /(o[1]*o[22]*o[4]) + pi1*(3.5842867920213e-22*o[28] + pi1*(-5.65070932023524e-23
-        *o[26] + 2.99318679335866e-24*o[24]*pi1))) - 3.33001080055983e-19/(o[
-        1]*o[21]*o[4]*o[5]*tau1)) + 1.44400475720615e-17/(o[21]*o[4]*o[5]*
-        tau1)) + (1.01874413933128e-8 + 1.39398969845072e-9*o[10])/(o[1]*o[5]
-        *tau1))))) + o[3]*(0.00094368642146534 + o[2]*(0.00060003561586052 +
-        (-0.000095322787813974 + o[1]*(8.8283690661692e-6 +
-        1.45389992595188e-15*o[9]))*tau1))) + o[14]*(-0.00028319080123804 + o[
-        1]*(0.00060706301565874 + o[7]*(0.018990068218419 + tau1*(
-        0.032529748770505 + (0.021841717175414 + 0.00005283835796993*o[1])*
-        tau1))));
-    end g1pitau;
-
-    function g2pitau "derivative of g wrt pi and tau"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      output Real pi "dimensionless pressure";
-      output Real tau "dimensionless temperature";
-      output Real gpi "dimensionless dervative of Gibbs function wrt pi";
-      output Real gtau "dimensionless dervative of Gibbs function wrt tau";
-    protected
-      Real tau2 "dimensionless temperature";
-      Real[22] o "vector of auxiliary variables";
-    algorithm
-      assert(p > triple.ptriple,
-        "IF97 medium function g2pitau called with too low pressure\n" +
-        "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
-      assert(p <= 100.0e6,
-        "IF97 medium function g2pitau: the input pressure (= " + String(p) + " Pa) is higher than 100 Mpa");
-      assert(T >= 273.15,
-        "IF97 medium function g2pitau: the temperature (= " + String(T) + " K) is lower than 273.15 K!");
-      assert(T <= 1073.15,
-        "IF97 medium function g2pitau: the input temperature (= " + String(T) + " K) is higher than the limit of 1073.15 K");
-      pi := p/data.PSTAR2;
-      tau := data.TSTAR2/T;
-      tau2 := -0.5 + tau;
-      o[1] := tau*tau;
-      o[2] := o[1]*o[1];
-      o[3] := tau2*tau2;
-      o[4] := o[3]*tau2;
-      o[5] := o[3]*o[3];
-      o[6] := o[5]*o[5];
-      o[7] := o[6]*o[6];
-      o[8] := o[5]*o[6]*o[7]*tau2;
-      o[9] := o[3]*o[5];
-      o[10] := o[5]*o[6]*tau2;
-      o[11] := o[3]*o[7]*tau2;
-      o[12] := o[3]*o[5]*o[6];
-      o[13] := o[3]*o[5]*tau2;
-      o[14] := o[5]*o[6]*o[7];
-      o[15] := pi*pi;
-      o[16] := o[15]*o[15];
-      o[17] := o[15]*o[16];
-      o[18] := o[5]*o[7]*tau2;
-      o[19] := o[7]*o[7];
-      o[20] := o[3]*o[5]*o[6]*tau2;
-      o[21] := o[5]*o[7];
-      o[22] := o[3]*o[7];
-      gtau := (0.0280439559151 + tau*(-0.2858109552582 + tau*(1.2213149471784
-         + tau*(-2.848163942888 + tau*(4.38395111945 + o[1]*(10.08665568018
-         + (-0.5681726521544 + 0.06380539059921*tau)*tau))))))/(o[1]*o[2]) +
-        pi*(-0.017834862292358 + tau2*(-0.09199202739273 + (-0.172743777250296
-         - 0.30195167236758*o[4])*tau2) + pi*(-0.000033032641670203 + (-0.0003789797503263
-         + o[3]*(-0.015757110897342 + o[4]*(-0.306581069554011 -
-        0.000960283724907132*o[8])))*tau2 + pi*(4.3870667284435e-7 + o[3]*(-0.00009683303171571
-         + o[4]*(-0.0090203547252888 - 1.42338887469272*o[8])) + pi*(-7.8847309559367e-10
-         + (2.558143570457e-8 + 1.44676118155521e-6*tau2)*tau2 + pi*(
-        0.0000160454534363627*o[9] + pi*((-5.0144299353183e-11 + o[10]*(-0.033874355714168
-         - 836.35096769364*o[11]))*o[3] + pi*((-0.0000138839897890111 -
-        0.973671060893475*o[12])*o[3]*o[6] + pi*(o[13]*(9.0049690883672e-11
-         - 296.320827232793*o[14]) + pi*(2.57526266427144e-7*o[5]*o[6] + pi*(
-        o[4]*(4.1627860840696e-19 + (-1.0234747095929e-12 -
-        1.40254511313154e-8*o[5])*o[9]) + o[17]*(o[14]*(-2.34560435076256e-9
-         + 5.3465159397045*o[18]) + o[15]*(-19.1874828272775*o[19]*o[6]*o[7]
-         + o[15]*(o[11]*(1.78371690710842e-23 + (1.07202609066812e-11 -
-        0.000201611844951398*o[10])*o[20]) + pi*(-1.24017662339842e-24*o[21]
-         + pi*(0.000200482822351322*o[19]*o[5]*o[7] + pi*(-4.97975748452559e-14
-        *o[19]*o[3]*o[5] + (1.90027787547159e-27 + o[12]*(
-        2.21658861403112e-15 - 0.0000547344301999018*o[22]))*o[6]*o[7]*pi*
-        tau2))))))))))))))));
-      gpi := (1. + pi*(-0.0017731742473213 + tau2*(-0.017834862292358 + tau2*
-        (-0.045996013696365 + (-0.057581259083432 - 0.05032527872793*o[4])*
-        tau2)) + pi*(tau2*(-0.000066065283340406 + (-0.0003789797503263 + o[3]
-        *(-0.007878555448671 + o[4]*(-0.087594591301146 -
-        0.000053349095828174*o[8])))*tau2) + pi*(6.1445213076927e-8 + (
-        1.31612001853305e-6 + o[3]*(-0.00009683303171571 + o[4]*(-0.0045101773626444
-         - 0.122004760687947*o[8])))*tau2 + pi*(tau2*(-3.15389238237468e-9 +
-        (5.116287140914e-8 + 1.92901490874028e-6*tau2)*tau2) + pi*(
-        0.0000114610381688305*o[13] + pi*((-1.00288598706366e-10 + o[10]*(-0.012702883392813
-         - 143.374451604624*o[11]))*o[4] + pi*(-4.1341695026989e-17 + (-8.8352662293707e-6
-         - 0.272627897050173*o[12])*o[3]*o[6]*tau2 + pi*((9.0049690883672e-11
-         - 65.8490727183984*o[14])*o[6] + pi*(1.78287415218792e-7*o[10] + pi*
-        (o[5]*(1.0406965210174e-18 + (-1.0234747095929e-12 -
-        1.0018179379511e-8*o[5])*o[9]) + o[17]*((-1.29412653835176e-9 +
-        1.71088510070544*o[18])*o[8] + o[15]*(-6.05920510335078*o[19]*o[6]*o[
-        7]*tau2 + o[15]*((1.78371690710842e-23 + (6.1258633752464e-12 -
-        0.000084004935396416*o[10])*o[20])*o[21] + pi*(-1.24017662339842e-24*
-        o[18] + pi*(0.0000832192847496054*o[19]*o[5]*o[7]*tau2 + pi*((
-        1.75410265428146e-27 + o[12]*(1.32995316841867e-15 -
-        0.0000226487297378904*o[22]))*o[3]*o[6]*o[7]*pi -
-        2.93678005497663e-14*o[19]*o[3]*o[5]*tau2)))))))))))))))))/pi;
-    end g2pitau;
-
-    function g5pitau "derivative of g wrt pi and tau"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      output Real pi "dimensionless pressure";
-      output Real tau "dimensionless temperature";
-      output Real gpi "dimensionless dervative of Gibbs function wrt pi";
-      output Real gtau "dimensionless dervative of Gibbs function wrt tau";
-    protected
-      Real[3] o "vector of auxiliary variables";
-    algorithm
-      assert(p > triple.ptriple,
-        "IF97 medium function g5pitau called with too low pressure\n" +
-        "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
-      assert(p <= data.PLIMIT5,
-        "IF97 medium function g5pitau: input pressure (= " + String(p) + " Pa) is higher than 10 Mpa in region 5");
-      assert(T <= 2273.15,
-        "IF97 medium function g5pitau: input temperature (= " + String(T) + " K) is higher than limit of 2273.15 K in region 5");
-      pi := p/data.PSTAR5;
-      tau := data.TSTAR5/T;
-      o[1] := tau*tau;
-      o[2] := o[1]*o[1];
-      o[3] := o[2]*o[2];
-      gtau := pi*(0.0021774678714571 - 0.013782846269973*o[1] + pi*(-0.0000357523455236121
-        *o[3] + 3.8757684869352e-7*o[1]*pi)) + (0.074415446800398 + tau*(-0.73803069960666
-         + (3.1161318213925 + o[1]*(6.8540841634434 - 0.65923253077834*tau))*
-        tau))/o[2];
-      gpi := (1.0 + pi*(-0.00012563183589592 + (0.0021774678714571 -
-        0.004594282089991*o[1])*tau + pi*(-7.9449656719138e-6*o[3]*tau +
-        3.8757684869352e-7*o[1]*pi*tau)))/pi;
-    end g5pitau;
-
-    function f3deltatau "1st derivatives of f wrt delta and tau"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      output Real delta "dimensionless density";
-      output Real tau "dimensionless temperature";
-      output Real fdelta
-        "dimensionless dervative of Helmholtz function wrt delta";
-      output Real ftau "dimensionless dervative of Helmholtz function wrt tau";
-    protected
-      Real[13] o "vector of auxiliary variables";
-    algorithm
-      tau := data.TCRIT/T;
-      delta := if (d == data.DCRIT and T == data.TCRIT) then 1 + Modelica.
-        Constants.eps else d/data.DCRIT;
-      o[1] := tau*tau;
-      o[2] := o[1]*o[1];
-      o[3] := o[2]*o[2];
-      o[4] := o[3]*tau;
-      o[5] := o[1]*o[2]*o[3]*tau;
-      o[6] := o[2]*o[3];
-      o[7] := o[1]*o[3];
-      o[8] := o[3]*o[3];
-      o[9] := o[1]*o[2]*o[8];
-      o[10] := o[1]*o[2]*o[8]*tau;
-      o[11] := o[3]*o[8];
-      o[12] := o[1]*o[3]*o[8];
-      o[13] := o[3]*o[8]*tau;
-      fdelta := (1.0658070028513 + delta*(o[1]*(-1.2654315477714 + o[2]*(-1.1524407806681
-         + (0.88521043984318 - 0.64207765181607*o[1])*o[4])) + delta*(
-        0.76986920373342 + o[1]*(-1.70429417648412 + o[2]*(9.7944563083754 +
-        (-6.100523451393 + (0.078841073758308 + 0.25116816848616*o[2])*o[5])*
-        tau)) + delta*(-0.8399798909613 + o[1]*(4.169939870838 + o[1]*(-6.056974507071
-         + o[6]*(-0.0246442911521889 - 1.42788107204769*o[7]))) + delta*(
-        0.175936297894 + o[1]*(-1.77905741714956 + o[1]*(3.62288282878932 +
-        2.82089800351868*o[9])) + delta*(delta*(-0.133052405238576 + o[1]*(
-        0.565564509990552 + 0.98617670687766*o[11]) + delta*(-0.094523605689436
-        *o[1] + delta*(-0.118674762819776*o[12] + delta*(o[1]*(
-        0.00521306582652756 + 0.0290780142333399*o[11]) + delta*(
-        0.00080964802996215 - 0.000494162889679965*delta*o[12] -
-        0.0016557679795037*tau))))) + (0.5385256313166 + o[1]*(-1.6456811629477
-         - 2.5435531020579*o[10]))*tau))))))/delta;
-      ftau := 20.944396974307 + tau*(-15.3735415757432 + o[2]*tau*(
-        18.3301634515678 + o[1]*tau*(-28.08078114862 + o[1]*(14.4640436358204
-         - 0.194503669468755*o[1]*o[3]*tau)))) + delta*((-2.5308630955428 + o[
-        2]*(-6.9146446840086 + (13.2781565976477 - 10.9153200808732*o[1])*o[4]))
-        *tau + delta*(tau*(-1.70429417648412 + o[2]*(29.3833689251262 + (-21.3518320798755
-         + (0.867251811341388 + 3.26518619032008*o[2])*o[5])*tau)) + delta*((
-        2.779959913892 + o[1]*(-8.075966009428 + o[6]*(-0.131436219478341 -
-        12.37496929108*o[7])))*tau + delta*((-0.88952870857478 + o[1]*(
-        3.62288282878932 + 18.3358370228714*o[9]))*tau + delta*(
-        0.10770512626332 + o[1]*(-0.98740869776862 - 13.2264761307011*o[10])
-         + delta*((0.188521503330184 + 4.27343239646986*o[11])*tau + delta*(-0.027006744482696
-        *tau + delta*(-0.385692979164272*o[13] + delta*(delta*(-0.00016557679795037
-         - 0.00116802137560719*delta*o[13]) + (0.00115845907256168 +
-        0.0840031522296486*o[11])*tau)))))))));
-    end f3deltatau;
-
-    function tph1 "inverse function for region 1: T(p,h)"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      output Modelica.SIunits.Temperature T "temperature (K)";
-    protected
-      Real pi "dimensionless pressure";
-      Real eta1 "dimensionless specific enthalpy";
-      Real[3] o "vector of auxiliary variables";
-    algorithm
-      assert(p > triple.ptriple,
-        "IF97 medium function tph1 called with too low pressure\n" +
-        "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
-      pi := p/data.PSTAR2;
-      eta1 := h/data.HSTAR1 + 1.0;
-      o[1] := eta1*eta1;
-      o[2] := o[1]*o[1];
-      o[3] := o[2]*o[2];
-      T := -238.724899245210 - 13.3917448726020*pi + eta1*(404.21188637945 +
-        43.211039183559*pi + eta1*(113.497468817180 - 54.010067170506*pi +
-        eta1*(30.5358922039160*pi + eta1*(-6.5964749423638*pi + o[1]*(-5.8457616048039
-         + o[2]*(pi*(0.0093965400878363 + (-0.0000258586412820730 +
-        6.6456186191635e-8*pi)*pi) + o[2]*o[3]*(-0.000152854824131400 + o[1]*
-        o[3]*(-1.08667076953770e-6 + pi*(1.15736475053400e-7 + pi*(-4.0644363084799e-9
-         + pi*(8.0670734103027e-11 + pi*(-9.3477771213947e-13 + (
-        5.8265442020601e-15 - 1.50201859535030e-17*pi)*pi))))))))))));
-    end tph1;
-
-    function tps1 "inverse function for region 1: T(p,s)"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      output Modelica.SIunits.Temperature T "temperature (K)";
-    protected
-      constant Modelica.SIunits.Pressure pstar=1.0e6;
-      constant Modelica.SIunits.SpecificEntropy sstar=1.0e3;
-      Real pi "dimensionless pressure";
-      Real sigma1 "dimensionless specific entropy";
-      Real[6] o "vector of auxiliary variables";
-    algorithm
-      pi := p/pstar;
-      assert(p > triple.ptriple,
-        "IF97 medium function tps1 called with too low pressure\n" +
-        "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
-
-      sigma1 := s/sstar + 2.0;
-      o[1] := sigma1*sigma1;
-      o[2] := o[1]*o[1];
-      o[3] := o[2]*o[2];
-      o[4] := o[3]*o[3];
-      o[5] := o[4]*o[4];
-      o[6] := o[1]*o[2]*o[4];
-
-      T := 174.782680583070 + sigma1*(34.806930892873 + sigma1*(
-        6.5292584978455 + (0.33039981775489 + o[3]*(-1.92813829231960e-7 -
-        2.49091972445730e-23*o[2]*o[4]))*sigma1)) + pi*(-0.261076364893320 +
-        pi*(0.00056608900654837 + pi*(o[1]*o[3]*(2.64004413606890e-13 +
-        7.8124600459723e-29*o[6]) - 3.07321999036680e-31*o[5]*pi) + sigma1*(-0.00032635483139717
-         + sigma1*(0.000044778286690632 + o[1]*o[2]*(-5.1322156908507e-10 -
-        4.2522657042207e-26*o[6])*sigma1))) + sigma1*(0.225929659815860 +
-        sigma1*(-0.064256463395226 + sigma1*(0.0078876289270526 + o[3]*sigma1
-        *(3.5672110607366e-10 + 1.73324969948950e-24*o[1]*o[4]*sigma1)))));
-    end tps1;
-
-    function tph2 "reverse function for region 2: T(p,h)"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      output Modelica.SIunits.Temperature T "temperature (K)";
-    protected
-      Real pi "dimensionless pressure";
-      Real pi2b "dimensionless pressure";
-      Real pi2c "dimensionless pressure";
-      Real eta "dimensionless specific enthalpy";
-      Real etabc "dimensionless specific enthalpy";
-      Real eta2a "dimensionless specific enthalpy";
-      Real eta2b "dimensionless specific enthalpy";
-      Real eta2c "dimensionless specific enthalpy";
-      Real[8] o "vector of auxiliary variables";
-    algorithm
-      pi := p*data.IPSTAR;
-      eta := h*data.IHSTAR;
-      etabc := h*1.0e-3;
-      if (pi < 4.0) then
-        eta2a := eta - 2.1;
-        o[1] := eta2a*eta2a;
-        o[2] := o[1]*o[1];
-        o[3] := pi*pi;
-        o[4] := o[3]*o[3];
-        o[5] := o[3]*pi;
-        T := 1089.89523182880 + (1.84457493557900 - 0.0061707422868339*pi)*pi
-           + eta2a*(849.51654495535 - 4.1792700549624*pi + eta2a*(-107.817480918260
-           + (6.2478196935812 - 0.310780466295830*pi)*pi + eta2a*(
-          33.153654801263 - 17.3445631081140*pi + o[2]*(-7.4232016790248 + pi
-          *(-200.581768620960 + 11.6708730771070*pi) + o[1]*(271.960654737960
-          *pi + o[1]*(-455.11318285818*pi + eta2a*(1.38657242832260*o[4] + o[
-          1]*o[2]*(3091.96886047550*pi + o[1]*(11.7650487243560 + o[2]*(-13551.3342407750
-          *o[5] + o[2]*(-62.459855192507*o[3]*o[4]*pi + o[2]*(o[4]*(
-          235988.325565140 + 7399.9835474766*pi) + o[1]*(19127.7292396600*o[3]
-          *o[4] + o[1]*(o[3]*(1.28127984040460e8 - 551966.97030060*o[5]) + o[
-          1]*(-9.8554909623276e8*o[3] + o[1]*(2.82245469730020e9*o[3] + o[1]*
-          (o[3]*(-3.5948971410703e9 + 3.7154085996233e6*o[5]) + o[1]*pi*(
-          252266.403578720 + pi*(1.72273499131970e9 + pi*(1.28487346646500e7
-           + (-1.31052365450540e7 - 415351.64835634*o[3])*pi))))))))))))))))))));
-      elseif (pi < (0.12809002730136e-03*etabc - 0.67955786399241)*etabc +
-          0.90584278514723e3) then
-        eta2b := eta - 2.6;
-        pi2b := pi - 2.0;
-        o[1] := pi2b*pi2b;
-        o[2] := o[1]*pi2b;
-        o[3] := o[1]*o[1];
-        o[4] := eta2b*eta2b;
-        o[5] := o[4]*o[4];
-        o[6] := o[4]*o[5];
-        o[7] := o[5]*o[5];
-        T := 1489.50410795160 + 0.93747147377932*pi2b + eta2b*(
-          743.07798314034 + o[2]*(0.000110328317899990 - 1.75652339694070e-18
-          *o[1]*o[3]) + eta2b*(-97.708318797837 + pi2b*(3.3593118604916 +
-          pi2b*(-0.0218107553247610 + pi2b*(0.000189552483879020 + (
-          2.86402374774560e-7 - 8.1456365207833e-14*o[2])*pi2b))) + o[5]*(
-          3.3809355601454*pi2b + o[4]*(-0.108297844036770*o[1] + o[5]*(
-          2.47424647056740 + (0.168445396719040 + o[1]*(0.00308915411605370
-           - 0.0000107798573575120*pi2b))*pi2b + o[6]*(-0.63281320016026 +
-          pi2b*(0.73875745236695 + (-0.046333324635812 + o[1]*(-0.000076462712454814
-           + 2.82172816350400e-7*pi2b))*pi2b) + o[6]*(1.13859521296580 + pi2b
-          *(-0.47128737436186 + o[1]*(0.00135555045549490 + (
-          0.0000140523928183160 + 1.27049022719450e-6*pi2b)*pi2b)) + o[5]*(-0.47811863648625
-           + (0.150202731397070 + o[2]*(-0.0000310838143314340 + o[1]*(-1.10301392389090e-8
-           - 2.51805456829620e-11*pi2b)))*pi2b + o[5]*o[7]*(
-          0.0085208123431544 + pi2b*(-0.00217641142197500 + pi2b*(
-          0.000071280351959551 + o[1]*(-1.03027382121030e-6 + (
-          7.3803353468292e-8 + 8.6934156344163e-15*o[3])*pi2b))))))))))));
-      else
-        eta2c := eta - 1.8;
-        pi2c := pi + 25.0;
-        o[1] := pi2c*pi2c;
-        o[2] := o[1]*o[1];
-        o[3] := o[1]*o[2]*pi2c;
-        o[4] := 1/o[3];
-        o[5] := o[1]*o[2];
-        o[6] := eta2c*eta2c;
-        o[7] := o[2]*o[2];
-        o[8] := o[6]*o[6];
-        T := eta2c*((859777.22535580 + o[1]*(482.19755109255 +
-          1.12615974072300e-12*o[5]))/o[1] + eta2c*((-5.8340131851590e11 + (
-          2.08255445631710e10 + 31081.0884227140*o[2])*pi2c)/o[5] + o[6]*(o[8]
-          *(o[6]*(1.23245796908320e-7*o[5] + o[6]*(-1.16069211309840e-6*o[5]
-           + o[8]*(0.0000278463670885540*o[5] + (-0.00059270038474176*o[5] +
-          0.00129185829918780*o[5]*o[6])*o[8]))) - 10.8429848800770*pi2c) + o[
-          4]*(7.3263350902181e12 + o[7]*(3.7966001272486 + (-0.045364172676660
-           - 1.78049822406860e-11*o[2])*pi2c))))) + o[4]*(-3.2368398555242e12
-           + pi2c*(3.5825089945447e11 + pi2c*(-1.07830682174700e10 + o[1]*
-          pi2c*(610747.83564516 + pi2c*(-25745.7236041700 + (1208.23158659360
-           + 1.45591156586980e-13*o[5])*pi2c)))));
-      end if;
-    end tph2;
-
-    function tps2a "reverse function for region 2a: T(p,s)"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      output Modelica.SIunits.Temperature T "temperature (K)";
-    protected
-      Real[12] o "vector of auxiliary variables";
-      constant Real IPSTAR=1.0e-6 "scaling variable";
-      constant Real ISSTAR2A=1/2000.0 "scaling variable";
-      Real pi "dimensionless pressure";
-      Real sigma2a "dimensionless specific entropy";
-    algorithm
-      pi := p*IPSTAR;
-      sigma2a := s*ISSTAR2A - 2.0;
-      o[1] := pi^0.5;
-      o[2] := sigma2a*sigma2a;
-      o[3] := o[2]*o[2];
-      o[4] := o[3]*o[3];
-      o[5] := o[4]*o[4];
-      o[6] := pi^0.25;
-      o[7] := o[2]*o[4]*o[5];
-      o[8] := 1/o[7];
-      o[9] := o[3]*sigma2a;
-      o[10] := o[2]*o[3]*sigma2a;
-      o[11] := o[3]*o[4]*sigma2a;
-      o[12] := o[2]*sigma2a;
-      T := ((-392359.83861984 + (515265.73827270 + o[3]*(40482.443161048 + o[
-        2]*o[3]*(-321.93790923902 + o[2]*(96.961424218694 - 22.8678463717730*
-        sigma2a))))*sigma2a)/(o[4]*o[5]) + o[6]*((-449429.14124357 + o[3]*(-5011.8336020166
-         + 0.35684463560015*o[4]*sigma2a))/(o[2]*o[5]*sigma2a) + o[6]*(o[8]*(
-        44235.335848190 + o[9]*(-13673.3888117080 + o[3]*(421632.60207864 + (
-        22516.9258374750 + o[10]*(474.42144865646 - 149.311307976470*sigma2a))
-        *sigma2a))) + o[6]*((-197811.263204520 - 23554.3994707600*sigma2a)/(o[
-        2]*o[3]*o[4]*sigma2a) + o[6]*((-19070.6163020760 + o[11]*(
-        55375.669883164 + (3829.3691437363 - 603.91860580567*o[2])*o[3]))*o[8]
-         + o[6]*((1936.31026203310 + o[2]*(4266.0643698610 + o[2]*o[3]*o[4]*(
-        -5978.0638872718 - 704.01463926862*o[9])))/(o[2]*o[4]*o[5]*sigma2a)
-         + o[1]*((338.36784107553 + o[12]*(20.8627866351870 + (
-        0.033834172656196 - 0.000043124428414893*o[12])*o[3]))*sigma2a + o[6]
-        *(166.537913564120 + sigma2a*(-139.862920558980 + o[3]*(-0.78849547999872
-         + (0.072132411753872 + o[3]*(-0.0059754839398283 + (-0.0000121413589539040
-         + 2.32270967338710e-7*o[2])*o[3]))*sigma2a)) + o[6]*(-10.5384635661940
-         + o[3]*(2.07189254965020 + (-0.072193155260427 + 2.07498870811200e-7
-        *o[4])*o[9]) + o[6]*(o[6]*(o[12]*(0.210375278936190 +
-        0.000256812397299990*o[3]*o[4]) + (-0.0127990029337810 -
-        8.2198102652018e-6*o[11])*o[6]*o[9]) + o[10]*(-0.0183406579113790 +
-        2.90362723486960e-7*o[2]*o[4]*sigma2a)))))))))))/(o[1]*pi);
-    end tps2a;
-
-    function tps2b "reverse function for region 2b: T(p,s)"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      output Modelica.SIunits.Temperature T "temperature (K)";
-    protected
-      Real[8] o "vector of auxiliary variables";
-      constant Real IPSTAR=1.0e-6 "scaling variable";
-      constant Real ISSTAR2B=1/785.3 "scaling variable";
-      Real pi "dimensionless pressure";
-      Real sigma2b "dimensionless specific entropy";
-    algorithm
-      pi := p*IPSTAR;
-      sigma2b := 10.0 - s*ISSTAR2B;
-      o[1] := pi*pi;
-      o[2] := o[1]*o[1];
-      o[3] := sigma2b*sigma2b;
-      o[4] := o[3]*o[3];
-      o[5] := o[4]*o[4];
-      o[6] := o[3]*o[5]*sigma2b;
-      o[7] := o[3]*o[5];
-      o[8] := o[3]*sigma2b;
-      T := (316876.65083497 + 20.8641758818580*o[6] + pi*(-398593.99803599 -
-        21.8160585188770*o[6] + pi*(223697.851942420 + (-2784.17034458170 +
-        9.9207436071480*o[7])*sigma2b + pi*(-75197.512299157 + (
-        2970.86059511580 + o[7]*(-3.4406878548526 + 0.38815564249115*sigma2b))
-        *sigma2b + pi*(17511.2950857500 + sigma2b*(-1423.71128544490 + (
-        1.09438033641670 + 0.89971619308495*o[4])*o[4]*sigma2b) + pi*(-3375.9740098958
-         + (471.62885818355 + o[4]*(-1.91882419936790 + o[8]*(
-        0.41078580492196 - 0.33465378172097*sigma2b)))*sigma2b + pi*(
-        1387.00347775050 + sigma2b*(-406.63326195838 + sigma2b*(
-        41.727347159610 + o[3]*(2.19325494345320 + sigma2b*(-1.03200500090770
-         + (0.35882943516703 + 0.0052511453726066*o[8])*sigma2b)))) + pi*(
-        12.8389164507050 + sigma2b*(-2.86424372193810 + sigma2b*(
-        0.56912683664855 + (-0.099962954584931 + o[4]*(-0.0032632037778459 +
-        0.000233209225767230*sigma2b))*sigma2b)) + pi*(-0.153348098574500 + (
-        0.0290722882399020 + 0.00037534702741167*o[4])*sigma2b + pi*(
-        0.00172966917024110 + (-0.00038556050844504 - 0.000035017712292608*o[
-        3])*sigma2b + pi*(-0.0000145663936314920 + 5.6420857267269e-6*sigma2b
-         + pi*(4.1286150074605e-8 + (-2.06846711188240e-8 +
-        1.64093936747250e-9*sigma2b)*sigma2b))))))))))))/(o[1]*o[2]);
-    end tps2b;
-
-    function tps2c "reverse function for region 2c: T(p,s)"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      output Modelica.SIunits.Temperature T "temperature (K)";
-    protected
-      constant Real IPSTAR=1.0e-6 "scaling variable";
-      constant Real ISSTAR2C=1/2925.1 "scaling variable";
-      Real pi "dimensionless pressure";
-      Real sigma2c "dimensionless specific entropy";
-      Real[3] o "vector of auxiliary variables";
-    algorithm
-      pi := p*IPSTAR;
-      sigma2c := 2.0 - s*ISSTAR2C;
-      o[1] := pi*pi;
-      o[2] := sigma2c*sigma2c;
-      o[3] := o[2]*o[2];
-      T := (909.68501005365 + 2404.56670884200*sigma2c + pi*(-591.62326387130
-         + pi*(541.45404128074 + sigma2c*(-270.983084111920 + (
-        979.76525097926 - 469.66772959435*sigma2c)*sigma2c) + pi*(
-        14.3992746047230 + (-19.1042042304290 + o[2]*(5.3299167111971 -
-        21.2529753759340*sigma2c))*sigma2c + pi*(-0.311473344137600 + (
-        0.60334840894623 - 0.042764839702509*sigma2c)*sigma2c + pi*(
-        0.0058185597255259 + (-0.0145970082847530 + 0.0056631175631027*o[3])*
-        sigma2c + pi*(-0.000076155864584577 + sigma2c*(0.000224403429193320
-         - 0.0000125610950134130*o[2]*sigma2c) + pi*(6.3323132660934e-7 + (-2.05419896753750e-6
-         + 3.6405370390082e-8*sigma2c)*sigma2c + pi*(-2.97598977892150e-9 +
-        1.01366185297630e-8*sigma2c + pi*(5.9925719692351e-12 + sigma2c*(-2.06778701051640e-11
-         + o[2]*(-2.08742781818860e-11 + (1.01621668250890e-10 -
-        1.64298282813470e-10*sigma2c)*sigma2c))))))))))))/o[1];
-    end tps2c;
-
-    function tps2 "reverse function for region 2: T(p,s)"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      output Modelica.SIunits.Temperature T "temperature (K)";
-    protected
-      Real pi "dimensionless pressure";
-      constant Modelica.SIunits.SpecificEntropy SLIMIT=5.85e3
-        "subregion boundary specific entropy between regions 2a and 2b";
-    algorithm
-      if p < 4.0e6 then
-        T := tps2a(p, s);
-      elseif s > SLIMIT then
-        T := tps2b(p, s);
-      else
-        T := tps2c(p, s);
-      end if;
-    end tps2;
-
-    function tsat "region 4 saturation temperature as a function of pressure"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output Modelica.SIunits.Temperature t_sat "temperature";
-    protected
-      Real pi "dimensionless pressure";
-      Real[20] o "vector of auxiliary variables";
-    algorithm
-    //   assert(p > triple.ptriple,
-    //     "IF97 medium function tsat called with too low pressure\n" +
-    //     "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
-    //  assert(p <= data.PCRIT,
-    //    "tsat: input pressure is higher than the critical point pressure");
-      pi := max(min(p,data.PCRIT),triple.ptriple)*data.IPSTAR;
-      o[1] := pi^0.25;
-      o[2] := -3.2325550322333e6*o[1];
-      o[3] := pi^0.5;
-      o[4] := -724213.16703206*o[3];
-      o[5] := 405113.40542057 + o[2] + o[4];
-      o[6] := -17.0738469400920*o[1];
-      o[7] := 14.9151086135300 + o[3] + o[6];
-      o[8] := -4.0*o[5]*o[7];
-      o[9] := 12020.8247024700*o[1];
-      o[10] := 1167.05214527670*o[3];
-      o[11] := -4823.2657361591 + o[10] + o[9];
-      o[12] := o[11]*o[11];
-      o[13] := o[12] + o[8];
-      o[14] := o[13]^0.5;
-      o[15] := -o[14];
-      o[16] := -12020.8247024700*o[1];
-      o[17] := -1167.05214527670*o[3];
-      o[18] := 4823.2657361591 + o[15] + o[16] + o[17];
-      o[19] := 1/o[18];
-      o[20] := 2.0*o[19]*o[5];
-
-      t_sat := 0.5*(650.17534844798 + o[20] - (-4.0*(-0.238555575678490 +
-        1300.35069689596*o[19]*o[5]) + (650.17534844798 + o[20])^2.0)^0.5);
-      annotation (derivative=tsat_der);
-    end tsat;
-
-    function dtsatofp "derivative of saturation temperature w.r.t. pressure"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output Real dtsat(unit="K/Pa") "derivative of T w.r.t. p";
-    protected
-      Real pi "dimensionless pressure";
-      Real[49] o "vector of auxiliary variables";
-    algorithm
-      pi := p*data.IPSTAR;
-      o[1] := pi^0.75;
-      o[2] := 1/o[1];
-      o[3] := -4.268461735023*o[2];
-      o[4] := sqrt(pi);
-      o[5] := 1/o[4];
-      o[6] := 0.5*o[5];
-      o[7] := o[3] + o[6];
-      o[8] := pi^0.25;
-      o[9] := -3.2325550322333e6*o[8];
-      o[10] := -724213.16703206*o[4];
-      o[11] := 405113.40542057 + o[10] + o[9];
-      o[12] := -4*o[11]*o[7];
-      o[13] := -808138.758058325*o[2];
-      o[14] := -362106.58351603*o[5];
-      o[15] := o[13] + o[14];
-      o[16] := -17.073846940092*o[8];
-      o[17] := 14.91510861353 + o[16] + o[4];
-      o[18] := -4*o[15]*o[17];
-      o[19] := 3005.2061756175*o[2];
-      o[20] := 583.52607263835*o[5];
-      o[21] := o[19] + o[20];
-      o[22] := 12020.82470247*o[8];
-      o[23] := 1167.0521452767*o[4];
-      o[24] := -4823.2657361591 + o[22] + o[23];
-      o[25] := 2.0*o[21]*o[24];
-      o[26] := o[12] + o[18] + o[25];
-      o[27] := -4.0*o[11]*o[17];
-      o[28] := o[24]*o[24];
-      o[29] := o[27] + o[28];
-      o[30] := sqrt(o[29]);
-      o[31] := 1/o[30];
-      o[32] := (-o[30]);
-      o[33] := -12020.82470247*o[8];
-      o[34] := -1167.0521452767*o[4];
-      o[35] := 4823.2657361591 + o[32] + o[33] + o[34];
-      o[36] := o[30];
-      o[37] := -4823.2657361591 + o[22] + o[23] + o[36];
-      o[38] := o[37]*o[37];
-      o[39] := 1/o[38];
-      o[40] := -1.72207339365771*o[30];
-      o[41] := 21592.2055343628*o[8];
-      o[42] := o[30]*o[8];
-      o[43] := -8192.87114842946*o[4];
-      o[44] := -0.510632954559659*o[30]*o[4];
-      o[45] := -3100.02526152368*o[1];
-      o[46] := pi;
-      o[47] := 1295.95640782102*o[46];
-      o[48] := 2862.09212505088 + o[40] + o[41] + o[42] + o[43] + o[44] + o[
-        45] + o[47];
-      o[49] := 1/(o[35]*o[35]);
-      dtsat := data.IPSTAR*0.5*((2.0*o[15])/o[35] - 2.*o[11]*(-3005.2061756175
-        *o[2] - 0.5*o[26]*o[31] - 583.52607263835*o[5])*o[49] - (
-        20953.46356643991*(o[39]*(1295.95640782102 + 5398.05138359071*o[2] +
-        0.25*o[2]*o[30] - 0.861036696828853*o[26]*o[31] - 0.255316477279829*o[
-        26]*o[31]*o[4] - 4096.43557421473*o[5] - 0.255316477279829*o[30]*o[5]
-         - 2325.01894614276/o[8] + 0.5*o[26]*o[31]*o[8]) - 2.0*(o[19] + o[20]
-         + 0.5*o[26]*o[31])*o[48]*o[37]^(-3)))/sqrt(o[39]*o[48]));
-    end dtsatofp;
-
-    function tsat_der "derivative function for tsat"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Real der_p(unit="Pa/s") "pressure derivatrive";
-      output Real der_tsat(unit="K/s") "temperature derivative";
-    protected
-      Real dtp;
-    algorithm
-      dtp := dtsatofp(p);
-      der_tsat := dtp*der_p;
-    end tsat_der;
-
-    function psat "region 4 saturation pressure as a functionx of temperature"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      output Modelica.SIunits.Pressure p_sat "pressure";
-    protected
-      Real[7] o "vector of auxiliary variables";
-      Real C "auxiliary variable";
-      Real B "auxiliary variable";
-      Real A "auxiliary variable";
-      Real Tlim=min(T, data.TCRIT);
-    algorithm
-      assert(T >= 273.16,
-        "IF97 medium function psat: input temperature (= " + String(triple.ptriple) + " K).\n" +
-        "lower than the triple point temperature 273.16 K");
-      o[1] := -650.17534844798 + Tlim;
-      o[2] := 1/o[1];
-      o[3] := -0.238555575678490*o[2];
-      o[4] := o[3] + Tlim "theta";
-      o[5] := -4823.2657361591*o[4] "n7*theta";
-      o[6] := o[4]*o[4] "theta^2";
-      o[7] := 14.9151086135300*o[6] "n6*theta^2";
-      C := 405113.40542057 + o[5] + o[7] "C";
-      B := -3.2325550322333e6 +12020.8247024700*o[4] - 17.0738469400920*o[6];
-      A := (-724213.16703206 + 1167.05214527670*o[4] + o[6]);
-      p_sat := 16.0e6*C*C*C*C*1/(-B + (-4.0*A*C + B*B)^0.5)^4.0;
-      annotation (derivative=psat_der);
-    end psat;
-
-    function dptofT
-      "derivative of pressure wrt temperature along the saturation pressure curve"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      output Real dpt(unit = "Pa/K") "temperature derivative of pressure";
-    protected
-      Real[31] o "vector of auxiliary variables";
-      Real Tlim "temperature limited to TCRIT";
-    algorithm
-      Tlim := min(T, data.TCRIT);
-      o[1] := -650.17534844798 + Tlim;
-      o[2] := 1/o[1];
-      o[3] := -0.238555575678490*o[2];
-      o[4] := o[3] + Tlim "theta";
-      o[5] := -4823.2657361591*o[4];
-      o[6] := o[4]*o[4] "theta^2";
-      o[7] := 14.9151086135300*o[6];
-      o[8] := 405113.40542057 + o[5] + o[7];
-      o[9] := o[8]*o[8];
-      o[10] := o[9]*o[9];
-      o[11] := o[1]*o[1];
-      o[12] := 1/o[11];
-      o[13] := 0.238555575678490*o[12];
-      o[14] := 1.00000000000000 + o[13] "dtheta";
-      o[15] := 12020.8247024700*o[4];
-      o[16] := -17.0738469400920*o[6];
-      o[17] := -3.2325550322333e6 + o[15] + o[16];
-      o[18] := -4823.2657361591*o[14];
-      o[19] := 29.8302172270600*o[14]*o[4];
-      o[20] := o[18] + o[19];
-      o[21] := 1167.05214527670*o[4];
-      o[22] := -724213.16703206 + o[21] + o[6];
-      o[23] := o[17]*o[17];
-      o[24] := -4.0000000000000*o[22]*o[8];
-      o[25] := o[23] + o[24];
-      o[26] := sqrt(o[25]);
-      o[27] := -12020.8247024700*o[4];
-      o[28] := 17.0738469400920*o[6];
-      o[29] := 3.2325550322333e6 + o[26] + o[27] + o[28];
-      o[30] := o[29]*o[29];
-      o[31] := o[30]*o[30];
-      dpt := 1e6*((-64.0*o[10]*(-12020.8247024700*o[14] + 34.147693880184*o[
-        14]*o[4] + (0.5*(-4.0*o[20]*o[22] + 2.00000000000000*o[17]*(
-        12020.8247024700*o[14] - 34.147693880184*o[14]*o[4]) - 4.0*(
-        1167.05214527670*o[14] + 2.0*o[14]*o[4])*o[8]))/o[26]))/(o[29]*o[31])
-         + (64.*o[20]*o[8]*o[9])/o[31]);
-    end dptofT;
-
-    function d2ptofT
-      "Second derivative of pressure wrt temperature along the saturation pressure curve"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      output Real dpT(unit = "Pa/K") "Temperature derivative of pressure";
-      output Real dpTT(unit = "Pa/(K.K)")
-        "Second temperature derivative of pressure";
-    protected
-      Real A "Auxiliary variable";
-      Real Ad "Auxiliary variable";
-      Real A1 "Auxiliary variable";
-      Real A2 "Auxiliary variable";
-      Real B "Auxiliary variable";
-      Real Bd "Auxiliary variable";
-      Real B1 "Auxiliary variable";
-      Real B2 "Auxiliary variable";
-      Real C "Auxiliary variable";
-      Real Cd "Auxiliary variable";
-      Real C1 "Auxiliary variable";
-      Real C2 "Auxiliary variable";
-      Real D "Auxiliary variable";
-      Real D1 "Auxiliary variable";
-      Real Dd "Auxiliary variable";
-      Real D2 "Auxiliary variable";
-    //   Real F "Auxiliary variable";
-    //   Real Fd "Auxiliary variable";
-      Real th "Auxiliary variable";
-      Real thd "Auxiliary variable";
-      Real thdd "Auxiliary variable";
-      Real v "Auxiliary variable";
-      Real v2 "Auxiliary variable";
-      Real v4 "Auxiliary variable";
-      Real v5 "Auxiliary variable";
-      Real v6 "Auxiliary variable";
-      Real[16] o "vector of auxiliary variables";
-      Real Tlim "temperature limited to TCRIT";
-      parameter Real[10] n =  {0.11670521452767e4,-0.72421316703206e6,
-                              -0.17073846940092e2, 0.12020824702470e5,
-                              -0.32325550322333e7, 0.14915108613530e2,
-                              -0.48232657361591e4, 0.40511340542057e6,
-                              -0.23855557567849,   0.65017534844798e3};
-    algorithm
-      Tlim := min(T, data.TCRIT);
-      o[1] := Tlim - n[10];
-      th := Tlim + n[9]/o[1];
-      o[2] := th*th "theta^2";
-      A := o[2] + n[1]*th + n[2];
-      B := n[3]*o[2] + n[4]*th + n[5];
-      C := n[6]*o[2] + n[7]*th + n[8];
-      o[3] := o[1]*o[1];
-      o[4] := o[3]*o[3];
-      D := (B*B-4.0*A*C);
-      o[5] := sqrt(D);
-      v := 1/(o[5]- B);
-      v2 := v*v;
-      v4 := v2*v2;
-      v5 := v4*v;
-      v6 := v4*v2;
-      o[6] := 2.0*C*v;
-      o[7] := o[6]*o[6];
-    //  F := o[7]*o[7]*1e6 "this is also psat, and correct";
-      thd := 1.0 - n[9]/o[3];
-      thdd :=  2.0*n[9]/(o[3]*o[1]);
-      Ad := 2.0*th + n[1];
-      Bd := 2.0*n[3]*th + n[4];
-      Cd := 2.0*n[6]*th + n[7];
-      Dd := 2*B*Bd -4*(Ad*C + Cd*A);
-      A1 := Ad*thd;
-      B1 := Bd*thd;
-      C1 := Cd*thd;
-      D1 := Dd*thd;
-      o[8] := C*C "C^2";
-      o[9] := o[8]*C "C^3";
-      o[10] := o[9]*C "C^4";
-      o[11] := 1/o[5] "1/sqrt(D)";
-      o[12] := (-B1 + 0.5*D1*o[11]) "-B1 + 1/2*D1/sqrt(D)";
-      o[13] := o[12]*o[12];
-      o[14] := C1*C1 "C1^2";
-      o[15] := B1*B1 "B1^2";
-      o[16] := D*o[5] "D^3/2";
-      // dpsat (=Fd) is correct
-      // Fd := 64.0*C*C*C*C1*v4-64.0*C*C*C*C*(-B1 + 0.5*D1/sqrt(D))*v5;
-      dpT := 64.0*(C1*o[9]*v4 - o[10]*o[12]*v5)*1.0e6 "dpsat";
-      A2 := Ad*thdd + thd*thd*2.0;
-      B2 := Bd*thdd + thd*thd*2.0*n[3];
-      C2 := Cd*thdd + thd*thd*2.0*n[6];
-      D2 := 2.0*(B*B2 + o[15]) -4.0*(A2*C + 2.0*A1*C1 + A*C2);
-      dpTT := ((192.0*o[8]*o[14] + 64.0*o[9]*C2)*v4 + (-512.0*C1*o[9]*o[12] - 64.0*o[10]*(-B2-0.25*D1*D1/o[16] + 0.5*D2*o[11]))*v5
-         +(320.0*o[10]*o[13])*v6)*1.0e6;
-    end d2ptofT;
-
-    function psat_der "derivative function for psat"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      input Real der_T(unit = "K/s") "temperature derivative";
-      output Real der_psat(unit = "Pa/s") "pressure";
-    protected
-      Real dpt;
-    algorithm
-      dpt := dptofT(T);
-      der_psat := dpt*der_T;
-    end psat_der;
-
-    // Inverses p_hs from the 2001 assition to IAPWS97
-    function p1_hs "pressure as a function of ehtnalpy and entropy in region 1"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      output Modelica.SIunits.Pressure p "Pressure";
-      constant Real[:] n=
-        {-0.691997014660582,-0.183612548787560e2,-0.928332409297335e1,0.659639569909906e2,
-         -0.162060388912024e2,0.450620017338667e3,0.854680678224170e3,0.607523214001162e4,0.326487682621856e2,
-         -0.269408844582931e2,-0.319947848334300e3,-0.928354307043320e3,0.303634537455249e2,-0.650540422444146e2,
-         -0.430991316516130e4,-0.747512324096068e3,0.730000345529245e3,0.114284032569021e4,-0.436407041874559e3};
-      constant Real[:] I = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,3,4,4,5};
-      constant Real[:] J = {0,1,2,4,5,6,8,14,0,1,4,6,0,1,10,4,1,4,0};
-      constant Modelica.SIunits.SpecificEnthalpy hstar=3400e3
-        "normalization enthalpy";
-      constant Modelica.SIunits.Pressure pstar=100e6 "normalization pressure";
-      constant Modelica.SIunits.SpecificEntropy sstar=7.6e3
-        "normalization entropy";
-    protected
-      Real eta = h/hstar "normalized specific enthalpy";
-      Real sigma = s/sstar "normalized specific entropy";
-    algorithm
-      p := sum(n[i]*(eta + 0.05)^I[i]*(sigma + 0.05)^J[i] for i in 1:19)*pstar;
-      annotation (
-          Documentation(                                                                                                    info="<html>
+      "),
+      Icon(graphics = {Text(extent = {{-102, 0}, {24, -26}}, lineColor = {242, 148, 0}, textString = "Thermo"), Text(extent = {{-4, 8}, {68, -34}}, lineColor = {46, 170, 220}, textString = "SysPro"), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-32, 12}, {-16, 14}, {6, 14}, {26, 12}, {42, 8}, {52, 2}, {42, 6}, {28, 10}, {6, 12}, {-12, 12}, {-16, 12}, {-34, 10}, {-50, 6}, {-62, 2}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-44, 38}, {-24, 38}, {-26, 30}, {-26, 22}, {-24, 14}, {-24, 12}, {-46, 8}, {-42, 22}, {-42, 30}, {-44, 38}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-26, 20}, {-20, 20}, {-20, 22}, {-14, 22}, {-14, 20}, {-12, 20}, {-12, 12}, {-26, 12}, {-28, 12}, {-26, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-8, 14}, {-8, 24}, {-6, 24}, {-6, 14}, {-8, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 30}, {-6, 26}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 36}, {-6, 32}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 42}, {-6, 38}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 48}, {-6, 44}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-4, 14}, {-4, 26}, {-2, 26}, {-2, 14}, {-4, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 32}, {-2, 28}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 38}, {-2, 34}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 44}, {-2, 40}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 50}, {-2, 46}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-2, 20}, {8, 20}, {8, 22}, {10, 22}, {18, 22}, {18, 12}, {-4, 14}, {-2, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-36, 10}, {-18, 12}, {6, 12}, {26, 10}, {42, 6}, {52, 0}, {42, 4}, {28, 8}, {6, 10}, {-12, 10}, {-18, 10}, {-38, 8}, {-50, 6}, {-62, 2}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Line(points = {{22, 12}, {22, 14}, {22, 16}, {24, 14}, {20, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{26, 12}, {26, 14}, {26, 16}, {28, 14}, {24, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{30, 10}, {30, 12}, {30, 14}, {32, 12}, {28, 16}}, color = {46, 170, 220}, thickness = 0.5), Polygon(points = {{36, 8}, {36, 30}, {34, 34}, {36, 38}, {40, 38}, {40, 8}, {36, 8}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 80}, {80, -100}}, lineColor = {0, 0, 255}), Line(points = {{-100, 80}, {-80, 100}, {100, 100}, {100, -80}, {80, -100}}, color = {0, 0, 255}, smooth = Smooth.None), Line(points = {{80, 80}, {100, 100}}, color = {0, 0, 255}, smooth = Smooth.None)}));
+  end Regions;
+
+  //===================================================================
+  //                      Base functions
+  //===================================================================
+
+  package Basic "Base functions as described in IAWPS/IF97"
+    function g1 "Gibbs function for region 1: g(p,T)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      output ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs g "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+    protected
+      Real pi1 "dimensionless pressure";
+      Real tau1 "dimensionless temperature";
+      Real[45] o "vector of auxiliary variables";
+    algorithm
+//   assert(p > triple.ptriple,
+//     "IF97 medium function g1 called with too low pressure\n" +
+//     "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
+//   assert(p <= 100.0e6,
+//     "IF97 medium function g1: the input pressure (= " + String(p) + " Pa) is higher than 100 Mpa");
+//   assert(T >= 273.15,
+//     "IF97 medium function g1: the temperature (= " + String(T) + " K)  is lower than 273.15 K!");
+      g.p := p;
+      g.T := T;
+      g.R := data.RH2O;
+      g.pi := max(p, triple.ptriple) / data.PSTAR1;
+      g.tau := data.TSTAR1 / max(T, triple.Ttriple);
+      pi1 := 7.1000000000000 - g.pi;
+      tau1 := (-1.22200000000000) + g.tau;
+      o[1] := tau1 * tau1;
+      o[2] := o[1] * o[1];
+      o[3] := o[2] * o[2];
+      o[4] := o[3] * tau1;
+      o[5] := 1 / o[4];
+      o[6] := o[1] * o[2];
+      o[7] := o[1] * tau1;
+      o[8] := 1 / o[7];
+      o[9] := o[1] * o[2] * o[3];
+      o[10] := 1 / o[2];
+      o[11] := o[2] * tau1;
+      o[12] := 1 / o[11];
+      o[13] := o[2] * o[3];
+      o[14] := 1 / o[3];
+      o[15] := pi1 * pi1;
+      o[16] := o[15] * pi1;
+      o[17] := o[15] * o[15];
+      o[18] := o[17] * o[17];
+      o[19] := o[17] * o[18] * pi1;
+      o[20] := o[15] * o[17];
+      o[21] := o[3] * o[3];
+      o[22] := o[21] * o[21];
+      o[23] := o[22] * o[3] * tau1;
+      o[24] := 1 / o[23];
+      o[25] := o[22] * o[3];
+      o[26] := 1 / o[25];
+      o[27] := o[1] * o[2] * o[22] * tau1;
+      o[28] := 1 / o[27];
+      o[29] := o[1] * o[2] * o[22];
+      o[30] := 1 / o[29];
+      o[31] := o[1] * o[2] * o[21] * o[3] * tau1;
+      o[32] := 1 / o[31];
+      o[33] := o[2] * o[21] * o[3] * tau1;
+      o[34] := 1 / o[33];
+      o[35] := o[1] * o[3] * tau1;
+      o[36] := 1 / o[35];
+      o[37] := o[1] * o[3];
+      o[38] := 1 / o[37];
+      o[39] := 1 / o[6];
+      o[40] := o[1] * o[22] * o[3];
+      o[41] := 1 / o[40];
+      o[42] := 1 / o[22];
+      o[43] := o[1] * o[2] * o[21] * o[3];
+      o[44] := 1 / o[43];
+      o[45] := 1 / o[13];
+      g.g := pi1 * (pi1 * (pi1 * (o[10] * ((-0.000031679644845054) + o[2] * ((-2.82707979853120e-6) - 8.5205128120103e-10 * o[6])) + pi1 * (o[12] * ((-2.24252819080000e-6) + ((-6.5171222895601e-7) - 1.43417299379240e-13 * o[13]) * o[7]) + pi1 * ((-4.0516996860117e-7 * o[14]) + o[16] * (((-1.27343017416410e-9) - 1.74248712306340e-10 * o[11]) * o[36] + o[19] * ((-6.8762131295531e-19 * o[34]) + o[15] * (1.44783078285210e-20 * o[32] + o[20] * (2.63357816627950e-23 * o[30] + pi1 * ((-1.19476226400710e-23 * o[28]) + pi1 * (1.82280945814040e-24 * o[26] - 9.3537087292458e-26 * o[24] * pi1))))))))) + o[8] * ((-0.00047184321073267) + o[7] * ((-0.000300017807930260) + (0.000047661393906987 + o[1] * ((-4.4141845330846e-6) - 7.2694996297594e-16 * o[9])) * tau1))) + o[5] * (0.000283190801238040 + o[1] * ((-0.00060706301565874) + o[6] * ((-0.0189900682184190) + tau1 * ((-0.032529748770505) + ((-0.0218417171754140) - 0.000052838357969930 * o[1]) * tau1))))) + (0.146329712131670 + tau1 * ((-0.84548187169114) + tau1 * ((-3.7563603672040) + tau1 * (3.3855169168385 + tau1 * ((-0.95791963387872) + tau1 * (0.157720385132280 + ((-0.0166164171995010) + 0.00081214629983568 * tau1) * tau1)))))) / o[1];
+      g.gpi := pi1 * (pi1 * (o[10] * (0.000095038934535162 + o[2] * (8.4812393955936e-6 + 2.55615384360309e-9 * o[6])) + pi1 * (o[12] * (8.9701127632000e-6 + (2.60684891582404e-6 + 5.7366919751696e-13 * o[13]) * o[7]) + pi1 * (2.02584984300585e-6 * o[14] + o[16] * ((1.01874413933128e-8 + 1.39398969845072e-9 * o[11]) * o[36] + o[19] * (1.44400475720615e-17 * o[34] + o[15] * ((-3.3300108005598e-19 * o[32]) + o[20] * ((-7.6373766822106e-22 * o[30]) + pi1 * (3.5842867920213e-22 * o[28] + pi1 * ((-5.6507093202352e-23 * o[26]) + 2.99318679335866e-24 * o[24] * pi1))))))))) + o[8] * (0.00094368642146534 + o[7] * (0.00060003561586052 + ((-0.000095322787813974) + o[1] * (8.8283690661692e-6 + 1.45389992595188e-15 * o[9])) * tau1))) + o[5] * ((-0.000283190801238040) + o[1] * (0.00060706301565874 + o[6] * (0.0189900682184190 + tau1 * (0.032529748770505 + (0.0218417171754140 + 0.000052838357969930 * o[1]) * tau1))));
+      g.gpipi := pi1 * (o[10] * ((-0.000190077869070324) + o[2] * ((-0.0000169624787911872) - 5.1123076872062e-9 * o[6])) + pi1 * (o[12] * ((-0.0000269103382896000) + ((-7.8205467474721e-6) - 1.72100759255088e-12 * o[13]) * o[7]) + pi1 * ((-8.1033993720234e-6 * o[14]) + o[16] * (((-7.1312089753190e-8) - 9.7579278891550e-9 * o[11]) * o[36] + o[19] * ((-2.88800951441230e-16 * o[34]) + o[15] * (7.3260237612316e-18 * o[32] + o[20] * (2.13846547101895e-20 * o[30] + pi1 * ((-1.03944316968618e-20 * o[28]) + pi1 * (1.69521279607057e-21 * o[26] - 9.2788790594118e-23 * o[24] * pi1))))))))) + o[8] * ((-0.00094368642146534) + o[7] * ((-0.00060003561586052) + (0.000095322787813974 + o[1] * ((-8.8283690661692e-6) - 1.45389992595188e-15 * o[9])) * tau1));
+      g.gtau := pi1 * (o[38] * ((-0.00254871721114236) + o[1] * (0.0042494411096112 + (0.0189900682184190 + ((-0.0218417171754140) - 0.000158515073909790 * o[1]) * o[1]) * o[6])) + pi1 * (o[10] * (0.00141552963219801 + o[2] * (0.000047661393906987 + o[1] * ((-0.0000132425535992538) - 1.23581493705910e-14 * o[9]))) + pi1 * (o[12] * (0.000126718579380216 - 5.1123076872062e-9 * o[37]) + pi1 * (o[39] * (0.0000112126409540000 + (1.30342445791202e-6 - 1.43417299379240e-12 * o[13]) * o[7]) + pi1 * (3.2413597488094e-6 * o[5] + o[16] * ((1.40077319158051e-8 + 1.04549227383804e-9 * o[11]) * o[45] + o[19] * (1.99410180757040e-17 * o[44] + o[15] * ((-4.4882754268415e-19 * o[42]) + o[20] * ((-1.00075970318621e-21 * o[28]) + pi1 * (4.6595728296277e-22 * o[26] + pi1 * ((-7.2912378325616e-23 * o[24]) + 3.8350205789908e-24 * o[41] * pi1))))))))))) + o[8] * ((-0.292659424263340) + tau1 * (0.84548187169114 + o[1] * (3.3855169168385 + tau1 * ((-1.91583926775744) + tau1 * (0.47316115539684 + ((-0.066465668798004) + 0.0040607314991784 * tau1) * tau1)))));
+      g.gtautau := pi1 * (o[36] * (0.0254871721114236 + o[1] * ((-0.033995528876889) + ((-0.037980136436838) - 0.00031703014781958 * o[2]) * o[6])) + pi1 * (o[12] * ((-0.0056621185287920) + o[6] * ((-0.0000264851071985076) - 1.97730389929456e-13 * o[9])) + pi1 * (((-0.00063359289690108) - 2.55615384360309e-8 * o[37]) * o[39] + pi1 * (pi1 * ((-0.0000291722377392842 * o[38]) + o[16] * (o[19] * ((-5.9823054227112e-16 * o[32]) + o[15] * (o[20] * (3.9029628424262e-20 * o[26] + pi1 * ((-1.86382913185108e-20 * o[24]) + pi1 * (2.98940751135026e-21 * o[41] - 1.61070864317613e-22 * pi1 / (o[1] * o[22] * o[3] * tau1)))) + 1.43624813658928e-17 / (o[22] * tau1))) + ((-1.68092782989661e-7) - 7.3184459168663e-9 * o[11]) / (o[2] * o[3] * tau1))) + ((-0.000067275845724000) + ((-3.9102733737361e-6) - 1.29075569441316e-11 * o[13]) * o[7]) / (o[1] * o[2] * tau1))))) + o[10] * (0.87797827279002 + tau1 * ((-1.69096374338228) + o[7] * ((-1.91583926775744) + tau1 * (0.94632231079368 + ((-0.199397006394012) + 0.0162429259967136 * tau1) * tau1))));
+      g.gtaupi := o[38] * (0.00254871721114236 + o[1] * ((-0.0042494411096112) + ((-0.0189900682184190) + (0.0218417171754140 + 0.000158515073909790 * o[1]) * o[1]) * o[6])) + pi1 * (o[10] * ((-0.00283105926439602) + o[2] * ((-0.000095322787813974) + o[1] * (0.0000264851071985076 + 2.47162987411820e-14 * o[9]))) + pi1 * (o[12] * ((-0.00038015573814065) + 1.53369230616185e-8 * o[37]) + pi1 * (o[39] * ((-0.000044850563816000) + ((-5.2136978316481e-6) + 5.7366919751696e-12 * o[13]) * o[7]) + pi1 * ((-0.0000162067987440468 * o[5]) + o[16] * (((-1.12061855326441e-7) - 8.3639381907043e-9 * o[11]) * o[45] + o[19] * ((-4.1876137958978e-16 * o[44]) + o[15] * (1.03230334817355e-17 * o[42] + o[20] * (2.90220313924001e-20 * o[28] + pi1 * ((-1.39787184888831e-20 * o[26]) + pi1 * (2.26028372809410e-21 * o[24] - 1.22720658527705e-22 * o[41] * pi1))))))))));
+    end g1;
+
+    function g2 "Gibbs function for region 2: g(p,T)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      output ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs g "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+    protected
+      Real tau2 "dimensionless temperature";
+      Real[55] o "vector of auxiliary variables";
+    algorithm
+      g.p := p;
+      g.T := T;
+      g.R := data.RH2O;
+//   assert(p > triple.ptriple,
+//     "IF97 medium function g2 called with too low pressure\n" +
+//     "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
+//   assert(p <= 100.0e6,
+//     "IF97 medium function g2: the input pressure (= " + String(p) + " Pa) is higher than 100 Mpa");
+//   assert(T >= 273.15,
+//     "IF97 medium function g2: the temperature (= " + String(T) + " K) is lower than 273.15 K!");
+//   assert(T <= 1073.15,
+//     "IF97 medium function g2: the input temperature (= " + String(T) + " K) is higher than the limit of 1073.15 K");
+      g.pi := max(p, triple.ptriple) / data.PSTAR2;
+      g.tau := data.TSTAR2 / max(T, triple.Ttriple);
+      tau2 := (-0.5) + g.tau;
+      o[1] := tau2 * tau2;
+      o[2] := o[1] * tau2;
+      o[3] := -0.050325278727930 * o[2];
+      o[4] := (-0.057581259083432) + o[3];
+      o[5] := o[4] * tau2;
+      o[6] := (-0.045996013696365) + o[5];
+      o[7] := o[6] * tau2;
+      o[8] := (-0.0178348622923580) + o[7];
+      o[9] := o[8] * tau2;
+      o[10] := o[1] * o[1];
+      o[11] := o[10] * o[10];
+      o[12] := o[11] * o[11];
+      o[13] := o[10] * o[11] * o[12] * tau2;
+      o[14] := o[1] * o[10] * tau2;
+      o[15] := o[10] * o[11] * tau2;
+      o[16] := o[1] * o[12] * tau2;
+      o[17] := o[1] * o[11] * tau2;
+      o[18] := o[1] * o[10] * o[11];
+      o[19] := o[10] * o[11] * o[12];
+      o[20] := o[1] * o[10];
+      o[21] := g.pi * g.pi;
+      o[22] := o[21] * o[21];
+      o[23] := o[21] * o[22];
+      o[24] := o[10] * o[12] * tau2;
+      o[25] := o[12] * o[12];
+      o[26] := o[11] * o[12] * o[25] * tau2;
+      o[27] := o[10] * o[12];
+      o[28] := o[1] * o[10] * o[11] * tau2;
+      o[29] := o[10] * o[12] * o[25] * tau2;
+      o[30] := o[1] * o[10] * o[25] * tau2;
+      o[31] := o[1] * o[11] * o[12];
+      o[32] := o[1] * o[12];
+      o[33] := g.tau * g.tau;
+      o[34] := o[33] * o[33];
+      o[35] := -0.000053349095828174 * o[13];
+      o[36] := (-0.087594591301146) + o[35];
+      o[37] := o[2] * o[36];
+      o[38] := (-0.0078785554486710) + o[37];
+      o[39] := o[1] * o[38];
+      o[40] := (-0.00037897975032630) + o[39];
+      o[41] := o[40] * tau2;
+      o[42] := (-0.000066065283340406) + o[41];
+      o[43] := o[42] * tau2;
+      o[44] := 5.7870447262208e-6 * tau2;
+      o[45] := -0.301951672367580 * o[2];
+      o[46] := (-0.172743777250296) + o[45];
+      o[47] := o[46] * tau2;
+      o[48] := (-0.091992027392730) + o[47];
+      o[49] := o[48] * tau2;
+      o[50] := o[1] * o[11];
+      o[51] := o[10] * o[11];
+      o[52] := o[11] * o[12] * o[25];
+      o[53] := o[10] * o[12] * o[25];
+      o[54] := o[1] * o[10] * o[25];
+      o[55] := o[11] * o[12] * tau2;
+      g.g := g.pi * ((-0.00177317424732130) + o[9] + g.pi * (tau2 * ((-0.000033032641670203) + ((-0.000189489875163150) + o[1] * ((-0.0039392777243355) + ((-0.043797295650573) - 0.0000266745479140870 * o[13]) * o[2])) * tau2) + g.pi * (2.04817376923090e-8 + (4.3870667284435e-7 + o[1] * ((-0.000032277677238570) + ((-0.00150339245421480) - 0.040668253562649 * o[13]) * o[2])) * tau2 + g.pi * (g.pi * (2.29220763376610e-6 * o[14] + g.pi * (((-1.67147664510610e-11) + o[15] * ((-0.00211714723213550) - 23.8957419341040 * o[16])) * o[2] + g.pi * ((-5.9059564324270e-18) + o[17] * ((-1.26218088991010e-6) - 0.038946842435739 * o[18]) + g.pi * (o[11] * (1.12562113604590e-11 - 8.2311340897998 * o[19]) + g.pi * (1.98097128020880e-8 * o[15] + g.pi * (o[10] * (1.04069652101740e-19 + ((-1.02347470959290e-13) - 1.00181793795110e-9 * o[10]) * o[20]) + o[23] * (o[13] * ((-8.0882908646985e-11) + 0.106930318794090 * o[24]) + o[21] * ((-0.33662250574171 * o[26]) + o[21] * (o[27] * (8.9185845355421e-25 + (3.06293168762320e-13 - 4.2002467698208e-6 * o[15]) * o[28]) + g.pi * ((-5.9056029685639e-26 * o[24]) + g.pi * (3.7826947613457e-6 * o[29] + g.pi * ((-1.27686089346810e-15 * o[30]) + o[31] * (7.3087610595061e-29 + o[18] * (5.5414715350778e-17 - 9.4369707241210e-7 * o[32])) * g.pi)))))))))))) + tau2 * ((-7.8847309559367e-10) + (1.27907178522850e-8 + 4.8225372718507e-7 * tau2) * tau2))))) + ((-0.0056087911830200) + g.tau * (0.071452738814550 + g.tau * ((-0.40710498239280) + g.tau * (1.42408197144400 + g.tau * ((-4.3839511194500) + g.tau * ((-9.6927686002170) + g.tau * (10.0866556801800 + ((-0.284086326077200) + 0.0212684635330700 * g.tau) * g.tau) + Modelica.Math.log(g.pi))))))) / (o[34] * g.tau);
+      g.gpi := (1.00000000000000 + g.pi * ((-0.00177317424732130) + o[9] + g.pi * (o[43] + g.pi * (6.1445213076927e-8 + (1.31612001853305e-6 + o[1] * ((-0.000096833031715710) + ((-0.0045101773626444) - 0.122004760687947 * o[13]) * o[2])) * tau2 + g.pi * (g.pi * (0.0000114610381688305 * o[14] + g.pi * (((-1.00288598706366e-10) + o[15] * ((-0.0127028833928130) - 143.374451604624 * o[16])) * o[2] + g.pi * ((-4.1341695026989e-17) + o[17] * ((-8.8352662293707e-6) - 0.272627897050173 * o[18]) + g.pi * (o[11] * (9.0049690883672e-11 - 65.849072718398 * o[19]) + g.pi * (1.78287415218792e-7 * o[15] + g.pi * (o[10] * (1.04069652101740e-18 + ((-1.02347470959290e-12) - 1.00181793795110e-8 * o[10]) * o[20]) + o[23] * (o[13] * ((-1.29412653835176e-9) + 1.71088510070544 * o[24]) + o[21] * ((-6.0592051033508 * o[26]) + o[21] * (o[27] * (1.78371690710842e-23 + (6.1258633752464e-12 - 0.000084004935396416 * o[15]) * o[28]) + g.pi * ((-1.24017662339842e-24 * o[24]) + g.pi * (0.000083219284749605 * o[29] + g.pi * ((-2.93678005497663e-14 * o[30]) + o[31] * (1.75410265428146e-27 + o[18] * (1.32995316841867e-15 - 0.0000226487297378904 * o[32])) * g.pi)))))))))))) + tau2 * ((-3.15389238237468e-9) + (5.1162871409140e-8 + 1.92901490874028e-6 * tau2) * tau2)))))) / g.pi;
+      g.gpipi := ((-1.00000000000000) + o[21] * (o[43] + g.pi * (1.22890426153854e-7 + (2.63224003706610e-6 + o[1] * ((-0.000193666063431420) + ((-0.0090203547252888) - 0.244009521375894 * o[13]) * o[2])) * tau2 + g.pi * (g.pi * (0.000045844152675322 * o[14] + g.pi * (((-5.0144299353183e-10) + o[15] * ((-0.063514416964065) - 716.87225802312 * o[16])) * o[2] + g.pi * ((-2.48050170161934e-16) + o[17] * ((-0.000053011597376224) - 1.63576738230104 * o[18]) + g.pi * (o[11] * (6.3034783618570e-10 - 460.94350902879 * o[19]) + g.pi * (1.42629932175034e-6 * o[15] + g.pi * (o[10] * (9.3662686891566e-18 + ((-9.2112723863361e-12) - 9.0163614415599e-8 * o[10]) * o[20]) + o[23] * (o[13] * ((-1.94118980752764e-8) + 25.6632765105816 * o[24]) + o[21] * ((-103.006486756963 * o[26]) + o[21] * (o[27] * (3.3890621235060e-22 + (1.16391404129682e-10 - 0.00159609377253190 * o[15]) * o[28]) + g.pi * ((-2.48035324679684e-23 * o[24]) + g.pi * (0.00174760497974171 * o[29] + g.pi * ((-6.4609161209486e-13 * o[30]) + o[31] * (4.0344361048474e-26 + o[18] * (3.05889228736295e-14 - 0.00052092078397148 * o[32])) * g.pi)))))))))))) + tau2 * ((-9.4616771471240e-9) + (1.53488614227420e-7 + o[44]) * tau2))))) / o[21];
+      g.gtau := (0.0280439559151000 + g.tau * ((-0.285810955258200) + g.tau * (1.22131494717840 + g.tau * ((-2.84816394288800) + g.tau * (4.3839511194500 + o[33] * (10.0866556801800 + ((-0.56817265215440) + 0.063805390599210 * g.tau) * g.tau)))))) / (o[33] * o[34]) + g.pi * ((-0.0178348622923580) + o[49] + g.pi * ((-0.000033032641670203) + ((-0.00037897975032630) + o[1] * ((-0.0157571108973420) + ((-0.306581069554011) - 0.00096028372490713 * o[13]) * o[2])) * tau2 + g.pi * (4.3870667284435e-7 + o[1] * ((-0.000096833031715710) + ((-0.0090203547252888) - 1.42338887469272 * o[13]) * o[2]) + g.pi * ((-7.8847309559367e-10) + g.pi * (0.0000160454534363627 * o[20] + g.pi * (o[1] * ((-5.0144299353183e-11) + o[15] * ((-0.033874355714168) - 836.35096769364 * o[16])) + g.pi * (((-0.0000138839897890111) - 0.97367106089347 * o[18]) * o[50] + g.pi * (o[14] * (9.0049690883672e-11 - 296.320827232793 * o[19]) + g.pi * (2.57526266427144e-7 * o[51] + g.pi * (o[2] * (4.1627860840696e-19 + ((-1.02347470959290e-12) - 1.40254511313154e-8 * o[10]) * o[20]) + o[23] * (o[19] * ((-2.34560435076256e-9) + 5.3465159397045 * o[24]) + o[21] * ((-19.1874828272775 * o[52]) + o[21] * (o[16] * (1.78371690710842e-23 + (1.07202609066812e-11 - 0.000201611844951398 * o[15]) * o[28]) + g.pi * ((-1.24017662339842e-24 * o[27]) + g.pi * (0.000200482822351322 * o[53] + g.pi * ((-4.9797574845256e-14 * o[54]) + (1.90027787547159e-27 + o[18] * (2.21658861403112e-15 - 0.000054734430199902 * o[32])) * o[55] * g.pi)))))))))))) + (2.55814357045700e-8 + 1.44676118155521e-6 * tau2) * tau2))));
+      g.gtautau := ((-0.168263735490600) + g.tau * (1.42905477629100 + g.tau * ((-4.8852597887136) + g.tau * (8.5444918286640 + g.tau * ((-8.7679022389000) + o[33] * ((-0.56817265215440) + 0.127610781198420 * g.tau) * g.tau))))) / (o[33] * o[34] * g.tau) + g.pi * ((-0.091992027392730) + ((-0.34548755450059) - 1.50975836183790 * o[2]) * tau2 + g.pi * ((-0.00037897975032630) + o[1] * ((-0.047271332692026) + ((-1.83948641732407) - 0.033609930371750 * o[13]) * o[2]) + g.pi * (((-0.000193666063431420) + ((-0.045101773626444) - 48.395221739552 * o[13]) * o[2]) * tau2 + g.pi * (2.55814357045700e-8 + 2.89352236311042e-6 * tau2 + g.pi * (0.000096272720618176 * o[10] * tau2 + g.pi * (((-1.00288598706366e-10) + o[15] * ((-0.50811533571252) - 28435.9329015838 * o[16])) * tau2 + g.pi * (o[11] * ((-0.000138839897890111) - 23.3681054614434 * o[18]) * tau2 + g.pi * ((6.3034783618570e-10 - 10371.2289531477 * o[19]) * o[20] + g.pi * (3.09031519712573e-6 * o[17] + g.pi * (o[1] * (1.24883582522088e-18 + ((-9.2112723863361e-12) - 1.82330864707100e-7 * o[10]) * o[20]) + o[23] * (o[1] * o[11] * o[12] * ((-6.5676921821352e-8) + 261.979281045521 * o[24]) * tau2 + o[21] * ((-1074.49903832754 * o[1] * o[10] * o[12] * o[25] * tau2) + o[21] * ((3.3890621235060e-22 + (3.6448887082716e-10 - 0.0094757567127157 * o[15]) * o[28]) * o[32] + g.pi * ((-2.48035324679684e-23 * o[16]) + g.pi * (0.0104251067622687 * o[1] * o[12] * o[25] * tau2 + g.pi * (o[11] * o[12] * (4.7506946886790e-26 + o[18] * (8.6446955947214e-14 - 0.00311986252139440 * o[32])) * g.pi - 1.89230784411972e-12 * o[10] * o[25] * tau2))))))))))))))));
+      g.gtaupi := (-0.0178348622923580) + o[49] + g.pi * ((-0.000066065283340406) + ((-0.00075795950065260) + o[1] * ((-0.0315142217946840) + ((-0.61316213910802) - 0.00192056744981426 * o[13]) * o[2])) * tau2 + g.pi * (1.31612001853305e-6 + o[1] * ((-0.000290499095147130) + ((-0.0270610641758664) - 4.2701666240781 * o[13]) * o[2]) + g.pi * ((-3.15389238237468e-9) + g.pi * (0.000080227267181813 * o[20] + g.pi * (o[1] * ((-3.00865796119098e-10) + o[15] * ((-0.203246134285008) - 5018.1058061618 * o[16])) + g.pi * (((-0.000097187928523078) - 6.8156974262543 * o[18]) * o[50] + g.pi * (o[14] * (7.2039752706938e-10 - 2370.56661786234 * o[19]) + g.pi * (2.31773639784430e-6 * o[51] + g.pi * (o[2] * (4.1627860840696e-18 + ((-1.02347470959290e-11) - 1.40254511313154e-7 * o[10]) * o[20]) + o[23] * (o[19] * ((-3.7529669612201e-8) + 85.544255035272 * o[24]) + o[21] * ((-345.37469089099 * o[52]) + o[21] * (o[16] * (3.5674338142168e-22 + (2.14405218133624e-10 - 0.0040322368990280 * o[15]) * o[28]) + g.pi * ((-2.60437090913668e-23 * o[27]) + g.pi * (0.0044106220917291 * o[53] + g.pi * ((-1.14534422144089e-12 * o[54]) + (4.5606669011318e-26 + o[18] * (5.3198126736747e-14 - 0.00131362632479764 * o[32])) * o[55] * g.pi)))))))))))) + (1.02325742818280e-7 + o[44]) * tau2)));
+    end g2;
+
+    function g2metastable "Gibbs function for metastable part of region 2: g(p,T)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      output ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs g "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+    protected
+      Real pi "dimensionless pressure";
+      Real tau "dimensionless temperature";
+      Real tau2 "dimensionless temperature";
+      Real[27] o "vector of auxiliary variables";
+    algorithm
+      assert(p > triple.ptriple, "IF97 medium function g2metastable called with too low pressure\n" + "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
+      assert(p <= 100.0e6, "IF97 medium function g2metastable: the input pressure (= " + String(p) + " Pa) is higher than 100 Mpa");
+      assert(T >= 273.15, "IF97 medium function g2metastable: the temperature (= " + String(T) + " K) is lower than 273.15 K!");
+      assert(T <= 1073.15, "IF97 medium function g2metastable: the input temperature (= " + String(T) + " K) is higher than the limit of 1073.15 K");
+      g.p := p;
+      g.T := T;
+      g.R := data.RH2O;
+      g.pi := p / data.PSTAR2;
+      g.tau := data.TSTAR2 / T;
+      tau2 := (-0.5) + g.tau;
+      o[1] := tau2 * tau2;
+      o[2] := o[1] * tau2;
+      o[3] := o[1] * o[1];
+      o[4] := o[1] * o[3];
+      o[5] := -0.0040813178534455 * o[4];
+      o[6] := (-0.072334555213245) + o[5];
+      o[7] := o[2] * o[6];
+      o[8] := (-0.088223831943146) + o[7];
+      o[9] := o[1] * o[8];
+      o[10] := o[3] * o[3];
+      o[11] := o[10] * tau2;
+      o[12] := o[10] * o[3];
+      o[13] := o[1] * o[3] * tau2;
+      o[14] := g.tau * g.tau;
+      o[15] := o[14] * o[14];
+      o[16] := -0.015238081817394 * o[11];
+      o[17] := (-0.106091843797284) + o[16];
+      o[18] := o[17] * o[4];
+      o[19] := 0.0040195606760414 + o[18];
+      o[20] := o[19] * tau2;
+      o[21] := g.pi * g.pi;
+      o[22] := -0.0448944963879005 * o[4];
+      o[23] := (-0.361672776066225) + o[22];
+      o[24] := o[2] * o[23];
+      o[25] := (-0.176447663886292) + o[24];
+      o[26] := o[25] * tau2;
+      o[27] := o[3] * tau2;
+      g.g := g.pi * ((-0.0073362260186506) + o[9] + g.pi * (g.pi * (((-0.0063498037657313) - 0.086043093028588 * o[12]) * o[3] + g.pi * (o[13] * (0.007532158152277 - 0.0079238375446139 * o[2]) + o[11] * g.pi * ((-0.00022888160778447) - 0.002645650148281 * tau2))) + (0.0020097803380207 + ((-0.053045921898642) - 0.007619040908697 * o[11]) * o[4]) * tau2)) + ((-0.00560879118302) + g.tau * (0.07145273881455 + g.tau * ((-0.4071049823928) + g.tau * (1.424081971444 + g.tau * ((-4.38395111945) + g.tau * ((-9.6937268393049) + g.tau * (10.087275970006 + ((-0.2840863260772) + 0.02126846353307 * g.tau) * g.tau) + Modelica.Math.log(g.pi))))))) / (o[15] * g.tau);
+      g.gpi := (1.0 + g.pi * ((-0.0073362260186506) + o[9] + g.pi * (o[20] + g.pi * (((-0.0190494112971939) - 0.258129279085764 * o[12]) * o[3] + g.pi * (o[13] * (0.030128632609108 - 0.0316953501784556 * o[2]) + o[11] * g.pi * ((-0.00114440803892235) - 0.013228250741405 * tau2)))))) / g.pi;
+      g.gpipi := ((-1.) + o[21] * (o[20] + g.pi * (((-0.0380988225943878) - 0.516258558171528 * o[12]) * o[3] + g.pi * (o[13] * (0.090385897827324 - 0.0950860505353668 * o[2]) + o[11] * g.pi * ((-0.0045776321556894) - 0.05291300296562 * tau2))))) / o[21];
+      g.gtau := (0.0280439559151 + g.tau * ((-0.2858109552582) + g.tau * (1.2213149471784 + g.tau * ((-2.848163942888) + g.tau * (4.38395111945 + o[14] * (10.087275970006 + ((-0.5681726521544) + 0.06380539059921 * g.tau) * g.tau)))))) / (o[14] * o[15]) + g.pi * (o[26] + g.pi * (0.0020097803380207 + ((-0.371321453290494) - 0.121904654539152 * o[11]) * o[4] + g.pi * (((-0.0253992150629252) - 1.37668948845741 * o[12]) * o[2] + g.pi * ((0.052725107065939 - 0.079238375446139 * o[2]) * o[4] + o[10] * g.pi * ((-0.00205993447006023) - 0.02645650148281 * tau2)))));
+      g.gtautau := ((-0.1682637354906) + g.tau * (1.429054776291 + g.tau * ((-4.8852597887136) + g.tau * (8.544491828664 + g.tau * ((-8.7679022389) + o[14] * ((-0.5681726521544) + 0.12761078119842 * g.tau) * g.tau))))) / (o[14] * o[15] * g.tau) + g.pi * ((-0.176447663886292) + o[2] * ((-1.4466911042649) - 0.448944963879005 * o[4]) + g.pi * (((-2.22792871974296) - 1.82856981808728 * o[11]) * o[27] + g.pi * (o[1] * ((-0.0761976451887756) - 20.6503423268611 * o[12]) + g.pi * ((0.316350642395634 - 0.713145379015251 * o[2]) * o[27] + o[13] * g.pi * ((-0.0164794757604818) - 0.23810851334529 * tau2)))));
+      g.gtaupi := o[26] + g.pi * (0.0040195606760414 + ((-0.742642906580988) - 0.243809309078304 * o[11]) * o[4] + g.pi * (((-0.0761976451887756) - 4.13006846537222 * o[12]) * o[2] + g.pi * ((0.210900428263756 - 0.316953501784556 * o[2]) * o[4] + o[10] * g.pi * ((-0.0102996723503012) - 0.13228250741405 * tau2))));
+    end g2metastable;
+
+    function f3 "Helmholtz function for region 3: f(d,T)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      output ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs f "dimensionless Helmholtz function and dervatives wrt delta and tau";
+    protected
+      Real[40] o "vector of auxiliary variables";
+    algorithm
+      f.T := T;
+      f.d := d;
+      f.R := data.RH2O;
+      f.tau := data.TCRIT / T;
+      f.delta := if d == data.DCRIT and T == data.TCRIT then 1 - Modelica.Constants.eps else abs(d / data.DCRIT);
+      o[1] := f.tau * f.tau;
+      o[2] := o[1] * o[1];
+      o[3] := o[2] * f.tau;
+      o[4] := o[1] * f.tau;
+      o[5] := o[2] * o[2];
+      o[6] := o[1] * o[5] * f.tau;
+      o[7] := o[5] * f.tau;
+      o[8] := -0.64207765181607 * o[1];
+      o[9] := 0.88521043984318 + o[8];
+      o[10] := o[7] * o[9];
+      o[11] := (-1.15244078066810) + o[10];
+      o[12] := o[11] * o[2];
+      o[13] := (-1.26543154777140) + o[12];
+      o[14] := o[1] * o[13];
+      o[15] := o[1] * o[2] * o[5] * f.tau;
+      o[16] := o[2] * o[5];
+      o[17] := o[1] * o[5];
+      o[18] := o[5] * o[5];
+      o[19] := o[1] * o[18] * o[2];
+      o[20] := o[1] * o[18] * o[2] * f.tau;
+      o[21] := o[18] * o[5];
+      o[22] := o[1] * o[18] * o[5];
+      o[23] := 0.251168168486160 * o[2];
+      o[24] := 0.078841073758308 + o[23];
+      o[25] := o[15] * o[24];
+      o[26] := (-6.1005234513930) + o[25];
+      o[27] := o[26] * f.tau;
+      o[28] := 9.7944563083754 + o[27];
+      o[29] := o[2] * o[28];
+      o[30] := (-1.70429417648412) + o[29];
+      o[31] := o[1] * o[30];
+      o[32] := f.delta * f.delta;
+      o[33] := -10.9153200808732 * o[1];
+      o[34] := 13.2781565976477 + o[33];
+      o[35] := o[34] * o[7];
+      o[36] := (-6.9146446840086) + o[35];
+      o[37] := o[2] * o[36];
+      o[38] := (-2.53086309554280) + o[37];
+      o[39] := o[38] * f.tau;
+      o[40] := o[18] * o[5] * f.tau;
+      f.f := (-15.7328452902390) + f.tau * (20.9443969743070 + ((-7.6867707878716) + o[3] * (2.61859477879540 + o[4] * ((-2.80807811486200) + o[1] * (1.20533696965170 - 0.0084566812812502 * o[6])))) * f.tau) + f.delta * (o[14] + f.delta * (0.38493460186671 + o[1] * ((-0.85214708824206) + o[2] * (4.8972281541877 + ((-3.05026172569650) + o[15] * (0.039420536879154 + 0.125584084243080 * o[2])) * f.tau)) + f.delta * ((-0.279993296987100) + o[1] * (1.38997995694600 + o[1] * ((-2.01899150235700) + o[16] * ((-0.0082147637173963) - 0.47596035734923 * o[17]))) + f.delta * (0.043984074473500 + o[1] * ((-0.44476435428739) + o[1] * (0.90572070719733 + 0.70522450087967 * o[19])) + f.delta * (f.delta * ((-0.0221754008730960) + o[1] * (0.094260751665092 + 0.164362784479610 * o[21]) + f.delta * ((-0.0135033722413480 * o[1]) + f.delta * ((-0.0148343453524720 * o[22]) + f.delta * (o[1] * (0.00057922953628084 + 0.0032308904703711 * o[21]) + f.delta * (0.000080964802996215 - 0.000044923899061815 * f.delta * o[22] - 0.000165576797950370 * f.tau))))) + (0.107705126263320 + o[1] * ((-0.32913623258954) - 0.50871062041158 * o[20])) * f.tau))))) + 1.06580700285130 * Modelica.Math.log(f.delta);
+      f.fdelta := (1.06580700285130 + f.delta * (o[14] + f.delta * (0.76986920373342 + o[31] + f.delta * ((-0.83997989096130) + o[1] * (4.1699398708380 + o[1] * ((-6.0569745070710) + o[16] * ((-0.0246442911521889) - 1.42788107204769 * o[17]))) + f.delta * (0.175936297894000 + o[1] * ((-1.77905741714956) + o[1] * (3.6228828287893 + 2.82089800351868 * o[19])) + f.delta * (f.delta * ((-0.133052405238576) + o[1] * (0.56556450999055 + 0.98617670687766 * o[21]) + f.delta * ((-0.094523605689436 * o[1]) + f.delta * ((-0.118674762819776 * o[22]) + f.delta * (o[1] * (0.0052130658265276 + 0.0290780142333399 * o[21]) + f.delta * (0.00080964802996215 - 0.00049416288967996 * f.delta * o[22] - 0.00165576797950370 * f.tau))))) + (0.53852563131660 + o[1] * ((-1.64568116294770) - 2.54355310205790 * o[20])) * f.tau)))))) / f.delta;
+      f.fdeltadelta := ((-1.06580700285130) + o[32] * (0.76986920373342 + o[31] + f.delta * ((-1.67995978192260) + o[1] * (8.3398797416760 + o[1] * ((-12.1139490141420) + o[16] * ((-0.049288582304378) - 2.85576214409538 * o[17]))) + f.delta * (0.52780889368200 + o[1] * ((-5.3371722514487) + o[1] * (10.8686484863680 + 8.4626940105560 * o[19])) + f.delta * (f.delta * ((-0.66526202619288) + o[1] * (2.82782254995276 + 4.9308835343883 * o[21]) + f.delta * ((-0.56714163413662 * o[1]) + f.delta * ((-0.83072333973843 * o[22]) + f.delta * (o[1] * (0.041704526612220 + 0.232624113866719 * o[21]) + f.delta * (0.0072868322696594 - 0.0049416288967996 * f.delta * o[22] - 0.0149019118155333 * f.tau))))) + (2.15410252526640 + o[1] * ((-6.5827246517908) - 10.1742124082316 * o[20])) * f.tau))))) / o[32];
+      f.ftau := 20.9443969743070 + ((-15.3735415757432) + o[3] * (18.3301634515678 + o[4] * ((-28.0807811486200) + o[1] * (14.4640436358204 - 0.194503669468755 * o[6])))) * f.tau + f.delta * (o[39] + f.delta * (f.tau * ((-1.70429417648412) + o[2] * (29.3833689251262 + ((-21.3518320798755) + o[15] * (0.86725181134139 + 3.2651861903201 * o[2])) * f.tau)) + f.delta * ((2.77995991389200 + o[1] * ((-8.0759660094280) + o[16] * ((-0.131436219478341) - 12.3749692910800 * o[17]))) * f.tau + f.delta * (((-0.88952870857478) + o[1] * (3.6228828287893 + 18.3358370228714 * o[19])) * f.tau + f.delta * (0.107705126263320 + o[1] * ((-0.98740869776862) - 13.2264761307011 * o[20]) + f.delta * ((0.188521503330184 + 4.2734323964699 * o[21]) * f.tau + f.delta * ((-0.0270067444826960 * f.tau) + f.delta * ((-0.38569297916427 * o[40]) + f.delta * (f.delta * ((-0.000165576797950370) - 0.00116802137560719 * f.delta * o[40]) + (0.00115845907256168 + 0.084003152229649 * o[21]) * f.tau)))))))));
+      f.ftautau := (-15.3735415757432) + o[3] * (109.980980709407 + o[4] * ((-252.727030337580) + o[1] * (159.104479994024 - 4.2790807283126 * o[6]))) + f.delta * ((-2.53086309554280) + o[2] * ((-34.573223420043) + (185.894192367068 - 174.645121293971 * o[1]) * o[7]) + f.delta * ((-1.70429417648412) + o[2] * (146.916844625631 + ((-128.110992479253) + o[15] * (18.2122880381691 + 81.629654758002 * o[2])) * f.tau) + f.delta * (2.77995991389200 + o[1] * ((-24.2278980282840) + o[16] * ((-1.97154329217511) - 309.374232277000 * o[17])) + f.delta * ((-0.88952870857478) + o[1] * (10.8686484863680 + 458.39592557179 * o[19]) + f.delta * (f.delta * (0.188521503330184 + 106.835809911747 * o[21] + f.delta * ((-0.0270067444826960) + f.delta * ((-9.6423244791068 * o[21]) + f.delta * (0.00115845907256168 + 2.10007880574121 * o[21] - 0.0292005343901797 * o[21] * o[32])))) + ((-1.97481739553724) - 330.66190326753 * o[20]) * f.tau)))));
+      f.fdeltatau := o[39] + f.delta * (f.tau * ((-3.4085883529682) + o[2] * (58.766737850252 + ((-42.703664159751) + o[15] * (1.73450362268278 + 6.5303723806402 * o[2])) * f.tau)) + f.delta * ((8.3398797416760 + o[1] * ((-24.2278980282840) + o[16] * ((-0.39430865843502) - 37.124907873240 * o[17]))) * f.tau + f.delta * (((-3.5581148342991) + o[1] * (14.4915313151573 + 73.343348091486 * o[19])) * f.tau + f.delta * (0.53852563131660 + o[1] * ((-4.9370434888431) - 66.132380653505 * o[20]) + f.delta * ((1.13112901998110 + 25.6405943788192 * o[21]) * f.tau + f.delta * ((-0.189047211378872 * f.tau) + f.delta * ((-3.08554383331418 * o[40]) + f.delta * (f.delta * ((-0.00165576797950370) - 0.0128482351316791 * f.delta * o[40]) + (0.0104261316530551 + 0.75602837006684 * o[21]) * f.tau))))))));
+    end f3;
+
+    function g5 "base function for region 5: g(p,T)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      output Modelica.Media.Common.GibbsDerivs g "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+    protected
+      Real[11] o "vector of auxiliary variables";
+    algorithm
+//         assert(p > triple.ptriple,
+//           "IF97 medium function g5 called with too low pressure\n" +
+//           "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
+//         assert(p <= data.PLIMIT5,
+//           "IF97 medium function g5: input pressure (= " + String(p) + " Pa) is higher than 10 Mpa in region 5");
+//         assert(T <= 2273.15,
+//           "IF97 medium function g5: input temperature (= " + String(T) + " K) is higher than limit of 2273.15K in region 5");
+      g.p := p;
+      g.T := T;
+      g.R_s := data.RH2O;
+      g.pi := max(p, triple.ptriple) / data.PSTAR5;
+      g.tau := data.TSTAR5 / max(T, triple.Ttriple);
+      o[1] := g.tau * g.tau;
+      o[2] := -0.0045942820899910 * o[1];
+      o[3] := 0.00217746787145710 + o[2];
+      o[4] := o[3] * g.tau;
+      o[5] := o[1] * g.tau;
+      o[6] := o[1] * o[1];
+      o[7] := o[6] * o[6];
+      o[8] := o[7] * g.tau;
+      o[9] := -7.9449656719138e-6 * o[8];
+      o[10] := g.pi * g.pi;
+      o[11] := -0.0137828462699730 * o[1];
+      g.g := g.pi * ((-0.000125631835895920) + o[4] + g.pi * ((-3.9724828359569e-6 * o[8]) + 1.29192282897840e-7 * o[5] * g.pi)) + ((-0.0248051489334660) + g.tau * (0.36901534980333 + g.tau * ((-3.11613182139250) + g.tau * ((-13.1799836742010) + (6.8540841634434 - 0.32961626538917 * g.tau) * g.tau + Modelica.Math.log(g.pi))))) / o[5];
+      g.gpi := (1.0 + g.pi * ((-0.000125631835895920) + o[4] + g.pi * (o[9] + 3.8757684869352e-7 * o[5] * g.pi))) / g.pi;
+      g.gpipi := ((-1.00000000000000) + o[10] * (o[9] + 7.7515369738704e-7 * o[5] * g.pi)) / o[10];
+      g.gtau := g.pi * (0.00217746787145710 + o[11] + g.pi * ((-0.000035752345523612 * o[7]) + 3.8757684869352e-7 * o[1] * g.pi)) + (0.074415446800398 + g.tau * ((-0.73803069960666) + (3.11613182139250 + o[1] * (6.8540841634434 - 0.65923253077834 * g.tau)) * g.tau)) / o[6];
+      g.gtautau := ((-0.297661787201592) + g.tau * (2.21409209881998 + ((-6.2322636427850) - 0.65923253077834 * o[5]) * g.tau)) / (o[6] * g.tau) + g.pi * ((-0.0275656925399460 * g.tau) + g.pi * ((-0.000286018764188897 * o[1] * o[6] * g.tau) + 7.7515369738704e-7 * g.pi * g.tau));
+      g.gtaupi := 0.00217746787145710 + o[11] + g.pi * ((-0.000071504691047224 * o[7]) + 1.16273054608056e-6 * o[1] * g.pi);
+    end g5;
+
+    function gibbs "Gibbs function for region 1, 2 or 5: g(p,T,region)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      input Integer region "IF97 region, 1, 2 or 5";
+      output Real g "dimensionless Gibbs funcion";
+    protected
+      Modelica.Media.Common.GibbsDerivs gibbs "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+    algorithm
+      assert(region == 1 or region == 2 or region == 5, "IF97 medium function gibbs called with wrong region (= " + String(region) + ").\n" + "Only regions 1, 2 or 5 are possible");
+      if region == 1 then
+        gibbs := g1(p, T);
+      elseif region == 2 then
+        gibbs := g2(p, T);
+      else
+        gibbs := g5(p, T);
+      end if;
+      g := gibbs.g;
+    end gibbs;
+
+    function g1pitau "derivative of g wrt pi and tau"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      output Real pi "dimensionless pressure";
+      output Real tau "dimensionless temperature";
+      output Real gpi "dimensionless dervative of Gibbs function wrt pi";
+      output Real gtau "dimensionless dervative of Gibbs function wrt tau";
+    protected
+      Real pi1 "dimensionless pressure";
+      Real tau1 "dimensionless temperature";
+      Real[28] o "vector of auxiliary variables";
+    algorithm
+      assert(p > triple.ptriple, "IF97 medium function g1pitau called with too low pressure\n" + "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
+      assert(p <= 100.0e6, "IF97 medium function g1pitau: the input pressure (= " + String(p) + " Pa) is higher than 100 Mpa");
+      assert(T >= 273.15, "IF97 medium function g1pitau: the temperature (= " + String(T) + " K) is lower than 273.15 K!");
+      pi := p / data.PSTAR1;
+      tau := data.TSTAR1 / T;
+      pi1 := 7.1 - pi;
+      tau1 := (-1.222) + tau;
+      o[1] := tau1 * tau1;
+      o[2] := o[1] * tau1;
+      o[3] := 1 / o[2];
+      o[4] := o[1] * o[1];
+      o[5] := o[4] * o[4];
+      o[6] := o[1] * o[5];
+      o[7] := o[1] * o[4];
+      o[8] := 1 / o[4];
+      o[9] := o[1] * o[4] * o[5];
+      o[10] := o[4] * tau1;
+      o[11] := 1 / o[10];
+      o[12] := o[4] * o[5];
+      o[13] := o[5] * tau1;
+      o[14] := 1 / o[13];
+      o[15] := pi1 * pi1;
+      o[16] := o[15] * pi1;
+      o[17] := o[15] * o[15];
+      o[18] := o[17] * o[17];
+      o[19] := o[17] * o[18] * pi1;
+      o[20] := o[15] * o[17];
+      o[21] := o[5] * o[5];
+      o[22] := o[21] * o[21];
+      o[23] := o[22] * o[5] * tau1;
+      o[24] := 1 / o[23];
+      o[25] := o[22] * o[5];
+      o[26] := 1 / o[25];
+      o[27] := o[1] * o[22] * o[4] * tau1;
+      o[28] := 1 / o[27];
+      gtau := pi1 * (((-0.00254871721114236) + o[1] * (0.00424944110961118 + (0.018990068218419 + ((-0.021841717175414) - 0.00015851507390979 * o[1]) * o[1]) * o[7])) / o[6] + pi1 * (o[8] * (0.00141552963219801 + o[4] * (0.000047661393906987 + o[1] * ((-0.0000132425535992538) - 1.2358149370591e-14 * o[9]))) + pi1 * (o[11] * (0.000126718579380216 - 5.11230768720618e-9 * o[6]) + pi1 * ((0.000011212640954 + (1.30342445791202e-6 - 1.4341729937924e-12 * o[12]) * o[2]) / o[7] + pi1 * (3.24135974880936e-6 * o[14] + o[16] * ((1.40077319158051e-8 + 1.04549227383804e-9 * o[10]) / o[12] + o[19] * (1.9941018075704e-17 / (o[1] * o[21] * o[4] * o[5]) + o[15] * ((-4.48827542684151e-19 / o[22]) + o[20] * ((-1.00075970318621e-21 * o[28]) + pi1 * (4.65957282962769e-22 * o[26] + pi1 * ((-7.2912378325616e-23 * o[24]) + 3.83502057899078e-24 * pi1 / (o[1] * o[22] * o[5])))))))))))) + o[3] * ((-0.29265942426334) + tau1 * (0.84548187169114 + o[1] * (3.3855169168385 + tau1 * ((-1.91583926775744) + tau1 * (0.47316115539684 + ((-0.066465668798004) + 0.0040607314991784 * tau1) * tau1)))));
+      gpi := pi1 * (pi1 * ((0.000095038934535162 + o[4] * (8.4812393955936e-6 + 2.55615384360309e-9 * o[7])) * o[8] + pi1 * (o[11] * (8.9701127632e-6 + (2.60684891582404e-6 + 5.7366919751696e-13 * o[12]) * o[2]) + pi1 * (2.02584984300585e-6 / o[5] + o[16] * (o[19] * (o[15] * (o[20] * ((-7.63737668221055e-22 / (o[1] * o[22] * o[4])) + pi1 * (3.5842867920213e-22 * o[28] + pi1 * ((-5.65070932023524e-23 * o[26]) + 2.99318679335866e-24 * o[24] * pi1))) - 3.33001080055983e-19 / (o[1] * o[21] * o[4] * o[5] * tau1)) + 1.44400475720615e-17 / (o[21] * o[4] * o[5] * tau1)) + (1.01874413933128e-8 + 1.39398969845072e-9 * o[10]) / (o[1] * o[5] * tau1))))) + o[3] * (0.00094368642146534 + o[2] * (0.00060003561586052 + ((-0.000095322787813974) + o[1] * (8.8283690661692e-6 + 1.45389992595188e-15 * o[9])) * tau1))) + o[14] * ((-0.00028319080123804) + o[1] * (0.00060706301565874 + o[7] * (0.018990068218419 + tau1 * (0.032529748770505 + (0.021841717175414 + 0.00005283835796993 * o[1]) * tau1))));
+    end g1pitau;
+
+    function g2pitau "derivative of g wrt pi and tau"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      output Real pi "dimensionless pressure";
+      output Real tau "dimensionless temperature";
+      output Real gpi "dimensionless dervative of Gibbs function wrt pi";
+      output Real gtau "dimensionless dervative of Gibbs function wrt tau";
+    protected
+      Real tau2 "dimensionless temperature";
+      Real[22] o "vector of auxiliary variables";
+    algorithm
+      assert(p > triple.ptriple, "IF97 medium function g2pitau called with too low pressure\n" + "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
+      assert(p <= 100.0e6, "IF97 medium function g2pitau: the input pressure (= " + String(p) + " Pa) is higher than 100 Mpa");
+      assert(T >= 273.15, "IF97 medium function g2pitau: the temperature (= " + String(T) + " K) is lower than 273.15 K!");
+      assert(T <= 1073.15, "IF97 medium function g2pitau: the input temperature (= " + String(T) + " K) is higher than the limit of 1073.15 K");
+      pi := p / data.PSTAR2;
+      tau := data.TSTAR2 / T;
+      tau2 := (-0.5) + tau;
+      o[1] := tau * tau;
+      o[2] := o[1] * o[1];
+      o[3] := tau2 * tau2;
+      o[4] := o[3] * tau2;
+      o[5] := o[3] * o[3];
+      o[6] := o[5] * o[5];
+      o[7] := o[6] * o[6];
+      o[8] := o[5] * o[6] * o[7] * tau2;
+      o[9] := o[3] * o[5];
+      o[10] := o[5] * o[6] * tau2;
+      o[11] := o[3] * o[7] * tau2;
+      o[12] := o[3] * o[5] * o[6];
+      o[13] := o[3] * o[5] * tau2;
+      o[14] := o[5] * o[6] * o[7];
+      o[15] := pi * pi;
+      o[16] := o[15] * o[15];
+      o[17] := o[15] * o[16];
+      o[18] := o[5] * o[7] * tau2;
+      o[19] := o[7] * o[7];
+      o[20] := o[3] * o[5] * o[6] * tau2;
+      o[21] := o[5] * o[7];
+      o[22] := o[3] * o[7];
+      gtau := (0.0280439559151 + tau * ((-0.2858109552582) + tau * (1.2213149471784 + tau * ((-2.848163942888) + tau * (4.38395111945 + o[1] * (10.08665568018 + ((-0.5681726521544) + 0.06380539059921 * tau) * tau)))))) / (o[1] * o[2]) + pi * ((-0.017834862292358) + tau2 * ((-0.09199202739273) + ((-0.172743777250296) - 0.30195167236758 * o[4]) * tau2) + pi * ((-0.000033032641670203) + ((-0.0003789797503263) + o[3] * ((-0.015757110897342) + o[4] * ((-0.306581069554011) - 0.000960283724907132 * o[8]))) * tau2 + pi * (4.3870667284435e-7 + o[3] * ((-0.00009683303171571) + o[4] * ((-0.0090203547252888) - 1.42338887469272 * o[8])) + pi * ((-7.8847309559367e-10) + (2.558143570457e-8 + 1.44676118155521e-6 * tau2) * tau2 + pi * (0.0000160454534363627 * o[9] + pi * (((-5.0144299353183e-11) + o[10] * ((-0.033874355714168) - 836.35096769364 * o[11])) * o[3] + pi * (((-0.0000138839897890111) - 0.973671060893475 * o[12]) * o[3] * o[6] + pi * (o[13] * (9.0049690883672e-11 - 296.320827232793 * o[14]) + pi * (2.57526266427144e-7 * o[5] * o[6] + pi * (o[4] * (4.1627860840696e-19 + ((-1.0234747095929e-12) - 1.40254511313154e-8 * o[5]) * o[9]) + o[17] * (o[14] * ((-2.34560435076256e-9) + 5.3465159397045 * o[18]) + o[15] * ((-19.1874828272775 * o[19] * o[6] * o[7]) + o[15] * (o[11] * (1.78371690710842e-23 + (1.07202609066812e-11 - 0.000201611844951398 * o[10]) * o[20]) + pi * ((-1.24017662339842e-24 * o[21]) + pi * (0.000200482822351322 * o[19] * o[5] * o[7] + pi * ((-4.97975748452559e-14 * o[19] * o[3] * o[5]) + (1.90027787547159e-27 + o[12] * (2.21658861403112e-15 - 0.0000547344301999018 * o[22])) * o[6] * o[7] * pi * tau2))))))))))))))));
+      gpi := (1. + pi * ((-0.0017731742473213) + tau2 * ((-0.017834862292358) + tau2 * ((-0.045996013696365) + ((-0.057581259083432) - 0.05032527872793 * o[4]) * tau2)) + pi * (tau2 * ((-0.000066065283340406) + ((-0.0003789797503263) + o[3] * ((-0.007878555448671) + o[4] * ((-0.087594591301146) - 0.000053349095828174 * o[8]))) * tau2) + pi * (6.1445213076927e-8 + (1.31612001853305e-6 + o[3] * ((-0.00009683303171571) + o[4] * ((-0.0045101773626444) - 0.122004760687947 * o[8]))) * tau2 + pi * (tau2 * ((-3.15389238237468e-9) + (5.116287140914e-8 + 1.92901490874028e-6 * tau2) * tau2) + pi * (0.0000114610381688305 * o[13] + pi * (((-1.00288598706366e-10) + o[10] * ((-0.012702883392813) - 143.374451604624 * o[11])) * o[4] + pi * ((-4.1341695026989e-17) + ((-8.8352662293707e-6) - 0.272627897050173 * o[12]) * o[3] * o[6] * tau2 + pi * ((9.0049690883672e-11 - 65.8490727183984 * o[14]) * o[6] + pi * (1.78287415218792e-7 * o[10] + pi * (o[5] * (1.0406965210174e-18 + ((-1.0234747095929e-12) - 1.0018179379511e-8 * o[5]) * o[9]) + o[17] * (((-1.29412653835176e-9) + 1.71088510070544 * o[18]) * o[8] + o[15] * ((-6.05920510335078 * o[19] * o[6] * o[7] * tau2) + o[15] * ((1.78371690710842e-23 + (6.1258633752464e-12 - 0.000084004935396416 * o[10]) * o[20]) * o[21] + pi * ((-1.24017662339842e-24 * o[18]) + pi * (0.0000832192847496054 * o[19] * o[5] * o[7] * tau2 + pi * ((1.75410265428146e-27 + o[12] * (1.32995316841867e-15 - 0.0000226487297378904 * o[22])) * o[3] * o[6] * o[7] * pi - 2.93678005497663e-14 * o[19] * o[3] * o[5] * tau2))))))))))))))))) / pi;
+    end g2pitau;
+
+    function g5pitau "derivative of g wrt pi and tau"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      output Real pi "dimensionless pressure";
+      output Real tau "dimensionless temperature";
+      output Real gpi "dimensionless dervative of Gibbs function wrt pi";
+      output Real gtau "dimensionless dervative of Gibbs function wrt tau";
+    protected
+      Real[3] o "vector of auxiliary variables";
+    algorithm
+      assert(p > triple.ptriple, "IF97 medium function g5pitau called with too low pressure\n" + "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
+      assert(p <= data.PLIMIT5, "IF97 medium function g5pitau: input pressure (= " + String(p) + " Pa) is higher than 10 Mpa in region 5");
+      assert(T <= 2273.15, "IF97 medium function g5pitau: input temperature (= " + String(T) + " K) is higher than limit of 2273.15 K in region 5");
+      pi := p / data.PSTAR5;
+      tau := data.TSTAR5 / T;
+      o[1] := tau * tau;
+      o[2] := o[1] * o[1];
+      o[3] := o[2] * o[2];
+      gtau := pi * (0.0021774678714571 - 0.013782846269973 * o[1] + pi * ((-0.0000357523455236121 * o[3]) + 3.8757684869352e-7 * o[1] * pi)) + (0.074415446800398 + tau * ((-0.73803069960666) + (3.1161318213925 + o[1] * (6.8540841634434 - 0.65923253077834 * tau)) * tau)) / o[2];
+      gpi := (1.0 + pi * ((-0.00012563183589592) + (0.0021774678714571 - 0.004594282089991 * o[1]) * tau + pi * ((-7.9449656719138e-6 * o[3] * tau) + 3.8757684869352e-7 * o[1] * pi * tau))) / pi;
+    end g5pitau;
+
+    function f3deltatau "1st derivatives of f wrt delta and tau"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      output Real delta "dimensionless density";
+      output Real tau "dimensionless temperature";
+      output Real fdelta "dimensionless dervative of Helmholtz function wrt delta";
+      output Real ftau "dimensionless dervative of Helmholtz function wrt tau";
+    protected
+      Real[13] o "vector of auxiliary variables";
+    algorithm
+      tau := data.TCRIT / T;
+      delta := if d == data.DCRIT and T == data.TCRIT then 1 + Modelica.Constants.eps else d / data.DCRIT;
+      o[1] := tau * tau;
+      o[2] := o[1] * o[1];
+      o[3] := o[2] * o[2];
+      o[4] := o[3] * tau;
+      o[5] := o[1] * o[2] * o[3] * tau;
+      o[6] := o[2] * o[3];
+      o[7] := o[1] * o[3];
+      o[8] := o[3] * o[3];
+      o[9] := o[1] * o[2] * o[8];
+      o[10] := o[1] * o[2] * o[8] * tau;
+      o[11] := o[3] * o[8];
+      o[12] := o[1] * o[3] * o[8];
+      o[13] := o[3] * o[8] * tau;
+      fdelta := (1.0658070028513 + delta * (o[1] * ((-1.2654315477714) + o[2] * ((-1.1524407806681) + (0.88521043984318 - 0.64207765181607 * o[1]) * o[4])) + delta * (0.76986920373342 + o[1] * ((-1.70429417648412) + o[2] * (9.7944563083754 + ((-6.100523451393) + (0.078841073758308 + 0.25116816848616 * o[2]) * o[5]) * tau)) + delta * ((-0.8399798909613) + o[1] * (4.169939870838 + o[1] * ((-6.056974507071) + o[6] * ((-0.0246442911521889) - 1.42788107204769 * o[7]))) + delta * (0.175936297894 + o[1] * ((-1.77905741714956) + o[1] * (3.62288282878932 + 2.82089800351868 * o[9])) + delta * (delta * ((-0.133052405238576) + o[1] * (0.565564509990552 + 0.98617670687766 * o[11]) + delta * ((-0.094523605689436 * o[1]) + delta * ((-0.118674762819776 * o[12]) + delta * (o[1] * (0.00521306582652756 + 0.0290780142333399 * o[11]) + delta * (0.00080964802996215 - 0.000494162889679965 * delta * o[12] - 0.0016557679795037 * tau))))) + (0.5385256313166 + o[1] * ((-1.6456811629477) - 2.5435531020579 * o[10])) * tau)))))) / delta;
+      ftau := 20.944396974307 + tau * ((-15.3735415757432) + o[2] * tau * (18.3301634515678 + o[1] * tau * ((-28.08078114862) + o[1] * (14.4640436358204 - 0.194503669468755 * o[1] * o[3] * tau)))) + delta * (((-2.5308630955428) + o[2] * ((-6.9146446840086) + (13.2781565976477 - 10.9153200808732 * o[1]) * o[4])) * tau + delta * (tau * ((-1.70429417648412) + o[2] * (29.3833689251262 + ((-21.3518320798755) + (0.867251811341388 + 3.26518619032008 * o[2]) * o[5]) * tau)) + delta * ((2.779959913892 + o[1] * ((-8.075966009428) + o[6] * ((-0.131436219478341) - 12.37496929108 * o[7]))) * tau + delta * (((-0.88952870857478) + o[1] * (3.62288282878932 + 18.3358370228714 * o[9])) * tau + delta * (0.10770512626332 + o[1] * ((-0.98740869776862) - 13.2264761307011 * o[10]) + delta * ((0.188521503330184 + 4.27343239646986 * o[11]) * tau + delta * ((-0.027006744482696 * tau) + delta * ((-0.385692979164272 * o[13]) + delta * (delta * ((-0.00016557679795037) - 0.00116802137560719 * delta * o[13]) + (0.00115845907256168 + 0.0840031522296486 * o[11]) * tau)))))))));
+    end f3deltatau;
+
+    function tph1 "inverse function for region 1: T(p,h)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      output Modelica.Units.SI.Temperature T "temperature (K)";
+    protected
+      Real pi "dimensionless pressure";
+      Real eta1 "dimensionless specific enthalpy";
+      Real[3] o "vector of auxiliary variables";
+    algorithm
+      assert(p > triple.ptriple, "IF97 medium function tph1 called with too low pressure\n" + "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
+      pi := p / data.PSTAR2;
+      eta1 := h / data.HSTAR1 + 1.0;
+      o[1] := eta1 * eta1;
+      o[2] := o[1] * o[1];
+      o[3] := o[2] * o[2];
+      T := (-238.724899245210) - 13.3917448726020 * pi + eta1 * (404.21188637945 + 43.211039183559 * pi + eta1 * (113.497468817180 - 54.010067170506 * pi + eta1 * (30.5358922039160 * pi + eta1 * ((-6.5964749423638 * pi) + o[1] * ((-5.8457616048039) + o[2] * (pi * (0.0093965400878363 + ((-0.0000258586412820730) + 6.6456186191635e-8 * pi) * pi) + o[2] * o[3] * ((-0.000152854824131400) + o[1] * o[3] * ((-1.08667076953770e-6) + pi * (1.15736475053400e-7 + pi * ((-4.0644363084799e-9) + pi * (8.0670734103027e-11 + pi * ((-9.3477771213947e-13) + (5.8265442020601e-15 - 1.50201859535030e-17 * pi) * pi))))))))))));
+    end tph1;
+
+    function tps1 "inverse function for region 1: T(p,s)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      output Modelica.Units.SI.Temperature T "temperature (K)";
+    protected
+      constant Modelica.Units.SI.Pressure pstar = 1.0e6;
+      constant Modelica.Units.SI.SpecificEntropy sstar = 1.0e3;
+      Real pi "dimensionless pressure";
+      Real sigma1 "dimensionless specific entropy";
+      Real[6] o "vector of auxiliary variables";
+    algorithm
+      pi := p / pstar;
+      assert(p > triple.ptriple, "IF97 medium function tps1 called with too low pressure\n" + "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
+      sigma1 := s / sstar + 2.0;
+      o[1] := sigma1 * sigma1;
+      o[2] := o[1] * o[1];
+      o[3] := o[2] * o[2];
+      o[4] := o[3] * o[3];
+      o[5] := o[4] * o[4];
+      o[6] := o[1] * o[2] * o[4];
+      T := 174.782680583070 + sigma1 * (34.806930892873 + sigma1 * (6.5292584978455 + (0.33039981775489 + o[3] * ((-1.92813829231960e-7) - 2.49091972445730e-23 * o[2] * o[4])) * sigma1)) + pi * ((-0.261076364893320) + pi * (0.00056608900654837 + pi * (o[1] * o[3] * (2.64004413606890e-13 + 7.8124600459723e-29 * o[6]) - 3.07321999036680e-31 * o[5] * pi) + sigma1 * ((-0.00032635483139717) + sigma1 * (0.000044778286690632 + o[1] * o[2] * ((-5.1322156908507e-10) - 4.2522657042207e-26 * o[6]) * sigma1))) + sigma1 * (0.225929659815860 + sigma1 * ((-0.064256463395226) + sigma1 * (0.0078876289270526 + o[3] * sigma1 * (3.5672110607366e-10 + 1.73324969948950e-24 * o[1] * o[4] * sigma1)))));
+    end tps1;
+
+    function tph2 "reverse function for region 2: T(p,h)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      output Modelica.Units.SI.Temperature T "temperature (K)";
+    protected
+      Real pi "dimensionless pressure";
+      Real pi2b "dimensionless pressure";
+      Real pi2c "dimensionless pressure";
+      Real eta "dimensionless specific enthalpy";
+      Real etabc "dimensionless specific enthalpy";
+      Real eta2a "dimensionless specific enthalpy";
+      Real eta2b "dimensionless specific enthalpy";
+      Real eta2c "dimensionless specific enthalpy";
+      Real[8] o "vector of auxiliary variables";
+    algorithm
+      pi := p * data.IPSTAR;
+      eta := h * data.IHSTAR;
+      etabc := h * 1.0e-3;
+      if pi < 4.0 then
+        eta2a := eta - 2.1;
+        o[1] := eta2a * eta2a;
+        o[2] := o[1] * o[1];
+        o[3] := pi * pi;
+        o[4] := o[3] * o[3];
+        o[5] := o[3] * pi;
+        T := 1089.89523182880 + (1.84457493557900 - 0.0061707422868339 * pi) * pi + eta2a * (849.51654495535 - 4.1792700549624 * pi + eta2a * ((-107.817480918260) + (6.2478196935812 - 0.310780466295830 * pi) * pi + eta2a * (33.153654801263 - 17.3445631081140 * pi + o[2] * ((-7.4232016790248) + pi * ((-200.581768620960) + 11.6708730771070 * pi) + o[1] * (271.960654737960 * pi + o[1] * ((-455.11318285818 * pi) + eta2a * (1.38657242832260 * o[4] + o[1] * o[2] * (3091.96886047550 * pi + o[1] * (11.7650487243560 + o[2] * ((-13551.3342407750 * o[5]) + o[2] * ((-62.459855192507 * o[3] * o[4] * pi) + o[2] * (o[4] * (235988.325565140 + 7399.9835474766 * pi) + o[1] * (19127.7292396600 * o[3] * o[4] + o[1] * (o[3] * (1.28127984040460e8 - 551966.97030060 * o[5]) + o[1] * ((-9.8554909623276e8 * o[3]) + o[1] * (2.82245469730020e9 * o[3] + o[1] * (o[3] * ((-3.5948971410703e9) + 3.7154085996233e6 * o[5]) + o[1] * pi * (252266.403578720 + pi * (1.72273499131970e9 + pi * (1.28487346646500e7 + ((-1.31052365450540e7) - 415351.64835634 * o[3]) * pi))))))))))))))))))));
+      elseif pi < (0.12809002730136e-03 * etabc - 0.67955786399241) * etabc + 0.90584278514723e3 then
+        eta2b := eta - 2.6;
+        pi2b := pi - 2.0;
+        o[1] := pi2b * pi2b;
+        o[2] := o[1] * pi2b;
+        o[3] := o[1] * o[1];
+        o[4] := eta2b * eta2b;
+        o[5] := o[4] * o[4];
+        o[6] := o[4] * o[5];
+        o[7] := o[5] * o[5];
+        T := 1489.50410795160 + 0.93747147377932 * pi2b + eta2b * (743.07798314034 + o[2] * (0.000110328317899990 - 1.75652339694070e-18 * o[1] * o[3]) + eta2b * ((-97.708318797837) + pi2b * (3.3593118604916 + pi2b * ((-0.0218107553247610) + pi2b * (0.000189552483879020 + (2.86402374774560e-7 - 8.1456365207833e-14 * o[2]) * pi2b))) + o[5] * (3.3809355601454 * pi2b + o[4] * ((-0.108297844036770 * o[1]) + o[5] * (2.47424647056740 + (0.168445396719040 + o[1] * (0.00308915411605370 - 0.0000107798573575120 * pi2b)) * pi2b + o[6] * ((-0.63281320016026) + pi2b * (0.73875745236695 + ((-0.046333324635812) + o[1] * ((-0.000076462712454814) + 2.82172816350400e-7 * pi2b)) * pi2b) + o[6] * (1.13859521296580 + pi2b * ((-0.47128737436186) + o[1] * (0.00135555045549490 + (0.0000140523928183160 + 1.27049022719450e-6 * pi2b) * pi2b)) + o[5] * ((-0.47811863648625) + (0.150202731397070 + o[2] * ((-0.0000310838143314340) + o[1] * ((-1.10301392389090e-8) - 2.51805456829620e-11 * pi2b))) * pi2b + o[5] * o[7] * (0.0085208123431544 + pi2b * ((-0.00217641142197500) + pi2b * (0.000071280351959551 + o[1] * ((-1.03027382121030e-6) + (7.3803353468292e-8 + 8.6934156344163e-15 * o[3]) * pi2b))))))))))));
+      else
+        eta2c := eta - 1.8;
+        pi2c := pi + 25.0;
+        o[1] := pi2c * pi2c;
+        o[2] := o[1] * o[1];
+        o[3] := o[1] * o[2] * pi2c;
+        o[4] := 1 / o[3];
+        o[5] := o[1] * o[2];
+        o[6] := eta2c * eta2c;
+        o[7] := o[2] * o[2];
+        o[8] := o[6] * o[6];
+        T := eta2c * ((859777.22535580 + o[1] * (482.19755109255 + 1.12615974072300e-12 * o[5])) / o[1] + eta2c * (((-5.8340131851590e11) + (2.08255445631710e10 + 31081.0884227140 * o[2]) * pi2c) / o[5] + o[6] * (o[8] * (o[6] * (1.23245796908320e-7 * o[5] + o[6] * ((-1.16069211309840e-6 * o[5]) + o[8] * (0.0000278463670885540 * o[5] + ((-0.00059270038474176 * o[5]) + 0.00129185829918780 * o[5] * o[6]) * o[8]))) - 10.8429848800770 * pi2c) + o[4] * (7.3263350902181e12 + o[7] * (3.7966001272486 + ((-0.045364172676660) - 1.78049822406860e-11 * o[2]) * pi2c))))) + o[4] * ((-3.2368398555242e12) + pi2c * (3.5825089945447e11 + pi2c * ((-1.07830682174700e10) + o[1] * pi2c * (610747.83564516 + pi2c * ((-25745.7236041700) + (1208.23158659360 + 1.45591156586980e-13 * o[5]) * pi2c)))));
+      end if;
+    end tph2;
+
+    function tps2a "reverse function for region 2a: T(p,s)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      output Modelica.Units.SI.Temperature T "temperature (K)";
+    protected
+      Real[12] o "vector of auxiliary variables";
+      constant Real IPSTAR = 1.0e-6 "scaling variable";
+      constant Real ISSTAR2A = 1 / 2000.0 "scaling variable";
+      Real pi "dimensionless pressure";
+      Real sigma2a "dimensionless specific entropy";
+    algorithm
+      pi := p * IPSTAR;
+      sigma2a := s * ISSTAR2A - 2.0;
+      o[1] := pi ^ 0.5;
+      o[2] := sigma2a * sigma2a;
+      o[3] := o[2] * o[2];
+      o[4] := o[3] * o[3];
+      o[5] := o[4] * o[4];
+      o[6] := pi ^ 0.25;
+      o[7] := o[2] * o[4] * o[5];
+      o[8] := 1 / o[7];
+      o[9] := o[3] * sigma2a;
+      o[10] := o[2] * o[3] * sigma2a;
+      o[11] := o[3] * o[4] * sigma2a;
+      o[12] := o[2] * sigma2a;
+      T := (((-392359.83861984) + (515265.73827270 + o[3] * (40482.443161048 + o[2] * o[3] * ((-321.93790923902) + o[2] * (96.961424218694 - 22.8678463717730 * sigma2a)))) * sigma2a) / (o[4] * o[5]) + o[6] * (((-449429.14124357) + o[3] * ((-5011.8336020166) + 0.35684463560015 * o[4] * sigma2a)) / (o[2] * o[5] * sigma2a) + o[6] * (o[8] * (44235.335848190 + o[9] * ((-13673.3888117080) + o[3] * (421632.60207864 + (22516.9258374750 + o[10] * (474.42144865646 - 149.311307976470 * sigma2a)) * sigma2a))) + o[6] * (((-197811.263204520) - 23554.3994707600 * sigma2a) / (o[2] * o[3] * o[4] * sigma2a) + o[6] * (((-19070.6163020760) + o[11] * (55375.669883164 + (3829.3691437363 - 603.91860580567 * o[2]) * o[3])) * o[8] + o[6] * ((1936.31026203310 + o[2] * (4266.0643698610 + o[2] * o[3] * o[4] * ((-5978.0638872718) - 704.01463926862 * o[9]))) / (o[2] * o[4] * o[5] * sigma2a) + o[1] * ((338.36784107553 + o[12] * (20.8627866351870 + (0.033834172656196 - 0.000043124428414893 * o[12]) * o[3])) * sigma2a + o[6] * (166.537913564120 + sigma2a * ((-139.862920558980) + o[3] * ((-0.78849547999872) + (0.072132411753872 + o[3] * ((-0.0059754839398283) + ((-0.0000121413589539040) + 2.32270967338710e-7 * o[2]) * o[3])) * sigma2a)) + o[6] * ((-10.5384635661940) + o[3] * (2.07189254965020 + ((-0.072193155260427) + 2.07498870811200e-7 * o[4]) * o[9]) + o[6] * (o[6] * (o[12] * (0.210375278936190 + 0.000256812397299990 * o[3] * o[4]) + ((-0.0127990029337810) - 8.2198102652018e-6 * o[11]) * o[6] * o[9]) + o[10] * ((-0.0183406579113790) + 2.90362723486960e-7 * o[2] * o[4] * sigma2a))))))))))) / (o[1] * pi);
+    end tps2a;
+
+    function tps2b "reverse function for region 2b: T(p,s)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      output Modelica.Units.SI.Temperature T "temperature (K)";
+    protected
+      Real[8] o "vector of auxiliary variables";
+      constant Real IPSTAR = 1.0e-6 "scaling variable";
+      constant Real ISSTAR2B = 1 / 785.3 "scaling variable";
+      Real pi "dimensionless pressure";
+      Real sigma2b "dimensionless specific entropy";
+    algorithm
+      pi := p * IPSTAR;
+      sigma2b := 10.0 - s * ISSTAR2B;
+      o[1] := pi * pi;
+      o[2] := o[1] * o[1];
+      o[3] := sigma2b * sigma2b;
+      o[4] := o[3] * o[3];
+      o[5] := o[4] * o[4];
+      o[6] := o[3] * o[5] * sigma2b;
+      o[7] := o[3] * o[5];
+      o[8] := o[3] * sigma2b;
+      T := (316876.65083497 + 20.8641758818580 * o[6] + pi * ((-398593.99803599) - 21.8160585188770 * o[6] + pi * (223697.851942420 + ((-2784.17034458170) + 9.9207436071480 * o[7]) * sigma2b + pi * ((-75197.512299157) + (2970.86059511580 + o[7] * ((-3.4406878548526) + 0.38815564249115 * sigma2b)) * sigma2b + pi * (17511.2950857500 + sigma2b * ((-1423.71128544490) + (1.09438033641670 + 0.89971619308495 * o[4]) * o[4] * sigma2b) + pi * ((-3375.9740098958) + (471.62885818355 + o[4] * ((-1.91882419936790) + o[8] * (0.41078580492196 - 0.33465378172097 * sigma2b))) * sigma2b + pi * (1387.00347775050 + sigma2b * ((-406.63326195838) + sigma2b * (41.727347159610 + o[3] * (2.19325494345320 + sigma2b * ((-1.03200500090770) + (0.35882943516703 + 0.0052511453726066 * o[8]) * sigma2b)))) + pi * (12.8389164507050 + sigma2b * ((-2.86424372193810) + sigma2b * (0.56912683664855 + ((-0.099962954584931) + o[4] * ((-0.0032632037778459) + 0.000233209225767230 * sigma2b)) * sigma2b)) + pi * ((-0.153348098574500) + (0.0290722882399020 + 0.00037534702741167 * o[4]) * sigma2b + pi * (0.00172966917024110 + ((-0.00038556050844504) - 0.000035017712292608 * o[3]) * sigma2b + pi * ((-0.0000145663936314920) + 5.6420857267269e-6 * sigma2b + pi * (4.1286150074605e-8 + ((-2.06846711188240e-8) + 1.64093936747250e-9 * sigma2b) * sigma2b)))))))))))) / (o[1] * o[2]);
+    end tps2b;
+
+    function tps2c "reverse function for region 2c: T(p,s)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      output Modelica.Units.SI.Temperature T "temperature (K)";
+    protected
+      constant Real IPSTAR = 1.0e-6 "scaling variable";
+      constant Real ISSTAR2C = 1 / 2925.1 "scaling variable";
+      Real pi "dimensionless pressure";
+      Real sigma2c "dimensionless specific entropy";
+      Real[3] o "vector of auxiliary variables";
+    algorithm
+      pi := p * IPSTAR;
+      sigma2c := 2.0 - s * ISSTAR2C;
+      o[1] := pi * pi;
+      o[2] := sigma2c * sigma2c;
+      o[3] := o[2] * o[2];
+      T := (909.68501005365 + 2404.56670884200 * sigma2c + pi * ((-591.62326387130) + pi * (541.45404128074 + sigma2c * ((-270.983084111920) + (979.76525097926 - 469.66772959435 * sigma2c) * sigma2c) + pi * (14.3992746047230 + ((-19.1042042304290) + o[2] * (5.3299167111971 - 21.2529753759340 * sigma2c)) * sigma2c + pi * ((-0.311473344137600) + (0.60334840894623 - 0.042764839702509 * sigma2c) * sigma2c + pi * (0.0058185597255259 + ((-0.0145970082847530) + 0.0056631175631027 * o[3]) * sigma2c + pi * ((-0.000076155864584577) + sigma2c * (0.000224403429193320 - 0.0000125610950134130 * o[2] * sigma2c) + pi * (6.3323132660934e-7 + ((-2.05419896753750e-6) + 3.6405370390082e-8 * sigma2c) * sigma2c + pi * ((-2.97598977892150e-9) + 1.01366185297630e-8 * sigma2c + pi * (5.9925719692351e-12 + sigma2c * ((-2.06778701051640e-11) + o[2] * ((-2.08742781818860e-11) + (1.01621668250890e-10 - 1.64298282813470e-10 * sigma2c) * sigma2c)))))))))))) / o[1];
+    end tps2c;
+
+    function tps2 "reverse function for region 2: T(p,s)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      output Modelica.Units.SI.Temperature T "temperature (K)";
+    protected
+      Real pi "dimensionless pressure";
+      constant Modelica.Units.SI.SpecificEntropy SLIMIT = 5.85e3 "subregion boundary specific entropy between regions 2a and 2b";
+    algorithm
+      if p < 4.0e6 then
+        T := tps2a(p, s);
+      elseif s > SLIMIT then
+        T := tps2b(p, s);
+      else
+        T := tps2c(p, s);
+      end if;
+    end tps2;
+
+    function tsat "region 4 saturation temperature as a function of pressure"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output Modelica.Units.SI.Temperature t_sat "temperature";
+    protected
+      Real pi "dimensionless pressure";
+      Real[20] o "vector of auxiliary variables";
+    algorithm
+//   assert(p > triple.ptriple,
+//     "IF97 medium function tsat called with too low pressure\n" +
+//     "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
+//  assert(p <= data.PCRIT,
+//    "tsat: input pressure is higher than the critical point pressure");
+      pi := max(min(p, data.PCRIT), triple.ptriple) * data.IPSTAR;
+      o[1] := pi ^ 0.25;
+      o[2] := -3.2325550322333e6 * o[1];
+      o[3] := pi ^ 0.5;
+      o[4] := -724213.16703206 * o[3];
+      o[5] := 405113.40542057 + o[2] + o[4];
+      o[6] := -17.0738469400920 * o[1];
+      o[7] := 14.9151086135300 + o[3] + o[6];
+      o[8] := -4.0 * o[5] * o[7];
+      o[9] := 12020.8247024700 * o[1];
+      o[10] := 1167.05214527670 * o[3];
+      o[11] := (-4823.2657361591) + o[10] + o[9];
+      o[12] := o[11] * o[11];
+      o[13] := o[12] + o[8];
+      o[14] := o[13] ^ 0.5;
+      o[15] := -o[14];
+      o[16] := -12020.8247024700 * o[1];
+      o[17] := -1167.05214527670 * o[3];
+      o[18] := 4823.2657361591 + o[15] + o[16] + o[17];
+      o[19] := 1 / o[18];
+      o[20] := 2.0 * o[19] * o[5];
+      t_sat := 0.5 * (650.17534844798 + o[20] - ((-4.0 * ((-0.238555575678490) + 1300.35069689596 * o[19] * o[5])) + (650.17534844798 + o[20]) ^ 2.0) ^ 0.5);
+      annotation(
+        derivative = tsat_der);
+    end tsat;
+
+    function dtsatofp "derivative of saturation temperature w.r.t. pressure"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output Real dtsat(unit = "K/Pa") "derivative of T w.r.t. p";
+    protected
+      Real pi "dimensionless pressure";
+      Real[49] o "vector of auxiliary variables";
+    algorithm
+      pi := p * data.IPSTAR;
+      o[1] := pi ^ 0.75;
+      o[2] := 1 / o[1];
+      o[3] := -4.268461735023 * o[2];
+      o[4] := sqrt(pi);
+      o[5] := 1 / o[4];
+      o[6] := 0.5 * o[5];
+      o[7] := o[3] + o[6];
+      o[8] := pi ^ 0.25;
+      o[9] := -3.2325550322333e6 * o[8];
+      o[10] := -724213.16703206 * o[4];
+      o[11] := 405113.40542057 + o[10] + o[9];
+      o[12] := -4 * o[11] * o[7];
+      o[13] := -808138.758058325 * o[2];
+      o[14] := -362106.58351603 * o[5];
+      o[15] := o[13] + o[14];
+      o[16] := -17.073846940092 * o[8];
+      o[17] := 14.91510861353 + o[16] + o[4];
+      o[18] := -4 * o[15] * o[17];
+      o[19] := 3005.2061756175 * o[2];
+      o[20] := 583.52607263835 * o[5];
+      o[21] := o[19] + o[20];
+      o[22] := 12020.82470247 * o[8];
+      o[23] := 1167.0521452767 * o[4];
+      o[24] := (-4823.2657361591) + o[22] + o[23];
+      o[25] := 2.0 * o[21] * o[24];
+      o[26] := o[12] + o[18] + o[25];
+      o[27] := -4.0 * o[11] * o[17];
+      o[28] := o[24] * o[24];
+      o[29] := o[27] + o[28];
+      o[30] := sqrt(o[29]);
+      o[31] := 1 / o[30];
+      o[32] := -o[30];
+      o[33] := -12020.82470247 * o[8];
+      o[34] := -1167.0521452767 * o[4];
+      o[35] := 4823.2657361591 + o[32] + o[33] + o[34];
+      o[36] := o[30];
+      o[37] := (-4823.2657361591) + o[22] + o[23] + o[36];
+      o[38] := o[37] * o[37];
+      o[39] := 1 / o[38];
+      o[40] := -1.72207339365771 * o[30];
+      o[41] := 21592.2055343628 * o[8];
+      o[42] := o[30] * o[8];
+      o[43] := -8192.87114842946 * o[4];
+      o[44] := -0.510632954559659 * o[30] * o[4];
+      o[45] := -3100.02526152368 * o[1];
+      o[46] := pi;
+      o[47] := 1295.95640782102 * o[46];
+      o[48] := 2862.09212505088 + o[40] + o[41] + o[42] + o[43] + o[44] + o[45] + o[47];
+      o[49] := 1 / (o[35] * o[35]);
+      dtsat := data.IPSTAR * 0.5 * (2.0 * o[15] / o[35] - 2. * o[11] * ((-3005.2061756175 * o[2]) - 0.5 * o[26] * o[31] - 583.52607263835 * o[5]) * o[49] - 20953.46356643991 * (o[39] * (1295.95640782102 + 5398.05138359071 * o[2] + 0.25 * o[2] * o[30] - 0.861036696828853 * o[26] * o[31] - 0.255316477279829 * o[26] * o[31] * o[4] - 4096.43557421473 * o[5] - 0.255316477279829 * o[30] * o[5] - 2325.01894614276 / o[8] + 0.5 * o[26] * o[31] * o[8]) - 2.0 * (o[19] + o[20] + 0.5 * o[26] * o[31]) * o[48] * o[37] ^ (-3)) / sqrt(o[39] * o[48]));
+    end dtsatofp;
+
+    function tsat_der "derivative function for tsat"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Real der_p(unit = "Pa/s") "pressure derivatrive";
+      output Real der_tsat(unit = "K/s") "temperature derivative";
+    protected
+      Real dtp;
+    algorithm
+      dtp := dtsatofp(p);
+      der_tsat := dtp * der_p;
+    end tsat_der;
+
+    function psat "region 4 saturation pressure as a functionx of temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      output Modelica.Units.SI.Pressure p_sat "pressure";
+    protected
+      Real[7] o "vector of auxiliary variables";
+      Real C "auxiliary variable";
+      Real B "auxiliary variable";
+      Real A "auxiliary variable";
+      Real Tlim = min(T, data.TCRIT);
+    algorithm
+      assert(T >= 273.16, "IF97 medium function psat: input temperature (= " + String(triple.ptriple) + " K).\n" + "lower than the triple point temperature 273.16 K");
+      o[1] := (-650.17534844798) + Tlim;
+      o[2] := 1 / o[1];
+      o[3] := -0.238555575678490 * o[2];
+      o[4] := o[3] + Tlim "theta";
+      o[5] := -4823.2657361591 * o[4] "n7*theta";
+      o[6] := o[4] * o[4] "theta^2";
+      o[7] := 14.9151086135300 * o[6] "n6*theta^2";
+      C := 405113.40542057 + o[5] + o[7] "C";
+      B := (-3.2325550322333e6) + 12020.8247024700 * o[4] - 17.0738469400920 * o[6];
+      A := (-724213.16703206) + 1167.05214527670 * o[4] + o[6];
+      p_sat := 16.0e6 * C * C * C * C * 1 / ((-B) + ((-4.0 * A * C) + B * B) ^ 0.5) ^ 4.0;
+      annotation(
+        derivative = psat_der);
+    end psat;
+
+    function dptofT "derivative of pressure wrt temperature along the saturation pressure curve"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      output Real dpt(unit = "Pa/K") "temperature derivative of pressure";
+    protected
+      Real[31] o "vector of auxiliary variables";
+      Real Tlim "temperature limited to TCRIT";
+    algorithm
+      Tlim := min(T, data.TCRIT);
+      o[1] := (-650.17534844798) + Tlim;
+      o[2] := 1 / o[1];
+      o[3] := -0.238555575678490 * o[2];
+      o[4] := o[3] + Tlim "theta";
+      o[5] := -4823.2657361591 * o[4];
+      o[6] := o[4] * o[4] "theta^2";
+      o[7] := 14.9151086135300 * o[6];
+      o[8] := 405113.40542057 + o[5] + o[7];
+      o[9] := o[8] * o[8];
+      o[10] := o[9] * o[9];
+      o[11] := o[1] * o[1];
+      o[12] := 1 / o[11];
+      o[13] := 0.238555575678490 * o[12];
+      o[14] := 1.00000000000000 + o[13] "dtheta";
+      o[15] := 12020.8247024700 * o[4];
+      o[16] := -17.0738469400920 * o[6];
+      o[17] := (-3.2325550322333e6) + o[15] + o[16];
+      o[18] := -4823.2657361591 * o[14];
+      o[19] := 29.8302172270600 * o[14] * o[4];
+      o[20] := o[18] + o[19];
+      o[21] := 1167.05214527670 * o[4];
+      o[22] := (-724213.16703206) + o[21] + o[6];
+      o[23] := o[17] * o[17];
+      o[24] := -4.0000000000000 * o[22] * o[8];
+      o[25] := o[23] + o[24];
+      o[26] := sqrt(o[25]);
+      o[27] := -12020.8247024700 * o[4];
+      o[28] := 17.0738469400920 * o[6];
+      o[29] := 3.2325550322333e6 + o[26] + o[27] + o[28];
+      o[30] := o[29] * o[29];
+      o[31] := o[30] * o[30];
+      dpt := 1e6 * ((-64.0 * o[10] * ((-12020.8247024700 * o[14]) + 34.147693880184 * o[14] * o[4] + 0.5 * ((-4.0 * o[20] * o[22]) + 2.00000000000000 * o[17] * (12020.8247024700 * o[14] - 34.147693880184 * o[14] * o[4]) - 4.0 * (1167.05214527670 * o[14] + 2.0 * o[14] * o[4]) * o[8]) / o[26])) / (o[29] * o[31]) + 64. * o[20] * o[8] * o[9] / o[31]);
+    end dptofT;
+
+    function d2ptofT "Second derivative of pressure wrt temperature along the saturation pressure curve"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      output Real dpT(unit = "Pa/K") "Temperature derivative of pressure";
+      output Real dpTT(unit = "Pa/(K.K)") "Second temperature derivative of pressure";
+    protected
+      Real A "Auxiliary variable";
+      Real Ad "Auxiliary variable";
+      Real A1 "Auxiliary variable";
+      Real A2 "Auxiliary variable";
+      Real B "Auxiliary variable";
+      Real Bd "Auxiliary variable";
+      Real B1 "Auxiliary variable";
+      Real B2 "Auxiliary variable";
+      Real C "Auxiliary variable";
+      Real Cd "Auxiliary variable";
+      Real C1 "Auxiliary variable";
+      Real C2 "Auxiliary variable";
+      Real D "Auxiliary variable";
+      Real D1 "Auxiliary variable";
+      Real Dd "Auxiliary variable";
+      Real D2 "Auxiliary variable";
+      //   Real F "Auxiliary variable";
+      //   Real Fd "Auxiliary variable";
+      Real th "Auxiliary variable";
+      Real thd "Auxiliary variable";
+      Real thdd "Auxiliary variable";
+      Real v "Auxiliary variable";
+      Real v2 "Auxiliary variable";
+      Real v4 "Auxiliary variable";
+      Real v5 "Auxiliary variable";
+      Real v6 "Auxiliary variable";
+      Real[16] o "vector of auxiliary variables";
+      Real Tlim "temperature limited to TCRIT";
+      parameter Real[10] n = {0.11670521452767e4, -0.72421316703206e6, -0.17073846940092e2, 0.12020824702470e5, -0.32325550322333e7, 0.14915108613530e2, -0.48232657361591e4, 0.40511340542057e6, -0.23855557567849, 0.65017534844798e3};
+    algorithm
+      Tlim := min(T, data.TCRIT);
+      o[1] := Tlim - n[10];
+      th := Tlim + n[9] / o[1];
+      o[2] := th * th "theta^2";
+      A := o[2] + n[1] * th + n[2];
+      B := n[3] * o[2] + n[4] * th + n[5];
+      C := n[6] * o[2] + n[7] * th + n[8];
+      o[3] := o[1] * o[1];
+      o[4] := o[3] * o[3];
+      D := B * B - 4.0 * A * C;
+      o[5] := sqrt(D);
+      v := 1 / (o[5] - B);
+      v2 := v * v;
+      v4 := v2 * v2;
+      v5 := v4 * v;
+      v6 := v4 * v2;
+      o[6] := 2.0 * C * v;
+      o[7] := o[6] * o[6];
+//  F := o[7]*o[7]*1e6 "this is also psat, and correct";
+      thd := 1.0 - n[9] / o[3];
+      thdd := 2.0 * n[9] / (o[3] * o[1]);
+      Ad := 2.0 * th + n[1];
+      Bd := 2.0 * n[3] * th + n[4];
+      Cd := 2.0 * n[6] * th + n[7];
+      Dd := 2 * B * Bd - 4 * (Ad * C + Cd * A);
+      A1 := Ad * thd;
+      B1 := Bd * thd;
+      C1 := Cd * thd;
+      D1 := Dd * thd;
+      o[8] := C * C "C^2";
+      o[9] := o[8] * C "C^3";
+      o[10] := o[9] * C "C^4";
+      o[11] := 1 / o[5] "1/sqrt(D)";
+      o[12] := (-B1) + 0.5 * D1 * o[11] "-B1 + 1/2*D1/sqrt(D)";
+      o[13] := o[12] * o[12];
+      o[14] := C1 * C1 "C1^2";
+      o[15] := B1 * B1 "B1^2";
+      o[16] := D * o[5] "D^3/2";
+// dpsat (=Fd) is correct
+// Fd := 64.0*C*C*C*C1*v4-64.0*C*C*C*C*(-B1 + 0.5*D1/sqrt(D))*v5;
+      dpT := 64.0 * (C1 * o[9] * v4 - o[10] * o[12] * v5) * 1.0e6 "dpsat";
+      A2 := Ad * thdd + thd * thd * 2.0;
+      B2 := Bd * thdd + thd * thd * 2.0 * n[3];
+      C2 := Cd * thdd + thd * thd * 2.0 * n[6];
+      D2 := 2.0 * (B * B2 + o[15]) - 4.0 * (A2 * C + 2.0 * A1 * C1 + A * C2);
+      dpTT := ((192.0 * o[8] * o[14] + 64.0 * o[9] * C2) * v4 + ((-512.0 * C1 * o[9] * o[12]) - 64.0 * o[10] * ((-B2) - 0.25 * D1 * D1 / o[16] + 0.5 * D2 * o[11])) * v5 + 320.0 * o[10] * o[13] * v6) * 1.0e6;
+    end d2ptofT;
+
+    function psat_der "derivative function for psat"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      input Real der_T(unit = "K/s") "temperature derivative";
+      output Real der_psat(unit = "Pa/s") "pressure";
+    protected
+      Real dpt;
+    algorithm
+      dpt := dptofT(T);
+      der_psat := dpt * der_T;
+    end psat_der;
+
+    // Inverses p_hs from the 2001 assition to IAPWS97
+
+    function p1_hs "pressure as a function of ehtnalpy and entropy in region 1"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      output Modelica.Units.SI.Pressure p "Pressure";
+      constant Real[:] n = {-0.691997014660582, -0.183612548787560e2, -0.928332409297335e1, 0.659639569909906e2, -0.162060388912024e2, 0.450620017338667e3, 0.854680678224170e3, 0.607523214001162e4, 0.326487682621856e2, -0.269408844582931e2, -0.319947848334300e3, -0.928354307043320e3, 0.303634537455249e2, -0.650540422444146e2, -0.430991316516130e4, -0.747512324096068e3, 0.730000345529245e3, 0.114284032569021e4, -0.436407041874559e3};
+      constant Real[:] I = {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 3, 4, 4, 5};
+      constant Real[:] J = {0, 1, 2, 4, 5, 6, 8, 14, 0, 1, 4, 6, 0, 1, 10, 4, 1, 4, 0};
+      constant Modelica.Units.SI.SpecificEnthalpy hstar = 3400e3 "normalization enthalpy";
+      constant Modelica.Units.SI.Pressure pstar = 100e6 "normalization pressure";
+      constant Modelica.Units.SI.SpecificEntropy sstar = 7.6e3 "normalization entropy";
+    protected
+      Real eta = h / hstar "normalized specific enthalpy";
+      Real sigma = s / sstar "normalized specific entropy";
+    algorithm
+      p := sum(n[i] * (eta + 0.05) ^ I[i] * (sigma + 0.05) ^ J[i] for i in 1:19) * pstar;
+      annotation(
+        Documentation(info = "<html>
 <p>
   Equation number 1 from:<br>
   The International Association for the Properties of Water and Steam<br>
@@ -3227,24 +2188,22 @@
   Formulation 1997 for the Thermodynamic Properties of Water and Steam<br>
   </p>
   </html>
-  "));
-    end p1_hs;
-
-    function h2ab_s "boundary between regions 2a and 2b"
-      extends Modelica.Icons.Function;
-      output Modelica.SIunits.SpecificEnthalpy h "Enthalpy";
-      input Modelica.SIunits.SpecificEntropy s "Entropy";
-    protected
-      constant Real[:] n = {-0.349898083432139e4,0.257560716905876e4,-0.421073558227969e3,0.276349063799944e2};
-      constant Modelica.SIunits.SpecificEnthalpy hstar=1e3
-        "normalization enthalpy";
-      constant Modelica.SIunits.SpecificEntropy sstar=1e3
-        "normalization entropy";
-      Real sigma = s/sstar "normalized specific entropy";
-    algorithm
-      h := (n[1] + n[2]*sigma + n[3]*sigma^2 + n[4]*sigma^3)*hstar;
-      annotation (
-          Documentation(                                                                                                    info="<html>
+  "));
+    end p1_hs;
+
+    function h2ab_s "boundary between regions 2a and 2b"
+      extends Modelica.Icons.Function;
+      output Modelica.Units.SI.SpecificEnthalpy h "Enthalpy";
+      input Modelica.Units.SI.SpecificEntropy s "Entropy";
+    protected
+      constant Real[:] n = {-0.349898083432139e4, 0.257560716905876e4, -0.421073558227969e3, 0.276349063799944e2};
+      constant Modelica.Units.SI.SpecificEnthalpy hstar = 1e3 "normalization enthalpy";
+      constant Modelica.Units.SI.SpecificEntropy sstar = 1e3 "normalization entropy";
+      Real sigma = s / sstar "normalized specific entropy";
+    algorithm
+      h := (n[1] + n[2] * sigma + n[3] * sigma ^ 2 + n[4] * sigma ^ 3) * hstar;
+      annotation(
+        Documentation(info = "<html>
   <p>
   Equation number 2 from:<br>
   The International Association for the Properties of Water and Steam<br>
@@ -3255,36 +2214,27 @@
   Formulation 1997 for the Thermodynamic Properties of Water and Steam<br>
   </p>
   </html>
-  "));
-    end h2ab_s;
-
-    function p2a_hs
-      "pressure as a function of enthalpy and entropy in subregion 2a"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      output Modelica.SIunits.Pressure p "Pressure";
-      constant Real[:] n=
-        {-0.182575361923032e-1,-0.125229548799536,0.592290437320145,0.604769706185122e1,
-         0.238624965444474e3,-0.298639090222922e3,0.512250813040750e-1,-0.437266515606486,0.413336902999504,
-         -0.516468254574773e1,-0.557014838445711e1,0.128555037824478e2,0.114144108953290e2,-0.119504225652714e3,
-         -0.284777985961560e4,0.431757846408006e4,0.112894040802650e1,0.197409186206319e4,0.151612444706087e4,
-         0.141324451421235e-1,0.585501282219601,-0.297258075863012e1,0.594567314847319e1,-0.623656565798905e4,
-         0.965986235133332e4,0.681500934948134e1,-0.633207286824489e4,-0.558919224465760e1,0.400645798472063e-1};
-      constant Real[:] I = {0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,2,2,2,3,3,3,3,3,4,5,5,6,7};
-      constant Real[:] J = {1,3,6,16,20,22,0,1,2,3,5,6,10,16,20,22,3,16,20,0,2,3,6,16,16,3,16,3,1};
-      constant Modelica.SIunits.SpecificEnthalpy hstar=4200e3
-        "normalization enthalpy";
-      constant Modelica.SIunits.Pressure pstar=4e6 "normalization pressure";
-      constant Modelica.SIunits.SpecificEntropy sstar=12e3
-        "normalization entropy";
-    protected
-      Real eta = h/hstar "normalized specific enthalpy";
-      Real sigma = s/sstar "normalized specific entropy";
-    algorithm
-      p := sum(n[i]*(eta - 0.5)^I[i]*(sigma - 1.2)^J[i] for i in 1:29)^4*pstar;
-      annotation (
-          Documentation(                                                                                                    info="<html>
+  "));
+    end h2ab_s;
+
+    function p2a_hs "pressure as a function of enthalpy and entropy in subregion 2a"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      output Modelica.Units.SI.Pressure p "Pressure";
+      constant Real[:] n = {-0.182575361923032e-1, -0.125229548799536, 0.592290437320145, 0.604769706185122e1, 0.238624965444474e3, -0.298639090222922e3, 0.512250813040750e-1, -0.437266515606486, 0.413336902999504, -0.516468254574773e1, -0.557014838445711e1, 0.128555037824478e2, 0.114144108953290e2, -0.119504225652714e3, -0.284777985961560e4, 0.431757846408006e4, 0.112894040802650e1, 0.197409186206319e4, 0.151612444706087e4, 0.141324451421235e-1, 0.585501282219601, -0.297258075863012e1, 0.594567314847319e1, -0.623656565798905e4, 0.965986235133332e4, 0.681500934948134e1, -0.633207286824489e4, -0.558919224465760e1, 0.400645798472063e-1};
+      constant Real[:] I = {0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 5, 5, 6, 7};
+      constant Real[:] J = {1, 3, 6, 16, 20, 22, 0, 1, 2, 3, 5, 6, 10, 16, 20, 22, 3, 16, 20, 0, 2, 3, 6, 16, 16, 3, 16, 3, 1};
+      constant Modelica.Units.SI.SpecificEnthalpy hstar = 4200e3 "normalization enthalpy";
+      constant Modelica.Units.SI.Pressure pstar = 4e6 "normalization pressure";
+      constant Modelica.Units.SI.SpecificEntropy sstar = 12e3 "normalization entropy";
+    protected
+      Real eta = h / hstar "normalized specific enthalpy";
+      Real sigma = s / sstar "normalized specific entropy";
+    algorithm
+      p := sum(n[i] * (eta - 0.5) ^ I[i] * (sigma - 1.2) ^ J[i] for i in 1:29) ^ 4 * pstar;
+      annotation(
+        Documentation(info = "<html>
   <p>
   Equation number 3 from:<br>
   The International Association for the Properties of Water and Steam<br>
@@ -3295,38 +2245,27 @@
   Formulation 1997 for the Thermodynamic Properties of Water and Steam<br>
   </p>
   </html>
-  "));
-    end p2a_hs;
-
-  function p2b_hs
-      "pressure as a function of enthalpy and entropy in subregion 2a"
-    extends Modelica.Icons.Function;
-    input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    input Modelica.SIunits.SpecificEntropy s "specific entropy";
-    output Modelica.SIunits.Pressure p "Pressure";
-    constant Real[:] n=
-      {0.801496989929495e-1,-0.543862807146111,0.337455597421283,0.890555451157450e1,
-       0.313840736431485e3,0.797367065977789,-0.121616973556240e1,0.872803386937477e1,-0.169769781757602e2,
-       -0.186552827328416e3,0.951159274344237e5,-0.189168510120494e2,-0.433407037194840e4,0.543212633012715e9,
-       0.144793408386013,0.128024559637516e3,-0.672309534071268e5,0.336972380095287e8,-0.586634196762720e3,
-       -0.221403224769889e11,0.171606668708389e4,-0.570817595806302e9,-0.312109693178482e4,-0.207841384633010e7,
-       0.305605946157786e13,0.322157004314333e4,0.326810259797295e12,-0.144104158934487e4,0.410694867802691e3,
-       0.109077066873024e12,-0.247964654258893e14,0.188801906865134e10,-0.123651009018773e15};
-    constant Real[:] I = {0,0,0,0,0,1,1,1,1,1,1,2,2,2,3,3,3,3,4,4,5,5,6,6,6,7,7,8,8,8,8,12,14};
-    constant Real[:] J = {0,1,2,4,8,0,1,2,3,5,12,1,6,18,0,1,7,12,1,16,1,12,1,8,18,1,16,1,3,14,18,10,16};
-    constant Modelica.SIunits.SpecificEnthalpy hstar=4100e3
-        "normalization enthalpy";
-    constant Modelica.SIunits.Pressure pstar=100e6 "normalization pressure";
-    constant Modelica.SIunits.SpecificEntropy sstar=7.9e3
-        "normalization entropy";
-    protected
-    Real eta = h/hstar "normalized specific enthalpy";
-    Real sigma = s/sstar "normalized specific entropy";
-
-  algorithm
-    p := sum(n[i]*(eta - 0.6)^I[i]*(sigma - 1.01)^J[i] for i in 1:33)^4*pstar;
-    annotation (
-          Documentation(                                                                                                    info="<html>
+  "));
+    end p2a_hs;
+
+    function p2b_hs "pressure as a function of enthalpy and entropy in subregion 2a"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      output Modelica.Units.SI.Pressure p "Pressure";
+      constant Real[:] n = {0.801496989929495e-1, -0.543862807146111, 0.337455597421283, 0.890555451157450e1, 0.313840736431485e3, 0.797367065977789, -0.121616973556240e1, 0.872803386937477e1, -0.169769781757602e2, -0.186552827328416e3, 0.951159274344237e5, -0.189168510120494e2, -0.433407037194840e4, 0.543212633012715e9, 0.144793408386013, 0.128024559637516e3, -0.672309534071268e5, 0.336972380095287e8, -0.586634196762720e3, -0.221403224769889e11, 0.171606668708389e4, -0.570817595806302e9, -0.312109693178482e4, -0.207841384633010e7, 0.305605946157786e13, 0.322157004314333e4, 0.326810259797295e12, -0.144104158934487e4, 0.410694867802691e3, 0.109077066873024e12, -0.247964654258893e14, 0.188801906865134e10, -0.123651009018773e15};
+      constant Real[:] I = {0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 8, 12, 14};
+      constant Real[:] J = {0, 1, 2, 4, 8, 0, 1, 2, 3, 5, 12, 1, 6, 18, 0, 1, 7, 12, 1, 16, 1, 12, 1, 8, 18, 1, 16, 1, 3, 14, 18, 10, 16};
+      constant Modelica.Units.SI.SpecificEnthalpy hstar = 4100e3 "normalization enthalpy";
+      constant Modelica.Units.SI.Pressure pstar = 100e6 "normalization pressure";
+      constant Modelica.Units.SI.SpecificEntropy sstar = 7.9e3 "normalization entropy";
+    protected
+      Real eta = h / hstar "normalized specific enthalpy";
+      Real sigma = s / sstar "normalized specific entropy";
+    algorithm
+      p := sum(n[i] * (eta - 0.6) ^ I[i] * (sigma - 1.01) ^ J[i] for i in 1:33) ^ 4 * pstar;
+      annotation(
+        Documentation(info = "<html>
 <p>
 Equation number 4 from:<br>
 The International Association for the Properties of Water and Steam<br>
@@ -3337,37 +2276,27 @@
 Formulation 1997 for the Thermodynamic Properties of Water and Steam<br>
 </p>
       </html>
-"));
-  end p2b_hs;
-
-    function p2c_hs
-      "pressure as a function of enthalpy and entropy in subregion 2c"
-        extends Modelica.Icons.Function;
-        input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-        input Modelica.SIunits.SpecificEntropy s "specific entropy";
-        output Modelica.SIunits.Pressure p "Pressure";
-        constant Real[:] n=
-          {0.112225607199012,-0.339005953606712e1,-0.320503911730094e2,-0.197597305104900e3,
-           -0.407693861553446e3,0.132943775222331e5,0.170846839774007e1,0.373694198142245e2,0.358144365815434e4,
-           0.423014446424664e6,-0.751071025760063e9,0.523446127607898e2,-0.228351290812417e3,-0.960652417056937e6,
-           -0.807059292526074e8,0.162698017225669e13,0.772465073604171,0.463929973837746e5,-0.137317885134128e8,
-           0.170470392630512e13,-0.251104628187308e14,0.317748830835520e14,0.538685623675312e2,-0.553089094625169e5,
-           -0.102861522421405e7,0.204249418756234e13,0.273918446626977e9,-0.263963146312685e16,-0.107890854108088e10,
-           -0.296492620980124e11,-0.111754907323424e16};
-        constant Real[:] I = {0,0,0,0,0,0,1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,5,5,5,5,6,6,10,12,16};
-        constant Real[:] J = {0,1,2,3,4,8,0,2,5,8,14,2,3,7,10,18,0,5,8,16,18,18,1,4,6,14,8,18,7,7,10};
-        constant Modelica.SIunits.SpecificEnthalpy hstar=3500e3
-        "normalization enthalpy";
-        constant Modelica.SIunits.Pressure pstar=100e6 "normalization pressure";
-        constant Modelica.SIunits.SpecificEntropy sstar=5.9e3
-        "normalization entropy";
-    protected
-        Real eta = h/hstar "normalized specific enthalpy";
-        Real sigma = s/sstar "normalized specific entropy";
-    algorithm
-        p := sum(n[i]*(eta - 0.7)^I[i]*(sigma - 1.1)^J[i] for i in 1:31)^4*pstar;
-        annotation (
-          Documentation(                                                                                                    info="<html>
+        "));
+    end p2b_hs;
+
+    function p2c_hs "pressure as a function of enthalpy and entropy in subregion 2c"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      output Modelica.Units.SI.Pressure p "Pressure";
+      constant Real[:] n = {0.112225607199012, -0.339005953606712e1, -0.320503911730094e2, -0.197597305104900e3, -0.407693861553446e3, 0.132943775222331e5, 0.170846839774007e1, 0.373694198142245e2, 0.358144365815434e4, 0.423014446424664e6, -0.751071025760063e9, 0.523446127607898e2, -0.228351290812417e3, -0.960652417056937e6, -0.807059292526074e8, 0.162698017225669e13, 0.772465073604171, 0.463929973837746e5, -0.137317885134128e8, 0.170470392630512e13, -0.251104628187308e14, 0.317748830835520e14, 0.538685623675312e2, -0.553089094625169e5, -0.102861522421405e7, 0.204249418756234e13, 0.273918446626977e9, -0.263963146312685e16, -0.107890854108088e10, -0.296492620980124e11, -0.111754907323424e16};
+      constant Real[:] I = {0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 5, 5, 5, 5, 6, 6, 10, 12, 16};
+      constant Real[:] J = {0, 1, 2, 3, 4, 8, 0, 2, 5, 8, 14, 2, 3, 7, 10, 18, 0, 5, 8, 16, 18, 18, 1, 4, 6, 14, 8, 18, 7, 7, 10};
+      constant Modelica.Units.SI.SpecificEnthalpy hstar = 3500e3 "normalization enthalpy";
+      constant Modelica.Units.SI.Pressure pstar = 100e6 "normalization pressure";
+      constant Modelica.Units.SI.SpecificEntropy sstar = 5.9e3 "normalization entropy";
+    protected
+      Real eta = h / hstar "normalized specific enthalpy";
+      Real sigma = s / sstar "normalized specific entropy";
+    algorithm
+      p := sum(n[i] * (eta - 0.7) ^ I[i] * (sigma - 1.1) ^ J[i] for i in 1:31) ^ 4 * pstar;
+      annotation(
+        Documentation(info = "<html>
       <p>
       Equation number 5 from:<br>
       The International Association for the Properties of Water and Steam<br>
@@ -3378,25 +2307,24 @@
       Formulation 1997 for the Thermodynamic Properties of Water and Steam<br>
       </p>
       </html>
-      "));
-    end p2c_hs;
-
-    // Inverses from the 2003 additions to IF97
-    function h3ab_p "ergion 3 a b boundary for pressure/enthalpy"
-        extends Modelica.Icons.Function;
-        output Modelica.SIunits.SpecificEnthalpy h "Enthalpy";
-        input Modelica.SIunits.Pressure p "Pressure";
-    protected
-        constant Real[:] n = {0.201464004206875e4,0.374696550136983e1,-0.219921901054187e-1,0.875131686009950e-4};
-        constant Modelica.SIunits.SpecificEnthalpy hstar=1000
-        "normalization enthalpy";
-        constant Modelica.SIunits.Pressure pstar=1e6 "normalization pressure";
-        Real pi = p/pstar "normalized specific pressure";
-
-    algorithm
-        h := (n[1] + n[2]*pi + n[3]*pi^2 + n[4]*pi^3)*hstar;
-        annotation (
-    Documentation(info="<html>
+      "));
+    end p2c_hs;
+
+    // Inverses from the 2003 additions to IF97
+
+    function h3ab_p "ergion 3 a b boundary for pressure/enthalpy"
+      extends Modelica.Icons.Function;
+      output Modelica.Units.SI.SpecificEnthalpy h "Enthalpy";
+      input Modelica.Units.SI.Pressure p "Pressure";
+    protected
+      constant Real[:] n = {0.201464004206875e4, 0.374696550136983e1, -0.219921901054187e-1, 0.875131686009950e-4};
+      constant Modelica.Units.SI.SpecificEnthalpy hstar = 1000 "normalization enthalpy";
+      constant Modelica.Units.SI.Pressure pstar = 1e6 "normalization pressure";
+      Real pi = p / pstar "normalized specific pressure";
+    algorithm
+      h := (n[1] + n[2] * pi + n[3] * pi ^ 2 + n[4] * pi ^ 3) * hstar;
+      annotation(
+        Documentation(info = "<html>
       <p>
       &nbsp;Equation number 1 from:<br>
       <div style=\"text-align: center;\">&nbsp;[1] The international Association
@@ -3409,37 +2337,27 @@
       the Thermodynamic Properties of<br>
       &nbsp;Water and Steam</div>
       </p>
-      </html>"));
-    end h3ab_p;
-
-    function T3a_ph "Region 3 a: inverse function T(p,h)"
-        extends Modelica.Icons.Function;
-        input Modelica.SIunits.Pressure p "Pressure";
-        input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-        output Modelica.SIunits.Temp_K T "Temperature";
-    protected
-        constant Real[:] n=
-          {-0.133645667811215e-6,0.455912656802978e-5,-0.146294640700979e-4, 0.639341312970080e-2,0.372783927268847e3,
-           -0.718654377460447e4,0.573494752103400e6,-0.267569329111439e7,-0.334066283302614e-4,-0.245479214069597e-1,
-           0.478087847764996e2,0.764664131818904e-5,0.128350627676972e-2,0.171219081377331e-1,-0.851007304583213e1,
-           -0.136513461629781e-1,-0.384460997596657e-5,0.337423807911655e-2,-0.551624873066791,0.729202277107470,
-           -0.992522757376041e-2,-0.119308831407288,0.793929190615421,0.454270731799386,0.209998591259910,
-           -0.642109823904738e-2,-0.235155868604540e-1,0.252233108341612e-2,-0.764885133368119e-2,0.136176427574291e-1,
-           -0.133027883575669e-1};
-        constant Real[:] I = {-12,-12,-12,-12,-12,-12,-12,-12,-10,-10,
-                              -10,-8,-8,-8,-8,-5,-3,-2,-2,-2,-1,-1,0,0,1,3,3,4,4,10,12};
-        constant Real[:] J = { 0,1,2,6,14,16,20,22,1,5,12,0,2,4,10,2,0,1,3,4,0,2,0,1,1,0,1,0,3,4,5};
-        constant Modelica.SIunits.SpecificEnthalpy hstar=2300e3
-        "normalization enthalpy";
-        constant Modelica.SIunits.Pressure pstar=100e6 "normalization pressure";
-        constant Modelica.SIunits.Temp_K Tstar=760 "normalization temperature";
-        Real pi = p/pstar "normalized specific pressure";
-        Real eta = h/hstar "normalized specific enthalpy";
-    algorithm
-        T := sum(n[i]*(pi + 0.240)^I[i]*(eta - 0.615)^J[i] for i in 1:31)*Tstar;
-        annotation (
-          Documentation(
-     info="<html>
+      </html>"));
+    end h3ab_p;
+
+    function T3a_ph "Region 3 a: inverse function T(p,h)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "Pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      output Modelica.Units.SI.Temperature T "Temperature";
+    protected
+      constant Real[:] n = {-0.133645667811215e-6, 0.455912656802978e-5, -0.146294640700979e-4, 0.639341312970080e-2, 0.372783927268847e3, -0.718654377460447e4, 0.573494752103400e6, -0.267569329111439e7, -0.334066283302614e-4, -0.245479214069597e-1, 0.478087847764996e2, 0.764664131818904e-5, 0.128350627676972e-2, 0.171219081377331e-1, -0.851007304583213e1, -0.136513461629781e-1, -0.384460997596657e-5, 0.337423807911655e-2, -0.551624873066791, 0.729202277107470, -0.992522757376041e-2, -0.119308831407288, 0.793929190615421, 0.454270731799386, 0.209998591259910, -0.642109823904738e-2, -0.235155868604540e-1, 0.252233108341612e-2, -0.764885133368119e-2, 0.136176427574291e-1, -0.133027883575669e-1};
+      constant Real[:] I = {-12, -12, -12, -12, -12, -12, -12, -12, -10, -10, -10, -8, -8, -8, -8, -5, -3, -2, -2, -2, -1, -1, 0, 0, 1, 3, 3, 4, 4, 10, 12};
+      constant Real[:] J = {0, 1, 2, 6, 14, 16, 20, 22, 1, 5, 12, 0, 2, 4, 10, 2, 0, 1, 3, 4, 0, 2, 0, 1, 1, 0, 1, 0, 3, 4, 5};
+      constant Modelica.Units.SI.SpecificEnthalpy hstar = 2300e3 "normalization enthalpy";
+      constant Modelica.Units.SI.Pressure pstar = 100e6 "normalization pressure";
+      constant Modelica.Units.SI.Temperature Tstar = 760 "normalization temperature";
+      Real pi = p / pstar "normalized specific pressure";
+      Real eta = h / hstar "normalized specific enthalpy";
+    algorithm
+      T := sum(n[i] * (pi + 0.240) ^ I[i] * (eta - 0.615) ^ J[i] for i in 1:31) * Tstar;
+      annotation(
+        Documentation(info = "<html>
  <p>
  &nbsp;Equation number 2 from:<br>
  <div style=\"text-align: center;\">&nbsp;[1] The international Association
@@ -3452,37 +2370,27 @@
  the Thermodynamic Properties of<br>
  &nbsp;Water and Steam</div>
  </p>
- </html>"));
-    end T3a_ph;
-
-    function T3b_ph "Region 3 b: inverse function T(p,h)"
-        extends Modelica.Icons.Function;
-        input Modelica.SIunits.Pressure p "Pressure";
-        input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-        output Modelica.SIunits.Temp_K T "Temperature";
-    protected
-        constant Real[:] n=
-          {0.323254573644920e-4,-0.127575556587181e-3,-0.475851877356068e-3,0.156183014181602e-2,
-           0.105724860113781,-0.858514221132534e2,0.724140095480911e3,0.296475810273257e-2,-0.592721983365988e-2,
-           -0.126305422818666e-1,-0.115716196364853,0.849000969739595e2,-0.108602260086615e-1,0.154304475328851e-1,
-           0.750455441524466e-1,0.252520973612982e-1,-0.602507901232996e-1,-0.307622221350501e1,-0.574011959864879e-1,
-           0.503471360939849e1,-0.925081888584834,0.391733882917546e1,-0.773146007130190e2,0.949308762098587e4,
-           -0.141043719679409e7,0.849166230819026e7,0.861095729446704,0.323346442811720,0.873281936020439,
-           -0.436653048526683,0.286596714529479,-0.131778331276228,0.676682064330275e-2};
-        constant Real[:] I = {-12,-12,-10,-10,-10,-10,-10,-8,-8,-8,-8,
-                              -8,-6,-6,-6,-4,-4,-3,-2,-2,-1,-1,-1,-1,-1,-1,0,0,1,3,5,6,8};
-        constant Real[:] J = {0,1,0,1,5,10,12,0,1,2,4,10,0,1,2,0,1,5,0,4,2,4,6,10,14,16,0,2,1,1,1,1,1};
-        constant Modelica.SIunits.Temp_K Tstar=860 "normalization temperature";
-        constant Modelica.SIunits.Pressure pstar=100e6 "normalization pressure";
-        constant Modelica.SIunits.SpecificEnthalpy hstar=2800e3
-        "normalization enthalpy";
-        Real pi = p/pstar "normalized specific pressure";
-        Real eta = h/hstar "normalized specific enthalpy";
-    algorithm
-        T := sum(n[i]*(pi + 0.298)^I[i]*(eta - 0.720)^J[i] for i in 1:33)*Tstar;
-        annotation (
-          Documentation(
-     info="<html>
+ </html>"));
+    end T3a_ph;
+
+    function T3b_ph "Region 3 b: inverse function T(p,h)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "Pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      output Modelica.Units.SI.Temperature T "Temperature";
+    protected
+      constant Real[:] n = {0.323254573644920e-4, -0.127575556587181e-3, -0.475851877356068e-3, 0.156183014181602e-2, 0.105724860113781, -0.858514221132534e2, 0.724140095480911e3, 0.296475810273257e-2, -0.592721983365988e-2, -0.126305422818666e-1, -0.115716196364853, 0.849000969739595e2, -0.108602260086615e-1, 0.154304475328851e-1, 0.750455441524466e-1, 0.252520973612982e-1, -0.602507901232996e-1, -0.307622221350501e1, -0.574011959864879e-1, 0.503471360939849e1, -0.925081888584834, 0.391733882917546e1, -0.773146007130190e2, 0.949308762098587e4, -0.141043719679409e7, 0.849166230819026e7, 0.861095729446704, 0.323346442811720, 0.873281936020439, -0.436653048526683, 0.286596714529479, -0.131778331276228, 0.676682064330275e-2};
+      constant Real[:] I = {-12, -12, -10, -10, -10, -10, -10, -8, -8, -8, -8, -8, -6, -6, -6, -4, -4, -3, -2, -2, -1, -1, -1, -1, -1, -1, 0, 0, 1, 3, 5, 6, 8};
+      constant Real[:] J = {0, 1, 0, 1, 5, 10, 12, 0, 1, 2, 4, 10, 0, 1, 2, 0, 1, 5, 0, 4, 2, 4, 6, 10, 14, 16, 0, 2, 1, 1, 1, 1, 1};
+      constant Modelica.Units.SI.Temperature Tstar = 860 "normalization temperature";
+      constant Modelica.Units.SI.Pressure pstar = 100e6 "normalization pressure";
+      constant Modelica.Units.SI.SpecificEnthalpy hstar = 2800e3 "normalization enthalpy";
+      Real pi = p / pstar "normalized specific pressure";
+      Real eta = h / hstar "normalized specific enthalpy";
+    algorithm
+      T := sum(n[i] * (pi + 0.298) ^ I[i] * (eta - 0.720) ^ J[i] for i in 1:33) * Tstar;
+      annotation(
+        Documentation(info = "<html>
  <p>
  &nbsp;Equation number 3 from:<br>
  <div style=\"text-align: center;\">&nbsp;[1] The international Association
@@ -3495,38 +2403,27 @@
  the Thermodynamic Properties of<br>
  &nbsp;Water and Steam</div>
  </p>
- </html>"));
-    end T3b_ph;
-
-    function v3a_ph "Region 3 a: inverse function v(p,h)"
-        extends Modelica.Icons.Function;
-        input Modelica.SIunits.Pressure p "Pressure";
-        input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-        output Modelica.SIunits.SpecificVolume v "specific volume";
-    protected
-        constant Real[:] n=
-          { 0.529944062966028e-2,-0.170099690234461,0.111323814312927e2,-0.217898123145125e4,
-           -0.506061827980875e-3,0.556495239685324,-0.943672726094016e1,-0.297856807561527,0.939353943717186e2,
-           0.192944939465981e-1,0.421740664704763,-0.368914126282330e7,-0.737566847600639e-2,-0.354753242424366,
-           -0.199768169338727e1,0.115456297059049e1,0.568366875815960e4,0.808169540124668e-2,0.172416341519307,
-           0.104270175292927e1,-0.297691372792847,0.560394465163593,0.275234661176914,-0.148347894866012,
-           -0.651142513478515e-1,-0.292468715386302e1,0.664876096952665e-1,0.352335014263844e1,-0.146340792313332e-1,
-           -0.224503486668184e1,0.110533464706142e1,-0.408757344495612e-1};
-        constant Real[:] I = {-12,-12,-12,-12,-10,-10,-10,-8,-8,-6,
-                              -6,-6,-4,-4,-3,-2,-2,-1,-1,-1,-1,0,0,1,1,1,2,2,3,4,5,8};
-        constant Real[:] J = {6,8,12,18,4,7,10,5,12,3,4,22,2,3,7,3,16,0,1,2,3,0,1,0,1,2,0,2,0,2,2,2};
-        constant Modelica.SIunits.Volume vstar=0.0028
-        "normalization temperature";
-        constant Modelica.SIunits.Pressure pstar=100e6 "normalization pressure";
-        constant Modelica.SIunits.SpecificEnthalpy hstar=2100e3
-        "normalization enthalpy";
-        Real pi = p/pstar "normalized specific pressure";
-        Real eta = h/hstar "normalized specific enthalpy";
-    algorithm
-        v := sum(n[i]*(pi + 0.128)^I[i]*(eta - 0.727)^J[i] for i in 1:32)*vstar;
-        annotation (
-          Documentation(
-     info="<html>
+ </html>"));
+    end T3b_ph;
+
+    function v3a_ph "Region 3 a: inverse function v(p,h)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "Pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      output Modelica.Units.SI.SpecificVolume v "specific volume";
+    protected
+      constant Real[:] n = {0.529944062966028e-2, -0.170099690234461, 0.111323814312927e2, -0.217898123145125e4, -0.506061827980875e-3, 0.556495239685324, -0.943672726094016e1, -0.297856807561527, 0.939353943717186e2, 0.192944939465981e-1, 0.421740664704763, -0.368914126282330e7, -0.737566847600639e-2, -0.354753242424366, -0.199768169338727e1, 0.115456297059049e1, 0.568366875815960e4, 0.808169540124668e-2, 0.172416341519307, 0.104270175292927e1, -0.297691372792847, 0.560394465163593, 0.275234661176914, -0.148347894866012, -0.651142513478515e-1, -0.292468715386302e1, 0.664876096952665e-1, 0.352335014263844e1, -0.146340792313332e-1, -0.224503486668184e1, 0.110533464706142e1, -0.408757344495612e-1};
+      constant Real[:] I = {-12, -12, -12, -12, -10, -10, -10, -8, -8, -6, -6, -6, -4, -4, -3, -2, -2, -1, -1, -1, -1, 0, 0, 1, 1, 1, 2, 2, 3, 4, 5, 8};
+      constant Real[:] J = {6, 8, 12, 18, 4, 7, 10, 5, 12, 3, 4, 22, 2, 3, 7, 3, 16, 0, 1, 2, 3, 0, 1, 0, 1, 2, 0, 2, 0, 2, 2, 2};
+      constant Modelica.Units.SI.Volume vstar = 0.0028 "normalization temperature";
+      constant Modelica.Units.SI.Pressure pstar = 100e6 "normalization pressure";
+      constant Modelica.Units.SI.SpecificEnthalpy hstar = 2100e3 "normalization enthalpy";
+      Real pi = p / pstar "normalized specific pressure";
+      Real eta = h / hstar "normalized specific enthalpy";
+    algorithm
+      v := sum(n[i] * (pi + 0.128) ^ I[i] * (eta - 0.727) ^ J[i] for i in 1:32) * vstar;
+      annotation(
+        Documentation(info = "<html>
  <p>
  &nbsp;Equation number 4 from:<br>
  <div style=\"text-align: center;\">&nbsp;[1] The international Association
@@ -3539,38 +2436,27 @@
  the Thermodynamic Properties of<br>
  &nbsp;Water and Steam</div>
  </p>
- </html>"));
-    end v3a_ph;
-
-    function v3b_ph "Region 3 b: inverse function v(p,h)"
-        extends Modelica.Icons.Function;
-        input Modelica.SIunits.Pressure p "Pressure";
-        input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-        output Modelica.SIunits.SpecificVolume v "specific volume";
-    protected
-        constant Real[:] n=
-          { -0.225196934336318e-8,0.140674363313486e-7,0.233784085280560e-5,-0.331833715229001e-4,
-           0.107956778514318e-2,-0.271382067378863,0.107202262490333e1,-0.853821329075382,-0.215214194340526e-4,
-           0.769656088222730e-3,-0.431136580433864e-2,0.453342167309331,-0.507749535873652,-0.100475154528389e3,
-           -0.219201924648793,-0.321087965668917e1,0.607567815637771e3,0.557686450685932e-3,0.187499040029550,
-           0.905368030448107e-2,0.285417173048685,0.329924030996098e-1,0.239897419685483,0.482754995951394e1,
-           -0.118035753702231e2,0.169490044091791,-0.179967222507787e-1,0.371810116332674e-1,-0.536288335065096e-1,
-           0.160697101092520e1};
-        constant Real[:] I = {-12,-12,-8,-8,-8,-8,-8,-8,-6,-6,
-                              -6,-6,-6,-6,-4,-4,-4,-3,-3,-2,-2,-1,-1,-1,-1,0,1,1,2,2};
-        constant Real[:] J = {0,1,0,1,3,6,7,8,0,1,2,5,6,10,3,6,10,0,2,1,2,0,1,4,5,0,0,1,2,6};
-        constant Modelica.SIunits.Volume vstar=0.0088
-        "normalization temperature";
-        constant Modelica.SIunits.Pressure pstar=100e6 "normalization pressure";
-        constant Modelica.SIunits.SpecificEnthalpy hstar=2800e3
-        "normalization enthalpy";
-        Real pi = p/pstar "normalized specific pressure";
-        Real eta = h/hstar "normalized specific enthalpy";
-    algorithm
-        v := sum(n[i]*(pi + 0.0661)^I[i]*(eta - 0.720)^J[i] for i in 1:30)*vstar;
-        annotation (
-          Documentation(
-     info="<html>
+ </html>"));
+    end v3a_ph;
+
+    function v3b_ph "Region 3 b: inverse function v(p,h)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "Pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      output Modelica.Units.SI.SpecificVolume v "specific volume";
+    protected
+      constant Real[:] n = {-0.225196934336318e-8, 0.140674363313486e-7, 0.233784085280560e-5, -0.331833715229001e-4, 0.107956778514318e-2, -0.271382067378863, 0.107202262490333e1, -0.853821329075382, -0.215214194340526e-4, 0.769656088222730e-3, -0.431136580433864e-2, 0.453342167309331, -0.507749535873652, -0.100475154528389e3, -0.219201924648793, -0.321087965668917e1, 0.607567815637771e3, 0.557686450685932e-3, 0.187499040029550, 0.905368030448107e-2, 0.285417173048685, 0.329924030996098e-1, 0.239897419685483, 0.482754995951394e1, -0.118035753702231e2, 0.169490044091791, -0.179967222507787e-1, 0.371810116332674e-1, -0.536288335065096e-1, 0.160697101092520e1};
+      constant Real[:] I = {-12, -12, -8, -8, -8, -8, -8, -8, -6, -6, -6, -6, -6, -6, -4, -4, -4, -3, -3, -2, -2, -1, -1, -1, -1, 0, 1, 1, 2, 2};
+      constant Real[:] J = {0, 1, 0, 1, 3, 6, 7, 8, 0, 1, 2, 5, 6, 10, 3, 6, 10, 0, 2, 1, 2, 0, 1, 4, 5, 0, 0, 1, 2, 6};
+      constant Modelica.Units.SI.Volume vstar = 0.0088 "normalization temperature";
+      constant Modelica.Units.SI.Pressure pstar = 100e6 "normalization pressure";
+      constant Modelica.Units.SI.SpecificEnthalpy hstar = 2800e3 "normalization enthalpy";
+      Real pi = p / pstar "normalized specific pressure";
+      Real eta = h / hstar "normalized specific enthalpy";
+    algorithm
+      v := sum(n[i] * (pi + 0.0661) ^ I[i] * (eta - 0.720) ^ J[i] for i in 1:30) * vstar;
+      annotation(
+        Documentation(info = "<html>
  <p>
  &nbsp;Equation number 5 from:<br>
  <div style=\"text-align: center;\">&nbsp;[1] The international Association
@@ -3583,37 +2469,27 @@
  the Thermodynamic Properties of<br>
  &nbsp;Water and Steam</div>
  </p>
- </html>"));
-    end v3b_ph;
-
-    function T3a_ps "Region 3 a: inverse function T(p,s)"
-        extends Modelica.Icons.Function;
-        input Modelica.SIunits.Pressure p "Pressure";
-        input Modelica.SIunits.SpecificEntropy s "specific entropy";
-        output Modelica.SIunits.Temp_K T "Temperature";
-    protected
-        constant Real[:] n=
-          {0.150042008263875e10,-0.159397258480424e12,0.502181140217975e-3,-0.672057767855466e2,
-           0.145058545404456e4,-0.823889534888890e4,-0.154852214233853,0.112305046746695e2,-0.297000213482822e2,
-           0.438565132635495e11,0.137837838635464e-2,-0.297478527157462e1,0.971777947349413e13,-0.571527767052398e-4,
-           0.288307949778420e5,-0.744428289262703e14,0.128017324848921e2,-0.368275545889071e3,0.664768904779177e16,
-           0.449359251958880e-1,-0.422897836099655e1,-0.240614376434179,-0.474341365254924e1,0.724093999126110,
-           0.923874349695897,0.399043655281015e1,0.384066651868009e-1,-0.359344365571848e-2,-0.735196448821653,
-           0.188367048396131,0.141064266818704e-3,-0.257418501496337e-2,0.123220024851555e-2};
-        constant Real[:] I = {-12,-12,-10,-10,-10,-10,-8,-8,
-                              -8,-8,-6,-6,-6,-5,-5,-5,-4,-4,-4,-2,-2,-1,-1,0,0,0,1,2,2,3,8,8,10};
-        constant Real[:] J = {28,32,4,10,12,14,5,7,8,28,2,6,32,0,14,32,6,10,36,1,4,1,6,0,1,4,0,0,3,2,0,1,2};
-        constant Modelica.SIunits.Temp_K Tstar=760 "normalization temperature";
-        constant Modelica.SIunits.Pressure pstar=100e6 "normalization pressure";
-        constant Modelica.SIunits.SpecificEntropy sstar=4.4e3
-        "normalization entropy";
-        Real pi = p/pstar "normalized specific pressure";
-        Real sigma = s/sstar "normalized specific entropy";
-    algorithm
-        T := sum(n[i]*(pi + 0.240)^I[i]*(sigma - 0.703)^J[i] for i in 1:33)*Tstar;
-        annotation (
-          Documentation(
-     info="<html>
+ </html>"));
+    end v3b_ph;
+
+    function T3a_ps "Region 3 a: inverse function T(p,s)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "Pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      output Modelica.Units.SI.Temperature T "Temperature";
+    protected
+      constant Real[:] n = {0.150042008263875e10, -0.159397258480424e12, 0.502181140217975e-3, -0.672057767855466e2, 0.145058545404456e4, -0.823889534888890e4, -0.154852214233853, 0.112305046746695e2, -0.297000213482822e2, 0.438565132635495e11, 0.137837838635464e-2, -0.297478527157462e1, 0.971777947349413e13, -0.571527767052398e-4, 0.288307949778420e5, -0.744428289262703e14, 0.128017324848921e2, -0.368275545889071e3, 0.664768904779177e16, 0.449359251958880e-1, -0.422897836099655e1, -0.240614376434179, -0.474341365254924e1, 0.724093999126110, 0.923874349695897, 0.399043655281015e1, 0.384066651868009e-1, -0.359344365571848e-2, -0.735196448821653, 0.188367048396131, 0.141064266818704e-3, -0.257418501496337e-2, 0.123220024851555e-2};
+      constant Real[:] I = {-12, -12, -10, -10, -10, -10, -8, -8, -8, -8, -6, -6, -6, -5, -5, -5, -4, -4, -4, -2, -2, -1, -1, 0, 0, 0, 1, 2, 2, 3, 8, 8, 10};
+      constant Real[:] J = {28, 32, 4, 10, 12, 14, 5, 7, 8, 28, 2, 6, 32, 0, 14, 32, 6, 10, 36, 1, 4, 1, 6, 0, 1, 4, 0, 0, 3, 2, 0, 1, 2};
+      constant Modelica.Units.SI.Temperature Tstar = 760 "normalization temperature";
+      constant Modelica.Units.SI.Pressure pstar = 100e6 "normalization pressure";
+      constant Modelica.Units.SI.SpecificEntropy sstar = 4.4e3 "normalization entropy";
+      Real pi = p / pstar "normalized specific pressure";
+      Real sigma = s / sstar "normalized specific entropy";
+    algorithm
+      T := sum(n[i] * (pi + 0.240) ^ I[i] * (sigma - 0.703) ^ J[i] for i in 1:33) * Tstar;
+      annotation(
+        Documentation(info = "<html>
  <p>
  &nbsp;Equation number 6 from:<br>
  <div style=\"text-align: center;\">&nbsp;[1] The international Association
@@ -3626,35 +2502,27 @@
  the Thermodynamic Properties of<br>
  &nbsp;Water and Steam</div>
  </p>
- </html>"));
-    end T3a_ps;
-
-    function T3b_ps "Region 3 b: inverse function T(p,s)"
-        extends Modelica.Icons.Function;
-        input Modelica.SIunits.Pressure p "Pressure";
-        input Modelica.SIunits.SpecificEntropy s "specific entropy";
-        output Modelica.SIunits.Temp_K T "Temperature";
-    protected
-        constant Real[:] n=
-          {0.527111701601660,-0.401317830052742e2,0.153020073134484e3,-0.224799398218827e4,
-           -0.193993484669048,-0.140467557893768e1,0.426799878114024e2,0.752810643416743,0.226657238616417e2,
-           -0.622873556909932e3,-0.660823667935396,0.841267087271658,-0.253717501764397e2,0.485708963532948e3,
-           0.880531517490555e3,0.265015592794626e7,-0.359287150025783,-0.656991567673753e3,0.241768149185367e1,
-           0.856873461222588,0.655143675313458,-0.213535213206406,0.562974957606348e-2,-0.316955725450471e15,
-           -0.699997000152457e-3,0.119845803210767e-1,0.193848122022095e-4,-0.215095749182309e-4};
-        constant Real[:] I = {-12,-12,-12,-12,-8,-8,-8,-6,-6,-6,-5,-5,-5,-5,-5,-4,-3,-3,-2,0,2,3,4,5,6,8,12,14};
-        constant Real[:] J = {1,3,4,7,0,1,3,0,2,4,0,1,2,4,6,12,1,6,2,0,1,1,0,24,0,3,1,2};
-        constant Modelica.SIunits.Temp_K Tstar=860 "normalization temperature";
-        constant Modelica.SIunits.Pressure pstar=100e6 "normalization pressure";
-        constant Modelica.SIunits.SpecificEntropy sstar=5.3e3
-        "normalization entropy";
-        Real pi = p/pstar "normalized specific pressure";
-        Real sigma = s/sstar "normalized specific entropy";
-    algorithm
-        T := sum(n[i]*(pi + 0.760)^I[i]*(sigma - 0.818)^J[i] for i in 1:28)*Tstar;
-        annotation (
-          Documentation(
-     info="<html>
+ </html>"));
+    end T3a_ps;
+
+    function T3b_ps "Region 3 b: inverse function T(p,s)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "Pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      output Modelica.Units.SI.Temperature T "Temperature";
+    protected
+      constant Real[:] n = {0.527111701601660, -0.401317830052742e2, 0.153020073134484e3, -0.224799398218827e4, -0.193993484669048, -0.140467557893768e1, 0.426799878114024e2, 0.752810643416743, 0.226657238616417e2, -0.622873556909932e3, -0.660823667935396, 0.841267087271658, -0.253717501764397e2, 0.485708963532948e3, 0.880531517490555e3, 0.265015592794626e7, -0.359287150025783, -0.656991567673753e3, 0.241768149185367e1, 0.856873461222588, 0.655143675313458, -0.213535213206406, 0.562974957606348e-2, -0.316955725450471e15, -0.699997000152457e-3, 0.119845803210767e-1, 0.193848122022095e-4, -0.215095749182309e-4};
+      constant Real[:] I = {-12, -12, -12, -12, -8, -8, -8, -6, -6, -6, -5, -5, -5, -5, -5, -4, -3, -3, -2, 0, 2, 3, 4, 5, 6, 8, 12, 14};
+      constant Real[:] J = {1, 3, 4, 7, 0, 1, 3, 0, 2, 4, 0, 1, 2, 4, 6, 12, 1, 6, 2, 0, 1, 1, 0, 24, 0, 3, 1, 2};
+      constant Modelica.Units.SI.Temperature Tstar = 860 "normalization temperature";
+      constant Modelica.Units.SI.Pressure pstar = 100e6 "normalization pressure";
+      constant Modelica.Units.SI.SpecificEntropy sstar = 5.3e3 "normalization entropy";
+      Real pi = p / pstar "normalized specific pressure";
+      Real sigma = s / sstar "normalized specific entropy";
+    algorithm
+      T := sum(n[i] * (pi + 0.760) ^ I[i] * (sigma - 0.818) ^ J[i] for i in 1:28) * Tstar;
+      annotation(
+        Documentation(info = "<html>
  <p>
  &nbsp;Equation number 7 from:<br>
  <div style=\"text-align: center;\">&nbsp;[1] The international Association
@@ -3667,36 +2535,27 @@
  the Thermodynamic Properties of<br>
  &nbsp;Water and Steam</div>
  </p>
- </html>"));
-    end T3b_ps;
-
-    function v3a_ps "Region 3 a: inverse function v(p,s)"
-        extends Modelica.Icons.Function;
-        input Modelica.SIunits.Pressure p "Pressure";
-        input Modelica.SIunits.SpecificEntropy s "specific entropy";
-        output Modelica.SIunits.SpecificVolume v "specific volume";
-    protected
-        constant Real[:] n=
-          {0.795544074093975e2,-0.238261242984590e4,0.176813100617787e5,-0.110524727080379e-2,
-           -0.153213833655326e2,0.297544599376982e3,-0.350315206871242e8,0.277513761062119,-0.523964271036888,
-           -0.148011182995403e6,0.160014899374266e7,0.170802322663427e13,0.246866996006494e-3,0.165326084797980e1,
-           -0.118008384666987,0.253798642355900e1,0.965127704669424,-0.282172420532826e2,0.203224612353823,
-           0.110648186063513e1,0.526127948451280,0.277000018736321,0.108153340501132e1,-0.744127885357893e-1,
-           0.164094443541384e-1,-0.680468275301065e-1,0.257988576101640e-1,-0.145749861944416e-3};
-        constant Real[:] I = {-12,-12,-12,-10,-10,-10,-10,-8,-8,-8,-8,-6,-5,-4,-3,-3,-2,-2,-1,-1,0,0,0,1,2,4,5,6};
-        constant Real[:] J = {10,12,14,4,8,10,20,5,6,14,16,28,1,5,2,4,3,8,1,2,0,1,3,0,0,2,2,0};
-        constant Modelica.SIunits.Volume vstar=0.0028
-        "normalization temperature";
-        constant Modelica.SIunits.Pressure pstar=100e6 "normalization pressure";
-        constant Modelica.SIunits.SpecificEntropy sstar=4.4e3
-        "normalization entropy";
-        Real pi = p/pstar "normalized specific pressure";
-        Real sigma = s/sstar "normalized specific entropy";
-    algorithm
-        v := sum(n[i]*(pi + 0.187)^I[i]*(sigma - 0.755)^J[i] for i in 1:28)*vstar;
-        annotation (
-          Documentation(
-     info="<html>
+ </html>"));
+    end T3b_ps;
+
+    function v3a_ps "Region 3 a: inverse function v(p,s)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "Pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      output Modelica.Units.SI.SpecificVolume v "specific volume";
+    protected
+      constant Real[:] n = {0.795544074093975e2, -0.238261242984590e4, 0.176813100617787e5, -0.110524727080379e-2, -0.153213833655326e2, 0.297544599376982e3, -0.350315206871242e8, 0.277513761062119, -0.523964271036888, -0.148011182995403e6, 0.160014899374266e7, 0.170802322663427e13, 0.246866996006494e-3, 0.165326084797980e1, -0.118008384666987, 0.253798642355900e1, 0.965127704669424, -0.282172420532826e2, 0.203224612353823, 0.110648186063513e1, 0.526127948451280, 0.277000018736321, 0.108153340501132e1, -0.744127885357893e-1, 0.164094443541384e-1, -0.680468275301065e-1, 0.257988576101640e-1, -0.145749861944416e-3};
+      constant Real[:] I = {-12, -12, -12, -10, -10, -10, -10, -8, -8, -8, -8, -6, -5, -4, -3, -3, -2, -2, -1, -1, 0, 0, 0, 1, 2, 4, 5, 6};
+      constant Real[:] J = {10, 12, 14, 4, 8, 10, 20, 5, 6, 14, 16, 28, 1, 5, 2, 4, 3, 8, 1, 2, 0, 1, 3, 0, 0, 2, 2, 0};
+      constant Modelica.Units.SI.Volume vstar = 0.0028 "normalization temperature";
+      constant Modelica.Units.SI.Pressure pstar = 100e6 "normalization pressure";
+      constant Modelica.Units.SI.SpecificEntropy sstar = 4.4e3 "normalization entropy";
+      Real pi = p / pstar "normalized specific pressure";
+      Real sigma = s / sstar "normalized specific entropy";
+    algorithm
+      v := sum(n[i] * (pi + 0.187) ^ I[i] * (sigma - 0.755) ^ J[i] for i in 1:28) * vstar;
+      annotation(
+        Documentation(info = "<html>
  <p>
  &nbsp;Equation number 8 from:<br>
  <div style=\"text-align: center;\">&nbsp;[1] The international Association
@@ -3709,38 +2568,27 @@
  the Thermodynamic Properties of<br>
  &nbsp;Water and Steam</div>
  </p>
- </html>"));
-    end v3a_ps;
-
-    function v3b_ps "Region 3 b: inverse function v(p,s)"
-        extends Modelica.Icons.Function;
-        input Modelica.SIunits.Pressure p "Pressure";
-        input Modelica.SIunits.SpecificEntropy s "specific entropy";
-        output Modelica.SIunits.SpecificVolume v "specific volume";
-    protected
-        constant Real[:] n=
-          {0.591599780322238e-4,-0.185465997137856e-2,0.104190510480013e-1,0.598647302038590e-2,
-           -0.771391189901699,0.172549765557036e1,-0.467076079846526e-3,0.134533823384439e-1,-0.808094336805495e-1,
-           0.508139374365767,0.128584643361683e-2,-0.163899353915435e1,0.586938199318063e1,-0.292466667918613e1,
-           -0.614076301499537e-2,0.576199014049172e1,-0.121613320606788e2,0.167637540957944e1,-0.744135838773463e1,
-           0.378168091437659e-1,0.401432203027688e1,0.160279837479185e2,0.317848779347728e1,-0.358362310304853e1,
-           -0.115995260446827e7,0.199256573577909,-0.122270624794624,-0.191449143716586e2,-0.150448002905284e-1,
-           0.146407900162154e2,-0.327477787188230e1};
-        constant Real[:] I = {-12,-12,-12,-12,-12,-12,-10,-10,
-                              -10,-10,-8,-5,-5,-5,-4,-4,-4,-4,-3,-2,-2,-2,-2,-2,-2,0,0,0,1,1,2};
-        constant Real[:] J = {0,1,2,3,5,6,0,1,2,4,0,1,2,3,0,1,2,3,1,0,1,2,3,4,12,0,1,2,0,2,2};
-        constant Modelica.SIunits.Volume vstar=0.0088
-        "normalization temperature";
-        constant Modelica.SIunits.Pressure pstar=100e6 "normalization pressure";
-        constant Modelica.SIunits.SpecificEntropy sstar=5.3e3
-        "normalization entropy";
-        Real pi = p/pstar "normalized specific pressure";
-        Real sigma = s/sstar "normalized specific entropy";
-    algorithm
-        v := sum(n[i]*(pi + 0.298)^I[i]*(sigma - 0.816)^J[i] for i in 1:31)*vstar;
-        annotation (
-          Documentation(
-     info="<html>
+ </html>"));
+    end v3a_ps;
+
+    function v3b_ps "Region 3 b: inverse function v(p,s)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "Pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      output Modelica.Units.SI.SpecificVolume v "specific volume";
+    protected
+      constant Real[:] n = {0.591599780322238e-4, -0.185465997137856e-2, 0.104190510480013e-1, 0.598647302038590e-2, -0.771391189901699, 0.172549765557036e1, -0.467076079846526e-3, 0.134533823384439e-1, -0.808094336805495e-1, 0.508139374365767, 0.128584643361683e-2, -0.163899353915435e1, 0.586938199318063e1, -0.292466667918613e1, -0.614076301499537e-2, 0.576199014049172e1, -0.121613320606788e2, 0.167637540957944e1, -0.744135838773463e1, 0.378168091437659e-1, 0.401432203027688e1, 0.160279837479185e2, 0.317848779347728e1, -0.358362310304853e1, -0.115995260446827e7, 0.199256573577909, -0.122270624794624, -0.191449143716586e2, -0.150448002905284e-1, 0.146407900162154e2, -0.327477787188230e1};
+      constant Real[:] I = {-12, -12, -12, -12, -12, -12, -10, -10, -10, -10, -8, -5, -5, -5, -4, -4, -4, -4, -3, -2, -2, -2, -2, -2, -2, 0, 0, 0, 1, 1, 2};
+      constant Real[:] J = {0, 1, 2, 3, 5, 6, 0, 1, 2, 4, 0, 1, 2, 3, 0, 1, 2, 3, 1, 0, 1, 2, 3, 4, 12, 0, 1, 2, 0, 2, 2};
+      constant Modelica.Units.SI.Volume vstar = 0.0088 "normalization temperature";
+      constant Modelica.Units.SI.Pressure pstar = 100e6 "normalization pressure";
+      constant Modelica.Units.SI.SpecificEntropy sstar = 5.3e3 "normalization entropy";
+      Real pi = p / pstar "normalized specific pressure";
+      Real sigma = s / sstar "normalized specific entropy";
+    algorithm
+      v := sum(n[i] * (pi + 0.298) ^ I[i] * (sigma - 0.816) ^ J[i] for i in 1:31) * vstar;
+      annotation(
+        Documentation(info = "<html>
  <p>
  &nbsp;Equation number 9 from:<br>
  <div style=\"text-align: center;\">&nbsp;[1] The international Association
@@ -3753,866 +2601,348 @@
  the Thermodynamic Properties of<br>
  &nbsp;Water and Steam</div>
  </p>
- </html>"));
-    end v3b_ps;
-
-    function g1L3
-      "base function for region 1 with 3rd derivatives for sensitivities: g(p,T)"
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      output ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd
-                                                      g
-        "dimensionless Gibbs function and derivatives up to 3rd derivatives";
-    protected
-      Real pi1;
-      Real tau1;
-      Real[55] o;
-    algorithm
-      assert(p > ThermoSysPro.Properties.WaterSteam.BaseIF97.triple.ptriple,
-        "IF97 medium function g1 called with too low pressure\n" + "p = " +
-        String(p) + " Pa <= " + String(ThermoSysPro.Properties.WaterSteam.BaseIF97.triple.ptriple)
-         + " Pa (triple point pressure)");
-      assert(p <= 100.0e6,
-        "IF97 medium function g1: the input pressure (= " + String(p) + " Pa) is higher than 100 Mpa");
-      assert(T >= 273.15,
-        "IF97 medium function g1: the temperature (= " + String(T) + " K)  is lower than 273.15 K!");
-      g.p := p;
-      g.T := T;
-      g.R := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
-      g.pi := p/ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PSTAR1;
-      g.tau := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TSTAR1/T;
-      pi1 := 7.1 - g.pi;
-      tau1 := -1.222 + g.tau;
-      o[1] := tau1*tau1;
-      o[2] := o[1]*o[1];
-      o[3] := o[2]*o[2];
-      o[4] := o[3]*tau1;
-      o[5] := 1/o[4];
-      o[6] := o[1]*o[2];
-      o[7] := o[1]*tau1;
-      o[8] := 1/o[7];
-      o[9] := o[1]*o[2]*o[3];
-      o[10] := 1/o[2];
-      o[11] := o[2]*tau1;
-      o[12] := 1/o[11];
-      o[13] := o[2]*o[3];
-      o[14] := 1/o[3];
-      o[15] := pi1*pi1;
-      o[16] := o[15]*pi1;
-      o[17] := o[15]*o[15];
-      o[18] := o[17]*o[17];
-      o[19] := o[17]*o[18]*pi1;
-      o[20] := o[15]*o[17];
-      o[21] := o[3]*o[3];
-      o[22] := o[21]*o[21];
-      o[23] := o[22]*o[3]*tau1;
-      o[24] := 1/o[23];
-      o[25] := o[22]*o[3];
-      o[26] := 1/o[25];
-      o[27] := o[1]*o[2]*o[22]*tau1;
-      o[28] := 1/o[27];
-      o[29] := o[1]*o[2]*o[22];
-      o[30] := 1/o[29];
-      o[31] := o[1]*o[2]*o[21]*o[3]*tau1;
-      o[32] := 1/o[31];
-      o[33] := o[2]*o[21]*o[3]*tau1;
-      o[34] := 1/o[33];
-      o[35] := o[1]*o[3]*tau1;
-      o[36] := 1/o[35];
-      o[37] := 5.85475673349302e-8*o[11];
-      o[38] := o[1]*o[3];
-      o[39] := 1/o[38];
-      o[40] := 1/o[6];
-      o[41] := o[1]*o[22]*o[3];
-      o[42] := 1/o[41];
-      o[43] := 1/o[22];
-      o[44] := o[1]*o[2]*o[21]*o[3];
-      o[45] := 1/o[44];
-      o[46] := 1/o[13];
-      o[47] := -0.00031703014781958*o[2];
-      o[48] := o[1]*o[2]*tau1;
-      o[49] := 1/o[48];
-      o[50] := o[1]*o[22]*o[3]*tau1;
-      o[51] := 1/o[50];
-      o[52] := o[22]*tau1;
-      o[53] := 1/o[52];
-      o[54] := o[2]*o[3]*tau1;
-      o[55] := 1/o[54];
-
-      g.g := pi1*
-          (pi1*(pi1*(o[10]*(-0.000031679644845054 +
-       o[2]*(-2.8270797985312e-6-8.5205128120103e-10*o[6])) +
-       pi1*(o[12]*(-2.2425281908e-6 + (-6.5171222895601e-7 -
-       1.4341729937924e-13*o[13])*o[7]) + pi1*(-4.0516996860117e-7*o[14] +
-       o[16]*((-1.2734301741641e-9-1.7424871230634e-10*o[11])*o[36] +
-       o[19]*(-6.8762131295531e-19*o[34] + o[15]*(1.4478307828521e-20*o[32]
-       + o[20]*(2.6335781662795e-23*o[30] + pi1*(-1.1947622640071e-23*o[28]+
-       pi1*(1.8228094581404e-24*o[26]- 9.3537087292458e-26*o[24]*pi1)))))))))
-       + o[8]*(-0.00047184321073267 + o[7]*(-0.00030001780793026 +
-       (0.000047661393906987 +
-       o[1]*(-4.4141845330846e-6-7.2694996297594e-16*o[9]))*tau1))) +
-       o[5]*(0.00028319080123804 + o[1]*(-0.00060706301565874 +
-       o[6]*(-0.018990068218419 + tau1*(-0.032529748770505 +
-       (-0.021841717175414-0.00005283835796993*o[1])*tau1))))) +
-       (0.14632971213167 + tau1*(-0.84548187169114 + tau1*(-3.756360367204
-       + tau1*(3.3855169168385 + tau1*(-0.95791963387872 +
-       tau1*(0.15772038513228 + (-0.016616417199501 +
-       0.00081214629983568*tau1)*tau1))))))/o[1];
-
-       g.gpi :=  pi1*(pi1*(o[10]*(0.000095038934535162 + o[2]*(8.4812393955936e-6 +
-       2.55615384360309e-9*o[6])) + pi1*(o[12]*(8.9701127632e-6 +
-       (2.60684891582404e-6 + 5.7366919751696e-13*o[13])*o[7]) +
-       pi1*(2.02584984300585e-6*o[14] + o[16]*((1.01874413933128e-8 +
-       1.39398969845072e-9*o[11])*o[36] + o[19]*(1.44400475720615e-17*o[34]
-       + o[15]*(-3.33001080055983e-19*o[32] +
-       o[20]*(-7.63737668221055e-22*o[30] + pi1*(3.5842867920213e-22*o[28]
-       + pi1*(-5.65070932023524e-23*o[26] +
-       2.99318679335866e-24*o[24]*pi1))))))))) + o[8]*(0.00094368642146534
-       + o[7]*(0.00060003561586052 + (-0.000095322787813974 +
-       o[1]*(8.8283690661692e-6 + 1.45389992595188e-15*o[9]))*tau1))) +
-       o[5]*(-0.00028319080123804 + o[1]*(0.00060706301565874 +
-       o[6]*(0.018990068218419 + tau1*(0.032529748770505 +
-       (0.021841717175414 + 0.00005283835796993*o[1])*tau1))));
-
-       g.gpipi :=  pi1*(o[10]*(-0.000190077869070324 +
-       o[2]*(-0.0000169624787911872-5.11230768720618e-9*o[6])) +
-       pi1*(o[12]*(-0.0000269103382896 +
-       (-7.82054674747212e-6-1.72100759255088e-12*o[13])*o[7]) +
-       pi1*(-8.1033993720234e-6*o[14] +
-       o[16]*((-7.13120897531896e-8-9.75792788915504e-9*o[11])*o[36] +
-       o[19]*(-2.8880095144123e-16*o[34] +
-       o[15]*(7.32602376123163e-18*o[32] +
-       o[20]*(2.13846547101895e-20*o[30] + pi1*(-1.03944316968618e-20*o[28]+
-       pi1*(1.69521279607057e-21*o[26]-9.27887905941183e-23*o[24]*pi1)))))))))
-       + o[8]*(-0.00094368642146534 + o[7]*(-0.00060003561586052 +
-       (0.000095322787813974 +
-       o[1]*(-8.8283690661692e-6-1.45389992595188e-15*o[9]))*tau1));
-
-       g.gpipipi := o[10]*(0.000190077869070324 + o[2]*(0.0000169624787911872 +
-       5.11230768720618e-9*o[6])) + pi1*(o[12]*(0.0000538206765792 +
-       (0.0000156410934949442 + 3.44201518510176e-12*o[13])*o[7]) +
-       pi1*(0.0000243101981160702*o[14] + o[16]*(o[36]*(4.27872538519138e-7
-       + o[37]) + o[19]*(5.48721807738337e-15*o[34] +
-       o[15]*(-1.53846498985864e-16*o[32] +
-       o[20]*(-5.77385677175118e-19*o[30] + pi1*(2.9104408751213e-19*o[28]
-       + pi1*(-4.91611710860466e-20*o[26] +
-       2.78366371782355e-21*o[24]*pi1))))))));
-
-       g.gtau :=
-       pi1*(o[39]*(-0.00254871721114236 + o[1]*(0.00424944110961118 +
-       (0.018990068218419 +
-       (-0.021841717175414-0.00015851507390979*o[1])*o[1])*o[6])) +
-       pi1*(o[10]*(0.00141552963219801 + o[2]*(0.000047661393906987 +
-       o[1]*(-0.0000132425535992538-1.2358149370591e-14*o[9]))) +
-       pi1*(o[12]*(0.000126718579380216-5.11230768720618e-9*o[38]) +
-       pi1*(o[40]*(0.000011212640954 +
-       (1.30342445791202e-6-1.4341729937924e-12*o[13])*o[7]) +
-       pi1*(3.24135974880936e-6*o[5] + o[16]*((1.40077319158051e-8 +
-       1.04549227383804e-9*o[11])*o[46] + o[19]*(1.9941018075704e-17*o[45]
-       + o[15]*(-4.48827542684151e-19*o[43] +
-       o[20]*(-1.00075970318621e-21*o[28] + pi1*(4.65957282962769e-22*o[26]
-       + pi1*(-7.2912378325616e-23*o[24] +
-       3.83502057899078e-24*o[42]*pi1))))))))))) + o[8]*(-0.29265942426334
-       + tau1*(0.84548187169114 + o[1]*(3.3855169168385 +
-       tau1*(-1.91583926775744 + tau1*(0.47316115539684 +
-       (-0.066465668798004 + 0.0040607314991784*tau1)*tau1)))));
-
-       g.gtautau :=
-       pi1*(o[36]*(0.0254871721114236 + o[1]*(-0.0339955288768894 +
-       (-0.037980136436838 + o[47])*o[6])) +
-       pi1*(o[12]*(-0.00566211852879204 +
-       o[6]*(-0.0000264851071985076-1.97730389929456e-13*o[9])) +
-       pi1*((-0.00063359289690108-2.55615384360309e-8*o[38])*o[40] +
-       pi1*(o[49]*(-0.000067275845724 +
-       (-3.91027337373606e-6-1.29075569441316e-11*o[13])*o[7]) +
-       pi1*(-0.0000291722377392842*o[39] +
-       o[16]*((-1.68092782989661e-7-7.31844591686628e-9*o[11])*o[55] +
-       o[19]*(-5.9823054227112e-16*o[32] +
-       o[15]*(1.43624813658928e-17*o[53] +
-       o[20]*(3.90296284242622e-20*o[26] + pi1*(-1.86382913185108e-20*o[24]
-       +
-       pi1*(2.98940751135026e-21*o[42]-1.61070864317613e-22*o[51]*pi1)))))))))))
-       + o[10]*(0.87797827279002 + tau1*(-1.69096374338228 +
-       o[7]*(-1.91583926775744 + tau1*(0.94632231079368 +
-       (-0.199397006394012 + 0.0162429259967136*tau1)*tau1))));
-
-       g.gtautautau :=
-       pi1*(o[46]*(-0.28035889322566 + o[1]*(0.305959759892005 +
-       (0.113940409310514 + o[47])*o[6])) + pi1*(o[40]*(0.0283105926439602
-       + o[6]*(-0.0000264851071985076-2.96595584894183e-12*o[9])) +
-       pi1*((0.00380155738140648-1.02246153744124e-7*o[38])*o[49] +
-       pi1*(o[14]*(0.000470930920068 +
-       (0.0000156410934949442-1.03260455553053e-10*o[13])*o[7]) +
-       pi1*(0.000291722377392842*o[36] + o[16]*((2.1852061788656e-6 +
-       o[37])/o[9] + o[19]*(1.85451468104047e-14*o[43] +
-       o[15]*(-4.73961885074464e-16/(o[1]*o[22]) +
-       o[20]*(-1.56118513697049e-18*o[24] + pi1*(7.64169944058941e-19*o[42]
-       + pi1*(-1.25555115476711e-19*o[51] +
-       (6.92604716565734e-21*pi1)/(o[2]*o[22]*o[3])))))))))))) +
-       o[12]*(-3.51191309116008 + tau1*(5.07289123014684 +
-       o[2]*(0.94632231079368 + (-0.398794012788024 +
-       0.0487287779901408*tau1)*tau1)));
-
-       g.gpitau := o[39]*(0.00254871721114236
-       + o[1]*(-0.00424944110961118 + (-0.018990068218419 +
-       (0.021841717175414 + 0.00015851507390979*o[1])*o[1])*o[6])) +
-       pi1*(o[10]*(-0.00283105926439602 + o[2]*(-0.000095322787813974 +
-       o[1]*(0.0000264851071985076 + 2.4716298741182e-14*o[9]))) +
-       pi1*(o[12]*(-0.000380155738140648 + 1.53369230616185e-8*o[38]) +
-       pi1*(o[40]*(-0.000044850563816 + (-5.21369783164808e-6 +
-       5.7366919751696e-12*o[13])*o[7]) + pi1*(-0.0000162067987440468*o[5]
-       + o[16]*((-1.12061855326441e-7-8.36393819070432e-9*o[11])*o[46] +
-       o[19]*(-4.18761379589784e-16*o[45] +
-       o[15]*(1.03230334817355e-17*o[43] +
-       o[20]*(2.90220313924001e-20*o[28] + pi1*(-1.39787184888831e-20*o[26]
-       +
-       pi1*(2.2602837280941e-21*o[24]-1.22720658527705e-22*o[42]*pi1))))))))));
-
-       g.gpipitau := o[10]*(0.00283105926439602 + o[2]*(0.000095322787813974 +
-       o[1]*(-0.0000264851071985076-2.4716298741182e-14*o[9]))) +
-       pi1*(o[12]*(0.000760311476281296-3.06738461232371e-8*o[38]) +
-       pi1*(o[40]*(0.000134551691448 +
-       (0.0000156410934949442-1.72100759255088e-11*o[13])*o[7]) +
-       pi1*(0.0000648271949761872*o[5] + o[16]*((7.84432987285086e-7 +
-       o[37])*o[46] + o[19]*(8.37522759179568e-15*o[45] +
-       o[15]*(-2.2710673659818e-16*o[43] +
-       o[20]*(-8.12616878987203e-19*o[28] + pi1*(4.05382836177609e-19*o[26]
-       + pi1*(-6.78085118428229e-20*o[24] +
-       3.80434041435885e-21*o[42]*pi1)))))))));
-
-       g.gpitautau :=  o[36]*(-0.0254871721114236 + o[1]*(0.0339955288768894 +
-       (0.037980136436838 + 0.00031703014781958*o[2])*o[6])) +
-       pi1*(o[12]*(0.0113242370575841 + o[6]*(0.0000529702143970152 +
-       3.95460779858911e-13*o[9])) + pi1*((0.00190077869070324 +
-        7.66846153080927e-8*o[38])*o[40] + pi1*(o[49]*(0.000269103382896 +
-        (0.0000156410934949442 + 5.16302277765264e-11*o[13])*o[7]) +
-        pi1*(0.000145861188696421*o[39] + o[16]*((1.34474226391729e-6 +
-        o[37])*o[55] + o[19]*(1.25628413876935e-14*o[32] +
-        o[15]*(-3.30337071415535e-16*o[53] +
-        o[20]*(-1.1318592243036e-18*o[26] + pi1*(5.59148739555323e-19*o[24]
-        + pi1*(-9.26716328518579e-20*o[42] +5.1542676581636e-21*o[51]*pi1))))))))));
-    end g1L3;
-
-    function g2L3
-      "base function for region 2 with 3rd derivatives for sensitivities: g(p,T)"
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      output ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd
-                                                      g
-        "dimensionless Gibbs function and derivatives up to 3rd derivatives";
-    protected
-      Real pi2;
-      Real tau2;
-      Real[82] o;
-    algorithm
-      assert(p > ThermoSysPro.Properties.WaterSteam.BaseIF97.triple.ptriple,
-        "IF97 medium function g2 called with too low pressure\n" + "p = " +
-        String(p) + " Pa <= " + String(ThermoSysPro.Properties.WaterSteam.BaseIF97.triple.ptriple)
-         + " Pa (triple point pressure)");
-      assert(p <= 100.0e6,
-        "IF97 medium function g2: the input pressure (= " + String(p) + " Pa) is higher than 100 Mpa");
-      assert(T >= 273.15,
-        "IF97 medium function g2: the temperature (= " + String(T) + " K) is lower than 273.15 K!");
-      assert(T <= 1073.15,
-        "IF97 medium function g2: the input temperature (= " + String(T) + " K) is higher than the limit of 1073.15 K");
-      g.p := p;
-      g.T := T;
-      g.R := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
-      g.pi := p/ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PSTAR2;
-      g.tau := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TSTAR2/T;
-      tau2 := -0.5 + g.tau;
-      o[1] := tau2*tau2;
-      o[2] := o[1]*tau2;
-      o[3] := -0.05032527872793*o[2];
-      o[4] := -0.057581259083432 + o[3];
-      o[5] := o[4]*tau2;
-      o[6] := -0.045996013696365 + o[5];
-      o[7] := o[6]*tau2;
-      o[8] := -0.017834862292358 + o[7];
-      o[9] := o[8]*tau2;
-      o[10] := o[1]*o[1];
-      o[11] := o[10]*o[10];
-      o[12] := o[11]*o[11];
-      o[13] := o[10]*o[11]*o[12]*tau2;
-      o[14] := o[1]*o[10]*tau2;
-      o[15] := o[10]*o[11]*tau2;
-      o[16] := o[1]*o[12]*tau2;
-      o[17] := o[1]*o[11]*tau2;
-      o[18] := o[1]*o[10]*o[11];
-      o[19] := o[10]*o[11]*o[12];
-      o[20] := o[1]*o[10];
-      o[21] := g.pi*g.pi;
-      o[22] := o[21]*o[21];
-      o[23] := o[21]*o[22];
-      o[24] := o[10]*o[12]*tau2;
-      o[25] := o[12]*o[12];
-       o[26] := o[11]*o[12]*o[25]*tau2;
-       o[27] := o[10]*o[12];
-       o[28] := o[1]*o[10]*o[11]*tau2;
-       o[29] := o[10]*o[12]*o[25]*tau2;
-       o[30] := o[1]*o[10]*o[25]*tau2;
-       o[31] := o[1]*o[11]*o[12];
-       o[32] := o[1]*o[12];
-       o[33] := g.tau*g.tau;
-       o[34] := o[33]*o[33];
-       o[35] := -0.000053349095828174*o[13];
-       o[36] := -0.087594591301146 + o[35];
-       o[37] := o[2]*o[36];
-       o[38] := -0.007878555448671 + o[37];
-       o[39] := o[1]*o[38];
-       o[40] := -0.0003789797503263 + o[39];
-       o[41] := o[40]*tau2;
-       o[42] := -0.000066065283340406 + o[41];
-       o[43] := o[42]*tau2;
-       o[44] := -0.244009521375894*o[13];
-       o[45] := -0.0090203547252888 + o[44];
-       o[46] := o[2]*o[45];
-       o[47] := -0.00019366606343142 + o[46];
-       o[48] := o[1]*o[47];
-       o[49] := 2.6322400370661e-6 + o[48];
-       o[50] := o[49]*tau2;
-       o[51] := 5.78704472622084e-6*tau2;
-       o[52] := o[21]*g.pi;
-       o[53] := 0.0000115740894524417*tau2;
-       o[54] := -0.30195167236758*o[2];
-       o[55] := -0.172743777250296 + o[54];
-       o[56] := o[55]*tau2;
-       o[57] := -0.09199202739273 + o[56];
-       o[58] := o[57]*tau2;
-       o[59] := o[1]*o[11];
-       o[60] := o[10]*o[11];
-       o[61] := o[11]*o[12]*o[25];
-       o[62] := o[10]*o[12]*o[25];
-       o[63] := o[1]*o[10]*o[25];
-       o[64] := o[11]*o[12]*tau2;
-       o[65] := -1.5097583618379*o[2];
-       o[66] := -0.345487554500592 + o[65];
-       o[67] := o[66]*tau2;
-       o[68] := o[10]*tau2;
-       o[69] := o[11]*tau2;
-       o[70] := o[1]*o[11]*o[12]*tau2;
-       o[71] := o[1]*o[10]*o[12]*o[25]*tau2;
-       o[72] := o[1]*o[12]*o[25]*tau2;
-       o[73] := o[10]*o[25]*tau2;
-       o[74] := o[11]*o[12];
-       o[75] := o[34]*o[34];
-       o[76] := -0.00192056744981426*o[13];
-       o[77] := -0.613162139108022 + o[76];
-       o[78] := o[2]*o[77];
-       o[79] := -0.031514221794684 + o[78];
-       o[80] := o[1]*o[79];
-       o[81] := -0.0007579595006526 + o[80];
-       o[82] := o[81]*tau2;
-
-      g.g := g.pi*(-0.0017731742473213 + o[9] + g.pi*(tau2*(-0.000033032641670203
-         + (-0.00018948987516315 + o[1]*(-0.0039392777243355 + (-0.043797295650573
-         - 0.000026674547914087*o[13])*o[2]))*tau2) + g.pi*(2.0481737692309e-8
-         + (4.3870667284435e-7 + o[1]*(-0.00003227767723857 + (-0.0015033924542148
-         - 0.040668253562649*o[13])*o[2]))*tau2 + g.pi*(g.pi*(
-        2.2922076337661e-6*o[14] + g.pi*((-1.6714766451061e-11 + o[15]*(-0.0021171472321355
-         - 23.895741934104*o[16]))*o[2] + g.pi*(-5.905956432427e-18 + o[17]*(-1.2621808899101e-6
-         - 0.038946842435739*o[18]) + g.pi*(o[11]*(1.1256211360459e-11 -
-        8.2311340897998*o[19]) + g.pi*(1.9809712802088e-8*o[15] + g.pi*(o[10]*(
-        1.0406965210174e-19 + (-1.0234747095929e-13 - 1.0018179379511e-9*o[10])
-        *o[20]) + o[23]*(o[13]*(-8.0882908646985e-11 + 0.10693031879409*o[24])
-         + o[21]*(-0.33662250574171*o[26] + o[21]*(o[27]*(8.9185845355421e-25
-         + (3.0629316876232e-13 - 4.2002467698208e-6*o[15])*o[28]) + g.pi*(-5.9056029685639e-26
-        *o[24] + g.pi*(3.7826947613457e-6*o[29] + g.pi*(-1.2768608934681e-15*o[
-        30] + o[31]*(7.3087610595061e-29 + o[18]*(5.5414715350778e-17 -
-        9.436970724121e-7*o[32]))*g.pi)))))))))))) + tau2*(-7.8847309559367e-10
-         + (1.2790717852285e-8 + 4.8225372718507e-7*tau2)*tau2))))) + (-0.00560879118302
-         + g.tau*(0.07145273881455 + g.tau*(-0.4071049823928 + g.tau*(
-        1.424081971444 + g.tau*(-4.38395111945 + g.tau*(-9.692768600217 + g.tau
-        *(10.08665568018 + (-0.2840863260772 + 0.02126846353307*g.tau)*g.tau)
-         + Modelica.Math.log(g.pi)))))))/(o[34]*g.tau);
-
-      g.gpi :=
-        (1.0 + g.pi*(-0.0017731742473213 + o[9] + g.pi*(o[43] +
-           g.pi*(6.1445213076927e-8 + (1.31612001853305e-6 +
-           o[1]*(-0.00009683303171571 +
-           (-0.0045101773626444-0.122004760687947*o[13])*o[2]))*tau2 +
-           g.pi*(g.pi*(0.0000114610381688305*o[14] + g.pi*((-1.00288598706366e-10 +
-           o[15]*(-0.012702883392813-143.374451604624*o[16]))*o[2] +
-           g.pi*(-4.1341695026989e-17 +
-           o[17]*(-8.8352662293707e-6-0.272627897050173*o[18]) +
-           g.pi*(o[11]*(9.0049690883672e-11-65.8490727183984*o[19]) +
-           g.pi*(1.78287415218792e-7*o[15] + g.pi*(o[10]*(1.0406965210174e-18 +
-           (-1.0234747095929e-12-1.0018179379511e-8*o[10])*o[20]) +
-           o[23]*(o[13]*(-1.29412653835176e-9 + 1.71088510070544*o[24]) +
-           o[21]*(-6.05920510335078*o[26] + o[21]*(o[27]*(1.78371690710842e-23 +
-           (6.1258633752464e-12-0.000084004935396416*o[15])*o[28]) +
-           g.pi*(-1.24017662339842e-24*o[24] + g.pi*(0.0000832192847496054*o[29] +
-           g.pi*(-2.93678005497663e-14*o[30] + o[31]*(1.75410265428146e-27 +
-           o[18]*(1.32995316841867e-15-0.0000226487297378904*o[32]))*g.pi))))))))))))
-           + tau2*(-3.15389238237468e-9 + (5.116287140914e-8 +
-           1.92901490874028e-6*tau2)*tau2))))))/g.pi;
-
-      g.gpipi :=
-          (-1.0 + o[21]*(o[43] + g.pi*(1.22890426153854e-7 + o[50] +
-           g.pi*(g.pi*(0.000045844152675322*o[14] + g.pi*((-5.0144299353183e-10 +
-           o[15]*(-0.063514416964065-716.87225802312*o[16]))*o[2] +
-           g.pi*(-2.48050170161934e-16 +
-           o[17]*(-0.0000530115973762242-1.63576738230104*o[18]) +
-           g.pi*(o[11]*(6.30347836185704e-10-460.943509028789*o[19]) +
-           g.pi*(1.42629932175034e-6*o[15] + g.pi*(o[10]*(9.3662686891566e-18 +
-           (-9.2112723863361e-12-9.0163614415599e-8*o[10])*o[20]) +
-           o[23]*(o[13]*(-1.94118980752764e-8 + 25.6632765105816*o[24]) +
-           o[21]*(-103.006486756963*o[26] + o[21]*(o[27]*(3.389062123506e-22 +
-           (1.16391404129682e-10-0.0015960937725319*o[15])*o[28]) +
-           g.pi*(-2.48035324679684e-23*o[24] + g.pi*(0.00174760497974171*o[29] +
-           g.pi*(-6.46091612094859e-13*o[30] + o[31]*(4.03443610484737e-26 +
-           o[18]*(3.05889228736295e-14-0.000520920783971479*o[32]))*g.pi))))))))))))
-           + tau2*(-9.46167714712404e-9 + (1.5348861422742e-7 +
-           o[51])*tau2)))))/o[21];
-
-      g.gpipipi :=
-            (2.0 + o[52]*(1.22890426153854e-7 + o[50] +
-           g.pi*(g.pi*(0.000137532458025966*o[14] + g.pi*((-2.00577197412732e-9 +
-           o[15]*(-0.25405766785626-2867.48903209248*o[16]))*o[2] +
-           g.pi*(-1.24025085080967e-15 +
-           o[17]*(-0.000265057986881121-8.17883691150519*o[18]) +
-           g.pi*(o[11]*(3.78208701711422e-9-2765.66105417273*o[19]) +
-           g.pi*(9.98409525225235e-6*o[15] + g.pi*(o[10]*(7.49301495132528e-17 +
-           (-7.36901790906888e-11-7.21308915324792e-7*o[10])*o[20]) +
-           o[23]*(o[13]*(-2.7176657305387e-7 + 359.285871148142*o[24]) +
-           o[21]*(-1648.10378811141*o[26] + o[21]*(o[27]*(6.1003118223108e-21 +
-           (2.09504527433427e-9-0.0287296879055743*o[15])*o[28]) +
-           g.pi*(-4.71267116891399e-22*o[24] + g.pi*(0.0349520995948343*o[29] +
-           g.pi*(-1.3567923853992e-11*o[30] + o[31]*(8.87575943066421e-25 +
-           o[18]*(6.72956303219848e-13-0.0114602572473725*o[32]))*g.pi))))))))))))
-           + tau2*(-1.89233542942481e-8 + (3.0697722845484e-7 +
-           o[53])*tau2))))/o[52];
-
-      g.gtau :=
-         (0.0280439559151 + g.tau*(-0.2858109552582 +
-           g.tau*(1.2213149471784 + g.tau*(-2.848163942888 + g.tau*(4.38395111945 +
-           o[33]*(10.08665568018 + (-0.5681726521544 +
-           0.06380539059921*g.tau)*g.tau))))))/(o[33]*o[34]) + g.pi*(-0.017834862292358
-           + o[58] + g.pi*(-0.000033032641670203 + (-0.0003789797503263 +
-           o[1]*(-0.015757110897342 +
-           (-0.306581069554011-0.000960283724907132*o[13])*o[2]))*tau2 +
-           g.pi*(4.3870667284435e-7 + o[1]*(-0.00009683303171571 +
-           (-0.0090203547252888-1.42338887469272*o[13])*o[2]) +
-           g.pi*(-7.8847309559367e-10 + g.pi*(0.0000160454534363627*o[20] +
-           g.pi*(o[1]*(-5.0144299353183e-11 +
-           o[15]*(-0.033874355714168-836.35096769364*o[16])) +
-           g.pi*((-0.0000138839897890111-0.973671060893475*o[18])*o[59] +
-           g.pi*(o[14]*(9.0049690883672e-11-296.320827232793*o[19]) +
-           g.pi*(2.57526266427144e-7*o[60] + g.pi*(o[2]*(4.1627860840696e-19 +
-           (-1.0234747095929e-12-1.40254511313154e-8*o[10])*o[20]) +
-           o[23]*(o[19]*(-2.34560435076256e-9 + 5.3465159397045*o[24]) +
-           o[21]*(-19.1874828272775*o[61] + o[21]*(o[16]*(1.78371690710842e-23 +
-           (1.07202609066812e-11-0.000201611844951398*o[15])*o[28]) +
-           g.pi*(-1.24017662339842e-24*o[27] + g.pi*(0.000200482822351322*o[62] +
-           g.pi*(-4.97975748452559e-14*o[63] + (1.90027787547159e-27 +
-           o[18]*(2.21658861403112e-15-0.0000547344301999018*o[32]))*o[64]*g.pi))))))))))))
-           + (2.558143570457e-8 + 1.44676118155521e-6*tau2)*tau2))));
-
-      g.gtautau :=
-            (-0.1682637354906 + g.tau*(1.429054776291 +
-           g.tau*(-4.8852597887136 + g.tau*(8.544491828664 + g.tau*(-8.7679022389 +
-           o[33]*(-0.5681726521544 +
-           0.12761078119842*g.tau)*g.tau)))))/(o[33]*o[34]*g.tau) +
-           g.pi*(-0.09199202739273 + o[67] + g.pi*(-0.0003789797503263 +
-           o[1]*(-0.047271332692026 +
-           (-1.83948641732407-0.0336099303717496*o[13])*o[2]) +
-           g.pi*((-0.00019366606343142 +
-           (-0.045101773626444-48.3952217395523*o[13])*o[2])*tau2 +
-           g.pi*(2.558143570457e-8 + 2.89352236311042e-6*tau2 +
-           g.pi*(0.0000962727206181762*o[68] +
-           g.pi*(g.pi*((-0.000138839897890111-23.3681054614434*o[18])*o[69] +
-           g.pi*((6.30347836185704e-10-10371.2289531477*o[19])*o[20] +
-           g.pi*(3.09031519712573e-6*o[17] + g.pi*(o[1]*(1.24883582522088e-18 +
-           (-9.2112723863361e-12-1.823308647071e-7*o[10])*o[20]) +
-           o[23]*((-6.56769218213518e-8 + 261.979281045521*o[24])*o[70] +
-           o[21]*(-1074.49903832754*o[71] + o[21]*((3.389062123506e-22 +
-           (3.64488870827161e-10-0.00947575671271573*o[15])*o[28])*o[32] +
-    g.pi*(-2.48035324679684e-23*o[16] + g.pi*(0.0104251067622687*o[72] +
-    g.pi*(-1.89230784411972e-12*o[73] + (4.75069468867897e-26 +
-    o[18]*(8.64469559472137e-14-0.0031198625213944*o[32]))*o[74]*g.pi))))))))))
-    + (-1.00288598706366e-10 +
-    o[15]*(-0.50811533571252-28435.9329015838*o[16]))*tau2))))));
-
-      g.gtautautau :=
-               (1.1778461484342 + g.tau*(-8.574328657746 + g.tau*(24.426298943568
-           + g.tau*(-34.177967314656 + (26.3037067167 +
-           0.12761078119842*o[34])*g.tau))))/o[75] +
-           g.pi*(-0.345487554500592-6.0390334473516*o[2] + g.pi*((-0.094542665384052
-           + (-9.19743208662033-1.14273763263949*o[13])*o[2])*tau2 +
-           g.pi*(-0.00019366606343142 +
-           (-0.180407094505776-1597.04231740523*o[13])*o[2] +
-           g.pi*(2.89352236311042e-6 + g.pi*(0.000481363603090881*o[10] +
-           g.pi*(-1.00288598706366e-10 +
-           o[15]*(-7.11361469997528-938385.785752264*o[16]) +
-           g.pi*(o[11]*(-0.001249559081011-537.466425613198*o[18]) +
-           g.pi*((3.78208701711422e-9-352621.784407023*o[19])*o[68] +
-           g.pi*(0.000033993467168383*o[59] + g.pi*((2.49767165044176e-18 +
-           (-7.36901790906888e-11-2.1879703764852e-6*o[10])*o[20])*tau2 +
-           o[23]*((-1.7732768891765e-6 + 12575.005490185*o[24])*o[31] +
-           o[21]*(-59097.4471080146*o[1]*o[10]*o[12]*o[25] +
-           o[21]*(o[12]*(6.1003118223108e-21 +
-           (1.20281327372963e-8-0.435884808784923*o[15])*o[28])*tau2 +
-    g.pi*(-4.71267116891399e-22*o[32] +
-    g.pi*(0.531680444875706*o[1]*o[12]*o[25] +
-    g.pi*(-7.00153902324298e-11*o[10]*o[25] +
-    o[1]*o[10]*o[12]*(1.14016672528295e-24 +
-    o[18]*(3.28498432599412e-12-0.174712301198087*o[32]))*g.pi*tau2))))))))))))))));
-
-      g.gpitau := -0.017834862292358 + o[58] + g.pi*
-                                             (-0.000066065283340406 + o[82]
-           + g.pi*(1.31612001853305e-6 + o[1]*(-0.00029049909514713 +
-           (-0.0270610641758664-4.27016662407815*o[13])*o[2]) +
-           g.pi*(-3.15389238237468e-9 + g.pi*(0.0000802272671818135*o[20] +
-           g.pi*(o[1]*(-3.00865796119098e-10 +
-           o[15]*(-0.203246134285008-5018.10580616184*o[16])) +
-           g.pi*((-0.0000971879285230777-6.81569742625432*o[18])*o[59] +
-           g.pi*(o[14]*(7.20397527069376e-10-2370.56661786234*o[19]) +
-           g.pi*(2.3177363978443e-6*o[60] + g.pi*(o[2]*(4.1627860840696e-18 +
-           (-1.0234747095929e-11-1.40254511313154e-7*o[10])*o[20]) +
-           o[23]*(o[19]*(-3.7529669612201e-8 + 85.544255035272*o[24]) +
-           o[21]*(-345.374690890994*o[61] + o[21]*(o[16]*(3.56743381421684e-22 +
-           (2.14405218133624e-10-0.00403223689902797*o[15])*o[28]) +
-           g.pi*(-2.60437090913668e-23*o[27] + g.pi*(0.00441062209172909*o[62] +
-           g.pi*(-1.14534422144089e-12*o[63] + (4.56066690113181e-26 +
-           o[18]*(5.31981267367469e-14-0.00131362632479764*o[32]))*o[64]*g.pi))))))))))))
-           + (1.0232574281828e-7 + o[51])*tau2)));
-
-      g.gpipitau := -0.000066065283340406 + o[82] + g.pi*
-                                                  (2.6322400370661e-6 +
-           o[1]*(-0.00058099819029426 +
-           (-0.0541221283517328-8.54033324815629*o[13])*o[2]) +
-           g.pi*(-9.46167714712404e-9 + g.pi*(0.000320909068727254*o[20] +
-           g.pi*(o[1]*(-1.50432898059549e-9 +
-           o[15]*(-1.01623067142504-25090.5290308092*o[16])) +
-           g.pi*((-0.000583127571138466-40.8941845575259*o[18])*o[59] +
-           g.pi*(o[14]*(5.04278268948563e-9-16593.9663250364*o[19]) +
-           g.pi*(0.0000185418911827544*o[60] + g.pi*(o[2]*(3.74650747566264e-17 +
-           (-9.2112723863361e-11-1.26229060181839e-6*o[10])*o[20]) +
-           o[23]*(o[19]*(-5.62945044183016e-7 + 1283.16382552908*o[24]) +
-           o[21]*(-5871.36974514691*o[61] + o[21]*(o[16]*(6.778124247012e-21 +
-           (4.07369914453886e-9-0.0766125010815314*o[15])*o[28]) +
-           g.pi*(-5.20874181827336e-22*o[27] + g.pi*(0.0926230639263108*o[62] +
-           g.pi*(-2.51975728716995e-11*o[63] + (1.04895338726032e-24 +
-           o[18]*(1.22355691494518e-12-0.0302134054703458*o[32]))*o[64]*g.pi))))))))))))
-           + (3.0697722845484e-7 + 0.0000173611341786625*tau2)*tau2));
-
-      g.gpitautau := -0.09199202739273 + o[67] + g.pi*
-                                               (-0.0007579595006526 +
-    o[1]*(-0.094542665384052 +
-    (-3.67897283464813-0.0672198607434992*o[13])*o[2]) +
-    g.pi*((-0.00058099819029426 +
-    (-0.135305320879332-145.185665218657*o[13])*o[2])*tau2 +
-    g.pi*(1.0232574281828e-7 + o[53] + g.pi*(0.000481363603090881*o[68] +
-    g.pi*(g.pi*((-0.000971879285230777-163.576738230104*o[18])*o[69] +
-    g.pi*((5.04278268948563e-9-82969.831625182*o[19])*o[20] +
-    g.pi*(0.0000278128367741315*o[17] + g.pi*(o[1]*(1.24883582522088e-17 +
-    (-9.2112723863361e-11-1.823308647071e-6*o[10])*o[20]) +
-    o[23]*((-1.05083074914163e-6 + 4191.66849672833*o[24])*o[70] +
-    o[21]*(-19340.9826898957*o[71] + o[21]*((6.778124247012e-21 +
-    (7.28977741654322e-9-0.189515134254314*o[15])*o[28])*o[32] +
-    g.pi*(-5.20874181827336e-22*o[16] + g.pi*(0.229352348769913*o[72] +
-    g.pi*(-4.35230804147537e-11*o[73] + (1.14016672528295e-24 +
-    o[18]*(2.07472694273313e-12-0.0748767005134657*o[32]))*o[74]*g.pi)))))))))) +
-     (-6.01731592238196e-10 + o[15]*(-3.04869201427512 - 170615.597409503*o[16]))
-                                                 *tau2)))));
-    end g2L3;
-
-    function f3L3
-      "Helmholtz function for region 3: f(d,T), including 3rd derivatives"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      output ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd
-                                                          f
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-    protected
-      Real tau "dimensionless temperature";
-      Real del "dimensionless density";
-      Real[62] o "vector of auxiliary variables";
-    algorithm
-      f.T := T;
-      f.d := d;
-      f.R := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
-      tau := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TCRIT/T;
-      del := if (d == ThermoSysPro.Properties.WaterSteam.BaseIF97.data.DCRIT and
-        T == ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TCRIT) then 1 -
-        Modelica.Constants.eps else abs(d/ThermoSysPro.Properties.WaterSteam.BaseIF97.data.DCRIT);
-      f.tau := tau;
-      f.delta := del;
-      o[1] := tau*tau;
-      o[2] := o[1]*o[1];
-      o[3] := o[2]*tau;
-      o[4] := o[1]*tau;
-      o[5] := o[2]*o[2];
-      o[6] := o[1]*o[5]*tau;
-      o[7] := o[5]*tau;
-      o[8] := -0.64207765181607*o[1];
-      o[9] := 0.88521043984318 + o[8];
-      o[10] := o[7]*o[9];
-      o[11] := -1.1524407806681 + o[10];
-      o[12] := o[11]*o[2];
-      o[13] := -1.2654315477714 + o[12];
-      o[14] := o[1]*o[13];
-      o[15] := o[1]*o[2]*o[5]*tau;
-      o[16] := o[2]*o[5];
-      o[17] := o[1]*o[5];
-      o[18] := o[5]*o[5];
-      o[19] := o[1]*o[18]*o[2];
-      o[20] := o[1]*o[18]*o[2]*tau;
-      o[21] := o[18]*o[5];
-      o[22] := o[1]*o[18]*o[5];
-      o[23] := 0.25116816848616*o[2];
-      o[24] := 0.078841073758308 + o[23];
-      o[25] := o[15]*o[24];
-      o[26] := -6.100523451393 + o[25];
-      o[27] := o[26]*tau;
-      o[28] := 9.7944563083754 + o[27];
-      o[29] := o[2]*o[28];
-      o[30] := -1.70429417648412 + o[29];
-      o[31] := o[1]*o[30];
-      o[32] := del*del;
-      o[33] := -2.85576214409538*o[17];
-      o[34] := -0.0492885823043778 + o[33];
-      o[35] := o[16]*o[34];
-      o[36] := -12.113949014142 + o[35];
-      o[37] := o[1]*o[36];
-      o[38] := 8.339879741676 + o[37];
-      o[39] := o[1]*o[38];
-      o[40] := del*o[32];
-      o[41] := -10.9153200808732*o[1];
-      o[42] := 13.2781565976477 + o[41];
-      o[43] := o[42]*o[7];
-      o[44] := -6.9146446840086 + o[43];
-      o[45] := o[2]*o[44];
-      o[46] := -2.5308630955428 + o[45];
-      o[47] := o[46]*tau;
-      o[48] := o[18]*o[5]*tau;
-      o[49] := -174.645121293971*o[1];
-      o[50] := 185.894192367068 + o[49];
-      o[51] := o[50]*o[7];
-      o[52] := -34.573223420043 + o[51];
-      o[53] := o[2]*o[52];
-      o[54] := 6.53037238064016*o[2];
-      o[55] := 1.73450362268278 + o[54];
-      o[56] := o[15]*o[55];
-      o[57] := -42.703664159751 + o[56];
-      o[58] := o[57]*tau;
-      o[59] := 58.7667378502524 + o[58];
-      o[60] := o[2]*o[59];
-      o[61] := -3.40858835296824 + o[60];
-      o[62] := o[61]*tau;
-
-      f.f := -15.732845290239 + tau*(20.944396974307 + (-7.6867707878716 + o[3]
-        *(2.6185947787954 + o[4]*(-2.808078114862 + o[1]*(1.2053369696517 -
-        0.0084566812812502*o[6]))))*tau) + del*(o[14] + del*(0.38493460186671
-         + o[1]*(-0.85214708824206 + o[2]*(4.8972281541877 + (-3.0502617256965
-         + o[15]*(0.039420536879154 + 0.12558408424308*o[2]))*tau)) + del*(-0.2799932969871
-         + o[1]*(1.389979956946 + o[1]*(-2.018991502357 + o[16]*(-0.0082147637173963
-         - 0.47596035734923*o[17]))) + del*(0.0439840744735 + o[1]*(-0.44476435428739
-         + o[1]*(0.90572070719733 + 0.70522450087967*o[19])) + del*(del*(-0.022175400873096
-         + o[1]*(0.094260751665092 + 0.16436278447961*o[21]) + del*(-0.013503372241348
-        *o[1] + del*(-0.014834345352472*o[22] + del*(o[1]*(0.00057922953628084
-         + 0.0032308904703711*o[21]) + del*(0.000080964802996215 -
-        0.000044923899061815*del*o[22] - 0.00016557679795037*tau))))) + (
-        0.10770512626332 + o[1]*(-0.32913623258954 - 0.50871062041158*o[20]))*
-        tau))))) + 1.0658070028513*Modelica.Math.log(del);
-
-      f.fdelta := (1.0658070028513 + del*
-                    (o[14] + del*(0.76986920373342 + o[31] + del*(-0.8399798909613+ o[1]*(
-        4.169939870838 + o[1]*(-6.056974507071 + o[16]*(-0.0246442911521889
-         - 1.42788107204769*o[17])))+del*(0.175936297894+o[1]*(-1.77905741714956
-         + o[1]*(3.62288282878932 + 2.82089800351868*o[19])) + del*   (del*(-0.133052405238576
-         + o[1]*(0.565564509990552 + 0.98617670687766*o[21]) + del*(-0.094523605689436*o[1] + del*
-        (-0.118674762819776*o[22] + del*(o[1]*(0.00521306582652756 + 0.0290780142333399*o[21])
-         + del*(0.00080964802996215 - 0.000494162889679965*del*o[22] -
-        0.0016557679795037*tau)))))+(0.5385256313166+o[1]*(-1.6456811629477-2.5435531020579*o[20]))*tau))))))/del;
-
-      f.fdeltadelta := (-1.0658070028513 + o[32]*
-                       (0.76986920373342 + o[31] + del*
-                                                   (-1.6799597819226 + o[39]
-         + del*(0.527808893682 + o[1]*(-5.33717225144868 + o[1]*(
-        10.868648486368 + 8.46269401055604*o[19])) + del*(del*
-        (-0.66526202619288 + o[1]*(2.82782254995276 + 4.9308835343883*o[21])
-         + del*                                                              (-0.567141634136616
-        *o[1] + del*
-        (-0.830723339738432*o[22] + del*
-                                      (o[1]*(0.0417045266122205 +
-        0.232624113866719*o[21]) + del*(0.00728683226965935 -
-        0.00494162889679965*del*o[22] - 0.0149019118155333*tau)))))          +(
-        2.1541025252664 + o[1]*(-6.5827246517908 - 10.1742124082316*o[20]))*
-        tau)))))                                                        /o[32];
-
-      f.fdeltadeltadelta :=
-                     (2.1316140057026 + o[40]*
-                                            (-1.6799597819226 + o[39] + del*
-                                                                        (
-        1.055617787364 + o[1]*                                                               (-10.6743445028974
-         + o[1]*(21.7372969727359 + 16.9253880211121*o[19]))
-                                         +del*(del*(-2.66104810477152+o[1]*(11.311290199811+19.7235341375532*o[21])
-     +del*(-2.83570817068308*o[1]+del*(-4.98434003843059*o[22]+del*(o[1]*(0.291931686285543+1.62836879706703*o[21])
-     +del*(0.0582946581572748-0.0444746600711968*del*o[22]-0.119215294524266*tau)))))+(6.4623075757992+o[1]*(-19.7481739553724
-         - 30.5226372246948*o[20]))       *tau))))/o[40];
-
-      f.ftau := 20.944396974307 +
-                         (-15.3735415757432 + o[3]*
-                                                 (18.3301634515678 + o[4]*
-                                                                        (-28.08078114862
-         + o[1]*(14.4640436358204 - 0.194503669468755*o[6]))))
-                                           *tau+del*(o[47]+del*(tau*(-1.70429417648412+o[2]*
-    (29.3833689251262 + (-21.3518320798755 + o[15]*(0.867251811341388 +
-        3.26518619032008*o[2]))*tau))
-    +del*((2.779959913892+o[1]*(-8.075966009428+o[16]*(-0.131436219478341-12.37496929108
-        *o[17])))     *tau+del*((-0.88952870857478+o[1]*(3.62288282878932+18.3358370228714*o[19]))*tau + del*
-       (0.10770512626332 + o[1]*(-0.98740869776862 - 13.2264761307011*o[20])
-         + del*                                                              ((
-        0.188521503330184 + 4.27343239646986*o[21])
-                      *tau+del*(-0.027006744482696*tau+del*(-0.385692979164272*o[48]+del*(del*(-0.00016557679795037
-         - 0.00116802137560719*del*o[48]) + (0.00115845907256168 +
-        0.0840031522296486*o[21])*tau)))))))));
-
-      f.ftautau := -15.3735415757432 + o[3]*
-                                   (109.980980709407 + o[4]*
-                                                          (-252.72703033758
-         + o[1]*(159.104479994024 - 4.2790807283126*o[6])))
-                                        +del*(-2.5308630955428+o[53]+del*(-1.70429417648412+o[2]*(
-        146.916844625631 + (-128.110992479253 + o[15]*(18.2122880381691 +
-        81.629654758002*o[2]))*tau) + del*(2.779959913892 + o[1]*(-24.227898028284
-         + o[16]*(-1.97154329217511 - 309.374232277*o[17])) + del*(-0.88952870857478
-         + o[1]*(10.868648486368 + 458.395925571786*o[19]) + del*   (del*(
-        0.188521503330184 + 106.835809911746*o[21] + del*
-                          (-0.027006744482696 + del*
-                                                  (-9.6423244791068*o[21] +
-        del*                                                                  (
-        0.00115845907256168 + 2.10007880574121*o[21] - 0.0292005343901797*o[
-        21]*o[32]))))                                   +(-1.97481739553724-330.661903267527*o[20])*tau)))));
-
-      f.ftautautau := o[2]*(549.904903547034 + o[4]*(-2021.81624270064 + o[1]*(1591.04479994024 -
-        89.8606952945646*o[6]))) + del*
-    (o[4]*(-138.292893680172 + (2416.62450077188 - 2619.67681940957*o[1])*o[7])
-         + del*                                                                 (o[4]*(
-        587.667378502524 + (-640.554962396265 + o[15]*(364.245760763383 +
-        1959.11171419205*o[2]))*tau) + del*((-48.455796056568 + o[16]*(-27.6016060904516
-         - 7424.98157464799*o[17]))*tau + del*                                  (del*(-1.97481739553724
-         - 7935.88567842065*o[20] + del*     (2564.05943788192*o[20] + o[32]*
-                                                                           (-231.415787498563
-        *o[20] + del*(50.4018913377892*o[20] - 0.700812825364314*o[20]*o[32]))))
-                                                                  +(21.7372969727359+
-        11001.5022137229*o[19])
-                      *tau))));
-
-      f.fdeltatau := o[47] + del*
-                        (o[62] + del*
-                                   ((8.339879741676 + o[1]*
-                                                         (-24.227898028284 +
-        o[16]*(-0.394308658435022 - 37.1249078732399*o[17])))
-                                            *tau+del*((-3.55811483429912+o[1]*(
-        14.4915313151573 + 73.3433480914857*o[19]))
-                                         *tau+del*(0.5385256313166+o[1]*(-4.9370434888431
-         - 66.1323806535054*o[20]) + del*    ((1.1311290199811 +
-        25.6405943788192*o[21])
-     *tau+del*(-0.189047211378872*tau+del*(-3.08554383331418*o[48]+del*(del*(-0.0016557679795037
-         - 0.0128482351316791*del*o[48]) + (0.0104261316530551 +
-        0.756028370066837*o[21])*tau))))))));
-
-      f.fdeltatautau := -2.5308630955428 + o[53] + del*
-                                           (-3.40858835296824 + o[2]*
-                                                                   (
-        293.833689251262 + (-256.221984958506 + o[15]*(36.4245760763383 +
-        163.259309516004*o[2]))*tau)                                  +del*(8.339879741676+o[1]*(-72.683694084852
-         + o[16]*(-5.91462987652534 - 928.122696830999*o[17])) + del*       (-3.55811483429912
-         + o[1]*(43.4745939454718 + 1833.58370228714*o[19]) + del*
-                                                  (del*(1.1311290199811 +
-        641.014859470479*o[21] + del*
-    (-0.189047211378872 + del*
-                            (-77.1385958328544*o[21] + del*
-                                                         (0.0104261316530551
-         + 18.9007092516709*o[21] - 0.321205878291977*o[21]*o[32]))))
-                                      +(-9.8740869776862-1653.30951633764*o[20])*tau))));
-
-      f.fdeltadeltatau := o[62] + del*
-                            ((16.679759483352 + o[1]*
-                                                   (-48.455796056568 + o[16]*
-                                                                           (-0.788617316870045
-         - 74.2498157464799*o[17])))
-                        *tau+del*((-10.6743445028974+o[1]*(43.4745939454718+
-        220.030044274457*o[19]))
-                       *tau+del*(2.1541025252664+o[1]*(-19.7481739553724-264.529522614022*o[20])
-     +del*((5.65564509990552+128.202971894096*o[21])*tau+del*(-1.13428326827323*tau+del*(-21.5988068331992
-        *o[48] + del*       (del*(-0.0149019118155333 - 0.128482351316791*del
-        *o[48]) + (0.0834090532244409 + 6.0482269605347*o[21])*tau)))))));
-    end f3L3;
-
-    function g5L3
-      "base function for region 5: g(p,T), including 3rd derivatives"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      output ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd
-                                                      g
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-    protected
-      Real tau "dimensionless temperature";
-      Real pi "dimensionless pressure";
-      Real[16] o "vector of auxiliary variables";
-    algorithm
-      assert(p > ThermoSysPro.Properties.WaterSteam.BaseIF97.triple.ptriple,
-        "IF97 medium function g5 called with too low pressure\n" + "p = " +
-        String(p) + " Pa <= " + String(ThermoSysPro.Properties.WaterSteam.BaseIF97.triple.ptriple)
-         + " Pa (triple point pressure)");
-      assert(p <= ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PLIMIT5,
-        "IF97 medium function g5: input pressure (= " + String(p) +
-        " Pa) is higher than 10 Mpa in region 5");
-      assert(T <= 2273.15,
-        "IF97 medium function g5: input temperature (= " + String(T) + " K) is higher than limit of 2273.15K in region 5");
-      g.p := p;
-      g.T := T;
-      g.R := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
-      pi := p/ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PSTAR5;
-      tau := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TSTAR5/T;
-      g.pi := pi;
-      g.tau := tau;
-      o[1] := tau*tau;
-      o[2] := -0.004594282089991*o[1];
-      o[3] := 0.0021774678714571 + o[2];
-      o[4] := o[3]*tau;
-      o[5] := o[1]*tau;
-      o[6] := o[1]*o[1];
-      o[7] := o[6]*o[6];
-      o[8] := o[7]*tau;
-      o[9] := -7.9449656719138e-6*o[8];
-      o[10] := pi*pi;
-      o[11] := o[10]*pi;
-      o[12] := -0.013782846269973*o[1];
-      o[13] := -0.027565692539946*tau;
-      o[14] := o[1]*o[6]*tau;
-      o[15] := o[1]*o[6];
-      o[16] := -0.0000715046910472242*o[7];
-      g.g := pi*(-0.00012563183589592 + o[4] + pi*(-3.9724828359569e-6*o[8] +
-        1.2919228289784e-7*o[5]*pi)) + (-0.024805148933466 + tau*(
-        0.36901534980333 + tau*(-3.1161318213925 + tau*(-13.179983674201 + (
-        6.8540841634434 - 0.32961626538917*tau)*tau + Modelica.Math.log(pi)))))
-        /o[5];
-      g.gpi := (1.0 + pi*(-0.00012563183589592 + o[4] + pi*(o[9] +
-        3.8757684869352e-7*o[5]*pi)))/pi;
-      g.gpipi := (-1.0 + o[10]*(o[9] + 7.7515369738704e-7*o[5]*pi))/o[10];
-      g.gpipipi := (2.0 + 7.7515369738704e-7*o[11]*o[5])/o[11];
-      g.gtau := pi*(0.0021774678714571 + o[12] + pi*(-0.0000357523455236121*o[7] +
-        3.8757684869352e-7*o[1]*pi)) + (0.074415446800398 + tau*(-0.73803069960666
-         + (3.1161318213925 + o[1]*(6.8540841634434 - 0.65923253077834*tau))*tau))/
-        o[6];
-      g.gtautau := (-0.297661787201592 + tau*(2.21409209881998 + (-6.232263642785
-         - 0.65923253077834*o[5])*tau))/(o[6]*tau) + pi*(o[13] + pi*(-0.000286018764188897
-        *o[14] + 7.7515369738704e-7*pi*tau));
-      g.gtautautau := pi*(-0.027565692539946 + (-0.00200213134932228*o[15] +
-        7.7515369738704e-7*pi)*pi) + (1.48830893600796 + tau*(-8.85636839527992 +
-        18.696790928355*tau))/o[15];
-      g.gpitau := 0.0021774678714571 + o[12] + pi*(o[16] + 1.16273054608056e-6*o[1]
-        *pi);
-      g.gpipitau := o[16] + 2.32546109216112e-6*o[1]*pi;
-      g.gpitautau := o[13] + pi*(-0.000572037528377794*o[14] + 2.32546109216112e-6*
-        pi*tau);
-    end g5L3;
-    annotation (Documentation(info="<HTML><h4>Package description</h4>
+ </html>"));
+    end v3b_ps;
+
+    function g1L3 "base function for region 1 with 3rd derivatives for sensitivities: g(p,T)"
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      output ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd g "dimensionless Gibbs function and derivatives up to 3rd derivatives";
+    protected
+      Real pi1;
+      Real tau1;
+      Real[55] o;
+    algorithm
+      assert(p > ThermoSysPro.Properties.WaterSteam.BaseIF97.triple.ptriple, "IF97 medium function g1 called with too low pressure\n" + "p = " + String(p) + " Pa <= " + String(ThermoSysPro.Properties.WaterSteam.BaseIF97.triple.ptriple) + " Pa (triple point pressure)");
+      assert(p <= 100.0e6, "IF97 medium function g1: the input pressure (= " + String(p) + " Pa) is higher than 100 Mpa");
+      assert(T >= 273.15, "IF97 medium function g1: the temperature (= " + String(T) + " K)  is lower than 273.15 K!");
+      g.p := p;
+      g.T := T;
+      g.R := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
+      g.pi := p / ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PSTAR1;
+      g.tau := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TSTAR1 / T;
+      pi1 := 7.1 - g.pi;
+      tau1 := (-1.222) + g.tau;
+      o[1] := tau1 * tau1;
+      o[2] := o[1] * o[1];
+      o[3] := o[2] * o[2];
+      o[4] := o[3] * tau1;
+      o[5] := 1 / o[4];
+      o[6] := o[1] * o[2];
+      o[7] := o[1] * tau1;
+      o[8] := 1 / o[7];
+      o[9] := o[1] * o[2] * o[3];
+      o[10] := 1 / o[2];
+      o[11] := o[2] * tau1;
+      o[12] := 1 / o[11];
+      o[13] := o[2] * o[3];
+      o[14] := 1 / o[3];
+      o[15] := pi1 * pi1;
+      o[16] := o[15] * pi1;
+      o[17] := o[15] * o[15];
+      o[18] := o[17] * o[17];
+      o[19] := o[17] * o[18] * pi1;
+      o[20] := o[15] * o[17];
+      o[21] := o[3] * o[3];
+      o[22] := o[21] * o[21];
+      o[23] := o[22] * o[3] * tau1;
+      o[24] := 1 / o[23];
+      o[25] := o[22] * o[3];
+      o[26] := 1 / o[25];
+      o[27] := o[1] * o[2] * o[22] * tau1;
+      o[28] := 1 / o[27];
+      o[29] := o[1] * o[2] * o[22];
+      o[30] := 1 / o[29];
+      o[31] := o[1] * o[2] * o[21] * o[3] * tau1;
+      o[32] := 1 / o[31];
+      o[33] := o[2] * o[21] * o[3] * tau1;
+      o[34] := 1 / o[33];
+      o[35] := o[1] * o[3] * tau1;
+      o[36] := 1 / o[35];
+      o[37] := 5.85475673349302e-8 * o[11];
+      o[38] := o[1] * o[3];
+      o[39] := 1 / o[38];
+      o[40] := 1 / o[6];
+      o[41] := o[1] * o[22] * o[3];
+      o[42] := 1 / o[41];
+      o[43] := 1 / o[22];
+      o[44] := o[1] * o[2] * o[21] * o[3];
+      o[45] := 1 / o[44];
+      o[46] := 1 / o[13];
+      o[47] := -0.00031703014781958 * o[2];
+      o[48] := o[1] * o[2] * tau1;
+      o[49] := 1 / o[48];
+      o[50] := o[1] * o[22] * o[3] * tau1;
+      o[51] := 1 / o[50];
+      o[52] := o[22] * tau1;
+      o[53] := 1 / o[52];
+      o[54] := o[2] * o[3] * tau1;
+      o[55] := 1 / o[54];
+      g.g := pi1 * (pi1 * (pi1 * (o[10] * ((-0.000031679644845054) + o[2] * ((-2.8270797985312e-6) - 8.5205128120103e-10 * o[6])) + pi1 * (o[12] * ((-2.2425281908e-6) + ((-6.5171222895601e-7) - 1.4341729937924e-13 * o[13]) * o[7]) + pi1 * ((-4.0516996860117e-7 * o[14]) + o[16] * (((-1.2734301741641e-9) - 1.7424871230634e-10 * o[11]) * o[36] + o[19] * ((-6.8762131295531e-19 * o[34]) + o[15] * (1.4478307828521e-20 * o[32] + o[20] * (2.6335781662795e-23 * o[30] + pi1 * ((-1.1947622640071e-23 * o[28]) + pi1 * (1.8228094581404e-24 * o[26] - 9.3537087292458e-26 * o[24] * pi1))))))))) + o[8] * ((-0.00047184321073267) + o[7] * ((-0.00030001780793026) + (0.000047661393906987 + o[1] * ((-4.4141845330846e-6) - 7.2694996297594e-16 * o[9])) * tau1))) + o[5] * (0.00028319080123804 + o[1] * ((-0.00060706301565874) + o[6] * ((-0.018990068218419) + tau1 * ((-0.032529748770505) + ((-0.021841717175414) - 0.00005283835796993 * o[1]) * tau1))))) + (0.14632971213167 + tau1 * ((-0.84548187169114) + tau1 * ((-3.756360367204) + tau1 * (3.3855169168385 + tau1 * ((-0.95791963387872) + tau1 * (0.15772038513228 + ((-0.016616417199501) + 0.00081214629983568 * tau1) * tau1)))))) / o[1];
+      g.gpi := pi1 * (pi1 * (o[10] * (0.000095038934535162 + o[2] * (8.4812393955936e-6 + 2.55615384360309e-9 * o[6])) + pi1 * (o[12] * (8.9701127632e-6 + (2.60684891582404e-6 + 5.7366919751696e-13 * o[13]) * o[7]) + pi1 * (2.02584984300585e-6 * o[14] + o[16] * ((1.01874413933128e-8 + 1.39398969845072e-9 * o[11]) * o[36] + o[19] * (1.44400475720615e-17 * o[34] + o[15] * ((-3.33001080055983e-19 * o[32]) + o[20] * ((-7.63737668221055e-22 * o[30]) + pi1 * (3.5842867920213e-22 * o[28] + pi1 * ((-5.65070932023524e-23 * o[26]) + 2.99318679335866e-24 * o[24] * pi1))))))))) + o[8] * (0.00094368642146534 + o[7] * (0.00060003561586052 + ((-0.000095322787813974) + o[1] * (8.8283690661692e-6 + 1.45389992595188e-15 * o[9])) * tau1))) + o[5] * ((-0.00028319080123804) + o[1] * (0.00060706301565874 + o[6] * (0.018990068218419 + tau1 * (0.032529748770505 + (0.021841717175414 + 0.00005283835796993 * o[1]) * tau1))));
+      g.gpipi := pi1 * (o[10] * ((-0.000190077869070324) + o[2] * ((-0.0000169624787911872) - 5.11230768720618e-9 * o[6])) + pi1 * (o[12] * ((-0.0000269103382896) + ((-7.82054674747212e-6) - 1.72100759255088e-12 * o[13]) * o[7]) + pi1 * ((-8.1033993720234e-6 * o[14]) + o[16] * (((-7.13120897531896e-8) - 9.75792788915504e-9 * o[11]) * o[36] + o[19] * ((-2.8880095144123e-16 * o[34]) + o[15] * (7.32602376123163e-18 * o[32] + o[20] * (2.13846547101895e-20 * o[30] + pi1 * ((-1.03944316968618e-20 * o[28]) + pi1 * (1.69521279607057e-21 * o[26] - 9.27887905941183e-23 * o[24] * pi1))))))))) + o[8] * ((-0.00094368642146534) + o[7] * ((-0.00060003561586052) + (0.000095322787813974 + o[1] * ((-8.8283690661692e-6) - 1.45389992595188e-15 * o[9])) * tau1));
+      g.gpipipi := o[10] * (0.000190077869070324 + o[2] * (0.0000169624787911872 + 5.11230768720618e-9 * o[6])) + pi1 * (o[12] * (0.0000538206765792 + (0.0000156410934949442 + 3.44201518510176e-12 * o[13]) * o[7]) + pi1 * (0.0000243101981160702 * o[14] + o[16] * (o[36] * (4.27872538519138e-7 + o[37]) + o[19] * (5.48721807738337e-15 * o[34] + o[15] * ((-1.53846498985864e-16 * o[32]) + o[20] * ((-5.77385677175118e-19 * o[30]) + pi1 * (2.9104408751213e-19 * o[28] + pi1 * ((-4.91611710860466e-20 * o[26]) + 2.78366371782355e-21 * o[24] * pi1))))))));
+      g.gtau := pi1 * (o[39] * ((-0.00254871721114236) + o[1] * (0.00424944110961118 + (0.018990068218419 + ((-0.021841717175414) - 0.00015851507390979 * o[1]) * o[1]) * o[6])) + pi1 * (o[10] * (0.00141552963219801 + o[2] * (0.000047661393906987 + o[1] * ((-0.0000132425535992538) - 1.2358149370591e-14 * o[9]))) + pi1 * (o[12] * (0.000126718579380216 - 5.11230768720618e-9 * o[38]) + pi1 * (o[40] * (0.000011212640954 + (1.30342445791202e-6 - 1.4341729937924e-12 * o[13]) * o[7]) + pi1 * (3.24135974880936e-6 * o[5] + o[16] * ((1.40077319158051e-8 + 1.04549227383804e-9 * o[11]) * o[46] + o[19] * (1.9941018075704e-17 * o[45] + o[15] * ((-4.48827542684151e-19 * o[43]) + o[20] * ((-1.00075970318621e-21 * o[28]) + pi1 * (4.65957282962769e-22 * o[26] + pi1 * ((-7.2912378325616e-23 * o[24]) + 3.83502057899078e-24 * o[42] * pi1))))))))))) + o[8] * ((-0.29265942426334) + tau1 * (0.84548187169114 + o[1] * (3.3855169168385 + tau1 * ((-1.91583926775744) + tau1 * (0.47316115539684 + ((-0.066465668798004) + 0.0040607314991784 * tau1) * tau1)))));
+      g.gtautau := pi1 * (o[36] * (0.0254871721114236 + o[1] * ((-0.0339955288768894) + ((-0.037980136436838) + o[47]) * o[6])) + pi1 * (o[12] * ((-0.00566211852879204) + o[6] * ((-0.0000264851071985076) - 1.97730389929456e-13 * o[9])) + pi1 * (((-0.00063359289690108) - 2.55615384360309e-8 * o[38]) * o[40] + pi1 * (o[49] * ((-0.000067275845724) + ((-3.91027337373606e-6) - 1.29075569441316e-11 * o[13]) * o[7]) + pi1 * ((-0.0000291722377392842 * o[39]) + o[16] * (((-1.68092782989661e-7) - 7.31844591686628e-9 * o[11]) * o[55] + o[19] * ((-5.9823054227112e-16 * o[32]) + o[15] * (1.43624813658928e-17 * o[53] + o[20] * (3.90296284242622e-20 * o[26] + pi1 * ((-1.86382913185108e-20 * o[24]) + pi1 * (2.98940751135026e-21 * o[42] - 1.61070864317613e-22 * o[51] * pi1))))))))))) + o[10] * (0.87797827279002 + tau1 * ((-1.69096374338228) + o[7] * ((-1.91583926775744) + tau1 * (0.94632231079368 + ((-0.199397006394012) + 0.0162429259967136 * tau1) * tau1))));
+      g.gtautautau := pi1 * (o[46] * ((-0.28035889322566) + o[1] * (0.305959759892005 + (0.113940409310514 + o[47]) * o[6])) + pi1 * (o[40] * (0.0283105926439602 + o[6] * ((-0.0000264851071985076) - 2.96595584894183e-12 * o[9])) + pi1 * ((0.00380155738140648 - 1.02246153744124e-7 * o[38]) * o[49] + pi1 * (o[14] * (0.000470930920068 + (0.0000156410934949442 - 1.03260455553053e-10 * o[13]) * o[7]) + pi1 * (0.000291722377392842 * o[36] + o[16] * ((2.1852061788656e-6 + o[37]) / o[9] + o[19] * (1.85451468104047e-14 * o[43] + o[15] * ((-4.73961885074464e-16 / (o[1] * o[22])) + o[20] * ((-1.56118513697049e-18 * o[24]) + pi1 * (7.64169944058941e-19 * o[42] + pi1 * ((-1.25555115476711e-19 * o[51]) + 6.92604716565734e-21 * pi1 / (o[2] * o[22] * o[3])))))))))))) + o[12] * ((-3.51191309116008) + tau1 * (5.07289123014684 + o[2] * (0.94632231079368 + ((-0.398794012788024) + 0.0487287779901408 * tau1) * tau1)));
+      g.gpitau := o[39] * (0.00254871721114236 + o[1] * ((-0.00424944110961118) + ((-0.018990068218419) + (0.021841717175414 + 0.00015851507390979 * o[1]) * o[1]) * o[6])) + pi1 * (o[10] * ((-0.00283105926439602) + o[2] * ((-0.000095322787813974) + o[1] * (0.0000264851071985076 + 2.4716298741182e-14 * o[9]))) + pi1 * (o[12] * ((-0.000380155738140648) + 1.53369230616185e-8 * o[38]) + pi1 * (o[40] * ((-0.000044850563816) + ((-5.21369783164808e-6) + 5.7366919751696e-12 * o[13]) * o[7]) + pi1 * ((-0.0000162067987440468 * o[5]) + o[16] * (((-1.12061855326441e-7) - 8.36393819070432e-9 * o[11]) * o[46] + o[19] * ((-4.18761379589784e-16 * o[45]) + o[15] * (1.03230334817355e-17 * o[43] + o[20] * (2.90220313924001e-20 * o[28] + pi1 * ((-1.39787184888831e-20 * o[26]) + pi1 * (2.2602837280941e-21 * o[24] - 1.22720658527705e-22 * o[42] * pi1))))))))));
+      g.gpipitau := o[10] * (0.00283105926439602 + o[2] * (0.000095322787813974 + o[1] * ((-0.0000264851071985076) - 2.4716298741182e-14 * o[9]))) + pi1 * (o[12] * (0.000760311476281296 - 3.06738461232371e-8 * o[38]) + pi1 * (o[40] * (0.000134551691448 + (0.0000156410934949442 - 1.72100759255088e-11 * o[13]) * o[7]) + pi1 * (0.0000648271949761872 * o[5] + o[16] * ((7.84432987285086e-7 + o[37]) * o[46] + o[19] * (8.37522759179568e-15 * o[45] + o[15] * ((-2.2710673659818e-16 * o[43]) + o[20] * ((-8.12616878987203e-19 * o[28]) + pi1 * (4.05382836177609e-19 * o[26] + pi1 * ((-6.78085118428229e-20 * o[24]) + 3.80434041435885e-21 * o[42] * pi1)))))))));
+      g.gpitautau := o[36] * ((-0.0254871721114236) + o[1] * (0.0339955288768894 + (0.037980136436838 + 0.00031703014781958 * o[2]) * o[6])) + pi1 * (o[12] * (0.0113242370575841 + o[6] * (0.0000529702143970152 + 3.95460779858911e-13 * o[9])) + pi1 * ((0.00190077869070324 + 7.66846153080927e-8 * o[38]) * o[40] + pi1 * (o[49] * (0.000269103382896 + (0.0000156410934949442 + 5.16302277765264e-11 * o[13]) * o[7]) + pi1 * (0.000145861188696421 * o[39] + o[16] * ((1.34474226391729e-6 + o[37]) * o[55] + o[19] * (1.25628413876935e-14 * o[32] + o[15] * ((-3.30337071415535e-16 * o[53]) + o[20] * ((-1.1318592243036e-18 * o[26]) + pi1 * (5.59148739555323e-19 * o[24] + pi1 * ((-9.26716328518579e-20 * o[42]) + 5.1542676581636e-21 * o[51] * pi1))))))))));
+    end g1L3;
+
+    function g2L3 "base function for region 2 with 3rd derivatives for sensitivities: g(p,T)"
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      output ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd g "dimensionless Gibbs function and derivatives up to 3rd derivatives";
+    protected
+      Real pi2;
+      Real tau2;
+      Real[82] o;
+    algorithm
+      assert(p > ThermoSysPro.Properties.WaterSteam.BaseIF97.triple.ptriple, "IF97 medium function g2 called with too low pressure\n" + "p = " + String(p) + " Pa <= " + String(ThermoSysPro.Properties.WaterSteam.BaseIF97.triple.ptriple) + " Pa (triple point pressure)");
+      assert(p <= 100.0e6, "IF97 medium function g2: the input pressure (= " + String(p) + " Pa) is higher than 100 Mpa");
+      assert(T >= 273.15, "IF97 medium function g2: the temperature (= " + String(T) + " K) is lower than 273.15 K!");
+      assert(T <= 1073.15, "IF97 medium function g2: the input temperature (= " + String(T) + " K) is higher than the limit of 1073.15 K");
+      g.p := p;
+      g.T := T;
+      g.R := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
+      g.pi := p / ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PSTAR2;
+      g.tau := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TSTAR2 / T;
+      tau2 := (-0.5) + g.tau;
+      o[1] := tau2 * tau2;
+      o[2] := o[1] * tau2;
+      o[3] := -0.05032527872793 * o[2];
+      o[4] := (-0.057581259083432) + o[3];
+      o[5] := o[4] * tau2;
+      o[6] := (-0.045996013696365) + o[5];
+      o[7] := o[6] * tau2;
+      o[8] := (-0.017834862292358) + o[7];
+      o[9] := o[8] * tau2;
+      o[10] := o[1] * o[1];
+      o[11] := o[10] * o[10];
+      o[12] := o[11] * o[11];
+      o[13] := o[10] * o[11] * o[12] * tau2;
+      o[14] := o[1] * o[10] * tau2;
+      o[15] := o[10] * o[11] * tau2;
+      o[16] := o[1] * o[12] * tau2;
+      o[17] := o[1] * o[11] * tau2;
+      o[18] := o[1] * o[10] * o[11];
+      o[19] := o[10] * o[11] * o[12];
+      o[20] := o[1] * o[10];
+      o[21] := g.pi * g.pi;
+      o[22] := o[21] * o[21];
+      o[23] := o[21] * o[22];
+      o[24] := o[10] * o[12] * tau2;
+      o[25] := o[12] * o[12];
+      o[26] := o[11] * o[12] * o[25] * tau2;
+      o[27] := o[10] * o[12];
+      o[28] := o[1] * o[10] * o[11] * tau2;
+      o[29] := o[10] * o[12] * o[25] * tau2;
+      o[30] := o[1] * o[10] * o[25] * tau2;
+      o[31] := o[1] * o[11] * o[12];
+      o[32] := o[1] * o[12];
+      o[33] := g.tau * g.tau;
+      o[34] := o[33] * o[33];
+      o[35] := -0.000053349095828174 * o[13];
+      o[36] := (-0.087594591301146) + o[35];
+      o[37] := o[2] * o[36];
+      o[38] := (-0.007878555448671) + o[37];
+      o[39] := o[1] * o[38];
+      o[40] := (-0.0003789797503263) + o[39];
+      o[41] := o[40] * tau2;
+      o[42] := (-0.000066065283340406) + o[41];
+      o[43] := o[42] * tau2;
+      o[44] := -0.244009521375894 * o[13];
+      o[45] := (-0.0090203547252888) + o[44];
+      o[46] := o[2] * o[45];
+      o[47] := (-0.00019366606343142) + o[46];
+      o[48] := o[1] * o[47];
+      o[49] := 2.6322400370661e-6 + o[48];
+      o[50] := o[49] * tau2;
+      o[51] := 5.78704472622084e-6 * tau2;
+      o[52] := o[21] * g.pi;
+      o[53] := 0.0000115740894524417 * tau2;
+      o[54] := -0.30195167236758 * o[2];
+      o[55] := (-0.172743777250296) + o[54];
+      o[56] := o[55] * tau2;
+      o[57] := (-0.09199202739273) + o[56];
+      o[58] := o[57] * tau2;
+      o[59] := o[1] * o[11];
+      o[60] := o[10] * o[11];
+      o[61] := o[11] * o[12] * o[25];
+      o[62] := o[10] * o[12] * o[25];
+      o[63] := o[1] * o[10] * o[25];
+      o[64] := o[11] * o[12] * tau2;
+      o[65] := -1.5097583618379 * o[2];
+      o[66] := (-0.345487554500592) + o[65];
+      o[67] := o[66] * tau2;
+      o[68] := o[10] * tau2;
+      o[69] := o[11] * tau2;
+      o[70] := o[1] * o[11] * o[12] * tau2;
+      o[71] := o[1] * o[10] * o[12] * o[25] * tau2;
+      o[72] := o[1] * o[12] * o[25] * tau2;
+      o[73] := o[10] * o[25] * tau2;
+      o[74] := o[11] * o[12];
+      o[75] := o[34] * o[34];
+      o[76] := -0.00192056744981426 * o[13];
+      o[77] := (-0.613162139108022) + o[76];
+      o[78] := o[2] * o[77];
+      o[79] := (-0.031514221794684) + o[78];
+      o[80] := o[1] * o[79];
+      o[81] := (-0.0007579595006526) + o[80];
+      o[82] := o[81] * tau2;
+      g.g := g.pi * ((-0.0017731742473213) + o[9] + g.pi * (tau2 * ((-0.000033032641670203) + ((-0.00018948987516315) + o[1] * ((-0.0039392777243355) + ((-0.043797295650573) - 0.000026674547914087 * o[13]) * o[2])) * tau2) + g.pi * (2.0481737692309e-8 + (4.3870667284435e-7 + o[1] * ((-0.00003227767723857) + ((-0.0015033924542148) - 0.040668253562649 * o[13]) * o[2])) * tau2 + g.pi * (g.pi * (2.2922076337661e-6 * o[14] + g.pi * (((-1.6714766451061e-11) + o[15] * ((-0.0021171472321355) - 23.895741934104 * o[16])) * o[2] + g.pi * ((-5.905956432427e-18) + o[17] * ((-1.2621808899101e-6) - 0.038946842435739 * o[18]) + g.pi * (o[11] * (1.1256211360459e-11 - 8.2311340897998 * o[19]) + g.pi * (1.9809712802088e-8 * o[15] + g.pi * (o[10] * (1.0406965210174e-19 + ((-1.0234747095929e-13) - 1.0018179379511e-9 * o[10]) * o[20]) + o[23] * (o[13] * ((-8.0882908646985e-11) + 0.10693031879409 * o[24]) + o[21] * ((-0.33662250574171 * o[26]) + o[21] * (o[27] * (8.9185845355421e-25 + (3.0629316876232e-13 - 4.2002467698208e-6 * o[15]) * o[28]) + g.pi * ((-5.9056029685639e-26 * o[24]) + g.pi * (3.7826947613457e-6 * o[29] + g.pi * ((-1.2768608934681e-15 * o[30]) + o[31] * (7.3087610595061e-29 + o[18] * (5.5414715350778e-17 - 9.436970724121e-7 * o[32])) * g.pi)))))))))))) + tau2 * ((-7.8847309559367e-10) + (1.2790717852285e-8 + 4.8225372718507e-7 * tau2) * tau2))))) + ((-0.00560879118302) + g.tau * (0.07145273881455 + g.tau * ((-0.4071049823928) + g.tau * (1.424081971444 + g.tau * ((-4.38395111945) + g.tau * ((-9.692768600217) + g.tau * (10.08665568018 + ((-0.2840863260772) + 0.02126846353307 * g.tau) * g.tau) + Modelica.Math.log(g.pi))))))) / (o[34] * g.tau);
+      g.gpi := (1.0 + g.pi * ((-0.0017731742473213) + o[9] + g.pi * (o[43] + g.pi * (6.1445213076927e-8 + (1.31612001853305e-6 + o[1] * ((-0.00009683303171571) + ((-0.0045101773626444) - 0.122004760687947 * o[13]) * o[2])) * tau2 + g.pi * (g.pi * (0.0000114610381688305 * o[14] + g.pi * (((-1.00288598706366e-10) + o[15] * ((-0.012702883392813) - 143.374451604624 * o[16])) * o[2] + g.pi * ((-4.1341695026989e-17) + o[17] * ((-8.8352662293707e-6) - 0.272627897050173 * o[18]) + g.pi * (o[11] * (9.0049690883672e-11 - 65.8490727183984 * o[19]) + g.pi * (1.78287415218792e-7 * o[15] + g.pi * (o[10] * (1.0406965210174e-18 + ((-1.0234747095929e-12) - 1.0018179379511e-8 * o[10]) * o[20]) + o[23] * (o[13] * ((-1.29412653835176e-9) + 1.71088510070544 * o[24]) + o[21] * ((-6.05920510335078 * o[26]) + o[21] * (o[27] * (1.78371690710842e-23 + (6.1258633752464e-12 - 0.000084004935396416 * o[15]) * o[28]) + g.pi * ((-1.24017662339842e-24 * o[24]) + g.pi * (0.0000832192847496054 * o[29] + g.pi * ((-2.93678005497663e-14 * o[30]) + o[31] * (1.75410265428146e-27 + o[18] * (1.32995316841867e-15 - 0.0000226487297378904 * o[32])) * g.pi)))))))))))) + tau2 * ((-3.15389238237468e-9) + (5.116287140914e-8 + 1.92901490874028e-6 * tau2) * tau2)))))) / g.pi;
+      g.gpipi := ((-1.0) + o[21] * (o[43] + g.pi * (1.22890426153854e-7 + o[50] + g.pi * (g.pi * (0.000045844152675322 * o[14] + g.pi * (((-5.0144299353183e-10) + o[15] * ((-0.063514416964065) - 716.87225802312 * o[16])) * o[2] + g.pi * ((-2.48050170161934e-16) + o[17] * ((-0.0000530115973762242) - 1.63576738230104 * o[18]) + g.pi * (o[11] * (6.30347836185704e-10 - 460.943509028789 * o[19]) + g.pi * (1.42629932175034e-6 * o[15] + g.pi * (o[10] * (9.3662686891566e-18 + ((-9.2112723863361e-12) - 9.0163614415599e-8 * o[10]) * o[20]) + o[23] * (o[13] * ((-1.94118980752764e-8) + 25.6632765105816 * o[24]) + o[21] * ((-103.006486756963 * o[26]) + o[21] * (o[27] * (3.389062123506e-22 + (1.16391404129682e-10 - 0.0015960937725319 * o[15]) * o[28]) + g.pi * ((-2.48035324679684e-23 * o[24]) + g.pi * (0.00174760497974171 * o[29] + g.pi * ((-6.46091612094859e-13 * o[30]) + o[31] * (4.03443610484737e-26 + o[18] * (3.05889228736295e-14 - 0.000520920783971479 * o[32])) * g.pi)))))))))))) + tau2 * ((-9.46167714712404e-9) + (1.5348861422742e-7 + o[51]) * tau2))))) / o[21];
+      g.gpipipi := (2.0 + o[52] * (1.22890426153854e-7 + o[50] + g.pi * (g.pi * (0.000137532458025966 * o[14] + g.pi * (((-2.00577197412732e-9) + o[15] * ((-0.25405766785626) - 2867.48903209248 * o[16])) * o[2] + g.pi * ((-1.24025085080967e-15) + o[17] * ((-0.000265057986881121) - 8.17883691150519 * o[18]) + g.pi * (o[11] * (3.78208701711422e-9 - 2765.66105417273 * o[19]) + g.pi * (9.98409525225235e-6 * o[15] + g.pi * (o[10] * (7.49301495132528e-17 + ((-7.36901790906888e-11) - 7.21308915324792e-7 * o[10]) * o[20]) + o[23] * (o[13] * ((-2.7176657305387e-7) + 359.285871148142 * o[24]) + o[21] * ((-1648.10378811141 * o[26]) + o[21] * (o[27] * (6.1003118223108e-21 + (2.09504527433427e-9 - 0.0287296879055743 * o[15]) * o[28]) + g.pi * ((-4.71267116891399e-22 * o[24]) + g.pi * (0.0349520995948343 * o[29] + g.pi * ((-1.3567923853992e-11 * o[30]) + o[31] * (8.87575943066421e-25 + o[18] * (6.72956303219848e-13 - 0.0114602572473725 * o[32])) * g.pi)))))))))))) + tau2 * ((-1.89233542942481e-8) + (3.0697722845484e-7 + o[53]) * tau2)))) / o[52];
+      g.gtau := (0.0280439559151 + g.tau * ((-0.2858109552582) + g.tau * (1.2213149471784 + g.tau * ((-2.848163942888) + g.tau * (4.38395111945 + o[33] * (10.08665568018 + ((-0.5681726521544) + 0.06380539059921 * g.tau) * g.tau)))))) / (o[33] * o[34]) + g.pi * ((-0.017834862292358) + o[58] + g.pi * ((-0.000033032641670203) + ((-0.0003789797503263) + o[1] * ((-0.015757110897342) + ((-0.306581069554011) - 0.000960283724907132 * o[13]) * o[2])) * tau2 + g.pi * (4.3870667284435e-7 + o[1] * ((-0.00009683303171571) + ((-0.0090203547252888) - 1.42338887469272 * o[13]) * o[2]) + g.pi * ((-7.8847309559367e-10) + g.pi * (0.0000160454534363627 * o[20] + g.pi * (o[1] * ((-5.0144299353183e-11) + o[15] * ((-0.033874355714168) - 836.35096769364 * o[16])) + g.pi * (((-0.0000138839897890111) - 0.973671060893475 * o[18]) * o[59] + g.pi * (o[14] * (9.0049690883672e-11 - 296.320827232793 * o[19]) + g.pi * (2.57526266427144e-7 * o[60] + g.pi * (o[2] * (4.1627860840696e-19 + ((-1.0234747095929e-12) - 1.40254511313154e-8 * o[10]) * o[20]) + o[23] * (o[19] * ((-2.34560435076256e-9) + 5.3465159397045 * o[24]) + o[21] * ((-19.1874828272775 * o[61]) + o[21] * (o[16] * (1.78371690710842e-23 + (1.07202609066812e-11 - 0.000201611844951398 * o[15]) * o[28]) + g.pi * ((-1.24017662339842e-24 * o[27]) + g.pi * (0.000200482822351322 * o[62] + g.pi * ((-4.97975748452559e-14 * o[63]) + (1.90027787547159e-27 + o[18] * (2.21658861403112e-15 - 0.0000547344301999018 * o[32])) * o[64] * g.pi)))))))))))) + (2.558143570457e-8 + 1.44676118155521e-6 * tau2) * tau2))));
+      g.gtautau := ((-0.1682637354906) + g.tau * (1.429054776291 + g.tau * ((-4.8852597887136) + g.tau * (8.544491828664 + g.tau * ((-8.7679022389) + o[33] * ((-0.5681726521544) + 0.12761078119842 * g.tau) * g.tau))))) / (o[33] * o[34] * g.tau) + g.pi * ((-0.09199202739273) + o[67] + g.pi * ((-0.0003789797503263) + o[1] * ((-0.047271332692026) + ((-1.83948641732407) - 0.0336099303717496 * o[13]) * o[2]) + g.pi * (((-0.00019366606343142) + ((-0.045101773626444) - 48.3952217395523 * o[13]) * o[2]) * tau2 + g.pi * (2.558143570457e-8 + 2.89352236311042e-6 * tau2 + g.pi * (0.0000962727206181762 * o[68] + g.pi * (g.pi * (((-0.000138839897890111) - 23.3681054614434 * o[18]) * o[69] + g.pi * ((6.30347836185704e-10 - 10371.2289531477 * o[19]) * o[20] + g.pi * (3.09031519712573e-6 * o[17] + g.pi * (o[1] * (1.24883582522088e-18 + ((-9.2112723863361e-12) - 1.823308647071e-7 * o[10]) * o[20]) + o[23] * (((-6.56769218213518e-8) + 261.979281045521 * o[24]) * o[70] + o[21] * ((-1074.49903832754 * o[71]) + o[21] * ((3.389062123506e-22 + (3.64488870827161e-10 - 0.00947575671271573 * o[15]) * o[28]) * o[32] + g.pi * ((-2.48035324679684e-23 * o[16]) + g.pi * (0.0104251067622687 * o[72] + g.pi * ((-1.89230784411972e-12 * o[73]) + (4.75069468867897e-26 + o[18] * (8.64469559472137e-14 - 0.0031198625213944 * o[32])) * o[74] * g.pi)))))))))) + ((-1.00288598706366e-10) + o[15] * ((-0.50811533571252) - 28435.9329015838 * o[16])) * tau2))))));
+      g.gtautautau := (1.1778461484342 + g.tau * ((-8.574328657746) + g.tau * (24.426298943568 + g.tau * ((-34.177967314656) + (26.3037067167 + 0.12761078119842 * o[34]) * g.tau)))) / o[75] + g.pi * ((-0.345487554500592) - 6.0390334473516 * o[2] + g.pi * (((-0.094542665384052) + ((-9.19743208662033) - 1.14273763263949 * o[13]) * o[2]) * tau2 + g.pi * ((-0.00019366606343142) + ((-0.180407094505776) - 1597.04231740523 * o[13]) * o[2] + g.pi * (2.89352236311042e-6 + g.pi * (0.000481363603090881 * o[10] + g.pi * ((-1.00288598706366e-10) + o[15] * ((-7.11361469997528) - 938385.785752264 * o[16]) + g.pi * (o[11] * ((-0.001249559081011) - 537.466425613198 * o[18]) + g.pi * ((3.78208701711422e-9 - 352621.784407023 * o[19]) * o[68] + g.pi * (0.000033993467168383 * o[59] + g.pi * ((2.49767165044176e-18 + ((-7.36901790906888e-11) - 2.1879703764852e-6 * o[10]) * o[20]) * tau2 + o[23] * (((-1.7732768891765e-6) + 12575.005490185 * o[24]) * o[31] + o[21] * ((-59097.4471080146 * o[1] * o[10] * o[12] * o[25]) + o[21] * (o[12] * (6.1003118223108e-21 + (1.20281327372963e-8 - 0.435884808784923 * o[15]) * o[28]) * tau2 + g.pi * ((-4.71267116891399e-22 * o[32]) + g.pi * (0.531680444875706 * o[1] * o[12] * o[25] + g.pi * ((-7.00153902324298e-11 * o[10] * o[25]) + o[1] * o[10] * o[12] * (1.14016672528295e-24 + o[18] * (3.28498432599412e-12 - 0.174712301198087 * o[32])) * g.pi * tau2))))))))))))))));
+      g.gpitau := (-0.017834862292358) + o[58] + g.pi * ((-0.000066065283340406) + o[82] + g.pi * (1.31612001853305e-6 + o[1] * ((-0.00029049909514713) + ((-0.0270610641758664) - 4.27016662407815 * o[13]) * o[2]) + g.pi * ((-3.15389238237468e-9) + g.pi * (0.0000802272671818135 * o[20] + g.pi * (o[1] * ((-3.00865796119098e-10) + o[15] * ((-0.203246134285008) - 5018.10580616184 * o[16])) + g.pi * (((-0.0000971879285230777) - 6.81569742625432 * o[18]) * o[59] + g.pi * (o[14] * (7.20397527069376e-10 - 2370.56661786234 * o[19]) + g.pi * (2.3177363978443e-6 * o[60] + g.pi * (o[2] * (4.1627860840696e-18 + ((-1.0234747095929e-11) - 1.40254511313154e-7 * o[10]) * o[20]) + o[23] * (o[19] * ((-3.7529669612201e-8) + 85.544255035272 * o[24]) + o[21] * ((-345.374690890994 * o[61]) + o[21] * (o[16] * (3.56743381421684e-22 + (2.14405218133624e-10 - 0.00403223689902797 * o[15]) * o[28]) + g.pi * ((-2.60437090913668e-23 * o[27]) + g.pi * (0.00441062209172909 * o[62] + g.pi * ((-1.14534422144089e-12 * o[63]) + (4.56066690113181e-26 + o[18] * (5.31981267367469e-14 - 0.00131362632479764 * o[32])) * o[64] * g.pi)))))))))))) + (1.0232574281828e-7 + o[51]) * tau2)));
+      g.gpipitau := (-0.000066065283340406) + o[82] + g.pi * (2.6322400370661e-6 + o[1] * ((-0.00058099819029426) + ((-0.0541221283517328) - 8.54033324815629 * o[13]) * o[2]) + g.pi * ((-9.46167714712404e-9) + g.pi * (0.000320909068727254 * o[20] + g.pi * (o[1] * ((-1.50432898059549e-9) + o[15] * ((-1.01623067142504) - 25090.5290308092 * o[16])) + g.pi * (((-0.000583127571138466) - 40.8941845575259 * o[18]) * o[59] + g.pi * (o[14] * (5.04278268948563e-9 - 16593.9663250364 * o[19]) + g.pi * (0.0000185418911827544 * o[60] + g.pi * (o[2] * (3.74650747566264e-17 + ((-9.2112723863361e-11) - 1.26229060181839e-6 * o[10]) * o[20]) + o[23] * (o[19] * ((-5.62945044183016e-7) + 1283.16382552908 * o[24]) + o[21] * ((-5871.36974514691 * o[61]) + o[21] * (o[16] * (6.778124247012e-21 + (4.07369914453886e-9 - 0.0766125010815314 * o[15]) * o[28]) + g.pi * ((-5.20874181827336e-22 * o[27]) + g.pi * (0.0926230639263108 * o[62] + g.pi * ((-2.51975728716995e-11 * o[63]) + (1.04895338726032e-24 + o[18] * (1.22355691494518e-12 - 0.0302134054703458 * o[32])) * o[64] * g.pi)))))))))))) + (3.0697722845484e-7 + 0.0000173611341786625 * tau2) * tau2));
+      g.gpitautau := (-0.09199202739273) + o[67] + g.pi * ((-0.0007579595006526) + o[1] * ((-0.094542665384052) + ((-3.67897283464813) - 0.0672198607434992 * o[13]) * o[2]) + g.pi * (((-0.00058099819029426) + ((-0.135305320879332) - 145.185665218657 * o[13]) * o[2]) * tau2 + g.pi * (1.0232574281828e-7 + o[53] + g.pi * (0.000481363603090881 * o[68] + g.pi * (g.pi * (((-0.000971879285230777) - 163.576738230104 * o[18]) * o[69] + g.pi * ((5.04278268948563e-9 - 82969.831625182 * o[19]) * o[20] + g.pi * (0.0000278128367741315 * o[17] + g.pi * (o[1] * (1.24883582522088e-17 + ((-9.2112723863361e-11) - 1.823308647071e-6 * o[10]) * o[20]) + o[23] * (((-1.05083074914163e-6) + 4191.66849672833 * o[24]) * o[70] + o[21] * ((-19340.9826898957 * o[71]) + o[21] * ((6.778124247012e-21 + (7.28977741654322e-9 - 0.189515134254314 * o[15]) * o[28]) * o[32] + g.pi * ((-5.20874181827336e-22 * o[16]) + g.pi * (0.229352348769913 * o[72] + g.pi * ((-4.35230804147537e-11 * o[73]) + (1.14016672528295e-24 + o[18] * (2.07472694273313e-12 - 0.0748767005134657 * o[32])) * o[74] * g.pi)))))))))) + ((-6.01731592238196e-10) + o[15] * ((-3.04869201427512) - 170615.597409503 * o[16])) * tau2)))));
+    end g2L3;
+
+    function f3L3 "Helmholtz function for region 3: f(d,T), including 3rd derivatives"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      output ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd f "dimensionless Helmholtz function and dervatives wrt delta and tau";
+    protected
+      Real tau "dimensionless temperature";
+      Real del "dimensionless density";
+      Real[62] o "vector of auxiliary variables";
+    algorithm
+      f.T := T;
+      f.d := d;
+      f.R := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
+      tau := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TCRIT / T;
+      del := if d == ThermoSysPro.Properties.WaterSteam.BaseIF97.data.DCRIT and T == ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TCRIT then 1 - Modelica.Constants.eps else abs(d / ThermoSysPro.Properties.WaterSteam.BaseIF97.data.DCRIT);
+      f.tau := tau;
+      f.delta := del;
+      o[1] := tau * tau;
+      o[2] := o[1] * o[1];
+      o[3] := o[2] * tau;
+      o[4] := o[1] * tau;
+      o[5] := o[2] * o[2];
+      o[6] := o[1] * o[5] * tau;
+      o[7] := o[5] * tau;
+      o[8] := -0.64207765181607 * o[1];
+      o[9] := 0.88521043984318 + o[8];
+      o[10] := o[7] * o[9];
+      o[11] := (-1.1524407806681) + o[10];
+      o[12] := o[11] * o[2];
+      o[13] := (-1.2654315477714) + o[12];
+      o[14] := o[1] * o[13];
+      o[15] := o[1] * o[2] * o[5] * tau;
+      o[16] := o[2] * o[5];
+      o[17] := o[1] * o[5];
+      o[18] := o[5] * o[5];
+      o[19] := o[1] * o[18] * o[2];
+      o[20] := o[1] * o[18] * o[2] * tau;
+      o[21] := o[18] * o[5];
+      o[22] := o[1] * o[18] * o[5];
+      o[23] := 0.25116816848616 * o[2];
+      o[24] := 0.078841073758308 + o[23];
+      o[25] := o[15] * o[24];
+      o[26] := (-6.100523451393) + o[25];
+      o[27] := o[26] * tau;
+      o[28] := 9.7944563083754 + o[27];
+      o[29] := o[2] * o[28];
+      o[30] := (-1.70429417648412) + o[29];
+      o[31] := o[1] * o[30];
+      o[32] := del * del;
+      o[33] := -2.85576214409538 * o[17];
+      o[34] := (-0.0492885823043778) + o[33];
+      o[35] := o[16] * o[34];
+      o[36] := (-12.113949014142) + o[35];
+      o[37] := o[1] * o[36];
+      o[38] := 8.339879741676 + o[37];
+      o[39] := o[1] * o[38];
+      o[40] := del * o[32];
+      o[41] := -10.9153200808732 * o[1];
+      o[42] := 13.2781565976477 + o[41];
+      o[43] := o[42] * o[7];
+      o[44] := (-6.9146446840086) + o[43];
+      o[45] := o[2] * o[44];
+      o[46] := (-2.5308630955428) + o[45];
+      o[47] := o[46] * tau;
+      o[48] := o[18] * o[5] * tau;
+      o[49] := -174.645121293971 * o[1];
+      o[50] := 185.894192367068 + o[49];
+      o[51] := o[50] * o[7];
+      o[52] := (-34.573223420043) + o[51];
+      o[53] := o[2] * o[52];
+      o[54] := 6.53037238064016 * o[2];
+      o[55] := 1.73450362268278 + o[54];
+      o[56] := o[15] * o[55];
+      o[57] := (-42.703664159751) + o[56];
+      o[58] := o[57] * tau;
+      o[59] := 58.7667378502524 + o[58];
+      o[60] := o[2] * o[59];
+      o[61] := (-3.40858835296824) + o[60];
+      o[62] := o[61] * tau;
+      f.f := (-15.732845290239) + tau * (20.944396974307 + ((-7.6867707878716) + o[3] * (2.6185947787954 + o[4] * ((-2.808078114862) + o[1] * (1.2053369696517 - 0.0084566812812502 * o[6])))) * tau) + del * (o[14] + del * (0.38493460186671 + o[1] * ((-0.85214708824206) + o[2] * (4.8972281541877 + ((-3.0502617256965) + o[15] * (0.039420536879154 + 0.12558408424308 * o[2])) * tau)) + del * ((-0.2799932969871) + o[1] * (1.389979956946 + o[1] * ((-2.018991502357) + o[16] * ((-0.0082147637173963) - 0.47596035734923 * o[17]))) + del * (0.0439840744735 + o[1] * ((-0.44476435428739) + o[1] * (0.90572070719733 + 0.70522450087967 * o[19])) + del * (del * ((-0.022175400873096) + o[1] * (0.094260751665092 + 0.16436278447961 * o[21]) + del * ((-0.013503372241348 * o[1]) + del * ((-0.014834345352472 * o[22]) + del * (o[1] * (0.00057922953628084 + 0.0032308904703711 * o[21]) + del * (0.000080964802996215 - 0.000044923899061815 * del * o[22] - 0.00016557679795037 * tau))))) + (0.10770512626332 + o[1] * ((-0.32913623258954) - 0.50871062041158 * o[20])) * tau))))) + 1.0658070028513 * Modelica.Math.log(del);
+      f.fdelta := (1.0658070028513 + del * (o[14] + del * (0.76986920373342 + o[31] + del * ((-0.8399798909613) + o[1] * (4.169939870838 + o[1] * ((-6.056974507071) + o[16] * ((-0.0246442911521889) - 1.42788107204769 * o[17]))) + del * (0.175936297894 + o[1] * ((-1.77905741714956) + o[1] * (3.62288282878932 + 2.82089800351868 * o[19])) + del * (del * ((-0.133052405238576) + o[1] * (0.565564509990552 + 0.98617670687766 * o[21]) + del * ((-0.094523605689436 * o[1]) + del * ((-0.118674762819776 * o[22]) + del * (o[1] * (0.00521306582652756 + 0.0290780142333399 * o[21]) + del * (0.00080964802996215 - 0.000494162889679965 * del * o[22] - 0.0016557679795037 * tau))))) + (0.5385256313166 + o[1] * ((-1.6456811629477) - 2.5435531020579 * o[20])) * tau)))))) / del;
+      f.fdeltadelta := ((-1.0658070028513) + o[32] * (0.76986920373342 + o[31] + del * ((-1.6799597819226) + o[39] + del * (0.527808893682 + o[1] * ((-5.33717225144868) + o[1] * (10.868648486368 + 8.46269401055604 * o[19])) + del * (del * ((-0.66526202619288) + o[1] * (2.82782254995276 + 4.9308835343883 * o[21]) + del * ((-0.567141634136616 * o[1]) + del * ((-0.830723339738432 * o[22]) + del * (o[1] * (0.0417045266122205 + 0.232624113866719 * o[21]) + del * (0.00728683226965935 - 0.00494162889679965 * del * o[22] - 0.0149019118155333 * tau))))) + (2.1541025252664 + o[1] * ((-6.5827246517908) - 10.1742124082316 * o[20])) * tau))))) / o[32];
+      f.fdeltadeltadelta := (2.1316140057026 + o[40] * ((-1.6799597819226) + o[39] + del * (1.055617787364 + o[1] * ((-10.6743445028974) + o[1] * (21.7372969727359 + 16.9253880211121 * o[19])) + del * (del * ((-2.66104810477152) + o[1] * (11.311290199811 + 19.7235341375532 * o[21]) + del * ((-2.83570817068308 * o[1]) + del * ((-4.98434003843059 * o[22]) + del * (o[1] * (0.291931686285543 + 1.62836879706703 * o[21]) + del * (0.0582946581572748 - 0.0444746600711968 * del * o[22] - 0.119215294524266 * tau))))) + (6.4623075757992 + o[1] * ((-19.7481739553724) - 30.5226372246948 * o[20])) * tau)))) / o[40];
+      f.ftau := 20.944396974307 + ((-15.3735415757432) + o[3] * (18.3301634515678 + o[4] * ((-28.08078114862) + o[1] * (14.4640436358204 - 0.194503669468755 * o[6])))) * tau + del * (o[47] + del * (tau * ((-1.70429417648412) + o[2] * (29.3833689251262 + ((-21.3518320798755) + o[15] * (0.867251811341388 + 3.26518619032008 * o[2])) * tau)) + del * ((2.779959913892 + o[1] * ((-8.075966009428) + o[16] * ((-0.131436219478341) - 12.37496929108 * o[17]))) * tau + del * (((-0.88952870857478) + o[1] * (3.62288282878932 + 18.3358370228714 * o[19])) * tau + del * (0.10770512626332 + o[1] * ((-0.98740869776862) - 13.2264761307011 * o[20]) + del * ((0.188521503330184 + 4.27343239646986 * o[21]) * tau + del * ((-0.027006744482696 * tau) + del * ((-0.385692979164272 * o[48]) + del * (del * ((-0.00016557679795037) - 0.00116802137560719 * del * o[48]) + (0.00115845907256168 + 0.0840031522296486 * o[21]) * tau)))))))));
+      f.ftautau := (-15.3735415757432) + o[3] * (109.980980709407 + o[4] * ((-252.72703033758) + o[1] * (159.104479994024 - 4.2790807283126 * o[6]))) + del * ((-2.5308630955428) + o[53] + del * ((-1.70429417648412) + o[2] * (146.916844625631 + ((-128.110992479253) + o[15] * (18.2122880381691 + 81.629654758002 * o[2])) * tau) + del * (2.779959913892 + o[1] * ((-24.227898028284) + o[16] * ((-1.97154329217511) - 309.374232277 * o[17])) + del * ((-0.88952870857478) + o[1] * (10.868648486368 + 458.395925571786 * o[19]) + del * (del * (0.188521503330184 + 106.835809911746 * o[21] + del * ((-0.027006744482696) + del * ((-9.6423244791068 * o[21]) + del * (0.00115845907256168 + 2.10007880574121 * o[21] - 0.0292005343901797 * o[21] * o[32])))) + ((-1.97481739553724) - 330.661903267527 * o[20]) * tau)))));
+      f.ftautautau := o[2] * (549.904903547034 + o[4] * ((-2021.81624270064) + o[1] * (1591.04479994024 - 89.8606952945646 * o[6]))) + del * (o[4] * ((-138.292893680172) + (2416.62450077188 - 2619.67681940957 * o[1]) * o[7]) + del * (o[4] * (587.667378502524 + ((-640.554962396265) + o[15] * (364.245760763383 + 1959.11171419205 * o[2])) * tau) + del * (((-48.455796056568) + o[16] * ((-27.6016060904516) - 7424.98157464799 * o[17])) * tau + del * (del * ((-1.97481739553724) - 7935.88567842065 * o[20] + del * (2564.05943788192 * o[20] + o[32] * ((-231.415787498563 * o[20]) + del * (50.4018913377892 * o[20] - 0.700812825364314 * o[20] * o[32])))) + (21.7372969727359 + 11001.5022137229 * o[19]) * tau))));
+      f.fdeltatau := o[47] + del * (o[62] + del * ((8.339879741676 + o[1] * ((-24.227898028284) + o[16] * ((-0.394308658435022) - 37.1249078732399 * o[17]))) * tau + del * (((-3.55811483429912) + o[1] * (14.4915313151573 + 73.3433480914857 * o[19])) * tau + del * (0.5385256313166 + o[1] * ((-4.9370434888431) - 66.1323806535054 * o[20]) + del * ((1.1311290199811 + 25.6405943788192 * o[21]) * tau + del * ((-0.189047211378872 * tau) + del * ((-3.08554383331418 * o[48]) + del * (del * ((-0.0016557679795037) - 0.0128482351316791 * del * o[48]) + (0.0104261316530551 + 0.756028370066837 * o[21]) * tau))))))));
+      f.fdeltatautau := (-2.5308630955428) + o[53] + del * ((-3.40858835296824) + o[2] * (293.833689251262 + ((-256.221984958506) + o[15] * (36.4245760763383 + 163.259309516004 * o[2])) * tau) + del * (8.339879741676 + o[1] * ((-72.683694084852) + o[16] * ((-5.91462987652534) - 928.122696830999 * o[17])) + del * ((-3.55811483429912) + o[1] * (43.4745939454718 + 1833.58370228714 * o[19]) + del * (del * (1.1311290199811 + 641.014859470479 * o[21] + del * ((-0.189047211378872) + del * ((-77.1385958328544 * o[21]) + del * (0.0104261316530551 + 18.9007092516709 * o[21] - 0.321205878291977 * o[21] * o[32])))) + ((-9.8740869776862) - 1653.30951633764 * o[20]) * tau))));
+      f.fdeltadeltatau := o[62] + del * ((16.679759483352 + o[1] * ((-48.455796056568) + o[16] * ((-0.788617316870045) - 74.2498157464799 * o[17]))) * tau + del * (((-10.6743445028974) + o[1] * (43.4745939454718 + 220.030044274457 * o[19])) * tau + del * (2.1541025252664 + o[1] * ((-19.7481739553724) - 264.529522614022 * o[20]) + del * ((5.65564509990552 + 128.202971894096 * o[21]) * tau + del * ((-1.13428326827323 * tau) + del * ((-21.5988068331992 * o[48]) + del * (del * ((-0.0149019118155333) - 0.128482351316791 * del * o[48]) + (0.0834090532244409 + 6.0482269605347 * o[21]) * tau)))))));
+    end f3L3;
+
+    function g5L3 "base function for region 5: g(p,T), including 3rd derivatives"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      output ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd g "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+    protected
+      Real tau "dimensionless temperature";
+      Real pi "dimensionless pressure";
+      Real[16] o "vector of auxiliary variables";
+    algorithm
+      assert(p > ThermoSysPro.Properties.WaterSteam.BaseIF97.triple.ptriple, "IF97 medium function g5 called with too low pressure\n" + "p = " + String(p) + " Pa <= " + String(ThermoSysPro.Properties.WaterSteam.BaseIF97.triple.ptriple) + " Pa (triple point pressure)");
+      assert(p <= ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PLIMIT5, "IF97 medium function g5: input pressure (= " + String(p) + " Pa) is higher than 10 Mpa in region 5");
+      assert(T <= 2273.15, "IF97 medium function g5: input temperature (= " + String(T) + " K) is higher than limit of 2273.15K in region 5");
+      g.p := p;
+      g.T := T;
+      g.R := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
+      pi := p / ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PSTAR5;
+      tau := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TSTAR5 / T;
+      g.pi := pi;
+      g.tau := tau;
+      o[1] := tau * tau;
+      o[2] := -0.004594282089991 * o[1];
+      o[3] := 0.0021774678714571 + o[2];
+      o[4] := o[3] * tau;
+      o[5] := o[1] * tau;
+      o[6] := o[1] * o[1];
+      o[7] := o[6] * o[6];
+      o[8] := o[7] * tau;
+      o[9] := -7.9449656719138e-6 * o[8];
+      o[10] := pi * pi;
+      o[11] := o[10] * pi;
+      o[12] := -0.013782846269973 * o[1];
+      o[13] := -0.027565692539946 * tau;
+      o[14] := o[1] * o[6] * tau;
+      o[15] := o[1] * o[6];
+      o[16] := -0.0000715046910472242 * o[7];
+      g.g := pi * ((-0.00012563183589592) + o[4] + pi * ((-3.9724828359569e-6 * o[8]) + 1.2919228289784e-7 * o[5] * pi)) + ((-0.024805148933466) + tau * (0.36901534980333 + tau * ((-3.1161318213925) + tau * ((-13.179983674201) + (6.8540841634434 - 0.32961626538917 * tau) * tau + Modelica.Math.log(pi))))) / o[5];
+      g.gpi := (1.0 + pi * ((-0.00012563183589592) + o[4] + pi * (o[9] + 3.8757684869352e-7 * o[5] * pi))) / pi;
+      g.gpipi := ((-1.0) + o[10] * (o[9] + 7.7515369738704e-7 * o[5] * pi)) / o[10];
+      g.gpipipi := (2.0 + 7.7515369738704e-7 * o[11] * o[5]) / o[11];
+      g.gtau := pi * (0.0021774678714571 + o[12] + pi * ((-0.0000357523455236121 * o[7]) + 3.8757684869352e-7 * o[1] * pi)) + (0.074415446800398 + tau * ((-0.73803069960666) + (3.1161318213925 + o[1] * (6.8540841634434 - 0.65923253077834 * tau)) * tau)) / o[6];
+      g.gtautau := ((-0.297661787201592) + tau * (2.21409209881998 + ((-6.232263642785) - 0.65923253077834 * o[5]) * tau)) / (o[6] * tau) + pi * (o[13] + pi * ((-0.000286018764188897 * o[14]) + 7.7515369738704e-7 * pi * tau));
+      g.gtautautau := pi * ((-0.027565692539946) + ((-0.00200213134932228 * o[15]) + 7.7515369738704e-7 * pi) * pi) + (1.48830893600796 + tau * ((-8.85636839527992) + 18.696790928355 * tau)) / o[15];
+      g.gpitau := 0.0021774678714571 + o[12] + pi * (o[16] + 1.16273054608056e-6 * o[1] * pi);
+      g.gpipitau := o[16] + 2.32546109216112e-6 * o[1] * pi;
+      g.gpitautau := o[13] + pi * ((-0.000572037528377794 * o[14]) + 2.32546109216112e-6 * pi * tau);
+    end g5L3;
+    annotation(
+      Documentation(info = "<HTML><h4>Package description</h4>
           <p>Package BaseIF97/Basic computes the the fundamental functions for the 5 regions of the steam tables
           as described in the standards document <a href=\"Documentation/IF97documentation/IF97.pdf\">IF97.pdf</a>. The code of these
           functions has been generated using <b><i>Mathematica</i></b> and the add-on packages \"Format\" and \"Optimize\"
@@ -4667,8 +2997,8 @@
           <li>Documentation added: December 2002</li>
           </ul>
           </HTML>
-          "),   Documentation(
-     info="<html>
+          "),
+      Documentation(info = "<html>
        <p>
        &nbsp;Equation from:<br>
        <div style=\"text-align: center;\">&nbsp;[1] The international Association
@@ -4681,427 +3011,254 @@
        the Thermodynamic Properties of<br>
        &nbsp;Water and Steam</div>
        </p>
-       </html>"),
-      Icon(graphics={
-          Text(
-            extent={{-102,0},{24,-26}},
-            lineColor={242,148,0},
-            textString=
-                 "Thermo"),
-          Text(
-            extent={{-4,8},{68,-34}},
-            lineColor={46,170,220},
-            textString=
-                 "SysPro"),
-          Polygon(
-            points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},{
-                42,8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},{
-                -50,6},{-62,2}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{-46,
-                8},{-42,22},{-42,30},{-44,38}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{-12,
-                12},{-26,12},{-28,12},{-26,20}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,30},{-6,26}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,36},{-6,32}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,42},{-6,38}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,48},{-6,44}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,32},{-2,28}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,38},{-2,34}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,44},{-2,40}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,50},{-2,46}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{-2,
-                20}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},{
-                42,6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},{
-                -50,6},{-62,2}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Line(
-            points={{22,12},{22,14},{22,16},{24,14},{20,18}},
-            color={46,170,220},
-            thickness=0.5),
-          Line(
-            points={{26,12},{26,14},{26,16},{28,14},{24,18}},
-            color={46,170,220},
-            thickness=0.5),
-          Line(
-            points={{30,10},{30,12},{30,14},{32,12},{28,16}},
-            color={46,170,220},
-            thickness=0.5),
-          Polygon(
-            points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}),
-          Line(
-            points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}},
-            color={0,0,255},
-            smooth=Smooth.None),
-          Line(
-            points={{80,80},{100,100}},
-            color={0,0,255},
-            smooth=Smooth.None)}));
-  end Basic;
-
-  package Transport "transport properties for water according to IAPWS/IF97"
-
-    function visc_dT "dynamic viscosity eta(d,T), industrial formulation"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      output Modelica.SIunits.DynamicViscosity eta "dynamic viscosity";
-    protected
-      constant Real n0=1.0 "viscosity coefficient";
-      constant Real n1=0.978197 "viscosity coefficient";
-      constant Real n2=0.579829 "viscosity coefficient";
-      constant Real n3=-0.202354 "viscosity coefficient";
-      constant Real[42] nn=array(0.5132047, 0.3205656, 0.0, 0.0, -0.7782567,
-          0.1885447, 0.2151778, 0.7317883, 1.241044, 1.476783, 0.0, 0.0, -0.2818107,
-           -1.070786, -1.263184, 0.0, 0.0, 0.0, 0.1778064, 0.460504,
-          0.2340379, -0.4924179, 0.0, 0.0, -0.0417661, 0.0, 0.0, 0.1600435,
-          0.0, 0.0, 0.0, -0.01578386, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.003629481,
-           0.0, 0.0) "viscosity coefficients";
-      constant Modelica.SIunits.Density rhostar=317.763 "scaling density";
-      constant Modelica.SIunits.DynamicViscosity etastar=55.071e-6
-        "scaling viscosity";
-      constant Modelica.SIunits.Temperature tstar=647.226 "scaling temperature";
-      Integer i "auxiliary variable";
-      Integer j "auxiliary variable";
-      Real delta "dimensionless density";
-      Real deltam1 "dimensionless density";
-      Real tau "dimensionless temperature";
-      Real taum1 "dimensionless temperature";
-      Real Psi0 "auxiliary variable";
-      Real Psi1 "auxiliary variable";
-      Real tfun "auxiliary variable";
-      Real rhofun "auxiliary variable";
-      Real Tc=T - 273.15 "Celsius temperature for region check";
-      //      Integer region "region of IF97";
-    algorithm
-      delta := max(d,triple.dvtriple)/rhostar;
-    //   assert(d > triple.dvtriple,
-    //     "IF97 medium function visc_dTp for viscosity called with too low density\n" +
-    //     "d = " + String(d) + " <= " + String(triple.dvtriple) + " (triple point density)");
-      deltam1 := delta - 1.0;
-      tau := tstar/T;
-      taum1 := tau - 1.0;
-      Psi0 := 1/(n0 + (n1 + (n2 + n3*tau)*tau)*tau)/(tau^0.5);
-      Psi1 := 0.0;
-      tfun := 1.0;
-      for i in 1:6 loop
-        if (i <> 1) then
-          tfun := tfun*taum1;
-        end if;
-        rhofun := 1.;
-        for j in 0:6 loop
-          if (j <> 0) then
-            rhofun := rhofun*deltam1;
-          end if;
-          Psi1 := Psi1 + nn[i + j*6]*tfun*rhofun;
-        end for;
-      end for;
-      eta := etastar*Psi0*Modelica.Math.exp(delta*Psi1);
-      annotation(smoothOrder=5);
-    end visc_dT;
-
-    function cond_dTp
-      "Thermal conductivity lam(d,T,p) (industrial use version) only in one-phase region"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      input Modelica.SIunits.Pressure p "pressure";
-      input Integer phase=0 "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Boolean industrialMethod=true
-        "if true, the industrial method is used, otherwise the scientific one";
-      output Modelica.SIunits.ThermalConductivity lambda "thermal conductivity";
-    protected
-      Integer region(min=1, max=5) "IF97 region, valid values:1,2,3, and 5";
-      constant Real n0=1.0 "conductivity coefficient";
-      constant Real n1=6.978267 "conductivity coefficient";
-      constant Real n2=2.599096 "conductivity coefficient";
-      constant Real n3=-0.998254 "conductivity coefficient";
-      constant Real[30] nn=array(1.3293046, 1.7018363, 5.2246158, 8.7127675,
-          -1.8525999, -0.40452437, -2.2156845, -10.124111, -9.5000611,
-          0.9340469, 0.2440949, 1.6511057, 4.9874687, 4.3786606, 0.0,
-          0.018660751, -0.76736002, -0.27297694, -0.91783782, 0.0, -0.12961068,
-           0.37283344, -0.43083393, 0.0, 0.0, 0.044809953, -0.1120316,
-          0.13333849, 0.0, 0.0) "conductivity coefficient";
-      constant Modelica.SIunits.ThermalConductivity lamstar=0.4945
-        "scaling conductivity";
-      constant Modelica.SIunits.Density rhostar=317.763 "scaling density";
-      constant Modelica.SIunits.Temperature tstar=647.226 "scaling temperature";
-      constant Modelica.SIunits.Pressure pstar=22.115e6 "scaling pressure";
-      constant Modelica.SIunits.DynamicViscosity etastar=55.071e-6
-        "scaling viscosity";
-      Integer i "auxiliary variable";
-      Integer j "auxiliary variable";
-      Real delta "dimensionless density";
-      Real tau "dimensionless temperature";
-      Real deltam1 "dimensionless density";
-      Real taum1 "dimensionless temperature";
-      Real Lam0 "part of thermal conductivity";
-      Real Lam1 "part of thermal conductivity";
-      Real Lam2 "part of thermal conductivity";
-      Real tfun "auxiliary variable";
-      Real rhofun "auxiliary variable";
-      Real dpitau "auxiliary variable";
-      Real ddelpi "auxiliary variable";
-      Real d2 "auxiliary variable";
-      Modelica.Media.Common.GibbsDerivs g
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      Modelica.Media.Common.HelmholtzDerivs f
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-      Real Tc=T - 273.15 "Celsius temperature for region check";
-      Real Chi "symmetrized compressibility";
-      // slightly different variables for industrial use
-      constant Modelica.SIunits.Density rhostar2=317.7 "Reference density";
-      constant Modelica.SIunits.Temperature Tstar2=647.25
-        "Reference temperature";
-      constant Modelica.SIunits.ThermalConductivity lambdastar=1
-        "Reference thermal conductivity";
-      parameter Real TREL=T/Tstar2 "Relative temperature";
-      parameter Real rhoREL=d/rhostar2 "Relative density";
-      Real lambdaREL "Relative thermal conductivity";
-      Real deltaTREL "Relative temperature increment";
-      constant Real[:] C={0.642857,-4.11717,-6.17937,0.00308976,0.0822994,
-          10.0932};
-      constant Real[:] dpar={0.0701309,0.0118520,0.00169937,-1.0200};
-      constant Real[:] b={-0.397070,0.400302,1.060000};
-      constant Real[:] B={-0.171587,2.392190};
-      constant Real[:] a={0.0102811,0.0299621,0.0156146,-0.00422464};
-      Real Q;
-      Real S;
-      Real lambdaREL2
-        "function, part of the interpolating equation of the thermal conductivity";
-      Real lambdaREL1
-        "function, part of the interpolating equation of the thermal conductivity";
-      Real lambdaREL0
-        "function, part of the interpolating equation of the thermal conductivity";
-    algorithm
-      // region := BaseIF97.Regions.region_dT(d,T,phase);
-      // simplified region check, assuming that calling arguments are legal
-      //  assert(phase <> 2,
-      //   "thermalConductivity can not be called with 2-phase inputs!");
-      assert(d > triple.dvtriple,
-        "IF97 medium function cond_dTp called with too low density\n" +
-        "d = " + String(d) + " <= " + String(triple.dvtriple) + " (triple point density)");
-      assert((p <= 100e6 and (Tc >= 0.0 and Tc <= 500)) or
-      (p <= 70e6 and (Tc > 500.0 and Tc <= 650)) or
-      (p <= 40e6 and (Tc > 650.0 and Tc <= 800)),
-      "IF97 medium function cond_dTp: thermal conductivity computed outside the range\n" +
-      "of validity of the IF97 formulation: p = " + String(p) + " Pa, Tc = " + String(Tc) + " K");
-      if industrialMethod == true then
-        deltaTREL := abs(TREL - 1) + C[4];
-        Q := 2 + C[5]/deltaTREL^(3/5);
-        if TREL >= 1 then
-          S := 1/deltaTREL;
-        else
-          S := C[6]/deltaTREL^(3/5);
-        end if;
-        lambdaREL2 := (dpar[1]/TREL^10 + dpar[2])*rhoREL^(9/5)*Modelica.Math.exp(C[1]*(1 - rhoREL^(14
-          /5))) + dpar[3]*S*rhoREL^Q*Modelica.Math.exp((Q/(1 + Q))*(1 -
-          rhoREL^(1 + Q))) + dpar[4]*Modelica.Math.exp(C[2]*TREL^(3/2) + C[3]
-          /rhoREL^5);
-        lambdaREL1 := b[1] + b[2]*rhoREL + b[3]*Modelica.Math.exp(B[1]*(
-          rhoREL + B[2])^2);
-        lambdaREL0 := TREL^(1/2)*sum(a[i]*TREL^(i - 1) for i in 1:4);
-        lambdaREL := lambdaREL0 + lambdaREL1 + lambdaREL2;
-        lambda := lambdaREL*lambdastar;
-      else
-        if p < data.PLIMIT4A then
-          //regions are 1 or 2,
-          if d > data.DCRIT then
-     region := 1;
-          else
-     region := 2;
-          end if;
-        else
-          //region is 3, or illegal
-          assert(false,
-            "the scientific method works only for temperatures up to 623.15 K");
-        end if;
-        tau := tstar/T;
-        delta := d/rhostar;
-        deltam1 := delta - 1.0;
-        taum1 := tau - 1.0;
-        Lam0 := 1/(n0 + (n1 + (n2 + n3*tau)*tau)*tau)/(tau^0.5);
-        Lam1 := 0.0;
-        tfun := 1.0;
-        for
-     i in 1:5 loop
-          if (i <> 1) then
-     tfun := tfun*taum1;
-          end if;
-          rhofun := 1.0;
-          for
-       j in 0:5 loop
-     if (j <> 0) then
-              rhofun := rhofun*deltam1;
-     end if;
-     Lam1 := Lam1 + nn[i + j*5]*tfun*rhofun;
-          end for;
-        end for;
-        if (region == 1) then
-          g := Basic.g1(p, T);
-          // dp/dT @ cont d = -g.p/g.T*(g.gpi - g.tau*g.gtaupi)/(g.gpipi*g.pi);
-          dpitau := -tstar/pstar*(data.PSTAR1*(g.gpi - data.TSTAR1/T*g.gtaupi)
-            /g.gpipi/T);
-          ddelpi := -pstar/rhostar*data.RH2O/data.PSTAR1/data.PSTAR1*T*d*d*g.
-            gpipi;
-          Chi := delta*ddelpi;
-        elseif (region == 2) then
-          g := Basic.g2(p, T);
-          dpitau := -tstar/pstar*(data.PSTAR2*(g.gpi - data.TSTAR2/T*g.gtaupi)
-            /g.gpipi/T);
-          ddelpi := -pstar/rhostar*data.RH2O/data.PSTAR2/data.PSTAR2*T*d*d*g.
-            gpipi;
-          Chi := delta*ddelpi;
-          //         elseif (region == 3) then
-          //           f := Basic.f3(T, d);
-          //            dpitau := tstar/pstar*(f.R*f.d*f.delta*(f.fdelta - f.tau*f.fdeltatau));
-          //           ddelpi := pstar*d*d/(rhostar*p*p)/(f.R*f.T*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta));
-          //    Chi := delta*ddelpi;
-        else
-          assert(false,
-            "thermal conductivity can only be called in the one-phase regions below 623.15 K\n" +
-            "(p = " + String(p) + " Pa, T = " + String(T) + " K, region = " + String(region) + ")");
-        end if;
-        taum1 := 1/tau - 1;
-        d2 := deltam1*deltam1;
-        Lam2 := 0.0013848*etastar/visc_dT(d, T)/(tau*tau*delta*delta)*
-          dpitau*dpitau*max(Chi, Modelica.Constants.small)^0.4678*(delta)^0.5
-          *Modelica.Math.exp(-18.66*taum1*taum1 - d2*d2);
-        lambda := lamstar*(Lam0*Modelica.Math.exp(delta*Lam1) + Lam2);
-      end if;
-      annotation(smoothOrder=5);
-    end cond_dTp;
-
-    function surfaceTension
-      "surface tension in region 4 between steam and water"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      output Modelica.SIunits.SurfaceTension sigma
-        "surface tension in SI units";
-    protected
-      Real Theta "dimensionless temperature";
-    algorithm
-      Theta := min(1.0,T/data.TCRIT);
-      sigma := 235.8e-3*(1 - Theta)^1.256*(1 - 0.625*(1 - Theta));
-      annotation(smoothOrder=5);
-    end surfaceTension;
-
-    function cond_industrial_dT
-      "Thermal conductivity lam(d,T) (industrial use version) only in one-phase region"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      output Modelica.SIunits.ThermalConductivity lambda "thermal conductivity";
-    protected
-      constant Modelica.SIunits.Density rhostar2=317.7 "Reference density";
-      constant Modelica.SIunits.Temperature Tstar2=647.25
-        "Reference temperature";
-      constant Modelica.SIunits.ThermalConductivity lambdastar=1
-        "Reference thermal conductivity";
-      constant Real[:] C={0.642857,-4.11717,-6.17937,0.00308976,0.0822994,
-          10.0932};
-      constant Real[:] dpar={0.0701309,0.0118520,0.00169937,-1.0200};
-      constant Real[:] b={-0.397070,0.400302,1.060000};
-      constant Real[:] B={-0.171587,2.392190};
-      constant Real[:] a={0.0102811,0.0299621,0.0156146,-0.00422464};
-      Integer region(min=1, max=5) "IF97 region, valid values:1,2,3, and 5";
-      Real TREL "Relative temperature";
-      Real rhoREL "Relative density";
-      Real lambdaREL "Relative thermal conductivity";
-      Real deltaTREL "Relative temperature increment";
-      Real Q;
-      Real S;
-      Real lambdaREL2
-        "function, part of the interpolating equation of the thermal conductivity";
-      Real lambdaREL1
-        "function, part of the interpolating equation of the thermal conductivity";
-      Real lambdaREL0
-        "function, part of the interpolating equation of the thermal conductivity";
-    algorithm
-      assert(d > triple.dvtriple,
-        "IF97 medium function cond_dTp called with too low density\n" +
-        "d = " + String(d) + " <= " + String(triple.dvtriple) + " (triple point density)");
-       TREL := T/Tstar2;
-       rhoREL := d/rhostar2;
-       deltaTREL := abs(TREL - 1) + C[4];
-       Q := 2 + C[5]/deltaTREL^(3/5);
-       S := if TREL >= 1 then  1/deltaTREL else C[6]/deltaTREL^(3/5);
-        lambdaREL2 := (dpar[1]/TREL^10 + dpar[2])*rhoREL^(9/5)*Modelica.Math.exp(C[1]*(1 - rhoREL^(14
-          /5))) + dpar[3]*S*rhoREL^Q*Modelica.Math.exp((Q/(1 + Q))*(1 -
-          rhoREL^(1 + Q))) + dpar[4]*Modelica.Math.exp(C[2]*TREL^(3/2) + C[3]
-          /rhoREL^5);
-        lambdaREL1 := b[1] + b[2]*rhoREL + b[3]*Modelica.Math.exp(B[1]*(
-          rhoREL + B[2])^2);
-        lambdaREL0 := TREL^(1/2)*sum(a[i]*TREL^(i - 1) for i in 1:4);
-        lambdaREL := lambdaREL0 + lambdaREL1 + lambdaREL2;
-        lambda := lambdaREL*lambdastar;
-      annotation(smoothOrder=5);
-    end cond_industrial_dT;
-    annotation (Documentation(info="<HTML><h4>Package description</h4>
+       </html>"),
+      Icon(graphics = {Text(extent = {{-102, 0}, {24, -26}}, lineColor = {242, 148, 0}, textString = "Thermo"), Text(extent = {{-4, 8}, {68, -34}}, lineColor = {46, 170, 220}, textString = "SysPro"), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-32, 12}, {-16, 14}, {6, 14}, {26, 12}, {42, 8}, {52, 2}, {42, 6}, {28, 10}, {6, 12}, {-12, 12}, {-16, 12}, {-34, 10}, {-50, 6}, {-62, 2}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-44, 38}, {-24, 38}, {-26, 30}, {-26, 22}, {-24, 14}, {-24, 12}, {-46, 8}, {-42, 22}, {-42, 30}, {-44, 38}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-26, 20}, {-20, 20}, {-20, 22}, {-14, 22}, {-14, 20}, {-12, 20}, {-12, 12}, {-26, 12}, {-28, 12}, {-26, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-8, 14}, {-8, 24}, {-6, 24}, {-6, 14}, {-8, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 30}, {-6, 26}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 36}, {-6, 32}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 42}, {-6, 38}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 48}, {-6, 44}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-4, 14}, {-4, 26}, {-2, 26}, {-2, 14}, {-4, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 32}, {-2, 28}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 38}, {-2, 34}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 44}, {-2, 40}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 50}, {-2, 46}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-2, 20}, {8, 20}, {8, 22}, {10, 22}, {18, 22}, {18, 12}, {-4, 14}, {-2, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-36, 10}, {-18, 12}, {6, 12}, {26, 10}, {42, 6}, {52, 0}, {42, 4}, {28, 8}, {6, 10}, {-12, 10}, {-18, 10}, {-38, 8}, {-50, 6}, {-62, 2}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Line(points = {{22, 12}, {22, 14}, {22, 16}, {24, 14}, {20, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{26, 12}, {26, 14}, {26, 16}, {28, 14}, {24, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{30, 10}, {30, 12}, {30, 14}, {32, 12}, {28, 16}}, color = {46, 170, 220}, thickness = 0.5), Polygon(points = {{36, 8}, {36, 30}, {34, 34}, {36, 38}, {40, 38}, {40, 8}, {36, 8}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 80}, {80, -100}}, lineColor = {0, 0, 255}), Line(points = {{-100, 80}, {-80, 100}, {100, 100}, {100, -80}, {80, -100}}, color = {0, 0, 255}, smooth = Smooth.None), Line(points = {{80, 80}, {100, 100}}, color = {0, 0, 255}, smooth = Smooth.None)}));
+  end Basic;
+
+  package Transport "transport properties for water according to IAPWS/IF97"
+    function visc_dT "dynamic viscosity eta(d,T), industrial formulation"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      output Modelica.Units.SI.DynamicViscosity eta "dynamic viscosity";
+    protected
+      constant Real n0 = 1.0 "viscosity coefficient";
+      constant Real n1 = 0.978197 "viscosity coefficient";
+      constant Real n2 = 0.579829 "viscosity coefficient";
+      constant Real n3 = -0.202354 "viscosity coefficient";
+      constant Real[42] nn = array(0.5132047, 0.3205656, 0.0, 0.0, -0.7782567, 0.1885447, 0.2151778, 0.7317883, 1.241044, 1.476783, 0.0, 0.0, -0.2818107, -1.070786, -1.263184, 0.0, 0.0, 0.0, 0.1778064, 0.460504, 0.2340379, -0.4924179, 0.0, 0.0, -0.0417661, 0.0, 0.0, 0.1600435, 0.0, 0.0, 0.0, -0.01578386, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.003629481, 0.0, 0.0) "viscosity coefficients";
+      constant Modelica.Units.SI.Density rhostar = 317.763 "scaling density";
+      constant Modelica.Units.SI.DynamicViscosity etastar = 55.071e-6 "scaling viscosity";
+      constant Modelica.Units.SI.Temperature tstar = 647.226 "scaling temperature";
+      Integer i "auxiliary variable";
+      Integer j "auxiliary variable";
+      Real delta "dimensionless density";
+      Real deltam1 "dimensionless density";
+      Real tau "dimensionless temperature";
+      Real taum1 "dimensionless temperature";
+      Real Psi0 "auxiliary variable";
+      Real Psi1 "auxiliary variable";
+      Real tfun "auxiliary variable";
+      Real rhofun "auxiliary variable";
+      Real Tc = T - 273.15 "Celsius temperature for region check";
+      //      Integer region "region of IF97";
+    algorithm
+      delta := max(d, triple.dvtriple) / rhostar;
+//   assert(d > triple.dvtriple,
+//     "IF97 medium function visc_dTp for viscosity called with too low density\n" +
+//     "d = " + String(d) + " <= " + String(triple.dvtriple) + " (triple point density)");
+      deltam1 := delta - 1.0;
+      tau := tstar / T;
+      taum1 := tau - 1.0;
+      Psi0 := 1 / (n0 + (n1 + (n2 + n3 * tau) * tau) * tau) / tau ^ 0.5;
+      Psi1 := 0.0;
+      tfun := 1.0;
+      for i in 1:6 loop
+        if i <> 1 then
+          tfun := tfun * taum1;
+        end if;
+        rhofun := 1.;
+        for j in 0:6 loop
+          if j <> 0 then
+            rhofun := rhofun * deltam1;
+          end if;
+          Psi1 := Psi1 + nn[i + j * 6] * tfun * rhofun;
+        end for;
+      end for;
+      eta := etastar * Psi0 * Modelica.Math.exp(delta * Psi1);
+      annotation(
+        smoothOrder = 5);
+    end visc_dT;
+
+    function cond_dTp "Thermal conductivity lam(d,T,p) (industrial use version) only in one-phase region"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Boolean industrialMethod = true "if true, the industrial method is used, otherwise the scientific one";
+      output Modelica.Units.SI.ThermalConductivity lambda "thermal conductivity";
+    protected
+      Integer region(min = 1, max = 5) "IF97 region, valid values:1,2,3, and 5";
+      constant Real n0 = 1.0 "conductivity coefficient";
+      constant Real n1 = 6.978267 "conductivity coefficient";
+      constant Real n2 = 2.599096 "conductivity coefficient";
+      constant Real n3 = -0.998254 "conductivity coefficient";
+      constant Real[30] nn = array(1.3293046, 1.7018363, 5.2246158, 8.7127675, -1.8525999, -0.40452437, -2.2156845, -10.124111, -9.5000611, 0.9340469, 0.2440949, 1.6511057, 4.9874687, 4.3786606, 0.0, 0.018660751, -0.76736002, -0.27297694, -0.91783782, 0.0, -0.12961068, 0.37283344, -0.43083393, 0.0, 0.0, 0.044809953, -0.1120316, 0.13333849, 0.0, 0.0) "conductivity coefficient";
+      constant Modelica.Units.SI.ThermalConductivity lamstar = 0.4945 "scaling conductivity";
+      constant Modelica.Units.SI.Density rhostar = 317.763 "scaling density";
+      constant Modelica.Units.SI.Temperature tstar = 647.226 "scaling temperature";
+      constant Modelica.Units.SI.Pressure pstar = 22.115e6 "scaling pressure";
+      constant Modelica.Units.SI.DynamicViscosity etastar = 55.071e-6 "scaling viscosity";
+      Integer i "auxiliary variable";
+      Integer j "auxiliary variable";
+      Real delta "dimensionless density";
+      Real tau "dimensionless temperature";
+      Real deltam1 "dimensionless density";
+      Real taum1 "dimensionless temperature";
+      Real Lam0 "part of thermal conductivity";
+      Real Lam1 "part of thermal conductivity";
+      Real Lam2 "part of thermal conductivity";
+      Real tfun "auxiliary variable";
+      Real rhofun "auxiliary variable";
+      Real dpitau "auxiliary variable";
+      Real ddelpi "auxiliary variable";
+      Real d2 "auxiliary variable";
+      Modelica.Media.Common.GibbsDerivs g "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      Modelica.Media.Common.HelmholtzDerivs f "dimensionless Helmholtz function and dervatives wrt delta and tau";
+      Real Tc = T - 273.15 "Celsius temperature for region check";
+      Real Chi "symmetrized compressibility";
+      // slightly different variables for industrial use
+      constant Modelica.Units.SI.Density rhostar2 = 317.7 "Reference density";
+      constant Modelica.Units.SI.Temperature Tstar2 = 647.25 "Reference temperature";
+      constant Modelica.Units.SI.ThermalConductivity lambdastar = 1 "Reference thermal conductivity";
+      parameter Real TREL = T / Tstar2 "Relative temperature";
+      parameter Real rhoREL = d / rhostar2 "Relative density";
+      Real lambdaREL "Relative thermal conductivity";
+      Real deltaTREL "Relative temperature increment";
+      constant Real[:] C = {0.642857, -4.11717, -6.17937, 0.00308976, 0.0822994, 10.0932};
+      constant Real[:] dpar = {0.0701309, 0.0118520, 0.00169937, -1.0200};
+      constant Real[:] b = {-0.397070, 0.400302, 1.060000};
+      constant Real[:] B = {-0.171587, 2.392190};
+      constant Real[:] a = {0.0102811, 0.0299621, 0.0156146, -0.00422464};
+      Real Q;
+      Real S;
+      Real lambdaREL2 "function, part of the interpolating equation of the thermal conductivity";
+      Real lambdaREL1 "function, part of the interpolating equation of the thermal conductivity";
+      Real lambdaREL0 "function, part of the interpolating equation of the thermal conductivity";
+    algorithm
+// region := BaseIF97.Regions.region_dT(d,T,phase);
+// simplified region check, assuming that calling arguments are legal
+//  assert(phase <> 2,
+//   "thermalConductivity can not be called with 2-phase inputs!");
+      assert(d > triple.dvtriple, "IF97 medium function cond_dTp called with too low density\n" + "d = " + String(d) + " <= " + String(triple.dvtriple) + " (triple point density)");
+      assert(p <= 100e6 and Tc >= 0.0 and Tc <= 500 or p <= 70e6 and Tc > 500.0 and Tc <= 650 or p <= 40e6 and Tc > 650.0 and Tc <= 800, "IF97 medium function cond_dTp: thermal conductivity computed outside the range\n" + "of validity of the IF97 formulation: p = " + String(p) + " Pa, Tc = " + String(Tc) + " K");
+      if industrialMethod == true then
+        deltaTREL := abs(TREL - 1) + C[4];
+        Q := 2 + C[5] / deltaTREL ^ (3 / 5);
+        if TREL >= 1 then
+          S := 1 / deltaTREL;
+        else
+          S := C[6] / deltaTREL ^ (3 / 5);
+        end if;
+        lambdaREL2 := (dpar[1] / TREL ^ 10 + dpar[2]) * rhoREL ^ (9 / 5) * Modelica.Math.exp(C[1] * (1 - rhoREL ^ (14 / 5))) + dpar[3] * S * rhoREL ^ Q * Modelica.Math.exp(Q / (1 + Q) * (1 - rhoREL ^ (1 + Q))) + dpar[4] * Modelica.Math.exp(C[2] * TREL ^ (3 / 2) + C[3] / rhoREL ^ 5);
+        lambdaREL1 := b[1] + b[2] * rhoREL + b[3] * Modelica.Math.exp(B[1] * (rhoREL + B[2]) ^ 2);
+        lambdaREL0 := TREL ^ (1 / 2) * sum(a[i] * TREL ^ (i - 1) for i in 1:4);
+        lambdaREL := lambdaREL0 + lambdaREL1 + lambdaREL2;
+        lambda := lambdaREL * lambdastar;
+      else
+        if p < data.PLIMIT4A then
+          if d > data.DCRIT then
+            region := 1;
+          else
+            region := 2;
+          end if;
+        else
+          assert(false, "the scientific method works only for temperatures up to 623.15 K");
+        end if;
+        tau := tstar / T;
+        delta := d / rhostar;
+        deltam1 := delta - 1.0;
+        taum1 := tau - 1.0;
+        Lam0 := 1 / (n0 + (n1 + (n2 + n3 * tau) * tau) * tau) / tau ^ 0.5;
+        Lam1 := 0.0;
+        tfun := 1.0;
+        for i in 1:5 loop
+          if i <> 1 then
+            tfun := tfun * taum1;
+          end if;
+          rhofun := 1.0;
+          for j in 0:5 loop
+            if j <> 0 then
+              rhofun := rhofun * deltam1;
+            end if;
+            Lam1 := Lam1 + nn[i + j * 5] * tfun * rhofun;
+          end for;
+        end for;
+        if region == 1 then
+          g := Basic.g1(p, T);
+          dpitau := -tstar / pstar * (data.PSTAR1 * (g.gpi - data.TSTAR1 / T * g.gtaupi) / g.gpipi / T);
+          ddelpi := -pstar / rhostar * data.RH2O / data.PSTAR1 / data.PSTAR1 * T * d * d * g.gpipi;
+          Chi := delta * ddelpi;
+        elseif region == 2 then
+          g := Basic.g2(p, T);
+          dpitau := -tstar / pstar * (data.PSTAR2 * (g.gpi - data.TSTAR2 / T * g.gtaupi) / g.gpipi / T);
+          ddelpi := -pstar / rhostar * data.RH2O / data.PSTAR2 / data.PSTAR2 * T * d * d * g.gpipi;
+          Chi := delta * ddelpi;
+        else
+          assert(false, "thermal conductivity can only be called in the one-phase regions below 623.15 K\n" + "(p = " + String(p) + " Pa, T = " + String(T) + " K, region = " + String(region) + ")");
+        end if;
+        taum1 := 1 / tau - 1;
+        d2 := deltam1 * deltam1;
+        Lam2 := 0.0013848 * etastar / visc_dT(d, T) / (tau * tau * delta * delta) * dpitau * dpitau * max(Chi, Modelica.Constants.small) ^ 0.4678 * delta ^ 0.5 * Modelica.Math.exp((-18.66 * taum1 * taum1) - d2 * d2);
+        lambda := lamstar * (Lam0 * Modelica.Math.exp(delta * Lam1) + Lam2);
+      end if;
+//regions are 1 or 2,
+//region is 3, or illegal
+// dp/dT @ cont d = -g.p/g.T*(g.gpi - g.tau*g.gtaupi)/(g.gpipi*g.pi);
+//         elseif (region == 3) then
+//           f := Basic.f3(T, d);
+//            dpitau := tstar/pstar*(f.R*f.d*f.delta*(f.fdelta - f.tau*f.fdeltatau));
+//           ddelpi := pstar*d*d/(rhostar*p*p)/(f.R*f.T*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta));
+//    Chi := delta*ddelpi;
+      annotation(
+        smoothOrder = 5);
+    end cond_dTp;
+
+    function surfaceTension "surface tension in region 4 between steam and water"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      output Modelica.Units.SI.SurfaceTension sigma "surface tension in SI units";
+    protected
+      Real Theta "dimensionless temperature";
+    algorithm
+      Theta := min(1.0, T / data.TCRIT);
+      sigma := 235.8e-3 * (1 - Theta) ^ 1.256 * (1 - 0.625 * (1 - Theta));
+      annotation(
+        smoothOrder = 5);
+    end surfaceTension;
+
+    function cond_industrial_dT "Thermal conductivity lam(d,T) (industrial use version) only in one-phase region"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      output Modelica.Units.SI.ThermalConductivity lambda "thermal conductivity";
+    protected
+      constant Modelica.Units.SI.Density rhostar2 = 317.7 "Reference density";
+      constant Modelica.Units.SI.Temperature Tstar2 = 647.25 "Reference temperature";
+      constant Modelica.Units.SI.ThermalConductivity lambdastar = 1 "Reference thermal conductivity";
+      constant Real[:] C = {0.642857, -4.11717, -6.17937, 0.00308976, 0.0822994, 10.0932};
+      constant Real[:] dpar = {0.0701309, 0.0118520, 0.00169937, -1.0200};
+      constant Real[:] b = {-0.397070, 0.400302, 1.060000};
+      constant Real[:] B = {-0.171587, 2.392190};
+      constant Real[:] a = {0.0102811, 0.0299621, 0.0156146, -0.00422464};
+      Integer region(min = 1, max = 5) "IF97 region, valid values:1,2,3, and 5";
+      Real TREL "Relative temperature";
+      Real rhoREL "Relative density";
+      Real lambdaREL "Relative thermal conductivity";
+      Real deltaTREL "Relative temperature increment";
+      Real Q;
+      Real S;
+      Real lambdaREL2 "function, part of the interpolating equation of the thermal conductivity";
+      Real lambdaREL1 "function, part of the interpolating equation of the thermal conductivity";
+      Real lambdaREL0 "function, part of the interpolating equation of the thermal conductivity";
+    algorithm
+      assert(d > triple.dvtriple, "IF97 medium function cond_dTp called with too low density\n" + "d = " + String(d) + " <= " + String(triple.dvtriple) + " (triple point density)");
+      TREL := T / Tstar2;
+      rhoREL := d / rhostar2;
+      deltaTREL := abs(TREL - 1) + C[4];
+      Q := 2 + C[5] / deltaTREL ^ (3 / 5);
+      S := if TREL >= 1 then 1 / deltaTREL else C[6] / deltaTREL ^ (3 / 5);
+      lambdaREL2 := (dpar[1] / TREL ^ 10 + dpar[2]) * rhoREL ^ (9 / 5) * Modelica.Math.exp(C[1] * (1 - rhoREL ^ (14 / 5))) + dpar[3] * S * rhoREL ^ Q * Modelica.Math.exp(Q / (1 + Q) * (1 - rhoREL ^ (1 + Q))) + dpar[4] * Modelica.Math.exp(C[2] * TREL ^ (3 / 2) + C[3] / rhoREL ^ 5);
+      lambdaREL1 := b[1] + b[2] * rhoREL + b[3] * Modelica.Math.exp(B[1] * (rhoREL + B[2]) ^ 2);
+      lambdaREL0 := TREL ^ (1 / 2) * sum(a[i] * TREL ^ (i - 1) for i in 1:4);
+      lambdaREL := lambdaREL0 + lambdaREL1 + lambdaREL2;
+      lambda := lambdaREL * lambdastar;
+      annotation(
+        smoothOrder = 5);
+    end cond_industrial_dT;
+    annotation(
+      Documentation(info = "<HTML><h4>Package description</h4>
           <p></p>
           <h4>Package contents</h4>
           <p>
@@ -5136,687 +3293,380 @@
           <li>Initial version: October 2002</li>
           </ul>
           </HTML>
-          "), Icon(graphics={
-          Text(
-            extent={{-102,0},{24,-26}},
-            lineColor={242,148,0},
-            textString=
-                 "Thermo"),
-          Text(
-            extent={{-4,8},{68,-34}},
-            lineColor={46,170,220},
-            textString=
-                 "SysPro"),
-          Polygon(
-            points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},{
-                42,8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},{
-                -50,6},{-62,2}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{-46,
-                8},{-42,22},{-42,30},{-44,38}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{-12,
-                12},{-26,12},{-28,12},{-26,20}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,30},{-6,26}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,36},{-6,32}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,42},{-6,38}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,48},{-6,44}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,32},{-2,28}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,38},{-2,34}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,44},{-2,40}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,50},{-2,46}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{-2,
-                20}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},{
-                42,6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},{
-                -50,6},{-62,2}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Line(
-            points={{22,12},{22,14},{22,16},{24,14},{20,18}},
-            color={46,170,220},
-            thickness=0.5),
-          Line(
-            points={{26,12},{26,14},{26,16},{28,14},{24,18}},
-            color={46,170,220},
-            thickness=0.5),
-          Line(
-            points={{30,10},{30,12},{30,14},{32,12},{28,16}},
-            color={46,170,220},
-            thickness=0.5),
-          Polygon(
-            points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}),
-          Line(
-            points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}},
-            color={0,0,255},
-            smooth=Smooth.None),
-          Line(
-            points={{80,80},{100,100}},
-            color={0,0,255},
-            smooth=Smooth.None)}));
-  end Transport;
-
-  package Isentropic
-    "functions for calculating the isentropic enthalpy from pressure p and specific entropy s"
-
-    function hofpT1
-      "intermediate function for isentropic specific enthalpy in region 1"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    protected
-      Real[13] o "vector of auxiliary variables";
-      Real pi1 "dimensionless pressure";
-      Real tau "dimensionless temperature";
-      Real tau1 "dimensionless temperature";
-    algorithm
-      tau := data.TSTAR1/T;
-      pi1 := 7.1 - p/data.PSTAR1;
-      assert(p > triple.ptriple,
-        "IF97 medium function hofpT1  called with too low pressure\n" +
-        "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
-      tau1 := -1.222 + tau;
-      o[1] := tau1*tau1;
-      o[2] := o[1]*tau1;
-      o[3] := o[1]*o[1];
-      o[4] := o[3]*o[3];
-      o[5] := o[1]*o[4];
-      o[6] := o[1]*o[3];
-      o[7] := o[3]*tau1;
-      o[8] := o[3]*o[4];
-      o[9] := pi1*pi1;
-      o[10] := o[9]*o[9];
-      o[11] := o[10]*o[10];
-      o[12] := o[4]*o[4];
-      o[13] := o[12]*o[12];
-
-      h := data.RH2O*T*tau*(pi1*((-0.00254871721114236 + o[1]*(
-        0.00424944110961118 + (0.018990068218419 + (-0.021841717175414 -
-        0.00015851507390979*o[1])*o[1])*o[6]))/o[5] + pi1*((
-        0.00141552963219801 + o[3]*(0.000047661393906987 + o[1]*(-0.0000132425535992538
-         - 1.2358149370591e-14*o[1]*o[3]*o[4])))/o[3] + pi1*((
-        0.000126718579380216 - 5.11230768720618e-9*o[5])/o[7] + pi1*((
-        0.000011212640954 + o[2]*(1.30342445791202e-6 - 1.4341729937924e-12*o[
-        8]))/o[6] + pi1*(o[9]*pi1*((1.40077319158051e-8 + 1.04549227383804e-9
-        *o[7])/o[8] + o[10]*o[11]*pi1*(1.9941018075704e-17/(o[1]*o[12]*o[3]*o[
-        4]) + o[9]*(-4.48827542684151e-19/o[13] + o[10]*o[9]*(pi1*(
-        4.65957282962769e-22/(o[13]*o[4]) + pi1*((3.83502057899078e-24*pi1)/(
-        o[1]*o[13]*o[4]) - 7.2912378325616e-23/(o[13]*o[4]*tau1))) -
-        1.00075970318621e-21/(o[1]*o[13]*o[3]*tau1))))) + 3.24135974880936e-6
-        /(o[4]*tau1)))))) + (-0.29265942426334 + tau1*(0.84548187169114 + o[1]
-        *(3.3855169168385 + tau1*(-1.91583926775744 + tau1*(0.47316115539684
-         + (-0.066465668798004 + 0.0040607314991784*tau1)*tau1)))))/o[2]);
-    end hofpT1;
-
-    function handsofpT1
-      "special function for specific enthalpy and specific entropy in region 1"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      output Modelica.SIunits.SpecificEntropy s "specific entropy";
-    protected
-      Real[28] o "vector of auxiliary variables";
-      Real pi1 "dimensionless pressure";
-      Real tau "dimensionless temperature";
-      Real tau1 "dimensionless temperature";
-      Real g "dimensionless Gibbs energy";
-      Real gtau "derivative of  dimensionless Gibbs energy w.r.t. tau";
-    algorithm
-      assert(p > triple.ptriple,
-        "IF97 medium function handsofpT1 called with too low pressure\n" +
-        "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
-      tau := data.TSTAR1/T;
-      pi1 := 7.1 - p/data.PSTAR1;
-      tau1 := -1.222 + tau;
-      o[1] := tau1*tau1;
-      o[2] := o[1]*o[1];
-      o[3] := o[2]*o[2];
-      o[4] := o[3]*tau1;
-      o[5] := 1/o[4];
-      o[6] := o[1]*o[2];
-      o[7] := o[1]*tau1;
-      o[8] := 1/o[7];
-      o[9] := o[1]*o[2]*o[3];
-      o[10] := 1/o[2];
-      o[11] := o[2]*tau1;
-      o[12] := 1/o[11];
-      o[13] := o[2]*o[3];
-      o[14] := pi1*pi1;
-      o[15] := o[14]*pi1;
-      o[16] := o[14]*o[14];
-      o[17] := o[16]*o[16];
-      o[18] := o[16]*o[17]*pi1;
-      o[19] := o[14]*o[16];
-      o[20] := o[3]*o[3];
-      o[21] := o[20]*o[20];
-      o[22] := o[21]*o[3]*tau1;
-      o[23] := 1/o[22];
-      o[24] := o[21]*o[3];
-      o[25] := 1/o[24];
-      o[26] := o[1]*o[2]*o[21]*tau1;
-      o[27] := 1/o[26];
-      o[28] := o[1]*o[3];
-
-      g := pi1*(pi1*(pi1*(o[10]*(-0.000031679644845054 + o[2]*(-2.8270797985312e-6
-         - 8.5205128120103e-10*o[6])) + pi1*(o[12]*(-2.2425281908e-6 + (-6.5171222895601e-7
-         - 1.4341729937924e-13*o[13])*o[7]) + pi1*(-4.0516996860117e-7/o[3]
-         + o[15]*(o[18]*(o[14]*(o[19]*(2.6335781662795e-23/(o[1]*o[2]*o[21])
-         + pi1*(-1.1947622640071e-23*o[27] + pi1*(1.8228094581404e-24*o[25]
-         - 9.3537087292458e-26*o[23]*pi1))) + 1.4478307828521e-20/(o[1]*o[2]*
-        o[20]*o[3]*tau1)) - 6.8762131295531e-19/(o[2]*o[20]*o[3]*tau1)) + (-1.2734301741641e-9
-         - 1.7424871230634e-10*o[11])/(o[1]*o[3]*tau1))))) + o[8]*(-0.00047184321073267
-         + o[7]*(-0.00030001780793026 + (0.000047661393906987 + o[1]*(-4.4141845330846e-6
-         - 7.2694996297594e-16*o[9]))*tau1))) + o[5]*(0.00028319080123804 + o[
-        1]*(-0.00060706301565874 + o[6]*(-0.018990068218419 + tau1*(-0.032529748770505
-         + (-0.021841717175414 - 0.00005283835796993*o[1])*tau1))))) + (
-        0.14632971213167 + tau1*(-0.84548187169114 + tau1*(-3.756360367204 +
-        tau1*(3.3855169168385 + tau1*(-0.95791963387872 + tau1*(
-        0.15772038513228 + (-0.016616417199501 + 0.00081214629983568*tau1)*
-        tau1))))))/o[1];
-
-      gtau := pi1*((-0.00254871721114236 + o[1]*(0.00424944110961118 + (
-        0.018990068218419 + (-0.021841717175414 - 0.00015851507390979*o[1])*o[
-        1])*o[6]))/o[28] + pi1*(o[10]*(0.00141552963219801 + o[2]*(
-        0.000047661393906987 + o[1]*(-0.0000132425535992538 -
-        1.2358149370591e-14*o[9]))) + pi1*(o[12]*(0.000126718579380216 -
-        5.11230768720618e-9*o[28]) + pi1*((0.000011212640954 + (
-        1.30342445791202e-6 - 1.4341729937924e-12*o[13])*o[7])/o[6] + pi1*(
-        3.24135974880936e-6*o[5] + o[15]*((1.40077319158051e-8 +
-        1.04549227383804e-9*o[11])/o[13] + o[18]*(1.9941018075704e-17/(o[1]*o[
-        2]*o[20]*o[3]) + o[14]*(-4.48827542684151e-19/o[21] + o[19]*(-1.00075970318621e-21
-        *o[27] + pi1*(4.65957282962769e-22*o[25] + pi1*(-7.2912378325616e-23*
-        o[23] + (3.83502057899078e-24*pi1)/(o[1]*o[21]*o[3])))))))))))) + o[8]
-        *(-0.29265942426334 + tau1*(0.84548187169114 + o[1]*(3.3855169168385
-         + tau1*(-1.91583926775744 + tau1*(0.47316115539684 + (-0.066465668798004
-         + 0.0040607314991784*tau1)*tau1)))));
-
-      h := data.RH2O*T*tau*gtau;
-      s := data.RH2O*(tau*gtau - g);
-    end handsofpT1;
-
-    function hofps1 "function for isentropic specific enthalpy in region 1"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    protected
-      Modelica.SIunits.Temperature T "temperature (K)";
-    algorithm
-      T := Basic.tps1(p, s);
-      h := hofpT1(p, T);
-    end hofps1;
-
-    // for isentropic specific enthalpy get T(p,s), then use this
-    function hofpT2
-      "intermediate function for isentropic specific enthalpy in region 2"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    protected
-      Real[16] o "vector of auxiliary variables";
-      Real pi "dimensionless pressure";
-      Real tau "dimensionless temperature";
-      Real tau2 "dimensionless temperature";
-    algorithm
-      assert(p > triple.ptriple,
-        "IF97 medium function hofpT2 called with too low pressure\n" +
-        "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
-      pi := p/data.PSTAR2;
-      tau := data.TSTAR2/T;
-      tau2 := -0.5 + tau;
-      o[1] := tau*tau;
-      o[2] := o[1]*o[1];
-      o[3] := tau2*tau2;
-      o[4] := o[3]*tau2;
-      o[5] := o[3]*o[3];
-      o[6] := o[5]*o[5];
-      o[7] := o[6]*o[6];
-      o[8] := o[5]*o[6]*o[7]*tau2;
-      o[9] := o[3]*o[5];
-      o[10] := o[5]*o[6]*tau2;
-      o[11] := o[3]*o[7]*tau2;
-      o[12] := o[3]*o[5]*o[6];
-      o[13] := o[5]*o[6]*o[7];
-      o[14] := pi*pi;
-      o[15] := o[14]*o[14];
-      o[16] := o[7]*o[7];
-
-      h := data.RH2O*T*tau*((0.0280439559151 + tau*(-0.2858109552582 + tau*(
-        1.2213149471784 + tau*(-2.848163942888 + tau*(4.38395111945 + o[1]*(
-        10.08665568018 + (-0.5681726521544 + 0.06380539059921*tau)*tau))))))/
-        (o[1]*o[2]) + pi*(-0.017834862292358 + tau2*(-0.09199202739273 + (-0.172743777250296
-         - 0.30195167236758*o[4])*tau2) + pi*(-0.000033032641670203 + (-0.0003789797503263
-         + o[3]*(-0.015757110897342 + o[4]*(-0.306581069554011 -
-        0.000960283724907132*o[8])))*tau2 + pi*(4.3870667284435e-7 + o[3]*(-0.00009683303171571
-         + o[4]*(-0.0090203547252888 - 1.42338887469272*o[8])) + pi*(-7.8847309559367e-10
-         + (2.558143570457e-8 + 1.44676118155521e-6*tau2)*tau2 + pi*(
-        0.0000160454534363627*o[9] + pi*((-5.0144299353183e-11 + o[10]*(-0.033874355714168
-         - 836.35096769364*o[11]))*o[3] + pi*((-0.0000138839897890111 -
-        0.973671060893475*o[12])*o[3]*o[6] + pi*((9.0049690883672e-11 -
-        296.320827232793*o[13])*o[3]*o[5]*tau2 + pi*(2.57526266427144e-7*o[5]
-        *o[6] + pi*(o[4]*(4.1627860840696e-19 + (-1.0234747095929e-12 -
-        1.40254511313154e-8*o[5])*o[9]) + o[14]*o[15]*(o[13]*(-2.34560435076256e-9
-         + 5.3465159397045*o[5]*o[7]*tau2) + o[14]*(-19.1874828272775*o[16]*o[
-        6]*o[7] + o[14]*(o[11]*(1.78371690710842e-23 + (1.07202609066812e-11
-         - 0.000201611844951398*o[10])*o[3]*o[5]*o[6]*tau2) + pi*(-1.24017662339842e-24
-        *o[5]*o[7] + pi*(0.000200482822351322*o[16]*o[5]*o[7] + pi*(-4.97975748452559e-14
-        *o[16]*o[3]*o[5] + o[6]*o[7]*(1.90027787547159e-27 + o[12]*(
-        2.21658861403112e-15 - 0.0000547344301999018*o[3]*o[7]))*pi*tau2)))))))))))))))));
-    end hofpT2;
-
-    function handsofpT2
-      "function for isentropic specific enthalpy and specific entropy in region 2"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      output Modelica.SIunits.SpecificEntropy s "specific entropy";
-    protected
-      Real[22] o "vector of auxiliary variables";
-      Real pi "dimensionless pressure";
-      Real tau "dimensionless temperature";
-      Real tau2 "dimensionless temperature";
-      Real g "dimensionless Gibbs energy";
-      Real gtau "derivative of  dimensionless Gibbs energy w.r.t. tau";
-    algorithm
-      assert(p > triple.ptriple,
-        "IF97 medium function handsofpT2 called with too low pressure\n" +
-        "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
-      tau := data.TSTAR2/T;
-      pi := p/data.PSTAR2;
-      tau2 := tau - 0.5;
-      o[1] := tau2*tau2;
-      o[2] := o[1]*tau2;
-      o[3] := o[1]*o[1];
-      o[4] := o[3]*o[3];
-      o[5] := o[4]*o[4];
-      o[6] := o[3]*o[4]*o[5]*tau2;
-      o[7] := o[1]*o[3]*tau2;
-      o[8] := o[3]*o[4]*tau2;
-      o[9] := o[1]*o[5]*tau2;
-      o[10] := o[1]*o[3]*o[4];
-      o[11] := o[3]*o[4]*o[5];
-      o[12] := o[1]*o[3];
-      o[13] := pi*pi;
-      o[14] := o[13]*o[13];
-      o[15] := o[13]*o[14];
-      o[16] := o[3]*o[5]*tau2;
-      o[17] := o[5]*o[5];
-      o[18] := o[3]*o[5];
-      o[19] := o[1]*o[3]*o[4]*tau2;
-      o[20] := o[1]*o[5];
-      o[21] := tau*tau;
-      o[22] := o[21]*o[21];
-
-      g := pi*(-0.0017731742473213 + tau2*(-0.017834862292358 + tau2*(-0.045996013696365
-         + (-0.057581259083432 - 0.05032527872793*o[2])*tau2)) + pi*(tau2*(-0.000033032641670203
-         + (-0.00018948987516315 + o[1]*(-0.0039392777243355 + o[2]*(-0.043797295650573
-         - 0.000026674547914087*o[6])))*tau2) + pi*(2.0481737692309e-8 + (
-        4.3870667284435e-7 + o[1]*(-0.00003227767723857 + o[2]*(-0.0015033924542148
-         - 0.040668253562649*o[6])))*tau2 + pi*(tau2*(-7.8847309559367e-10 +
-        (1.2790717852285e-8 + 4.8225372718507e-7*tau2)*tau2) + pi*(
-        2.2922076337661e-6*o[7] + pi*(o[2]*(-1.6714766451061e-11 + o[8]*(-0.0021171472321355
-         - 23.895741934104*o[9])) + pi*(-5.905956432427e-18 + o[1]*(-1.2621808899101e-6
-         - 0.038946842435739*o[10])*o[4]*tau2 + pi*((1.1256211360459e-11 -
-        8.2311340897998*o[11])*o[4] + pi*(1.9809712802088e-8*o[8] + pi*((
-        1.0406965210174e-19 + o[12]*(-1.0234747095929e-13 -
-        1.0018179379511e-9*o[3]))*o[3] + o[15]*((-8.0882908646985e-11 +
-        0.10693031879409*o[16])*o[6] + o[13]*(-0.33662250574171*o[17]*o[4]*o[
-        5]*tau2 + o[13]*(o[18]*(8.9185845355421e-25 + o[19]*(
-        3.0629316876232e-13 - 4.2002467698208e-6*o[8])) + pi*(-5.9056029685639e-26
-        *o[16] + pi*(3.7826947613457e-6*o[17]*o[3]*o[5]*tau2 + pi*(o[1]*(
-        7.3087610595061e-29 + o[10]*(5.5414715350778e-17 - 9.436970724121e-7*
-        o[20]))*o[4]*o[5]*pi - 1.2768608934681e-15*o[1]*o[17]*o[3]*tau2))))))))))))))))
-         + (-0.00560879118302 + tau*(0.07145273881455 + tau*(-0.4071049823928
-         + tau*(1.424081971444 + tau*(-4.38395111945 + tau*(-9.692768600217
-         + tau*(10.08665568018 + (-0.2840863260772 + 0.02126846353307*tau)*
-        tau) + Modelica.Math.log(pi)))))))/(o[22]*tau);
-
-      gtau := (0.0280439559151 + tau*(-0.2858109552582 + tau*(1.2213149471784
-         + tau*(-2.848163942888 + tau*(4.38395111945 + o[21]*(10.08665568018
-         + (-0.5681726521544 + 0.06380539059921*tau)*tau))))))/(o[21]*o[22])
-         + pi*(-0.017834862292358 + tau2*(-0.09199202739273 + (-0.172743777250296
-         - 0.30195167236758*o[2])*tau2) + pi*(-0.000033032641670203 + (-0.0003789797503263
-         + o[1]*(-0.015757110897342 + o[2]*(-0.306581069554011 -
-        0.000960283724907132*o[6])))*tau2 + pi*(4.3870667284435e-7 + o[1]*(-0.00009683303171571
-         + o[2]*(-0.0090203547252888 - 1.42338887469272*o[6])) + pi*(-7.8847309559367e-10
-         + (2.558143570457e-8 + 1.44676118155521e-6*tau2)*tau2 + pi*(
-        0.0000160454534363627*o[12] + pi*(o[1]*(-5.0144299353183e-11 + o[8]*(
-        -0.033874355714168 - 836.35096769364*o[9])) + pi*(o[1]*(-0.0000138839897890111
-         - 0.973671060893475*o[10])*o[4] + pi*((9.0049690883672e-11 -
-        296.320827232793*o[11])*o[7] + pi*(2.57526266427144e-7*o[3]*o[4] + pi
-        *(o[2]*(4.1627860840696e-19 + o[12]*(-1.0234747095929e-12 -
-        1.40254511313154e-8*o[3])) + o[15]*(o[11]*(-2.34560435076256e-9 +
-        5.3465159397045*o[16]) + o[13]*(-19.1874828272775*o[17]*o[4]*o[5] + o[
-        13]*((1.78371690710842e-23 + o[19]*(1.07202609066812e-11 -
-        0.000201611844951398*o[8]))*o[9] + pi*(-1.24017662339842e-24*o[18] +
-        pi*(0.000200482822351322*o[17]*o[3]*o[5] + pi*(-4.97975748452559e-14*
-        o[1]*o[17]*o[3] + (1.90027787547159e-27 + o[10]*(2.21658861403112e-15
-         - 0.0000547344301999018*o[20]))*o[4]*o[5]*pi*tau2))))))))))))))));
-
-      h := data.RH2O*T*tau*gtau;
-      s := data.RH2O*(tau*gtau - g);
-    end handsofpT2;
-
-    function hofps2 "function for isentropic specific enthalpy in region 2"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    protected
-      Modelica.SIunits.Temperature T "temperature (K)";
-    algorithm
-      T := Basic.tps2(p, s);
-      h := hofpT2(p, T);
-    end hofps2;
-    // region 3 extra functions
-
-    // for isentropic specific enthalpy get (d,T) = f(p,s), then use this
-    // which needs a bloody iteration, ...
-    // this is one thing that needs to be done somehow, ...
-
-    function hofdT3 "function for isentropic specific enthalpy in region 3"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    protected
-      Real delta;
-      Real tau "dimensionless temperature";
-      Real[13] o "vector of auxiliary variables";
-      Real ftau "derivative of  dimensionless Helmholtz energy w.r.t. tau";
-      Real fdelta "derivative of  dimensionless Helmholtz energy w.r.t. delta";
-    algorithm
-      tau := data.TCRIT/T;
-      delta := d/data.DCRIT;
-      o[1] := tau*tau;
-      o[2] := o[1]*o[1];
-      o[3] := o[2]*o[2];
-      o[4] := o[3]*tau;
-      o[5] := o[1]*o[2]*o[3]*tau;
-      o[6] := o[2]*o[3];
-      o[7] := o[1]*o[3];
-      o[8] := o[3]*o[3];
-      o[9] := o[1]*o[2]*o[8];
-      o[10] := o[1]*o[2]*o[8]*tau;
-      o[11] := o[3]*o[8];
-      o[12] := o[3]*o[8]*tau;
-      o[13] := o[1]*o[3]*o[8];
-
-      ftau := 20.944396974307 + tau*(-15.3735415757432 + o[2]*tau*(
-        18.3301634515678 + o[1]*tau*(-28.08078114862 + o[1]*(14.4640436358204
-         - 0.194503669468755*o[1]*o[3]*tau)))) + delta*((-2.5308630955428 + o[
-        2]*(-6.9146446840086 + (13.2781565976477 - 10.9153200808732*o[1])*o[4]))
-        *tau + delta*(tau*(-1.70429417648412 + o[2]*(29.3833689251262 + (-21.3518320798755
-         + (0.867251811341388 + 3.26518619032008*o[2])*o[5])*tau)) + delta*((
-        2.779959913892 + o[1]*(-8.075966009428 + o[6]*(-0.131436219478341 -
-        12.37496929108*o[7])))*tau + delta*((-0.88952870857478 + o[1]*(
-        3.62288282878932 + 18.3358370228714*o[9]))*tau + delta*(
-        0.10770512626332 + o[1]*(-0.98740869776862 - 13.2264761307011*o[10])
-         + delta*((0.188521503330184 + 4.27343239646986*o[11])*tau + delta*(-0.027006744482696
-        *tau + delta*(-0.385692979164272*o[12] + delta*(delta*(-0.00016557679795037
-         - 0.00116802137560719*delta*o[12]) + (0.00115845907256168 +
-        0.0840031522296486*o[11])*tau)))))))));
-
-      fdelta := (1.0658070028513 + delta*(o[1]*(-1.2654315477714 + o[2]*(-1.1524407806681
-         + (0.88521043984318 - 0.64207765181607*o[1])*o[4])) + delta*(
-        0.76986920373342 + o[1]*(-1.70429417648412 + o[2]*(9.7944563083754 +
-        (-6.100523451393 + (0.078841073758308 + 0.25116816848616*o[2])*o[5])*
-        tau)) + delta*(-0.8399798909613 + o[1]*(4.169939870838 + o[1]*(-6.056974507071
-         + o[6]*(-0.0246442911521889 - 1.42788107204769*o[7]))) + delta*(
-        0.175936297894 + o[1]*(-1.77905741714956 + o[1]*(3.62288282878932 +
-        2.82089800351868*o[9])) + delta*(delta*(-0.133052405238576 + o[1]*(
-        0.565564509990552 + 0.98617670687766*o[11]) + delta*(-0.094523605689436
-        *o[1] + delta*(-0.118674762819776*o[13] + delta*(o[1]*(
-        0.00521306582652756 + 0.0290780142333399*o[11]) + delta*(
-        0.00080964802996215 - 0.000494162889679965*delta*o[13] -
-        0.0016557679795037*tau))))) + (0.5385256313166 + o[1]*(-1.6456811629477
-         - 2.5435531020579*o[10]))*tau))))))/delta;
-
-      h := data.RH2O*T*(tau*ftau + delta*fdelta);
-    end hofdT3;
-
-    function hofps3 "isentropic specific enthalpy in region 3 h(p,s)"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    protected
-      Modelica.SIunits.Density d "density";
-      Modelica.SIunits.Temperature T "temperature (K)";
-      Modelica.SIunits.Pressure delp=IterationData.DELP "iteration accuracy";
-      Modelica.SIunits.SpecificEntropy dels=IterationData.DELS
-        "iteration accuracy";
-      Integer error "error if not 0";
-    algorithm
-      (d,T,error) := Inverses.dtofps3(p=p,s= s,delp= delp,dels= dels);
-      h := hofdT3(d, T);
-    end hofps3;
-
-    function hofpsdt3
-      "isentropic specific enthalpy in region 3 h(p,s) with given good guess in d and T"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      input Modelica.SIunits.Density dguess
-        "good guess density, e.g. from adjacent volume";
-      input Modelica.SIunits.Temperature Tguess
-        "good guess temperature, e.g. from adjacent volume";
-      input Modelica.SIunits.Pressure delp=IterationData.DELP
-        "relative error in p";
-      input Modelica.SIunits.SpecificEntropy dels=IterationData.DELS
-        "relative error in s";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    protected
-      Modelica.SIunits.Density d "density";
-      Modelica.SIunits.Temperature T "temperature (K)";
-      Integer error "error flag";
-    algorithm
-      (d,T,error) := Inverses.dtofpsdt3(p=p,s= s,dguess= dguess,Tguess=
-        Tguess,delp= delp,dels= dels);
-      h := hofdT3(d, T);
-    end hofpsdt3;
-
-    function hofps4 "isentropic specific enthalpy in region 4 h(p,s)"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    protected
-      Modelica.SIunits.Temp_K Tsat "saturation temperature";
-      Modelica.SIunits.MassFraction x "dryness fraction";
-      Modelica.SIunits.SpecificEntropy sl "saturated liquid specific entropy";
-      Modelica.SIunits.SpecificEntropy sv "saturated vapour specific entropy";
-      Modelica.SIunits.SpecificEnthalpy hl "saturated liquid specific enthalpy";
-      Modelica.SIunits.SpecificEnthalpy hv "saturated vapour specific enthalpy";
-    algorithm
-      if (p <= data.PLIMIT4A) then
-        Tsat := Basic.tsat(p);
-        (hl,sl) := handsofpT1(p, Tsat);
-        (hv,sv) := handsofpT2(p, Tsat);
-      elseif (p < data.PCRIT) then
-        sl := Regions.sl_p_R4b(p);
-        sv := Regions.sv_p_R4b(p);
-        hl := Regions.hl_p_R4b(p);
-        hv := Regions.hv_p_R4b(p);
-      end if;
-      x := max(min(if sl <> sv then (s - sl)/(sv - sl) else 1.0, 1.0),0.0);
-      h := hl + x*(hv - hl);
-    end hofps4;
-
-    function hofpT5 "specific enthalpy in region 5 h(p,T)"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    protected
-      Real[4] o "vector of auxiliary variables";
-      Real tau "dimensionless temperature";
-      Real pi "dimensionless pressure";
-    algorithm
-      tau := data.TSTAR5/T;
-      pi := p/data.PSTAR5;
-      assert(p > triple.ptriple,
-        "IF97 medium function hofpT5 called with too low pressure\n" +
-        "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
-      o[1] := tau*tau;
-      o[2] := o[1]*o[1];
-      o[3] := pi*pi;
-      o[4] := o[2]*o[2];
-      h := data.RH2O*T*tau*(6.8540841634434 + 3.1161318213925/o[1] +
-        0.074415446800398/o[2] - 0.0000357523455236121*o[3]*o[4] +
-        0.0021774678714571*pi - 0.013782846269973*o[1]*pi +
-        3.8757684869352e-7*o[1]*o[3]*pi - 0.73803069960666/(o[1]*tau) -
-        0.65923253077834*tau);
-    end hofpT5;
-
-    function water_hisentropic
-      "isentropic specific enthalpy from p,s (preferably use water_hisentropic_dyn in dynamic simulation!)"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-     input Integer phase=
-                    0 "phase: 2 for two-phase, 1 for one phase, 0 if unknown";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    protected
-      Modelica.Media.Common.GibbsDerivs g
-        "derivatives of dimensionless Gibbs-function w.r.t dimensionless pi and tau";
-      Modelica.Media.Common.HelmholtzDerivs f
-        "derivatives of dimensionless Helmholtz-function w.r.t dimensionless delta and tau";
-      Integer region(min=1, max=5) "IF97 region";
-      Integer error "error if not 0";
-      Modelica.SIunits.Temperature T "temperature";
-      Modelica.SIunits.Density d "density";
-    algorithm
-      region := Regions.region_ps(p=p,s= s,phase=phase);
-      if (region == 1) then
-        h := hofps1(p, s);
-      elseif (region == 2) then
-        h := hofps2(p, s);
-      elseif (region == 3) then
-        (d,T,error) := Inverses.dtofps3(p=p,s= s,delp= IterationData.DELP,dels=
-               IterationData.DELS);
-        h := hofdT3(d, T);
-      elseif (region == 4) then
-        h := hofps4(p, s);
-      elseif (region == 5) then
-        (T,error) := Inverses.tofps5(p=p,s= s,relds= IterationData.DELS);
-        h := hofpT5(p, T);
-      end if;
-    end water_hisentropic;
-
-    function water_hisentropic_dyn
-      "isentropic specific enthalpy from p,s and good guesses of d and T"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      input Modelica.SIunits.Density dguess
-        "good guess density, e.g. from adjacent volume";
-      input Modelica.SIunits.Temperature Tguess
-        "good guess temperature, e.g. from adjacent volume";
-      input Integer phase "1 for one phase, 2 for two phase";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    protected
-      Modelica.Media.Common.GibbsDerivs g
-        "derivatives of dimensionless Gibbs-function w.r.t dimensionless pi and tau";
-      Modelica.Media.Common.HelmholtzDerivs f
-        "derivatives of dimensionless Helmholtz-function w.r.t dimensionless delta and tau";
-      Integer region(min=1, max=5) "IF97 region";
-      Integer error "error if not 0";
-      Modelica.SIunits.Temperature T "temperature";
-      Modelica.SIunits.Density d "density";
-    algorithm
-      region := Regions.region_ps(p=p,s= s,phase= phase);
-      if (region == 1) then
-        h := hofps1(p, s);
-      elseif (region == 2) then
-        h := hofps2(p, s);
-      elseif (region == 3) then
-        h := hofpsdt3(p=p,s= s,dguess= dguess,Tguess= Tguess,delp=
-          IterationData.DELP,dels= IterationData.DELS);
-      elseif (region == 4) then
-        h := hofps4(p, s);
-      elseif (region == 5) then
-        (T,error) := Inverses.tofpst5(p=p,s= s,Tguess= Tguess,relds=
-          IterationData.DELS);
-        h := hofpT5(p, T);
-      end if;
-    end water_hisentropic_dyn;
-
-    annotation (Documentation(info="<HTML><h4>Package description</h4>
+          "),
+      Icon(graphics = {Text(extent = {{-102, 0}, {24, -26}}, lineColor = {242, 148, 0}, textString = "Thermo"), Text(extent = {{-4, 8}, {68, -34}}, lineColor = {46, 170, 220}, textString = "SysPro"), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-32, 12}, {-16, 14}, {6, 14}, {26, 12}, {42, 8}, {52, 2}, {42, 6}, {28, 10}, {6, 12}, {-12, 12}, {-16, 12}, {-34, 10}, {-50, 6}, {-62, 2}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-44, 38}, {-24, 38}, {-26, 30}, {-26, 22}, {-24, 14}, {-24, 12}, {-46, 8}, {-42, 22}, {-42, 30}, {-44, 38}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-26, 20}, {-20, 20}, {-20, 22}, {-14, 22}, {-14, 20}, {-12, 20}, {-12, 12}, {-26, 12}, {-28, 12}, {-26, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-8, 14}, {-8, 24}, {-6, 24}, {-6, 14}, {-8, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 30}, {-6, 26}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 36}, {-6, 32}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 42}, {-6, 38}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 48}, {-6, 44}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-4, 14}, {-4, 26}, {-2, 26}, {-2, 14}, {-4, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 32}, {-2, 28}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 38}, {-2, 34}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 44}, {-2, 40}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 50}, {-2, 46}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-2, 20}, {8, 20}, {8, 22}, {10, 22}, {18, 22}, {18, 12}, {-4, 14}, {-2, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-36, 10}, {-18, 12}, {6, 12}, {26, 10}, {42, 6}, {52, 0}, {42, 4}, {28, 8}, {6, 10}, {-12, 10}, {-18, 10}, {-38, 8}, {-50, 6}, {-62, 2}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Line(points = {{22, 12}, {22, 14}, {22, 16}, {24, 14}, {20, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{26, 12}, {26, 14}, {26, 16}, {28, 14}, {24, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{30, 10}, {30, 12}, {30, 14}, {32, 12}, {28, 16}}, color = {46, 170, 220}, thickness = 0.5), Polygon(points = {{36, 8}, {36, 30}, {34, 34}, {36, 38}, {40, 38}, {40, 8}, {36, 8}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 80}, {80, -100}}, lineColor = {0, 0, 255}), Line(points = {{-100, 80}, {-80, 100}, {100, 100}, {100, -80}, {80, -100}}, color = {0, 0, 255}, smooth = Smooth.None), Line(points = {{80, 80}, {100, 100}}, color = {0, 0, 255}, smooth = Smooth.None)}));
+  end Transport;
+
+  package Isentropic "functions for calculating the isentropic enthalpy from pressure p and specific entropy s"
+    function hofpT1 "intermediate function for isentropic specific enthalpy in region 1"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    protected
+      Real[13] o "vector of auxiliary variables";
+      Real pi1 "dimensionless pressure";
+      Real tau "dimensionless temperature";
+      Real tau1 "dimensionless temperature";
+    algorithm
+      tau := data.TSTAR1 / T;
+      pi1 := 7.1 - p / data.PSTAR1;
+      assert(p > triple.ptriple, "IF97 medium function hofpT1  called with too low pressure\n" + "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
+      tau1 := (-1.222) + tau;
+      o[1] := tau1 * tau1;
+      o[2] := o[1] * tau1;
+      o[3] := o[1] * o[1];
+      o[4] := o[3] * o[3];
+      o[5] := o[1] * o[4];
+      o[6] := o[1] * o[3];
+      o[7] := o[3] * tau1;
+      o[8] := o[3] * o[4];
+      o[9] := pi1 * pi1;
+      o[10] := o[9] * o[9];
+      o[11] := o[10] * o[10];
+      o[12] := o[4] * o[4];
+      o[13] := o[12] * o[12];
+      h := data.RH2O * T * tau * (pi1 * (((-0.00254871721114236) + o[1] * (0.00424944110961118 + (0.018990068218419 + ((-0.021841717175414) - 0.00015851507390979 * o[1]) * o[1]) * o[6])) / o[5] + pi1 * ((0.00141552963219801 + o[3] * (0.000047661393906987 + o[1] * ((-0.0000132425535992538) - 1.2358149370591e-14 * o[1] * o[3] * o[4]))) / o[3] + pi1 * ((0.000126718579380216 - 5.11230768720618e-9 * o[5]) / o[7] + pi1 * ((0.000011212640954 + o[2] * (1.30342445791202e-6 - 1.4341729937924e-12 * o[8])) / o[6] + pi1 * (o[9] * pi1 * ((1.40077319158051e-8 + 1.04549227383804e-9 * o[7]) / o[8] + o[10] * o[11] * pi1 * (1.9941018075704e-17 / (o[1] * o[12] * o[3] * o[4]) + o[9] * ((-4.48827542684151e-19 / o[13]) + o[10] * o[9] * (pi1 * (4.65957282962769e-22 / (o[13] * o[4]) + pi1 * (3.83502057899078e-24 * pi1 / (o[1] * o[13] * o[4]) - 7.2912378325616e-23 / (o[13] * o[4] * tau1))) - 1.00075970318621e-21 / (o[1] * o[13] * o[3] * tau1))))) + 3.24135974880936e-6 / (o[4] * tau1)))))) + ((-0.29265942426334) + tau1 * (0.84548187169114 + o[1] * (3.3855169168385 + tau1 * ((-1.91583926775744) + tau1 * (0.47316115539684 + ((-0.066465668798004) + 0.0040607314991784 * tau1) * tau1))))) / o[2]);
+    end hofpT1;
+
+    function handsofpT1 "special function for specific enthalpy and specific entropy in region 1"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      output Modelica.Units.SI.SpecificEntropy s "specific entropy";
+    protected
+      Real[28] o "vector of auxiliary variables";
+      Real pi1 "dimensionless pressure";
+      Real tau "dimensionless temperature";
+      Real tau1 "dimensionless temperature";
+      Real g "dimensionless Gibbs energy";
+      Real gtau "derivative of  dimensionless Gibbs energy w.r.t. tau";
+    algorithm
+      assert(p > triple.ptriple, "IF97 medium function handsofpT1 called with too low pressure\n" + "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
+      tau := data.TSTAR1 / T;
+      pi1 := 7.1 - p / data.PSTAR1;
+      tau1 := (-1.222) + tau;
+      o[1] := tau1 * tau1;
+      o[2] := o[1] * o[1];
+      o[3] := o[2] * o[2];
+      o[4] := o[3] * tau1;
+      o[5] := 1 / o[4];
+      o[6] := o[1] * o[2];
+      o[7] := o[1] * tau1;
+      o[8] := 1 / o[7];
+      o[9] := o[1] * o[2] * o[3];
+      o[10] := 1 / o[2];
+      o[11] := o[2] * tau1;
+      o[12] := 1 / o[11];
+      o[13] := o[2] * o[3];
+      o[14] := pi1 * pi1;
+      o[15] := o[14] * pi1;
+      o[16] := o[14] * o[14];
+      o[17] := o[16] * o[16];
+      o[18] := o[16] * o[17] * pi1;
+      o[19] := o[14] * o[16];
+      o[20] := o[3] * o[3];
+      o[21] := o[20] * o[20];
+      o[22] := o[21] * o[3] * tau1;
+      o[23] := 1 / o[22];
+      o[24] := o[21] * o[3];
+      o[25] := 1 / o[24];
+      o[26] := o[1] * o[2] * o[21] * tau1;
+      o[27] := 1 / o[26];
+      o[28] := o[1] * o[3];
+      g := pi1 * (pi1 * (pi1 * (o[10] * ((-0.000031679644845054) + o[2] * ((-2.8270797985312e-6) - 8.5205128120103e-10 * o[6])) + pi1 * (o[12] * ((-2.2425281908e-6) + ((-6.5171222895601e-7) - 1.4341729937924e-13 * o[13]) * o[7]) + pi1 * ((-4.0516996860117e-7 / o[3]) + o[15] * (o[18] * (o[14] * (o[19] * (2.6335781662795e-23 / (o[1] * o[2] * o[21]) + pi1 * ((-1.1947622640071e-23 * o[27]) + pi1 * (1.8228094581404e-24 * o[25] - 9.3537087292458e-26 * o[23] * pi1))) + 1.4478307828521e-20 / (o[1] * o[2] * o[20] * o[3] * tau1)) - 6.8762131295531e-19 / (o[2] * o[20] * o[3] * tau1)) + ((-1.2734301741641e-9) - 1.7424871230634e-10 * o[11]) / (o[1] * o[3] * tau1))))) + o[8] * ((-0.00047184321073267) + o[7] * ((-0.00030001780793026) + (0.000047661393906987 + o[1] * ((-4.4141845330846e-6) - 7.2694996297594e-16 * o[9])) * tau1))) + o[5] * (0.00028319080123804 + o[1] * ((-0.00060706301565874) + o[6] * ((-0.018990068218419) + tau1 * ((-0.032529748770505) + ((-0.021841717175414) - 0.00005283835796993 * o[1]) * tau1))))) + (0.14632971213167 + tau1 * ((-0.84548187169114) + tau1 * ((-3.756360367204) + tau1 * (3.3855169168385 + tau1 * ((-0.95791963387872) + tau1 * (0.15772038513228 + ((-0.016616417199501) + 0.00081214629983568 * tau1) * tau1)))))) / o[1];
+      gtau := pi1 * (((-0.00254871721114236) + o[1] * (0.00424944110961118 + (0.018990068218419 + ((-0.021841717175414) - 0.00015851507390979 * o[1]) * o[1]) * o[6])) / o[28] + pi1 * (o[10] * (0.00141552963219801 + o[2] * (0.000047661393906987 + o[1] * ((-0.0000132425535992538) - 1.2358149370591e-14 * o[9]))) + pi1 * (o[12] * (0.000126718579380216 - 5.11230768720618e-9 * o[28]) + pi1 * ((0.000011212640954 + (1.30342445791202e-6 - 1.4341729937924e-12 * o[13]) * o[7]) / o[6] + pi1 * (3.24135974880936e-6 * o[5] + o[15] * ((1.40077319158051e-8 + 1.04549227383804e-9 * o[11]) / o[13] + o[18] * (1.9941018075704e-17 / (o[1] * o[2] * o[20] * o[3]) + o[14] * ((-4.48827542684151e-19 / o[21]) + o[19] * ((-1.00075970318621e-21 * o[27]) + pi1 * (4.65957282962769e-22 * o[25] + pi1 * ((-7.2912378325616e-23 * o[23]) + 3.83502057899078e-24 * pi1 / (o[1] * o[21] * o[3])))))))))))) + o[8] * ((-0.29265942426334) + tau1 * (0.84548187169114 + o[1] * (3.3855169168385 + tau1 * ((-1.91583926775744) + tau1 * (0.47316115539684 + ((-0.066465668798004) + 0.0040607314991784 * tau1) * tau1)))));
+      h := data.RH2O * T * tau * gtau;
+      s := data.RH2O * (tau * gtau - g);
+    end handsofpT1;
+
+    function hofps1 "function for isentropic specific enthalpy in region 1"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    protected
+      Modelica.Units.SI.Temperature T "temperature (K)";
+    algorithm
+      T := Basic.tps1(p, s);
+      h := hofpT1(p, T);
+    end hofps1;
+
+    // for isentropic specific enthalpy get T(p,s), then use this
+
+    function hofpT2 "intermediate function for isentropic specific enthalpy in region 2"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    protected
+      Real[16] o "vector of auxiliary variables";
+      Real pi "dimensionless pressure";
+      Real tau "dimensionless temperature";
+      Real tau2 "dimensionless temperature";
+    algorithm
+      assert(p > triple.ptriple, "IF97 medium function hofpT2 called with too low pressure\n" + "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
+      pi := p / data.PSTAR2;
+      tau := data.TSTAR2 / T;
+      tau2 := (-0.5) + tau;
+      o[1] := tau * tau;
+      o[2] := o[1] * o[1];
+      o[3] := tau2 * tau2;
+      o[4] := o[3] * tau2;
+      o[5] := o[3] * o[3];
+      o[6] := o[5] * o[5];
+      o[7] := o[6] * o[6];
+      o[8] := o[5] * o[6] * o[7] * tau2;
+      o[9] := o[3] * o[5];
+      o[10] := o[5] * o[6] * tau2;
+      o[11] := o[3] * o[7] * tau2;
+      o[12] := o[3] * o[5] * o[6];
+      o[13] := o[5] * o[6] * o[7];
+      o[14] := pi * pi;
+      o[15] := o[14] * o[14];
+      o[16] := o[7] * o[7];
+      h := data.RH2O * T * tau * ((0.0280439559151 + tau * ((-0.2858109552582) + tau * (1.2213149471784 + tau * ((-2.848163942888) + tau * (4.38395111945 + o[1] * (10.08665568018 + ((-0.5681726521544) + 0.06380539059921 * tau) * tau)))))) / (o[1] * o[2]) + pi * ((-0.017834862292358) + tau2 * ((-0.09199202739273) + ((-0.172743777250296) - 0.30195167236758 * o[4]) * tau2) + pi * ((-0.000033032641670203) + ((-0.0003789797503263) + o[3] * ((-0.015757110897342) + o[4] * ((-0.306581069554011) - 0.000960283724907132 * o[8]))) * tau2 + pi * (4.3870667284435e-7 + o[3] * ((-0.00009683303171571) + o[4] * ((-0.0090203547252888) - 1.42338887469272 * o[8])) + pi * ((-7.8847309559367e-10) + (2.558143570457e-8 + 1.44676118155521e-6 * tau2) * tau2 + pi * (0.0000160454534363627 * o[9] + pi * (((-5.0144299353183e-11) + o[10] * ((-0.033874355714168) - 836.35096769364 * o[11])) * o[3] + pi * (((-0.0000138839897890111) - 0.973671060893475 * o[12]) * o[3] * o[6] + pi * ((9.0049690883672e-11 - 296.320827232793 * o[13]) * o[3] * o[5] * tau2 + pi * (2.57526266427144e-7 * o[5] * o[6] + pi * (o[4] * (4.1627860840696e-19 + ((-1.0234747095929e-12) - 1.40254511313154e-8 * o[5]) * o[9]) + o[14] * o[15] * (o[13] * ((-2.34560435076256e-9) + 5.3465159397045 * o[5] * o[7] * tau2) + o[14] * ((-19.1874828272775 * o[16] * o[6] * o[7]) + o[14] * (o[11] * (1.78371690710842e-23 + (1.07202609066812e-11 - 0.000201611844951398 * o[10]) * o[3] * o[5] * o[6] * tau2) + pi * ((-1.24017662339842e-24 * o[5] * o[7]) + pi * (0.000200482822351322 * o[16] * o[5] * o[7] + pi * ((-4.97975748452559e-14 * o[16] * o[3] * o[5]) + o[6] * o[7] * (1.90027787547159e-27 + o[12] * (2.21658861403112e-15 - 0.0000547344301999018 * o[3] * o[7])) * pi * tau2)))))))))))))))));
+    end hofpT2;
+
+    function handsofpT2 "function for isentropic specific enthalpy and specific entropy in region 2"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      output Modelica.Units.SI.SpecificEntropy s "specific entropy";
+    protected
+      Real[22] o "vector of auxiliary variables";
+      Real pi "dimensionless pressure";
+      Real tau "dimensionless temperature";
+      Real tau2 "dimensionless temperature";
+      Real g "dimensionless Gibbs energy";
+      Real gtau "derivative of  dimensionless Gibbs energy w.r.t. tau";
+    algorithm
+      assert(p > triple.ptriple, "IF97 medium function handsofpT2 called with too low pressure\n" + "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
+      tau := data.TSTAR2 / T;
+      pi := p / data.PSTAR2;
+      tau2 := tau - 0.5;
+      o[1] := tau2 * tau2;
+      o[2] := o[1] * tau2;
+      o[3] := o[1] * o[1];
+      o[4] := o[3] * o[3];
+      o[5] := o[4] * o[4];
+      o[6] := o[3] * o[4] * o[5] * tau2;
+      o[7] := o[1] * o[3] * tau2;
+      o[8] := o[3] * o[4] * tau2;
+      o[9] := o[1] * o[5] * tau2;
+      o[10] := o[1] * o[3] * o[4];
+      o[11] := o[3] * o[4] * o[5];
+      o[12] := o[1] * o[3];
+      o[13] := pi * pi;
+      o[14] := o[13] * o[13];
+      o[15] := o[13] * o[14];
+      o[16] := o[3] * o[5] * tau2;
+      o[17] := o[5] * o[5];
+      o[18] := o[3] * o[5];
+      o[19] := o[1] * o[3] * o[4] * tau2;
+      o[20] := o[1] * o[5];
+      o[21] := tau * tau;
+      o[22] := o[21] * o[21];
+      g := pi * ((-0.0017731742473213) + tau2 * ((-0.017834862292358) + tau2 * ((-0.045996013696365) + ((-0.057581259083432) - 0.05032527872793 * o[2]) * tau2)) + pi * (tau2 * ((-0.000033032641670203) + ((-0.00018948987516315) + o[1] * ((-0.0039392777243355) + o[2] * ((-0.043797295650573) - 0.000026674547914087 * o[6]))) * tau2) + pi * (2.0481737692309e-8 + (4.3870667284435e-7 + o[1] * ((-0.00003227767723857) + o[2] * ((-0.0015033924542148) - 0.040668253562649 * o[6]))) * tau2 + pi * (tau2 * ((-7.8847309559367e-10) + (1.2790717852285e-8 + 4.8225372718507e-7 * tau2) * tau2) + pi * (2.2922076337661e-6 * o[7] + pi * (o[2] * ((-1.6714766451061e-11) + o[8] * ((-0.0021171472321355) - 23.895741934104 * o[9])) + pi * ((-5.905956432427e-18) + o[1] * ((-1.2621808899101e-6) - 0.038946842435739 * o[10]) * o[4] * tau2 + pi * ((1.1256211360459e-11 - 8.2311340897998 * o[11]) * o[4] + pi * (1.9809712802088e-8 * o[8] + pi * ((1.0406965210174e-19 + o[12] * ((-1.0234747095929e-13) - 1.0018179379511e-9 * o[3])) * o[3] + o[15] * (((-8.0882908646985e-11) + 0.10693031879409 * o[16]) * o[6] + o[13] * ((-0.33662250574171 * o[17] * o[4] * o[5] * tau2) + o[13] * (o[18] * (8.9185845355421e-25 + o[19] * (3.0629316876232e-13 - 4.2002467698208e-6 * o[8])) + pi * ((-5.9056029685639e-26 * o[16]) + pi * (3.7826947613457e-6 * o[17] * o[3] * o[5] * tau2 + pi * (o[1] * (7.3087610595061e-29 + o[10] * (5.5414715350778e-17 - 9.436970724121e-7 * o[20])) * o[4] * o[5] * pi - 1.2768608934681e-15 * o[1] * o[17] * o[3] * tau2)))))))))))))))) + ((-0.00560879118302) + tau * (0.07145273881455 + tau * ((-0.4071049823928) + tau * (1.424081971444 + tau * ((-4.38395111945) + tau * ((-9.692768600217) + tau * (10.08665568018 + ((-0.2840863260772) + 0.02126846353307 * tau) * tau) + Modelica.Math.log(pi))))))) / (o[22] * tau);
+      gtau := (0.0280439559151 + tau * ((-0.2858109552582) + tau * (1.2213149471784 + tau * ((-2.848163942888) + tau * (4.38395111945 + o[21] * (10.08665568018 + ((-0.5681726521544) + 0.06380539059921 * tau) * tau)))))) / (o[21] * o[22]) + pi * ((-0.017834862292358) + tau2 * ((-0.09199202739273) + ((-0.172743777250296) - 0.30195167236758 * o[2]) * tau2) + pi * ((-0.000033032641670203) + ((-0.0003789797503263) + o[1] * ((-0.015757110897342) + o[2] * ((-0.306581069554011) - 0.000960283724907132 * o[6]))) * tau2 + pi * (4.3870667284435e-7 + o[1] * ((-0.00009683303171571) + o[2] * ((-0.0090203547252888) - 1.42338887469272 * o[6])) + pi * ((-7.8847309559367e-10) + (2.558143570457e-8 + 1.44676118155521e-6 * tau2) * tau2 + pi * (0.0000160454534363627 * o[12] + pi * (o[1] * ((-5.0144299353183e-11) + o[8] * ((-0.033874355714168) - 836.35096769364 * o[9])) + pi * (o[1] * ((-0.0000138839897890111) - 0.973671060893475 * o[10]) * o[4] + pi * ((9.0049690883672e-11 - 296.320827232793 * o[11]) * o[7] + pi * (2.57526266427144e-7 * o[3] * o[4] + pi * (o[2] * (4.1627860840696e-19 + o[12] * ((-1.0234747095929e-12) - 1.40254511313154e-8 * o[3])) + o[15] * (o[11] * ((-2.34560435076256e-9) + 5.3465159397045 * o[16]) + o[13] * ((-19.1874828272775 * o[17] * o[4] * o[5]) + o[13] * ((1.78371690710842e-23 + o[19] * (1.07202609066812e-11 - 0.000201611844951398 * o[8])) * o[9] + pi * ((-1.24017662339842e-24 * o[18]) + pi * (0.000200482822351322 * o[17] * o[3] * o[5] + pi * ((-4.97975748452559e-14 * o[1] * o[17] * o[3]) + (1.90027787547159e-27 + o[10] * (2.21658861403112e-15 - 0.0000547344301999018 * o[20])) * o[4] * o[5] * pi * tau2))))))))))))))));
+      h := data.RH2O * T * tau * gtau;
+      s := data.RH2O * (tau * gtau - g);
+    end handsofpT2;
+
+    function hofps2 "function for isentropic specific enthalpy in region 2"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    protected
+      Modelica.Units.SI.Temperature T "temperature (K)";
+    algorithm
+      T := Basic.tps2(p, s);
+      h := hofpT2(p, T);
+    end hofps2;
+
+    // region 3 extra functions
+    // for isentropic specific enthalpy get (d,T) = f(p,s), then use this
+    // which needs a bloody iteration, ...
+    // this is one thing that needs to be done somehow, ...
+
+    function hofdT3 "function for isentropic specific enthalpy in region 3"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    protected
+      Real delta;
+      Real tau "dimensionless temperature";
+      Real[13] o "vector of auxiliary variables";
+      Real ftau "derivative of  dimensionless Helmholtz energy w.r.t. tau";
+      Real fdelta "derivative of  dimensionless Helmholtz energy w.r.t. delta";
+    algorithm
+      tau := data.TCRIT / T;
+      delta := d / data.DCRIT;
+      o[1] := tau * tau;
+      o[2] := o[1] * o[1];
+      o[3] := o[2] * o[2];
+      o[4] := o[3] * tau;
+      o[5] := o[1] * o[2] * o[3] * tau;
+      o[6] := o[2] * o[3];
+      o[7] := o[1] * o[3];
+      o[8] := o[3] * o[3];
+      o[9] := o[1] * o[2] * o[8];
+      o[10] := o[1] * o[2] * o[8] * tau;
+      o[11] := o[3] * o[8];
+      o[12] := o[3] * o[8] * tau;
+      o[13] := o[1] * o[3] * o[8];
+      ftau := 20.944396974307 + tau * ((-15.3735415757432) + o[2] * tau * (18.3301634515678 + o[1] * tau * ((-28.08078114862) + o[1] * (14.4640436358204 - 0.194503669468755 * o[1] * o[3] * tau)))) + delta * (((-2.5308630955428) + o[2] * ((-6.9146446840086) + (13.2781565976477 - 10.9153200808732 * o[1]) * o[4])) * tau + delta * (tau * ((-1.70429417648412) + o[2] * (29.3833689251262 + ((-21.3518320798755) + (0.867251811341388 + 3.26518619032008 * o[2]) * o[5]) * tau)) + delta * ((2.779959913892 + o[1] * ((-8.075966009428) + o[6] * ((-0.131436219478341) - 12.37496929108 * o[7]))) * tau + delta * (((-0.88952870857478) + o[1] * (3.62288282878932 + 18.3358370228714 * o[9])) * tau + delta * (0.10770512626332 + o[1] * ((-0.98740869776862) - 13.2264761307011 * o[10]) + delta * ((0.188521503330184 + 4.27343239646986 * o[11]) * tau + delta * ((-0.027006744482696 * tau) + delta * ((-0.385692979164272 * o[12]) + delta * (delta * ((-0.00016557679795037) - 0.00116802137560719 * delta * o[12]) + (0.00115845907256168 + 0.0840031522296486 * o[11]) * tau)))))))));
+      fdelta := (1.0658070028513 + delta * (o[1] * ((-1.2654315477714) + o[2] * ((-1.1524407806681) + (0.88521043984318 - 0.64207765181607 * o[1]) * o[4])) + delta * (0.76986920373342 + o[1] * ((-1.70429417648412) + o[2] * (9.7944563083754 + ((-6.100523451393) + (0.078841073758308 + 0.25116816848616 * o[2]) * o[5]) * tau)) + delta * ((-0.8399798909613) + o[1] * (4.169939870838 + o[1] * ((-6.056974507071) + o[6] * ((-0.0246442911521889) - 1.42788107204769 * o[7]))) + delta * (0.175936297894 + o[1] * ((-1.77905741714956) + o[1] * (3.62288282878932 + 2.82089800351868 * o[9])) + delta * (delta * ((-0.133052405238576) + o[1] * (0.565564509990552 + 0.98617670687766 * o[11]) + delta * ((-0.094523605689436 * o[1]) + delta * ((-0.118674762819776 * o[13]) + delta * (o[1] * (0.00521306582652756 + 0.0290780142333399 * o[11]) + delta * (0.00080964802996215 - 0.000494162889679965 * delta * o[13] - 0.0016557679795037 * tau))))) + (0.5385256313166 + o[1] * ((-1.6456811629477) - 2.5435531020579 * o[10])) * tau)))))) / delta;
+      h := data.RH2O * T * (tau * ftau + delta * fdelta);
+    end hofdT3;
+
+    function hofps3 "isentropic specific enthalpy in region 3 h(p,s)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    protected
+      Modelica.Units.SI.Density d "density";
+      Modelica.Units.SI.Temperature T "temperature (K)";
+      Modelica.Units.SI.Pressure delp = IterationData.DELP "iteration accuracy";
+      Modelica.Units.SI.SpecificEntropy dels = IterationData.DELS "iteration accuracy";
+      Integer error "error if not 0";
+    algorithm
+      (d, T, error) := Inverses.dtofps3(p = p, s = s, delp = delp, dels = dels);
+      h := hofdT3(d, T);
+    end hofps3;
+
+    function hofpsdt3 "isentropic specific enthalpy in region 3 h(p,s) with given good guess in d and T"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      input Modelica.Units.SI.Density dguess "good guess density, e.g. from adjacent volume";
+      input Modelica.Units.SI.Temperature Tguess "good guess temperature, e.g. from adjacent volume";
+      input Modelica.Units.SI.Pressure delp = IterationData.DELP "relative error in p";
+      input Modelica.Units.SI.SpecificEntropy dels = IterationData.DELS "relative error in s";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    protected
+      Modelica.Units.SI.Density d "density";
+      Modelica.Units.SI.Temperature T "temperature (K)";
+      Integer error "error flag";
+    algorithm
+      (d, T, error) := Inverses.dtofpsdt3(p = p, s = s, dguess = dguess, Tguess = Tguess, delp = delp, dels = dels);
+      h := hofdT3(d, T);
+    end hofpsdt3;
+
+    function hofps4 "isentropic specific enthalpy in region 4 h(p,s)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    protected
+      Modelica.Units.SI.Temperature Tsat "saturation temperature";
+      Modelica.Units.SI.MassFraction x "dryness fraction";
+      Modelica.Units.SI.SpecificEntropy sl "saturated liquid specific entropy";
+      Modelica.Units.SI.SpecificEntropy sv "saturated vapour specific entropy";
+      Modelica.Units.SI.SpecificEnthalpy hl "saturated liquid specific enthalpy";
+      Modelica.Units.SI.SpecificEnthalpy hv "saturated vapour specific enthalpy";
+    algorithm
+      if p <= data.PLIMIT4A then
+        Tsat := Basic.tsat(p);
+        (hl, sl) := handsofpT1(p, Tsat);
+        (hv, sv) := handsofpT2(p, Tsat);
+      elseif p < data.PCRIT then
+        sl := Regions.sl_p_R4b(p);
+        sv := Regions.sv_p_R4b(p);
+        hl := Regions.hl_p_R4b(p);
+        hv := Regions.hv_p_R4b(p);
+      end if;
+      x := max(min(if sl <> sv then (s - sl) / (sv - sl) else 1.0, 1.0), 0.0);
+      h := hl + x * (hv - hl);
+    end hofps4;
+
+    function hofpT5 "specific enthalpy in region 5 h(p,T)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    protected
+      Real[4] o "vector of auxiliary variables";
+      Real tau "dimensionless temperature";
+      Real pi "dimensionless pressure";
+    algorithm
+      tau := data.TSTAR5 / T;
+      pi := p / data.PSTAR5;
+      assert(p > triple.ptriple, "IF97 medium function hofpT5 called with too low pressure\n" + "p = " + String(p) + " Pa <= " + String(triple.ptriple) + " Pa (triple point pressure)");
+      o[1] := tau * tau;
+      o[2] := o[1] * o[1];
+      o[3] := pi * pi;
+      o[4] := o[2] * o[2];
+      h := data.RH2O * T * tau * (6.8540841634434 + 3.1161318213925 / o[1] + 0.074415446800398 / o[2] - 0.0000357523455236121 * o[3] * o[4] + 0.0021774678714571 * pi - 0.013782846269973 * o[1] * pi + 3.8757684869352e-7 * o[1] * o[3] * pi - 0.73803069960666 / (o[1] * tau) - 0.65923253077834 * tau);
+    end hofpT5;
+
+    function water_hisentropic "isentropic specific enthalpy from p,s (preferably use water_hisentropic_dyn in dynamic simulation!)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      input Integer phase = 0 "phase: 2 for two-phase, 1 for one phase, 0 if unknown";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    protected
+      Modelica.Media.Common.GibbsDerivs g "derivatives of dimensionless Gibbs-function w.r.t dimensionless pi and tau";
+      Modelica.Media.Common.HelmholtzDerivs f "derivatives of dimensionless Helmholtz-function w.r.t dimensionless delta and tau";
+      Integer region(min = 1, max = 5) "IF97 region";
+      Integer error "error if not 0";
+      Modelica.Units.SI.Temperature T "temperature";
+      Modelica.Units.SI.Density d "density";
+    algorithm
+      region := Regions.region_ps(p = p, s = s, phase = phase);
+      if region == 1 then
+        h := hofps1(p, s);
+      elseif region == 2 then
+        h := hofps2(p, s);
+      elseif region == 3 then
+        (d, T, error) := Inverses.dtofps3(p = p, s = s, delp = IterationData.DELP, dels = IterationData.DELS);
+        h := hofdT3(d, T);
+      elseif region == 4 then
+        h := hofps4(p, s);
+      elseif region == 5 then
+        (T, error) := Inverses.tofps5(p = p, s = s, relds = IterationData.DELS);
+        h := hofpT5(p, T);
+      end if;
+    end water_hisentropic;
+
+    function water_hisentropic_dyn "isentropic specific enthalpy from p,s and good guesses of d and T"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      input Modelica.Units.SI.Density dguess "good guess density, e.g. from adjacent volume";
+      input Modelica.Units.SI.Temperature Tguess "good guess temperature, e.g. from adjacent volume";
+      input Integer phase "1 for one phase, 2 for two phase";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    protected
+      Modelica.Media.Common.GibbsDerivs g "derivatives of dimensionless Gibbs-function w.r.t dimensionless pi and tau";
+      Modelica.Media.Common.HelmholtzDerivs f "derivatives of dimensionless Helmholtz-function w.r.t dimensionless delta and tau";
+      Integer region(min = 1, max = 5) "IF97 region";
+      Integer error "error if not 0";
+      Modelica.Units.SI.Temperature T "temperature";
+      Modelica.Units.SI.Density d "density";
+    algorithm
+      region := Regions.region_ps(p = p, s = s, phase = phase);
+      if region == 1 then
+        h := hofps1(p, s);
+      elseif region == 2 then
+        h := hofps2(p, s);
+      elseif region == 3 then
+        h := hofpsdt3(p = p, s = s, dguess = dguess, Tguess = Tguess, delp = IterationData.DELP, dels = IterationData.DELS);
+      elseif region == 4 then
+        h := hofps4(p, s);
+      elseif region == 5 then
+        (T, error) := Inverses.tofpst5(p = p, s = s, Tguess = Tguess, relds = IterationData.DELS);
+        h := hofpT5(p, T);
+      end if;
+    end water_hisentropic_dyn;
+    annotation(
+      Documentation(info = "<HTML><h4>Package description</h4>
           <p></p>
           <h4>Package contents</h4>
           <p>
@@ -5858,710 +3708,520 @@
           <li>Documentation added: December 2002</li>
           </ul>
           </HTML>
-          "), Icon(graphics={
-          Text(
-            extent={{-102,0},{24,-26}},
-            lineColor={242,148,0},
-            textString=
-                 "Thermo"),
-          Text(
-            extent={{-4,8},{68,-34}},
-            lineColor={46,170,220},
-            textString=
-                 "SysPro"),
-          Polygon(
-            points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},{
-                42,8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},{
-                -50,6},{-62,2}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{-46,
-                8},{-42,22},{-42,30},{-44,38}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{-12,
-                12},{-26,12},{-28,12},{-26,20}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,30},{-6,26}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,36},{-6,32}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,42},{-6,38}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,48},{-6,44}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,32},{-2,28}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,38},{-2,34}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,44},{-2,40}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,50},{-2,46}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{-2,
-                20}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},{
-                42,6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},{
-                -50,6},{-62,2}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Line(
-            points={{22,12},{22,14},{22,16},{24,14},{20,18}},
-            color={46,170,220},
-            thickness=0.5),
-          Line(
-            points={{26,12},{26,14},{26,16},{28,14},{24,18}},
-            color={46,170,220},
-            thickness=0.5),
-          Line(
-            points={{30,10},{30,12},{30,14},{32,12},{28,16}},
-            color={46,170,220},
-            thickness=0.5),
-          Polygon(
-            points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}),
-          Line(
-            points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}},
-            color={0,0,255},
-            smooth=Smooth.None),
-          Line(
-            points={{80,80},{100,100}},
-            color={0,0,255},
-            smooth=Smooth.None)}));
-  end Isentropic;
-  //work needed: (Pr,lam,eta) = f(d,T,p, region?)
-  package Inverses "efficient inverses for selected pairs of variables"
-
-    //===================================================================
-    //            Iterative version for some pairs/regions
-
-    //===================================================================
-    function fixdT "region limits for inverse iteration in region 3"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density din "density";
-      input Modelica.SIunits.Temperature Tin "temperature";
-      output Modelica.SIunits.Density dout "density";
-      output Modelica.SIunits.Temperature Tout "temperature";
-    protected
-      Modelica.SIunits.Temperature Tmin "approximation of minimum temperature";
-      Modelica.SIunits.Temperature Tmax "approximation of maximum temperature";
-    algorithm
-      if (din > 765.0) then
-        dout := 765.0;
-      elseif (din < 110.0) then
-        dout := 110.0;
-      else
-        dout := din;
-      end if;
-      if (dout < 390.0) then
-        Tmax := 554.3557377 + dout*0.809344262;
-      else
-        Tmax := 1116.85 - dout*0.632948717;
-      end if;
-      if (dout < data.DCRIT) then
-        Tmin := data.TCRIT*(1.0 - (dout - data.DCRIT)*(dout - data.DCRIT)/
-          1.0e6);
-      else
-        Tmin := data.TCRIT*(1.0 - (dout - data.DCRIT)*(dout - data.DCRIT)/
-          1.44e6);
-      end if;
-      if (Tin < Tmin) then
-        Tout := Tmin;
-      elseif (Tin > Tmax) then
-        Tout := Tmax;
-      else
-        Tout := Tin;
-      end if;
-    end fixdT;
-
-    function dofp13 "density at the boundary between regions 1 and 3"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output Modelica.SIunits.Density d "density";
-    protected
-      Real p2 "auxiliary variable";
-      Real[3] o "vector of auxiliary variables";
-    algorithm
-      p2 := 7.1 - 6.04960677555959e-8*p;
-      o[1] := p2*p2;
-      o[2] := o[1]*o[1];
-      o[3] := o[2]*o[2];
-      d := 57.4756752485113/(0.0737412153522555 + p2*(0.00145092247736023 +
-        p2*(0.000102697173772229 + p2*(0.0000114683182476084 + p2*(
-        1.99080616601101e-6 + o[1]*p2*(1.13217858826367e-8 + o[2]*o[3]*p2*(
-        1.35549330686006e-17 + o[1]*(-3.11228834832975e-19 + o[1]*o[2]*(-7.02987180039442e-22
-         + p2*(3.29199117056433e-22 + (-5.17859076694812e-23 +
-        2.73712834080283e-24*p2)*p2))))))))));
-
-    end dofp13;
-
-    function dofp23 "density at the boundary between regions 2 and 3"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      output Modelica.SIunits.Density d "density";
-    protected
-      Modelica.SIunits.Temperature T;
-      Real[13] o "vector of auxiliary variables";
-      Real taug "auxiliary variable";
-      Real pi "dimensionless pressure";
-      Real gpi23
-        "derivative of g w.r.t. pi on the boundary between regions 2 and 3";
-    algorithm
-      pi := p/data.PSTAR2;
-      T := 572.54459862746 + 31.3220101646784*(-13.91883977887 + pi)^0.5;
-      o[1] := (-13.91883977887 + pi)^0.5;
-      taug := -0.5 + 540.0/(572.54459862746 + 31.3220101646784*o[1]);
-      o[2] := taug*taug;
-      o[3] := o[2]*taug;
-      o[4] := o[2]*o[2];
-      o[5] := o[4]*o[4];
-      o[6] := o[5]*o[5];
-      o[7] := o[4]*o[5]*o[6]*taug;
-      o[8] := o[4]*o[5]*taug;
-      o[9] := o[2]*o[4]*o[5];
-      o[10] := pi*pi;
-      o[11] := o[10]*o[10];
-      o[12] := o[4]*o[6]*taug;
-      o[13] := o[6]*o[6];
-
-      gpi23 := (1.0 + pi*(-0.0017731742473213 + taug*(-0.017834862292358 +
-        taug*(-0.045996013696365 + (-0.057581259083432 - 0.05032527872793*o[3])
-        *taug)) + pi*(taug*(-0.000066065283340406 + (-0.0003789797503263 + o[
-        2]*(-0.007878555448671 + o[3]*(-0.087594591301146 -
-        0.000053349095828174*o[7])))*taug) + pi*(6.1445213076927e-8 + (
-        1.31612001853305e-6 + o[2]*(-0.00009683303171571 + o[3]*(-0.0045101773626444
-         - 0.122004760687947*o[7])))*taug + pi*(taug*(-3.15389238237468e-9 +
-        (5.116287140914e-8 + 1.92901490874028e-6*taug)*taug) + pi*(
-        0.0000114610381688305*o[2]*o[4]*taug + pi*(o[3]*(-1.00288598706366e-10
-         + o[8]*(-0.012702883392813 - 143.374451604624*o[2]*o[6]*taug)) + pi*
-        (-4.1341695026989e-17 + o[2]*o[5]*(-8.8352662293707e-6 -
-        0.272627897050173*o[9])*taug + pi*(o[5]*(9.0049690883672e-11 -
-        65.8490727183984*o[4]*o[5]*o[6]) + pi*(1.78287415218792e-7*o[8] + pi*
-        (o[4]*(1.0406965210174e-18 + o[2]*(-1.0234747095929e-12 -
-        1.0018179379511e-8*o[4])*o[4]) + o[10]*o[11]*((-1.29412653835176e-9
-         + 1.71088510070544*o[12])*o[7] + o[10]*(-6.05920510335078*o[13]*o[5]
-        *o[6]*taug + o[10]*(o[4]*o[6]*(1.78371690710842e-23 + o[2]*o[4]*o[5]*
-        (6.1258633752464e-12 - 0.000084004935396416*o[8])*taug) + pi*(-1.24017662339842e-24
-        *o[12] + pi*(0.0000832192847496054*o[13]*o[4]*o[6]*taug + pi*(o[2]*o[
-        5]*o[6]*(1.75410265428146e-27 + (1.32995316841867e-15 -
-        0.0000226487297378904*o[2]*o[6])*o[9])*pi - 2.93678005497663e-14*o[13]
-        *o[2]*o[4]*taug)))))))))))))))))/pi;
-      d := p/(data.RH2O*T*pi*gpi23);
-    end dofp23;
-
-    function dofpt3 "inverse iteration in region 3: (d) = f(p,T)"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      input Modelica.SIunits.Pressure delp
-        "iteration converged if (p-pre(p) < delp)";
-      output Modelica.SIunits.Density d "density";
-      output Integer error=0 "error flag: iteration failed if different from 0";
-    protected
-      Modelica.SIunits.Density dguess "guess density";
-      Integer i=0 "loop counter";
-      Real dp "pressure difference";
-      Modelica.SIunits.Density deld "density step";
-      Modelica.Media.Common.HelmholtzDerivs f
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-      Modelica.Media.Common.NewtonDerivatives_pT nDerivs
-        "derivatives needed in Newton iteration";
-      Boolean found=false "flag for iteration success";
-      Boolean supercritical "flag, true for supercritical states";
-      Boolean liquid "flag, true for liquid states";
-      Modelica.SIunits.Density dmin "lower density limit";
-      Modelica.SIunits.Density dmax "upper density limit";
-      Modelica.SIunits.Temperature Tmax "maximum temperature";
-    algorithm
-      assert(p >= data.PLIMIT4A,
-        "BaseIF97.dofpt3: function called outside of region 3! p too low\n" +
-        "p = " + String(p) + " Pa < " + String(data.PLIMIT4A) + " Pa");
-      assert(T >= data.TLIMIT1,
-        "BaseIF97.dofpt3: function called outside of region 3! T too low\n" +
-        "T = " + String(T) + " K < " + String(data.TLIMIT1) + " K");
-      assert(p >= Regions.boundary23ofT(T),
-        "BaseIF97.dofpt3: function called outside of region 3! T too high\n" +
-        "p = " + String(p) + " Pa, T = " + String(T) + " K");
-      supercritical := p > data.PCRIT;
-      dmax := dofp13(p);
-      dmin := dofp23(p);
-      Tmax := Regions.boundary23ofp(p);
-      if supercritical then
-        dguess := dmin + (T - data.TLIMIT1)/(data.TLIMIT1 - Tmax)*(dmax -
-          dmin);
-        //this may need improvement!!
-      else
-        liquid := T < Basic.tsat(p);
-        if liquid then
-          dguess := 0.5*(Regions.rhol_p_R4b(p) + dmax);
-        else
-          dguess := 0.5*(Regions.rhov_p_R4b(p) + dmin);
-        end if;
-      end if;
-      while ((i < IterationData.IMAX) and not found) loop
-        d := dguess;
-        f := Basic.f3(d, T);
-        nDerivs := Modelica.Media.Common.Helmholtz_pT(f);
-        dp := nDerivs.p - p;
-        if (abs(dp/p) <= delp) then
-          found := true;
-        end if;
-        deld := dp/nDerivs.pd;
-        d := d - deld;
-        if d > dmin and d < dmax then
-          dguess := d;
-        else
-          if d > dmax then
-            dguess := dmax - sqrt(Modelica.Constants.eps);
-              // put it on the correct spot just inside the boundary here instead
-          else
-            dguess := dmin + sqrt(Modelica.Constants.eps);
-          end if;
-        end if;
-        i := i + 1;
-      end while;
-      if not found then
-        error := 1;
-      end if;
-      assert(error <> 1, "error in inverse function dofpt3: iteration failed");
-    end dofpt3;
-
-    // for all iteration functions: project to bounadries possible
-    // if p is input. Step 1 get dofpt_efficient(p,T) at boundary
-    // for T, use boundary itself if off limits, for d a bit inside
-
-    function dtofph3 "inverse iteration in region 3: (d,T) = f(p,h)"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input Modelica.SIunits.Pressure delp "iteration accuracy";
-      input Modelica.SIunits.SpecificEnthalpy delh "iteration accuracy";
-      output Modelica.SIunits.Density d "density";
-      output Modelica.SIunits.Temperature T "temperature (K)";
-      output Integer error "error flag: iteration failed if different from 0";
-    protected
-      Modelica.SIunits.Temperature Tguess "initial temperature";
-      Modelica.SIunits.Density dguess "initial density";
-      Integer i "iteration counter";
-      Real dh "Newton-error in h-direction";
-      Real dp "Newton-error in p-direction";
-      Real det "determinant of directional derivatives";
-      Real deld "Newton-step in d-direction";
-      Real delt "Newton-step in T-direction";
-      Modelica.Media.Common.HelmholtzDerivs f
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-      Modelica.Media.Common.NewtonDerivatives_ph nDerivs
-        "derivatives needed in Newton iteration";
-      Boolean found=false "flag for iteration success";
-      Integer subregion "1 for subregion 3a, 2 for subregion 3b";
-    algorithm
-      if p < data.PCRIT then
-        // allow a 10 J margin inside the (well approximated) phase boundary
-        subregion := if h < (Regions.hl_p(p) + 10.0) then 1 else
-          if h > (Regions.hv_p(p) - 10.0) then 2 else 0;
-        assert(subregion <> 0,"inverse iteration of dt from ph called in 2 phase region: this can not work");
-      else
-        //supercritical
-        subregion := if h < Basic.h3ab_p(p) then 1 else 2;
-      end if;
-      T := if subregion == 1 then Basic.T3a_ph(p,h) else Basic.T3b_ph(p,h);
-      d := if subregion == 1 then 1/Basic.v3a_ph(p,h) else 1/Basic.v3b_ph(p,h);
-      i := 0;
-      error := 0;
-      while ((i < IterationData.IMAX) and not found) loop
-        f := Basic.f3(d, T);
-        nDerivs := Modelica.Media.Common.Helmholtz_ph(f);
-        dh := nDerivs.h - h;
-        dp := nDerivs.p - p;
-        if ((abs(dh/h) <= delh) and (abs(dp/p) <= delp)) then
-          found := true;
-        end if;
-        det := nDerivs.ht*nDerivs.pd - nDerivs.pt*nDerivs.hd;
-        delt := (nDerivs.pd*dh - nDerivs.hd*dp)/det;
-        deld := (nDerivs.ht*dp - nDerivs.pt*dh)/det;
-        T := T - delt;
-        d := d - deld;
-        dguess := d;
-        Tguess := T;
-        i := i + 1;
-        (d,T) := fixdT(dguess, Tguess);
-      end while;
-      if not found then
-        error := 1;
-      end if;
-      assert(error <> 1,
-        "error in inverse function dtofph3: iteration failed");
-    end dtofph3;
-
-    function dtofps3 "inverse iteration in region 3: (d,T) = f(p,s)"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      input Modelica.SIunits.Pressure delp "iteration accuracy";
-      input Modelica.SIunits.SpecificEntropy dels "iteration accuracy";
-      output Modelica.SIunits.Density d "density";
-      output Modelica.SIunits.Temperature T "temperature (K)";
-      output Integer error "error flag: iteration failed if different from 0";
-    protected
-      Modelica.SIunits.Temperature Tguess "initial temperature";
-      Modelica.SIunits.Density dguess "initial density";
-      Integer i "iteration counter";
-      Real ds "Newton-error in s-direction";
-      Real dp "Newton-error in p-direction";
-      Real det "determinant of directional derivatives";
-      Real deld "Newton-step in d-direction";
-      Real delt "Newton-step in T-direction";
-      Modelica.Media.Common.HelmholtzDerivs f
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-      Modelica.Media.Common.NewtonDerivatives_ps nDerivs
-        "derivatives needed in Newton iteration";
-      Boolean found "flag for iteration success";
-      Integer subregion "1 for subregion 3a, 2 for subregion 3b";
-    algorithm
-      i := 0;
-      error := 0;
-      found := false;
-      if p < data.PCRIT then
-        // allow a 1 J/K margin inside the (well approximated) phase boundary
-        subregion := if s < (Regions.sl_p(p) + 10.0) then 1 else
-          if s > (Regions.sv_p(p) - 10.0) then 2 else 0;
-        assert(subregion <> 0,"inverse iteration of dt from ps called in 2 phase region: this is illegal!");
-      else
-        subregion := if s < data.SCRIT then 1 else 2;
-      end if;
-      T := if subregion == 1 then Basic.T3a_ps(p,s) else Basic.T3b_ps(p,s);
-      d := if subregion == 1 then 1/Basic.v3a_ps(p,s) else 1/Basic.v3b_ps(p,s);
-      while ((i < IterationData.IMAX) and not found) loop
-        f := Basic.f3(d, T);
-        nDerivs := Modelica.Media.Common.Helmholtz_ps(f);
-        ds := nDerivs.s - s;
-        dp := nDerivs.p - p;
-        if ((abs(ds/s) <= dels) and (abs(dp/p) <= delp)) then
-          found := true;
-        end if;
-        det := nDerivs.st*nDerivs.pd - nDerivs.pt*nDerivs.sd;
-        delt := (nDerivs.pd*ds - nDerivs.sd*dp)/det;
-        deld := (nDerivs.st*dp - nDerivs.pt*ds)/det;
-        T := T - delt;
-        d := d - deld;
-        dguess := d;
-        Tguess := T;
-        i := i + 1;
-        (d,T) := fixdT(dguess, Tguess);
-      end while;
-      if not found then
-        error := 1;
-      end if;
-      assert(error <> 1,
-        "error in inverse function dtofps3: iteration failed");
-    end dtofps3;
-
-    function dtofpsdt3 "inverse iteration in region 3: (d,T) = f(p,s)"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      input Modelica.SIunits.Density dguess
-        "guess density, e.g. from adjacent volume";
-      input Modelica.SIunits.Temperature Tguess
-        "guess temperature, e.g. from adjacent volume";
-      input Modelica.SIunits.Pressure delp "iteration accuracy";
-      input Modelica.SIunits.SpecificEntropy dels "iteration accuracy";
-      output Modelica.SIunits.Density d "density";
-      output Modelica.SIunits.Temperature T "temperature (K)";
-      output Integer error "error flag: iteration failed if different from 0";
-    protected
-      Integer i "iteration counter";
-      Real ds "Newton-error in s-direction";
-      Real dp "Newton-error in p-direction";
-      Real det "determinant of directional derivatives";
-      Real deld "Newton-step in d-direction";
-      Real delt "Newton-step in T-direction";
-      Modelica.Media.Common.HelmholtzDerivs f
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-      Modelica.Media.Common.NewtonDerivatives_ps nDerivs
-        "derivatives needed in Newton iteration";
-      Boolean found "flag for iteration success";
-      Modelica.SIunits.Density diter "density";
-      Modelica.SIunits.Temperature Titer "temperature (K)";
-    algorithm
-      i := 0;
-      error := 0;
-      found := false;
-      (diter,Titer) := fixdT(dguess, Tguess);
-      while ((i < IterationData.IMAX) and not found) loop
-        (d,T) := fixdT(diter, Titer);
-        f := Basic.f3(d, T);
-        nDerivs := Modelica.Media.Common.Helmholtz_ps(f);
-        ds := nDerivs.s - s;
-        dp := nDerivs.p - p;
-        if ((abs(ds/s) <= dels) and (abs(dp/p) <= delp)) then
-          found := true;
-        end if;
-        det := nDerivs.st*nDerivs.pd - nDerivs.pt*nDerivs.sd;
-        delt := (nDerivs.pd*ds - nDerivs.sd*dp)/det;
-        deld := (nDerivs.st*dp - nDerivs.pt*ds)/det;
-        T := T - delt;
-        d := d - deld;
-        diter := d;
-        Titer := T;
-        i := i + 1;
-      end while;
-      if not found then
-        error := 1;
-      end if;
-      assert(error <> 1,
-        "error in inverse function dtofpsdt3: iteration failed");
-    end dtofpsdt3;
-
-    function pofdt125 "inverse iteration in region 1,2 and 5: p = g(d,T)"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature (K)";
-      input Modelica.SIunits.Pressure reldd
-        "relative iteration accuracy of density";
-      input Integer region
-        "region in IAPWS/IF97 in which inverse should be calculated";
-      output Modelica.SIunits.Pressure p "pressure";
-      output Integer error "error flag: iteration failed if different from 0";
-    protected
-      Integer i "counter for while-loop";
-      Modelica.Media.Common.GibbsDerivs g
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      Boolean found "flag if iteration has been successful";
-      Real dd
-        "difference between density for  guessed p and the current density";
-      Real delp "step in p in Newton-iteration";
-      Real relerr "relative error in d";
-      Modelica.SIunits.Pressure pguess1=1.0e6
-        "initial pressure guess in region 1";
-      Modelica.SIunits.Pressure pguess2 "initial pressure guess in region 2";
-      constant Modelica.SIunits.Pressure pguess5=0.5e6
-        "initial pressure guess in region 5";
-    algorithm
-      i := 0;
-      error := 0;
-      pguess2 := 42800*d;
-      found := false;
-      if region == 1 then
-        p := pguess1;
-      elseif region == 2 then
-        p := pguess2;
-      else
-        p := pguess5;
-      end if;
-      while ((i < IterationData.IMAX) and not found) loop
-        if region == 1 then
-          g := Basic.g1(p, T);
-        elseif region == 2 then
-          g := Basic.g2(p, T);
-        else
-          g := Basic.g5(p, T);
-        end if;
-        dd := p/(data.RH2O*T*g.pi*g.gpi) - d;
-        relerr := dd/d;
-        if (abs(relerr) < reldd) then
-          found := true;
-        end if;
-        delp := dd*(-p*p/(d*d*data.RH2O*T*g.pi*g.pi*g.gpipi));
-        p := p - delp;
-        i := i + 1;
-        if not found then
-          if p < triple.ptriple then
-            p := 2.0*triple.ptriple;
-          end if;
-          if p > data.PLIMIT1 then
-            p := 0.95*data.PLIMIT1;
-          end if;
-        end if;
-      end while;
-
-        // print("i = " + i2s(i) + ", p = " + r2s(p/1.0e5) + ", delp = " + r2s(delp*1.0e-5) + "\n");
-      if not found then
-        error := 1;
-      end if;
-      assert(error <> 1,
-        "error in inverse function pofdt125: iteration failed");
-    end pofdt125;
-
-    function tofph5 "inverse iteration in region 5: (p,T) = f(p,h)"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input Modelica.SIunits.SpecificEnthalpy reldh "iteration accuracy";
-      output Modelica.SIunits.Temperature T "temperature (K)";
-      output Integer error "error flag: iteration failed if different from 0";
-
-    protected
-      Modelica.Media.Common.GibbsDerivs g
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      Modelica.SIunits.SpecificEnthalpy proh "h for current guess in T";
-      constant Modelica.SIunits.Temperature Tguess=1500 "initial temperature";
-      Integer i "iteration counter";
-      Real relerr "relative error in h";
-      Real dh "Newton-error in h-direction";
-      Real dT "Newton-step in T-direction";
-      Boolean found "flag for iteration success";
-    algorithm
-      i := 0;
-      error := 0;
-      T := Tguess;
-      found := false;
-      while ((i < IterationData.IMAX) and not found) loop
-        g := Basic.g5(p, T);
-        proh := data.RH2O*T*g.tau*g.gtau;
-        dh := proh - h;
-        relerr := dh/h;
-        if (abs(relerr) < reldh) then
-          found := true;
-        end if;
-        dT := dh/(-data.RH2O*g.tau*g.tau*g.gtautau);
-        T := T - dT;
-        i := i + 1;
-      end while;
-      if not found then
-        error := 1;
-      end if;
-      assert(error <> 1, "error in inverse function tofph5: iteration failed");
-    end tofph5;
-
-    function tofps5 "inverse iteration in region 5: (p,T) = f(p,s)"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      input Modelica.SIunits.SpecificEnthalpy relds "iteration accuracy";
-      output Modelica.SIunits.Temperature T "temperature (K)";
-      output Integer error "error flag: iteration failed if different from 0";
-
-    protected
-      Modelica.Media.Common.GibbsDerivs g
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      Modelica.SIunits.SpecificEntropy pros "s for current guess in T";
-      parameter Modelica.SIunits.Temperature Tguess=1500 "initial temperature";
-      Integer i "iteration counter";
-      Real relerr "relative error in s";
-      Real ds "Newton-error in s-direction";
-      Real dT "Newton-step in T-direction";
-      Boolean found "flag for iteration success";
-    algorithm
-      i := 0;
-      error := 0;
-      T := Tguess;
-      found := false;
-      while ((i < IterationData.IMAX) and not found) loop
-        g := Basic.g5(p, T);
-        pros := data.RH2O*(g.tau*g.gtau - g.g);
-        ds := pros - s;
-        relerr := ds/s;
-        if (abs(relerr) < relds) then
-          found := true;
-        end if;
-        dT := ds*T/(-data.RH2O*g.tau*g.tau*g.gtautau);
-        T := T - dT;
-        i := i + 1;
-      end while;
-      if not found then
-        error := 1;
-      end if;
-      assert(error <> 1, "error in inverse function tofps5: iteration failed");
-    end tofps5;
-
-    function tofpst5 "inverse iteration in region 5: (p,T) = f(p,s)"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      input Modelica.SIunits.Temperature Tguess
-        "guess temperature, e.g. from adjacent volume";
-      input Modelica.SIunits.SpecificEntropy relds "iteration accuracy";
-      output Modelica.SIunits.Temperature T "temperature (K)";
-      output Integer error "error flag: iteration failed if different from 0";
-
-    protected
-      Modelica.Media.Common.GibbsDerivs g
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      Modelica.SIunits.SpecificEntropy pros "s for current guess in T";
-      Integer i "iteration counter";
-      Real relerr "relative error in s";
-      Real ds "Newton-error in s-direction";
-      Real dT "Newton-step in T-direction";
-      Boolean found "flag for iteration success";
-    algorithm
-      i := 0;
-      error := 0;
-      T := Tguess;
-      found := false;
-      while ((i < IterationData.IMAX) and not found) loop
-        g := Basic.g5(p, T);
-        pros := data.RH2O*(g.tau*g.gtau - g.g);
-        ds := pros - s;
-        relerr := ds/s;
-        if (abs(relerr) < relds) then
-          found := true;
-        end if;
-        dT := ds*T/(-data.RH2O*g.tau*g.tau*g.gtautau);
-        T := T - dT;
-        i := i + 1;
-      end while;
-      if not found then
-        error := 1;
-      end if;
-      assert(error <> 1,
-        "error in inverse function tofpst5: iteration failed");
-    end tofpst5;
-
-    annotation (Documentation(info="<HTML><h4>Package description</h4>
+          "),
+      Icon(graphics = {Text(extent = {{-102, 0}, {24, -26}}, lineColor = {242, 148, 0}, textString = "Thermo"), Text(extent = {{-4, 8}, {68, -34}}, lineColor = {46, 170, 220}, textString = "SysPro"), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-32, 12}, {-16, 14}, {6, 14}, {26, 12}, {42, 8}, {52, 2}, {42, 6}, {28, 10}, {6, 12}, {-12, 12}, {-16, 12}, {-34, 10}, {-50, 6}, {-62, 2}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-44, 38}, {-24, 38}, {-26, 30}, {-26, 22}, {-24, 14}, {-24, 12}, {-46, 8}, {-42, 22}, {-42, 30}, {-44, 38}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-26, 20}, {-20, 20}, {-20, 22}, {-14, 22}, {-14, 20}, {-12, 20}, {-12, 12}, {-26, 12}, {-28, 12}, {-26, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-8, 14}, {-8, 24}, {-6, 24}, {-6, 14}, {-8, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 30}, {-6, 26}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 36}, {-6, 32}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 42}, {-6, 38}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 48}, {-6, 44}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-4, 14}, {-4, 26}, {-2, 26}, {-2, 14}, {-4, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 32}, {-2, 28}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 38}, {-2, 34}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 44}, {-2, 40}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 50}, {-2, 46}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-2, 20}, {8, 20}, {8, 22}, {10, 22}, {18, 22}, {18, 12}, {-4, 14}, {-2, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-36, 10}, {-18, 12}, {6, 12}, {26, 10}, {42, 6}, {52, 0}, {42, 4}, {28, 8}, {6, 10}, {-12, 10}, {-18, 10}, {-38, 8}, {-50, 6}, {-62, 2}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Line(points = {{22, 12}, {22, 14}, {22, 16}, {24, 14}, {20, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{26, 12}, {26, 14}, {26, 16}, {28, 14}, {24, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{30, 10}, {30, 12}, {30, 14}, {32, 12}, {28, 16}}, color = {46, 170, 220}, thickness = 0.5), Polygon(points = {{36, 8}, {36, 30}, {34, 34}, {36, 38}, {40, 38}, {40, 8}, {36, 8}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 80}, {80, -100}}, lineColor = {0, 0, 255}), Line(points = {{-100, 80}, {-80, 100}, {100, 100}, {100, -80}, {80, -100}}, color = {0, 0, 255}, smooth = Smooth.None), Line(points = {{80, 80}, {100, 100}}, color = {0, 0, 255}, smooth = Smooth.None)}));
+  end Isentropic;
+
+  //work needed: (Pr,lam,eta) = f(d,T,p, region?)
+
+  package Inverses "efficient inverses for selected pairs of variables"
+    //===================================================================
+    //            Iterative version for some pairs/regions
+    //===================================================================
+
+    function fixdT "region limits for inverse iteration in region 3"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density din "density";
+      input Modelica.Units.SI.Temperature Tin "temperature";
+      output Modelica.Units.SI.Density dout "density";
+      output Modelica.Units.SI.Temperature Tout "temperature";
+    protected
+      Modelica.Units.SI.Temperature Tmin "approximation of minimum temperature";
+      Modelica.Units.SI.Temperature Tmax "approximation of maximum temperature";
+    algorithm
+      if din > 765.0 then
+        dout := 765.0;
+      elseif din < 110.0 then
+        dout := 110.0;
+      else
+        dout := din;
+      end if;
+      if dout < 390.0 then
+        Tmax := 554.3557377 + dout * 0.809344262;
+      else
+        Tmax := 1116.85 - dout * 0.632948717;
+      end if;
+      if dout < data.DCRIT then
+        Tmin := data.TCRIT * (1.0 - (dout - data.DCRIT) * (dout - data.DCRIT) / 1.0e6);
+      else
+        Tmin := data.TCRIT * (1.0 - (dout - data.DCRIT) * (dout - data.DCRIT) / 1.44e6);
+      end if;
+      if Tin < Tmin then
+        Tout := Tmin;
+      elseif Tin > Tmax then
+        Tout := Tmax;
+      else
+        Tout := Tin;
+      end if;
+    end fixdT;
+
+    function dofp13 "density at the boundary between regions 1 and 3"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output Modelica.Units.SI.Density d "density";
+    protected
+      Real p2 "auxiliary variable";
+      Real[3] o "vector of auxiliary variables";
+    algorithm
+      p2 := 7.1 - 6.04960677555959e-8 * p;
+      o[1] := p2 * p2;
+      o[2] := o[1] * o[1];
+      o[3] := o[2] * o[2];
+      d := 57.4756752485113 / (0.0737412153522555 + p2 * (0.00145092247736023 + p2 * (0.000102697173772229 + p2 * (0.0000114683182476084 + p2 * (1.99080616601101e-6 + o[1] * p2 * (1.13217858826367e-8 + o[2] * o[3] * p2 * (1.35549330686006e-17 + o[1] * ((-3.11228834832975e-19) + o[1] * o[2] * ((-7.02987180039442e-22) + p2 * (3.29199117056433e-22 + ((-5.17859076694812e-23) + 2.73712834080283e-24 * p2) * p2))))))))));
+    end dofp13;
+
+    function dofp23 "density at the boundary between regions 2 and 3"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      output Modelica.Units.SI.Density d "density";
+    protected
+      Modelica.Units.SI.Temperature T;
+      Real[13] o "vector of auxiliary variables";
+      Real taug "auxiliary variable";
+      Real pi "dimensionless pressure";
+      Real gpi23 "derivative of g w.r.t. pi on the boundary between regions 2 and 3";
+    algorithm
+      pi := p / data.PSTAR2;
+      T := 572.54459862746 + 31.3220101646784 * ((-13.91883977887) + pi) ^ 0.5;
+      o[1] := ((-13.91883977887) + pi) ^ 0.5;
+      taug := (-0.5) + 540.0 / (572.54459862746 + 31.3220101646784 * o[1]);
+      o[2] := taug * taug;
+      o[3] := o[2] * taug;
+      o[4] := o[2] * o[2];
+      o[5] := o[4] * o[4];
+      o[6] := o[5] * o[5];
+      o[7] := o[4] * o[5] * o[6] * taug;
+      o[8] := o[4] * o[5] * taug;
+      o[9] := o[2] * o[4] * o[5];
+      o[10] := pi * pi;
+      o[11] := o[10] * o[10];
+      o[12] := o[4] * o[6] * taug;
+      o[13] := o[6] * o[6];
+      gpi23 := (1.0 + pi * ((-0.0017731742473213) + taug * ((-0.017834862292358) + taug * ((-0.045996013696365) + ((-0.057581259083432) - 0.05032527872793 * o[3]) * taug)) + pi * (taug * ((-0.000066065283340406) + ((-0.0003789797503263) + o[2] * ((-0.007878555448671) + o[3] * ((-0.087594591301146) - 0.000053349095828174 * o[7]))) * taug) + pi * (6.1445213076927e-8 + (1.31612001853305e-6 + o[2] * ((-0.00009683303171571) + o[3] * ((-0.0045101773626444) - 0.122004760687947 * o[7]))) * taug + pi * (taug * ((-3.15389238237468e-9) + (5.116287140914e-8 + 1.92901490874028e-6 * taug) * taug) + pi * (0.0000114610381688305 * o[2] * o[4] * taug + pi * (o[3] * ((-1.00288598706366e-10) + o[8] * ((-0.012702883392813) - 143.374451604624 * o[2] * o[6] * taug)) + pi * ((-4.1341695026989e-17) + o[2] * o[5] * ((-8.8352662293707e-6) - 0.272627897050173 * o[9]) * taug + pi * (o[5] * (9.0049690883672e-11 - 65.8490727183984 * o[4] * o[5] * o[6]) + pi * (1.78287415218792e-7 * o[8] + pi * (o[4] * (1.0406965210174e-18 + o[2] * ((-1.0234747095929e-12) - 1.0018179379511e-8 * o[4]) * o[4]) + o[10] * o[11] * (((-1.29412653835176e-9) + 1.71088510070544 * o[12]) * o[7] + o[10] * ((-6.05920510335078 * o[13] * o[5] * o[6] * taug) + o[10] * (o[4] * o[6] * (1.78371690710842e-23 + o[2] * o[4] * o[5] * (6.1258633752464e-12 - 0.000084004935396416 * o[8]) * taug) + pi * ((-1.24017662339842e-24 * o[12]) + pi * (0.0000832192847496054 * o[13] * o[4] * o[6] * taug + pi * (o[2] * o[5] * o[6] * (1.75410265428146e-27 + (1.32995316841867e-15 - 0.0000226487297378904 * o[2] * o[6]) * o[9]) * pi - 2.93678005497663e-14 * o[13] * o[2] * o[4] * taug))))))))))))))))) / pi;
+      d := p / (data.RH2O * T * pi * gpi23);
+    end dofp23;
+
+    function dofpt3 "inverse iteration in region 3: (d) = f(p,T)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      input Modelica.Units.SI.Pressure delp "iteration converged if (p-pre(p) < delp)";
+      output Modelica.Units.SI.Density d "density";
+      output Integer error = 0 "error flag: iteration failed if different from 0";
+    protected
+      Modelica.Units.SI.Density dguess "guess density";
+      Integer i = 0 "loop counter";
+      Real dp "pressure difference";
+      Modelica.Units.SI.Density deld "density step";
+      Modelica.Media.Common.HelmholtzDerivs f "dimensionless Helmholtz function and dervatives wrt delta and tau";
+      Modelica.Media.Common.NewtonDerivatives_pT nDerivs "derivatives needed in Newton iteration";
+      Boolean found = false "flag for iteration success";
+      Boolean supercritical "flag, true for supercritical states";
+      Boolean liquid "flag, true for liquid states";
+      Modelica.Units.SI.Density dmin "lower density limit";
+      Modelica.Units.SI.Density dmax "upper density limit";
+      Modelica.Units.SI.Temperature Tmax "maximum temperature";
+    algorithm
+      assert(p >= data.PLIMIT4A, "BaseIF97.dofpt3: function called outside of region 3! p too low\n" + "p = " + String(p) + " Pa < " + String(data.PLIMIT4A) + " Pa");
+      assert(T >= data.TLIMIT1, "BaseIF97.dofpt3: function called outside of region 3! T too low\n" + "T = " + String(T) + " K < " + String(data.TLIMIT1) + " K");
+      assert(p >= Regions.boundary23ofT(T), "BaseIF97.dofpt3: function called outside of region 3! T too high\n" + "p = " + String(p) + " Pa, T = " + String(T) + " K");
+      supercritical := p > data.PCRIT;
+      dmax := dofp13(p);
+      dmin := dofp23(p);
+      Tmax := Regions.boundary23ofp(p);
+      if supercritical then
+        dguess := dmin + (T - data.TLIMIT1) / (data.TLIMIT1 - Tmax) * (dmax - dmin);
+      else
+        liquid := T < Basic.tsat(p);
+        if liquid then
+          dguess := 0.5 * (Regions.rhol_p_R4b(p) + dmax);
+        else
+          dguess := 0.5 * (Regions.rhov_p_R4b(p) + dmin);
+        end if;
+      end if;
+//this may need improvement!!
+      while i < IterationData.IMAX and not found loop
+        d := dguess;
+        f := Basic.f3(d, T);
+        nDerivs := Modelica.Media.Common.Helmholtz_pT(f);
+        dp := nDerivs.p - p;
+        if abs(dp / p) <= delp then
+          found := true;
+        end if;
+        deld := dp / nDerivs.pd;
+        d := d - deld;
+        if d > dmin and d < dmax then
+          dguess := d;
+        else
+          if d > dmax then
+            dguess := dmax - sqrt(Modelica.Constants.eps);
+          else
+            dguess := dmin + sqrt(Modelica.Constants.eps);
+          end if;
+        end if;
+        i := i + 1;
+      end while;
+// put it on the correct spot just inside the boundary here instead
+      if not found then
+        error := 1;
+      end if;
+      assert(error <> 1, "error in inverse function dofpt3: iteration failed");
+    end dofpt3;
+
+    // for all iteration functions: project to bounadries possible
+    // if p is input. Step 1 get dofpt_efficient(p,T) at boundary
+    // for T, use boundary itself if off limits, for d a bit inside
+
+    function dtofph3 "inverse iteration in region 3: (d,T) = f(p,h)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Modelica.Units.SI.Pressure delp "iteration accuracy";
+      input Modelica.Units.SI.SpecificEnthalpy delh "iteration accuracy";
+      output Modelica.Units.SI.Density d "density";
+      output Modelica.Units.SI.Temperature T "temperature (K)";
+      output Integer error "error flag: iteration failed if different from 0";
+    protected
+      Modelica.Units.SI.Temperature Tguess "initial temperature";
+      Modelica.Units.SI.Density dguess "initial density";
+      Integer i "iteration counter";
+      Real dh "Newton-error in h-direction";
+      Real dp "Newton-error in p-direction";
+      Real det "determinant of directional derivatives";
+      Real deld "Newton-step in d-direction";
+      Real delt "Newton-step in T-direction";
+      Modelica.Media.Common.HelmholtzDerivs f "dimensionless Helmholtz function and dervatives wrt delta and tau";
+      Modelica.Media.Common.NewtonDerivatives_ph nDerivs "derivatives needed in Newton iteration";
+      Boolean found = false "flag for iteration success";
+      Integer subregion "1 for subregion 3a, 2 for subregion 3b";
+    algorithm
+      if p < data.PCRIT then
+        subregion := if h < Regions.hl_p(p) + 10.0 then 1 else if h > Regions.hv_p(p) - 10.0 then 2 else 0;
+        assert(subregion <> 0, "inverse iteration of dt from ph called in 2 phase region: this can not work");
+      else
+        subregion := if h < Basic.h3ab_p(p) then 1 else 2;
+      end if;
+// allow a 10 J margin inside the (well approximated) phase boundary
+//supercritical
+      T := if subregion == 1 then Basic.T3a_ph(p, h) else Basic.T3b_ph(p, h);
+      d := if subregion == 1 then 1 / Basic.v3a_ph(p, h) else 1 / Basic.v3b_ph(p, h);
+      i := 0;
+      error := 0;
+      while i < IterationData.IMAX and not found loop
+        f := Basic.f3(d, T);
+        nDerivs := Modelica.Media.Common.Helmholtz_ph(f);
+        dh := nDerivs.h - h;
+        dp := nDerivs.p - p;
+        if abs(dh / h) <= delh and abs(dp / p) <= delp then
+          found := true;
+        end if;
+        det := nDerivs.ht * nDerivs.pd - nDerivs.pt * nDerivs.hd;
+        delt := (nDerivs.pd * dh - nDerivs.hd * dp) / det;
+        deld := (nDerivs.ht * dp - nDerivs.pt * dh) / det;
+        T := T - delt;
+        d := d - deld;
+        dguess := d;
+        Tguess := T;
+        i := i + 1;
+        (d, T) := fixdT(dguess, Tguess);
+      end while;
+      if not found then
+        error := 1;
+      end if;
+      assert(error <> 1, "error in inverse function dtofph3: iteration failed");
+    end dtofph3;
+
+    function dtofps3 "inverse iteration in region 3: (d,T) = f(p,s)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      input Modelica.Units.SI.Pressure delp "iteration accuracy";
+      input Modelica.Units.SI.SpecificEntropy dels "iteration accuracy";
+      output Modelica.Units.SI.Density d "density";
+      output Modelica.Units.SI.Temperature T "temperature (K)";
+      output Integer error "error flag: iteration failed if different from 0";
+    protected
+      Modelica.Units.SI.Temperature Tguess "initial temperature";
+      Modelica.Units.SI.Density dguess "initial density";
+      Integer i "iteration counter";
+      Real ds "Newton-error in s-direction";
+      Real dp "Newton-error in p-direction";
+      Real det "determinant of directional derivatives";
+      Real deld "Newton-step in d-direction";
+      Real delt "Newton-step in T-direction";
+      Modelica.Media.Common.HelmholtzDerivs f "dimensionless Helmholtz function and dervatives wrt delta and tau";
+      Modelica.Media.Common.NewtonDerivatives_ps nDerivs "derivatives needed in Newton iteration";
+      Boolean found "flag for iteration success";
+      Integer subregion "1 for subregion 3a, 2 for subregion 3b";
+    algorithm
+      i := 0;
+      error := 0;
+      found := false;
+      if p < data.PCRIT then
+        subregion := if s < Regions.sl_p(p) + 10.0 then 1 else if s > Regions.sv_p(p) - 10.0 then 2 else 0;
+        assert(subregion <> 0, "inverse iteration of dt from ps called in 2 phase region: this is illegal!");
+      else
+        subregion := if s < data.SCRIT then 1 else 2;
+      end if;
+// allow a 1 J/K margin inside the (well approximated) phase boundary
+      T := if subregion == 1 then Basic.T3a_ps(p, s) else Basic.T3b_ps(p, s);
+      d := if subregion == 1 then 1 / Basic.v3a_ps(p, s) else 1 / Basic.v3b_ps(p, s);
+      while i < IterationData.IMAX and not found loop
+        f := Basic.f3(d, T);
+        nDerivs := Modelica.Media.Common.Helmholtz_ps(f);
+        ds := nDerivs.s - s;
+        dp := nDerivs.p - p;
+        if abs(ds / s) <= dels and abs(dp / p) <= delp then
+          found := true;
+        end if;
+        det := nDerivs.st * nDerivs.pd - nDerivs.pt * nDerivs.sd;
+        delt := (nDerivs.pd * ds - nDerivs.sd * dp) / det;
+        deld := (nDerivs.st * dp - nDerivs.pt * ds) / det;
+        T := T - delt;
+        d := d - deld;
+        dguess := d;
+        Tguess := T;
+        i := i + 1;
+        (d, T) := fixdT(dguess, Tguess);
+      end while;
+      if not found then
+        error := 1;
+      end if;
+      assert(error <> 1, "error in inverse function dtofps3: iteration failed");
+    end dtofps3;
+
+    function dtofpsdt3 "inverse iteration in region 3: (d,T) = f(p,s)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      input Modelica.Units.SI.Density dguess "guess density, e.g. from adjacent volume";
+      input Modelica.Units.SI.Temperature Tguess "guess temperature, e.g. from adjacent volume";
+      input Modelica.Units.SI.Pressure delp "iteration accuracy";
+      input Modelica.Units.SI.SpecificEntropy dels "iteration accuracy";
+      output Modelica.Units.SI.Density d "density";
+      output Modelica.Units.SI.Temperature T "temperature (K)";
+      output Integer error "error flag: iteration failed if different from 0";
+    protected
+      Integer i "iteration counter";
+      Real ds "Newton-error in s-direction";
+      Real dp "Newton-error in p-direction";
+      Real det "determinant of directional derivatives";
+      Real deld "Newton-step in d-direction";
+      Real delt "Newton-step in T-direction";
+      Modelica.Media.Common.HelmholtzDerivs f "dimensionless Helmholtz function and dervatives wrt delta and tau";
+      Modelica.Media.Common.NewtonDerivatives_ps nDerivs "derivatives needed in Newton iteration";
+      Boolean found "flag for iteration success";
+      Modelica.Units.SI.Density diter "density";
+      Modelica.Units.SI.Temperature Titer "temperature (K)";
+    algorithm
+      i := 0;
+      error := 0;
+      found := false;
+      (diter, Titer) := fixdT(dguess, Tguess);
+      while i < IterationData.IMAX and not found loop
+        (d, T) := fixdT(diter, Titer);
+        f := Basic.f3(d, T);
+        nDerivs := Modelica.Media.Common.Helmholtz_ps(f);
+        ds := nDerivs.s - s;
+        dp := nDerivs.p - p;
+        if abs(ds / s) <= dels and abs(dp / p) <= delp then
+          found := true;
+        end if;
+        det := nDerivs.st * nDerivs.pd - nDerivs.pt * nDerivs.sd;
+        delt := (nDerivs.pd * ds - nDerivs.sd * dp) / det;
+        deld := (nDerivs.st * dp - nDerivs.pt * ds) / det;
+        T := T - delt;
+        d := d - deld;
+        diter := d;
+        Titer := T;
+        i := i + 1;
+      end while;
+      if not found then
+        error := 1;
+      end if;
+      assert(error <> 1, "error in inverse function dtofpsdt3: iteration failed");
+    end dtofpsdt3;
+
+    function pofdt125 "inverse iteration in region 1,2 and 5: p = g(d,T)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature (K)";
+      input Modelica.Units.SI.Pressure reldd "relative iteration accuracy of density";
+      input Integer region "region in IAPWS/IF97 in which inverse should be calculated";
+      output Modelica.Units.SI.Pressure p "pressure";
+      output Integer error "error flag: iteration failed if different from 0";
+    protected
+      Integer i "counter for while-loop";
+      Modelica.Media.Common.GibbsDerivs g "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      Boolean found "flag if iteration has been successful";
+      Real dd "difference between density for  guessed p and the current density";
+      Real delp "step in p in Newton-iteration";
+      Real relerr "relative error in d";
+      Modelica.Units.SI.Pressure pguess1 = 1.0e6 "initial pressure guess in region 1";
+      Modelica.Units.SI.Pressure pguess2 "initial pressure guess in region 2";
+      constant Modelica.Units.SI.Pressure pguess5 = 0.5e6 "initial pressure guess in region 5";
+    algorithm
+      i := 0;
+      error := 0;
+      pguess2 := 42800 * d;
+      found := false;
+      if region == 1 then
+        p := pguess1;
+      elseif region == 2 then
+        p := pguess2;
+      else
+        p := pguess5;
+      end if;
+      while i < IterationData.IMAX and not found loop
+        if region == 1 then
+          g := Basic.g1(p, T);
+        elseif region == 2 then
+          g := Basic.g2(p, T);
+        else
+          g := Basic.g5(p, T);
+        end if;
+        dd := p / (data.RH2O * T * g.pi * g.gpi) - d;
+        relerr := dd / d;
+        if abs(relerr) < reldd then
+          found := true;
+        end if;
+        delp := dd * (-p * p / (d * d * data.RH2O * T * g.pi * g.pi * g.gpipi));
+        p := p - delp;
+        i := i + 1;
+        if not found then
+          if p < triple.ptriple then
+            p := 2.0 * triple.ptriple;
+          end if;
+          if p > data.PLIMIT1 then
+            p := 0.95 * data.PLIMIT1;
+          end if;
+        end if;
+      end while;
+// print("i = " + i2s(i) + ", p = " + r2s(p/1.0e5) + ", delp = " + r2s(delp*1.0e-5) + "\n");
+      if not found then
+        error := 1;
+      end if;
+      assert(error <> 1, "error in inverse function pofdt125: iteration failed");
+    end pofdt125;
+
+    function tofph5 "inverse iteration in region 5: (p,T) = f(p,h)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Modelica.Units.SI.SpecificEnthalpy reldh "iteration accuracy";
+      output Modelica.Units.SI.Temperature T "temperature (K)";
+      output Integer error "error flag: iteration failed if different from 0";
+    protected
+      Modelica.Media.Common.GibbsDerivs g "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      Modelica.Units.SI.SpecificEnthalpy proh "h for current guess in T";
+      constant Modelica.Units.SI.Temperature Tguess = 1500 "initial temperature";
+      Integer i "iteration counter";
+      Real relerr "relative error in h";
+      Real dh "Newton-error in h-direction";
+      Real dT "Newton-step in T-direction";
+      Boolean found "flag for iteration success";
+    algorithm
+      i := 0;
+      error := 0;
+      T := Tguess;
+      found := false;
+      while i < IterationData.IMAX and not found loop
+        g := Basic.g5(p, T);
+        proh := data.RH2O * T * g.tau * g.gtau;
+        dh := proh - h;
+        relerr := dh / h;
+        if abs(relerr) < reldh then
+          found := true;
+        end if;
+        dT := dh / (-data.RH2O * g.tau * g.tau * g.gtautau);
+        T := T - dT;
+        i := i + 1;
+      end while;
+      if not found then
+        error := 1;
+      end if;
+      assert(error <> 1, "error in inverse function tofph5: iteration failed");
+    end tofph5;
+
+    function tofps5 "inverse iteration in region 5: (p,T) = f(p,s)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      input Modelica.Units.SI.SpecificEnthalpy relds "iteration accuracy";
+      output Modelica.Units.SI.Temperature T "temperature (K)";
+      output Integer error "error flag: iteration failed if different from 0";
+    protected
+      Modelica.Media.Common.GibbsDerivs g "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      Modelica.Units.SI.SpecificEntropy pros "s for current guess in T";
+      parameter Modelica.Units.SI.Temperature Tguess = 1500 "initial temperature";
+      Integer i "iteration counter";
+      Real relerr "relative error in s";
+      Real ds "Newton-error in s-direction";
+      Real dT "Newton-step in T-direction";
+      Boolean found "flag for iteration success";
+    algorithm
+      i := 0;
+      error := 0;
+      T := Tguess;
+      found := false;
+      while i < IterationData.IMAX and not found loop
+        g := Basic.g5(p, T);
+        pros := data.RH2O * (g.tau * g.gtau - g.g);
+        ds := pros - s;
+        relerr := ds / s;
+        if abs(relerr) < relds then
+          found := true;
+        end if;
+        dT := ds * T / (-data.RH2O * g.tau * g.tau * g.gtautau);
+        T := T - dT;
+        i := i + 1;
+      end while;
+      if not found then
+        error := 1;
+      end if;
+      assert(error <> 1, "error in inverse function tofps5: iteration failed");
+    end tofps5;
+
+    function tofpst5 "inverse iteration in region 5: (p,T) = f(p,s)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      input Modelica.Units.SI.Temperature Tguess "guess temperature, e.g. from adjacent volume";
+      input Modelica.Units.SI.SpecificEntropy relds "iteration accuracy";
+      output Modelica.Units.SI.Temperature T "temperature (K)";
+      output Integer error "error flag: iteration failed if different from 0";
+    protected
+      Modelica.Media.Common.GibbsDerivs g "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      Modelica.Units.SI.SpecificEntropy pros "s for current guess in T";
+      Integer i "iteration counter";
+      Real relerr "relative error in s";
+      Real ds "Newton-error in s-direction";
+      Real dT "Newton-step in T-direction";
+      Boolean found "flag for iteration success";
+    algorithm
+      i := 0;
+      error := 0;
+      T := Tguess;
+      found := false;
+      while i < IterationData.IMAX and not found loop
+        g := Basic.g5(p, T);
+        pros := data.RH2O * (g.tau * g.gtau - g.g);
+        ds := pros - s;
+        relerr := ds / s;
+        if abs(relerr) < relds then
+          found := true;
+        end if;
+        dT := ds * T / (-data.RH2O * g.tau * g.tau * g.gtautau);
+        T := T - dT;
+        i := i + 1;
+      end while;
+      if not found then
+        error := 1;
+      end if;
+      assert(error <> 1, "error in inverse function tofpst5: iteration failed");
+    end tofpst5;
+    annotation(
+      Documentation(info = "<HTML><h4>Package description</h4>
           <p></p>
           <h4>Package contents</h4>
           <p>
@@ -6599,340 +4259,183 @@
           <li>Documentation added: December 2002</li>
           </ul>
           </HTML>
-          "), Icon(graphics={
-          Text(
-            extent={{-102,0},{24,-26}},
-            lineColor={242,148,0},
-            textString=
-                 "Thermo"),
-          Text(
-            extent={{-4,8},{68,-34}},
-            lineColor={46,170,220},
-            textString=
-                 "SysPro"),
-          Polygon(
-            points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},{
-                42,8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},{
-                -50,6},{-62,2}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{-46,
-                8},{-42,22},{-42,30},{-44,38}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{-12,
-                12},{-26,12},{-28,12},{-26,20}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,30},{-6,26}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,36},{-6,32}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,42},{-6,38}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,48},{-6,44}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,32},{-2,28}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,38},{-2,34}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,44},{-2,40}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,50},{-2,46}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{-2,
-                20}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},{
-                42,6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},{
-                -50,6},{-62,2}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Line(
-            points={{22,12},{22,14},{22,16},{24,14},{20,18}},
-            color={46,170,220},
-            thickness=0.5),
-          Line(
-            points={{26,12},{26,14},{26,16},{28,14},{24,18}},
-            color={46,170,220},
-            thickness=0.5),
-          Line(
-            points={{30,10},{30,12},{30,14},{32,12},{28,16}},
-            color={46,170,220},
-            thickness=0.5),
-          Polygon(
-            points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}),
-          Line(
-            points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}},
-            color={0,0,255},
-            smooth=Smooth.None),
-          Line(
-            points={{80,80},{100,100}},
-            color={0,0,255},
-            smooth=Smooth.None)}));
-  end Inverses;
-
-  package TwoPhase
-    "steam properties in the two-phase rgion and on the phase boundaries"
-
-    function waterLiq_p "properties on the liquid phase boundary of region 4"
-
-      extends Modelica.Icons.Function;
-      input SI.Pressure p "pressure";
-      output Modelica.Media.Common.PhaseBoundaryProperties liq
-        "liquid thermodynamic property collection";
-    protected
-      SI.Temperature Tsat "saturation temperature";
-      Real dpT "derivative of saturation pressure wrt temperature";
-      SI.Density dl "liquid density";
-      Modelica.Media.Common.GibbsDerivs g
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      Modelica.Media.Common.HelmholtzDerivs f
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-    algorithm
-      Tsat := Basic.tsat(p);
-      dpT := Basic.dptofT(Tsat);
-      if p < data.PLIMIT4A then
-        g := Basic.g1(p, Tsat);
-        liq := Modelica.Media.Common.gibbsToBoundaryProps(g);
-      else
-        dl := Regions.rhol_p_R4b(p);
-        f := Basic.f3(dl, Tsat);
-        liq := Modelica.Media.Common.helmholtzToBoundaryProps(f);
-      end if;
-    end waterLiq_p;
-
-    function waterVap_p "properties on the vapour phase boundary of region 4"
-
-      extends Modelica.Icons.Function;
-      input SI.Pressure p "pressure";
-      output Modelica.Media.Common.PhaseBoundaryProperties vap
-        "vapour thermodynamic property collection";
-    protected
-      SI.Temperature Tsat "saturation temperature";
-      Real dpT "derivative of saturation pressure wrt temperature";
-      SI.Density dv "vapour density";
-      Modelica.Media.Common.GibbsDerivs g
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      Modelica.Media.Common.HelmholtzDerivs f
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-    algorithm
-      Tsat := Basic.tsat(p);
-      dpT := Basic.dptofT(Tsat);
-      if p < data.PLIMIT4A then
-        g := Basic.g2(p, Tsat);
-        vap := Modelica.Media.Common.gibbsToBoundaryProps(g);
-      else
-        dv := Regions.rhov_p_R4b(p);
-        f := Basic.f3(dv, Tsat);
-        vap := Modelica.Media.Common.helmholtzToBoundaryProps(f);
-      end if;
-    end waterVap_p;
-
-    function waterSat_ph
-      "Water saturation properties in the 2-phase region (4) as f(p,h)"
-
-      extends Modelica.Icons.Function;
-      input SI.Pressure p "pressure";
-      input SI.SpecificEnthalpy h "specific enthalpy";
-      output Modelica.Media.Common.SaturationProperties pro
-        "thermodynamic property collection";
-    protected
-      SI.Density dl "liquid density";
-      SI.Density dv "vapour density";
-      Modelica.Media.Common.GibbsDerivs gl
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      Modelica.Media.Common.GibbsDerivs gv
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      Modelica.Media.Common.HelmholtzDerivs fl
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-      Modelica.Media.Common.HelmholtzDerivs fv
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-    algorithm
-      pro.h := h;
-      pro.p := p;
-      pro.T := Basic.tsat(p);
-      pro.dpT := Basic.dptofT(pro.T);
-      if p < data.PLIMIT4A then
-        gl := Basic.g1(p, pro.T);
-        gv := Basic.g2(p, pro.T);
-        pro.liq := Modelica.Media.Common.gibbsToBoundaryProps(gl);
-        pro.vap := Modelica.Media.Common.gibbsToBoundaryProps(gv);
-      else
-        dl := Regions.rhol_p_R4b(p);
-        dv := Regions.rhov_p_R4b(p);
-        fl := Basic.f3(dl, pro.T);
-        fv := Basic.f3(dv, pro.T);
-        pro.liq := Modelica.Media.Common.helmholtzToBoundaryProps(fl);
-        pro.vap := Modelica.Media.Common.helmholtzToBoundaryProps(fv);
-      end if;
-      pro.x := if (h < pro.liq.h) then 0.0 else if (pro.vap.h <> pro.liq.h) then
-              (h - pro.liq.h)/(pro.vap.h - pro.liq.h) else 1.0;
-      pro.d := pro.liq.d*pro.vap.d/(pro.vap.d + pro.x*(pro.liq.d - pro.vap.d));
-      pro.u := pro.x*pro.vap.u + (1 - pro.x)*pro.liq.u;
-      pro.s := pro.x*pro.vap.s + (1 - pro.x)*pro.liq.s;
-      pro.cp := Modelica.Constants.inf;
-      pro.cv := Modelica.Media.Common.cv2Phase(pro.liq, pro.vap, pro.x, pro.T,
-         p);
-      pro.kappa := 1/(pro.d*p)*pro.dpT*pro.dpT*pro.T/pro.cv;
-      pro.R := data.RH2O;
-    end waterSat_ph;
-
-    function waterR4_ph
-      "Water/Steam properties in region 4 of IAPWS/IF97 (two-phase)"
-
-      extends Modelica.Icons.Function;
-      input SI.Pressure p "pressure";
-      input SI.SpecificEnthalpy h "specific enthalpy";
-      output ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro
-        "thermodynamic property collection";
-    protected
-      SI.Density dl "liquid density";
-      SI.Density dv "vapour density";
-      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties liq
-        "phase boundary property record";
-      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties vap
-        "phase boundary property record";
-      Modelica.Media.Common.GibbsDerivs gl
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      Modelica.Media.Common.GibbsDerivs gv
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      Modelica.Media.Common.HelmholtzDerivs fl
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-      Modelica.Media.Common.HelmholtzDerivs fv
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-      Modelica.SIunits.SpecificHeatCapacity cv;
-      Real dpT "derivative of saturation curve";
-    algorithm
-      pro.T := Basic.tsat(p);
-      dpT := Basic.dptofT(pro.T);
-      dl := Regions.rhol_p_R4b(p);
-      dv := Regions.rhov_p_R4b(p);
-      if p < data.PLIMIT4A then
-        gl := Basic.g1(p, pro.T);
-        gv := Basic.g2(p, pro.T);
-        liq := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps(gl);
-        vap := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps(gv);
-      else
-        fl := Basic.f3(dl, pro.T);
-        fv := Basic.f3(dv, pro.T);
-        liq := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps(fl);
-        vap := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps(fv);
-      end if;
-      pro.x := if (vap.h <> liq.h) then (h - liq.h)/(vap.h - liq.h) else 1.0;
-      pro.d := liq.d*vap.d/(vap.d + pro.x*(liq.d - vap.d));
-      pro.u := pro.x*vap.u + (1 - pro.x)*liq.u;
-      pro.s := pro.x*vap.s + (1 - pro.x)*liq.s;
-      pro.cp := Modelica.Constants.inf;
-      cv := ThermoSysPro.Properties.WaterSteam.Common.cv2Phase(liq, vap, pro.x, pro.T, p);
-      pro.ddph := pro.d*(pro.d*cv/dpT + 1.0)/(dpT*pro.T);
-      pro.ddhp := -pro.d*pro.d/(dpT*pro.T);
-    end waterR4_ph;
-
-    function waterR4_dT "Water properties in region 4 as function of d and T"
-
-      extends Modelica.Icons.Function;
-      input SI.Density d "Density";
-      input SI.Temperature T "temperature";
-      output ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_dT
-                                        pro "thermodynamic property collection";
-    protected
-      SI.Density dl "liquid density";
-      SI.Density dv "vapour density";
-      Modelica.Media.Common.PhaseBoundaryProperties liq
-        "phase boundary property record";
-      Modelica.Media.Common.PhaseBoundaryProperties vap
-        "phase boundary property record";
-      Modelica.Media.Common.GibbsDerivs gl
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      Modelica.Media.Common.GibbsDerivs gv
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      Modelica.Media.Common.HelmholtzDerivs fl
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-      Modelica.Media.Common.HelmholtzDerivs fv
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-      Real x "dryness fraction";
-      Real dpT "derivative of saturation curve";
-    algorithm
-      pro.p := Basic.psat(T);
-      dpT := Basic.dptofT(T);
-      dl := Regions.rhol_p_R4b(pro.p);
-      dv := Regions.rhov_p_R4b(pro.p);
-      if pro.p < data.PLIMIT4A then
-        gl := Basic.g1(pro.p, T);
-        gv := Basic.g2(pro.p, T);
-        liq := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps(
-                                           gl);
-        vap := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps(
-                                           gv);
-      else
-        fl := Basic.f3(dl, T);
-        fv := Basic.f3(dv, T);
-        liq := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps(
-                                               fl);
-        vap := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps(
-                                               fv);
-      end if;
-      x := if (vap.d <> liq.d) then (1/d - 1/liq.d)/(1/vap.d - 1/liq.d) else
-        1.0;
-      pro.u := x*vap.u + (1 - x)*liq.u;
-      pro.h := x*vap.h + (1 - x)*liq.h;
-      pro.cp := Modelica.Constants.inf;
-    //  pro.cv := Modelica.Media.Common.cv2Phase(liq, vap, x, T, pro.p);
-    //   pro.kappa := 1/(d*pro.p)*dpT*dpT*T/pro.cv;
-    //   pro.a := Modelica.Constants.inf;
-    //   pro.R := data.RH2O;
-      pro.dudT := (pro.p - T*dpT)/(d*d);
-    end waterR4_dT;
-    annotation (Documentation(info="<HTML><h4>Package description</h4>
+          "),
+      Icon(graphics = {Text(extent = {{-102, 0}, {24, -26}}, lineColor = {242, 148, 0}, textString = "Thermo"), Text(extent = {{-4, 8}, {68, -34}}, lineColor = {46, 170, 220}, textString = "SysPro"), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-32, 12}, {-16, 14}, {6, 14}, {26, 12}, {42, 8}, {52, 2}, {42, 6}, {28, 10}, {6, 12}, {-12, 12}, {-16, 12}, {-34, 10}, {-50, 6}, {-62, 2}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-44, 38}, {-24, 38}, {-26, 30}, {-26, 22}, {-24, 14}, {-24, 12}, {-46, 8}, {-42, 22}, {-42, 30}, {-44, 38}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-26, 20}, {-20, 20}, {-20, 22}, {-14, 22}, {-14, 20}, {-12, 20}, {-12, 12}, {-26, 12}, {-28, 12}, {-26, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-8, 14}, {-8, 24}, {-6, 24}, {-6, 14}, {-8, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 30}, {-6, 26}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 36}, {-6, 32}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 42}, {-6, 38}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 48}, {-6, 44}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-4, 14}, {-4, 26}, {-2, 26}, {-2, 14}, {-4, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 32}, {-2, 28}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 38}, {-2, 34}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 44}, {-2, 40}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 50}, {-2, 46}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-2, 20}, {8, 20}, {8, 22}, {10, 22}, {18, 22}, {18, 12}, {-4, 14}, {-2, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-36, 10}, {-18, 12}, {6, 12}, {26, 10}, {42, 6}, {52, 0}, {42, 4}, {28, 8}, {6, 10}, {-12, 10}, {-18, 10}, {-38, 8}, {-50, 6}, {-62, 2}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Line(points = {{22, 12}, {22, 14}, {22, 16}, {24, 14}, {20, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{26, 12}, {26, 14}, {26, 16}, {28, 14}, {24, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{30, 10}, {30, 12}, {30, 14}, {32, 12}, {28, 16}}, color = {46, 170, 220}, thickness = 0.5), Polygon(points = {{36, 8}, {36, 30}, {34, 34}, {36, 38}, {40, 38}, {40, 8}, {36, 8}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 80}, {80, -100}}, lineColor = {0, 0, 255}), Line(points = {{-100, 80}, {-80, 100}, {100, 100}, {100, -80}, {80, -100}}, color = {0, 0, 255}, smooth = Smooth.None), Line(points = {{80, 80}, {100, 100}}, color = {0, 0, 255}, smooth = Smooth.None)}));
+  end Inverses;
+
+  package TwoPhase "steam properties in the two-phase rgion and on the phase boundaries"
+    function waterLiq_p "properties on the liquid phase boundary of region 4"
+      extends Modelica.Icons.Function;
+      input SI.Pressure p "pressure";
+      output Modelica.Media.Common.PhaseBoundaryProperties liq "liquid thermodynamic property collection";
+    protected
+      SI.Temperature Tsat "saturation temperature";
+      Real dpT "derivative of saturation pressure wrt temperature";
+      SI.Density dl "liquid density";
+      Modelica.Media.Common.GibbsDerivs g "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      Modelica.Media.Common.HelmholtzDerivs f "dimensionless Helmholtz function and dervatives wrt delta and tau";
+    algorithm
+      Tsat := Basic.tsat(p);
+      dpT := Basic.dptofT(Tsat);
+      if p < data.PLIMIT4A then
+        g := Basic.g1(p, Tsat);
+        liq := Modelica.Media.Common.gibbsToBoundaryProps(g);
+      else
+        dl := Regions.rhol_p_R4b(p);
+        f := Basic.f3(dl, Tsat);
+        liq := Modelica.Media.Common.helmholtzToBoundaryProps(f);
+      end if;
+    end waterLiq_p;
+
+    function waterVap_p "properties on the vapour phase boundary of region 4"
+      extends Modelica.Icons.Function;
+      input SI.Pressure p "pressure";
+      output Modelica.Media.Common.PhaseBoundaryProperties vap "vapour thermodynamic property collection";
+    protected
+      SI.Temperature Tsat "saturation temperature";
+      Real dpT "derivative of saturation pressure wrt temperature";
+      SI.Density dv "vapour density";
+      Modelica.Media.Common.GibbsDerivs g "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      Modelica.Media.Common.HelmholtzDerivs f "dimensionless Helmholtz function and dervatives wrt delta and tau";
+    algorithm
+      Tsat := Basic.tsat(p);
+      dpT := Basic.dptofT(Tsat);
+      if p < data.PLIMIT4A then
+        g := Basic.g2(p, Tsat);
+        vap := Modelica.Media.Common.gibbsToBoundaryProps(g);
+      else
+        dv := Regions.rhov_p_R4b(p);
+        f := Basic.f3(dv, Tsat);
+        vap := Modelica.Media.Common.helmholtzToBoundaryProps(f);
+      end if;
+    end waterVap_p;
+
+    function waterSat_ph "Water saturation properties in the 2-phase region (4) as f(p,h)"
+      extends Modelica.Icons.Function;
+      input SI.Pressure p "pressure";
+      input SI.SpecificEnthalpy h "specific enthalpy";
+      output Modelica.Media.Common.SaturationProperties pro "thermodynamic property collection";
+    protected
+      SI.Density dl "liquid density";
+      SI.Density dv "vapour density";
+      Modelica.Media.Common.GibbsDerivs gl "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      Modelica.Media.Common.GibbsDerivs gv "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      Modelica.Media.Common.HelmholtzDerivs fl "dimensionless Helmholtz function and dervatives wrt delta and tau";
+      Modelica.Media.Common.HelmholtzDerivs fv "dimensionless Helmholtz function and dervatives wrt delta and tau";
+    algorithm
+      pro.h := h;
+      pro.p := p;
+      pro.T := Basic.tsat(p);
+      pro.dpT := Basic.dptofT(pro.T);
+      if p < data.PLIMIT4A then
+        gl := Basic.g1(p, pro.T);
+        gv := Basic.g2(p, pro.T);
+        pro.liq := Modelica.Media.Common.gibbsToBoundaryProps(gl);
+        pro.vap := Modelica.Media.Common.gibbsToBoundaryProps(gv);
+      else
+        dl := Regions.rhol_p_R4b(p);
+        dv := Regions.rhov_p_R4b(p);
+        fl := Basic.f3(dl, pro.T);
+        fv := Basic.f3(dv, pro.T);
+        pro.liq := Modelica.Media.Common.helmholtzToBoundaryProps(fl);
+        pro.vap := Modelica.Media.Common.helmholtzToBoundaryProps(fv);
+      end if;
+      pro.x := if h < pro.liq.h then 0.0 else if pro.vap.h <> pro.liq.h then (h - pro.liq.h) / (pro.vap.h - pro.liq.h) else 1.0;
+      pro.d := pro.liq.d * pro.vap.d / (pro.vap.d + pro.x * (pro.liq.d - pro.vap.d));
+      pro.u := pro.x * pro.vap.u + (1 - pro.x) * pro.liq.u;
+      pro.s := pro.x * pro.vap.s + (1 - pro.x) * pro.liq.s;
+      pro.cp := Modelica.Constants.inf;
+      pro.cv := Modelica.Media.Common.cv2Phase(pro.liq, pro.vap, pro.x, pro.T, p);
+      pro.kappa := 1 / (pro.d * p) * pro.dpT * pro.dpT * pro.T / pro.cv;
+      pro.R_s := data.RH2O;
+    end waterSat_ph;
+
+    function waterR4_ph "Water/Steam properties in region 4 of IAPWS/IF97 (two-phase)"
+      extends Modelica.Icons.Function;
+      input SI.Pressure p "pressure";
+      input SI.SpecificEnthalpy h "specific enthalpy";
+      output ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro "thermodynamic property collection";
+    protected
+      SI.Density dl "liquid density";
+      SI.Density dv "vapour density";
+      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties liq "phase boundary property record";
+      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties vap "phase boundary property record";
+      Modelica.Media.Common.GibbsDerivs gl "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      Modelica.Media.Common.GibbsDerivs gv "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      Modelica.Media.Common.HelmholtzDerivs fl "dimensionless Helmholtz function and dervatives wrt delta and tau";
+      Modelica.Media.Common.HelmholtzDerivs fv "dimensionless Helmholtz function and dervatives wrt delta and tau";
+      Modelica.Units.SI.SpecificHeatCapacity cv;
+      Real dpT "derivative of saturation curve";
+    algorithm
+      pro.T := Basic.tsat(p);
+      dpT := Basic.dptofT(pro.T);
+      dl := Regions.rhol_p_R4b(p);
+      dv := Regions.rhov_p_R4b(p);
+      if p < data.PLIMIT4A then
+        gl := Basic.g1(p, pro.T);
+        gv := Basic.g2(p, pro.T);
+        liq := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps(gl);
+        vap := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps(gv);
+      else
+        fl := Basic.f3(dl, pro.T);
+        fv := Basic.f3(dv, pro.T);
+        liq := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps(fl);
+        vap := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps(fv);
+      end if;
+      pro.x := if vap.h <> liq.h then (h - liq.h) / (vap.h - liq.h) else 1.0;
+      pro.d := liq.d * vap.d / (vap.d + pro.x * (liq.d - vap.d));
+      pro.u := pro.x * vap.u + (1 - pro.x) * liq.u;
+      pro.s := pro.x * vap.s + (1 - pro.x) * liq.s;
+      pro.cp := Modelica.Constants.inf;
+      cv := ThermoSysPro.Properties.WaterSteam.Common.cv2Phase(liq, vap, pro.x, pro.T, p);
+      pro.ddph := pro.d * (pro.d * cv / dpT + 1.0) / (dpT * pro.T);
+      pro.ddhp := -pro.d * pro.d / (dpT * pro.T);
+    end waterR4_ph;
+
+    function waterR4_dT "Water properties in region 4 as function of d and T"
+      extends Modelica.Icons.Function;
+      input SI.Density d "Density";
+      input SI.Temperature T "temperature";
+      output ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_dT pro "thermodynamic property collection";
+    protected
+      SI.Density dl "liquid density";
+      SI.Density dv "vapour density";
+      Modelica.Media.Common.PhaseBoundaryProperties liq "phase boundary property record";
+      Modelica.Media.Common.PhaseBoundaryProperties vap "phase boundary property record";
+      Modelica.Media.Common.GibbsDerivs gl "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      Modelica.Media.Common.GibbsDerivs gv "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      Modelica.Media.Common.HelmholtzDerivs fl "dimensionless Helmholtz function and dervatives wrt delta and tau";
+      Modelica.Media.Common.HelmholtzDerivs fv "dimensionless Helmholtz function and dervatives wrt delta and tau";
+      Real x "dryness fraction";
+      Real dpT "derivative of saturation curve";
+    algorithm
+      pro.p := Basic.psat(T);
+      dpT := Basic.dptofT(T);
+      dl := Regions.rhol_p_R4b(pro.p);
+      dv := Regions.rhov_p_R4b(pro.p);
+      if pro.p < data.PLIMIT4A then
+        gl := Basic.g1(pro.p, T);
+        gv := Basic.g2(pro.p, T);
+        liq := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps(gl);
+        vap := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps(gv);
+      else
+        fl := Basic.f3(dl, T);
+        fv := Basic.f3(dv, T);
+        liq := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps(fl);
+        vap := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps(fv);
+      end if;
+      x := if vap.d <> liq.d then (1 / d - 1 / liq.d) / (1 / vap.d - 1 / liq.d) else 1.0;
+      pro.u := x * vap.u + (1 - x) * liq.u;
+      pro.h := x * vap.h + (1 - x) * liq.h;
+      pro.cp := Modelica.Constants.inf;
+//  pro.cv := Modelica.Media.Common.cv2Phase(liq, vap, x, T, pro.p);
+//   pro.kappa := 1/(d*pro.p)*dpT*dpT*T/pro.cv;
+//   pro.a := Modelica.Constants.inf;
+//   pro.R := data.RH2O;
+      pro.dudT := (pro.p - T * dpT) / (d * d);
+    end waterR4_dT;
+    annotation(
+      Documentation(info = "<HTML><h4>Package description</h4>
           <p>Package TwoPhase provides functions to compute the steam properties
           in the two-phase region and on the phase boundaries</p>
           <h4>Package contents</h4>
@@ -6964,127 +4467,11 @@
           <li>Documented and re-organized: January 2003</li>
           </ul>
           </HTML>
-"), Icon(graphics={
-          Text(
-            extent={{-102,0},{24,-26}},
-            lineColor={242,148,0},
-            textString=
-                 "Thermo"),
-          Text(
-            extent={{-4,8},{68,-34}},
-            lineColor={46,170,220},
-            textString=
-                 "SysPro"),
-          Polygon(
-            points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},{
-                42,8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},{
-                -50,6},{-62,2}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{-46,
-                8},{-42,22},{-42,30},{-44,38}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{-12,
-                12},{-26,12},{-28,12},{-26,20}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,30},{-6,26}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,36},{-6,32}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,42},{-6,38}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,48},{-6,44}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,32},{-2,28}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,38},{-2,34}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,44},{-2,40}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,50},{-2,46}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{-2,
-                20}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},{
-                42,6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},{
-                -50,6},{-62,2}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Line(
-            points={{22,12},{22,14},{22,16},{24,14},{20,18}},
-            color={46,170,220},
-            thickness=0.5),
-          Line(
-            points={{26,12},{26,14},{26,16},{28,14},{24,18}},
-            color={46,170,220},
-            thickness=0.5),
-          Line(
-            points={{30,10},{30,12},{30,14},{32,12},{28,16}},
-            color={46,170,220},
-            thickness=0.5),
-          Polygon(
-            points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}),
-          Line(
-            points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}},
-            color={0,0,255},
-            smooth=Smooth.None),
-          Line(
-            points={{80,80},{100,100}},
-            color={0,0,255},
-            smooth=Smooth.None)}));
-  end TwoPhase;
-  annotation (Documentation(info="<HTML>
+      "),
+      Icon(graphics = {Text(extent = {{-102, 0}, {24, -26}}, lineColor = {242, 148, 0}, textString = "Thermo"), Text(extent = {{-4, 8}, {68, -34}}, lineColor = {46, 170, 220}, textString = "SysPro"), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-32, 12}, {-16, 14}, {6, 14}, {26, 12}, {42, 8}, {52, 2}, {42, 6}, {28, 10}, {6, 12}, {-12, 12}, {-16, 12}, {-34, 10}, {-50, 6}, {-62, 2}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-44, 38}, {-24, 38}, {-26, 30}, {-26, 22}, {-24, 14}, {-24, 12}, {-46, 8}, {-42, 22}, {-42, 30}, {-44, 38}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-26, 20}, {-20, 20}, {-20, 22}, {-14, 22}, {-14, 20}, {-12, 20}, {-12, 12}, {-26, 12}, {-28, 12}, {-26, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-8, 14}, {-8, 24}, {-6, 24}, {-6, 14}, {-8, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 30}, {-6, 26}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 36}, {-6, 32}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 42}, {-6, 38}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 48}, {-6, 44}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-4, 14}, {-4, 26}, {-2, 26}, {-2, 14}, {-4, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 32}, {-2, 28}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 38}, {-2, 34}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 44}, {-2, 40}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 50}, {-2, 46}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-2, 20}, {8, 20}, {8, 22}, {10, 22}, {18, 22}, {18, 12}, {-4, 14}, {-2, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-36, 10}, {-18, 12}, {6, 12}, {26, 10}, {42, 6}, {52, 0}, {42, 4}, {28, 8}, {6, 10}, {-12, 10}, {-18, 10}, {-38, 8}, {-50, 6}, {-62, 2}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Line(points = {{22, 12}, {22, 14}, {22, 16}, {24, 14}, {20, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{26, 12}, {26, 14}, {26, 16}, {28, 14}, {24, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{30, 10}, {30, 12}, {30, 14}, {32, 12}, {28, 16}}, color = {46, 170, 220}, thickness = 0.5), Polygon(points = {{36, 8}, {36, 30}, {34, 34}, {36, 38}, {40, 38}, {40, 8}, {36, 8}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 80}, {80, -100}}, lineColor = {0, 0, 255}), Line(points = {{-100, 80}, {-80, 100}, {100, 100}, {100, -80}, {80, -100}}, color = {0, 0, 255}, smooth = Smooth.None), Line(points = {{80, 80}, {100, 100}}, color = {0, 0, 255}, smooth = Smooth.None)}));
+  end TwoPhase;
+  annotation(
+    Documentation(info = "<HTML>
     <h4>Version Info and Revision history
         </h4>
         <ul>
@@ -7447,123 +4834,6 @@
         one-phase regions of IF97 using inputs (p,T).</li>
         </ul>
         </p>
-        </HTML>"), Icon(graphics={
-        Text(
-          extent={{-102,0},{24,-26}},
-          lineColor={242,148,0},
-          textString=
-               "Thermo"),
-        Text(
-          extent={{-4,8},{68,-34}},
-          lineColor={46,170,220},
-          textString=
-               "SysPro"),
-        Polygon(
-          points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},{42,
-              8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},{-50,6},
-              {-62,2}},
-          lineColor={46,170,220},
-          fillColor={46,170,220},
-          fillPattern=FillPattern.Solid),
-        Polygon(
-          points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{-46,8},
-              {-42,22},{-42,30},{-44,38}},
-          lineColor={46,170,220},
-          fillColor={46,170,220},
-          fillPattern=FillPattern.Solid),
-        Polygon(
-          points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{-12,12},
-              {-26,12},{-28,12},{-26,20}},
-          lineColor={46,170,220},
-          fillColor={46,170,220},
-          fillPattern=FillPattern.Solid),
-        Polygon(
-          points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}},
-          lineColor={46,170,220},
-          fillColor={46,170,220},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-8,30},{-6,26}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-8,36},{-6,32}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-8,42},{-6,38}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-8,48},{-6,44}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Polygon(
-          points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}},
-          lineColor={46,170,220},
-          fillColor={46,170,220},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-4,32},{-2,28}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-4,38},{-2,34}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-4,44},{-2,40}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-4,50},{-2,46}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Polygon(
-          points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{-2,20}},
-          lineColor={46,170,220},
-          fillColor={46,170,220},
-          fillPattern=FillPattern.Solid),
-        Polygon(
-          points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},{42,
-              6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},{-50,6},
-              {-62,2}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Line(
-          points={{22,12},{22,14},{22,16},{24,14},{20,18}},
-          color={46,170,220},
-          thickness=0.5),
-        Line(
-          points={{26,12},{26,14},{26,16},{28,14},{24,18}},
-          color={46,170,220},
-          thickness=0.5),
-        Line(
-          points={{30,10},{30,12},{30,14},{32,12},{28,16}},
-          color={46,170,220},
-          thickness=0.5),
-        Polygon(
-          points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}},
-          lineColor={46,170,220},
-          fillColor={46,170,220},
-          fillPattern=FillPattern.Solid),
-        Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}),
-        Line(
-          points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}},
-          color={0,0,255},
-          smooth=Smooth.None),
-        Line(
-          points={{80,80},{100,100}},
-          color={0,0,255},
-          smooth=Smooth.None)}));
-
-end BaseIF97;
+        </HTML>"),
+    Icon(graphics = {Text(extent = {{-102, 0}, {24, -26}}, lineColor = {242, 148, 0}, textString = "Thermo"), Text(extent = {{-4, 8}, {68, -34}}, lineColor = {46, 170, 220}, textString = "SysPro"), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-32, 12}, {-16, 14}, {6, 14}, {26, 12}, {42, 8}, {52, 2}, {42, 6}, {28, 10}, {6, 12}, {-12, 12}, {-16, 12}, {-34, 10}, {-50, 6}, {-62, 2}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-44, 38}, {-24, 38}, {-26, 30}, {-26, 22}, {-24, 14}, {-24, 12}, {-46, 8}, {-42, 22}, {-42, 30}, {-44, 38}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-26, 20}, {-20, 20}, {-20, 22}, {-14, 22}, {-14, 20}, {-12, 20}, {-12, 12}, {-26, 12}, {-28, 12}, {-26, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-8, 14}, {-8, 24}, {-6, 24}, {-6, 14}, {-8, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 30}, {-6, 26}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 36}, {-6, 32}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 42}, {-6, 38}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 48}, {-6, 44}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-4, 14}, {-4, 26}, {-2, 26}, {-2, 14}, {-4, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 32}, {-2, 28}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 38}, {-2, 34}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 44}, {-2, 40}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 50}, {-2, 46}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-2, 20}, {8, 20}, {8, 22}, {10, 22}, {18, 22}, {18, 12}, {-4, 14}, {-2, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-36, 10}, {-18, 12}, {6, 12}, {26, 10}, {42, 6}, {52, 0}, {42, 4}, {28, 8}, {6, 10}, {-12, 10}, {-18, 10}, {-38, 8}, {-50, 6}, {-62, 2}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Line(points = {{22, 12}, {22, 14}, {22, 16}, {24, 14}, {20, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{26, 12}, {26, 14}, {26, 16}, {28, 14}, {24, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{30, 10}, {30, 12}, {30, 14}, {32, 12}, {28, 16}}, color = {46, 170, 220}, thickness = 0.5), Polygon(points = {{36, 8}, {36, 30}, {34, 34}, {36, 38}, {40, 38}, {40, 8}, {36, 8}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 80}, {80, -100}}, lineColor = {0, 0, 255}), Line(points = {{-100, 80}, {-80, 100}, {100, 100}, {100, -80}, {80, -100}}, color = {0, 0, 255}, smooth = Smooth.None), Line(points = {{80, 80}, {100, 100}}, color = {0, 0, 255}, smooth = Smooth.None)}));
+end BaseIF97;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam: BaseIF97.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam: BaseIF97.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam/Common.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam/Common.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam/Common.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam/Common.mo"	2022-03-10 09:58:38.776151825 +0000
@@ -1,11 +1,11 @@
-﻿within ThermoSysPro.Properties.WaterSteam;
+within ThermoSysPro.Properties.WaterSteam;
 package Common
-  import SI = Modelica.SIunits;
+  import Modelica.Units.SI;
 
   record HelmholtzData
-    Modelica.SIunits.Density d;
-    Modelica.SIunits.Temperature T;
-    Modelica.SIunits.SpecificHeatCapacity R;
+    Modelica.Units.SI.Density d;
+    Modelica.Units.SI.Temperature T;
+    Modelica.Units.SI.SpecificHeatCapacity R;
     annotation (
       Window(
         x=0.16,
@@ -36,9 +36,9 @@
   end HelmholtzData;
 
   record GibbsData
-    Modelica.SIunits.AbsolutePressure p;
-    Modelica.SIunits.Temperature T;
-    Modelica.SIunits.SpecificHeatCapacity R;
+    Modelica.Units.SI.AbsolutePressure p;
+    Modelica.Units.SI.Temperature T;
+    Modelica.Units.SI.SpecificHeatCapacity R;
     annotation (
       Window(
         x=0.16,
@@ -71,9 +71,9 @@
   record GibbsDerivs
     "derivatives of dimensionless Gibbs-function w.r.t dimensionless pressure and temperature"
     extends Modelica.Icons.Record;
-    Modelica.SIunits.Pressure p "pressure";
-    Modelica.SIunits.Temperature T "temperature";
-    Modelica.SIunits.SpecificHeatCapacity R "specific heat capacity";
+    Modelica.Units.SI.Pressure p "pressure";
+    Modelica.Units.SI.Temperature T "temperature";
+    Modelica.Units.SI.SpecificHeatCapacity R "specific heat capacity";
     Real pi(unit="1") "dimensionless pressure";
     Real tau(unit="1") "dimensionless temperature";
     Real g(unit="1") "dimensionless Gibbs-function";
@@ -87,9 +87,9 @@
   record HelmholtzDerivs
     "derivatives of dimensionless Helmholtz-function w.r.t dimensionless pressuredensity and temperature"
     extends Modelica.Icons.Record;
-    Modelica.SIunits.Density d "density";
-    Modelica.SIunits.Temperature T "temperature";
-    Modelica.SIunits.SpecificHeatCapacity R "specific heat capacity";
+    Modelica.Units.SI.Density d "density";
+    Modelica.Units.SI.Temperature T "temperature";
+    Modelica.Units.SI.SpecificHeatCapacity R "specific heat capacity";
     Real delta(unit="1") "dimensionless density";
     Real tau(unit="1") "dimensionless temperature";
     Real f(unit="1") "dimensionless Helmholtz-function";
@@ -101,29 +101,29 @@
   end HelmholtzDerivs;
 
   record ThermoProperties_ph
-    Modelica.SIunits.Temperature T(
+    Modelica.Units.SI.Temperature T(
       min=InitLimits.TMIN,
       max=InitLimits.TMAX,
       nominal=InitLimits.TNOM) "Temperature";
-    Modelica.SIunits.Density d(
+    Modelica.Units.SI.Density d(
       min=InitLimits.DMIN,
       max=InitLimits.DMAX,
       nominal=InitLimits.DNOM) "Density";
-    Modelica.SIunits.SpecificEnergy u(
+    Modelica.Units.SI.SpecificEnergy u(
       min=InitLimits.SEMIN,
       max=InitLimits.SEMAX,
       nominal=InitLimits.SENOM) "Specific inner energy";
-    Modelica.SIunits.SpecificEntropy s(
+    Modelica.Units.SI.SpecificEntropy s(
       min=InitLimits.SSMIN,
       max=InitLimits.SSMAX,
       nominal=InitLimits.SSNOM) "Specific entropy";
-    Modelica.SIunits.SpecificHeatCapacity cp(
+    Modelica.Units.SI.SpecificHeatCapacity cp(
       min=InitLimits.CPMIN,
       max=InitLimits.CPMAX,
       nominal=InitLimits.CPNOM) "Specific heat capacity at constant presure";
-    Modelica.SIunits.DerDensityByEnthalpy ddhp
+    Modelica.Units.SI.DerDensityByEnthalpy ddhp
       "Derivative of density wrt. specific enthalpy at constant pressure";
-    Modelica.SIunits.DerDensityByPressure ddph
+    Modelica.Units.SI.DerDensityByPressure ddph
       "Derivative of density wrt. pressure at constant specific enthalpy";
     Real duph(unit="m3/kg")
       "Derivative of specific inner energy wrt. pressure at constant specific enthalpy";
@@ -214,8 +214,8 @@
   end gibbsToProps_ph;
 
   record NewtonDerivatives_ph
-    Modelica.SIunits.AbsolutePressure p;
-    Modelica.SIunits.SpecificEnthalpy h;
+    Modelica.Units.SI.AbsolutePressure p;
+    Modelica.Units.SI.SpecificEnthalpy h;
     Real pd;
     Real pt;
     Real hd;
@@ -264,7 +264,7 @@
     pro.s := f.R*(f.tau*f.ftau - f.f);
     pro.u := f.R*f.T*f.tau*f.ftau;
     cv := f.R*(-f.tau*f.tau*f.ftautau);
-    // calculating cp near the critical point may be troublesome (cp -> inf).
+// calculating cp near the critical point may be troublesome (cp -> inf).
     pro.cp := f.R*(-f.tau*f.tau*f.ftautau + (f.delta*f.fdelta - f.delta*f.tau
               *f.fdeltatau)^2/(2*f.delta*f.fdelta + f.delta*f.delta*f.fdeltadelta));
     pd := f.R*f.T*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta);
@@ -297,13 +297,13 @@
   record PhaseBoundaryProperties
     "thermodynamic base properties on the phase boundary"
     extends Modelica.Icons.Record;
-    Modelica.SIunits.Density d "density";
-    Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    Modelica.SIunits.SpecificEnergy u "inner energy";
-    Modelica.SIunits.SpecificEntropy s "specific entropy";
-    Modelica.SIunits.SpecificHeatCapacity cp
+    Modelica.Units.SI.Density d "density";
+    Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    Modelica.Units.SI.SpecificEnergy u "inner energy";
+    Modelica.Units.SI.SpecificEntropy s "specific entropy";
+    Modelica.Units.SI.SpecificHeatCapacity cp
       "heat capacity at constant pressure";
-    Modelica.SIunits.SpecificHeatCapacity cv "heat capacity at constant volume";
+    Modelica.Units.SI.SpecificHeatCapacity cv "heat capacity at constant volume";
     ThermoSysPro.Units.DerPressureByTemperature pt
       "derivative of pressure wrt temperature";
     ThermoSysPro.Units.DerPressureByDensity pd
@@ -329,7 +329,7 @@
        tau*g.gtaupi)/(g.gpipi));
     vt := g.R/g.p*(g.pi*g.gpi - g.tau*g.pi*g.gtaupi);
     vp := g.R*g.T/(g.p*g.p)*g.pi*g.pi*g.gpipi;
-    // sat.kappa := -1/(sat.d*g.p)*sat.cp/(vp*sat.cp + vt*vt*g.T);
+// sat.kappa := -1/(sat.d*g.p)*sat.cp/(vp*sat.cp + vt*vt*g.T);
     sat.pt := -g.p/g.T*(g.gpi - g.tau*g.gtaupi)/(g.gpipi*g.pi);
     sat.pd := -g.R*g.T*g.gpi*g.gpi/(g.gpipi);
   end gibbsToBoundaryProps;
@@ -358,7 +358,7 @@
   function HelmholtzOfph
 
   protected
-    Modelica.SIunits.SpecificHeatCapacity cv;
+    Modelica.Units.SI.SpecificHeatCapacity cv;
   public
     input HelmholtzDerivs f
       "Dérivées adimensionnelles de la fonction de Helmholtz"
@@ -411,9 +411,9 @@
     input PhaseBoundaryProperties liq;
     input PhaseBoundaryProperties vap;
     input Real x "Vapor mass fraction";
-    input Modelica.SIunits.Temperature T;
-    input Modelica.SIunits.AbsolutePressure p;
-    output Modelica.SIunits.SpecificHeatCapacity cv;
+    input Modelica.Units.SI.Temperature T;
+    input Modelica.Units.SI.AbsolutePressure p;
+    output Modelica.Units.SI.SpecificHeatCapacity cv;
 
   protected
     Real dpT;
@@ -427,7 +427,7 @@
   algorithm
     dxv := if (liq.d <> vap.d) then liq.d*vap.d/(liq.d - vap.d) else 0.0;
     dpT := (vap.s - liq.s)*dxv;
-    // wrong at critical point
+// wrong at critical point
     dvTl := (liq.pt - dpT)/liq.pd/liq.d/liq.d;
     dvTv := (vap.pt - dpT)/vap.pd/vap.d/vap.d;
     dxt := -dxv*(dvTl + x*(dvTv - dvTl));
@@ -466,8 +466,8 @@
   end cv2Phase;
 
   record NewtonDerivatives_ps
-    Modelica.SIunits.AbsolutePressure p;
-    Modelica.SIunits.SpecificEntropy s;
+    Modelica.Units.SI.AbsolutePressure p;
+    Modelica.Units.SI.SpecificEntropy s;
     Real pd;
     Real pt;
     Real sd;
@@ -506,7 +506,7 @@
   function HelmholtzOfps
 
   protected
-    Modelica.SIunits.SpecificHeatCapacity cv;
+    Modelica.Units.SI.SpecificHeatCapacity cv;
   public
     input HelmholtzDerivs f
       "Dérivées adimensionnelles de la fonction de Helmholtz"
@@ -557,14 +557,14 @@
   end HelmholtzOfps;
 
   record PropThermoSat
-    Modelica.SIunits.AbsolutePressure P "Pressure";
-    Modelica.SIunits.Temperature T "Temperature";
-    Modelica.SIunits.Density rho "Density";
-    Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
-    Modelica.SIunits.SpecificHeatCapacity cp
+    Modelica.Units.SI.AbsolutePressure P "Pressure";
+    Modelica.Units.SI.Temperature T "Temperature";
+    Modelica.Units.SI.Density rho "Density";
+    Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+    Modelica.Units.SI.SpecificHeatCapacity cp
       "Specific heat capacity at constant pressure";
     Real pt "Derivative of pressure wrt. temperature";
-    Modelica.SIunits.SpecificHeatCapacity cv
+    Modelica.Units.SI.SpecificHeatCapacity cv
       "Specific heat capacity at constant volume";
     /*
   Modelica.SIunits.SpecificEnergy u "Specific inner energy";
@@ -601,10 +601,10 @@
   end PropThermoSat;
 
   function gibbsRho
-    input Modelica.SIunits.AbsolutePressure P "Pressure";
-    input Modelica.SIunits.Temperature T "Temperature";
+    input Modelica.Units.SI.AbsolutePressure P "Pressure";
+    input Modelica.Units.SI.Temperature T "Temperature";
 
-    output Modelica.SIunits.Density rho "density";
+    output Modelica.Units.SI.Density rho "density";
     input GibbsDerivs g "Dérivées de la fonction de Gibbs"
       annotation (Placement(transformation(extent={{-70,-70},{70,70}}, rotation=
              0)));
@@ -644,8 +644,8 @@
   end gibbsRho;
 
   function gibbsPropsSat
-    input Modelica.SIunits.AbsolutePressure P "Pressure";
-    input Modelica.SIunits.Temperature T "Temperature";
+    input Modelica.Units.SI.AbsolutePressure P "Pressure";
+    input Modelica.Units.SI.Temperature T "Temperature";
 
     input GibbsDerivs g "Dérivées de la fonction de Gibbs"
       annotation (Placement(transformation(extent={{-85,15},{-15,85}}, rotation=
@@ -754,33 +754,33 @@
   end gibbsToProps_pT;
 
   record ThermoProperties_pT
-    Modelica.SIunits.Density d(
+    Modelica.Units.SI.Density d(
       min=InitLimits.DMIN,
       max=InitLimits.DMAX,
       nominal=InitLimits.DNOM) "Density";
-    Modelica.SIunits.SpecificEnthalpy h(
+    Modelica.Units.SI.SpecificEnthalpy h(
       min=InitLimits.SHMIN,
       max=InitLimits.SHMAX,
       nominal=InitLimits.SHNOM) "Specific enthalpy";
-    Modelica.SIunits.SpecificEnergy u(
+    Modelica.Units.SI.SpecificEnergy u(
       min=InitLimits.SEMIN,
       max=InitLimits.SEMAX,
       nominal=InitLimits.SENOM) "Specific inner energy";
-    Modelica.SIunits.SpecificEntropy s(
+    Modelica.Units.SI.SpecificEntropy s(
       min=InitLimits.SSMIN,
       max=InitLimits.SSMAX,
       nominal=InitLimits.SSNOM) "Specific entropy";
-    Modelica.SIunits.SpecificHeatCapacity cp(
+    Modelica.Units.SI.SpecificHeatCapacity cp(
       min=InitLimits.CPMIN,
       max=InitLimits.CPMAX,
       nominal=InitLimits.CPNOM) "Specific heat capacity at constant presure";
-    Modelica.SIunits.DerDensityByTemperature ddTp
+    Modelica.Units.SI.DerDensityByTemperature ddTp
       "Derivative of the density wrt. temperature at constant pressure";
-    Modelica.SIunits.DerDensityByPressure ddpT
+    Modelica.Units.SI.DerDensityByPressure ddpT
       "Derivative of the density wrt. presure at constant temperature";
-    Modelica.SIunits.DerEnergyByPressure dupT
+    Modelica.Units.SI.DerEnergyByPressure dupT
       "Derivative of the inner energy wrt. pressure at constant temperature";
-    Modelica.SIunits.SpecificHeatCapacity duTp
+    Modelica.Units.SI.SpecificHeatCapacity duTp
       "Derivative of the inner energy wrt. temperature at constant pressure";
     ThermoSysPro.Units.MassFraction x "Vapor mass fraction";
     annotation (
@@ -861,29 +861,29 @@
   end gibbsToProps_ps;
 
   record ThermoProperties_ps
-    Modelica.SIunits.Temperature T(
+    Modelica.Units.SI.Temperature T(
       min=InitLimits.TMIN,
       max=InitLimits.TMAX,
       nominal=InitLimits.TNOM) "Temperature";
-    Modelica.SIunits.Density d(
+    Modelica.Units.SI.Density d(
       min=InitLimits.DMIN,
       max=InitLimits.DMAX,
       nominal=InitLimits.DNOM) "Density";
-    Modelica.SIunits.SpecificEnergy u(
+    Modelica.Units.SI.SpecificEnergy u(
       min=InitLimits.SEMIN,
       max=InitLimits.SEMAX,
       nominal=InitLimits.SENOM) "Specific inner energy";
-    Modelica.SIunits.SpecificEnthalpy h(
+    Modelica.Units.SI.SpecificEnthalpy h(
       min=InitLimits.SHMIN,
       max=InitLimits.SHMAX,
       nominal=InitLimits.SHNOM) "Specific enthalpy";
-    Modelica.SIunits.SpecificHeatCapacity cp(
+    Modelica.Units.SI.SpecificHeatCapacity cp(
       min=InitLimits.CPMIN,
       max=InitLimits.CPMAX,
       nominal=InitLimits.CPNOM) "Specific heat capacity at constant pressure";
     ThermoSysPro.Units.DerDensityByEntropy ddsp
       "Derivative of the density wrt. specific entropy at constant pressure";
-    Modelica.SIunits.DerDensityByPressure ddps
+    Modelica.Units.SI.DerDensityByPressure ddps
       "Derivative of the density wrt. pressure at constant specific entropy";
     ThermoSysPro.Units.MassFraction x "Vapor mass fraction";
     annotation (
@@ -930,8 +930,7 @@
     pro.T := f.T;
     pro.u := f.R*f.T*f.tau*f.ftau;
     pro.h := f.R*f.T*(f.tau*f.ftau + f.delta*f.fdelta);
-
-    // calculating cp near the critical point may be troublesome (cp -> inf).
+// calculating cp near the critical point may be troublesome (cp -> inf).
     pro.cp := f.R*(-f.tau*f.tau*f.ftautau + (f.delta*f.fdelta - f.delta*f.tau
       *f.fdeltatau)^2/(2*f.delta*f.fdelta + f.delta*f.delta*f.fdeltadelta));
     cv := f.R*(-f.tau*f.tau*f.ftautau);
@@ -1017,23 +1016,23 @@
   end gibbsToProps_dT;
 
   record ThermoProperties_dT
-    Modelica.SIunits.AbsolutePressure p(
+    Modelica.Units.SI.AbsolutePressure p(
       min=InitLimits.PMIN,
       max=InitLimits.PMAX,
       nominal=InitLimits.PNOM) "Pressure";
-    Modelica.SIunits.SpecificEnthalpy h(
+    Modelica.Units.SI.SpecificEnthalpy h(
       min=InitLimits.SHMIN,
       max=InitLimits.SHMAX,
       nominal=InitLimits.SHNOM) "Specific enthalpy";
-    Modelica.SIunits.SpecificEnergy u(
+    Modelica.Units.SI.SpecificEnergy u(
       min=InitLimits.SEMIN,
       max=InitLimits.SEMAX,
       nominal=InitLimits.SENOM) "Specific inner energy";
-    Modelica.SIunits.SpecificEntropy s(
+    Modelica.Units.SI.SpecificEntropy s(
       min=InitLimits.SSMIN,
       max=InitLimits.SSMAX,
       nominal=InitLimits.SSNOM) "Specific entropy";
-    Modelica.SIunits.SpecificHeatCapacity cp(
+    Modelica.Units.SI.SpecificHeatCapacity cp(
       min=InitLimits.CPMIN,
       max=InitLimits.CPMAX,
       nominal=InitLimits.CPNOM) "Specific heat capacity at constant pressure";
@@ -1079,7 +1078,7 @@
     pv := -1/(f.d*f.d)*f.R*f.T*f.delta*(2.0*f.fdelta + f.delta*f.
       fdeltadelta);
     pt := f.R*f.d*f.delta*(f.fdelta - f.tau*f.fdeltatau);
-    // calculating cp near the critical point may be troublesome (cp -> inf).
+// calculating cp near the critical point may be troublesome (cp -> inf).
     pro.cp := f.R*(-f.tau*f.tau*f.ftautau + (f.delta*f.fdelta - f.delta*f.tau
       *f.fdeltatau)^2/(2*f.delta*f.fdelta + f.delta*f.delta*f.fdeltadelta));
     pro.dudT := (pro.p - f.T*pt)/(f.d*f.d);
@@ -1115,7 +1114,7 @@
   end helmholtzToProps_dT;
 
   record NewtonDerivatives_pT
-    Modelica.SIunits.AbsolutePressure p "Pressure";
+    Modelica.Units.SI.AbsolutePressure p "Pressure";
     ThermoSysPro.Units.DerPressureByDensity pd
       "derivative of pressure wrt. density";
     annotation (
@@ -1201,7 +1200,7 @@
     pt := f.R*f.d*f.delta*(f.fdelta - f.tau*f.fdeltatau);
     cv := f.R*(-f.tau*f.tau*f.ftautau);
     pv := -1/(f.d*f.d)*pd;
-    // calculating cp near the critical point may be troublesome (cp -> inf).
+// calculating cp near the critical point may be troublesome (cp -> inf).
     pro.cp := f.R*(-f.tau*f.tau*f.ftautau + (f.delta*f.fdelta - f.delta*f.tau
       *f.fdeltatau)^2/(2*f.delta*f.fdelta + f.delta*f.delta*f.fdeltadelta));
     pro.ddTp := -pt/pd;
@@ -1241,21 +1240,21 @@
   end helmholtzToProps_pT;
 
   record miniProp "Test record for derivatives"
-    Modelica.SIunits.Temperature T "Temperature";
-    Modelica.SIunits.Density d "Density";
+    Modelica.Units.SI.Temperature T "Temperature";
+    Modelica.Units.SI.Density d "Density";
   end miniProp;
 
   record IF97PhaseBoundaryProperties
     "thermodynamic base properties on the phase boundary for IF97 steam tables"
     extends Modelica.Icons.Record;
-    Modelica.SIunits.SpecificHeatCapacity R "specific heat capacity";
-    Modelica.SIunits.Temperature T "temperature";
-    Modelica.SIunits.Density d "density";
-    Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    Modelica.SIunits.SpecificEntropy s "specific entropy";
-    Modelica.SIunits.SpecificHeatCapacity cp
+    Modelica.Units.SI.SpecificHeatCapacity R "specific heat capacity";
+    Modelica.Units.SI.Temperature T "temperature";
+    Modelica.Units.SI.Density d "density";
+    Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    Modelica.Units.SI.SpecificEntropy s "specific entropy";
+    Modelica.Units.SI.SpecificHeatCapacity cp
       "heat capacity at constant pressure";
-    Modelica.SIunits.SpecificHeatCapacity cv "heat capacity at constant volume";
+    Modelica.Units.SI.SpecificHeatCapacity cv "heat capacity at constant volume";
     ThermoSysPro.Units.DerPressureByTemperature dpT
       "dp/dT derivative of saturation curve";
     ThermoSysPro.Units.DerPressureByTemperature pt
@@ -1268,8 +1267,8 @@
   end IF97PhaseBoundaryProperties;
 
   function water_ph_r4
-    input Modelica.SIunits.AbsolutePressure p;
-    input Modelica.SIunits.SpecificEnthalpy h;
+    input Modelica.Units.SI.AbsolutePressure p;
+    input Modelica.Units.SI.SpecificEnthalpy h;
 
   protected
     Real x;
@@ -1283,8 +1282,8 @@
     GibbsDerivs gv;
     HelmholtzDerivs fl;
     HelmholtzDerivs fv;
-    Modelica.SIunits.Density dl;
-    Modelica.SIunits.Density dv;
+    Modelica.Units.SI.Density dl;
+    Modelica.Units.SI.Density dv;
     Real cv "Heat capacity at constant volume";
   algorithm
     pro.T := BaseIF97.Basic.tsat(p);
@@ -1340,8 +1339,8 @@
   end water_ph_r4;
 
   function water_ps_r4
-    input Modelica.SIunits.AbsolutePressure p "pressure";
-    input Modelica.SIunits.SpecificEntropy s "specific entropy";
+    input Modelica.Units.SI.AbsolutePressure p "pressure";
+    input Modelica.Units.SI.SpecificEntropy s "specific entropy";
 
   protected
     Real x;
@@ -1360,8 +1359,8 @@
     HelmholtzDerivs fv
       "dimensionless Helmholtz function and derivatives wrt dimensionless presure and temperature";
     Real cv "Heat capacity at constant volume";
-    Modelica.SIunits.Density dl;
-    Modelica.SIunits.Density dv;
+    Modelica.Units.SI.Density dl;
+    Modelica.Units.SI.Density dv;
   algorithm
 
     pro.T := BaseIF97.Basic.tsat(p);
@@ -1474,9 +1473,9 @@
   record GibbsDerivs3rd
     "derivatives of dimensionless Gibbs-function w.r.t dimensionless pressure and temperature, including 3rd derivatives"
     extends Modelica.Icons.Record;
-    Modelica.SIunits.Pressure p "pressure";
-    Modelica.SIunits.Temperature T "temperature";
-    Modelica.SIunits.SpecificHeatCapacity R "specific heat capacity";
+    Modelica.Units.SI.Pressure p "pressure";
+    Modelica.Units.SI.Temperature T "temperature";
+    Modelica.Units.SI.SpecificHeatCapacity R "specific heat capacity";
     Real pi(unit="1") "dimensionless pressure";
     Real tau(unit="1") "dimensionless temperature";
     Real g(unit="1") "dimensionless Gibbs-function";
@@ -1530,9 +1529,9 @@
   record HelmholtzDerivs3rd
     "derivatives of dimensionless Helmholtz-function w.r.t dimensionless pressuredensity and temperature, including 3rd derivatives"
     extends Modelica.Icons.Record;
-    Modelica.SIunits.Density d "density";
-    Modelica.SIunits.Temperature T "temperature";
-    Modelica.SIunits.SpecificHeatCapacity R "specific heat capacity";
+    Modelica.Units.SI.Density d "density";
+    Modelica.Units.SI.Temperature T "temperature";
+    Modelica.Units.SI.SpecificHeatCapacity R "specific heat capacity";
     Real delta(unit="1") "dimensionless density";
     Real tau(unit="1") "dimensionless temperature";
     Real f(unit="1") "dimensionless Helmholtz-function";
@@ -1558,7 +1557,7 @@
     output ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties3rd
       sat "phase boundary property record";
   protected
-    Modelica.SIunits.Pressure p "pressure";
+    Modelica.Units.SI.Pressure p "pressure";
   algorithm
     p := f.R*f.d*f.T*f.delta*f.fdelta;
     sat.d := f.d;
@@ -1583,14 +1582,14 @@
   record IF97PhaseBoundaryProperties3rd
     "Thermodynamic base properties on the phase boundary, Analytic Jacobian verModelica.SIunitson"
     extends Modelica.Icons.Record;
-    Modelica.SIunits.SpecificHeatCapacity R "specific heat capacity";
-    Modelica.SIunits.Temperature T "temperature";
-    Modelica.SIunits.Density d "denModelica.SIunitsty";
-    Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    Modelica.SIunits.SpecificEntropy s "specific entropy";
-    Modelica.SIunits.SpecificHeatCapacity cp
+    Modelica.Units.SI.SpecificHeatCapacity R "specific heat capacity";
+    Modelica.Units.SI.Temperature T "temperature";
+    Modelica.Units.SI.Density d "denModelica.SIunitsty";
+    Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    Modelica.Units.SI.SpecificEntropy s "specific entropy";
+    Modelica.Units.SI.SpecificHeatCapacity cp
       "heat capacity at constant pressure";
-    Modelica.SIunits.SpecificHeatCapacity cv "heat capacity at constant volume";
+    Modelica.Units.SI.SpecificHeatCapacity cv "heat capacity at constant volume";
     ThermoSysPro.Units.DerPressureByTemperature dpT
       "dp/dT derivative of saturation curve";
     Real dpTT(unit = "Pa/(K.K)") "Second derivative of saturation curve";
@@ -1616,16 +1615,16 @@
   record PhaseBoundaryProperties3rd
     "thermodynamic base properties on the phase boundary"
     extends Modelica.Icons.Record;
-    Modelica.SIunits.Temperature T "Temperature";
+    Modelica.Units.SI.Temperature T "Temperature";
     ThermoSysPro.Units.DerPressureByTemperature dpT
       "dp/dT derivative of saturation curve";
-    Modelica.SIunits.Density d "Density";
-    Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
-    Modelica.SIunits.SpecificEnergy u "Inner energy";
-    Modelica.SIunits.SpecificEntropy s "Specific entropy";
-    Modelica.SIunits.SpecificHeatCapacity cp
+    Modelica.Units.SI.Density d "Density";
+    Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+    Modelica.Units.SI.SpecificEnergy u "Inner energy";
+    Modelica.Units.SI.SpecificEntropy s "Specific entropy";
+    Modelica.Units.SI.SpecificHeatCapacity cp
       "Heat capacity at constant pressure";
-    Modelica.SIunits.SpecificHeatCapacity cv "Heat capacity at constant volume";
+    Modelica.Units.SI.SpecificHeatCapacity cv "Heat capacity at constant volume";
     ThermoSysPro.Units.DerPressureByTemperature pt
       "Derivative of pressure wrt temperature";
     ThermoSysPro.Units.DerPressureByDensity pd
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam/IF97_Utilities.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam/IF97_Utilities.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam/IF97_Utilities.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam/IF97_Utilities.mo"	2022-03-10 09:58:38.196151752 +0000
@@ -1,4253 +1,3169 @@
-within ThermoSysPro.Properties.WaterSteam;
-package IF97_Utilities
-  "Low level and utility computation for high accuracy water properties according to the IAPWS/IF97 standard"
-
-  replaceable record iter =
-      ThermoSysPro.Properties.WaterSteam.BaseIF97.IterationData;
-//   function isentropicEnthalpy
-//     "isentropic specific enthalpy from p,s (preferably use dynamicIsentropicEnthalpy in dynamic simulation!)"
-//     extends Modelica.Icons.Function;
-//     input SI.Pressure p "pressure";
-//     input SI.SpecificEntropy s "specific entropy";
-//     input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
-//     output SI.SpecificEnthalpy h "specific enthalpy";
-//   algorithm
-//    h := BaseIF97.Isentropic.water_hisentropic(p,s,phase);
-//   end isentropicEnthalpy;
-
-public
-  package AnalyticDerivatives "Functions with analytic derivatives"
-
-    import ThermoSysPro.Properties.WaterSteam.BaseIF97.*;
-
-    function waterBasePropAnalytic_ph "intermediate property record for water"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input Integer phase =  0
-        "phase: 2 for two-phase, 1 for one phase, 0 if unknown";
-      input Integer region = 0
-        "if 0, do region computation, otherwise assume the region is this input";
-      output ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-    protected
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd
-                                                            g
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd
-                                                                f
-        "dimensionless Helmholtz funcion and dervatives wrt delta and tau";
-      Integer error "error flag for inverse iterations";
-      Modelica.SIunits.SpecificEnthalpy h_liq "liquid specific enthalpy";
-      Modelica.SIunits.Density d_liq "liquid density";
-      Modelica.SIunits.SpecificEnthalpy h_vap "vapour specific enthalpy";
-      Modelica.SIunits.Density d_vap "vapour density";
-      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties3rd
-                                                                        liq
-        "phase boundary property record";
-      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties3rd
-                                                                        vap
-        "phase boundary property record";
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd
-                                                            gl
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd
-                                                            gv
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd
-                                                                fl
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd
-                                                                fv
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-      Modelica.SIunits.Temperature t1
-        "temperature at phase boundary, using inverse from region 1";
-      Modelica.SIunits.Temperature t2
-        "temperature at phase boundary, using inverse from region 2";
-      /// new stuff, for analytic Jacobian
-      Real dxv "der of x wrt v";
-      Real dxd "der of x wrt d";
-      Real dvTl "der of v wrt T at boiling";
-      Real dvTv "der of v wrt T at dew";
-      Real dxT "der of x wrt T";
-      Real duTl "der of u wrt T at boiling";
-      Real duTv "der of u wrt T at dew";
-      Real dpTT "2nd der of p wrt T";
-      Real dxdd "2nd der of x wrt d";
-      Real dxTd "2nd der of x wrt d and T";
-      Real dvTTl "2nd der of v wrt T at boiling";
-      Real dvTTv "2nd der of v wrt T at dew";
-      Real dxTT " 2nd der of x wrt T";
-      Real duTTl "2nd der of u wrt T at boiling";
-      Real duTTv "2nd der of u wrt T at dew";
-      Real vp3 "vp^3";
-      Real ivp3 "1/vp3";
-      Modelica.SIunits.SpecificVolume v;
-      // cvt is in aux record
-      // Real detpht;
-    algorithm
-      aux.region := if region == 0 then
-        (if phase == 2 then 4 else ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_ph(
-                                                              p=p,h= h,phase= phase)) else region;
-      aux.phase := if phase <> 0 then phase else if aux.region == 4 then 2 else 1;
-      // LogVariable(p);
-      // LogVariable(h);
-      // LogVariable(aux.region);
-      aux.p := max(p,611.657);
-      aux.h := max(h,1e3);
-      aux.R :=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
-      if (aux.region == 1) or (aux.region == 2) or (aux.region == 5) then
-        if (aux.region == 1) then
-          aux.T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tph1(
-                                       aux.p, aux.h);
-          g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1L3(
-                                   p, aux.T);
-          aux.x := 0.0;
-        elseif (aux.region == 2) then
-          aux.T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tph2(
-                                       aux.p, aux.h);
-          g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2L3(
-                                   p, aux.T);
-          aux.x := 1.0;
-        else /* region must be 5 here */
-          (
-    aux.T,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.tofph5(
-              p=aux.p,
-              h=aux.h,
-              reldh=1.0e-7);
-          assert(error == 0, "error in inverse iteration of steam tables");
-          g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g5L3(
-                                   p, aux.T);
-          aux.x := 1.0;
-        end if;
-        aux.s := aux.R*(g.tau*g.gtau - g.g);
-        aux.rho := p/(aux.R*aux.T*g.pi*g.gpi);
-        aux.vt := aux.R/p*(g.pi*g.gpi - g.tau*g.pi*g.gpitau);
-        aux.vp := aux.R*aux.T/(p*p)*g.pi*g.pi*g.gpipi;
-        aux.cp := -aux.R*g.tau*g.tau*g.gtautau;
-        aux.cv := aux.R*(-g.tau*g.tau*g.gtautau + ((g.gpi - g.tau*g.gpitau)*(g.gpi - g.tau*g.gpitau)/g.gpipi));
-        aux.dpT := -aux.vt/aux.vp;
-        aux.vtt := aux.R*g.pi/p*g.tau/aux.T*g.tau*g.gpitautau;
-        aux.vtp := aux.R*g.pi*g.pi/(p*p)*(g.gpipi - g.tau*g.gpipitau);
-        aux.vpp := aux.R*aux.T*g.pi*g.pi*g.pi/(p*p*p)*g.gpipipi;
-        aux.cpt := aux.R*g.tau*g.tau/aux.T*(2*g.gtautau + g.tau*g.gtautautau);
-        aux.pt := -g.p/g.T*(g.gpi - g.tau*g.gpitau)/(g.gpipi*g.pi);
-        aux.pd := -g.R*g.T*g.gpi*g.gpi/(g.gpipi);
-        v := 1/aux.rho;
-        vp3 := aux.vp*aux.vp*aux.vp;
-        ivp3 := 1/vp3;
-        aux.ptt := -(aux.vtt*aux.vp*aux.vp -2.0*aux.vt*aux.vtp*aux.vp +aux.vt*aux.vt*aux.vpp)*ivp3;
-        aux.pdd := -aux.vpp*ivp3*v*v*v*v - 2*v*aux.pd "= pvv/d^4";
-        aux.ptd := (aux.vtp*aux.vp-aux.vt*aux.vpp)*ivp3*v*v "= -ptv/d^2";
-        aux.cvt := (vp3*aux.cpt + aux.vp*aux.vp*aux.vt*aux.vt + 3.0*aux.vp*aux.vp*aux.T*aux.vt*aux.vtt
-      - 3.0*aux.vtp*aux.vp*aux.T*aux.vt*aux.vt + aux.T*aux.vt*aux.vt*aux.vt*aux.vpp)*ivp3;
-      elseif (aux.region == 3) then
-        (aux.rho,aux.T,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.dtofph3(
-                                                           p=aux.p,h=aux.h,delp= 1.0e-7,delh=
-          1.0e-6);
-        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(
-                                 aux.rho, aux.T);
-        aux.h := aux.R*aux.T*(f.tau*f.ftau + f.delta*f.fdelta);
-        aux.s := aux.R*(f.tau*f.ftau - f.f);
-        aux.pd := aux.R*aux.T*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta);
-        aux.pt := aux.R*aux.rho*f.delta*(f.fdelta - f.tau*f.fdeltatau);
-        aux.cv := abs(aux.R*(-f.tau*f.tau*f.ftautau))
-          "can be close to neg. infinity near critical point";
-        aux.cp := (aux.rho*aux.rho*aux.pd*aux.cv + aux.T*aux.pt*aux.pt)/(aux.rho*aux.rho*aux.pd);
-        aux.x := 0.0;
-        aux.dpT := aux.pt; /*safety against div-by-0 in initialization*/
-        aux.pdd := aux.R*aux.T*f.delta/aux.rho*(2.0*f.fdelta + 4.0*f.delta*f.fdeltadelta +
-             f.delta*f.delta*f.fdeltadeltadelta);
-        aux.ptt := aux.R*aux.rho*f.delta*f.tau*f.tau/aux.T*f.fdeltatautau;
-        aux.ptd := aux.R*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta - 2.0*f.tau*f.fdeltatau
-      -f.delta*f.tau*f.fdeltadeltatau);
-        aux.cvt := aux.R*f.tau*f.tau/aux.T*(2.0*f.ftautau + f.tau*f.ftautautau);
-        aux.cpt := (aux.cvt*aux.pd + aux.cv*aux.ptd + (aux.pt + 2.0*aux.T*aux.ptt)*aux.pt/(aux.rho*aux.rho)
-      - aux.cp*aux.ptd)/aux.pd;
-      elseif (aux.region == 4) then
-        h_liq := hl_p(p);
-        h_vap := hv_p(p);
-        aux.x := if (h_vap <> h_liq) then (h - h_liq)/(h_vap - h_liq) else 1.0;
-        if p <ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PLIMIT4A then
-          t1 := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tph1(
-                                    aux.p, h_liq);
-          t2 := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tph2(
-                                    aux.p, h_vap);
-          gl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1L3(
-                                    aux.p, t1);
-          gv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2L3(
-                                    aux.p, t2);
-          liq := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps3rd(
-            gl);
-          vap := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps3rd(
-            gv);
-          aux.T := t1 + aux.x*(t2 - t1);
-        else
-          aux.T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tsat(
-                                       aux.p);
-          // how to avoid ?
-          d_liq := rhol_T(aux.T);
-          d_vap := rhov_T(aux.T);
-          fl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(
-                                    d_liq, aux.T);
-          fv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(
-                                    d_vap, aux.T);
-          liq :=
-            ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps3rd(
-            fl);
-          vap :=
-            ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps3rd(
-            fv);
-          //  aux.dpT := BaseIF97.Basic.dptofT(aux.T);
-        end if;
-        aux.rho := liq.d*vap.d/(vap.d + aux.x*(liq.d - vap.d));
-        dxv := if (liq.d <> vap.d) then liq.d*vap.d/(liq.d-vap.d) else 0.0;
-        dxd := -dxv/(aux.rho*aux.rho);
-        aux.dpT := if (liq.d <> vap.d) then (vap.s - liq.s)*dxv else ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.dptofT(
-                                                                                           aux.T);
-        dvTl := (liq.pt -aux.dpT)/(liq.pd*liq.d*liq.d);
-        dvTv := (vap.pt -aux.dpT)/(vap.pd*vap.d*vap.d);
-        dxT := -dxv*(dvTl + aux.x*(dvTv-dvTl));
-        duTl := liq.cv + (aux.T*liq.pt-p)*dvTl;
-        duTv := vap.cv + (aux.T*vap.pt-p)*dvTv;
-        aux.cv := duTl + aux.x*(duTv-duTl) + dxT * (vap.u-liq.u);
-        dpTT := dxv*(vap.cv/aux.T-liq.cv/aux.T + dvTv*(vap.pt-aux.dpT)-dvTl*(liq.pt-aux.dpT));
-        dxdd := 2.0*dxv/(aux.rho*aux.rho*aux.rho);
-        dxTd := dxv*dxv*(dvTv-dvTl)/(aux.rho*aux.rho);
-        dvTTl := ((liq.ptt-dpTT)/(liq.d*liq.d) + dvTl*(liq.d*dvTl*(2.0*liq.pd + liq.d*liq.pdd)
-             -2.0*liq.ptd))/liq.pd;
-        dvTTv := ((vap.ptt-dpTT)/(vap.d*vap.d) + dvTv*(vap.d*dvTv*(2.0*vap.pd + vap.d*vap.pdd)
-             -2.0*vap.ptd))/vap.pd;
-        dxTT := -dxv*(2.0*dxT*(dvTv-dvTl) + dvTTl + aux.x*(dvTTv-dvTTl));
-        duTTl := liq.cvt +(liq.pt-aux.dpT + aux.T*(2.0*liq.ptt -liq.d*liq.d*liq.ptd *dvTl))*dvTl + (aux.T*
-          liq.pt - p)*dvTTl;
-        duTTv := vap.cvt +(vap.pt-aux.dpT + aux.T*(2.0*vap.ptt -vap.d*vap.d*vap.ptd *dvTv))*dvTv + (aux.T*
-          vap.pt - p)*dvTTv;
-        aux.cvt := duTTl + aux.x *(duTTv -duTTl) + 2.0*dxT*(duTv-duTl) + dxTT *(vap.u-liq.u);
-        aux.s := liq.s + aux.x*(vap.s - liq.s);
-        // next ones are only for cases where region 4 is called improperly
-        aux.cp := liq.cp + aux.x*(vap.cp - liq.cp); // undefined
-        aux.pt := liq.pt + aux.x*(vap.pt - liq.pt); // dpT
-        aux.pd := liq.pd + aux.x*(vap.pd - liq.pd); // 0.0
-        aux.vt := dvTl + aux.x*(dvTv-dvTl) +dxT*(1/vap.d-1/liq.d);
-        // v = vl + x*(vv-vl)
-        aux.vp := aux.vt/aux.dpT;
-        aux.pdd := 0.0;
-        aux.ptd := 0.0;
-        aux.ptt := dpTT;
-        aux.vtt := dvTTl + aux.x*(dvTTv-dvTTl);
-        aux.vtp := aux.vtt/aux.dpT;
-        //hpp := vp - T*vtp = aux.vt/aux.dpT - T*aux.vtt/aux.dpT;
-      else
-        assert(false, "error in region computation of IF97 steam tables"
-        + "(p = " + String(p) + ", h = " + String(h) + ")");
-      end if;
-      annotation (Icon(graphics));
-    end waterBasePropAnalytic_ph;
-
-    function waterBasePropAnalytic_pT
-      "intermediate property record for water (p and T prefered states)"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer region = 0
-        "if 0, do region computation, otherwise assume the region is this input";
-      output ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-    protected
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd
-                                                            g
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd
-                                                                f
-        "dimensionless Helmholtz funcion and dervatives wrt delta and tau";
-      Real vp3 "vp^3";
-      Real ivp3 "1/vp3";
-      Modelica.SIunits.SpecificVolume v;
-      Integer error "error flag for inverse iterations";
-    algorithm
-      aux.phase := 1;
-      aux.region := if region == 0 then ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_pT(
-                                                                   p=p,T= T) else region;
-      aux.R :=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
-      aux.p := p;
-      aux.T := T;
-      if (aux.region == 1) or (aux.region == 2) or (aux.region == 5) then
-        if (aux.region == 1) then
-          g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1L3(
-                                   p, T);
-          aux.x := 0.0;
-        elseif (aux.region == 2) then
-          g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2L3(
-                                   p, T);
-          aux.x := 1.0;
-        else
-          g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g5L3(
-                                   p, T);
-          aux.x := 1.0;
-        end if;
-        aux.h := aux.R*aux.T*g.tau*g.gtau;
-        aux.s := aux.R*(g.tau*g.gtau - g.g);
-        aux.rho := p/(aux.R*T*g.pi*g.gpi);
-        aux.vt := aux.R/p*(g.pi*g.gpi - g.tau*g.pi*g.gpitau);
-        aux.vp := aux.R*T/(p*p)*g.pi*g.pi*g.gpipi;
-        aux.cp := -aux.R*g.tau*g.tau*g.gtautau;
-        aux.cv := aux.R*(-g.tau*g.tau*g.gtautau + ((g.gpi - g.tau*g.gpitau)*(g.gpi - g.tau*g.gpitau)/g.gpipi));
-        aux.x := 0.0;
-        aux.vtt := aux.R*g.pi/aux.p*g.tau/aux.T*g.tau*g.gpitautau;
-        aux.vtp := aux.R*g.pi*g.pi/(aux.p*aux.p)*(g.gpipi - g.tau*g.gpipitau);
-        aux.vpp := aux.R*aux.T*g.pi*g.pi*g.pi/(aux.p*aux.p*aux.p)*g.gpipipi;
-        aux.cpt := aux.R*g.tau*g.tau/aux.T*(2*g.gtautau + g.tau*g.gtautautau);
-        aux.pt := -g.p/g.T*(g.gpi - g.tau*g.gpitau)/(g.gpipi*g.pi);
-        aux.pd := -g.R*g.T*g.gpi*g.gpi/(g.gpipi);
-        v := 1/aux.rho;
-        vp3 := aux.vp*aux.vp*aux.vp;
-        ivp3 := 1/vp3;
-        aux.ptt := -(aux.vtt*aux.vp*aux.vp -2.0*aux.vt*aux.vtp*aux.vp +aux.vt*aux.vt*aux.vpp)*ivp3;
-        aux.pdd := -aux.vpp*ivp3*v*v*v*v - 2*v*aux.pd;
-        aux.ptd := (aux.vtp*aux.vp-aux.vt*aux.vpp)*ivp3*v*v "= -ptv/d^2";
-        aux.cvt := (vp3*aux.cpt + aux.vp*aux.vp*aux.vt*aux.vt + 3.0*aux.vp*aux.vp*aux.T*aux.vt*aux.vtt
-      - 3.0*aux.vtp*aux.vp*aux.T*aux.vt*aux.vt + aux.T*aux.vt*aux.vt*aux.vt*aux.vpp)*ivp3;
-      elseif (aux.region == 3) then
-        (aux.rho,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.dofpt3(
-                                                    p=p,T= T,delp= 1.0e-7);
-        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(
-                                 aux.rho, T);
-        aux.h := aux.R*T*(f.tau*f.ftau + f.delta*f.fdelta);
-        aux.s := aux.R*(f.tau*f.ftau - f.f);
-        aux.pd := aux.R*T*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta);
-        aux.pt := aux.R*aux.rho*f.delta*(f.fdelta - f.tau*f.fdeltatau);
-        aux.cv := aux.R*(-f.tau*f.tau*f.ftautau);
-        aux.x := 0.0;
-        aux.pdd := aux.R*aux.T*f.delta/aux.rho*(2.0*f.fdelta + 4.0*f.delta*f.fdeltadelta +
-             f.delta*f.delta*f.fdeltadeltadelta);
-        aux.ptt := aux.R*aux.rho*f.delta*f.tau*f.tau/aux.T*f.fdeltatautau;
-        aux.ptd := aux.R*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta - 2.0*f.tau*f.fdeltatau
-      -f.delta*f.tau*f.fdeltadeltatau);
-        aux.cvt := aux.R*f.tau*f.tau/aux.T*(2.0*f.ftautau + f.tau*f.ftautautau);
-        aux.cpt := (aux.cvt*aux.pd + aux.cv*aux.ptd + (aux.pt + 2.0*aux.T*aux.ptt)*aux.pt/(aux.rho*aux.rho)
-      - aux.pt*aux.ptd)/aux.pd;
-      else
-        assert(false, "error in region computation of IF97 steam tables"
-        + "(p = " + String(p) + ", T = " + String(T) + ")");
-      end if;
-    end waterBasePropAnalytic_pT;
-
-    function waterBasePropAnalytic_dT
-      "intermediate property record for water (d and T prefered states)"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density rho "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer phase =  0
-        "phase: 2 for two-phase, 1 for one phase, 0 if unknown";
-      input Integer region = 0
-        "if 0, do region computation, otherwise assume the region is this input";
-      output ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-    protected
-      Modelica.SIunits.SpecificEnthalpy h_liq "liquid specific enthalpy";
-      Modelica.SIunits.Density d_liq "liquid density";
-      Modelica.SIunits.SpecificEnthalpy h_vap "vapour specific enthalpy";
-      Modelica.SIunits.Density d_vap "vapour density";
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd
-                                                            g
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd
-                                                                f
-        "dimensionless Helmholtz funcion and dervatives wrt delta and tau";
-      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties3rd
-                                                                        liq
-        "phase boundary property record";
-      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties3rd
-                                                                        vap
-        "phase boundary property record";
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd
-                                                            gl
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd
-                                                            gv
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd
-                                                                fl
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd
-                                                                fv
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-      Integer error "error flag for inverse iterations";
-      /// new stuff, for analytic Jacobian
-      Real dxv "der of x wrt v";
-      Real dxd "der of x wrt d";
-      Real dvTl "der of v wrt T at boiling";
-      Real dvTv "der of v wrt T at dew";
-      Real dxT "der of x wrt T";
-      Real duTl "der of u wrt T at boiling";
-      Real duTv "der of u wrt T at dew";
-      Real dpTT "2nd der of p wrt T";
-      Real dxdd "2nd der of x wrt d";
-      Real dxTd "2nd der of x wrt d and T";
-      Real dvTTl "2nd der of v wrt T at boiling";
-      Real dvTTv "2nd der of v wrt T at dew";
-      Real dxTT " 2nd der of x wrt T";
-      Real duTTl "2nd der of u wrt T at boiling";
-      Real duTTv "2nd der of u wrt T at dew";
-      // cvt is in aux record
-      Real vp3 "vp^3";
-      Real ivp3 "1/vp3";
-      Modelica.SIunits.SpecificVolume v;
-    algorithm
-      aux.region := if region == 0 then
-        (if phase == 2 then 4 else ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_dT(
-                                                              d=rho,T= T,phase= phase)) else region;
-      aux.phase := if aux.region == 4 then 2 else 1;
-      aux.R :=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
-      aux.rho := rho;
-      aux.T := T;
-      if (aux.region == 1) or (aux.region == 2) or (aux.region == 5) then
-        if (aux.region == 1) then
-          (
-    aux.p,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.pofdt125(
-              d=rho,
-              T=T,
-              reldd=1.0e-9,
-              region=1);
-          g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1L3(
-                                   aux.p, T);
-          aux.x := 0.0;
-        elseif (aux.region == 2) then
-          (
-    aux.p,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.pofdt125(
-              d=rho,
-              T=T,
-              reldd=1.0e-8,
-              region=2);
-          g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2L3(
-                                   aux.p, T);
-          aux.x := 1.0;
-        else
-          (
-    aux.p,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.pofdt125(
-              d=rho,
-              T=T,
-              reldd=1.0e-8,
-              region=5);
-          g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2L3(
-                                   aux.p, T);
-          aux.x := 1.0;
-        end if;
-        aux.h := aux.R*aux.T*g.tau*g.gtau;
-        aux.s := aux.R*(g.tau*g.gtau - g.g);
-        aux.rho := aux.p/(aux.R*T*g.pi*g.gpi);
-        aux.vt := aux.R/aux.p*(g.pi*g.gpi - g.tau*g.pi*g.gpitau);
-        aux.vp := aux.R*T/(aux.p*aux.p)*g.pi*g.pi*g.gpipi;
-        aux.cp := -aux.R*g.tau*g.tau*g.gtautau;
-        aux.cv := aux.R*(-g.tau*g.tau*g.gtautau + ((g.gpi - g.tau*g.gpitau)*(g.gpi - g.tau*g.gpitau)/g.gpipi));
-        aux.vtt := aux.R*g.pi/aux.p*g.tau/aux.T*g.tau*g.gpitautau;
-        aux.vtp := aux.R*g.pi*g.pi/(aux.p*aux.p)*(g.gpipi - g.tau*g.gpipitau);
-        aux.vpp := aux.R*aux.T*g.pi*g.pi*g.pi/(aux.p*aux.p*aux.p)*g.gpipipi;
-        aux.cpt := aux.R*g.tau*g.tau/aux.T*(2*g.gtautau + g.tau*g.gtautautau);
-        aux.pt := -g.p/g.T*(g.gpi - g.tau*g.gpitau)/(g.gpipi*g.pi);
-        aux.pd := -g.R*g.T*g.gpi*g.gpi/(g.gpipi);
-        v := 1/aux.rho;
-        vp3 := aux.vp*aux.vp*aux.vp;
-        ivp3 := 1/vp3;
-        aux.ptt := -(aux.vtt*aux.vp*aux.vp -2.0*aux.vt*aux.vtp*aux.vp +aux.vt*aux.vt*aux.vpp)*ivp3;
-        aux.pdd := -aux.vpp*ivp3*v*v*v*v - 2*v*aux.pd;
-        aux.ptd := (aux.vtp*aux.vp-aux.vt*aux.vpp)*ivp3*v*v "= -ptv/d^2";
-        aux.cvt := (vp3*aux.cpt + aux.vp*aux.vp*aux.vt*aux.vt + 3.0*aux.vp*aux.vp*aux.T*aux.vt*aux.vtt
-      - 3.0*aux.vtp*aux.vp*aux.T*aux.vt*aux.vt + aux.T*aux.vt*aux.vt*aux.vt*aux.vpp)*ivp3;
-      elseif (aux.region == 3) then
-        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(
-                                 rho, T);
-        aux.p := aux.R*rho*T*f.delta*f.fdelta;
-        aux.h := aux.R*T*(f.tau*f.ftau + f.delta*f.fdelta);
-        aux.s := aux.R*(f.tau*f.ftau - f.f);
-        aux.pd := aux.R*T*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta);
-        aux.pt := aux.R*rho*f.delta*(f.fdelta - f.tau*f.fdeltatau);
-        aux.cp := (aux.rho*aux.rho*aux.pd*aux.cv + aux.T*aux.pt*aux.pt)/(aux.rho*aux.rho*aux.pd);
-        aux.cv := aux.R*(-f.tau*f.tau*f.ftautau);
-        aux.x := 0.0;
-        aux.dpT := aux.pt; /*safety against div-by-0 in initialization*/
-        aux.pdd := aux.R*aux.T*f.delta/aux.rho*(2.0*f.fdelta + 4.0*f.delta*f.fdeltadelta +
-             f.delta*f.delta*f.fdeltadeltadelta);
-        aux.ptt := aux.R*aux.rho*f.delta*f.tau*f.tau/aux.T*f.fdeltatautau;
-        aux.ptd := aux.R*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta - 2.0*f.tau*f.fdeltatau
-      -f.delta*f.tau*f.fdeltadeltatau);
-        aux.cvt := aux.R*f.tau*f.tau/aux.T*(2.0*f.ftautau + f.tau*f.ftautautau);
-        aux.cpt := (aux.cvt*aux.pd + aux.cv*aux.ptd + (aux.pt + 2.0*aux.T*aux.ptt)*aux.pt/(aux.rho*aux.rho)
-      - aux.pt*aux.ptd)/aux.pd;
-      elseif (aux.region == 4) then
-        aux.p := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.psat(
-                                     T);
-        d_liq := rhol_T(T);
-        d_vap := rhov_T(T);
-        h_liq := hl_p(aux.p);
-        h_vap := hv_p(aux.p);
-        aux.x := if (d_vap <> d_liq) then (1/rho - 1/d_liq)/(1/d_vap - 1/d_liq) else 1.0;
-        aux.h := h_liq + aux.x*(h_vap - h_liq);
-        if T <ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TLIMIT1 then
-          gl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1L3(
-                                    aux.p, T);
-          gv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2L3(
-                                    aux.p, T);
-          liq := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps3rd(
-            gl);
-          vap := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps3rd(
-            gv);
-        else
-          fl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(
-                                    d_liq, T);
-          fv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(
-                                    d_vap, T);
-          liq :=
-            ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps3rd(
-            fl);
-          vap :=
-            ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps3rd(
-            fv);
-        end if;
-        aux.s := liq.s + aux.x*(vap.s - liq.s);
-        dxv := if (liq.d <> vap.d) then liq.d*vap.d/(liq.d-vap.d) else 0.0;
-        dxd := -dxv/(aux.rho*aux.rho);
-        aux.dpT := if (liq.d <> vap.d) then (vap.s - liq.s)*dxv else ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.dptofT(
-                                                                                           aux.T);
-        dvTl := (liq.pt -aux.dpT)/(liq.pd*liq.d*liq.d);
-        dvTv := (vap.pt -aux.dpT)/(vap.pd*vap.d*vap.d);
-        dxT := -dxv*(dvTl + aux.x*(dvTv-dvTl));
-        duTl := liq.cv + (aux.T*liq.pt-aux.p)*dvTl;
-        duTv := vap.cv + (aux.T*vap.pt-aux.p)*dvTv;
-        aux.cv := duTl + aux.x*(duTv-duTl) + dxT * (vap.u-liq.u);
-        dpTT := dxv*(vap.cv/aux.T-liq.cv/aux.T + dvTv*(vap.pt-aux.dpT)-dvTl*(liq.pt-aux.dpT));
-        dxdd := 2.0*dxv/(aux.rho*aux.rho*aux.rho);
-        dxTd := dxv*dxv*(dvTv-dvTl)/(aux.rho*aux.rho);
-        dvTTl := ((liq.ptt-dpTT)/(liq.d*liq.d) + dvTl*(liq.d*dvTl*(2.0*liq.pd + liq.d*liq.pdd)
-             -2.0*liq.ptd))/liq.pd;
-        dvTTv := ((vap.ptt-dpTT)/(vap.d*vap.d) + dvTv*(vap.d*dvTv*(2.0*vap.pd + vap.d*vap.pdd)
-             -2.0*vap.ptd))/vap.pd;
-        dxTT := -dxv*(2.0*dxT*(dvTv-dvTl) + dvTTl + aux.x*(dvTTv-dvTTl));
-        duTTl := liq.cvt +(liq.pt-aux.dpT + aux.T*(2.0*liq.ptt -liq.d*liq.d*liq.ptd *dvTl))*dvTl + (aux.T*
-                liq.pt - aux.p)*dvTTl;
-        duTTv := vap.cvt +(vap.pt-aux.dpT + aux.T*(2.0*vap.ptt -vap.d*vap.d*vap.ptd *dvTv))*dvTv + (aux.T*
-                vap.pt - aux.p)*dvTTv;
-        aux.cvt := duTTl + aux.x *(duTTv -duTTl) + 2.0*dxT*(duTv-duTl) + dxTT *(vap.u-liq.u);
-        aux.cp := liq.cp + aux.x*(vap.cp - liq.cp);
-        aux.pt := liq.pt + aux.x*(vap.pt - liq.pt);
-        aux.pd := liq.pd + aux.x*(vap.pd - liq.pd);
-        aux.ptt := dpTT;
-      else
-        assert(false, "error in region computation of IF97 steam tables"
-        + "(rho = " + String(rho) + ", T = " + String(T) + ")");
-      end if;
-    end waterBasePropAnalytic_dT;
-
-    function waterBaseProp_ps "intermediate property record for water"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      input Integer phase = 0
-        "phase: 2 for two-phase, 1 for one phase, 0 if unknown";
-      input Integer region = 0
-        "if 0, do region computation, otherwise assume the region is this input";
-      output ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-    protected
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs g
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs f
-        "dimensionless Helmholtz funcion and dervatives wrt delta and tau";
-      Integer error "error flag for inverse iterations";
-      Modelica.SIunits.SpecificEntropy s_liq "liquid specific entropy";
-      Modelica.SIunits.Density d_liq "liquid density";
-      Modelica.SIunits.SpecificEntropy s_vap "vapour specific entropy";
-      Modelica.SIunits.Density d_vap "vapour density";
-      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties liq
-        "phase boundary property record";
-      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties vap
-        "phase boundary property record";
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs gl
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs gv
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      Modelica.Media.Common.HelmholtzDerivs fl
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-      Modelica.Media.Common.HelmholtzDerivs fv
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-      Modelica.SIunits.Temperature t1
-        "temperature at phase boundary, using inverse from region 1";
-      Modelica.SIunits.Temperature t2
-        "temperature at phase boundary, using inverse from region 2";
-    algorithm
-      aux.region := if region == 0 then
-        (if phase == 2 then 4 else ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_ps(
-                                                              p=p,s=s,phase=phase)) else region;
-      aux.phase := if phase <> 0 then phase else if aux.region == 4 then 2 else 1;
-      aux.p := p;
-      aux.s := s;
-      aux.R :=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
-      if (aux.region == 1) then
-        aux.T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tps1(
-                                     p, s);
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(
-                               p, aux.T);
-        aux.h := aux.R*aux.T*g.tau*g.gtau;
-        aux.rho := p/(aux.R*aux.T*g.pi*g.gpi);
-        aux.vt := aux.R/p*(g.pi*g.gpi - g.tau*g.pi*g.gtaupi);
-        aux.vp := aux.R*aux.T/(p*p)*g.pi*g.pi*g.gpipi;
-        aux.cp := -aux.R*g.tau*g.tau*g.gtautau;
-        aux.cv := aux.R*(-g.tau*g.tau*g.gtautau + ((g.gpi - g.tau*g.gtaupi)*(g.gpi - g.tau*g.gtaupi)/g.gpipi));
-        aux.x := 0.0;
-      elseif (aux.region == 2) then
-        aux.T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tps2(
-                                     p, s);
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(
-                               p, aux.T);
-        aux.h := aux.R*aux.T*g.tau*g.gtau;
-        aux.rho := p/(aux.R*aux.T*g.pi*g.gpi);
-        aux.vt := aux.R/p*(g.pi*g.gpi - g.tau*g.pi*g.gtaupi);
-        aux.vp := aux.R*aux.T/(p*p)*g.pi*g.pi*g.gpipi;
-        aux.cp := -aux.R*g.tau*g.tau*g.gtautau;
-        aux.cv := aux.R*(-g.tau*g.tau*g.gtautau + ((g.gpi - g.tau*g.gtaupi)*(g.gpi - g.tau*g.gtaupi)/g.gpipi));
-        aux.x := 1.0;
-      elseif (aux.region == 3) then
-        (aux.rho,aux.T,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.dtofps3(
-                                                           p=p,s=s,delp=1.0e-7,dels=
-          1.0e-6);
-        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(
-                               aux.rho, aux.T);
-        aux.h := aux.R*aux.T*(f.tau*f.ftau + f.delta*f.fdelta);
-        aux.s := aux.R*(f.tau*f.ftau - f.f);
-        aux.pd := aux.R*aux.T*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta);
-        aux.pt := aux.R*aux.rho*f.delta*(f.fdelta - f.tau*f.fdeltatau);
-        aux.cv := aux.R*(-f.tau*f.tau*f.ftautau);
-        aux.cp := (aux.rho*aux.rho*aux.pd*aux.cv + aux.T*aux.pt*aux.pt)/(aux.rho*aux.rho*aux.pd);
-        aux.x := 0.0;
-      elseif (aux.region == 4) then
-        s_liq := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.sl_p(
-                                       p);
-        s_vap := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.sv_p(
-                                       p);
-        aux.x := if (s_vap <> s_liq) then (s - s_liq)/(s_vap - s_liq) else 1.0;
-        if p <ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PLIMIT4A then
-          t1 := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tps1(
-                                    p, s_liq);
-          t2 := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tps2(
-                                    p, s_vap);
-          gl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(
-                                  p, t1);
-          gv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(
-                                  p, t2);
-          liq := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps(gl);
-          vap := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps(gv);
-          aux.T := t1 + aux.x*(t2 - t1);
-        else
-          aux.T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tsat(
-                                       p);
-          d_liq := rhol_T(aux.T);
-          d_vap := rhov_T(aux.T);
-          fl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(
-                                  d_liq, aux.T);
-          fv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(
-                                  d_vap, aux.T);
-          liq :=
-            ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps(fl);
-          vap :=
-            ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps(fv);
-        end if;
-        aux.dpT := if (liq.d <> vap.d) then (vap.s - liq.s)*liq.d*vap.d/(liq.d - vap.d) else
-             ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.dptofT(
-                                   aux.T);
-        aux.h := liq.h + aux.x*(vap.h - liq.h);
-        aux.rho := liq.d*vap.d/(vap.d + aux.x*(liq.d - vap.d));
-        aux.cv := ThermoSysPro.Properties.WaterSteam.Common.cv2Phase(
-              liq,
-              vap,
-              aux.x,
-              aux.T,
-              p);
-        aux.cp := liq.cp + aux.x*(vap.cp - liq.cp);
-        aux.pt := liq.pt + aux.x*(vap.pt - liq.pt);
-        aux.pd := liq.pd + aux.x*(vap.pd - liq.pd);
-      elseif (aux.region == 5) then
-        (aux.T,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.tofps5(
-                                                  p=p,s=s,relds= 1.0e-7);
-        assert(error == 0, "error in inverse iteration of steam tables");
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g5(
-                               p, aux.T);
-        aux.h := aux.R*aux.T*g.tau*g.gtau;
-        aux.rho := p/(aux.R*aux.T*g.pi*g.gpi);
-        aux.vt := aux.R/p*(g.pi*g.gpi - g.tau*g.pi*g.gtaupi);
-        aux.vp := aux.R*aux.T/(p*p)*g.pi*g.pi*g.gpipi;
-        aux.cp := -aux.R*g.tau*g.tau*g.gtautau;
-        aux.cv := aux.R*(-g.tau*g.tau*g.gtautau + ((g.gpi - g.tau*g.gtaupi)*(g.gpi - g.tau*g.gtaupi)/g.gpipi));
-      else
-        assert(false, "error in region computation of IF97 steam tables"
-        + "(p = " + String(p) + ", s = " + String(s) + ")");
-      end if;
-    end waterBaseProp_ps;
-
-    replaceable record iter =
-        ThermoSysPro.Properties.WaterSteam.BaseIF97.IterationData;
-
-    function phase_ph "phase as a function of  pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      output Integer phase "true if in liquid or gas or supercritical region";
-    algorithm
-      phase := if ((h < hl_p(p) or h > hv_p(p)) or p >ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT)
-                                                                                               then
-                                                                                 1 else 2;
-      annotation (InlineNoEvent=false);
-    end phase_ph;
-
-    function phase_dT "phase as a function of  pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density rho "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      output Integer phase "true if in liquid or gas or supercritical region";
-    algorithm
-      phase := if not ((rho < rhol_T(T) and rho > rhov_T(T)) and T <
-        ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TCRIT) then
-                         1 else 2;
-      annotation (InlineNoEvent=false);
-    end phase_dT;
-
-    function rho_props_ph
-      "density as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      output Modelica.SIunits.Density rho "density";
-    algorithm
-      rho := aux.rho;
-
-      annotation (
-        derivative(noDerivative=aux) = rho_ph_d,
-        Inline=false,
-        LateInline=true);
-    end rho_props_ph;
-
-    function rho_ph "density as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input Integer phase = 0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region = 0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.Density rho "density";
-    algorithm
-      rho := rho_props_ph(p, h, waterBasePropAnalytic_ph(p, h, phase, region));
-    end rho_ph;
-
-    function rho_ph_d "derivative function of rho_ph"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      input Real p_d "derivative of pressure";
-      input Real h_d "derivative of specific enthalpy";
-      output Real rho_d "derivative of density";
-    algorithm
-      if (aux.region == 4) then
-        rho_d := (aux.rho*(aux.rho*aux.cv/aux.dpT + 1.0)/(aux.dpT*aux.T))*p_d
-           + (-aux.rho*aux.rho/(aux.dpT*aux.T))*h_d;
-      elseif (aux.region == 3) then
-        rho_d := ((aux.rho*(aux.cv*aux.rho + aux.pt))/(aux.rho*aux.rho*aux.pd*
-          aux.cv + aux.T*aux.pt*aux.pt))*p_d + (-aux.rho*aux.rho*aux.pt/(aux.
-          rho*aux.rho*aux.pd*aux.cv + aux.T*aux.pt*aux.pt))*h_d;
-      else
-        //regions 1,2,5
-        rho_d := (-aux.rho*aux.rho*(aux.vp*aux.cp - aux.vt/aux.rho + aux.T*aux.
-          vt*aux.vt)/aux.cp)*p_d + (-aux.rho*aux.rho*aux.vt/(aux.cp))*h_d;
-      end if;
-
-      annotation (derivative(noDerivative=aux) = rho_ph_dd);
-    end rho_ph_d;
-
-    function rho_ph_dd "Second order derivative function of rho_ph"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      input Real p_d "derivative of pressure";
-      input Real h_d "derivative of specific enthalpy";
-      input Real p_dd "second derivative of pressure";
-      input Real h_dd "second derivative of specific enthalpy";
-      output Real rho_dd "Second derivative of density";
-    protected
-      Modelica.SIunits.DerDensityByPressure ddph
-        "Derivative of d by p at constant h";
-      Modelica.SIunits.DerDensityByEnthalpy ddhp
-        "Derivative of d by h at constant p";
-      Real ddph_ph "Derivative of ddph by p";
-      Real ddph_hp "Derivative of ddph by h";
-      Real ddhp_hp "Derivative of ddhp by h";
-      Real ddhp_ph "Derivative of ddhp by p";
-    algorithm
-      ddph := ddph_props(p,h,aux);
-      ddhp := ddhp_props(p,h,aux);
-      (ddph_ph,ddph_hp) := ddph_ph_dd(p,h,aux);
-      (ddhp_hp,ddhp_ph) := ddhp_ph_dd(p,h,aux);
-      rho_dd := ddph*p_dd + 2.0*ddhp_ph*p_d*h_d + ddph_ph*p_d*p_d + ddhp_hp*h_d*h_d + ddhp*h_dd;
-    end rho_ph_dd;
-
-    function T_props_ph
-      "temperature as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic
-        properties "auxiliary record";
-      output Modelica.SIunits.Temperature T "temperature";
-    algorithm
-      T := properties.T;
-
-      annotation (derivative(noDerivative=properties) = T_ph_der,
-        Inline=false,
-        LateInline=true);
-    end T_props_ph;
-
-    function T_ph "temperature as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input Integer phase = 0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region = 0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.Temperature T "Temperature";
-    algorithm
-      T := T_props_ph(p, h, waterBasePropAnalytic_ph(p, h, phase, region));
-    end T_ph;
-
-    function T_ph_der "derivative function of T_ph"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      input Real p_der "derivative of pressure";
-      input Real h_der "derivative of specific enthalpy";
-      output Real T_der "derivative of temperature";
-    algorithm
-      if (aux.region == 4) then
-        T_der := 1/aux.dpT*p_der;
-      elseif (aux.region == 3) then
-        T_der := ((-aux.rho*aux.pd + aux.T*aux.pt)/(aux.rho*aux.rho*aux.pd*aux.cv
-           + aux.T*aux.pt*aux.pt))*p_der + ((aux.rho*aux.rho*aux.pd)/(aux.rho*aux.
-           rho*aux.pd*aux.cv + aux.T*aux.pt*aux.pt))*h_der;
-      else
-        //regions 1,2 or 5
-        T_der := ((-1/aux.rho + aux.T*aux.vt)/aux.cp)*p_der + (1/aux.cp)*h_der;
-      end if;
-    end T_ph_der;
-
-    function s_props_ph
-      "specific entropy as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic
-        properties "auxiliary record";
-      output Modelica.SIunits.SpecificEntropy s "specific entropy";
-    algorithm
-      s := properties.s;
-
-      annotation (derivative(noDerivative=properties) = s_ph_der,
-    Inline=false,
-    LateInline=true);
-    end s_props_ph;
-
-    function s_ph
-      "specific entropy as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input Integer phase =   0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.SpecificEntropy s "specific entropy";
-    algorithm
-      s := s_props_ph(p, h, waterBasePropAnalytic_ph(p, h, phase, region));
-    end s_ph;
-
-    function s_ph_der
-      "specific entropy as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      input Real p_der "derivative of pressure";
-      input Real h_der "derivative of specific enthalpy";
-      output Real s_der "derivative of entropy";
-    algorithm
-      s_der := -1/(aux.rho*aux.T)*p_der + 1/aux.T*h_der;
-    end s_ph_der;
-
-    function cv_props_ph
-      "specific heat capacity at constant volume as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      output Modelica.SIunits.SpecificHeatCapacity cv "specific heat capacity";
-    algorithm
-      cv := aux.cv;
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end cv_props_ph;
-
-    function cv_ph
-      "specific heat capacity at constant volume as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input Integer phase = 0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region = 0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.SpecificHeatCapacity cv "specific heat capacity";
-    algorithm
-      cv := cv_props_ph(p, h, waterBasePropAnalytic_ph(p, h, phase, region));
-    end cv_ph;
-
-    function regionAssertReal "assert function for inlining"
-      extends Modelica.Icons.Function;
-      input Boolean check "condition to check";
-      output Real dummy "dummy output";
-    algorithm
-      assert(check, "this function can not be called with two-phase inputs!");
-    end regionAssertReal;
-
-    function cp_props_ph
-      "specific heat capacity at constant pressure as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      output Modelica.SIunits.SpecificHeatCapacity cp "specific heat capacity";
-    algorithm
-      cp := aux.cp;
-
-      annotation (
-        Inline=false,
-        LateInline=true,
-      derivative(noDerivative=aux) = cp_ph_der);
-    end cp_props_ph;
-
-    function cp_ph
-      "specific heat capacity at constant pressure as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input Integer phase = 0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region = 0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.SpecificHeatCapacity cp "specific heat capacity";
-    algorithm
-      cp := cp_props_ph(p, h, waterBasePropAnalytic_ph(p, h, phase, region));
-    end cp_ph;
-
-    function cp_ph_der "derivative function of cp_ph"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      input Real p_der "derivative of pressure";
-      input Real h_der "derivative of specific enthalpy";
-      output Real cp_der "derivative of heat capacity";
-    protected
-      Real detPH "Determinant";
-      Real dht;
-      Real dhd;
-      Real ddhp;
-      Real ddph;
-      Real dtph;
-      Real dthp;
-      Real detPH_d;
-      Real dcp_d;
-    algorithm
-      if (aux.region == 4) then
-        cp_der := 0.0;
-      elseif (aux.region == 3) then
-        detPH := aux.cp*aux.pd;
-        dht := aux.cv + aux.pt/aux.rho;
-        dhd := (aux.pd - aux.T*aux.pt/aux.rho)/aux.rho;
-        ddph := dht/ detPH;
-        ddhp := -aux.pt/detPH;
-        dtph := -dhd/detPH;
-        dthp := aux.pd/detPH;
-        detPH_d := aux.cv*aux.pdd + (2.0*aux.pt *(aux.ptd - aux.pt/aux.rho)
-            -aux.ptt*aux.pd) *aux.T/(aux.rho*aux.rho);
-        dcp_d :=(detPH_d - aux.cp*aux.pdd)/aux.pd;
-        cp_der := (ddph * dcp_d + dtph * aux.cpt)*p_der +
-           (ddhp * dcp_d + dthp * aux.cpt)*h_der;
-      else
-        //regions 1,2 or 5
-        cp_der := (-(aux.T * aux.vtt * aux.cp + aux.cpt/aux.rho - aux.cpt * aux.T * aux.vt) / aux.cp)*p_der +
-          aux.cpt/aux.cp*h_der;
-      end if;
-      annotation (Documentation(info="<html></html>"));
-    end cp_ph_der;
-
-    function beta_props_ph
-      "isobaric expansion coefficient as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      output Modelica.SIunits.RelativePressureCoefficient beta
-        "isobaric expansion coefficient";
-    algorithm
-      beta := if aux.region == 3 or aux.region == 4 then
-        aux.pt/(aux.rho*aux.pd) else
-        aux.vt*aux.rho;
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end beta_props_ph;
-
-    function beta_ph
-      "isobaric expansion coefficient as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input Integer phase = 0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region = 0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.RelativePressureCoefficient beta
-        "isobaric expansion coefficient";
-    algorithm
-      beta := beta_props_ph(p, h, waterBasePropAnalytic_ph(p, h, phase, region));
-    end beta_ph;
-
-    function kappa_props_ph
-      "isothermal compressibility factor as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      output Modelica.SIunits.IsothermalCompressibility kappa
-        "isothermal compressibility factor";
-    algorithm
-      kappa := if aux.region == 3 or aux.region == 4 then
-        1/(aux.rho*aux.pd) else -aux.vp*aux.rho;
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end kappa_props_ph;
-
-    function kappa_ph
-      "isothermal compressibility factor as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input Integer phase = 0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region = 0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.IsothermalCompressibility kappa
-        "isothermal compressibility factor";
-    algorithm
-      kappa := kappa_props_ph(p, h, waterBasePropAnalytic_ph(p, h, phase, region));
-    end kappa_ph;
-
-    function velocityOfSound_props_ph
-      "speed of sound as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      output Modelica.SIunits.Velocity v_sound "speed of sound";
-    algorithm
-      // dp/drho at constant s
-      v_sound := if aux.region == 3 then sqrt((aux.pd*aux.rho*aux.rho*aux.cv + aux.pt*aux.pt*aux.T)/(aux.rho*aux.rho*aux.cv)) else
-        if aux.region == 4 then
-        sqrt(1/((aux.rho*(aux.rho*aux.cv/aux.dpT + 1.0)/(aux.dpT*aux.T)) - 1/aux.rho*aux.rho*aux.rho/(aux.dpT*aux.T))) else
-             sqrt(-aux.cp/(aux.rho*aux.rho*(aux.vp*aux.cp+aux.vt*aux.vt*aux.T)));
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end velocityOfSound_props_ph;
-
-    function velocityOfSound_ph
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input Integer phase = 0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region = 0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.Velocity v_sound "speed of sound";
-    algorithm
-      v_sound := velocityOfSound_props_ph(p, h, waterBasePropAnalytic_ph(p, h, phase, region));
-    end velocityOfSound_ph;
-
-    function isentropicExponent_props_ph
-      "isentropic exponent as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      output Real gamma "isentropic exponent";
-    algorithm
-      gamma := if aux.region == 3 then 1/(aux.rho*p)*((aux.pd*aux.cv*aux.rho*aux.rho + aux.pt*aux.pt*aux.T)/(aux.cv)) else
-             if aux.region == 4 then 1/(aux.rho*p)*aux.dpT*aux.dpT*aux.T/aux.cv else
-        -1/(aux.rho*aux.p)*aux.cp/(aux.vp*aux.cp + aux.vt*aux.vt*aux.T);
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end isentropicExponent_props_ph;
-
-    function isentropicExponent_ph
-      "isentropic exponent as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input Integer phase =   0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Real gamma "isentropic exponent";
-    algorithm
-      gamma := isentropicExponent_props_ph(p, h, waterBasePropAnalytic_ph(p, h, phase, region));
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end isentropicExponent_ph;
-
-    function ddph_props "density derivative by pressure"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      output Modelica.SIunits.DerDensityByPressure ddph
-        "density derivative by pressure";
-    algorithm
-      ddph := if aux.region == 3 then
-        ((aux.rho*(aux.cv*aux.rho + aux.pt))/(aux.rho*aux.rho*aux.pd*aux.cv + aux.T*aux.pt*aux.pt)) else
-        if aux.region == 4 then  (aux.rho*(aux.rho*aux.cv/aux.dpT + 1.0)/(aux.dpT*aux.T)) else
-             (-aux.rho*aux.rho*(aux.vp*aux.cp - aux.vt/aux.rho + aux.T*aux.vt*aux.vt)/aux.cp);
-
-      annotation (
-        Inline=false,
-        LateInline=true,
-        derivative(noDerivative=aux) = ddph_ph_der);
-    end ddph_props;
-
-    function ddph "density derivative by pressure"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input Integer phase = 0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region = 0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.DerDensityByPressure ddph
-        "density derivative by pressure";
-    algorithm
-      ddph := ddph_props(p, h, waterBasePropAnalytic_ph(p, h, phase, region));
-    end ddph;
-
-    function ddph_ph_der "derivative function of ddph"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      input Real p_der "derivative of pressure";
-      input Real h_der "derivative of specific enthalpy";
-      output Real ddph_der "Gradient of ddph";
-    protected
-      Modelica.SIunits.SpecificVolume v=1/aux.rho;
-      Real detPH "Determinant";
-      Real dht;
-      Real dhd;
-      Real ddhp;
-      Real ddph;
-      Real dtph;
-      Real dthp;
-      Real detPH_d;
-      Real detPH_t;
-      Real dhtt;
-      Real dhtd;
-      Real ddph_t;
-      Real ddph_d;
-      Real ddhp_t;
-      Real ddhp_d;
-    algorithm
-      if (aux.region == 4) then
-
-        dht := aux.cv + aux.dpT * v;
-        dhd := -aux.T * aux.dpT*v*v;
-        detPH := -aux.dpT * dhd;
-        dtph := 1.0 / aux.dpT;
-        ddph := dht / detPH;
-        ddhp := -aux.dpT / detPH;
-        detPH_t := 2.0 * aux.ptt / aux.dpT + 1.0 / aux.T; /* = detPH_t / detPH */
-        detPH_d := -2.0 * v;                   /* = detPH_d / detPH */
-
-        dhtt := aux.cvt + aux.ptt * v;
-        dhtd := -(aux.T * aux.ptt + aux.dpT) *v*v;
-        ddhp_t := ddhp * (aux.ptt / aux.dpT - detPH_t);
-        ddhp_d := ddhp * (-detPH_d);
-        ddph_t := ddph * (dhtt / dht - detPH_t);
-        ddph_d := ddph * (dhtd / dht - detPH_d);
-        ddph_der := (ddph * ddph_d + dtph * ddph_t)*p_der + (ddhp * ddph_d)*h_der;
-      else
-        detPH := aux.cp*aux.pd;
-        dht := aux.cv + aux.pt*v;
-        dhd := (aux.pd - aux.T*aux.pt*v)*v;
-        ddph := dht/ detPH;
-        ddhp := -aux.pt/detPH;
-        dtph := -dhd/detPH;
-        dthp := aux.pd/detPH;
-        detPH_d := aux.cv*aux.pdd + (2.0*aux.pt *(aux.ptd - aux.pt*v)
-            -aux.ptt*aux.pd) *aux.T*v*v;
-        detPH_t := aux.cvt*aux.pd + aux.cv*aux.ptd +
-            (aux.pt + 2.0*aux.T*aux.ptt)*aux.pt*v*v;
-        dhtt := aux.cvt + aux.ptt*v;
-        dhtd := (aux.ptd - (aux.T * aux.ptt + aux.pt)*v) *v;
-        ddph_t := ddph * (dhtt / dht - detPH_t / detPH);
-        ddph_d := ddph * (dhtd / dht - detPH_d / detPH);
-        ddhp_t := ddhp * (aux.ptt / aux.pt - detPH_t / detPH);
-        ddhp_d := ddhp * (aux.ptd / aux.pt - detPH_d / detPH);
-        ddph_der := (ddph * ddph_d + dtph * ddph_t)*p_der +
-           (ddph * ddhp_d + dtph * ddhp_t)*h_der;
-
-      end if;
-    end ddph_ph_der;
-
-    function ddph_ph_dd "Second derivatives function of density"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      output Real ddph_ph "Second derivative of density by p at constant h";
-      output Real ddph_hp "Second mixed derivative of density by p and h";
-    protected
-      Modelica.SIunits.SpecificVolume v=1/aux.rho;
-      Real detPH "Determinant";
-      Real dht;
-      Real dhd;
-      Real ddhp;
-      Real ddph;
-      Real dtph;
-      Real dthp;
-      Real detPH_d;
-      Real detPH_t;
-      Real dhtt;
-      Real dhtd;
-      Real ddph_t;
-      Real ddph_d;
-      Real ddhp_t;
-      Real ddhp_d;
-    algorithm
-      if (aux.region == 4) then
-        dht := aux.cv + aux.dpT * v;
-        dhd := -aux.T * aux.dpT*v*v;
-        detPH := -aux.dpT * dhd;
-        dtph := 1.0 / aux.dpT;
-        ddph := dht / detPH;
-        ddhp := -aux.dpT / detPH;
-        detPH_t := 2.0 * aux.ptt / aux.dpT + 1.0 / aux.T; /* = detPH_t / detPH */
-        detPH_d := -2.0 * v;                   /* = detPH_d / detPH */
-        dhtt := aux.cvt + aux.ptt * v;
-        dhtd := -(aux.T * aux.ptt + aux.dpT) *v*v;
-        ddhp_t := ddhp * (aux.ptt / aux.dpT - detPH_t);
-        ddhp_d := ddhp * (-detPH_d);
-        ddph_t := ddph * (dhtt / dht - detPH_t);
-        ddph_d := ddph * (dhtd / dht - detPH_d);
-        ddph_ph := (ddph * ddph_d + dtph * ddph_t);
-        ddph_hp := (ddhp * ddph_d);
-      else
-        detPH := aux.cp*aux.pd;
-        dht := aux.cv + aux.pt*v;
-        dhd := (aux.pd - aux.T*aux.pt*v)*v;
-        ddph := dht/ detPH;
-        ddhp := -aux.pt/detPH;
-        dtph := -dhd/detPH;
-        dthp := aux.pd/detPH;
-        detPH_d := aux.cv*aux.pdd + (2.0*aux.pt *(aux.ptd - aux.pt*v)
-            -aux.ptt*aux.pd) *aux.T*v*v;
-        detPH_t := aux.cvt*aux.pd + aux.cv*aux.ptd +
-            (aux.pt + 2.0*aux.T*aux.ptt)*aux.pt*v*v;
-        dhtt := aux.cvt + aux.ptt*v;
-        dhtd := (aux.ptd - (aux.T * aux.ptt + aux.pt)*v) *v;
-        ddph_t := ddph * (dhtt / dht - detPH_t / detPH);
-        ddph_d := ddph * (dhtd / dht - detPH_d / detPH);
-        ddhp_t := ddhp * (aux.ptt / aux.pt - detPH_t / detPH);
-        ddhp_d := ddhp * (aux.ptd / aux.pt - detPH_d / detPH);
-        ddph_ph := (ddph * ddph_d + dtph * ddph_t);
-        ddph_hp := (ddph * ddhp_d + dtph * ddhp_t);
-      end if;
-    end ddph_ph_dd;
-
-    function ddhp_props "density derivative by specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      output Modelica.SIunits.DerDensityByEnthalpy ddhp
-        "density derivative by specific enthalpy";
-    algorithm
-      ddhp := if aux.region == 3 then
-        -aux.rho*aux.rho*aux.pt/(aux.rho*aux.rho*aux.pd*aux.cv + aux.T*aux.pt*aux.pt) else
-        if aux.region == 4 then -aux.rho*aux.rho/(aux.dpT*aux.T) else
-             -aux.rho*aux.rho*aux.vt/(aux.cp);
-
-      annotation (
-        Inline=false,
-        LateInline=true,
-      derivative(noDerivative=aux) = ddhp_ph_der);
-    end ddhp_props;
-
-    function ddhp "density derivative by specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input Integer phase = 0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region = 0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.DerDensityByEnthalpy ddhp
-        "density derivative by specific enthalpy";
-    algorithm
-      ddhp := ddhp_props(p, h, waterBasePropAnalytic_ph(p, h, phase, region));
-    end ddhp;
-
-    function ddhp_ph_der "derivative function of ddhp"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      input Real p_der "derivative of pressure";
-      input Real h_der "derivative of specific enthalpy";
-      output Real ddhp_der "Gradient of ddhp";
-    protected
-      Modelica.SIunits.SpecificVolume v=1/aux.rho;
-      Real detPH "Determinant";
-      Real dht;
-      Real dhd;
-      Real ddhp;
-      Real ddph;
-      Real dtph;
-      Real dthp;
-      Real detPH_d;
-      Real detPH_t;
-      Real dhtt;
-      Real dhtd;
-      Real ddhp_d;
-      Real ddhp_t;
-      Real ddph_d;
-    algorithm
-      if (aux.region == 4) then
-
-        dht := aux.cv + aux.dpT * v;
-        dhd := -aux.T * aux.dpT*v*v;
-        detPH := -aux.dpT * dhd;
-        dtph := 1.0 / aux.dpT;
-        ddph := dht / detPH;
-        ddhp := -aux.dpT / detPH;
-        detPH_d := -2.0 * v;                   /* = detPH_d / detPH */
-        dhtt := aux.cvt + aux.ptt * v;
-        dhtd := -(aux.T * aux.ptt + aux.dpT) *v*v;
-        ddhp_d := ddhp * (-detPH_d);
-        ddph_d := ddph * (dhtd / dht - detPH_d);
-        ddhp_der := (ddhp * ddhp_d)*h_der + (ddhp * ddph_d)*p_der;
-      else
-        detPH := aux.cp*aux.pd;
-        dht := aux.cv + aux.pt*v;
-        dhd := (aux.pd - aux.T*aux.pt*v)*v;
-        ddph := dht/ detPH;
-        ddhp := -aux.pt/detPH;
-        dtph := -dhd/detPH;
-        dthp := aux.pd/detPH;
-        detPH_d := aux.cv*aux.pdd + (2.0*aux.pt *(aux.ptd - aux.pt*v)
-            -aux.ptt*aux.pd) *aux.T*v*v;
-        detPH_t := aux.cvt*aux.pd + aux.cv*aux.ptd +
-            (aux.pt + 2.0*aux.T*aux.ptt)*aux.pt*v*v;
-        dhtt := aux.cvt + aux.ptt*v;
-        dhtd := (aux.ptd - (aux.T * aux.ptt + aux.pt)*v) *v;
-        ddhp_t := ddhp * (aux.ptt / aux.pt - detPH_t / detPH);
-        ddhp_d := ddhp * (aux.ptd / aux.pt - detPH_d / detPH);
-        ddhp_der := (ddhp * ddhp_d + dthp * ddhp_t)*h_der +
-           (ddph * ddhp_d + dtph * ddhp_t)*p_der;
-      end if;
-    end ddhp_ph_der;
-
-    function ddhp_ph_dd "Second derivatives of density w.r.t h and p"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      output Real ddhp_hp "Second derivative of density by h at constant p";
-      output Real ddhp_ph "Second mixed derivative of density by p and h";
-    protected
-      Modelica.SIunits.SpecificVolume v=1/aux.rho;
-      Real detPH "Determinant";
-      Real dht;
-      Real dhd;
-      Real ddhp;
-      Real ddph;
-      Real dtph;
-      Real dthp;
-      Real detPH_d;
-      Real detPH_t;
-      Real dhtt;
-      Real dhtd;
-      Real ddhp_d;
-      Real ddhp_t;
-      Real ddph_d;
-    algorithm
-      if (aux.region == 4) then
-        dht := aux.cv + aux.dpT * v;
-        dhd := -aux.T * aux.dpT*v*v;
-        detPH := -aux.dpT * dhd;
-        dtph := 1.0 / aux.dpT;
-        ddph := dht / detPH;
-        ddhp := -aux.dpT / detPH;
-        detPH_d := -2.0 * v;                   /* = detPH_d / detPH */
-        dhtt := aux.cvt + aux.ptt * v;
-        dhtd := -(aux.T * aux.ptt + aux.dpT) *v*v;
-        ddhp_d := ddhp * (-detPH_d);
-        ddph_d := ddph * (dhtd / dht - detPH_d);
-        ddhp_hp := (ddhp * ddhp_d);
-        ddhp_ph := (ddhp * ddph_d);
-      else
-        detPH := aux.cp*aux.pd;
-        dht := aux.cv + aux.pt*v;
-        dhd := (aux.pd - aux.T*aux.pt*v)*v;
-        ddph := dht/ detPH;
-        ddhp := -aux.pt/detPH;
-        dtph := -dhd/detPH;
-        dthp := aux.pd/detPH;
-        detPH_d := aux.cv*aux.pdd + (2.0*aux.pt *(aux.ptd - aux.pt*v)
-            -aux.ptt*aux.pd) *aux.T*v*v;
-        detPH_t := aux.cvt*aux.pd + aux.cv*aux.ptd +
-            (aux.pt + 2.0*aux.T*aux.ptt)*aux.pt*v*v;
-        dhtt := aux.cvt + aux.ptt*v;
-        dhtd := (aux.ptd - (aux.T * aux.ptt + aux.pt)*v) *v;
-        ddhp_t := ddhp * (aux.ptt / aux.pt - detPH_t / detPH);
-        ddhp_d := ddhp * (aux.ptd / aux.pt - detPH_d / detPH);
-        ddhp_hp :=  (ddhp * ddhp_d + dthp * ddhp_t);
-        ddhp_hp :=  (ddph * ddhp_d + dtph * ddhp_t);
-      end if;
-    end ddhp_ph_dd;
-
-    function rho_props_pT "density as function or pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      output Modelica.SIunits.Density rho "density";
-    algorithm
-      rho := aux.rho;
-
-      annotation (
-        derivative(noDerivative=aux) = rho_pT_der,
-        Inline=false,
-        LateInline=true);
-    end rho_props_pT;
-
-    function rho_pT "density as function or pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.Density rho "density";
-    algorithm
-      rho := rho_props_pT(p, T, waterBasePropAnalytic_pT(p, T, region));
-    end rho_pT;
-
-    function h_props_pT
-      "specific enthalpy as function or pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    algorithm
-      h := aux.h;
-
-      annotation (
-        derivative(noDerivative=aux) = h_pT_der,
-        Inline=false,
-        LateInline=true);
-    end h_props_pT;
-
-    function h_pT "specific enthalpy as function or pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "Temperature";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    algorithm
-      h := h_props_pT(p, T, waterBasePropAnalytic_pT(p, T, region));
-    end h_pT;
-
-    function h_pT_der "derivative function of h_pT"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      input Real p_der "derivative of pressure";
-      input Real T_der "derivative of temperature";
-      output Real h_der "derivative of specific enthalpy";
-    algorithm
-      if (aux.region == 3) then
-        h_der := ((-aux.rho*aux.pd + T*aux.pt)/(aux.rho*aux.rho*aux.pd))*p_der +
-          ((aux.rho*aux.rho*aux.pd*aux.cv + aux.T*aux.pt*aux.pt)/(aux.rho*aux.rho
-          *aux.pd))*T_der;
-      else
-        //regions 1,2 or 5
-        h_der := (1/aux.rho - aux.T*aux.vt)*p_der + aux.cp*T_der;
-      end if;
-    end h_pT_der;
-
-    function rho_pT_der "derivative function of rho_pT"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      input Real p_der "derivative of pressure";
-      input Real T_der "derivative of temperature";
-      output Real rho_der "derivative of density";
-    algorithm
-      if (aux.region == 3) then
-        rho_der := (1/aux.pd)*p_der - (aux.pt/aux.pd)*T_der;
-      else
-        //regions 1,2 or 5
-        rho_der := (-aux.rho*aux.rho*aux.vp)*p_der + (-aux.rho*aux.rho*aux.vt)*
-          T_der;
-      end if;
-    end rho_pT_der;
-
-    function s_props_pT
-      "specific entropy as function of pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      output Modelica.SIunits.SpecificEntropy s "specific entropy";
-    algorithm
-      s := aux.s;
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end s_props_pT;
-
-    function s_pT "temperature as function of pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.SpecificEntropy s "specific entropy";
-    algorithm
-      s := s_props_pT(p, T, waterBasePropAnalytic_pT(p, T, region));
-      annotation (InlineNoEvent=false);
-    end s_pT;
-
-    function cv_props_pT
-      "specific heat capacity at constant volume as function of pressure and temperature"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      output Modelica.SIunits.SpecificHeatCapacity cv "specific heat capacity";
-    algorithm
-      cv := aux.cv;
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end cv_props_pT;
-
-    function cv_pT
-      "specific heat capacity at constant volume as function of pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.SpecificHeatCapacity cv "specific heat capacity";
-    algorithm
-      cv := cv_props_pT(p, T, waterBasePropAnalytic_pT(p, T, region));
-      annotation (InlineNoEvent=false);
-    end cv_pT;
-
-    function cp_props_pT
-      "specific heat capacity at constant pressure as function of pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      output Modelica.SIunits.SpecificHeatCapacity cp "specific heat capacity";
-    algorithm
-      cp := if aux.region == 3 then
-        (aux.rho*aux.rho*aux.pd*aux.cv + aux.T*aux.pt*aux.pt)/(aux.rho*aux.rho*aux.pd) else
-        aux.cp;
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end cp_props_pT;
-
-    function cp_pT
-      "specific heat capacity at constant pressure as function of pressure and temperature"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.SpecificHeatCapacity cp "specific heat capacity";
-    algorithm
-      cp := cp_props_pT(p, T, waterBasePropAnalytic_pT(p, T, region));
-      annotation (InlineNoEvent=false);
-    end cp_pT;
-
-    function beta_props_pT
-      "isobaric expansion coefficient as function of pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      output Modelica.SIunits.RelativePressureCoefficient beta
-        "isobaric expansion coefficient";
-    algorithm
-      beta := if aux.region == 3 then
-        aux.pt/(aux.rho*aux.pd) else
-        aux.vt*aux.rho;
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end beta_props_pT;
-
-    function beta_pT
-      "isobaric expansion coefficient as function of pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.RelativePressureCoefficient beta
-        "isobaric expansion coefficient";
-    algorithm
-      beta := beta_props_pT(p, T, waterBasePropAnalytic_pT(p, T, region));
-      annotation (InlineNoEvent=false);
-    end beta_pT;
-
-    function kappa_props_pT
-      "isothermal compressibility factor as function of pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      output Modelica.SIunits.IsothermalCompressibility kappa
-        "isothermal compressibility factor";
-    algorithm
-      kappa := if aux.region == 3 then
-        1/(aux.rho*aux.pd) else -aux.vp*aux.rho;
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end kappa_props_pT;
-
-    function kappa_pT
-      "isothermal compressibility factor as function of pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.IsothermalCompressibility kappa
-        "isothermal compressibility factor";
-    algorithm
-      kappa := kappa_props_pT(p, T, waterBasePropAnalytic_pT(p, T, region));
-      annotation (InlineNoEvent=false);
-    end kappa_pT;
-
-    function velocityOfSound_props_pT
-      "speed of sound as function of pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      output Modelica.SIunits.Velocity v_sound "speed of sound";
-    algorithm
-      // dp/drho at constant s
-      v_sound := if aux.region == 3 then sqrt((aux.pd*aux.rho*aux.rho*aux.cv + aux.pt*aux.pt*aux.T)/(aux.rho*aux.rho*aux.cv)) else
-        sqrt(-aux.cp/(aux.rho*aux.rho*(aux.vp*aux.cp+aux.vt*aux.vt*aux.T)));
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end velocityOfSound_props_pT;
-
-    function velocityOfSound_pT
-      "speed of sound as function of pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.Velocity v_sound "speed of sound";
-    algorithm
-      v_sound := velocityOfSound_props_pT(p, T, waterBasePropAnalytic_pT(p, T, region));
-    end velocityOfSound_pT;
-
-    function isentropicExponent_props_pT
-      "isentropic exponent as function of pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      output Real gamma "isentropic exponent";
-    algorithm
-      gamma := if aux.region == 3 then 1/(aux.rho*p)*((aux.pd*aux.cv*aux.rho*aux.rho + aux.pt*aux.pt*aux.T)/(aux.cv)) else
-        -1/(aux.rho*aux.p)*aux.cp/(aux.vp*aux.cp + aux.vt*aux.vt*aux.T);
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end isentropicExponent_props_pT;
-
-    function isentropicExponent_pT
-      "isentropic exponent as function of pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Real gamma "isentropic exponent";
-    algorithm
-      gamma := isentropicExponent_props_pT(p, T, waterBasePropAnalytic_pT(p, T, region));
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end isentropicExponent_pT;
-
-    function h_props_dT
-      "specific enthalpy as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "Temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    algorithm
-      h := aux.h;
-
-      annotation (
-        derivative(noDerivative=aux) = h_dT_der,
-        Inline=false,
-        LateInline=true);
-    end h_props_dT;
-
-    function h_dT "specific enthalpy as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "Temperature";
-      input Integer phase =  0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    algorithm
-      h := h_props_dT(d, T, waterBasePropAnalytic_dT(d, T, phase, region));
-    end h_dT;
-
-    function h_dT_der "derivative function of h_dT"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      input Real d_der "derivative of density";
-      input Real T_der "derivative of temperature";
-      output Real h_der "derivative of specific enthalpy";
-    algorithm
-      if (aux.region == 3) then
-        h_der := ((-d*aux.pd + T*aux.pt)/(d*d))*d_der + ((aux.cv*d + aux.pt)/d)*
-          T_der;
-      elseif (aux.region == 4) then
-        h_der := T*aux.dpT/(d*d)*d_der + ((aux.cv*d + aux.dpT)/d)*T_der;
-      else
-        //regions 1,2 or 5
-        h_der := (-(-1/d + T*aux.vt)/(d*d*aux.vp))*d_der + ((aux.vp*aux.cp - aux.
-          vt/d + T*aux.vt*aux.vt)/aux.vp)*T_der;
-      end if;
-    end h_dT_der;
-
-    function p_props_dT "pressure as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "Temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      output Modelica.SIunits.Pressure p "pressure";
-    algorithm
-      p := aux.p;
-
-      annotation (
-        derivative(noDerivative=aux) = p_dT_der,
-        Inline=false,
-        LateInline=true);
-    end p_props_dT;
-
-    function p_dT "pressure as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "Temperature";
-      input Integer phase =  0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.Pressure p "pressure";
-    algorithm
-      p := p_props_dT(d, T, waterBasePropAnalytic_dT(d, T, phase, region));
-    end p_dT;
-
-    function p_dT_der "derivative function of p_dT"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      input Real d_der "derivative of density";
-      input Real T_der "derivative of temperature";
-      output Real p_der "derivative of pressure";
-    algorithm
-      if (aux.region == 3) then
-        p_der := aux.pd*d_der + aux.pt*T_der;
-      elseif (aux.region == 4) then
-        p_der := aux.dpT*T_der;
-        /*density derivative is 0.0*/
-      else
-        //regions 1,2 or 5
-        p_der := (-1/(d*d*aux.vp))*d_der + (-aux.vt/aux.vp)*T_der;
-      end if;
-    end p_dT_der;
-
-    function s_props_dT
-      "specific entropy as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "Temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      output Modelica.SIunits.SpecificEntropy s "specific entropy";
-    algorithm
-      s := aux.s;
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end s_props_dT;
-
-    function s_dT "temperature as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "Temperature";
-      input Integer phase =  0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.SpecificEntropy s "specific entropy";
-    algorithm
-      s := s_props_dT(d, T, waterBasePropAnalytic_dT(d, T, phase, region));
-    end s_dT;
-
-    function cv_props_dT
-      "specific heat capacity at constant volume as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      output Modelica.SIunits.SpecificHeatCapacity cv "specific heat capacity";
-    algorithm
-      cv := aux.cv;
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end cv_props_dT;
-
-    function cv_dT
-      "specific heat capacity at constant volume as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer phase =  0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.SpecificHeatCapacity cv "specific heat capacity";
-    algorithm
-      cv := cv_props_dT(d, T, waterBasePropAnalytic_dT(d, T, phase, region));
-    end cv_dT;
-
-    function cp_props_dT
-      "specific heat capacity at constant pressure as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      output Modelica.SIunits.SpecificHeatCapacity cp "specific heat capacity";
-    algorithm
-      cp := aux.cp;
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end cp_props_dT;
-
-    function cp_dT
-      "specific heat capacity at constant pressure as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer phase =  0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.SpecificHeatCapacity cp "specific heat capacity";
-    algorithm
-      cp := cp_props_dT(d, T, waterBasePropAnalytic_dT(d, T, phase, region));
-    end cp_dT;
-
-    function beta_props_dT
-      "isobaric expansion coefficient as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      output Modelica.SIunits.RelativePressureCoefficient beta
-        "isobaric expansion coefficient";
-    algorithm
-      beta := if aux.region == 3 or aux.region == 4 then
-        aux.pt/(aux.rho*aux.pd) else
-        aux.vt*aux.rho;
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end beta_props_dT;
-
-    function beta_dT
-      "isobaric expansion coefficient as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer phase =  0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.RelativePressureCoefficient beta
-        "isobaric expansion coefficient";
-    algorithm
-      beta := beta_props_dT(d, T, waterBasePropAnalytic_dT(d, T, phase, region));
-    end beta_dT;
-
-    function kappa_props_dT
-      "isothermal compressibility factor as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      output Modelica.SIunits.IsothermalCompressibility kappa
-        "isothermal compressibility factor";
-    algorithm
-      kappa := if aux.region == 3 or aux.region == 4 then
-        1/(aux.rho*aux.pd) else -aux.vp*aux.rho;
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end kappa_props_dT;
-
-    function kappa_dT
-      "isothermal compressibility factor as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer phase =  0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.IsothermalCompressibility kappa
-        "isothermal compressibility factor";
-    algorithm
-      kappa := kappa_props_dT(d, T, waterBasePropAnalytic_dT(d, T, phase, region));
-    end kappa_dT;
-
-    function velocityOfSound_props_dT
-      "speed of sound as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      output Modelica.SIunits.Velocity v_sound "speed of sound";
-    algorithm
-      // dp/drho at constant s
-      v_sound := if aux.region == 3 then sqrt((aux.pd*aux.rho*aux.rho*aux.cv + aux.pt*aux.pt*aux.T)/(aux.rho*aux.rho*aux.cv)) else
-        if aux.region == 4 then
-        sqrt(1/((aux.rho*(aux.rho*aux.cv/aux.dpT + 1.0)/(aux.dpT*aux.T)) - 1/aux.rho*aux.rho*aux.rho/(aux.dpT*aux.T))) else
-             sqrt(-aux.cp/(aux.rho*aux.rho*(aux.vp*aux.cp+aux.vt*aux.vt*aux.T)));
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end velocityOfSound_props_dT;
-
-    function velocityOfSound_dT
-      "speed of sound as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer phase =  0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.Velocity v_sound "speed of sound";
-    algorithm
-      v_sound := velocityOfSound_props_dT(d, T, waterBasePropAnalytic_dT(d, T, phase, region));
-    end velocityOfSound_dT;
-
-    function isentropicExponent_props_dT
-      "isentropic exponent as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux
-        "auxiliary record";
-      output Real gamma "isentropic exponent";
-    algorithm
-      gamma := if aux.region == 3 then 1/(aux.rho*aux.p)*((aux.pd*aux.cv*aux.rho*aux.rho + aux.pt*aux.pt*aux.T)/(aux.cv)) else
-             if aux.region == 4 then 1/(aux.rho*aux.p)*aux.dpT*aux.dpT*aux.T/aux.cv else
-        -1/(aux.rho*aux.p)*aux.cp/(aux.vp*aux.cp + aux.vt*aux.vt*aux.T);
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end isentropicExponent_props_dT;
-
-    function isentropicExponent_dT
-      "isentropic exponent as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer phase =  0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Real gamma "isentropic exponent";
-    algorithm
-      gamma := isentropicExponent_props_dT(d, T, waterBasePropAnalytic_dT(d, T, phase, region));
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end isentropicExponent_dT;
-
-  public
-    function hl_p =
-        ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hl_p
-      "compute the saturated liquid specific h(p)";
-    function hv_p =
-        ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hv_p
-      "compute the saturated vapour specific h(p)";
-
-    function sl_p =
-        ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.sl_p
-      "compute the saturated liquid specific s(p)";
-    function sv_p =
-        ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.sv_p
-      "compute the saturated vapour specific s(p)";
-
-    function rhol_T =
-        ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.rhol_T
-      "compute the saturated liquid d(T)";
-    function rhov_T =
-        ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.rhov_T
-      "compute the saturated vapour d(T)";
-
-    function rhol_p =
-        ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.rhol_p
-      "compute the saturated liquid d(p)";
-    function rhov_p =
-        ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.rhov_p
-      "compute the saturated vapour d(p)";
-
-    function dynamicViscosity =
-        ThermoSysPro.Properties.WaterSteam.BaseIF97.Transport.visc_dT
-      "compute eta(d,T) in the one-phase region";
-    function thermalConductivity =
-        ThermoSysPro.Properties.WaterSteam.BaseIF97.Transport.cond_industrial_dT
-      "compute lambda(d,T) in the one-phase region";
-    function surfaceTension =
-        ThermoSysPro.Properties.WaterSteam.BaseIF97.Transport.surfaceTension
-      "compute sigma(T) at saturation T";
-
-  //   function isentropicEnthalpy
-  //     "isentropic specific enthalpy from p,s (preferably use dynamicIsentropicEnthalpy in dynamic simulation!)"
-  //     extends Modelica.Icons.Function;
-  //     input SI.Pressure p "pressure";
-  //     input SI.SpecificEntropy s "specific entropy";
-  //     input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
-  //     output SI.SpecificEnthalpy h "specific enthalpy";
-  //   algorithm
-  //    h := BaseIF97.Isentropic.water_hisentropic(p,s,phase);
-  //   end isentropicEnthalpy;
-
-    function isentropicEnthalpy
-      "isentropic specific enthalpy from p,s (preferably use dynamicIsentropicEnthalpy in dynamic simulation!)"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      input Integer phase = 0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region = 0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    algorithm
-      h := isentropicEnthalpy_props(p, s, waterBaseProp_ps(p, s, phase, region));
-    end isentropicEnthalpy;
-
-    function isentropicEnthalpy_props
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      output Modelica.SIunits.SpecificEnthalpy h "isentropic enthalpay";
-    algorithm
-      h := aux.h;
-
-      annotation (derivative(noDerivative=aux) = isentropicEnthalpy_der,
-    Inline=false,
-    LateInline=true);
-    end isentropicEnthalpy_props;
-
-    function isentropicEnthalpy_der
-      "derivative of isentropic specific enthalpy from p,s"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      input Real p_der "pressure derivative";
-      input Real s_der "entropy derivative";
-      output Real h_der "specific enthalpy derivative";
-    algorithm
-      h_der := 1/aux.rho*p_der + aux.T*s_der;
-    end isentropicEnthalpy_der;
-
-    function dynamicIsentropicEnthalpy
-      "isentropic specific enthalpy from p,s and good guesses of d and T"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      input Modelica.SIunits.Density dguess
-        "good guess density, e.g. from adjacent volume";
-      input Modelica.SIunits.Temperature Tguess
-        "good guess temperature, e.g. from adjacent volume";
-      input Integer phase = 0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    algorithm
-     h := ThermoSysPro.Properties.WaterSteam.BaseIF97.Isentropic.water_hisentropic_dyn(
-                                                    p,s,dguess,Tguess,0);
-    end dynamicIsentropicEnthalpy;
-
-    annotation (Icon(graphics={
-          Text(
-            extent={{-102,0},{24,-26}},
-            lineColor={242,148,0},
-            textString=
-                 "Thermo"),
-          Text(
-            extent={{-4,8},{68,-34}},
-            lineColor={46,170,220},
-            textString=
-                 "SysPro"),
-          Polygon(
-            points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},{
-                42,8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},{
-                -50,6},{-62,2}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{-46,
-                8},{-42,22},{-42,30},{-44,38}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{-12,
-                12},{-26,12},{-28,12},{-26,20}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,30},{-6,26}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,36},{-6,32}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,42},{-6,38}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,48},{-6,44}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,32},{-2,28}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,38},{-2,34}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,44},{-2,40}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,50},{-2,46}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{-2,
-                20}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},{
-                42,6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},{
-                -50,6},{-62,2}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Line(
-            points={{22,12},{22,14},{22,16},{24,14},{20,18}},
-            color={46,170,220},
-            thickness=0.5),
-          Line(
-            points={{26,12},{26,14},{26,16},{28,14},{24,18}},
-            color={46,170,220},
-            thickness=0.5),
-          Line(
-            points={{30,10},{30,12},{30,14},{32,12},{28,16}},
-            color={46,170,220},
-            thickness=0.5),
-          Polygon(
-            points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}),
-          Line(
-            points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}},
-            color={0,0,255},
-            smooth=Smooth.None),
-          Line(
-            points={{80,80},{100,100}},
-            color={0,0,255},
-            smooth=Smooth.None)}));
-  end AnalyticDerivatives;
-
-  package Standard "Standard version without Anaytic Jacobians"
-
-    import ThermoSysPro.Properties.WaterSteam.BaseIF97.*;
-
-    replaceable record iter =
-        ThermoSysPro.Properties.WaterSteam.BaseIF97.IterationData;
-
-    function waterBaseProp_ph "intermediate property record for water"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input Integer phase =  0
-        "phase: 2 for two-phase, 1 for one phase, 0 if unknown";
-      input Integer region = 0
-        "if 0, do region computation, otherwise assume the region is this input";
-      output ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-    protected
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs g
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs f
-        "dimensionless Helmholtz funcion and dervatives wrt delta and tau";
-      Integer error "error flag for inverse iterations";
-      Modelica.SIunits.SpecificEnthalpy h_liq "liquid specific enthalpy";
-      Modelica.SIunits.Density d_liq "liquid density";
-      Modelica.SIunits.SpecificEnthalpy h_vap "vapour specific enthalpy";
-      Modelica.SIunits.Density d_vap "vapour density";
-      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties liq
-        "phase boundary property record";
-      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties vap
-        "phase boundary property record";
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs gl
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs gv
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      Modelica.Media.Common.HelmholtzDerivs fl
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-      Modelica.Media.Common.HelmholtzDerivs fv
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-      Modelica.SIunits.Temperature t1
-        "temperature at phase boundary, using inverse from region 1";
-      Modelica.SIunits.Temperature t2
-        "temperature at phase boundary, using inverse from region 2";
-    algorithm
-      aux.region := if region == 0 then
-        (if phase == 2 then 4 else ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_ph(
-                                                              p=p,h= h,phase= phase)) else region;
-      aux.phase := if phase <> 0 then phase else if aux.region == 4 then 2 else 1;
-      aux.p := max(p,611.657);
-      aux.h := max(h,1e3);
-      aux.R :=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
-      if (aux.region == 1) then
-        aux.T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tph1(
-                                     aux.p, aux.h);
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(
-                               p, aux.T);
-        aux.s := aux.R*(g.tau*g.gtau - g.g);
-        aux.rho := p/(aux.R*aux.T*g.pi*g.gpi);
-        aux.vt := aux.R/p*(g.pi*g.gpi - g.tau*g.pi*g.gtaupi);
-        aux.vp := aux.R*aux.T/(p*p)*g.pi*g.pi*g.gpipi;
-        aux.cp := -aux.R*g.tau*g.tau*g.gtautau;
-        aux.cv := aux.R*(-g.tau*g.tau*g.gtautau + ((g.gpi - g.tau*g.gtaupi)*(g.gpi - g.tau*g.gtaupi)/g.gpipi));
-        aux.x := 0.0;
-        aux.dpT := -aux.vt/aux.vp;
-      elseif (aux.region == 2) then
-        aux.T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tph2(
-                                     aux.p, aux.h);
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(
-                               p, aux.T);
-        aux.s := aux.R*(g.tau*g.gtau - g.g);
-        aux.rho := p/(aux.R*aux.T*g.pi*g.gpi);
-        aux.vt := aux.R/p*(g.pi*g.gpi - g.tau*g.pi*g.gtaupi);
-        aux.vp := aux.R*aux.T/(p*p)*g.pi*g.pi*g.gpipi;
-        aux.cp := -aux.R*g.tau*g.tau*g.gtautau;
-        aux.cv := aux.R*(-g.tau*g.tau*g.gtautau + ((g.gpi - g.tau*g.gtaupi)*(g.gpi - g.tau*g.gtaupi)/g.gpipi));
-        aux.x := 1.0;
-        aux.dpT := -aux.vt/aux.vp;
-      elseif (aux.region == 3) then
-        (aux.rho,aux.T,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.dtofph3(
-                                                           p=aux.p,h=aux.h,delp= 1.0e-7,delh=
-                1.0e-6);
-        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(
-                               aux.rho, aux.T);
-        aux.h := aux.R*aux.T*(f.tau*f.ftau + f.delta*f.fdelta);
-        aux.s := aux.R*(f.tau*f.ftau - f.f);
-        aux.pd := aux.R*aux.T*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta);
-        aux.pt := aux.R*aux.rho*f.delta*(f.fdelta - f.tau*f.fdeltatau);
-        aux.cv := abs(aux.R*(-f.tau*f.tau*f.ftautau))
-          "can be close to neg. infinity near critical point";
-        aux.cp := (aux.rho*aux.rho*aux.pd*aux.cv + aux.T*aux.pt*aux.pt)/(aux.rho*aux.rho*aux.pd);
-        aux.x := 0.0;
-        aux.dpT := aux.pt; /*safety against div-by-0 in initialization*/
-      elseif (aux.region == 4) then
-        h_liq := hl_p(p);
-        h_vap := hv_p(p);
-        aux.x := if (h_vap <> h_liq) then (h - h_liq)/(h_vap - h_liq) else 1.0;
-        if p <ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PLIMIT4A then
-          t1:= ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tph1(
-                                   aux.p, h_liq);
-          t2:= ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tph2(
-                                   aux.p, h_vap);
-          gl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(
-                                  aux.p, t1);
-          gv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(
-                                  aux.p, t2);
-          liq := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps(gl);
-          vap := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps(gv);
-          aux.T := t1 + aux.x*(t2-t1);
-        else
-          aux.T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tsat(
-                                       aux.p); // how to avoid ?
-          d_liq:= rhol_T(aux.T);
-          d_vap:= rhov_T(aux.T);
-          fl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(
-                                  d_liq, aux.T);
-          fv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(
-                                  d_vap, aux.T);
-          liq :=
-            ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps(fl);
-          vap :=
-            ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps(fv);
-        end if;
-        aux.dpT := if (liq.d <> vap.d) then (vap.s - liq.s)*liq.d*vap.d/(liq.d - vap.d) else ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.dptofT(
-                                                                                              aux.T);
-        aux.s := liq.s + aux.x*(vap.s - liq.s);
-        aux.rho := liq.d*vap.d/(vap.d + aux.x*(liq.d - vap.d));
-        aux.cv := ThermoSysPro.Properties.WaterSteam.Common.cv2Phase(
-              liq,
-              vap,
-              aux.x,
-              aux.T,
-              p);
-        aux.cp := liq.cp + aux.x*(vap.cp - liq.cp);
-        aux.pt := liq.pt + aux.x*(vap.pt - liq.pt);
-        aux.pd := liq.pd + aux.x*(vap.pd - liq.pd);
-      elseif (aux.region == 5) then
-        (aux.T,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.tofph5(
-                                                  p=aux.p,h= aux.h,reldh= 1.0e-7);
-        assert(error == 0, "error in inverse iteration of steam tables");
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g5(
-                               aux.p, aux.T);
-        aux.s := aux.R*(g.tau*g.gtau - g.g);
-        aux.rho := p/(aux.R*aux.T*g.pi*g.gpi);
-        aux.vt := aux.R/p*(g.pi*g.gpi - g.tau*g.pi*g.gtaupi);
-        aux.vp := aux.R*aux.T/(p*p)*g.pi*g.pi*g.gpipi;
-        aux.cp := -aux.R*g.tau*g.tau*g.gtautau;
-        aux.cv := aux.R*(-g.tau*g.tau*g.gtautau + ((g.gpi - g.tau*g.gtaupi)*(g.gpi - g.tau*g.gtaupi)/g.gpipi));
-        aux.dpT := -aux.vt/aux.vp;
-      else
-        assert(false, "error in region computation of IF97 steam tables"
-        + "(p = " + String(p) + ", h = " + String(h) + ")");
-      end if;
-    end waterBaseProp_ph;
-
-    function waterBaseProp_ps "intermediate property record for water"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      input Integer phase = 0
-        "phase: 2 for two-phase, 1 for one phase, 0 if unknown";
-      input Integer region = 0
-        "if 0, do region computation, otherwise assume the region is this input";
-      output ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-    protected
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs g
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs f
-        "dimensionless Helmholtz funcion and dervatives wrt delta and tau";
-      Integer error "error flag for inverse iterations";
-      Modelica.SIunits.SpecificEntropy s_liq "liquid specific entropy";
-      Modelica.SIunits.Density d_liq "liquid density";
-      Modelica.SIunits.SpecificEntropy s_vap "vapour specific entropy";
-      Modelica.SIunits.Density d_vap "vapour density";
-      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties liq
-        "phase boundary property record";
-      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties vap
-        "phase boundary property record";
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs gl
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs gv
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      Modelica.Media.Common.HelmholtzDerivs fl
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-      Modelica.Media.Common.HelmholtzDerivs fv
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-      Modelica.SIunits.Temperature t1
-        "temperature at phase boundary, using inverse from region 1";
-      Modelica.SIunits.Temperature t2
-        "temperature at phase boundary, using inverse from region 2";
-    algorithm
-      aux.region := if region == 0 then
-        (if phase == 2 then 4 else ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_ps(
-                                                              p=p,s=s,phase=phase)) else region;
-      aux.phase := if phase <> 0 then phase else if aux.region == 4 then 2 else 1;
-      aux.p := p;
-      aux.s := s;
-      aux.R :=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
-      if (aux.region == 1) then
-        aux.T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tps1(
-                                     p, s);
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(
-                               p, aux.T);
-        aux.h := aux.R*aux.T*g.tau*g.gtau;
-        aux.rho := p/(aux.R*aux.T*g.pi*g.gpi);
-        aux.vt := aux.R/p*(g.pi*g.gpi - g.tau*g.pi*g.gtaupi);
-        aux.vp := aux.R*aux.T/(p*p)*g.pi*g.pi*g.gpipi;
-        aux.cp := -aux.R*g.tau*g.tau*g.gtautau;
-        aux.cv := aux.R*(-g.tau*g.tau*g.gtautau + ((g.gpi - g.tau*g.gtaupi)*(g.gpi - g.tau*g.gtaupi)/g.gpipi));
-        aux.x := 0.0;
-      elseif (aux.region == 2) then
-        aux.T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tps2(
-                                     p, s);
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(
-                               p, aux.T);
-        aux.h := aux.R*aux.T*g.tau*g.gtau;
-        aux.rho := p/(aux.R*aux.T*g.pi*g.gpi);
-        aux.vt := aux.R/p*(g.pi*g.gpi - g.tau*g.pi*g.gtaupi);
-        aux.vp := aux.R*aux.T/(p*p)*g.pi*g.pi*g.gpipi;
-        aux.cp := -aux.R*g.tau*g.tau*g.gtautau;
-        aux.cv := aux.R*(-g.tau*g.tau*g.gtautau + ((g.gpi - g.tau*g.gtaupi)*(g.gpi - g.tau*g.gtaupi)/g.gpipi));
-        aux.x := 1.0;
-      elseif (aux.region == 3) then
-        (aux.rho,aux.T,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.dtofps3(
-                                                           p=p,s=s,delp=1.0e-7,dels=
-          1.0e-6);
-        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(
-                               aux.rho, aux.T);
-        aux.h := aux.R*aux.T*(f.tau*f.ftau + f.delta*f.fdelta);
-        aux.s := aux.R*(f.tau*f.ftau - f.f);
-        aux.pd := aux.R*aux.T*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta);
-        aux.pt := aux.R*aux.rho*f.delta*(f.fdelta - f.tau*f.fdeltatau);
-        aux.cv := aux.R*(-f.tau*f.tau*f.ftautau);
-        aux.cp := (aux.rho*aux.rho*aux.pd*aux.cv + aux.T*aux.pt*aux.pt)/(aux.rho*aux.rho*aux.pd);
-        aux.x := 0.0;
-      elseif (aux.region == 4) then
-        s_liq := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.sl_p(
-                                       p);
-        s_vap := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.sv_p(
-                                       p);
-        aux.x := if (s_vap <> s_liq) then (s - s_liq)/(s_vap - s_liq) else 1.0;
-        if p <ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PLIMIT4A then
-          t1 := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tps1(
-                                    p, s_liq);
-          t2 := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tps2(
-                                    p, s_vap);
-          gl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(
-                                  p, t1);
-          gv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(
-                                  p, t2);
-          liq := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps(gl);
-          vap := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps(gv);
-          aux.T := t1 + aux.x*(t2 - t1);
-        else
-          aux.T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tsat(
-                                       p);
-          d_liq := rhol_T(aux.T);
-          d_vap := rhov_T(aux.T);
-          fl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(
-                                  d_liq, aux.T);
-          fv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(
-                                  d_vap, aux.T);
-          liq :=
-            ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps(fl);
-          vap :=
-            ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps(fv);
-        end if;
-        aux.dpT := if (liq.d <> vap.d) then (vap.s - liq.s)*liq.d*vap.d/(liq.d - vap.d) else
-             ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.dptofT(
-                                   aux.T);
-        aux.h := liq.h + aux.x*(vap.h - liq.h);
-        aux.rho := liq.d*vap.d/(vap.d + aux.x*(liq.d - vap.d));
-        aux.cv := ThermoSysPro.Properties.WaterSteam.Common.cv2Phase(
-              liq,
-              vap,
-              aux.x,
-              aux.T,
-              p);
-        aux.cp := liq.cp + aux.x*(vap.cp - liq.cp);
-        aux.pt := liq.pt + aux.x*(vap.pt - liq.pt);
-        aux.pd := liq.pd + aux.x*(vap.pd - liq.pd);
-      elseif (aux.region == 5) then
-        (aux.T,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.tofps5(
-                                                  p=p,s=s,relds= 1.0e-7);
-        assert(error == 0, "error in inverse iteration of steam tables");
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g5(
-                               p, aux.T);
-        aux.h := aux.R*aux.T*g.tau*g.gtau;
-        aux.rho := p/(aux.R*aux.T*g.pi*g.gpi);
-        aux.vt := aux.R/p*(g.pi*g.gpi - g.tau*g.pi*g.gtaupi);
-        aux.vp := aux.R*aux.T/(p*p)*g.pi*g.pi*g.gpipi;
-        aux.cp := -aux.R*g.tau*g.tau*g.gtautau;
-        aux.cv := aux.R*(-g.tau*g.tau*g.gtautau + ((g.gpi - g.tau*g.gtaupi)*(g.gpi - g.tau*g.gtaupi)/g.gpipi));
-      else
-        assert(false, "error in region computation of IF97 steam tables"
-        + "(p = " + String(p) + ", s = " + String(s) + ")");
-      end if;
-    end waterBaseProp_ps;
-
-    function rho_props_ps
-      "density as function of pressure and specific entropy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase
-        properties "auxiliary record";
-      output Modelica.SIunits.Density rho "density";
-    algorithm
-      rho := properties.rho;
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end rho_props_ps;
-
-    function rho_ps "density as function of pressure and specific entropy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      input Integer phase = 0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region = 0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.Density rho "density";
-    algorithm
-      rho := rho_props_ps(p, s, waterBaseProp_ps(p, s, phase, region));
-    end rho_ps;
-
-    function T_props_ps
-      "temperature as function of pressure and specific entropy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase
-        properties "auxiliary record";
-      output Modelica.SIunits.Temperature T "temperature";
-    algorithm
-      T := properties.T;
-
-      annotation (Inline=false,
-                  LateInline=true);
-    end T_props_ps;
-
-    function T_ps "temperature as function of pressure and specific entropy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      input Integer phase = 0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region = 0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.Temperature T "Temperature";
-    algorithm
-      T := T_props_ps(p, s, waterBaseProp_ps(p, s, phase, region));
-    end T_ps;
-
-    function h_props_ps
-      "specific enthalpy as function or pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    algorithm
-      h := aux.h;
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end h_props_ps;
-
-    function h_ps "specific enthalpy as function or pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      input Integer phase = 0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    algorithm
-      h := h_props_ps(p, s, waterBaseProp_ps(p, s, phase, region));
-    end h_ps;
-
-    function phase_ps "phase as a function of  pressure and specific entropy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      output Integer phase "true if in liquid or gas or supercritical region";
-    algorithm
-      phase := if ((s < sl_p(p) or s > sv_p(p)) or p >ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT)
-                                                                                               then
-                                                                                 1 else 2;
-      annotation (InlineNoEvent=false);
-    end phase_ps;
-
-    function phase_ph "phase as a function of  pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      output Integer phase "true if in liquid or gas or supercritical region";
-    algorithm
-      phase := if ((h < hl_p(p) or h > hv_p(p)) or p >ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT)
-                                                                                               then
-                                                                                 1 else 2;
-      annotation (InlineNoEvent=false);
-    end phase_ph;
-
-    function phase_dT "phase as a function of  pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density rho "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      output Integer phase "true if in liquid or gas or supercritical region";
-    algorithm
-      phase := if not ((rho < rhol_T(T) and rho > rhov_T(T)) and T <
-        ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TCRIT) then
-                         1 else 2;
-      annotation (InlineNoEvent=false);
-    end phase_dT;
-
-    function rho_props_ph
-      "density as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase
-        properties "auxiliary record";
-      output Modelica.SIunits.Density rho "density";
-    algorithm
-      rho := properties.rho;
-
-      annotation (
-        derivative(noDerivative=properties) = rho_ph_der,
-        Inline=false,
-        LateInline=true);
-    end rho_props_ph;
-
-    function rho_ph "density as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input Integer phase = 0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region = 0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.Density rho "density";
-    algorithm
-      rho := rho_props_ph(p, h, waterBaseProp_ph(p, h, phase, region));
-    end rho_ph;
-
-    function rho_ph_der "derivative function of rho_ph"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      input Real p_der "derivative of pressure";
-      input Real h_der "derivative of specific enthalpy";
-      output Real rho_der "derivative of density";
-    algorithm
-      if (aux.region == 4) then
-        rho_der := (aux.rho*(aux.rho*aux.cv/aux.dpT + 1.0)/(aux.dpT*aux.T))*p_der
-           + (-aux.rho*aux.rho/(aux.dpT*aux.T))*h_der;
-      elseif (aux.region == 3) then
-        rho_der := ((aux.rho*(aux.cv*aux.rho + aux.pt))/(aux.rho*aux.rho*aux.pd*
-          aux.cv + aux.T*aux.pt*aux.pt))*p_der + (-aux.rho*aux.rho*aux.pt/(aux.
-          rho*aux.rho*aux.pd*aux.cv + aux.T*aux.pt*aux.pt))*h_der;
-      else
-        //regions 1,2,5
-        rho_der := (-aux.rho*aux.rho*(aux.vp*aux.cp - aux.vt/aux.rho + aux.T*aux.
-          vt*aux.vt)/aux.cp)*p_der + (-aux.rho*aux.rho*aux.vt/(aux.cp))*h_der;
-      end if;
-    end rho_ph_der;
-
-    function T_props_ph
-      "temperature as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase
-        properties "auxiliary record";
-      output Modelica.SIunits.Temperature T "temperature";
-    algorithm
-      T := properties.T;
-
-      annotation (derivative(noDerivative=properties) = T_ph_der,
-        Inline=false,
-        LateInline=true);
-    end T_props_ph;
-
-    function T_ph "temperature as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input Integer phase = 0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region = 0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.Temperature T "Temperature";
-    algorithm
-      T := T_props_ph(p, h, waterBaseProp_ph(p, h, phase, region));
-    end T_ph;
-
-    function T_ph_der "derivative function of T_ph"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      input Real p_der "derivative of pressure";
-      input Real h_der "derivative of specific enthalpy";
-      output Real T_der "derivative of temperature";
-    algorithm
-      if (aux.region == 4) then
-        T_der := 1/aux.dpT*p_der;
-      elseif (aux.region == 3) then
-        T_der := ((-aux.rho*aux.pd + aux.T*aux.pt)/(aux.rho*aux.rho*aux.pd*aux.cv
-           + aux.T*aux.pt*aux.pt))*p_der + ((aux.rho*aux.rho*aux.pd)/(aux.rho*aux.
-           rho*aux.pd*aux.cv + aux.T*aux.pt*aux.pt))*h_der;
-      else
-        //regions 1,2 or 5
-        T_der := ((-1/aux.rho + aux.T*aux.vt)/aux.cp)*p_der + (1/aux.cp)*h_der;
-      end if;
-    end T_ph_der;
-
-    function s_props_ph
-      "specific entropy as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase
-        properties "auxiliary record";
-      output Modelica.SIunits.SpecificEntropy s "specific entropy";
-    algorithm
-      s := properties.s;
-
-      annotation (derivative(noDerivative=properties) = s_ph_der,
-    Inline=false,
-    LateInline=true);
-    end s_props_ph;
-
-    function s_ph
-      "specific entropy as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input Integer phase =   0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.SpecificEntropy s "specific entropy";
-    algorithm
-      s := s_props_ph(p, h, waterBaseProp_ph(p, h, phase, region));
-    end s_ph;
-
-    function s_ph_der
-      "specific entropy as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      input Real p_der "derivative of pressure";
-      input Real h_der "derivative of specific enthalpy";
-      output Real s_der "derivative of entropy";
-    algorithm
-      s_der := -1/(aux.rho*aux.T)*p_der + 1/aux.T*h_der;
-    end s_ph_der;
-
-    function cv_props_ph
-      "specific heat capacity at constant volume as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      output Modelica.SIunits.SpecificHeatCapacity cv "specific heat capacity";
-    algorithm
-      cv := aux.cv;
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end cv_props_ph;
-
-    function cv_ph
-      "specific heat capacity at constant volume as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input Integer phase = 0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region = 0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.SpecificHeatCapacity cv "specific heat capacity";
-    algorithm
-      cv := cv_props_ph(p, h, waterBaseProp_ph(p, h, phase, region));
-    end cv_ph;
-
-    function regionAssertReal "assert function for inlining"
-      extends Modelica.Icons.Function;
-      input Boolean check "condition to check";
-      output Real dummy "dummy output";
-    algorithm
-      assert(check, "this function can not be called with two-phase inputs!");
-    end regionAssertReal;
-
-    function cp_props_ph
-      "specific heat capacity at constant pressure as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      output Modelica.SIunits.SpecificHeatCapacity cp "specific heat capacity";
-    algorithm
-      cp := aux.cp;
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end cp_props_ph;
-
-    function cp_ph
-      "specific heat capacity at constant pressure as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input Integer phase = 0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region = 0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.SpecificHeatCapacity cp "specific heat capacity";
-    algorithm
-      cp := cp_props_ph(p, h, waterBaseProp_ph(p, h, phase, region));
-    end cp_ph;
-
-    function beta_props_ph
-      "isobaric expansion coefficient as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      output Modelica.SIunits.RelativePressureCoefficient beta
-        "isobaric expansion coefficient";
-    algorithm
-      beta := if aux.region == 3 or aux.region == 4 then
-        aux.pt/(aux.rho*aux.pd) else
-        aux.vt*aux.rho;
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end beta_props_ph;
-
-    function beta_ph
-      "isobaric expansion coefficient as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input Integer phase = 0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region = 0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.RelativePressureCoefficient beta
-        "isobaric expansion coefficient";
-    algorithm
-      beta := beta_props_ph(p, h, waterBaseProp_ph(p, h, phase, region));
-    end beta_ph;
-
-    function kappa_props_ph
-      "isothermal compressibility factor as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      output Modelica.SIunits.IsothermalCompressibility kappa
-        "isothermal compressibility factor";
-    algorithm
-      kappa := if aux.region == 3 or aux.region == 4 then
-        1/(aux.rho*aux.pd) else -aux.vp*aux.rho;
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end kappa_props_ph;
-
-    function kappa_ph
-      "isothermal compressibility factor as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input Integer phase = 0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region = 0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.IsothermalCompressibility kappa
-        "isothermal compressibility factor";
-    algorithm
-      kappa := kappa_props_ph(p, h, waterBaseProp_ph(p, h, phase, region));
-    end kappa_ph;
-
-    function velocityOfSound_props_ph
-      "speed of sound as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      output Modelica.SIunits.Velocity v_sound "speed of sound";
-    algorithm
-      // dp/drho at constant s
-      v_sound := if aux.region == 3 then sqrt((aux.pd*aux.rho*aux.rho*aux.cv + aux.pt*aux.pt*aux.T)/(aux.rho*aux.rho*aux.cv)) else
-        if aux.region == 4 then
-        sqrt(1/((aux.rho*(aux.rho*aux.cv/aux.dpT + 1.0)/(aux.dpT*aux.T)) - 1/aux.rho*aux.rho*aux.rho/(aux.dpT*aux.T))) else
-             sqrt(-aux.cp/(aux.rho*aux.rho*(aux.vp*aux.cp+aux.vt*aux.vt*aux.T)));
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end velocityOfSound_props_ph;
-
-    function velocityOfSound_ph
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input Integer phase = 0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region = 0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.Velocity v_sound "speed of sound";
-    algorithm
-      v_sound := velocityOfSound_props_ph(p, h, waterBaseProp_ph(p, h, phase, region));
-    end velocityOfSound_ph;
-
-    function isentropicExponent_props_ph
-      "isentropic exponent as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      output Real gamma "isentropic exponent";
-    algorithm
-      gamma := if aux.region == 3 then 1/(aux.rho*p)*((aux.pd*aux.cv*aux.rho*aux.rho + aux.pt*aux.pt*aux.T)/(aux.cv)) else
-             if aux.region == 4 then 1/(aux.rho*p)*aux.dpT*aux.dpT*aux.T/aux.cv else
-        -1/(aux.rho*aux.p)*aux.cp/(aux.vp*aux.cp + aux.vt*aux.vt*aux.T);
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end isentropicExponent_props_ph;
-
-    function isentropicExponent_ph
-      "isentropic exponent as function of pressure and specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input Integer phase =   0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Real gamma "isentropic exponent";
-    algorithm
-      gamma := isentropicExponent_props_ph(p, h, waterBaseProp_ph(p, h, phase, region));
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end isentropicExponent_ph;
-
-    function ddph_props "density derivative by pressure"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      output Modelica.SIunits.DerDensityByPressure ddph
-        "density derivative by pressure";
-    algorithm
-      ddph := if aux.region == 3 then
-        ((aux.rho*(aux.cv*aux.rho + aux.pt))/(aux.rho*aux.rho*aux.pd*aux.cv + aux.T*aux.pt*aux.pt)) else
-        if aux.region == 4 then  (aux.rho*(aux.rho*aux.cv/aux.dpT + 1.0)/(aux.dpT*aux.T)) else
-             (-aux.rho*aux.rho*(aux.vp*aux.cp - aux.vt/aux.rho + aux.T*aux.vt*aux.vt)/aux.cp);
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end ddph_props;
-
-    function ddph "density derivative by pressure"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input Integer phase = 0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region = 0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.DerDensityByPressure ddph
-        "density derivative by pressure";
-    algorithm
-      ddph := ddph_props(p, h, waterBaseProp_ph(p, h, phase, region));
-    end ddph;
-
-    function ddhp_props "density derivative by specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      output Modelica.SIunits.DerDensityByEnthalpy ddhp
-        "density derivative by specific enthalpy";
-    algorithm
-      ddhp := if aux.region == 3 then
-        -aux.rho*aux.rho*aux.pt/(aux.rho*aux.rho*aux.pd*aux.cv + aux.T*aux.pt*aux.pt) else
-        if aux.region == 4 then -aux.rho*aux.rho/(aux.dpT*aux.T) else
-             -aux.rho*aux.rho*aux.vt/(aux.cp);
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end ddhp_props;
-
-    function ddhp "density derivative by specific enthalpy"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      input Integer phase = 0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region = 0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.DerDensityByEnthalpy ddhp
-        "density derivative by specific enthalpy";
-    algorithm
-      ddhp := ddhp_props(p, h, waterBaseProp_ph(p, h, phase, region));
-    end ddhp;
-
-    function waterBaseProp_pT
-      "intermediate property record for water (p and T prefered states)"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer region = 0
-        "if 0, do region computation, otherwise assume the region is this input";
-      output ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-    protected
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs g
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs f
-        "dimensionless Helmholtz funcion and dervatives wrt delta and tau";
-      Integer error "error flag for inverse iterations";
-    algorithm
-      aux.phase := 1;
-      aux.region := if region == 0 then ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_pT(
-                                                                   p=p,T= T) else region;
-      aux.R :=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
-      aux.p := p;
-      aux.T := T;
-      if (aux.region == 1) then
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(
-                               p, T);
-        aux.h := aux.R*aux.T*g.tau*g.gtau;
-        aux.s := aux.R*(g.tau*g.gtau - g.g);
-        aux.rho := p/(aux.R*T*g.pi*g.gpi);
-        aux.vt := aux.R/p*(g.pi*g.gpi - g.tau*g.pi*g.gtaupi);
-        aux.vp := aux.R*T/(p*p)*g.pi*g.pi*g.gpipi;
-        aux.cp := -aux.R*g.tau*g.tau*g.gtautau;
-        aux.cv := aux.R*(-g.tau*g.tau*g.gtautau + ((g.gpi - g.tau*g.gtaupi)*(g.gpi - g.tau*g.gtaupi)/g.gpipi));
-        aux.x := 0.0;
-      elseif (aux.region == 2) then
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(
-                               p, T);
-        aux.h := aux.R*aux.T*g.tau*g.gtau;
-        aux.s := aux.R*(g.tau*g.gtau - g.g);
-        aux.rho := p/(aux.R*T*g.pi*g.gpi);
-        aux.vt := aux.R/p*(g.pi*g.gpi - g.tau*g.pi*g.gtaupi);
-        aux.vp := aux.R*T/(p*p)*g.pi*g.pi*g.gpipi;
-        aux.cp := -aux.R*g.tau*g.tau*g.gtautau;
-        aux.cv := aux.R*(-g.tau*g.tau*g.gtautau + ((g.gpi - g.tau*g.gtaupi)*(g.gpi - g.tau*g.gtaupi)/g.gpipi));
-        aux.x := 1.0;
-      elseif (aux.region == 3) then
-        (aux.rho,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.dofpt3(
-                                                    p=p,T= T,delp= 1.0e-7);
-        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(
-                               aux.rho, T);
-        aux.h := aux.R*T*(f.tau*f.ftau + f.delta*f.fdelta);
-        aux.s := aux.R*(f.tau*f.ftau - f.f);
-        aux.pd := aux.R*T*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta);
-        aux.pt := aux.R*aux.rho*f.delta*(f.fdelta - f.tau*f.fdeltatau);
-        aux.cv := aux.R*(-f.tau*f.tau*f.ftautau);
-        aux.x := 0.0;
-      elseif (aux.region == 5) then
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g5(
-                               p, T);
-        aux.h := aux.R*aux.T*g.tau*g.gtau;
-        aux.s := aux.R*(g.tau*g.gtau - g.g);
-        aux.rho := p/(aux.R*T*g.pi*g.gpi);
-        aux.vt := aux.R/p*(g.pi*g.gpi - g.tau*g.pi*g.gtaupi);
-        aux.vp := aux.R*T/(p*p)*g.pi*g.pi*g.gpipi;
-        aux.cp := -aux.R*g.tau*g.tau*g.gtautau;
-        aux.cv := aux.R*(-g.tau*g.tau*g.gtautau + ((g.gpi - g.tau*g.gtaupi)*(g.gpi - g.tau*g.gtaupi)/g.gpipi));
-      else
-        assert(false, "error in region computation of IF97 steam tables"
-         + "(p = " + String(p) + ", T = " + String(T) + ")");
-      end if;
-    end waterBaseProp_pT;
-
-    function rho_props_pT "density as function or pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      output Modelica.SIunits.Density rho "density";
-    algorithm
-      rho := aux.rho;
-
-      annotation (
-        derivative(noDerivative=aux) = rho_pT_der,
-        Inline=false,
-        LateInline=true);
-    end rho_props_pT;
-
-    function rho_pT "density as function or pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.Density rho "density";
-    algorithm
-      rho := rho_props_pT(p, T, waterBaseProp_pT(p, T, region));
-    end rho_pT;
-
-    function h_props_pT
-      "specific enthalpy as function or pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    algorithm
-      h := aux.h;
-
-      annotation (
-        derivative(noDerivative=aux) = h_pT_der,
-        Inline=false,
-        LateInline=true);
-    end h_props_pT;
-
-    function h_pT "specific enthalpy as function or pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "Temperature";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    algorithm
-      h := h_props_pT(p, T, waterBaseProp_pT(p, T, region));
-    end h_pT;
-
-    function h_pT_der "derivative function of h_pT"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      input Real p_der "derivative of pressure";
-      input Real T_der "derivative of temperature";
-      output Real h_der "derivative of specific enthalpy";
-    algorithm
-      if (aux.region == 3) then
-        h_der := ((-aux.rho*aux.pd + T*aux.pt)/(aux.rho*aux.rho*aux.pd))*p_der +
-          ((aux.rho*aux.rho*aux.pd*aux.cv + aux.T*aux.pt*aux.pt)/(aux.rho*aux.rho
-          *aux.pd))*T_der;
-      else
-        //regions 1,2 or 5
-        h_der := (1/aux.rho - aux.T*aux.vt)*p_der + aux.cp*T_der;
-      end if;
-    end h_pT_der;
-
-    function rho_pT_der "derivative function of rho_pT"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      input Real p_der "derivative of pressure";
-      input Real T_der "derivative of temperature";
-      output Real rho_der "derivative of density";
-    algorithm
-      if (aux.region == 3) then
-        rho_der := (1/aux.pd)*p_der - (aux.pt/aux.pd)*T_der;
-      else
-        //regions 1,2 or 5
-        rho_der := (-aux.rho*aux.rho*aux.vp)*p_der + (-aux.rho*aux.rho*aux.vt)*
-          T_der;
-      end if;
-    end rho_pT_der;
-
-    function s_props_pT
-      "specific entropy as function of pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      output Modelica.SIunits.SpecificEntropy s "specific entropy";
-    algorithm
-      s := aux.s;
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end s_props_pT;
-
-    function s_pT "temperature as function of pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.SpecificEntropy s "specific entropy";
-    algorithm
-      s := s_props_pT(p, T, waterBaseProp_pT(p, T, region));
-      annotation (InlineNoEvent=false);
-    end s_pT;
-
-    function cv_props_pT
-      "specific heat capacity at constant volume as function of pressure and temperature"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      output Modelica.SIunits.SpecificHeatCapacity cv "specific heat capacity";
-    algorithm
-      cv := aux.cv;
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end cv_props_pT;
-
-    function cv_pT
-      "specific heat capacity at constant volume as function of pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.SpecificHeatCapacity cv "specific heat capacity";
-    algorithm
-      cv := cv_props_pT(p, T, waterBaseProp_pT(p, T, region));
-      annotation (InlineNoEvent=false);
-    end cv_pT;
-
-    function cp_props_pT
-      "specific heat capacity at constant pressure as function of pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      output Modelica.SIunits.SpecificHeatCapacity cp "specific heat capacity";
-    algorithm
-      cp := if aux.region == 3 then
-        (aux.rho*aux.rho*aux.pd*aux.cv + aux.T*aux.pt*aux.pt)/(aux.rho*aux.rho*aux.pd) else
-        aux.cp;
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end cp_props_pT;
-
-    function cp_pT
-      "specific heat capacity at constant pressure as function of pressure and temperature"
-
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.SpecificHeatCapacity cp "specific heat capacity";
-    algorithm
-      cp := cp_props_pT(p, T, waterBaseProp_pT(p, T, region));
-      annotation (InlineNoEvent=false);
-    end cp_pT;
-
-    function beta_props_pT
-      "isobaric expansion coefficient as function of pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      output Modelica.SIunits.RelativePressureCoefficient beta
-        "isobaric expansion coefficient";
-    algorithm
-      beta := if aux.region == 3 then
-        aux.pt/(aux.rho*aux.pd) else
-        aux.vt*aux.rho;
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end beta_props_pT;
-
-    function beta_pT
-      "isobaric expansion coefficient as function of pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.RelativePressureCoefficient beta
-        "isobaric expansion coefficient";
-    algorithm
-      beta := beta_props_pT(p, T, waterBaseProp_pT(p, T, region));
-      annotation (InlineNoEvent=false);
-    end beta_pT;
-
-    function kappa_props_pT
-      "isothermal compressibility factor as function of pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      output Modelica.SIunits.IsothermalCompressibility kappa
-        "isothermal compressibility factor";
-    algorithm
-      kappa := if aux.region == 3 then
-        1/(aux.rho*aux.pd) else -aux.vp*aux.rho;
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end kappa_props_pT;
-
-    function kappa_pT
-      "isothermal compressibility factor as function of pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.IsothermalCompressibility kappa
-        "isothermal compressibility factor";
-    algorithm
-      kappa := kappa_props_pT(p, T, waterBaseProp_pT(p, T, region));
-      annotation (InlineNoEvent=false);
-    end kappa_pT;
-
-    function velocityOfSound_props_pT
-      "speed of sound as function of pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      output Modelica.SIunits.Velocity v_sound "speed of sound";
-    algorithm
-      // dp/drho at constant s
-      v_sound := if aux.region == 3 then sqrt((aux.pd*aux.rho*aux.rho*aux.cv + aux.pt*aux.pt*aux.T)/(aux.rho*aux.rho*aux.cv)) else
-        sqrt(-aux.cp/(aux.rho*aux.rho*(aux.vp*aux.cp+aux.vt*aux.vt*aux.T)));
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end velocityOfSound_props_pT;
-
-    function velocityOfSound_pT
-      "speed of sound as function of pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.Velocity v_sound "speed of sound";
-    algorithm
-      v_sound := velocityOfSound_props_pT(p, T, waterBaseProp_pT(p, T, region));
-    end velocityOfSound_pT;
-
-    function isentropicExponent_props_pT
-      "isentropic exponent as function of pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      output Real gamma "isentropic exponent";
-    algorithm
-      gamma := if aux.region == 3 then 1/(aux.rho*p)*((aux.pd*aux.cv*aux.rho*aux.rho + aux.pt*aux.pt*aux.T)/(aux.cv)) else
-        -1/(aux.rho*aux.p)*aux.cp/(aux.vp*aux.cp + aux.vt*aux.vt*aux.T);
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end isentropicExponent_props_pT;
-
-    function isentropicExponent_pT
-      "isentropic exponent as function of pressure and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Real gamma "isentropic exponent";
-    algorithm
-      gamma := isentropicExponent_props_pT(p, T, waterBaseProp_pT(p, T, region));
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end isentropicExponent_pT;
-
-    function waterBaseProp_dT
-      "intermediate property record for water (d and T prefered states)"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density rho "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer phase =  0
-        "phase: 2 for two-phase, 1 for one phase, 0 if unknown";
-      input Integer region = 0
-        "if 0, do region computation, otherwise assume the region is this input";
-      output ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-    protected
-      Modelica.SIunits.SpecificEnthalpy h_liq "liquid specific enthalpy";
-      Modelica.SIunits.Density d_liq "liquid density";
-      Modelica.SIunits.SpecificEnthalpy h_vap "vapour specific enthalpy";
-      Modelica.SIunits.Density d_vap "vapour density";
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs g
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs f
-        "dimensionless Helmholtz funcion and dervatives wrt delta and tau";
-      Modelica.Media.Common.PhaseBoundaryProperties liq
-        "phase boundary property record";
-      Modelica.Media.Common.PhaseBoundaryProperties vap
-        "phase boundary property record";
-      Modelica.Media.Common.GibbsDerivs gl
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      Modelica.Media.Common.GibbsDerivs gv
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      Modelica.Media.Common.HelmholtzDerivs fl
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-      Modelica.Media.Common.HelmholtzDerivs fv
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-      Integer error "error flag for inverse iterations";
-    algorithm
-      aux.region := if region == 0 then
-        (if phase == 2 then 4 else ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_dT(
-                                                              d=rho,T= T,phase= phase)) else region;
-      aux.phase := if aux.region == 4 then 2 else 1;
-      aux.R :=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
-      aux.rho := rho;
-      aux.T := T;
-      if (aux.region == 1) then
-        (aux.p,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.pofdt125(
-                                                    d=rho,T= T,reldd= 1.0e-8,region=
-                 1);
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(
-                               aux.p, T);
-        aux.h := aux.R*aux.T*g.tau*g.gtau;
-        aux.s := aux.R*(g.tau*g.gtau - g.g);
-        aux.rho := aux.p/(aux.R*T*g.pi*g.gpi);
-        aux.vt := aux.R/aux.p*(g.pi*g.gpi - g.tau*g.pi*g.gtaupi);
-        aux.vp := aux.R*T/(aux.p*aux.p)*g.pi*g.pi*g.gpipi;
-        aux.cp := -aux.R*g.tau*g.tau*g.gtautau;
-        aux.cv := aux.R*(-g.tau*g.tau*g.gtautau + ((g.gpi - g.tau*g.gtaupi)*(g.gpi - g.tau*g.gtaupi)/g.gpipi));
-        aux.x := 0.0;
-      elseif (aux.region == 2) then
-        (aux.p,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.pofdt125(
-                                                    d=rho,T= T,reldd= 1.0e-8,region=
-                 2);
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(
-                               aux.p, T);
-        aux.h := aux.R*aux.T*g.tau*g.gtau;
-        aux.s := aux.R*(g.tau*g.gtau - g.g);
-        aux.rho := aux.p/(aux.R*T*g.pi*g.gpi);
-        aux.vt := aux.R/aux.p*(g.pi*g.gpi - g.tau*g.pi*g.gtaupi);
-        aux.vp := aux.R*T/(aux.p*aux.p)*g.pi*g.pi*g.gpipi;
-        aux.cp := -aux.R*g.tau*g.tau*g.gtautau;
-        aux.cv := aux.R*(-g.tau*g.tau*g.gtautau + ((g.gpi - g.tau*g.gtaupi)*(g.gpi - g.tau*g.gtaupi)/g.gpipi));
-        aux.x := 1.0;
-      elseif (aux.region == 3) then
-        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(
-                               rho, T);
-        aux.p := aux.R*rho*T*f.delta*f.fdelta;
-        aux.h := aux.R*T*(f.tau*f.ftau + f.delta*f.fdelta);
-        aux.s := aux.R*(f.tau*f.ftau - f.f);
-        aux.pd := aux.R*T*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta);
-        aux.pt := aux.R*rho*f.delta*(f.fdelta - f.tau*f.fdeltatau);
-        aux.cp := (aux.rho*aux.rho*aux.pd*aux.cv + aux.T*aux.pt*aux.pt)/(aux.rho*aux.rho*aux.pd);
-        aux.cv := aux.R*(-f.tau*f.tau*f.ftautau);
-        aux.x := 0.0;
-      elseif (aux.region == 4) then
-        aux.p := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.psat(
-                                     T);
-        aux.dpT := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.dptofT(
-                                         T);
-        d_liq := rhol_T(T);
-        d_vap := rhov_T(T);
-        h_liq := hl_p(aux.p);
-        h_vap := hv_p(aux.p);
-        aux.x := if (d_vap <> d_liq) then (1/rho - 1/d_liq)/(1/d_vap - 1/d_liq) else
-        1.0;
-        aux.h := h_liq + aux.x*(h_vap - h_liq);
-        if T <ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TLIMIT1 then
-          gl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(
-                                  aux.p, T);
-          gv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(
-                                  aux.p, T);
-          liq := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps(gl);
-          vap := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps(gv);
-        else
-          fl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(
-                                  d_liq, T);
-          fv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(
-                                  d_vap, T);
-          liq :=
-            ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps(fl);
-          vap :=
-            ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps(fv);
-        end if;
-        aux.dpT := if (liq.d <> vap.d) then (vap.s - liq.s)*liq.d*vap.d/(liq.d - vap.d) else ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.dptofT(
-                                                                                              aux.T);
-        aux.s := liq.s + aux.x*(vap.s - liq.s);
-        aux.cv := ThermoSysPro.Properties.WaterSteam.Common.cv2Phase(
-              liq,
-              vap,
-              aux.x,
-              aux.T,
-              aux.p);
-        aux.cp := liq.cp + aux.x*(vap.cp - liq.cp);
-        aux.pt := liq.pt + aux.x*(vap.pt - liq.pt);
-        aux.pd := liq.pd + aux.x*(vap.pd - liq.pd);
-      elseif (aux.region == 5) then
-        (aux.p,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.pofdt125(
-                                                    d=rho,T= T,reldd= 1.0e-8,region=5);
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(
-                               aux.p, T);
-        aux.h := aux.R*aux.T*g.tau*g.gtau;
-        aux.s := aux.R*(g.tau*g.gtau - g.g);
-        aux.rho := aux.p/(aux.R*T*g.pi*g.gpi);
-        aux.vt := aux.R/aux.p*(g.pi*g.gpi - g.tau*g.pi*g.gtaupi);
-        aux.vp := aux.R*T/(aux.p*aux.p)*g.pi*g.pi*g.gpipi;
-        aux.cp := -aux.R*g.tau*g.tau*g.gtautau;
-        aux.cv := aux.R*(-g.tau*g.tau*g.gtautau + ((g.gpi - g.tau*g.gtaupi)*(g.gpi - g.tau*g.gtaupi)/g.gpipi));
-      else
-        assert(false, "error in region computation of IF97 steam tables"
-         + "(rho = " + String(rho) + ", T = " + String(T) + ")");
-      end if;
-    end waterBaseProp_dT;
-
-    function h_props_dT
-      "specific enthalpy as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "Temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    algorithm
-      h := aux.h;
-
-      annotation (
-        derivative(noDerivative=aux) = h_dT_der,
-        Inline=false,
-        LateInline=true);
-    end h_props_dT;
-
-    function h_dT "specific enthalpy as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "Temperature";
-      input Integer phase =  0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    algorithm
-      h := h_props_dT(d, T, waterBaseProp_dT(d, T, phase, region));
-    end h_dT;
-
-    function h_dT_der "derivative function of h_dT"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      input Real d_der "derivative of density";
-      input Real T_der "derivative of temperature";
-      output Real h_der "derivative of specific enthalpy";
-    algorithm
-      if (aux.region == 3) then
-        h_der := ((-d*aux.pd + T*aux.pt)/(d*d))*d_der + ((aux.cv*d + aux.pt)/d)*
-          T_der;
-      elseif (aux.region == 4) then
-        h_der := T*aux.dpT/(d*d)*d_der + ((aux.cv*d + aux.dpT)/d)*T_der;
-      else
-        //regions 1,2 or 5
-        h_der := (-(-1/d + T*aux.vt)/(d*d*aux.vp))*d_der + ((aux.vp*aux.cp - aux.
-          vt/d + T*aux.vt*aux.vt)/aux.vp)*T_der;
-      end if;
-    end h_dT_der;
-
-    function p_props_dT "pressure as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "Temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      output Modelica.SIunits.Pressure p "pressure";
-    algorithm
-      p := aux.p;
-
-      annotation (
-        derivative(noDerivative=aux) = p_dT_der,
-        Inline=false,
-        LateInline=true);
-    end p_props_dT;
-
-    function p_dT "pressure as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "Temperature";
-      input Integer phase =  0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.Pressure p "pressure";
-    algorithm
-      p := p_props_dT(d, T, waterBaseProp_dT(d, T, phase, region));
-    end p_dT;
-
-    function p_dT_der "derivative function of p_dT"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      input Real d_der "derivative of density";
-      input Real T_der "derivative of temperature";
-      output Real p_der "derivative of pressure";
-    algorithm
-      if (aux.region == 3) then
-        p_der := aux.pd*d_der + aux.pt*T_der;
-      elseif (aux.region == 4) then
-        p_der := aux.dpT*T_der;
-        /*density derivative is 0.0*/
-      else
-        //regions 1,2 or 5
-        p_der := (-1/(d*d*aux.vp))*d_der + (-aux.vt/aux.vp)*T_der;
-      end if;
-    end p_dT_der;
-
-    function s_props_dT
-      "specific entropy as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "Temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      output Modelica.SIunits.SpecificEntropy s "specific entropy";
-    algorithm
-      s := aux.s;
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end s_props_dT;
-
-    function s_dT "temperature as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "Temperature";
-      input Integer phase =  0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.SpecificEntropy s "specific entropy";
-    algorithm
-      s := s_props_dT(d, T, waterBaseProp_dT(d, T, phase, region));
-    end s_dT;
-
-    function cv_props_dT
-      "specific heat capacity at constant volume as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      output Modelica.SIunits.SpecificHeatCapacity cv "specific heat capacity";
-    algorithm
-      cv := aux.cv;
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end cv_props_dT;
-
-    function cv_dT
-      "specific heat capacity at constant volume as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer phase =  0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.SpecificHeatCapacity cv "specific heat capacity";
-    algorithm
-      cv := cv_props_dT(d, T, waterBaseProp_dT(d, T, phase, region));
-    end cv_dT;
-
-    function cp_props_dT
-      "specific heat capacity at constant pressure as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      output Modelica.SIunits.SpecificHeatCapacity cp "specific heat capacity";
-    algorithm
-      cp := aux.cp;
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end cp_props_dT;
-
-    function cp_dT
-      "specific heat capacity at constant pressure as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer phase =  0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.SpecificHeatCapacity cp "specific heat capacity";
-    algorithm
-      cp := cp_props_dT(d, T, waterBaseProp_dT(d, T, phase, region));
-    end cp_dT;
-
-    function beta_props_dT
-      "isobaric expansion coefficient as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      output Modelica.SIunits.RelativePressureCoefficient beta
-        "isobaric expansion coefficient";
-    algorithm
-      beta := if aux.region == 3 or aux.region == 4 then
-        aux.pt/(aux.rho*aux.pd) else
-        aux.vt*aux.rho;
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end beta_props_dT;
-
-    function beta_dT
-      "isobaric expansion coefficient as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer phase =  0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.RelativePressureCoefficient beta
-        "isobaric expansion coefficient";
-    algorithm
-      beta := beta_props_dT(d, T, waterBaseProp_dT(d, T, phase, region));
-    end beta_dT;
-
-    function kappa_props_dT
-      "isothermal compressibility factor as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      output Modelica.SIunits.IsothermalCompressibility kappa
-        "isothermal compressibility factor";
-    algorithm
-      kappa := if aux.region == 3 or aux.region == 4 then
-        1/(aux.rho*aux.pd) else -aux.vp*aux.rho;
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end kappa_props_dT;
-
-    function kappa_dT
-      "isothermal compressibility factor as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer phase =  0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.IsothermalCompressibility kappa
-        "isothermal compressibility factor";
-    algorithm
-      kappa := kappa_props_dT(d, T, waterBaseProp_dT(d, T, phase, region));
-    end kappa_dT;
-
-    function velocityOfSound_props_dT
-      "speed of sound as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      output Modelica.SIunits.Velocity v_sound "speed of sound";
-    algorithm
-      // dp/drho at constant s
-      v_sound := if aux.region == 3 then sqrt((aux.pd*aux.rho*aux.rho*aux.cv + aux.pt*aux.pt*aux.T)/(aux.rho*aux.rho*aux.cv)) else
-        if aux.region == 4 then
-        sqrt(1/((aux.rho*(aux.rho*aux.cv/aux.dpT + 1.0)/(aux.dpT*aux.T)) - 1/aux.rho*aux.rho*aux.rho/(aux.dpT*aux.T))) else
-             sqrt(-aux.cp/(aux.rho*aux.rho*(aux.vp*aux.cp+aux.vt*aux.vt*aux.T)));
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end velocityOfSound_props_dT;
-
-    function velocityOfSound_dT
-      "speed of sound as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer phase =  0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.Velocity v_sound "speed of sound";
-    algorithm
-      v_sound := velocityOfSound_props_dT(d, T, waterBaseProp_dT(d, T, phase, region));
-    end velocityOfSound_dT;
-
-    function isentropicExponent_props_dT
-      "isentropic exponent as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      output Real gamma "isentropic exponent";
-    algorithm
-      gamma := if aux.region == 3 then 1/(aux.rho*aux.p)*((aux.pd*aux.cv*aux.rho*aux.rho + aux.pt*aux.pt*aux.T)/(aux.cv)) else
-             if aux.region == 4 then 1/(aux.rho*aux.p)*aux.dpT*aux.dpT*aux.T/aux.cv else
-        -1/(aux.rho*aux.p)*aux.cp/(aux.vp*aux.cp + aux.vt*aux.vt*aux.T);
-
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end isentropicExponent_props_dT;
-
-    function isentropicExponent_dT
-      "isentropic exponent as function of density and temperature"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Density d "density";
-      input Modelica.SIunits.Temperature T "temperature";
-      input Integer phase =  0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region =  0
-        "if 0, region is unknown, otherwise known and this input";
-      output Real gamma "isentropic exponent";
-    algorithm
-      gamma := isentropicExponent_props_dT(d, T, waterBaseProp_dT(d, T, phase, region));
-      annotation (
-        Inline=false,
-        LateInline=true);
-    end isentropicExponent_dT;
-
-  public
-    function hl_p =
-        ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hl_p
-      "compute the saturated liquid specific h(p)";
-    function hv_p =
-        ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hv_p
-      "compute the saturated vapour specific h(p)";
-
-    function sl_p =
-        ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.sl_p
-      "compute the saturated liquid specific s(p)";
-    function sv_p =
-        ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.sv_p
-      "compute the saturated vapour specific s(p)";
-
-    function rhol_T =
-        ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.rhol_T
-      "compute the saturated liquid d(T)";
-    function rhov_T =
-        ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.rhov_T
-      "compute the saturated vapour d(T)";
-
-    function rhol_p =
-        ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.rhol_p
-      "compute the saturated liquid d(p)";
-    function rhov_p =
-        ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.rhov_p
-      "compute the saturated vapour d(p)";
-
-    function dynamicViscosity =
-        ThermoSysPro.Properties.WaterSteam.BaseIF97.Transport.visc_dT
-      "compute eta(d,T) in the one-phase region";
-    function thermalConductivity =
-        ThermoSysPro.Properties.WaterSteam.BaseIF97.Transport.cond_industrial_dT
-      "compute lambda(d,T) in the one-phase region";
-    function surfaceTension =
-        ThermoSysPro.Properties.WaterSteam.BaseIF97.Transport.surfaceTension
-      "compute sigma(T) at saturation T";
-
-  //   function isentropicEnthalpy
-  //     "isentropic specific enthalpy from p,s (preferably use dynamicIsentropicEnthalpy in dynamic simulation!)"
-  //     extends Modelica.Icons.Function;
-  //     input SI.Pressure p "pressure";
-  //     input SI.SpecificEntropy s "specific entropy";
-  //     input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
-  //     output SI.SpecificEnthalpy h "specific enthalpy";
-  //   algorithm
-  //    h := BaseIF97.Isentropic.water_hisentropic(p,s,phase);
-  //   end isentropicEnthalpy;
-
-    function isentropicEnthalpy
-      "isentropic specific enthalpy from p,s (preferably use dynamicIsentropicEnthalpy in dynamic simulation!)"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      input Integer phase = 0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      input Integer region = 0
-        "if 0, region is unknown, otherwise known and this input";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    algorithm
-      h := isentropicEnthalpy_props(p, s, waterBaseProp_ps(p, s, phase, region));
-    end isentropicEnthalpy;
-
-    function isentropicEnthalpy_props
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      output Modelica.SIunits.SpecificEnthalpy h "isentropic enthalpay";
-    algorithm
-      h := aux.h;
-
-      annotation (derivative(noDerivative=aux) = isentropicEnthalpy_der,
-    Inline=false,
-    LateInline=true);
-    end isentropicEnthalpy_props;
-
-    function isentropicEnthalpy_der
-      "derivative of isentropic specific enthalpy from p,s"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux
-        "auxiliary record";
-      input Real p_der "pressure derivative";
-      input Real s_der "entropy derivative";
-      output Real h_der "specific enthalpy derivative";
-    algorithm
-      h_der := 1/aux.rho*p_der + aux.T*s_der;
-    end isentropicEnthalpy_der;
-
-    function dynamicIsentropicEnthalpy
-      "isentropic specific enthalpy from p,s and good guesses of d and T"
-      extends Modelica.Icons.Function;
-      input Modelica.SIunits.Pressure p "pressure";
-      input Modelica.SIunits.SpecificEntropy s "specific entropy";
-      input Modelica.SIunits.Density dguess
-        "good guess density, e.g. from adjacent volume";
-      input Modelica.SIunits.Temperature Tguess
-        "good guess temperature, e.g. from adjacent volume";
-      input Integer phase = 0
-        "2 for two-phase, 1 for one-phase, 0 if not known";
-      output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-    algorithm
-     h := ThermoSysPro.Properties.WaterSteam.BaseIF97.Isentropic.water_hisentropic_dyn(
-                                                    p,s,dguess,Tguess,0);
-    end dynamicIsentropicEnthalpy;
-
-    annotation (Icon(graphics={
-          Text(
-            extent={{-102,0},{24,-26}},
-            lineColor={242,148,0},
-            textString=
-                 "Thermo"),
-          Text(
-            extent={{-4,8},{68,-34}},
-            lineColor={46,170,220},
-            textString=
-                 "SysPro"),
-          Polygon(
-            points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},{
-                42,8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},{
-                -50,6},{-62,2}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{-46,
-                8},{-42,22},{-42,30},{-44,38}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{-12,
-                12},{-26,12},{-28,12},{-26,20}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,30},{-6,26}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,36},{-6,32}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,42},{-6,38}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,48},{-6,44}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,32},{-2,28}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,38},{-2,34}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,44},{-2,40}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,50},{-2,46}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{-2,
-                20}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},{
-                42,6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},{
-                -50,6},{-62,2}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Line(
-            points={{22,12},{22,14},{22,16},{24,14},{20,18}},
-            color={46,170,220},
-            thickness=0.5),
-          Line(
-            points={{26,12},{26,14},{26,16},{28,14},{24,18}},
-            color={46,170,220},
-            thickness=0.5),
-          Line(
-            points={{30,10},{30,12},{30,14},{32,12},{28,16}},
-            color={46,170,220},
-            thickness=0.5),
-          Polygon(
-            points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}),
-          Line(
-            points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}},
-            color={0,0,255},
-            smooth=Smooth.None),
-          Line(
-            points={{80,80},{100,100}},
-            color={0,0,255},
-            smooth=Smooth.None)}));
-  end Standard;
-  annotation (Documentation(info="<HTML>
+within ThermoSysPro.Properties.WaterSteam;
+
+package IF97_Utilities "Low level and utility computation for high accuracy water properties according to the IAPWS/IF97 standard"
+  replaceable record iter = ThermoSysPro.Properties.WaterSteam.BaseIF97.IterationData;
+  //   function isentropicEnthalpy
+  //     "isentropic specific enthalpy from p,s (preferably use dynamicIsentropicEnthalpy in dynamic simulation!)"
+  //     extends Modelica.Icons.Function;
+  //     input SI.Pressure p "pressure";
+  //     input SI.SpecificEntropy s "specific entropy";
+  //     input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+  //     output SI.SpecificEnthalpy h "specific enthalpy";
+  //   algorithm
+  //    h := BaseIF97.Isentropic.water_hisentropic(p,s,phase);
+  //   end isentropicEnthalpy;
+public
+  package AnalyticDerivatives "Functions with analytic derivatives"
+    import ThermoSysPro.Properties.WaterSteam.BaseIF97.*;
+
+    function waterBasePropAnalytic_ph "intermediate property record for water"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Integer phase = 0 "phase: 2 for two-phase, 1 for one phase, 0 if unknown";
+      input Integer region = 0 "if 0, do region computation, otherwise assume the region is this input";
+      output ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+    protected
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd g "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd f "dimensionless Helmholtz funcion and dervatives wrt delta and tau";
+      Integer error "error flag for inverse iterations";
+      Modelica.Units.SI.SpecificEnthalpy h_liq "liquid specific enthalpy";
+      Modelica.Units.SI.Density d_liq "liquid density";
+      Modelica.Units.SI.SpecificEnthalpy h_vap "vapour specific enthalpy";
+      Modelica.Units.SI.Density d_vap "vapour density";
+      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties3rd liq "phase boundary property record";
+      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties3rd vap "phase boundary property record";
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd gl "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd gv "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd fl "dimensionless Helmholtz function and dervatives wrt delta and tau";
+      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd fv "dimensionless Helmholtz function and dervatives wrt delta and tau";
+      Modelica.Units.SI.Temperature t1 "temperature at phase boundary, using inverse from region 1";
+      Modelica.Units.SI.Temperature t2 "temperature at phase boundary, using inverse from region 2";
+      /// new stuff, for analytic Jacobian
+      Real dxv "der of x wrt v";
+      Real dxd "der of x wrt d";
+      Real dvTl "der of v wrt T at boiling";
+      Real dvTv "der of v wrt T at dew";
+      Real dxT "der of x wrt T";
+      Real duTl "der of u wrt T at boiling";
+      Real duTv "der of u wrt T at dew";
+      Real dpTT "2nd der of p wrt T";
+      Real dxdd "2nd der of x wrt d";
+      Real dxTd "2nd der of x wrt d and T";
+      Real dvTTl "2nd der of v wrt T at boiling";
+      Real dvTTv "2nd der of v wrt T at dew";
+      Real dxTT " 2nd der of x wrt T";
+      Real duTTl "2nd der of u wrt T at boiling";
+      Real duTTv "2nd der of u wrt T at dew";
+      Real vp3 "vp^3";
+      Real ivp3 "1/vp3";
+      Modelica.Units.SI.SpecificVolume v;
+      // cvt is in aux record
+      // Real detpht;
+    algorithm
+      aux.region := if region == 0 then if phase == 2 then 4 else ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_ph(p = p, h = h, phase = phase) else region;
+      aux.phase := if phase <> 0 then phase else if aux.region == 4 then 2 else 1;
+// LogVariable(p);
+// LogVariable(h);
+// LogVariable(aux.region);
+      aux.p := max(p, 611.657);
+      aux.h := max(h, 1e3);
+      aux.R := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
+      if aux.region == 1 or aux.region == 2 or aux.region == 5 then
+        if aux.region == 1 then
+          aux.T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tph1(aux.p, aux.h);
+          g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1L3(p, aux.T);
+          aux.x := 0.0;
+        elseif aux.region == 2 then
+          aux.T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tph2(aux.p, aux.h);
+          g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2L3(p, aux.T);
+          aux.x := 1.0;
+        else
+          (aux.T, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.tofph5(p = aux.p, h = aux.h, reldh = 1.0e-7);
+          assert(error == 0, "error in inverse iteration of steam tables");
+          g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g5L3(p, aux.T);
+          aux.x := 1.0;
+        end if;
+        aux.s := aux.R * (g.tau * g.gtau - g.g);
+        aux.rho := p / (aux.R * aux.T * g.pi * g.gpi);
+        aux.vt := aux.R / p * (g.pi * g.gpi - g.tau * g.pi * g.gpitau);
+        aux.vp := aux.R * aux.T / (p * p) * g.pi * g.pi * g.gpipi;
+        aux.cp := -aux.R * g.tau * g.tau * g.gtautau;
+        aux.cv := aux.R * ((-g.tau * g.tau * g.gtautau) + (g.gpi - g.tau * g.gpitau) * (g.gpi - g.tau * g.gpitau) / g.gpipi);
+        aux.dpT := -aux.vt / aux.vp;
+        aux.vtt := aux.R * g.pi / p * g.tau / aux.T * g.tau * g.gpitautau;
+        aux.vtp := aux.R * g.pi * g.pi / (p * p) * (g.gpipi - g.tau * g.gpipitau);
+        aux.vpp := aux.R * aux.T * g.pi * g.pi * g.pi / (p * p * p) * g.gpipipi;
+        aux.cpt := aux.R * g.tau * g.tau / aux.T * (2 * g.gtautau + g.tau * g.gtautautau);
+        aux.pt := -g.p / g.T * (g.gpi - g.tau * g.gpitau) / (g.gpipi * g.pi);
+        aux.pd := -g.R * g.T * g.gpi * g.gpi / g.gpipi;
+        v := 1 / aux.rho;
+        vp3 := aux.vp * aux.vp * aux.vp;
+        ivp3 := 1 / vp3;
+        aux.ptt := -(aux.vtt * aux.vp * aux.vp - 2.0 * aux.vt * aux.vtp * aux.vp + aux.vt * aux.vt * aux.vpp) * ivp3;
+        aux.pdd := (-aux.vpp * ivp3 * v * v * v * v) - 2 * v * aux.pd "= pvv/d^4";
+        aux.ptd := (aux.vtp * aux.vp - aux.vt * aux.vpp) * ivp3 * v * v "= -ptv/d^2";
+        aux.cvt := (vp3 * aux.cpt + aux.vp * aux.vp * aux.vt * aux.vt + 3.0 * aux.vp * aux.vp * aux.T * aux.vt * aux.vtt - 3.0 * aux.vtp * aux.vp * aux.T * aux.vt * aux.vt + aux.T * aux.vt * aux.vt * aux.vt * aux.vpp) * ivp3;
+      elseif aux.region == 3 then
+        (aux.rho, aux.T, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.dtofph3(p = aux.p, h = aux.h, delp = 1.0e-7, delh = 1.0e-6);
+        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(aux.rho, aux.T);
+        aux.h := aux.R * aux.T * (f.tau * f.ftau + f.delta * f.fdelta);
+        aux.s := aux.R * (f.tau * f.ftau - f.f);
+        aux.pd := aux.R * aux.T * f.delta * (2.0 * f.fdelta + f.delta * f.fdeltadelta);
+        aux.pt := aux.R * aux.rho * f.delta * (f.fdelta - f.tau * f.fdeltatau);
+        aux.cv := abs(aux.R * (-f.tau * f.tau * f.ftautau)) "can be close to neg. infinity near critical point";
+        aux.cp := (aux.rho * aux.rho * aux.pd * aux.cv + aux.T * aux.pt * aux.pt) / (aux.rho * aux.rho * aux.pd);
+        aux.x := 0.0;
+        aux.dpT := aux.pt;
+        aux.pdd := aux.R * aux.T * f.delta / aux.rho * (2.0 * f.fdelta + 4.0 * f.delta * f.fdeltadelta + f.delta * f.delta * f.fdeltadeltadelta);
+        aux.ptt := aux.R * aux.rho * f.delta * f.tau * f.tau / aux.T * f.fdeltatautau;
+        aux.ptd := aux.R * f.delta * (2.0 * f.fdelta + f.delta * f.fdeltadelta - 2.0 * f.tau * f.fdeltatau - f.delta * f.tau * f.fdeltadeltatau);
+        aux.cvt := aux.R * f.tau * f.tau / aux.T * (2.0 * f.ftautau + f.tau * f.ftautautau);
+        aux.cpt := (aux.cvt * aux.pd + aux.cv * aux.ptd + (aux.pt + 2.0 * aux.T * aux.ptt) * aux.pt / (aux.rho * aux.rho) - aux.cp * aux.ptd) / aux.pd;
+      elseif aux.region == 4 then
+        h_liq := hl_p(p);
+        h_vap := hv_p(p);
+        aux.x := if h_vap <> h_liq then (h - h_liq) / (h_vap - h_liq) else 1.0;
+        if p < ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PLIMIT4A then
+          t1 := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tph1(aux.p, h_liq);
+          t2 := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tph2(aux.p, h_vap);
+          gl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1L3(aux.p, t1);
+          gv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2L3(aux.p, t2);
+          liq := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps3rd(gl);
+          vap := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps3rd(gv);
+          aux.T := t1 + aux.x * (t2 - t1);
+        else
+          aux.T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tsat(aux.p);
+          d_liq := rhol_T(aux.T);
+          d_vap := rhov_T(aux.T);
+          fl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(d_liq, aux.T);
+          fv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(d_vap, aux.T);
+          liq := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps3rd(fl);
+          vap := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps3rd(fv);
+        end if;
+        aux.rho := liq.d * vap.d / (vap.d + aux.x * (liq.d - vap.d));
+        dxv := if liq.d <> vap.d then liq.d * vap.d / (liq.d - vap.d) else 0.0;
+        dxd := -dxv / (aux.rho * aux.rho);
+        aux.dpT := if liq.d <> vap.d then (vap.s - liq.s) * dxv else ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.dptofT(aux.T);
+        dvTl := (liq.pt - aux.dpT) / (liq.pd * liq.d * liq.d);
+        dvTv := (vap.pt - aux.dpT) / (vap.pd * vap.d * vap.d);
+        dxT := -dxv * (dvTl + aux.x * (dvTv - dvTl));
+        duTl := liq.cv + (aux.T * liq.pt - p) * dvTl;
+        duTv := vap.cv + (aux.T * vap.pt - p) * dvTv;
+        aux.cv := duTl + aux.x * (duTv - duTl) + dxT * (vap.u - liq.u);
+        dpTT := dxv * (vap.cv / aux.T - liq.cv / aux.T + dvTv * (vap.pt - aux.dpT) - dvTl * (liq.pt - aux.dpT));
+        dxdd := 2.0 * dxv / (aux.rho * aux.rho * aux.rho);
+        dxTd := dxv * dxv * (dvTv - dvTl) / (aux.rho * aux.rho);
+        dvTTl := ((liq.ptt - dpTT) / (liq.d * liq.d) + dvTl * (liq.d * dvTl * (2.0 * liq.pd + liq.d * liq.pdd) - 2.0 * liq.ptd)) / liq.pd;
+        dvTTv := ((vap.ptt - dpTT) / (vap.d * vap.d) + dvTv * (vap.d * dvTv * (2.0 * vap.pd + vap.d * vap.pdd) - 2.0 * vap.ptd)) / vap.pd;
+        dxTT := -dxv * (2.0 * dxT * (dvTv - dvTl) + dvTTl + aux.x * (dvTTv - dvTTl));
+        duTTl := liq.cvt + (liq.pt - aux.dpT + aux.T * (2.0 * liq.ptt - liq.d * liq.d * liq.ptd * dvTl)) * dvTl + (aux.T * liq.pt - p) * dvTTl;
+        duTTv := vap.cvt + (vap.pt - aux.dpT + aux.T * (2.0 * vap.ptt - vap.d * vap.d * vap.ptd * dvTv)) * dvTv + (aux.T * vap.pt - p) * dvTTv;
+        aux.cvt := duTTl + aux.x * (duTTv - duTTl) + 2.0 * dxT * (duTv - duTl) + dxTT * (vap.u - liq.u);
+        aux.s := liq.s + aux.x * (vap.s - liq.s);
+        aux.cp := liq.cp + aux.x * (vap.cp - liq.cp);
+        aux.pt := liq.pt + aux.x * (vap.pt - liq.pt);
+        aux.pd := liq.pd + aux.x * (vap.pd - liq.pd);
+        aux.vt := dvTl + aux.x * (dvTv - dvTl) + dxT * (1 / vap.d - 1 / liq.d);
+        aux.vp := aux.vt / aux.dpT;
+        aux.pdd := 0.0;
+        aux.ptd := 0.0;
+        aux.ptt := dpTT;
+        aux.vtt := dvTTl + aux.x * (dvTTv - dvTTl);
+        aux.vtp := aux.vtt / aux.dpT;
+      else
+        assert(false, "error in region computation of IF97 steam tables" + "(p = " + String(p) + ", h = " + String(h) + ")");
+      end if;
+/* region must be 5 here */
+/*safety against div-by-0 in initialization*/
+// how to avoid ?
+//  aux.dpT := BaseIF97.Basic.dptofT(aux.T);
+// next ones are only for cases where region 4 is called improperly
+// undefined
+// dpT
+// 0.0
+// v = vl + x*(vv-vl)
+//hpp := vp - T*vtp = aux.vt/aux.dpT - T*aux.vtt/aux.dpT;
+      annotation(
+        Icon(graphics));
+    end waterBasePropAnalytic_ph;
+
+    function waterBasePropAnalytic_pT "intermediate property record for water (p and T prefered states)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer region = 0 "if 0, do region computation, otherwise assume the region is this input";
+      output ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+    protected
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd g "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd f "dimensionless Helmholtz funcion and dervatives wrt delta and tau";
+      Real vp3 "vp^3";
+      Real ivp3 "1/vp3";
+      Modelica.Units.SI.SpecificVolume v;
+      Integer error "error flag for inverse iterations";
+    algorithm
+      aux.phase := 1;
+      aux.region := if region == 0 then ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_pT(p = p, T = T) else region;
+      aux.R := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
+      aux.p := p;
+      aux.T := T;
+      if aux.region == 1 or aux.region == 2 or aux.region == 5 then
+        if aux.region == 1 then
+          g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1L3(p, T);
+          aux.x := 0.0;
+        elseif aux.region == 2 then
+          g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2L3(p, T);
+          aux.x := 1.0;
+        else
+          g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g5L3(p, T);
+          aux.x := 1.0;
+        end if;
+        aux.h := aux.R * aux.T * g.tau * g.gtau;
+        aux.s := aux.R * (g.tau * g.gtau - g.g);
+        aux.rho := p / (aux.R * T * g.pi * g.gpi);
+        aux.vt := aux.R / p * (g.pi * g.gpi - g.tau * g.pi * g.gpitau);
+        aux.vp := aux.R * T / (p * p) * g.pi * g.pi * g.gpipi;
+        aux.cp := -aux.R * g.tau * g.tau * g.gtautau;
+        aux.cv := aux.R * ((-g.tau * g.tau * g.gtautau) + (g.gpi - g.tau * g.gpitau) * (g.gpi - g.tau * g.gpitau) / g.gpipi);
+        aux.x := 0.0;
+        aux.vtt := aux.R * g.pi / aux.p * g.tau / aux.T * g.tau * g.gpitautau;
+        aux.vtp := aux.R * g.pi * g.pi / (aux.p * aux.p) * (g.gpipi - g.tau * g.gpipitau);
+        aux.vpp := aux.R * aux.T * g.pi * g.pi * g.pi / (aux.p * aux.p * aux.p) * g.gpipipi;
+        aux.cpt := aux.R * g.tau * g.tau / aux.T * (2 * g.gtautau + g.tau * g.gtautautau);
+        aux.pt := -g.p / g.T * (g.gpi - g.tau * g.gpitau) / (g.gpipi * g.pi);
+        aux.pd := -g.R * g.T * g.gpi * g.gpi / g.gpipi;
+        v := 1 / aux.rho;
+        vp3 := aux.vp * aux.vp * aux.vp;
+        ivp3 := 1 / vp3;
+        aux.ptt := -(aux.vtt * aux.vp * aux.vp - 2.0 * aux.vt * aux.vtp * aux.vp + aux.vt * aux.vt * aux.vpp) * ivp3;
+        aux.pdd := (-aux.vpp * ivp3 * v * v * v * v) - 2 * v * aux.pd;
+        aux.ptd := (aux.vtp * aux.vp - aux.vt * aux.vpp) * ivp3 * v * v "= -ptv/d^2";
+        aux.cvt := (vp3 * aux.cpt + aux.vp * aux.vp * aux.vt * aux.vt + 3.0 * aux.vp * aux.vp * aux.T * aux.vt * aux.vtt - 3.0 * aux.vtp * aux.vp * aux.T * aux.vt * aux.vt + aux.T * aux.vt * aux.vt * aux.vt * aux.vpp) * ivp3;
+      elseif aux.region == 3 then
+        (aux.rho, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.dofpt3(p = p, T = T, delp = 1.0e-7);
+        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(aux.rho, T);
+        aux.h := aux.R * T * (f.tau * f.ftau + f.delta * f.fdelta);
+        aux.s := aux.R * (f.tau * f.ftau - f.f);
+        aux.pd := aux.R * T * f.delta * (2.0 * f.fdelta + f.delta * f.fdeltadelta);
+        aux.pt := aux.R * aux.rho * f.delta * (f.fdelta - f.tau * f.fdeltatau);
+        aux.cv := aux.R * (-f.tau * f.tau * f.ftautau);
+        aux.x := 0.0;
+        aux.pdd := aux.R * aux.T * f.delta / aux.rho * (2.0 * f.fdelta + 4.0 * f.delta * f.fdeltadelta + f.delta * f.delta * f.fdeltadeltadelta);
+        aux.ptt := aux.R * aux.rho * f.delta * f.tau * f.tau / aux.T * f.fdeltatautau;
+        aux.ptd := aux.R * f.delta * (2.0 * f.fdelta + f.delta * f.fdeltadelta - 2.0 * f.tau * f.fdeltatau - f.delta * f.tau * f.fdeltadeltatau);
+        aux.cvt := aux.R * f.tau * f.tau / aux.T * (2.0 * f.ftautau + f.tau * f.ftautautau);
+        aux.cpt := (aux.cvt * aux.pd + aux.cv * aux.ptd + (aux.pt + 2.0 * aux.T * aux.ptt) * aux.pt / (aux.rho * aux.rho) - aux.pt * aux.ptd) / aux.pd;
+      else
+        assert(false, "error in region computation of IF97 steam tables" + "(p = " + String(p) + ", T = " + String(T) + ")");
+      end if;
+    end waterBasePropAnalytic_pT;
+
+    function waterBasePropAnalytic_dT "intermediate property record for water (d and T prefered states)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density rho "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer phase = 0 "phase: 2 for two-phase, 1 for one phase, 0 if unknown";
+      input Integer region = 0 "if 0, do region computation, otherwise assume the region is this input";
+      output ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+    protected
+      Modelica.Units.SI.SpecificEnthalpy h_liq "liquid specific enthalpy";
+      Modelica.Units.SI.Density d_liq "liquid density";
+      Modelica.Units.SI.SpecificEnthalpy h_vap "vapour specific enthalpy";
+      Modelica.Units.SI.Density d_vap "vapour density";
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd g "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd f "dimensionless Helmholtz funcion and dervatives wrt delta and tau";
+      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties3rd liq "phase boundary property record";
+      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties3rd vap "phase boundary property record";
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd gl "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd gv "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd fl "dimensionless Helmholtz function and dervatives wrt delta and tau";
+      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd fv "dimensionless Helmholtz function and dervatives wrt delta and tau";
+      Integer error "error flag for inverse iterations";
+      /// new stuff, for analytic Jacobian
+      Real dxv "der of x wrt v";
+      Real dxd "der of x wrt d";
+      Real dvTl "der of v wrt T at boiling";
+      Real dvTv "der of v wrt T at dew";
+      Real dxT "der of x wrt T";
+      Real duTl "der of u wrt T at boiling";
+      Real duTv "der of u wrt T at dew";
+      Real dpTT "2nd der of p wrt T";
+      Real dxdd "2nd der of x wrt d";
+      Real dxTd "2nd der of x wrt d and T";
+      Real dvTTl "2nd der of v wrt T at boiling";
+      Real dvTTv "2nd der of v wrt T at dew";
+      Real dxTT " 2nd der of x wrt T";
+      Real duTTl "2nd der of u wrt T at boiling";
+      Real duTTv "2nd der of u wrt T at dew";
+      // cvt is in aux record
+      Real vp3 "vp^3";
+      Real ivp3 "1/vp3";
+      Modelica.Units.SI.SpecificVolume v;
+    algorithm
+      aux.region := if region == 0 then if phase == 2 then 4 else ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_dT(d = rho, T = T, phase = phase) else region;
+      aux.phase := if aux.region == 4 then 2 else 1;
+      aux.R := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
+      aux.rho := rho;
+      aux.T := T;
+      if aux.region == 1 or aux.region == 2 or aux.region == 5 then
+        if aux.region == 1 then
+          (aux.p, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.pofdt125(d = rho, T = T, reldd = 1.0e-9, region = 1);
+          g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1L3(aux.p, T);
+          aux.x := 0.0;
+        elseif aux.region == 2 then
+          (aux.p, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.pofdt125(d = rho, T = T, reldd = 1.0e-8, region = 2);
+          g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2L3(aux.p, T);
+          aux.x := 1.0;
+        else
+          (aux.p, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.pofdt125(d = rho, T = T, reldd = 1.0e-8, region = 5);
+          g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2L3(aux.p, T);
+          aux.x := 1.0;
+        end if;
+        aux.h := aux.R * aux.T * g.tau * g.gtau;
+        aux.s := aux.R * (g.tau * g.gtau - g.g);
+        aux.rho := aux.p / (aux.R * T * g.pi * g.gpi);
+        aux.vt := aux.R / aux.p * (g.pi * g.gpi - g.tau * g.pi * g.gpitau);
+        aux.vp := aux.R * T / (aux.p * aux.p) * g.pi * g.pi * g.gpipi;
+        aux.cp := -aux.R * g.tau * g.tau * g.gtautau;
+        aux.cv := aux.R * ((-g.tau * g.tau * g.gtautau) + (g.gpi - g.tau * g.gpitau) * (g.gpi - g.tau * g.gpitau) / g.gpipi);
+        aux.vtt := aux.R * g.pi / aux.p * g.tau / aux.T * g.tau * g.gpitautau;
+        aux.vtp := aux.R * g.pi * g.pi / (aux.p * aux.p) * (g.gpipi - g.tau * g.gpipitau);
+        aux.vpp := aux.R * aux.T * g.pi * g.pi * g.pi / (aux.p * aux.p * aux.p) * g.gpipipi;
+        aux.cpt := aux.R * g.tau * g.tau / aux.T * (2 * g.gtautau + g.tau * g.gtautautau);
+        aux.pt := -g.p / g.T * (g.gpi - g.tau * g.gpitau) / (g.gpipi * g.pi);
+        aux.pd := -g.R * g.T * g.gpi * g.gpi / g.gpipi;
+        v := 1 / aux.rho;
+        vp3 := aux.vp * aux.vp * aux.vp;
+        ivp3 := 1 / vp3;
+        aux.ptt := -(aux.vtt * aux.vp * aux.vp - 2.0 * aux.vt * aux.vtp * aux.vp + aux.vt * aux.vt * aux.vpp) * ivp3;
+        aux.pdd := (-aux.vpp * ivp3 * v * v * v * v) - 2 * v * aux.pd;
+        aux.ptd := (aux.vtp * aux.vp - aux.vt * aux.vpp) * ivp3 * v * v "= -ptv/d^2";
+        aux.cvt := (vp3 * aux.cpt + aux.vp * aux.vp * aux.vt * aux.vt + 3.0 * aux.vp * aux.vp * aux.T * aux.vt * aux.vtt - 3.0 * aux.vtp * aux.vp * aux.T * aux.vt * aux.vt + aux.T * aux.vt * aux.vt * aux.vt * aux.vpp) * ivp3;
+      elseif aux.region == 3 then
+        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(rho, T);
+        aux.p := aux.R * rho * T * f.delta * f.fdelta;
+        aux.h := aux.R * T * (f.tau * f.ftau + f.delta * f.fdelta);
+        aux.s := aux.R * (f.tau * f.ftau - f.f);
+        aux.pd := aux.R * T * f.delta * (2.0 * f.fdelta + f.delta * f.fdeltadelta);
+        aux.pt := aux.R * rho * f.delta * (f.fdelta - f.tau * f.fdeltatau);
+        aux.cp := (aux.rho * aux.rho * aux.pd * aux.cv + aux.T * aux.pt * aux.pt) / (aux.rho * aux.rho * aux.pd);
+        aux.cv := aux.R * (-f.tau * f.tau * f.ftautau);
+        aux.x := 0.0;
+        aux.dpT := aux.pt;
+        aux.pdd := aux.R * aux.T * f.delta / aux.rho * (2.0 * f.fdelta + 4.0 * f.delta * f.fdeltadelta + f.delta * f.delta * f.fdeltadeltadelta);
+        aux.ptt := aux.R * aux.rho * f.delta * f.tau * f.tau / aux.T * f.fdeltatautau;
+        aux.ptd := aux.R * f.delta * (2.0 * f.fdelta + f.delta * f.fdeltadelta - 2.0 * f.tau * f.fdeltatau - f.delta * f.tau * f.fdeltadeltatau);
+        aux.cvt := aux.R * f.tau * f.tau / aux.T * (2.0 * f.ftautau + f.tau * f.ftautautau);
+        aux.cpt := (aux.cvt * aux.pd + aux.cv * aux.ptd + (aux.pt + 2.0 * aux.T * aux.ptt) * aux.pt / (aux.rho * aux.rho) - aux.pt * aux.ptd) / aux.pd;
+      elseif aux.region == 4 then
+        aux.p := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.psat(T);
+        d_liq := rhol_T(T);
+        d_vap := rhov_T(T);
+        h_liq := hl_p(aux.p);
+        h_vap := hv_p(aux.p);
+        aux.x := if d_vap <> d_liq then (1 / rho - 1 / d_liq) / (1 / d_vap - 1 / d_liq) else 1.0;
+        aux.h := h_liq + aux.x * (h_vap - h_liq);
+        if T < ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TLIMIT1 then
+          gl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1L3(aux.p, T);
+          gv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2L3(aux.p, T);
+          liq := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps3rd(gl);
+          vap := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps3rd(gv);
+        else
+          fl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(d_liq, T);
+          fv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(d_vap, T);
+          liq := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps3rd(fl);
+          vap := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps3rd(fv);
+        end if;
+        aux.s := liq.s + aux.x * (vap.s - liq.s);
+        dxv := if liq.d <> vap.d then liq.d * vap.d / (liq.d - vap.d) else 0.0;
+        dxd := -dxv / (aux.rho * aux.rho);
+        aux.dpT := if liq.d <> vap.d then (vap.s - liq.s) * dxv else ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.dptofT(aux.T);
+        dvTl := (liq.pt - aux.dpT) / (liq.pd * liq.d * liq.d);
+        dvTv := (vap.pt - aux.dpT) / (vap.pd * vap.d * vap.d);
+        dxT := -dxv * (dvTl + aux.x * (dvTv - dvTl));
+        duTl := liq.cv + (aux.T * liq.pt - aux.p) * dvTl;
+        duTv := vap.cv + (aux.T * vap.pt - aux.p) * dvTv;
+        aux.cv := duTl + aux.x * (duTv - duTl) + dxT * (vap.u - liq.u);
+        dpTT := dxv * (vap.cv / aux.T - liq.cv / aux.T + dvTv * (vap.pt - aux.dpT) - dvTl * (liq.pt - aux.dpT));
+        dxdd := 2.0 * dxv / (aux.rho * aux.rho * aux.rho);
+        dxTd := dxv * dxv * (dvTv - dvTl) / (aux.rho * aux.rho);
+        dvTTl := ((liq.ptt - dpTT) / (liq.d * liq.d) + dvTl * (liq.d * dvTl * (2.0 * liq.pd + liq.d * liq.pdd) - 2.0 * liq.ptd)) / liq.pd;
+        dvTTv := ((vap.ptt - dpTT) / (vap.d * vap.d) + dvTv * (vap.d * dvTv * (2.0 * vap.pd + vap.d * vap.pdd) - 2.0 * vap.ptd)) / vap.pd;
+        dxTT := -dxv * (2.0 * dxT * (dvTv - dvTl) + dvTTl + aux.x * (dvTTv - dvTTl));
+        duTTl := liq.cvt + (liq.pt - aux.dpT + aux.T * (2.0 * liq.ptt - liq.d * liq.d * liq.ptd * dvTl)) * dvTl + (aux.T * liq.pt - aux.p) * dvTTl;
+        duTTv := vap.cvt + (vap.pt - aux.dpT + aux.T * (2.0 * vap.ptt - vap.d * vap.d * vap.ptd * dvTv)) * dvTv + (aux.T * vap.pt - aux.p) * dvTTv;
+        aux.cvt := duTTl + aux.x * (duTTv - duTTl) + 2.0 * dxT * (duTv - duTl) + dxTT * (vap.u - liq.u);
+        aux.cp := liq.cp + aux.x * (vap.cp - liq.cp);
+        aux.pt := liq.pt + aux.x * (vap.pt - liq.pt);
+        aux.pd := liq.pd + aux.x * (vap.pd - liq.pd);
+        aux.ptt := dpTT;
+      else
+        assert(false, "error in region computation of IF97 steam tables" + "(rho = " + String(rho) + ", T = " + String(T) + ")");
+      end if;
+/*safety against div-by-0 in initialization*/
+    end waterBasePropAnalytic_dT;
+
+    function waterBaseProp_ps "intermediate property record for water"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      input Integer phase = 0 "phase: 2 for two-phase, 1 for one phase, 0 if unknown";
+      input Integer region = 0 "if 0, do region computation, otherwise assume the region is this input";
+      output ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+    protected
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs g "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs f "dimensionless Helmholtz funcion and dervatives wrt delta and tau";
+      Integer error "error flag for inverse iterations";
+      Modelica.Units.SI.SpecificEntropy s_liq "liquid specific entropy";
+      Modelica.Units.SI.Density d_liq "liquid density";
+      Modelica.Units.SI.SpecificEntropy s_vap "vapour specific entropy";
+      Modelica.Units.SI.Density d_vap "vapour density";
+      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties liq "phase boundary property record";
+      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties vap "phase boundary property record";
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs gl "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs gv "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      Modelica.Media.Common.HelmholtzDerivs fl "dimensionless Helmholtz function and dervatives wrt delta and tau";
+      Modelica.Media.Common.HelmholtzDerivs fv "dimensionless Helmholtz function and dervatives wrt delta and tau";
+      Modelica.Units.SI.Temperature t1 "temperature at phase boundary, using inverse from region 1";
+      Modelica.Units.SI.Temperature t2 "temperature at phase boundary, using inverse from region 2";
+    algorithm
+      aux.region := if region == 0 then if phase == 2 then 4 else ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_ps(p = p, s = s, phase = phase) else region;
+      aux.phase := if phase <> 0 then phase else if aux.region == 4 then 2 else 1;
+      aux.p := p;
+      aux.s := s;
+      aux.R := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
+      if aux.region == 1 then
+        aux.T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tps1(p, s);
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(p, aux.T);
+        aux.h := aux.R * aux.T * g.tau * g.gtau;
+        aux.rho := p / (aux.R * aux.T * g.pi * g.gpi);
+        aux.vt := aux.R / p * (g.pi * g.gpi - g.tau * g.pi * g.gtaupi);
+        aux.vp := aux.R * aux.T / (p * p) * g.pi * g.pi * g.gpipi;
+        aux.cp := -aux.R * g.tau * g.tau * g.gtautau;
+        aux.cv := aux.R * ((-g.tau * g.tau * g.gtautau) + (g.gpi - g.tau * g.gtaupi) * (g.gpi - g.tau * g.gtaupi) / g.gpipi);
+        aux.x := 0.0;
+      elseif aux.region == 2 then
+        aux.T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tps2(p, s);
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(p, aux.T);
+        aux.h := aux.R * aux.T * g.tau * g.gtau;
+        aux.rho := p / (aux.R * aux.T * g.pi * g.gpi);
+        aux.vt := aux.R / p * (g.pi * g.gpi - g.tau * g.pi * g.gtaupi);
+        aux.vp := aux.R * aux.T / (p * p) * g.pi * g.pi * g.gpipi;
+        aux.cp := -aux.R * g.tau * g.tau * g.gtautau;
+        aux.cv := aux.R * ((-g.tau * g.tau * g.gtautau) + (g.gpi - g.tau * g.gtaupi) * (g.gpi - g.tau * g.gtaupi) / g.gpipi);
+        aux.x := 1.0;
+      elseif aux.region == 3 then
+        (aux.rho, aux.T, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.dtofps3(p = p, s = s, delp = 1.0e-7, dels = 1.0e-6);
+        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(aux.rho, aux.T);
+        aux.h := aux.R * aux.T * (f.tau * f.ftau + f.delta * f.fdelta);
+        aux.s := aux.R * (f.tau * f.ftau - f.f);
+        aux.pd := aux.R * aux.T * f.delta * (2.0 * f.fdelta + f.delta * f.fdeltadelta);
+        aux.pt := aux.R * aux.rho * f.delta * (f.fdelta - f.tau * f.fdeltatau);
+        aux.cv := aux.R * (-f.tau * f.tau * f.ftautau);
+        aux.cp := (aux.rho * aux.rho * aux.pd * aux.cv + aux.T * aux.pt * aux.pt) / (aux.rho * aux.rho * aux.pd);
+        aux.x := 0.0;
+      elseif aux.region == 4 then
+        s_liq := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.sl_p(p);
+        s_vap := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.sv_p(p);
+        aux.x := if s_vap <> s_liq then (s - s_liq) / (s_vap - s_liq) else 1.0;
+        if p < ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PLIMIT4A then
+          t1 := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tps1(p, s_liq);
+          t2 := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tps2(p, s_vap);
+          gl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(p, t1);
+          gv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(p, t2);
+          liq := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps(gl);
+          vap := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps(gv);
+          aux.T := t1 + aux.x * (t2 - t1);
+        else
+          aux.T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tsat(p);
+          d_liq := rhol_T(aux.T);
+          d_vap := rhov_T(aux.T);
+          fl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(d_liq, aux.T);
+          fv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(d_vap, aux.T);
+          liq := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps(fl);
+          vap := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps(fv);
+        end if;
+        aux.dpT := if liq.d <> vap.d then (vap.s - liq.s) * liq.d * vap.d / (liq.d - vap.d) else ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.dptofT(aux.T);
+        aux.h := liq.h + aux.x * (vap.h - liq.h);
+        aux.rho := liq.d * vap.d / (vap.d + aux.x * (liq.d - vap.d));
+        aux.cv := ThermoSysPro.Properties.WaterSteam.Common.cv2Phase(liq, vap, aux.x, aux.T, p);
+        aux.cp := liq.cp + aux.x * (vap.cp - liq.cp);
+        aux.pt := liq.pt + aux.x * (vap.pt - liq.pt);
+        aux.pd := liq.pd + aux.x * (vap.pd - liq.pd);
+      elseif aux.region == 5 then
+        (aux.T, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.tofps5(p = p, s = s, relds = 1.0e-7);
+        assert(error == 0, "error in inverse iteration of steam tables");
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g5(p, aux.T);
+        aux.h := aux.R * aux.T * g.tau * g.gtau;
+        aux.rho := p / (aux.R * aux.T * g.pi * g.gpi);
+        aux.vt := aux.R / p * (g.pi * g.gpi - g.tau * g.pi * g.gtaupi);
+        aux.vp := aux.R * aux.T / (p * p) * g.pi * g.pi * g.gpipi;
+        aux.cp := -aux.R * g.tau * g.tau * g.gtautau;
+        aux.cv := aux.R * ((-g.tau * g.tau * g.gtautau) + (g.gpi - g.tau * g.gtaupi) * (g.gpi - g.tau * g.gtaupi) / g.gpipi);
+      else
+        assert(false, "error in region computation of IF97 steam tables" + "(p = " + String(p) + ", s = " + String(s) + ")");
+      end if;
+    end waterBaseProp_ps;
+
+    replaceable record iter = ThermoSysPro.Properties.WaterSteam.BaseIF97.IterationData;
+
+    function phase_ph "phase as a function of  pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      output Integer phase "true if in liquid or gas or supercritical region";
+    algorithm
+      phase := if h < hl_p(p) or h > hv_p(p) or p > ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT then 1 else 2;
+      annotation(
+        InlineNoEvent = false);
+    end phase_ph;
+
+    function phase_dT "phase as a function of  pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density rho "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      output Integer phase "true if in liquid or gas or supercritical region";
+    algorithm
+      phase := if not (rho < rhol_T(T) and rho > rhov_T(T) and T < ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TCRIT) then 1 else 2;
+      annotation(
+        InlineNoEvent = false);
+    end phase_dT;
+
+    function rho_props_ph "density as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      output Modelica.Units.SI.Density rho "density";
+    algorithm
+      rho := aux.rho;
+      annotation(
+        derivative(noDerivative = aux) = rho_ph_d,
+        Inline = false,
+        LateInline = true);
+    end rho_props_ph;
+
+    function rho_ph "density as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.Density rho "density";
+    algorithm
+      rho := rho_props_ph(p, h, waterBasePropAnalytic_ph(p, h, phase, region));
+    end rho_ph;
+
+    function rho_ph_d "derivative function of rho_ph"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      input Real p_d "derivative of pressure";
+      input Real h_d "derivative of specific enthalpy";
+      output Real rho_d "derivative of density";
+    algorithm
+      if aux.region == 4 then
+        rho_d := aux.rho * (aux.rho * aux.cv / aux.dpT + 1.0) / (aux.dpT * aux.T) * p_d + (-aux.rho * aux.rho / (aux.dpT * aux.T)) * h_d;
+      elseif aux.region == 3 then
+        rho_d := aux.rho * (aux.cv * aux.rho + aux.pt) / (aux.rho * aux.rho * aux.pd * aux.cv + aux.T * aux.pt * aux.pt) * p_d + (-aux.rho * aux.rho * aux.pt / (aux.rho * aux.rho * aux.pd * aux.cv + aux.T * aux.pt * aux.pt)) * h_d;
+      else
+        rho_d := (-aux.rho * aux.rho * (aux.vp * aux.cp - aux.vt / aux.rho + aux.T * aux.vt * aux.vt) / aux.cp) * p_d + (-aux.rho * aux.rho * aux.vt / aux.cp) * h_d;
+      end if;
+//regions 1,2,5
+      annotation(
+        derivative(noDerivative = aux) = rho_ph_dd);
+    end rho_ph_d;
+
+    function rho_ph_dd "Second order derivative function of rho_ph"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      input Real p_d "derivative of pressure";
+      input Real h_d "derivative of specific enthalpy";
+      input Real p_dd "second derivative of pressure";
+      input Real h_dd "second derivative of specific enthalpy";
+      output Real rho_dd "Second derivative of density";
+    protected
+      Modelica.Units.SI.DerDensityByPressure ddph "Derivative of d by p at constant h";
+      Modelica.Units.SI.DerDensityByEnthalpy ddhp "Derivative of d by h at constant p";
+      Real ddph_ph "Derivative of ddph by p";
+      Real ddph_hp "Derivative of ddph by h";
+      Real ddhp_hp "Derivative of ddhp by h";
+      Real ddhp_ph "Derivative of ddhp by p";
+    algorithm
+      ddph := ddph_props(p, h, aux);
+      ddhp := ddhp_props(p, h, aux);
+      (ddph_ph, ddph_hp) := ddph_ph_dd(p, h, aux);
+      (ddhp_hp, ddhp_ph) := ddhp_ph_dd(p, h, aux);
+      rho_dd := ddph * p_dd + 2.0 * ddhp_ph * p_d * h_d + ddph_ph * p_d * p_d + ddhp_hp * h_d * h_d + ddhp * h_dd;
+    end rho_ph_dd;
+
+    function T_props_ph "temperature as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic properties "auxiliary record";
+      output Modelica.Units.SI.Temperature T "temperature";
+    algorithm
+      T := properties.T;
+      annotation(
+        derivative(noDerivative = properties) = T_ph_der,
+        Inline = false,
+        LateInline = true);
+    end T_props_ph;
+
+    function T_ph "temperature as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.Temperature T "Temperature";
+    algorithm
+      T := T_props_ph(p, h, waterBasePropAnalytic_ph(p, h, phase, region));
+    end T_ph;
+
+    function T_ph_der "derivative function of T_ph"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      input Real p_der "derivative of pressure";
+      input Real h_der "derivative of specific enthalpy";
+      output Real T_der "derivative of temperature";
+    algorithm
+      if aux.region == 4 then
+        T_der := 1 / aux.dpT * p_der;
+      elseif aux.region == 3 then
+        T_der := ((-aux.rho * aux.pd) + aux.T * aux.pt) / (aux.rho * aux.rho * aux.pd * aux.cv + aux.T * aux.pt * aux.pt) * p_der + aux.rho * aux.rho * aux.pd / (aux.rho * aux.rho * aux.pd * aux.cv + aux.T * aux.pt * aux.pt) * h_der;
+      else
+        T_der := ((-1 / aux.rho) + aux.T * aux.vt) / aux.cp * p_der + 1 / aux.cp * h_der;
+      end if;
+//regions 1,2 or 5
+    end T_ph_der;
+
+    function s_props_ph "specific entropy as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic properties "auxiliary record";
+      output Modelica.Units.SI.SpecificEntropy s "specific entropy";
+    algorithm
+      s := properties.s;
+      annotation(
+        derivative(noDerivative = properties) = s_ph_der,
+        Inline = false,
+        LateInline = true);
+    end s_props_ph;
+
+    function s_ph "specific entropy as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.SpecificEntropy s "specific entropy";
+    algorithm
+      s := s_props_ph(p, h, waterBasePropAnalytic_ph(p, h, phase, region));
+    end s_ph;
+
+    function s_ph_der "specific entropy as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      input Real p_der "derivative of pressure";
+      input Real h_der "derivative of specific enthalpy";
+      output Real s_der "derivative of entropy";
+    algorithm
+      s_der := (-1 / (aux.rho * aux.T) * p_der) + 1 / aux.T * h_der;
+    end s_ph_der;
+
+    function cv_props_ph "specific heat capacity at constant volume as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      output Modelica.Units.SI.SpecificHeatCapacity cv "specific heat capacity";
+    algorithm
+      cv := aux.cv;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end cv_props_ph;
+
+    function cv_ph "specific heat capacity at constant volume as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.SpecificHeatCapacity cv "specific heat capacity";
+    algorithm
+      cv := cv_props_ph(p, h, waterBasePropAnalytic_ph(p, h, phase, region));
+    end cv_ph;
+
+    function regionAssertReal "assert function for inlining"
+      extends Modelica.Icons.Function;
+      input Boolean check "condition to check";
+      output Real dummy "dummy output";
+    algorithm
+      assert(check, "this function can not be called with two-phase inputs!");
+    end regionAssertReal;
+
+    function cp_props_ph "specific heat capacity at constant pressure as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      output Modelica.Units.SI.SpecificHeatCapacity cp "specific heat capacity";
+    algorithm
+      cp := aux.cp;
+      annotation(
+        Inline = false,
+        LateInline = true,
+        derivative(noDerivative = aux) = cp_ph_der);
+    end cp_props_ph;
+
+    function cp_ph "specific heat capacity at constant pressure as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.SpecificHeatCapacity cp "specific heat capacity";
+    algorithm
+      cp := cp_props_ph(p, h, waterBasePropAnalytic_ph(p, h, phase, region));
+    end cp_ph;
+
+    function cp_ph_der "derivative function of cp_ph"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      input Real p_der "derivative of pressure";
+      input Real h_der "derivative of specific enthalpy";
+      output Real cp_der "derivative of heat capacity";
+    protected
+      Real detPH "Determinant";
+      Real dht;
+      Real dhd;
+      Real ddhp;
+      Real ddph;
+      Real dtph;
+      Real dthp;
+      Real detPH_d;
+      Real dcp_d;
+    algorithm
+      if aux.region == 4 then
+        cp_der := 0.0;
+      elseif aux.region == 3 then
+        detPH := aux.cp * aux.pd;
+        dht := aux.cv + aux.pt / aux.rho;
+        dhd := (aux.pd - aux.T * aux.pt / aux.rho) / aux.rho;
+        ddph := dht / detPH;
+        ddhp := -aux.pt / detPH;
+        dtph := -dhd / detPH;
+        dthp := aux.pd / detPH;
+        detPH_d := aux.cv * aux.pdd + (2.0 * aux.pt * (aux.ptd - aux.pt / aux.rho) - aux.ptt * aux.pd) * aux.T / (aux.rho * aux.rho);
+        dcp_d := (detPH_d - aux.cp * aux.pdd) / aux.pd;
+        cp_der := (ddph * dcp_d + dtph * aux.cpt) * p_der + (ddhp * dcp_d + dthp * aux.cpt) * h_der;
+      else
+        cp_der := (-(aux.T * aux.vtt * aux.cp + aux.cpt / aux.rho - aux.cpt * aux.T * aux.vt) / aux.cp) * p_der + aux.cpt / aux.cp * h_der;
+      end if;
+//regions 1,2 or 5
+      annotation(
+        Documentation(info = "<html></html>"));
+    end cp_ph_der;
+
+    function beta_props_ph "isobaric expansion coefficient as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      output Modelica.Units.SI.RelativePressureCoefficient beta "isobaric expansion coefficient";
+    algorithm
+      beta := if aux.region == 3 or aux.region == 4 then aux.pt / (aux.rho * aux.pd) else aux.vt * aux.rho;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end beta_props_ph;
+
+    function beta_ph "isobaric expansion coefficient as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.RelativePressureCoefficient beta "isobaric expansion coefficient";
+    algorithm
+      beta := beta_props_ph(p, h, waterBasePropAnalytic_ph(p, h, phase, region));
+    end beta_ph;
+
+    function kappa_props_ph "isothermal compressibility factor as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      output Modelica.Units.SI.IsothermalCompressibility kappa "isothermal compressibility factor";
+    algorithm
+      kappa := if aux.region == 3 or aux.region == 4 then 1 / (aux.rho * aux.pd) else -aux.vp * aux.rho;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end kappa_props_ph;
+
+    function kappa_ph "isothermal compressibility factor as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.IsothermalCompressibility kappa "isothermal compressibility factor";
+    algorithm
+      kappa := kappa_props_ph(p, h, waterBasePropAnalytic_ph(p, h, phase, region));
+    end kappa_ph;
+
+    function velocityOfSound_props_ph "speed of sound as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      output Modelica.Units.SI.Velocity v_sound "speed of sound";
+    algorithm
+// dp/drho at constant s
+      v_sound := if aux.region == 3 then sqrt((aux.pd * aux.rho * aux.rho * aux.cv + aux.pt * aux.pt * aux.T) / (aux.rho * aux.rho * aux.cv)) else if aux.region == 4 then sqrt(1 / (aux.rho * (aux.rho * aux.cv / aux.dpT + 1.0) / (aux.dpT * aux.T) - 1 / aux.rho * aux.rho * aux.rho / (aux.dpT * aux.T))) else sqrt(-aux.cp / (aux.rho * aux.rho * (aux.vp * aux.cp + aux.vt * aux.vt * aux.T)));
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end velocityOfSound_props_ph;
+
+    function velocityOfSound_ph
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.Velocity v_sound "speed of sound";
+    algorithm
+      v_sound := velocityOfSound_props_ph(p, h, waterBasePropAnalytic_ph(p, h, phase, region));
+    end velocityOfSound_ph;
+
+    function isentropicExponent_props_ph "isentropic exponent as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      output Real gamma "isentropic exponent";
+    algorithm
+      gamma := if aux.region == 3 then 1 / (aux.rho * p) * ((aux.pd * aux.cv * aux.rho * aux.rho + aux.pt * aux.pt * aux.T) / aux.cv) else if aux.region == 4 then 1 / (aux.rho * p) * aux.dpT * aux.dpT * aux.T / aux.cv else -1 / (aux.rho * aux.p) * aux.cp / (aux.vp * aux.cp + aux.vt * aux.vt * aux.T);
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end isentropicExponent_props_ph;
+
+    function isentropicExponent_ph "isentropic exponent as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Real gamma "isentropic exponent";
+    algorithm
+      gamma := isentropicExponent_props_ph(p, h, waterBasePropAnalytic_ph(p, h, phase, region));
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end isentropicExponent_ph;
+
+    function ddph_props "density derivative by pressure"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      output Modelica.Units.SI.DerDensityByPressure ddph "density derivative by pressure";
+    algorithm
+      ddph := if aux.region == 3 then aux.rho * (aux.cv * aux.rho + aux.pt) / (aux.rho * aux.rho * aux.pd * aux.cv + aux.T * aux.pt * aux.pt) else if aux.region == 4 then aux.rho * (aux.rho * aux.cv / aux.dpT + 1.0) / (aux.dpT * aux.T) else -aux.rho * aux.rho * (aux.vp * aux.cp - aux.vt / aux.rho + aux.T * aux.vt * aux.vt) / aux.cp;
+      annotation(
+        Inline = false,
+        LateInline = true,
+        derivative(noDerivative = aux) = ddph_ph_der);
+    end ddph_props;
+
+    function ddph "density derivative by pressure"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.DerDensityByPressure ddph "density derivative by pressure";
+    algorithm
+      ddph := ddph_props(p, h, waterBasePropAnalytic_ph(p, h, phase, region));
+    end ddph;
+
+    function ddph_ph_der "derivative function of ddph"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      input Real p_der "derivative of pressure";
+      input Real h_der "derivative of specific enthalpy";
+      output Real ddph_der "Gradient of ddph";
+    protected
+      Modelica.Units.SI.SpecificVolume v = 1 / aux.rho;
+      Real detPH "Determinant";
+      Real dht;
+      Real dhd;
+      Real ddhp;
+      Real ddph;
+      Real dtph;
+      Real dthp;
+      Real detPH_d;
+      Real detPH_t;
+      Real dhtt;
+      Real dhtd;
+      Real ddph_t;
+      Real ddph_d;
+      Real ddhp_t;
+      Real ddhp_d;
+    algorithm
+      if aux.region == 4 then
+        dht := aux.cv + aux.dpT * v;
+        dhd := -aux.T * aux.dpT * v * v;
+        detPH := -aux.dpT * dhd;
+        dtph := 1.0 / aux.dpT;
+        ddph := dht / detPH;
+        ddhp := -aux.dpT / detPH;
+        detPH_t := 2.0 * aux.ptt / aux.dpT + 1.0 / aux.T;
+        detPH_d := -2.0 * v;
+        dhtt := aux.cvt + aux.ptt * v;
+        dhtd := -(aux.T * aux.ptt + aux.dpT) * v * v;
+        ddhp_t := ddhp * (aux.ptt / aux.dpT - detPH_t);
+        ddhp_d := ddhp * (-detPH_d);
+        ddph_t := ddph * (dhtt / dht - detPH_t);
+        ddph_d := ddph * (dhtd / dht - detPH_d);
+        ddph_der := (ddph * ddph_d + dtph * ddph_t) * p_der + ddhp * ddph_d * h_der;
+      else
+        detPH := aux.cp * aux.pd;
+        dht := aux.cv + aux.pt * v;
+        dhd := (aux.pd - aux.T * aux.pt * v) * v;
+        ddph := dht / detPH;
+        ddhp := -aux.pt / detPH;
+        dtph := -dhd / detPH;
+        dthp := aux.pd / detPH;
+        detPH_d := aux.cv * aux.pdd + (2.0 * aux.pt * (aux.ptd - aux.pt * v) - aux.ptt * aux.pd) * aux.T * v * v;
+        detPH_t := aux.cvt * aux.pd + aux.cv * aux.ptd + (aux.pt + 2.0 * aux.T * aux.ptt) * aux.pt * v * v;
+        dhtt := aux.cvt + aux.ptt * v;
+        dhtd := (aux.ptd - (aux.T * aux.ptt + aux.pt) * v) * v;
+        ddph_t := ddph * (dhtt / dht - detPH_t / detPH);
+        ddph_d := ddph * (dhtd / dht - detPH_d / detPH);
+        ddhp_t := ddhp * (aux.ptt / aux.pt - detPH_t / detPH);
+        ddhp_d := ddhp * (aux.ptd / aux.pt - detPH_d / detPH);
+        ddph_der := (ddph * ddph_d + dtph * ddph_t) * p_der + (ddph * ddhp_d + dtph * ddhp_t) * h_der;
+      end if;
+/* = detPH_t / detPH */
+/* = detPH_d / detPH */
+    end ddph_ph_der;
+
+    function ddph_ph_dd "Second derivatives function of density"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      output Real ddph_ph "Second derivative of density by p at constant h";
+      output Real ddph_hp "Second mixed derivative of density by p and h";
+    protected
+      Modelica.Units.SI.SpecificVolume v = 1 / aux.rho;
+      Real detPH "Determinant";
+      Real dht;
+      Real dhd;
+      Real ddhp;
+      Real ddph;
+      Real dtph;
+      Real dthp;
+      Real detPH_d;
+      Real detPH_t;
+      Real dhtt;
+      Real dhtd;
+      Real ddph_t;
+      Real ddph_d;
+      Real ddhp_t;
+      Real ddhp_d;
+    algorithm
+      if aux.region == 4 then
+        dht := aux.cv + aux.dpT * v;
+        dhd := -aux.T * aux.dpT * v * v;
+        detPH := -aux.dpT * dhd;
+        dtph := 1.0 / aux.dpT;
+        ddph := dht / detPH;
+        ddhp := -aux.dpT / detPH;
+        detPH_t := 2.0 * aux.ptt / aux.dpT + 1.0 / aux.T;
+        detPH_d := -2.0 * v;
+        dhtt := aux.cvt + aux.ptt * v;
+        dhtd := -(aux.T * aux.ptt + aux.dpT) * v * v;
+        ddhp_t := ddhp * (aux.ptt / aux.dpT - detPH_t);
+        ddhp_d := ddhp * (-detPH_d);
+        ddph_t := ddph * (dhtt / dht - detPH_t);
+        ddph_d := ddph * (dhtd / dht - detPH_d);
+        ddph_ph := ddph * ddph_d + dtph * ddph_t;
+        ddph_hp := ddhp * ddph_d;
+      else
+        detPH := aux.cp * aux.pd;
+        dht := aux.cv + aux.pt * v;
+        dhd := (aux.pd - aux.T * aux.pt * v) * v;
+        ddph := dht / detPH;
+        ddhp := -aux.pt / detPH;
+        dtph := -dhd / detPH;
+        dthp := aux.pd / detPH;
+        detPH_d := aux.cv * aux.pdd + (2.0 * aux.pt * (aux.ptd - aux.pt * v) - aux.ptt * aux.pd) * aux.T * v * v;
+        detPH_t := aux.cvt * aux.pd + aux.cv * aux.ptd + (aux.pt + 2.0 * aux.T * aux.ptt) * aux.pt * v * v;
+        dhtt := aux.cvt + aux.ptt * v;
+        dhtd := (aux.ptd - (aux.T * aux.ptt + aux.pt) * v) * v;
+        ddph_t := ddph * (dhtt / dht - detPH_t / detPH);
+        ddph_d := ddph * (dhtd / dht - detPH_d / detPH);
+        ddhp_t := ddhp * (aux.ptt / aux.pt - detPH_t / detPH);
+        ddhp_d := ddhp * (aux.ptd / aux.pt - detPH_d / detPH);
+        ddph_ph := ddph * ddph_d + dtph * ddph_t;
+        ddph_hp := ddph * ddhp_d + dtph * ddhp_t;
+      end if;
+/* = detPH_t / detPH */
+/* = detPH_d / detPH */
+    end ddph_ph_dd;
+
+    function ddhp_props "density derivative by specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      output Modelica.Units.SI.DerDensityByEnthalpy ddhp "density derivative by specific enthalpy";
+    algorithm
+      ddhp := if aux.region == 3 then -aux.rho * aux.rho * aux.pt / (aux.rho * aux.rho * aux.pd * aux.cv + aux.T * aux.pt * aux.pt) else if aux.region == 4 then -aux.rho * aux.rho / (aux.dpT * aux.T) else -aux.rho * aux.rho * aux.vt / aux.cp;
+      annotation(
+        Inline = false,
+        LateInline = true,
+        derivative(noDerivative = aux) = ddhp_ph_der);
+    end ddhp_props;
+
+    function ddhp "density derivative by specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.DerDensityByEnthalpy ddhp "density derivative by specific enthalpy";
+    algorithm
+      ddhp := ddhp_props(p, h, waterBasePropAnalytic_ph(p, h, phase, region));
+    end ddhp;
+
+    function ddhp_ph_der "derivative function of ddhp"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      input Real p_der "derivative of pressure";
+      input Real h_der "derivative of specific enthalpy";
+      output Real ddhp_der "Gradient of ddhp";
+    protected
+      Modelica.Units.SI.SpecificVolume v = 1 / aux.rho;
+      Real detPH "Determinant";
+      Real dht;
+      Real dhd;
+      Real ddhp;
+      Real ddph;
+      Real dtph;
+      Real dthp;
+      Real detPH_d;
+      Real detPH_t;
+      Real dhtt;
+      Real dhtd;
+      Real ddhp_d;
+      Real ddhp_t;
+      Real ddph_d;
+    algorithm
+      if aux.region == 4 then
+        dht := aux.cv + aux.dpT * v;
+        dhd := -aux.T * aux.dpT * v * v;
+        detPH := -aux.dpT * dhd;
+        dtph := 1.0 / aux.dpT;
+        ddph := dht / detPH;
+        ddhp := -aux.dpT / detPH;
+        detPH_d := -2.0 * v;
+        dhtt := aux.cvt + aux.ptt * v;
+        dhtd := -(aux.T * aux.ptt + aux.dpT) * v * v;
+        ddhp_d := ddhp * (-detPH_d);
+        ddph_d := ddph * (dhtd / dht - detPH_d);
+        ddhp_der := ddhp * ddhp_d * h_der + ddhp * ddph_d * p_der;
+      else
+        detPH := aux.cp * aux.pd;
+        dht := aux.cv + aux.pt * v;
+        dhd := (aux.pd - aux.T * aux.pt * v) * v;
+        ddph := dht / detPH;
+        ddhp := -aux.pt / detPH;
+        dtph := -dhd / detPH;
+        dthp := aux.pd / detPH;
+        detPH_d := aux.cv * aux.pdd + (2.0 * aux.pt * (aux.ptd - aux.pt * v) - aux.ptt * aux.pd) * aux.T * v * v;
+        detPH_t := aux.cvt * aux.pd + aux.cv * aux.ptd + (aux.pt + 2.0 * aux.T * aux.ptt) * aux.pt * v * v;
+        dhtt := aux.cvt + aux.ptt * v;
+        dhtd := (aux.ptd - (aux.T * aux.ptt + aux.pt) * v) * v;
+        ddhp_t := ddhp * (aux.ptt / aux.pt - detPH_t / detPH);
+        ddhp_d := ddhp * (aux.ptd / aux.pt - detPH_d / detPH);
+        ddhp_der := (ddhp * ddhp_d + dthp * ddhp_t) * h_der + (ddph * ddhp_d + dtph * ddhp_t) * p_der;
+      end if;
+/* = detPH_d / detPH */
+    end ddhp_ph_der;
+
+    function ddhp_ph_dd "Second derivatives of density w.r.t h and p"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      output Real ddhp_hp "Second derivative of density by h at constant p";
+      output Real ddhp_ph "Second mixed derivative of density by p and h";
+    protected
+      Modelica.Units.SI.SpecificVolume v = 1 / aux.rho;
+      Real detPH "Determinant";
+      Real dht;
+      Real dhd;
+      Real ddhp;
+      Real ddph;
+      Real dtph;
+      Real dthp;
+      Real detPH_d;
+      Real detPH_t;
+      Real dhtt;
+      Real dhtd;
+      Real ddhp_d;
+      Real ddhp_t;
+      Real ddph_d;
+    algorithm
+      if aux.region == 4 then
+        dht := aux.cv + aux.dpT * v;
+        dhd := -aux.T * aux.dpT * v * v;
+        detPH := -aux.dpT * dhd;
+        dtph := 1.0 / aux.dpT;
+        ddph := dht / detPH;
+        ddhp := -aux.dpT / detPH;
+        detPH_d := -2.0 * v;
+        dhtt := aux.cvt + aux.ptt * v;
+        dhtd := -(aux.T * aux.ptt + aux.dpT) * v * v;
+        ddhp_d := ddhp * (-detPH_d);
+        ddph_d := ddph * (dhtd / dht - detPH_d);
+        ddhp_hp := ddhp * ddhp_d;
+        ddhp_ph := ddhp * ddph_d;
+      else
+        detPH := aux.cp * aux.pd;
+        dht := aux.cv + aux.pt * v;
+        dhd := (aux.pd - aux.T * aux.pt * v) * v;
+        ddph := dht / detPH;
+        ddhp := -aux.pt / detPH;
+        dtph := -dhd / detPH;
+        dthp := aux.pd / detPH;
+        detPH_d := aux.cv * aux.pdd + (2.0 * aux.pt * (aux.ptd - aux.pt * v) - aux.ptt * aux.pd) * aux.T * v * v;
+        detPH_t := aux.cvt * aux.pd + aux.cv * aux.ptd + (aux.pt + 2.0 * aux.T * aux.ptt) * aux.pt * v * v;
+        dhtt := aux.cvt + aux.ptt * v;
+        dhtd := (aux.ptd - (aux.T * aux.ptt + aux.pt) * v) * v;
+        ddhp_t := ddhp * (aux.ptt / aux.pt - detPH_t / detPH);
+        ddhp_d := ddhp * (aux.ptd / aux.pt - detPH_d / detPH);
+        ddhp_hp := ddhp * ddhp_d + dthp * ddhp_t;
+        ddhp_hp := ddph * ddhp_d + dtph * ddhp_t;
+      end if;
+/* = detPH_d / detPH */
+    end ddhp_ph_dd;
+
+    function rho_props_pT "density as function or pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      output Modelica.Units.SI.Density rho "density";
+    algorithm
+      rho := aux.rho;
+      annotation(
+        derivative(noDerivative = aux) = rho_pT_der,
+        Inline = false,
+        LateInline = true);
+    end rho_props_pT;
+
+    function rho_pT "density as function or pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.Density rho "density";
+    algorithm
+      rho := rho_props_pT(p, T, waterBasePropAnalytic_pT(p, T, region));
+    end rho_pT;
+
+    function h_props_pT "specific enthalpy as function or pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    algorithm
+      h := aux.h;
+      annotation(
+        derivative(noDerivative = aux) = h_pT_der,
+        Inline = false,
+        LateInline = true);
+    end h_props_pT;
+
+    function h_pT "specific enthalpy as function or pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "Temperature";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    algorithm
+      h := h_props_pT(p, T, waterBasePropAnalytic_pT(p, T, region));
+    end h_pT;
+
+    function h_pT_der "derivative function of h_pT"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      input Real p_der "derivative of pressure";
+      input Real T_der "derivative of temperature";
+      output Real h_der "derivative of specific enthalpy";
+    algorithm
+      if aux.region == 3 then
+        h_der := ((-aux.rho * aux.pd) + T * aux.pt) / (aux.rho * aux.rho * aux.pd) * p_der + (aux.rho * aux.rho * aux.pd * aux.cv + aux.T * aux.pt * aux.pt) / (aux.rho * aux.rho * aux.pd) * T_der;
+      else
+        h_der := (1 / aux.rho - aux.T * aux.vt) * p_der + aux.cp * T_der;
+      end if;
+//regions 1,2 or 5
+    end h_pT_der;
+
+    function rho_pT_der "derivative function of rho_pT"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      input Real p_der "derivative of pressure";
+      input Real T_der "derivative of temperature";
+      output Real rho_der "derivative of density";
+    algorithm
+      if aux.region == 3 then
+        rho_der := 1 / aux.pd * p_der - aux.pt / aux.pd * T_der;
+      else
+        rho_der := (-aux.rho * aux.rho * aux.vp) * p_der + (-aux.rho * aux.rho * aux.vt) * T_der;
+      end if;
+//regions 1,2 or 5
+    end rho_pT_der;
+
+    function s_props_pT "specific entropy as function of pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      output Modelica.Units.SI.SpecificEntropy s "specific entropy";
+    algorithm
+      s := aux.s;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end s_props_pT;
+
+    function s_pT "temperature as function of pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.SpecificEntropy s "specific entropy";
+    algorithm
+      s := s_props_pT(p, T, waterBasePropAnalytic_pT(p, T, region));
+      annotation(
+        InlineNoEvent = false);
+    end s_pT;
+
+    function cv_props_pT "specific heat capacity at constant volume as function of pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      output Modelica.Units.SI.SpecificHeatCapacity cv "specific heat capacity";
+    algorithm
+      cv := aux.cv;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end cv_props_pT;
+
+    function cv_pT "specific heat capacity at constant volume as function of pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.SpecificHeatCapacity cv "specific heat capacity";
+    algorithm
+      cv := cv_props_pT(p, T, waterBasePropAnalytic_pT(p, T, region));
+      annotation(
+        InlineNoEvent = false);
+    end cv_pT;
+
+    function cp_props_pT "specific heat capacity at constant pressure as function of pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      output Modelica.Units.SI.SpecificHeatCapacity cp "specific heat capacity";
+    algorithm
+      cp := if aux.region == 3 then (aux.rho * aux.rho * aux.pd * aux.cv + aux.T * aux.pt * aux.pt) / (aux.rho * aux.rho * aux.pd) else aux.cp;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end cp_props_pT;
+
+    function cp_pT "specific heat capacity at constant pressure as function of pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.SpecificHeatCapacity cp "specific heat capacity";
+    algorithm
+      cp := cp_props_pT(p, T, waterBasePropAnalytic_pT(p, T, region));
+      annotation(
+        InlineNoEvent = false);
+    end cp_pT;
+
+    function beta_props_pT "isobaric expansion coefficient as function of pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      output Modelica.Units.SI.RelativePressureCoefficient beta "isobaric expansion coefficient";
+    algorithm
+      beta := if aux.region == 3 then aux.pt / (aux.rho * aux.pd) else aux.vt * aux.rho;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end beta_props_pT;
+
+    function beta_pT "isobaric expansion coefficient as function of pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.RelativePressureCoefficient beta "isobaric expansion coefficient";
+    algorithm
+      beta := beta_props_pT(p, T, waterBasePropAnalytic_pT(p, T, region));
+      annotation(
+        InlineNoEvent = false);
+    end beta_pT;
+
+    function kappa_props_pT "isothermal compressibility factor as function of pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      output Modelica.Units.SI.IsothermalCompressibility kappa "isothermal compressibility factor";
+    algorithm
+      kappa := if aux.region == 3 then 1 / (aux.rho * aux.pd) else -aux.vp * aux.rho;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end kappa_props_pT;
+
+    function kappa_pT "isothermal compressibility factor as function of pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.IsothermalCompressibility kappa "isothermal compressibility factor";
+    algorithm
+      kappa := kappa_props_pT(p, T, waterBasePropAnalytic_pT(p, T, region));
+      annotation(
+        InlineNoEvent = false);
+    end kappa_pT;
+
+    function velocityOfSound_props_pT "speed of sound as function of pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      output Modelica.Units.SI.Velocity v_sound "speed of sound";
+    algorithm
+// dp/drho at constant s
+      v_sound := if aux.region == 3 then sqrt((aux.pd * aux.rho * aux.rho * aux.cv + aux.pt * aux.pt * aux.T) / (aux.rho * aux.rho * aux.cv)) else sqrt(-aux.cp / (aux.rho * aux.rho * (aux.vp * aux.cp + aux.vt * aux.vt * aux.T)));
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end velocityOfSound_props_pT;
+
+    function velocityOfSound_pT "speed of sound as function of pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.Velocity v_sound "speed of sound";
+    algorithm
+      v_sound := velocityOfSound_props_pT(p, T, waterBasePropAnalytic_pT(p, T, region));
+    end velocityOfSound_pT;
+
+    function isentropicExponent_props_pT "isentropic exponent as function of pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      output Real gamma "isentropic exponent";
+    algorithm
+      gamma := if aux.region == 3 then 1 / (aux.rho * p) * ((aux.pd * aux.cv * aux.rho * aux.rho + aux.pt * aux.pt * aux.T) / aux.cv) else -1 / (aux.rho * aux.p) * aux.cp / (aux.vp * aux.cp + aux.vt * aux.vt * aux.T);
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end isentropicExponent_props_pT;
+
+    function isentropicExponent_pT "isentropic exponent as function of pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Real gamma "isentropic exponent";
+    algorithm
+      gamma := isentropicExponent_props_pT(p, T, waterBasePropAnalytic_pT(p, T, region));
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end isentropicExponent_pT;
+
+    function h_props_dT "specific enthalpy as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "Temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    algorithm
+      h := aux.h;
+      annotation(
+        derivative(noDerivative = aux) = h_dT_der,
+        Inline = false,
+        LateInline = true);
+    end h_props_dT;
+
+    function h_dT "specific enthalpy as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "Temperature";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    algorithm
+      h := h_props_dT(d, T, waterBasePropAnalytic_dT(d, T, phase, region));
+    end h_dT;
+
+    function h_dT_der "derivative function of h_dT"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      input Real d_der "derivative of density";
+      input Real T_der "derivative of temperature";
+      output Real h_der "derivative of specific enthalpy";
+    algorithm
+      if aux.region == 3 then
+        h_der := ((-d * aux.pd) + T * aux.pt) / (d * d) * d_der + (aux.cv * d + aux.pt) / d * T_der;
+      elseif aux.region == 4 then
+        h_der := T * aux.dpT / (d * d) * d_der + (aux.cv * d + aux.dpT) / d * T_der;
+      else
+        h_der := (-((-1 / d) + T * aux.vt) / (d * d * aux.vp)) * d_der + (aux.vp * aux.cp - aux.vt / d + T * aux.vt * aux.vt) / aux.vp * T_der;
+      end if;
+//regions 1,2 or 5
+    end h_dT_der;
+
+    function p_props_dT "pressure as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "Temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      output Modelica.Units.SI.Pressure p "pressure";
+    algorithm
+      p := aux.p;
+      annotation(
+        derivative(noDerivative = aux) = p_dT_der,
+        Inline = false,
+        LateInline = true);
+    end p_props_dT;
+
+    function p_dT "pressure as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "Temperature";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.Pressure p "pressure";
+    algorithm
+      p := p_props_dT(d, T, waterBasePropAnalytic_dT(d, T, phase, region));
+    end p_dT;
+
+    function p_dT_der "derivative function of p_dT"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      input Real d_der "derivative of density";
+      input Real T_der "derivative of temperature";
+      output Real p_der "derivative of pressure";
+    algorithm
+      if aux.region == 3 then
+        p_der := aux.pd * d_der + aux.pt * T_der;
+      elseif aux.region == 4 then
+        p_der := aux.dpT * T_der;
+      else
+        p_der := (-1 / (d * d * aux.vp)) * d_der + (-aux.vt / aux.vp) * T_der;
+      end if;
+/*density derivative is 0.0*/
+//regions 1,2 or 5
+    end p_dT_der;
+
+    function s_props_dT "specific entropy as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "Temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      output Modelica.Units.SI.SpecificEntropy s "specific entropy";
+    algorithm
+      s := aux.s;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end s_props_dT;
+
+    function s_dT "temperature as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "Temperature";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.SpecificEntropy s "specific entropy";
+    algorithm
+      s := s_props_dT(d, T, waterBasePropAnalytic_dT(d, T, phase, region));
+    end s_dT;
+
+    function cv_props_dT "specific heat capacity at constant volume as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      output Modelica.Units.SI.SpecificHeatCapacity cv "specific heat capacity";
+    algorithm
+      cv := aux.cv;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end cv_props_dT;
+
+    function cv_dT "specific heat capacity at constant volume as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.SpecificHeatCapacity cv "specific heat capacity";
+    algorithm
+      cv := cv_props_dT(d, T, waterBasePropAnalytic_dT(d, T, phase, region));
+    end cv_dT;
+
+    function cp_props_dT "specific heat capacity at constant pressure as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      output Modelica.Units.SI.SpecificHeatCapacity cp "specific heat capacity";
+    algorithm
+      cp := aux.cp;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end cp_props_dT;
+
+    function cp_dT "specific heat capacity at constant pressure as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.SpecificHeatCapacity cp "specific heat capacity";
+    algorithm
+      cp := cp_props_dT(d, T, waterBasePropAnalytic_dT(d, T, phase, region));
+    end cp_dT;
+
+    function beta_props_dT "isobaric expansion coefficient as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      output Modelica.Units.SI.RelativePressureCoefficient beta "isobaric expansion coefficient";
+    algorithm
+      beta := if aux.region == 3 or aux.region == 4 then aux.pt / (aux.rho * aux.pd) else aux.vt * aux.rho;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end beta_props_dT;
+
+    function beta_dT "isobaric expansion coefficient as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.RelativePressureCoefficient beta "isobaric expansion coefficient";
+    algorithm
+      beta := beta_props_dT(d, T, waterBasePropAnalytic_dT(d, T, phase, region));
+    end beta_dT;
+
+    function kappa_props_dT "isothermal compressibility factor as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      output Modelica.Units.SI.IsothermalCompressibility kappa "isothermal compressibility factor";
+    algorithm
+      kappa := if aux.region == 3 or aux.region == 4 then 1 / (aux.rho * aux.pd) else -aux.vp * aux.rho;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end kappa_props_dT;
+
+    function kappa_dT "isothermal compressibility factor as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.IsothermalCompressibility kappa "isothermal compressibility factor";
+    algorithm
+      kappa := kappa_props_dT(d, T, waterBasePropAnalytic_dT(d, T, phase, region));
+    end kappa_dT;
+
+    function velocityOfSound_props_dT "speed of sound as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      output Modelica.Units.SI.Velocity v_sound "speed of sound";
+    algorithm
+// dp/drho at constant s
+      v_sound := if aux.region == 3 then sqrt((aux.pd * aux.rho * aux.rho * aux.cv + aux.pt * aux.pt * aux.T) / (aux.rho * aux.rho * aux.cv)) else if aux.region == 4 then sqrt(1 / (aux.rho * (aux.rho * aux.cv / aux.dpT + 1.0) / (aux.dpT * aux.T) - 1 / aux.rho * aux.rho * aux.rho / (aux.dpT * aux.T))) else sqrt(-aux.cp / (aux.rho * aux.rho * (aux.vp * aux.cp + aux.vt * aux.vt * aux.T)));
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end velocityOfSound_props_dT;
+
+    function velocityOfSound_dT "speed of sound as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.Velocity v_sound "speed of sound";
+    algorithm
+      v_sound := velocityOfSound_props_dT(d, T, waterBasePropAnalytic_dT(d, T, phase, region));
+    end velocityOfSound_dT;
+
+    function isentropicExponent_props_dT "isentropic exponent as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      output Real gamma "isentropic exponent";
+    algorithm
+      gamma := if aux.region == 3 then 1 / (aux.rho * aux.p) * ((aux.pd * aux.cv * aux.rho * aux.rho + aux.pt * aux.pt * aux.T) / aux.cv) else if aux.region == 4 then 1 / (aux.rho * aux.p) * aux.dpT * aux.dpT * aux.T / aux.cv else -1 / (aux.rho * aux.p) * aux.cp / (aux.vp * aux.cp + aux.vt * aux.vt * aux.T);
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end isentropicExponent_props_dT;
+
+    function isentropicExponent_dT "isentropic exponent as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Real gamma "isentropic exponent";
+    algorithm
+      gamma := isentropicExponent_props_dT(d, T, waterBasePropAnalytic_dT(d, T, phase, region));
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end isentropicExponent_dT;
+  public
+    function hl_p = ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hl_p "compute the saturated liquid specific h(p)";
+    function hv_p = ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hv_p "compute the saturated vapour specific h(p)";
+    function sl_p = ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.sl_p "compute the saturated liquid specific s(p)";
+    function sv_p = ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.sv_p "compute the saturated vapour specific s(p)";
+    function rhol_T = ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.rhol_T "compute the saturated liquid d(T)";
+    function rhov_T = ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.rhov_T "compute the saturated vapour d(T)";
+    function rhol_p = ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.rhol_p "compute the saturated liquid d(p)";
+    function rhov_p = ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.rhov_p "compute the saturated vapour d(p)";
+    function dynamicViscosity = ThermoSysPro.Properties.WaterSteam.BaseIF97.Transport.visc_dT "compute eta(d,T) in the one-phase region";
+    function thermalConductivity = ThermoSysPro.Properties.WaterSteam.BaseIF97.Transport.cond_industrial_dT "compute lambda(d,T) in the one-phase region";
+    function surfaceTension = ThermoSysPro.Properties.WaterSteam.BaseIF97.Transport.surfaceTension "compute sigma(T) at saturation T";
+    //   function isentropicEnthalpy
+    //     "isentropic specific enthalpy from p,s (preferably use dynamicIsentropicEnthalpy in dynamic simulation!)"
+    //     extends Modelica.Icons.Function;
+    //     input SI.Pressure p "pressure";
+    //     input SI.SpecificEntropy s "specific entropy";
+    //     input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+    //     output SI.SpecificEnthalpy h "specific enthalpy";
+    //   algorithm
+    //    h := BaseIF97.Isentropic.water_hisentropic(p,s,phase);
+    //   end isentropicEnthalpy;
+
+    function isentropicEnthalpy "isentropic specific enthalpy from p,s (preferably use dynamicIsentropicEnthalpy in dynamic simulation!)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    algorithm
+      h := isentropicEnthalpy_props(p, s, waterBaseProp_ps(p, s, phase, region));
+    end isentropicEnthalpy;
+
+    function isentropicEnthalpy_props
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      output Modelica.Units.SI.SpecificEnthalpy h "isentropic enthalpay";
+    algorithm
+      h := aux.h;
+      annotation(
+        derivative(noDerivative = aux) = isentropicEnthalpy_der,
+        Inline = false,
+        LateInline = true);
+    end isentropicEnthalpy_props;
+
+    function isentropicEnthalpy_der "derivative of isentropic specific enthalpy from p,s"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      input Real p_der "pressure derivative";
+      input Real s_der "entropy derivative";
+      output Real h_der "specific enthalpy derivative";
+    algorithm
+      h_der := 1 / aux.rho * p_der + aux.T * s_der;
+    end isentropicEnthalpy_der;
+
+    function dynamicIsentropicEnthalpy "isentropic specific enthalpy from p,s and good guesses of d and T"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      input Modelica.Units.SI.Density dguess "good guess density, e.g. from adjacent volume";
+      input Modelica.Units.SI.Temperature Tguess "good guess temperature, e.g. from adjacent volume";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    algorithm
+      h := ThermoSysPro.Properties.WaterSteam.BaseIF97.Isentropic.water_hisentropic_dyn(p, s, dguess, Tguess, 0);
+    end dynamicIsentropicEnthalpy;
+    annotation(
+      Icon(graphics = {Text(extent = {{-102, 0}, {24, -26}}, lineColor = {242, 148, 0}, textString = "Thermo"), Text(extent = {{-4, 8}, {68, -34}}, lineColor = {46, 170, 220}, textString = "SysPro"), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-32, 12}, {-16, 14}, {6, 14}, {26, 12}, {42, 8}, {52, 2}, {42, 6}, {28, 10}, {6, 12}, {-12, 12}, {-16, 12}, {-34, 10}, {-50, 6}, {-62, 2}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-44, 38}, {-24, 38}, {-26, 30}, {-26, 22}, {-24, 14}, {-24, 12}, {-46, 8}, {-42, 22}, {-42, 30}, {-44, 38}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-26, 20}, {-20, 20}, {-20, 22}, {-14, 22}, {-14, 20}, {-12, 20}, {-12, 12}, {-26, 12}, {-28, 12}, {-26, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-8, 14}, {-8, 24}, {-6, 24}, {-6, 14}, {-8, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 30}, {-6, 26}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 36}, {-6, 32}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 42}, {-6, 38}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 48}, {-6, 44}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-4, 14}, {-4, 26}, {-2, 26}, {-2, 14}, {-4, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 32}, {-2, 28}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 38}, {-2, 34}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 44}, {-2, 40}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 50}, {-2, 46}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-2, 20}, {8, 20}, {8, 22}, {10, 22}, {18, 22}, {18, 12}, {-4, 14}, {-2, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-36, 10}, {-18, 12}, {6, 12}, {26, 10}, {42, 6}, {52, 0}, {42, 4}, {28, 8}, {6, 10}, {-12, 10}, {-18, 10}, {-38, 8}, {-50, 6}, {-62, 2}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Line(points = {{22, 12}, {22, 14}, {22, 16}, {24, 14}, {20, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{26, 12}, {26, 14}, {26, 16}, {28, 14}, {24, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{30, 10}, {30, 12}, {30, 14}, {32, 12}, {28, 16}}, color = {46, 170, 220}, thickness = 0.5), Polygon(points = {{36, 8}, {36, 30}, {34, 34}, {36, 38}, {40, 38}, {40, 8}, {36, 8}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 80}, {80, -100}}, lineColor = {0, 0, 255}), Line(points = {{-100, 80}, {-80, 100}, {100, 100}, {100, -80}, {80, -100}}, color = {0, 0, 255}, smooth = Smooth.None), Line(points = {{80, 80}, {100, 100}}, color = {0, 0, 255}, smooth = Smooth.None)}));
+  end AnalyticDerivatives;
+
+  package Standard "Standard version without Anaytic Jacobians"
+    import ThermoSysPro.Properties.WaterSteam.BaseIF97.*;
+    replaceable record iter = ThermoSysPro.Properties.WaterSteam.BaseIF97.IterationData;
+
+    function waterBaseProp_ph "intermediate property record for water"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Integer phase = 0 "phase: 2 for two-phase, 1 for one phase, 0 if unknown";
+      input Integer region = 0 "if 0, do region computation, otherwise assume the region is this input";
+      output ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+    protected
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs g "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs f "dimensionless Helmholtz funcion and dervatives wrt delta and tau";
+      Integer error "error flag for inverse iterations";
+      Modelica.Units.SI.SpecificEnthalpy h_liq "liquid specific enthalpy";
+      Modelica.Units.SI.Density d_liq "liquid density";
+      Modelica.Units.SI.SpecificEnthalpy h_vap "vapour specific enthalpy";
+      Modelica.Units.SI.Density d_vap "vapour density";
+      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties liq "phase boundary property record";
+      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties vap "phase boundary property record";
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs gl "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs gv "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      Modelica.Media.Common.HelmholtzDerivs fl "dimensionless Helmholtz function and dervatives wrt delta and tau";
+      Modelica.Media.Common.HelmholtzDerivs fv "dimensionless Helmholtz function and dervatives wrt delta and tau";
+      Modelica.Units.SI.Temperature t1 "temperature at phase boundary, using inverse from region 1";
+      Modelica.Units.SI.Temperature t2 "temperature at phase boundary, using inverse from region 2";
+    algorithm
+      aux.region := if region == 0 then if phase == 2 then 4 else ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_ph(p = p, h = h, phase = phase) else region;
+      aux.phase := if phase <> 0 then phase else if aux.region == 4 then 2 else 1;
+      aux.p := max(p, 611.657);
+      aux.h := max(h, 1e3);
+      aux.R := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
+      if aux.region == 1 then
+        aux.T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tph1(aux.p, aux.h);
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(p, aux.T);
+        aux.s := aux.R * (g.tau * g.gtau - g.g);
+        aux.rho := p / (aux.R * aux.T * g.pi * g.gpi);
+        aux.vt := aux.R / p * (g.pi * g.gpi - g.tau * g.pi * g.gtaupi);
+        aux.vp := aux.R * aux.T / (p * p) * g.pi * g.pi * g.gpipi;
+        aux.cp := -aux.R * g.tau * g.tau * g.gtautau;
+        aux.cv := aux.R * ((-g.tau * g.tau * g.gtautau) + (g.gpi - g.tau * g.gtaupi) * (g.gpi - g.tau * g.gtaupi) / g.gpipi);
+        aux.x := 0.0;
+        aux.dpT := -aux.vt / aux.vp;
+      elseif aux.region == 2 then
+        aux.T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tph2(aux.p, aux.h);
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(p, aux.T);
+        aux.s := aux.R * (g.tau * g.gtau - g.g);
+        aux.rho := p / (aux.R * aux.T * g.pi * g.gpi);
+        aux.vt := aux.R / p * (g.pi * g.gpi - g.tau * g.pi * g.gtaupi);
+        aux.vp := aux.R * aux.T / (p * p) * g.pi * g.pi * g.gpipi;
+        aux.cp := -aux.R * g.tau * g.tau * g.gtautau;
+        aux.cv := aux.R * ((-g.tau * g.tau * g.gtautau) + (g.gpi - g.tau * g.gtaupi) * (g.gpi - g.tau * g.gtaupi) / g.gpipi);
+        aux.x := 1.0;
+        aux.dpT := -aux.vt / aux.vp;
+      elseif aux.region == 3 then
+        (aux.rho, aux.T, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.dtofph3(p = aux.p, h = aux.h, delp = 1.0e-7, delh = 1.0e-6);
+        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(aux.rho, aux.T);
+        aux.h := aux.R * aux.T * (f.tau * f.ftau + f.delta * f.fdelta);
+        aux.s := aux.R * (f.tau * f.ftau - f.f);
+        aux.pd := aux.R * aux.T * f.delta * (2.0 * f.fdelta + f.delta * f.fdeltadelta);
+        aux.pt := aux.R * aux.rho * f.delta * (f.fdelta - f.tau * f.fdeltatau);
+        aux.cv := abs(aux.R * (-f.tau * f.tau * f.ftautau)) "can be close to neg. infinity near critical point";
+        aux.cp := (aux.rho * aux.rho * aux.pd * aux.cv + aux.T * aux.pt * aux.pt) / (aux.rho * aux.rho * aux.pd);
+        aux.x := 0.0;
+        aux.dpT := aux.pt;
+      elseif aux.region == 4 then
+        h_liq := hl_p(p);
+        h_vap := hv_p(p);
+        aux.x := if h_vap <> h_liq then (h - h_liq) / (h_vap - h_liq) else 1.0;
+        if p < ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PLIMIT4A then
+          t1 := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tph1(aux.p, h_liq);
+          t2 := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tph2(aux.p, h_vap);
+          gl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(aux.p, t1);
+          gv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(aux.p, t2);
+          liq := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps(gl);
+          vap := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps(gv);
+          aux.T := t1 + aux.x * (t2 - t1);
+        else
+          aux.T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tsat(aux.p);
+          d_liq := rhol_T(aux.T);
+          d_vap := rhov_T(aux.T);
+          fl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(d_liq, aux.T);
+          fv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(d_vap, aux.T);
+          liq := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps(fl);
+          vap := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps(fv);
+        end if;
+        aux.dpT := if liq.d <> vap.d then (vap.s - liq.s) * liq.d * vap.d / (liq.d - vap.d) else ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.dptofT(aux.T);
+        aux.s := liq.s + aux.x * (vap.s - liq.s);
+        aux.rho := liq.d * vap.d / (vap.d + aux.x * (liq.d - vap.d));
+        aux.cv := ThermoSysPro.Properties.WaterSteam.Common.cv2Phase(liq, vap, aux.x, aux.T, p);
+        aux.cp := liq.cp + aux.x * (vap.cp - liq.cp);
+        aux.pt := liq.pt + aux.x * (vap.pt - liq.pt);
+        aux.pd := liq.pd + aux.x * (vap.pd - liq.pd);
+      elseif aux.region == 5 then
+        (aux.T, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.tofph5(p = aux.p, h = aux.h, reldh = 1.0e-7);
+        assert(error == 0, "error in inverse iteration of steam tables");
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g5(aux.p, aux.T);
+        aux.s := aux.R * (g.tau * g.gtau - g.g);
+        aux.rho := p / (aux.R * aux.T * g.pi * g.gpi);
+        aux.vt := aux.R / p * (g.pi * g.gpi - g.tau * g.pi * g.gtaupi);
+        aux.vp := aux.R * aux.T / (p * p) * g.pi * g.pi * g.gpipi;
+        aux.cp := -aux.R * g.tau * g.tau * g.gtautau;
+        aux.cv := aux.R * ((-g.tau * g.tau * g.gtautau) + (g.gpi - g.tau * g.gtaupi) * (g.gpi - g.tau * g.gtaupi) / g.gpipi);
+        aux.dpT := -aux.vt / aux.vp;
+      else
+        assert(false, "error in region computation of IF97 steam tables" + "(p = " + String(p) + ", h = " + String(h) + ")");
+      end if;
+/*safety against div-by-0 in initialization*/
+// how to avoid ?
+    end waterBaseProp_ph;
+
+    function waterBaseProp_ps "intermediate property record for water"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      input Integer phase = 0 "phase: 2 for two-phase, 1 for one phase, 0 if unknown";
+      input Integer region = 0 "if 0, do region computation, otherwise assume the region is this input";
+      output ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+    protected
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs g "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs f "dimensionless Helmholtz funcion and dervatives wrt delta and tau";
+      Integer error "error flag for inverse iterations";
+      Modelica.Units.SI.SpecificEntropy s_liq "liquid specific entropy";
+      Modelica.Units.SI.Density d_liq "liquid density";
+      Modelica.Units.SI.SpecificEntropy s_vap "vapour specific entropy";
+      Modelica.Units.SI.Density d_vap "vapour density";
+      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties liq "phase boundary property record";
+      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties vap "phase boundary property record";
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs gl "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs gv "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      Modelica.Media.Common.HelmholtzDerivs fl "dimensionless Helmholtz function and dervatives wrt delta and tau";
+      Modelica.Media.Common.HelmholtzDerivs fv "dimensionless Helmholtz function and dervatives wrt delta and tau";
+      Modelica.Units.SI.Temperature t1 "temperature at phase boundary, using inverse from region 1";
+      Modelica.Units.SI.Temperature t2 "temperature at phase boundary, using inverse from region 2";
+    algorithm
+      aux.region := if region == 0 then if phase == 2 then 4 else ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_ps(p = p, s = s, phase = phase) else region;
+      aux.phase := if phase <> 0 then phase else if aux.region == 4 then 2 else 1;
+      aux.p := p;
+      aux.s := s;
+      aux.R := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
+      if aux.region == 1 then
+        aux.T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tps1(p, s);
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(p, aux.T);
+        aux.h := aux.R * aux.T * g.tau * g.gtau;
+        aux.rho := p / (aux.R * aux.T * g.pi * g.gpi);
+        aux.vt := aux.R / p * (g.pi * g.gpi - g.tau * g.pi * g.gtaupi);
+        aux.vp := aux.R * aux.T / (p * p) * g.pi * g.pi * g.gpipi;
+        aux.cp := -aux.R * g.tau * g.tau * g.gtautau;
+        aux.cv := aux.R * ((-g.tau * g.tau * g.gtautau) + (g.gpi - g.tau * g.gtaupi) * (g.gpi - g.tau * g.gtaupi) / g.gpipi);
+        aux.x := 0.0;
+      elseif aux.region == 2 then
+        aux.T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tps2(p, s);
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(p, aux.T);
+        aux.h := aux.R * aux.T * g.tau * g.gtau;
+        aux.rho := p / (aux.R * aux.T * g.pi * g.gpi);
+        aux.vt := aux.R / p * (g.pi * g.gpi - g.tau * g.pi * g.gtaupi);
+        aux.vp := aux.R * aux.T / (p * p) * g.pi * g.pi * g.gpipi;
+        aux.cp := -aux.R * g.tau * g.tau * g.gtautau;
+        aux.cv := aux.R * ((-g.tau * g.tau * g.gtautau) + (g.gpi - g.tau * g.gtaupi) * (g.gpi - g.tau * g.gtaupi) / g.gpipi);
+        aux.x := 1.0;
+      elseif aux.region == 3 then
+        (aux.rho, aux.T, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.dtofps3(p = p, s = s, delp = 1.0e-7, dels = 1.0e-6);
+        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(aux.rho, aux.T);
+        aux.h := aux.R * aux.T * (f.tau * f.ftau + f.delta * f.fdelta);
+        aux.s := aux.R * (f.tau * f.ftau - f.f);
+        aux.pd := aux.R * aux.T * f.delta * (2.0 * f.fdelta + f.delta * f.fdeltadelta);
+        aux.pt := aux.R * aux.rho * f.delta * (f.fdelta - f.tau * f.fdeltatau);
+        aux.cv := aux.R * (-f.tau * f.tau * f.ftautau);
+        aux.cp := (aux.rho * aux.rho * aux.pd * aux.cv + aux.T * aux.pt * aux.pt) / (aux.rho * aux.rho * aux.pd);
+        aux.x := 0.0;
+      elseif aux.region == 4 then
+        s_liq := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.sl_p(p);
+        s_vap := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.sv_p(p);
+        aux.x := if s_vap <> s_liq then (s - s_liq) / (s_vap - s_liq) else 1.0;
+        if p < ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PLIMIT4A then
+          t1 := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tps1(p, s_liq);
+          t2 := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tps2(p, s_vap);
+          gl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(p, t1);
+          gv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(p, t2);
+          liq := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps(gl);
+          vap := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps(gv);
+          aux.T := t1 + aux.x * (t2 - t1);
+        else
+          aux.T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tsat(p);
+          d_liq := rhol_T(aux.T);
+          d_vap := rhov_T(aux.T);
+          fl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(d_liq, aux.T);
+          fv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(d_vap, aux.T);
+          liq := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps(fl);
+          vap := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps(fv);
+        end if;
+        aux.dpT := if liq.d <> vap.d then (vap.s - liq.s) * liq.d * vap.d / (liq.d - vap.d) else ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.dptofT(aux.T);
+        aux.h := liq.h + aux.x * (vap.h - liq.h);
+        aux.rho := liq.d * vap.d / (vap.d + aux.x * (liq.d - vap.d));
+        aux.cv := ThermoSysPro.Properties.WaterSteam.Common.cv2Phase(liq, vap, aux.x, aux.T, p);
+        aux.cp := liq.cp + aux.x * (vap.cp - liq.cp);
+        aux.pt := liq.pt + aux.x * (vap.pt - liq.pt);
+        aux.pd := liq.pd + aux.x * (vap.pd - liq.pd);
+      elseif aux.region == 5 then
+        (aux.T, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.tofps5(p = p, s = s, relds = 1.0e-7);
+        assert(error == 0, "error in inverse iteration of steam tables");
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g5(p, aux.T);
+        aux.h := aux.R * aux.T * g.tau * g.gtau;
+        aux.rho := p / (aux.R * aux.T * g.pi * g.gpi);
+        aux.vt := aux.R / p * (g.pi * g.gpi - g.tau * g.pi * g.gtaupi);
+        aux.vp := aux.R * aux.T / (p * p) * g.pi * g.pi * g.gpipi;
+        aux.cp := -aux.R * g.tau * g.tau * g.gtautau;
+        aux.cv := aux.R * ((-g.tau * g.tau * g.gtautau) + (g.gpi - g.tau * g.gtaupi) * (g.gpi - g.tau * g.gtaupi) / g.gpipi);
+      else
+        assert(false, "error in region computation of IF97 steam tables" + "(p = " + String(p) + ", s = " + String(s) + ")");
+      end if;
+    end waterBaseProp_ps;
+
+    function rho_props_ps "density as function of pressure and specific entropy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase properties "auxiliary record";
+      output Modelica.Units.SI.Density rho "density";
+    algorithm
+      rho := properties.rho;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end rho_props_ps;
+
+    function rho_ps "density as function of pressure and specific entropy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.Density rho "density";
+    algorithm
+      rho := rho_props_ps(p, s, waterBaseProp_ps(p, s, phase, region));
+    end rho_ps;
+
+    function T_props_ps "temperature as function of pressure and specific entropy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase properties "auxiliary record";
+      output Modelica.Units.SI.Temperature T "temperature";
+    algorithm
+      T := properties.T;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end T_props_ps;
+
+    function T_ps "temperature as function of pressure and specific entropy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.Temperature T "Temperature";
+    algorithm
+      T := T_props_ps(p, s, waterBaseProp_ps(p, s, phase, region));
+    end T_ps;
+
+    function h_props_ps "specific enthalpy as function or pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    algorithm
+      h := aux.h;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end h_props_ps;
+
+    function h_ps "specific enthalpy as function or pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    algorithm
+      h := h_props_ps(p, s, waterBaseProp_ps(p, s, phase, region));
+    end h_ps;
+
+    function phase_ps "phase as a function of  pressure and specific entropy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      output Integer phase "true if in liquid or gas or supercritical region";
+    algorithm
+      phase := if s < sl_p(p) or s > sv_p(p) or p > ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT then 1 else 2;
+      annotation(
+        InlineNoEvent = false);
+    end phase_ps;
+
+    function phase_ph "phase as a function of  pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      output Integer phase "true if in liquid or gas or supercritical region";
+    algorithm
+      phase := if h < hl_p(p) or h > hv_p(p) or p > ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT then 1 else 2;
+      annotation(
+        InlineNoEvent = false);
+    end phase_ph;
+
+    function phase_dT "phase as a function of  pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density rho "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      output Integer phase "true if in liquid or gas or supercritical region";
+    algorithm
+      phase := if not (rho < rhol_T(T) and rho > rhov_T(T) and T < ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TCRIT) then 1 else 2;
+      annotation(
+        InlineNoEvent = false);
+    end phase_dT;
+
+    function rho_props_ph "density as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase properties "auxiliary record";
+      output Modelica.Units.SI.Density rho "density";
+    algorithm
+      rho := properties.rho;
+      annotation(
+        derivative(noDerivative = properties) = rho_ph_der,
+        Inline = false,
+        LateInline = true);
+    end rho_props_ph;
+
+    function rho_ph "density as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.Density rho "density";
+    algorithm
+      rho := rho_props_ph(p, h, waterBaseProp_ph(p, h, phase, region));
+    end rho_ph;
+
+    function rho_ph_der "derivative function of rho_ph"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      input Real p_der "derivative of pressure";
+      input Real h_der "derivative of specific enthalpy";
+      output Real rho_der "derivative of density";
+    algorithm
+      if aux.region == 4 then
+        rho_der := aux.rho * (aux.rho * aux.cv / aux.dpT + 1.0) / (aux.dpT * aux.T) * p_der + (-aux.rho * aux.rho / (aux.dpT * aux.T)) * h_der;
+      elseif aux.region == 3 then
+        rho_der := aux.rho * (aux.cv * aux.rho + aux.pt) / (aux.rho * aux.rho * aux.pd * aux.cv + aux.T * aux.pt * aux.pt) * p_der + (-aux.rho * aux.rho * aux.pt / (aux.rho * aux.rho * aux.pd * aux.cv + aux.T * aux.pt * aux.pt)) * h_der;
+      else
+        rho_der := (-aux.rho * aux.rho * (aux.vp * aux.cp - aux.vt / aux.rho + aux.T * aux.vt * aux.vt) / aux.cp) * p_der + (-aux.rho * aux.rho * aux.vt / aux.cp) * h_der;
+      end if;
+//regions 1,2,5
+    end rho_ph_der;
+
+    function T_props_ph "temperature as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase properties "auxiliary record";
+      output Modelica.Units.SI.Temperature T "temperature";
+    algorithm
+      T := properties.T;
+      annotation(
+        derivative(noDerivative = properties) = T_ph_der,
+        Inline = false,
+        LateInline = true);
+    end T_props_ph;
+
+    function T_ph "temperature as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.Temperature T "Temperature";
+    algorithm
+      T := T_props_ph(p, h, waterBaseProp_ph(p, h, phase, region));
+    end T_ph;
+
+    function T_ph_der "derivative function of T_ph"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      input Real p_der "derivative of pressure";
+      input Real h_der "derivative of specific enthalpy";
+      output Real T_der "derivative of temperature";
+    algorithm
+      if aux.region == 4 then
+        T_der := 1 / aux.dpT * p_der;
+      elseif aux.region == 3 then
+        T_der := ((-aux.rho * aux.pd) + aux.T * aux.pt) / (aux.rho * aux.rho * aux.pd * aux.cv + aux.T * aux.pt * aux.pt) * p_der + aux.rho * aux.rho * aux.pd / (aux.rho * aux.rho * aux.pd * aux.cv + aux.T * aux.pt * aux.pt) * h_der;
+      else
+        T_der := ((-1 / aux.rho) + aux.T * aux.vt) / aux.cp * p_der + 1 / aux.cp * h_der;
+      end if;
+//regions 1,2 or 5
+    end T_ph_der;
+
+    function s_props_ph "specific entropy as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase properties "auxiliary record";
+      output Modelica.Units.SI.SpecificEntropy s "specific entropy";
+    algorithm
+      s := properties.s;
+      annotation(
+        derivative(noDerivative = properties) = s_ph_der,
+        Inline = false,
+        LateInline = true);
+    end s_props_ph;
+
+    function s_ph "specific entropy as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.SpecificEntropy s "specific entropy";
+    algorithm
+      s := s_props_ph(p, h, waterBaseProp_ph(p, h, phase, region));
+    end s_ph;
+
+    function s_ph_der "specific entropy as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      input Real p_der "derivative of pressure";
+      input Real h_der "derivative of specific enthalpy";
+      output Real s_der "derivative of entropy";
+    algorithm
+      s_der := (-1 / (aux.rho * aux.T) * p_der) + 1 / aux.T * h_der;
+    end s_ph_der;
+
+    function cv_props_ph "specific heat capacity at constant volume as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      output Modelica.Units.SI.SpecificHeatCapacity cv "specific heat capacity";
+    algorithm
+      cv := aux.cv;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end cv_props_ph;
+
+    function cv_ph "specific heat capacity at constant volume as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.SpecificHeatCapacity cv "specific heat capacity";
+    algorithm
+      cv := cv_props_ph(p, h, waterBaseProp_ph(p, h, phase, region));
+    end cv_ph;
+
+    function regionAssertReal "assert function for inlining"
+      extends Modelica.Icons.Function;
+      input Boolean check "condition to check";
+      output Real dummy "dummy output";
+    algorithm
+      assert(check, "this function can not be called with two-phase inputs!");
+    end regionAssertReal;
+
+    function cp_props_ph "specific heat capacity at constant pressure as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      output Modelica.Units.SI.SpecificHeatCapacity cp "specific heat capacity";
+    algorithm
+      cp := aux.cp;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end cp_props_ph;
+
+    function cp_ph "specific heat capacity at constant pressure as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.SpecificHeatCapacity cp "specific heat capacity";
+    algorithm
+      cp := cp_props_ph(p, h, waterBaseProp_ph(p, h, phase, region));
+    end cp_ph;
+
+    function beta_props_ph "isobaric expansion coefficient as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      output Modelica.Units.SI.RelativePressureCoefficient beta "isobaric expansion coefficient";
+    algorithm
+      beta := if aux.region == 3 or aux.region == 4 then aux.pt / (aux.rho * aux.pd) else aux.vt * aux.rho;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end beta_props_ph;
+
+    function beta_ph "isobaric expansion coefficient as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.RelativePressureCoefficient beta "isobaric expansion coefficient";
+    algorithm
+      beta := beta_props_ph(p, h, waterBaseProp_ph(p, h, phase, region));
+    end beta_ph;
+
+    function kappa_props_ph "isothermal compressibility factor as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      output Modelica.Units.SI.IsothermalCompressibility kappa "isothermal compressibility factor";
+    algorithm
+      kappa := if aux.region == 3 or aux.region == 4 then 1 / (aux.rho * aux.pd) else -aux.vp * aux.rho;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end kappa_props_ph;
+
+    function kappa_ph "isothermal compressibility factor as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.IsothermalCompressibility kappa "isothermal compressibility factor";
+    algorithm
+      kappa := kappa_props_ph(p, h, waterBaseProp_ph(p, h, phase, region));
+    end kappa_ph;
+
+    function velocityOfSound_props_ph "speed of sound as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      output Modelica.Units.SI.Velocity v_sound "speed of sound";
+    algorithm
+// dp/drho at constant s
+      v_sound := if aux.region == 3 then sqrt((aux.pd * aux.rho * aux.rho * aux.cv + aux.pt * aux.pt * aux.T) / (aux.rho * aux.rho * aux.cv)) else if aux.region == 4 then sqrt(1 / (aux.rho * (aux.rho * aux.cv / aux.dpT + 1.0) / (aux.dpT * aux.T) - 1 / aux.rho * aux.rho * aux.rho / (aux.dpT * aux.T))) else sqrt(-aux.cp / (aux.rho * aux.rho * (aux.vp * aux.cp + aux.vt * aux.vt * aux.T)));
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end velocityOfSound_props_ph;
+
+    function velocityOfSound_ph
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.Velocity v_sound "speed of sound";
+    algorithm
+      v_sound := velocityOfSound_props_ph(p, h, waterBaseProp_ph(p, h, phase, region));
+    end velocityOfSound_ph;
+
+    function isentropicExponent_props_ph "isentropic exponent as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      output Real gamma "isentropic exponent";
+    algorithm
+      gamma := if aux.region == 3 then 1 / (aux.rho * p) * ((aux.pd * aux.cv * aux.rho * aux.rho + aux.pt * aux.pt * aux.T) / aux.cv) else if aux.region == 4 then 1 / (aux.rho * p) * aux.dpT * aux.dpT * aux.T / aux.cv else -1 / (aux.rho * aux.p) * aux.cp / (aux.vp * aux.cp + aux.vt * aux.vt * aux.T);
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end isentropicExponent_props_ph;
+
+    function isentropicExponent_ph "isentropic exponent as function of pressure and specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Real gamma "isentropic exponent";
+    algorithm
+      gamma := isentropicExponent_props_ph(p, h, waterBaseProp_ph(p, h, phase, region));
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end isentropicExponent_ph;
+
+    function ddph_props "density derivative by pressure"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      output Modelica.Units.SI.DerDensityByPressure ddph "density derivative by pressure";
+    algorithm
+      ddph := if aux.region == 3 then aux.rho * (aux.cv * aux.rho + aux.pt) / (aux.rho * aux.rho * aux.pd * aux.cv + aux.T * aux.pt * aux.pt) else if aux.region == 4 then aux.rho * (aux.rho * aux.cv / aux.dpT + 1.0) / (aux.dpT * aux.T) else -aux.rho * aux.rho * (aux.vp * aux.cp - aux.vt / aux.rho + aux.T * aux.vt * aux.vt) / aux.cp;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end ddph_props;
+
+    function ddph "density derivative by pressure"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.DerDensityByPressure ddph "density derivative by pressure";
+    algorithm
+      ddph := ddph_props(p, h, waterBaseProp_ph(p, h, phase, region));
+    end ddph;
+
+    function ddhp_props "density derivative by specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      output Modelica.Units.SI.DerDensityByEnthalpy ddhp "density derivative by specific enthalpy";
+    algorithm
+      ddhp := if aux.region == 3 then -aux.rho * aux.rho * aux.pt / (aux.rho * aux.rho * aux.pd * aux.cv + aux.T * aux.pt * aux.pt) else if aux.region == 4 then -aux.rho * aux.rho / (aux.dpT * aux.T) else -aux.rho * aux.rho * aux.vt / aux.cp;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end ddhp_props;
+
+    function ddhp "density derivative by specific enthalpy"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.DerDensityByEnthalpy ddhp "density derivative by specific enthalpy";
+    algorithm
+      ddhp := ddhp_props(p, h, waterBaseProp_ph(p, h, phase, region));
+    end ddhp;
+
+    function waterBaseProp_pT "intermediate property record for water (p and T prefered states)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer region = 0 "if 0, do region computation, otherwise assume the region is this input";
+      output ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+    protected
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs g "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs f "dimensionless Helmholtz funcion and dervatives wrt delta and tau";
+      Integer error "error flag for inverse iterations";
+    algorithm
+      aux.phase := 1;
+      aux.region := if region == 0 then ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_pT(p = p, T = T) else region;
+      aux.R := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
+      aux.p := p;
+      aux.T := T;
+      if aux.region == 1 then
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(p, T);
+        aux.h := aux.R * aux.T * g.tau * g.gtau;
+        aux.s := aux.R * (g.tau * g.gtau - g.g);
+        aux.rho := p / (aux.R * T * g.pi * g.gpi);
+        aux.vt := aux.R / p * (g.pi * g.gpi - g.tau * g.pi * g.gtaupi);
+        aux.vp := aux.R * T / (p * p) * g.pi * g.pi * g.gpipi;
+        aux.cp := -aux.R * g.tau * g.tau * g.gtautau;
+        aux.cv := aux.R * ((-g.tau * g.tau * g.gtautau) + (g.gpi - g.tau * g.gtaupi) * (g.gpi - g.tau * g.gtaupi) / g.gpipi);
+        aux.x := 0.0;
+      elseif aux.region == 2 then
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(p, T);
+        aux.h := aux.R * aux.T * g.tau * g.gtau;
+        aux.s := aux.R * (g.tau * g.gtau - g.g);
+        aux.rho := p / (aux.R * T * g.pi * g.gpi);
+        aux.vt := aux.R / p * (g.pi * g.gpi - g.tau * g.pi * g.gtaupi);
+        aux.vp := aux.R * T / (p * p) * g.pi * g.pi * g.gpipi;
+        aux.cp := -aux.R * g.tau * g.tau * g.gtautau;
+        aux.cv := aux.R * ((-g.tau * g.tau * g.gtautau) + (g.gpi - g.tau * g.gtaupi) * (g.gpi - g.tau * g.gtaupi) / g.gpipi);
+        aux.x := 1.0;
+      elseif aux.region == 3 then
+        (aux.rho, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.dofpt3(p = p, T = T, delp = 1.0e-7);
+        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(aux.rho, T);
+        aux.h := aux.R * T * (f.tau * f.ftau + f.delta * f.fdelta);
+        aux.s := aux.R * (f.tau * f.ftau - f.f);
+        aux.pd := aux.R * T * f.delta * (2.0 * f.fdelta + f.delta * f.fdeltadelta);
+        aux.pt := aux.R * aux.rho * f.delta * (f.fdelta - f.tau * f.fdeltatau);
+        aux.cv := aux.R * (-f.tau * f.tau * f.ftautau);
+        aux.x := 0.0;
+      elseif aux.region == 5 then
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g5(p, T);
+        aux.h := aux.R * aux.T * g.tau * g.gtau;
+        aux.s := aux.R * (g.tau * g.gtau - g.g);
+        aux.rho := p / (aux.R * T * g.pi * g.gpi);
+        aux.vt := aux.R / p * (g.pi * g.gpi - g.tau * g.pi * g.gtaupi);
+        aux.vp := aux.R * T / (p * p) * g.pi * g.pi * g.gpipi;
+        aux.cp := -aux.R * g.tau * g.tau * g.gtautau;
+        aux.cv := aux.R * ((-g.tau * g.tau * g.gtautau) + (g.gpi - g.tau * g.gtaupi) * (g.gpi - g.tau * g.gtaupi) / g.gpipi);
+      else
+        assert(false, "error in region computation of IF97 steam tables" + "(p = " + String(p) + ", T = " + String(T) + ")");
+      end if;
+    end waterBaseProp_pT;
+
+    function rho_props_pT "density as function or pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      output Modelica.Units.SI.Density rho "density";
+    algorithm
+      rho := aux.rho;
+      annotation(
+        derivative(noDerivative = aux) = rho_pT_der,
+        Inline = false,
+        LateInline = true);
+    end rho_props_pT;
+
+    function rho_pT "density as function or pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.Density rho "density";
+    algorithm
+      rho := rho_props_pT(p, T, waterBaseProp_pT(p, T, region));
+    end rho_pT;
+
+    function h_props_pT "specific enthalpy as function or pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    algorithm
+      h := aux.h;
+      annotation(
+        derivative(noDerivative = aux) = h_pT_der,
+        Inline = false,
+        LateInline = true);
+    end h_props_pT;
+
+    function h_pT "specific enthalpy as function or pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "Temperature";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    algorithm
+      h := h_props_pT(p, T, waterBaseProp_pT(p, T, region));
+    end h_pT;
+
+    function h_pT_der "derivative function of h_pT"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      input Real p_der "derivative of pressure";
+      input Real T_der "derivative of temperature";
+      output Real h_der "derivative of specific enthalpy";
+    algorithm
+      if aux.region == 3 then
+        h_der := ((-aux.rho * aux.pd) + T * aux.pt) / (aux.rho * aux.rho * aux.pd) * p_der + (aux.rho * aux.rho * aux.pd * aux.cv + aux.T * aux.pt * aux.pt) / (aux.rho * aux.rho * aux.pd) * T_der;
+      else
+        h_der := (1 / aux.rho - aux.T * aux.vt) * p_der + aux.cp * T_der;
+      end if;
+//regions 1,2 or 5
+    end h_pT_der;
+
+    function rho_pT_der "derivative function of rho_pT"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      input Real p_der "derivative of pressure";
+      input Real T_der "derivative of temperature";
+      output Real rho_der "derivative of density";
+    algorithm
+      if aux.region == 3 then
+        rho_der := 1 / aux.pd * p_der - aux.pt / aux.pd * T_der;
+      else
+        rho_der := (-aux.rho * aux.rho * aux.vp) * p_der + (-aux.rho * aux.rho * aux.vt) * T_der;
+      end if;
+//regions 1,2 or 5
+    end rho_pT_der;
+
+    function s_props_pT "specific entropy as function of pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      output Modelica.Units.SI.SpecificEntropy s "specific entropy";
+    algorithm
+      s := aux.s;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end s_props_pT;
+
+    function s_pT "temperature as function of pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.SpecificEntropy s "specific entropy";
+    algorithm
+      s := s_props_pT(p, T, waterBaseProp_pT(p, T, region));
+      annotation(
+        InlineNoEvent = false);
+    end s_pT;
+
+    function cv_props_pT "specific heat capacity at constant volume as function of pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      output Modelica.Units.SI.SpecificHeatCapacity cv "specific heat capacity";
+    algorithm
+      cv := aux.cv;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end cv_props_pT;
+
+    function cv_pT "specific heat capacity at constant volume as function of pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.SpecificHeatCapacity cv "specific heat capacity";
+    algorithm
+      cv := cv_props_pT(p, T, waterBaseProp_pT(p, T, region));
+      annotation(
+        InlineNoEvent = false);
+    end cv_pT;
+
+    function cp_props_pT "specific heat capacity at constant pressure as function of pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      output Modelica.Units.SI.SpecificHeatCapacity cp "specific heat capacity";
+    algorithm
+      cp := if aux.region == 3 then (aux.rho * aux.rho * aux.pd * aux.cv + aux.T * aux.pt * aux.pt) / (aux.rho * aux.rho * aux.pd) else aux.cp;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end cp_props_pT;
+
+    function cp_pT "specific heat capacity at constant pressure as function of pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.SpecificHeatCapacity cp "specific heat capacity";
+    algorithm
+      cp := cp_props_pT(p, T, waterBaseProp_pT(p, T, region));
+      annotation(
+        InlineNoEvent = false);
+    end cp_pT;
+
+    function beta_props_pT "isobaric expansion coefficient as function of pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      output Modelica.Units.SI.RelativePressureCoefficient beta "isobaric expansion coefficient";
+    algorithm
+      beta := if aux.region == 3 then aux.pt / (aux.rho * aux.pd) else aux.vt * aux.rho;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end beta_props_pT;
+
+    function beta_pT "isobaric expansion coefficient as function of pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.RelativePressureCoefficient beta "isobaric expansion coefficient";
+    algorithm
+      beta := beta_props_pT(p, T, waterBaseProp_pT(p, T, region));
+      annotation(
+        InlineNoEvent = false);
+    end beta_pT;
+
+    function kappa_props_pT "isothermal compressibility factor as function of pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      output Modelica.Units.SI.IsothermalCompressibility kappa "isothermal compressibility factor";
+    algorithm
+      kappa := if aux.region == 3 then 1 / (aux.rho * aux.pd) else -aux.vp * aux.rho;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end kappa_props_pT;
+
+    function kappa_pT "isothermal compressibility factor as function of pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.IsothermalCompressibility kappa "isothermal compressibility factor";
+    algorithm
+      kappa := kappa_props_pT(p, T, waterBaseProp_pT(p, T, region));
+      annotation(
+        InlineNoEvent = false);
+    end kappa_pT;
+
+    function velocityOfSound_props_pT "speed of sound as function of pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      output Modelica.Units.SI.Velocity v_sound "speed of sound";
+    algorithm
+// dp/drho at constant s
+      v_sound := if aux.region == 3 then sqrt((aux.pd * aux.rho * aux.rho * aux.cv + aux.pt * aux.pt * aux.T) / (aux.rho * aux.rho * aux.cv)) else sqrt(-aux.cp / (aux.rho * aux.rho * (aux.vp * aux.cp + aux.vt * aux.vt * aux.T)));
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end velocityOfSound_props_pT;
+
+    function velocityOfSound_pT "speed of sound as function of pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.Velocity v_sound "speed of sound";
+    algorithm
+      v_sound := velocityOfSound_props_pT(p, T, waterBaseProp_pT(p, T, region));
+    end velocityOfSound_pT;
+
+    function isentropicExponent_props_pT "isentropic exponent as function of pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      output Real gamma "isentropic exponent";
+    algorithm
+      gamma := if aux.region == 3 then 1 / (aux.rho * p) * ((aux.pd * aux.cv * aux.rho * aux.rho + aux.pt * aux.pt * aux.T) / aux.cv) else -1 / (aux.rho * aux.p) * aux.cp / (aux.vp * aux.cp + aux.vt * aux.vt * aux.T);
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end isentropicExponent_props_pT;
+
+    function isentropicExponent_pT "isentropic exponent as function of pressure and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Real gamma "isentropic exponent";
+    algorithm
+      gamma := isentropicExponent_props_pT(p, T, waterBaseProp_pT(p, T, region));
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end isentropicExponent_pT;
+
+    function waterBaseProp_dT "intermediate property record for water (d and T prefered states)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density rho "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer phase = 0 "phase: 2 for two-phase, 1 for one phase, 0 if unknown";
+      input Integer region = 0 "if 0, do region computation, otherwise assume the region is this input";
+      output ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+    protected
+      Modelica.Units.SI.SpecificEnthalpy h_liq "liquid specific enthalpy";
+      Modelica.Units.SI.Density d_liq "liquid density";
+      Modelica.Units.SI.SpecificEnthalpy h_vap "vapour specific enthalpy";
+      Modelica.Units.SI.Density d_vap "vapour density";
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs g "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs f "dimensionless Helmholtz funcion and dervatives wrt delta and tau";
+      Modelica.Media.Common.PhaseBoundaryProperties liq "phase boundary property record";
+      Modelica.Media.Common.PhaseBoundaryProperties vap "phase boundary property record";
+      Modelica.Media.Common.GibbsDerivs gl "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      Modelica.Media.Common.GibbsDerivs gv "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      Modelica.Media.Common.HelmholtzDerivs fl "dimensionless Helmholtz function and dervatives wrt delta and tau";
+      Modelica.Media.Common.HelmholtzDerivs fv "dimensionless Helmholtz function and dervatives wrt delta and tau";
+      Integer error "error flag for inverse iterations";
+    algorithm
+      aux.region := if region == 0 then if phase == 2 then 4 else ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_dT(d = rho, T = T, phase = phase) else region;
+      aux.phase := if aux.region == 4 then 2 else 1;
+      aux.R := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
+      aux.rho := rho;
+      aux.T := T;
+      if aux.region == 1 then
+        (aux.p, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.pofdt125(d = rho, T = T, reldd = 1.0e-8, region = 1);
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(aux.p, T);
+        aux.h := aux.R * aux.T * g.tau * g.gtau;
+        aux.s := aux.R * (g.tau * g.gtau - g.g);
+        aux.rho := aux.p / (aux.R * T * g.pi * g.gpi);
+        aux.vt := aux.R / aux.p * (g.pi * g.gpi - g.tau * g.pi * g.gtaupi);
+        aux.vp := aux.R * T / (aux.p * aux.p) * g.pi * g.pi * g.gpipi;
+        aux.cp := -aux.R * g.tau * g.tau * g.gtautau;
+        aux.cv := aux.R * ((-g.tau * g.tau * g.gtautau) + (g.gpi - g.tau * g.gtaupi) * (g.gpi - g.tau * g.gtaupi) / g.gpipi);
+        aux.x := 0.0;
+      elseif aux.region == 2 then
+        (aux.p, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.pofdt125(d = rho, T = T, reldd = 1.0e-8, region = 2);
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(aux.p, T);
+        aux.h := aux.R * aux.T * g.tau * g.gtau;
+        aux.s := aux.R * (g.tau * g.gtau - g.g);
+        aux.rho := aux.p / (aux.R * T * g.pi * g.gpi);
+        aux.vt := aux.R / aux.p * (g.pi * g.gpi - g.tau * g.pi * g.gtaupi);
+        aux.vp := aux.R * T / (aux.p * aux.p) * g.pi * g.pi * g.gpipi;
+        aux.cp := -aux.R * g.tau * g.tau * g.gtautau;
+        aux.cv := aux.R * ((-g.tau * g.tau * g.gtautau) + (g.gpi - g.tau * g.gtaupi) * (g.gpi - g.tau * g.gtaupi) / g.gpipi);
+        aux.x := 1.0;
+      elseif aux.region == 3 then
+        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(rho, T);
+        aux.p := aux.R * rho * T * f.delta * f.fdelta;
+        aux.h := aux.R * T * (f.tau * f.ftau + f.delta * f.fdelta);
+        aux.s := aux.R * (f.tau * f.ftau - f.f);
+        aux.pd := aux.R * T * f.delta * (2.0 * f.fdelta + f.delta * f.fdeltadelta);
+        aux.pt := aux.R * rho * f.delta * (f.fdelta - f.tau * f.fdeltatau);
+        aux.cp := (aux.rho * aux.rho * aux.pd * aux.cv + aux.T * aux.pt * aux.pt) / (aux.rho * aux.rho * aux.pd);
+        aux.cv := aux.R * (-f.tau * f.tau * f.ftautau);
+        aux.x := 0.0;
+      elseif aux.region == 4 then
+        aux.p := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.psat(T);
+        aux.dpT := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.dptofT(T);
+        d_liq := rhol_T(T);
+        d_vap := rhov_T(T);
+        h_liq := hl_p(aux.p);
+        h_vap := hv_p(aux.p);
+        aux.x := if d_vap <> d_liq then (1 / rho - 1 / d_liq) / (1 / d_vap - 1 / d_liq) else 1.0;
+        aux.h := h_liq + aux.x * (h_vap - h_liq);
+        if T < ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TLIMIT1 then
+          gl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(aux.p, T);
+          gv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(aux.p, T);
+          liq := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps(gl);
+          vap := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps(gv);
+        else
+          fl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(d_liq, T);
+          fv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(d_vap, T);
+          liq := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps(fl);
+          vap := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps(fv);
+        end if;
+        aux.dpT := if liq.d <> vap.d then (vap.s - liq.s) * liq.d * vap.d / (liq.d - vap.d) else ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.dptofT(aux.T);
+        aux.s := liq.s + aux.x * (vap.s - liq.s);
+        aux.cv := ThermoSysPro.Properties.WaterSteam.Common.cv2Phase(liq, vap, aux.x, aux.T, aux.p);
+        aux.cp := liq.cp + aux.x * (vap.cp - liq.cp);
+        aux.pt := liq.pt + aux.x * (vap.pt - liq.pt);
+        aux.pd := liq.pd + aux.x * (vap.pd - liq.pd);
+      elseif aux.region == 5 then
+        (aux.p, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.pofdt125(d = rho, T = T, reldd = 1.0e-8, region = 5);
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(aux.p, T);
+        aux.h := aux.R * aux.T * g.tau * g.gtau;
+        aux.s := aux.R * (g.tau * g.gtau - g.g);
+        aux.rho := aux.p / (aux.R * T * g.pi * g.gpi);
+        aux.vt := aux.R / aux.p * (g.pi * g.gpi - g.tau * g.pi * g.gtaupi);
+        aux.vp := aux.R * T / (aux.p * aux.p) * g.pi * g.pi * g.gpipi;
+        aux.cp := -aux.R * g.tau * g.tau * g.gtautau;
+        aux.cv := aux.R * ((-g.tau * g.tau * g.gtautau) + (g.gpi - g.tau * g.gtaupi) * (g.gpi - g.tau * g.gtaupi) / g.gpipi);
+      else
+        assert(false, "error in region computation of IF97 steam tables" + "(rho = " + String(rho) + ", T = " + String(T) + ")");
+      end if;
+    end waterBaseProp_dT;
+
+    function h_props_dT "specific enthalpy as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "Temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    algorithm
+      h := aux.h;
+      annotation(
+        derivative(noDerivative = aux) = h_dT_der,
+        Inline = false,
+        LateInline = true);
+    end h_props_dT;
+
+    function h_dT "specific enthalpy as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "Temperature";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    algorithm
+      h := h_props_dT(d, T, waterBaseProp_dT(d, T, phase, region));
+    end h_dT;
+
+    function h_dT_der "derivative function of h_dT"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      input Real d_der "derivative of density";
+      input Real T_der "derivative of temperature";
+      output Real h_der "derivative of specific enthalpy";
+    algorithm
+      if aux.region == 3 then
+        h_der := ((-d * aux.pd) + T * aux.pt) / (d * d) * d_der + (aux.cv * d + aux.pt) / d * T_der;
+      elseif aux.region == 4 then
+        h_der := T * aux.dpT / (d * d) * d_der + (aux.cv * d + aux.dpT) / d * T_der;
+      else
+        h_der := (-((-1 / d) + T * aux.vt) / (d * d * aux.vp)) * d_der + (aux.vp * aux.cp - aux.vt / d + T * aux.vt * aux.vt) / aux.vp * T_der;
+      end if;
+//regions 1,2 or 5
+    end h_dT_der;
+
+    function p_props_dT "pressure as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "Temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      output Modelica.Units.SI.Pressure p "pressure";
+    algorithm
+      p := aux.p;
+      annotation(
+        derivative(noDerivative = aux) = p_dT_der,
+        Inline = false,
+        LateInline = true);
+    end p_props_dT;
+
+    function p_dT "pressure as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "Temperature";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.Pressure p "pressure";
+    algorithm
+      p := p_props_dT(d, T, waterBaseProp_dT(d, T, phase, region));
+    end p_dT;
+
+    function p_dT_der "derivative function of p_dT"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      input Real d_der "derivative of density";
+      input Real T_der "derivative of temperature";
+      output Real p_der "derivative of pressure";
+    algorithm
+      if aux.region == 3 then
+        p_der := aux.pd * d_der + aux.pt * T_der;
+      elseif aux.region == 4 then
+        p_der := aux.dpT * T_der;
+      else
+        p_der := (-1 / (d * d * aux.vp)) * d_der + (-aux.vt / aux.vp) * T_der;
+      end if;
+/*density derivative is 0.0*/
+//regions 1,2 or 5
+    end p_dT_der;
+
+    function s_props_dT "specific entropy as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "Temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      output Modelica.Units.SI.SpecificEntropy s "specific entropy";
+    algorithm
+      s := aux.s;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end s_props_dT;
+
+    function s_dT "temperature as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "Temperature";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.SpecificEntropy s "specific entropy";
+    algorithm
+      s := s_props_dT(d, T, waterBaseProp_dT(d, T, phase, region));
+    end s_dT;
+
+    function cv_props_dT "specific heat capacity at constant volume as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      output Modelica.Units.SI.SpecificHeatCapacity cv "specific heat capacity";
+    algorithm
+      cv := aux.cv;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end cv_props_dT;
+
+    function cv_dT "specific heat capacity at constant volume as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.SpecificHeatCapacity cv "specific heat capacity";
+    algorithm
+      cv := cv_props_dT(d, T, waterBaseProp_dT(d, T, phase, region));
+    end cv_dT;
+
+    function cp_props_dT "specific heat capacity at constant pressure as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      output Modelica.Units.SI.SpecificHeatCapacity cp "specific heat capacity";
+    algorithm
+      cp := aux.cp;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end cp_props_dT;
+
+    function cp_dT "specific heat capacity at constant pressure as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.SpecificHeatCapacity cp "specific heat capacity";
+    algorithm
+      cp := cp_props_dT(d, T, waterBaseProp_dT(d, T, phase, region));
+    end cp_dT;
+
+    function beta_props_dT "isobaric expansion coefficient as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      output Modelica.Units.SI.RelativePressureCoefficient beta "isobaric expansion coefficient";
+    algorithm
+      beta := if aux.region == 3 or aux.region == 4 then aux.pt / (aux.rho * aux.pd) else aux.vt * aux.rho;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end beta_props_dT;
+
+    function beta_dT "isobaric expansion coefficient as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.RelativePressureCoefficient beta "isobaric expansion coefficient";
+    algorithm
+      beta := beta_props_dT(d, T, waterBaseProp_dT(d, T, phase, region));
+    end beta_dT;
+
+    function kappa_props_dT "isothermal compressibility factor as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      output Modelica.Units.SI.IsothermalCompressibility kappa "isothermal compressibility factor";
+    algorithm
+      kappa := if aux.region == 3 or aux.region == 4 then 1 / (aux.rho * aux.pd) else -aux.vp * aux.rho;
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end kappa_props_dT;
+
+    function kappa_dT "isothermal compressibility factor as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.IsothermalCompressibility kappa "isothermal compressibility factor";
+    algorithm
+      kappa := kappa_props_dT(d, T, waterBaseProp_dT(d, T, phase, region));
+    end kappa_dT;
+
+    function velocityOfSound_props_dT "speed of sound as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      output Modelica.Units.SI.Velocity v_sound "speed of sound";
+    algorithm
+// dp/drho at constant s
+      v_sound := if aux.region == 3 then sqrt((aux.pd * aux.rho * aux.rho * aux.cv + aux.pt * aux.pt * aux.T) / (aux.rho * aux.rho * aux.cv)) else if aux.region == 4 then sqrt(1 / (aux.rho * (aux.rho * aux.cv / aux.dpT + 1.0) / (aux.dpT * aux.T) - 1 / aux.rho * aux.rho * aux.rho / (aux.dpT * aux.T))) else sqrt(-aux.cp / (aux.rho * aux.rho * (aux.vp * aux.cp + aux.vt * aux.vt * aux.T)));
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end velocityOfSound_props_dT;
+
+    function velocityOfSound_dT "speed of sound as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.Velocity v_sound "speed of sound";
+    algorithm
+      v_sound := velocityOfSound_props_dT(d, T, waterBaseProp_dT(d, T, phase, region));
+    end velocityOfSound_dT;
+
+    function isentropicExponent_props_dT "isentropic exponent as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      output Real gamma "isentropic exponent";
+    algorithm
+      gamma := if aux.region == 3 then 1 / (aux.rho * aux.p) * ((aux.pd * aux.cv * aux.rho * aux.rho + aux.pt * aux.pt * aux.T) / aux.cv) else if aux.region == 4 then 1 / (aux.rho * aux.p) * aux.dpT * aux.dpT * aux.T / aux.cv else -1 / (aux.rho * aux.p) * aux.cp / (aux.vp * aux.cp + aux.vt * aux.vt * aux.T);
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end isentropicExponent_props_dT;
+
+    function isentropicExponent_dT "isentropic exponent as function of density and temperature"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Density d "density";
+      input Modelica.Units.SI.Temperature T "temperature";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Real gamma "isentropic exponent";
+    algorithm
+      gamma := isentropicExponent_props_dT(d, T, waterBaseProp_dT(d, T, phase, region));
+      annotation(
+        Inline = false,
+        LateInline = true);
+    end isentropicExponent_dT;
+  public
+    function hl_p = ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hl_p "compute the saturated liquid specific h(p)";
+    function hv_p = ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hv_p "compute the saturated vapour specific h(p)";
+    function sl_p = ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.sl_p "compute the saturated liquid specific s(p)";
+    function sv_p = ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.sv_p "compute the saturated vapour specific s(p)";
+    function rhol_T = ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.rhol_T "compute the saturated liquid d(T)";
+    function rhov_T = ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.rhov_T "compute the saturated vapour d(T)";
+    function rhol_p = ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.rhol_p "compute the saturated liquid d(p)";
+    function rhov_p = ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.rhov_p "compute the saturated vapour d(p)";
+    function dynamicViscosity = ThermoSysPro.Properties.WaterSteam.BaseIF97.Transport.visc_dT "compute eta(d,T) in the one-phase region";
+    function thermalConductivity = ThermoSysPro.Properties.WaterSteam.BaseIF97.Transport.cond_industrial_dT "compute lambda(d,T) in the one-phase region";
+    function surfaceTension = ThermoSysPro.Properties.WaterSteam.BaseIF97.Transport.surfaceTension "compute sigma(T) at saturation T";
+    //   function isentropicEnthalpy
+    //     "isentropic specific enthalpy from p,s (preferably use dynamicIsentropicEnthalpy in dynamic simulation!)"
+    //     extends Modelica.Icons.Function;
+    //     input SI.Pressure p "pressure";
+    //     input SI.SpecificEntropy s "specific entropy";
+    //     input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+    //     output SI.SpecificEnthalpy h "specific enthalpy";
+    //   algorithm
+    //    h := BaseIF97.Isentropic.water_hisentropic(p,s,phase);
+    //   end isentropicEnthalpy;
+
+    function isentropicEnthalpy "isentropic specific enthalpy from p,s (preferably use dynamicIsentropicEnthalpy in dynamic simulation!)"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      input Integer region = 0 "if 0, region is unknown, otherwise known and this input";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    algorithm
+      h := isentropicEnthalpy_props(p, s, waterBaseProp_ps(p, s, phase, region));
+    end isentropicEnthalpy;
+
+    function isentropicEnthalpy_props
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      output Modelica.Units.SI.SpecificEnthalpy h "isentropic enthalpay";
+    algorithm
+      h := aux.h;
+      annotation(
+        derivative(noDerivative = aux) = isentropicEnthalpy_der,
+        Inline = false,
+        LateInline = true);
+    end isentropicEnthalpy_props;
+
+    function isentropicEnthalpy_der "derivative of isentropic specific enthalpy from p,s"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      input ThermoSysPro.Properties.WaterSteam.Common.IF97BaseTwoPhase aux "auxiliary record";
+      input Real p_der "pressure derivative";
+      input Real s_der "entropy derivative";
+      output Real h_der "specific enthalpy derivative";
+    algorithm
+      h_der := 1 / aux.rho * p_der + aux.T * s_der;
+    end isentropicEnthalpy_der;
+
+    function dynamicIsentropicEnthalpy "isentropic specific enthalpy from p,s and good guesses of d and T"
+      extends Modelica.Icons.Function;
+      input Modelica.Units.SI.Pressure p "pressure";
+      input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      input Modelica.Units.SI.Density dguess "good guess density, e.g. from adjacent volume";
+      input Modelica.Units.SI.Temperature Tguess "good guess temperature, e.g. from adjacent volume";
+      input Integer phase = 0 "2 for two-phase, 1 for one-phase, 0 if not known";
+      output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+    algorithm
+      h := ThermoSysPro.Properties.WaterSteam.BaseIF97.Isentropic.water_hisentropic_dyn(p, s, dguess, Tguess, 0);
+    end dynamicIsentropicEnthalpy;
+    annotation(
+      Icon(graphics = {Text(extent = {{-102, 0}, {24, -26}}, lineColor = {242, 148, 0}, textString = "Thermo"), Text(extent = {{-4, 8}, {68, -34}}, lineColor = {46, 170, 220}, textString = "SysPro"), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-32, 12}, {-16, 14}, {6, 14}, {26, 12}, {42, 8}, {52, 2}, {42, 6}, {28, 10}, {6, 12}, {-12, 12}, {-16, 12}, {-34, 10}, {-50, 6}, {-62, 2}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-44, 38}, {-24, 38}, {-26, 30}, {-26, 22}, {-24, 14}, {-24, 12}, {-46, 8}, {-42, 22}, {-42, 30}, {-44, 38}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-26, 20}, {-20, 20}, {-20, 22}, {-14, 22}, {-14, 20}, {-12, 20}, {-12, 12}, {-26, 12}, {-28, 12}, {-26, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-8, 14}, {-8, 24}, {-6, 24}, {-6, 14}, {-8, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 30}, {-6, 26}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 36}, {-6, 32}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 42}, {-6, 38}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 48}, {-6, 44}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-4, 14}, {-4, 26}, {-2, 26}, {-2, 14}, {-4, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 32}, {-2, 28}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 38}, {-2, 34}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 44}, {-2, 40}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 50}, {-2, 46}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-2, 20}, {8, 20}, {8, 22}, {10, 22}, {18, 22}, {18, 12}, {-4, 14}, {-2, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-36, 10}, {-18, 12}, {6, 12}, {26, 10}, {42, 6}, {52, 0}, {42, 4}, {28, 8}, {6, 10}, {-12, 10}, {-18, 10}, {-38, 8}, {-50, 6}, {-62, 2}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Line(points = {{22, 12}, {22, 14}, {22, 16}, {24, 14}, {20, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{26, 12}, {26, 14}, {26, 16}, {28, 14}, {24, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{30, 10}, {30, 12}, {30, 14}, {32, 12}, {28, 16}}, color = {46, 170, 220}, thickness = 0.5), Polygon(points = {{36, 8}, {36, 30}, {34, 34}, {36, 38}, {40, 38}, {40, 8}, {36, 8}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 80}, {80, -100}}, lineColor = {0, 0, 255}), Line(points = {{-100, 80}, {-80, 100}, {100, 100}, {100, -80}, {80, -100}}, color = {0, 0, 255}, smooth = Smooth.None), Line(points = {{80, 80}, {100, 100}}, color = {0, 0, 255}, smooth = Smooth.None)}));
+  end Standard;
+  annotation(
+    Documentation(info = "<HTML>
       <h4>Package description:</h4>
       <p>This package provides high accuracy physical properties for water according
       to the IAPWS/IF97 standard. It has been part of the ThermoFluid Modelica library and been extended,
@@ -4335,125 +3251,7 @@
       SE-22370 Lund, Sweden<br>
       email: hubertus@modelon.se
       </address>
-      </HTML>", revisions="<h4>Intermediate release notes during development<\\h4>
-<p>Currenly the Events/noEvents switch is only implmented for p-h states. Only after testing that implmentation, it will be extended to dT.</p>"),
-      Icon(graphics={
-        Text(
-          extent={{-102,0},{24,-26}},
-          lineColor={242,148,0},
-          textString=
-               "Thermo"),
-        Text(
-          extent={{-4,8},{68,-34}},
-          lineColor={46,170,220},
-          textString=
-               "SysPro"),
-        Polygon(
-          points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},{42,
-              8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},{-50,6},
-              {-62,2}},
-          lineColor={46,170,220},
-          fillColor={46,170,220},
-          fillPattern=FillPattern.Solid),
-        Polygon(
-          points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{-46,8},
-              {-42,22},{-42,30},{-44,38}},
-          lineColor={46,170,220},
-          fillColor={46,170,220},
-          fillPattern=FillPattern.Solid),
-        Polygon(
-          points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{-12,12},
-              {-26,12},{-28,12},{-26,20}},
-          lineColor={46,170,220},
-          fillColor={46,170,220},
-          fillPattern=FillPattern.Solid),
-        Polygon(
-          points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}},
-          lineColor={46,170,220},
-          fillColor={46,170,220},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-8,30},{-6,26}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-8,36},{-6,32}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-8,42},{-6,38}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-8,48},{-6,44}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Polygon(
-          points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}},
-          lineColor={46,170,220},
-          fillColor={46,170,220},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-4,32},{-2,28}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-4,38},{-2,34}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-4,44},{-2,40}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-4,50},{-2,46}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Polygon(
-          points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{-2,20}},
-          lineColor={46,170,220},
-          fillColor={46,170,220},
-          fillPattern=FillPattern.Solid),
-        Polygon(
-          points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},{42,
-              6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},{-50,6},
-              {-62,2}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Line(
-          points={{22,12},{22,14},{22,16},{24,14},{20,18}},
-          color={46,170,220},
-          thickness=0.5),
-        Line(
-          points={{26,12},{26,14},{26,16},{28,14},{24,18}},
-          color={46,170,220},
-          thickness=0.5),
-        Line(
-          points={{30,10},{30,12},{30,14},{32,12},{28,16}},
-          color={46,170,220},
-          thickness=0.5),
-        Polygon(
-          points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}},
-          lineColor={46,170,220},
-          fillColor={46,170,220},
-          fillPattern=FillPattern.Solid),
-        Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}),
-        Line(
-          points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}},
-          color={0,0,255},
-          smooth=Smooth.None),
-        Line(
-          points={{80,80},{100,100}},
-          color={0,0,255},
-          smooth=Smooth.None)}));
-
-end IF97_Utilities;
+      </HTML>", revisions = "<h4>Intermediate release notes during development<\\h4>
+<p>Currenly the Events/noEvents switch is only implmented for p-h states. Only after testing that implmentation, it will be extended to dT.</p>"),
+    Icon(graphics = {Text(extent = {{-102, 0}, {24, -26}}, lineColor = {242, 148, 0}, textString = "Thermo"), Text(extent = {{-4, 8}, {68, -34}}, lineColor = {46, 170, 220}, textString = "SysPro"), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-32, 12}, {-16, 14}, {6, 14}, {26, 12}, {42, 8}, {52, 2}, {42, 6}, {28, 10}, {6, 12}, {-12, 12}, {-16, 12}, {-34, 10}, {-50, 6}, {-62, 2}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-44, 38}, {-24, 38}, {-26, 30}, {-26, 22}, {-24, 14}, {-24, 12}, {-46, 8}, {-42, 22}, {-42, 30}, {-44, 38}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-26, 20}, {-20, 20}, {-20, 22}, {-14, 22}, {-14, 20}, {-12, 20}, {-12, 12}, {-26, 12}, {-28, 12}, {-26, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-8, 14}, {-8, 24}, {-6, 24}, {-6, 14}, {-8, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 30}, {-6, 26}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 36}, {-6, 32}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 42}, {-6, 38}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 48}, {-6, 44}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-4, 14}, {-4, 26}, {-2, 26}, {-2, 14}, {-4, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 32}, {-2, 28}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 38}, {-2, 34}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 44}, {-2, 40}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 50}, {-2, 46}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-2, 20}, {8, 20}, {8, 22}, {10, 22}, {18, 22}, {18, 12}, {-4, 14}, {-2, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-36, 10}, {-18, 12}, {6, 12}, {26, 10}, {42, 6}, {52, 0}, {42, 4}, {28, 8}, {6, 10}, {-12, 10}, {-18, 10}, {-38, 8}, {-50, 6}, {-62, 2}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Line(points = {{22, 12}, {22, 14}, {22, 16}, {24, 14}, {20, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{26, 12}, {26, 14}, {26, 16}, {28, 14}, {24, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{30, 10}, {30, 12}, {30, 14}, {32, 12}, {28, 16}}, color = {46, 170, 220}, thickness = 0.5), Polygon(points = {{36, 8}, {36, 30}, {34, 34}, {36, 38}, {40, 38}, {40, 8}, {36, 8}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 80}, {80, -100}}, lineColor = {0, 0, 255}), Line(points = {{-100, 80}, {-80, 100}, {100, 100}, {100, -80}, {80, -100}}, color = {0, 0, 255}, smooth = Smooth.None), Line(points = {{80, 80}, {100, 100}}, color = {0, 0, 255}, smooth = Smooth.None)}));
+end IF97_Utilities;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam: IF97_Utilities.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam: IF97_Utilities.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam/IF97_packages.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam/IF97_packages.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam/IF97_packages.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam/IF97_packages.mo"	2022-03-10 09:58:33.768151191 +0000
@@ -1,618 +1,336 @@
-﻿within ThermoSysPro.Properties.WaterSteam;
-package IF97_packages
-
-  package IF97_wAJ
-      constant IF97_wAJ.Spline_Utilities.Data IF97_spline(
-        ndim = 1,
-        ncontrol = 100,
-        degree = 3,
-        knots = {
-        2.93063160225403e-007, 2.93063160225403e-007, 2.93063160225403e-007, 2.93063160225403e-007,
-        0.0150553301018805, 0.0225746360796844, 0.0300841766610507, 0.0375864719559614,
-        0.0450833779282367, 0.0525763026035424, 0.0600663541987385, 0.0675544420190098,
-        0.0750413446792581, 0.0825277558142009, 0.0900143143696351, 0.0975016244159301,
-        0.104990267916964, 0.11248081283071, 0.119973818177067, 0.127469837190213,
-        0.134969419310924, 0.14247311152242, 0.149981459358957, 0.157495007796453,
-        0.165014302152702, 0.172539889069826, 0.180072317615317, 0.187612140514708,
-        0.195159915514515, 0.202716206865773, 0.21028158691427, 0.217856637782066,
-        0.225441953125109, 0.233038139953034, 0.240645820499176, 0.248265634131007,
-        0.255898239293619, 0.26354431548115, 0.271204565233372, 0.278879716156774,
-        0.286570522971491, 0.294277769587339, 0.302002271213962, 0.309744876511783,
-        0.317506469792076, 0.325287973276035, 0.333090349424309, 0.340914603350119,
-        0.348761785330786, 0.356632993434437, 0.364529376280738, 0.372452135957019,
-        0.380402531113975, 0.388381880268579, 0.39639156534589, 0.404433035496425,
-        0.412507811231662, 0.420617488927502, 0.42876374575417, 0.436948345101518,
-        0.445173142581185, 0.453440092702033, 0.461751256332929, 0.470108809087968,
-        0.478515050793845, 0.486972416228223, 0.495483487352128, 0.50405100729972,
-        0.512677896436249, 0.521367270850924, 0.53012246371707, 0.538947050028345,
-        0.547844875307676, 0.556820088984304, 0.565877183242573, 0.575021038260507,
-        0.584256974874285, 0.593590815826759, 0.603028956896544, 0.612578449397273,
-        0.622247095874125, 0.632043561486359, 0.641977504873387, 0.652059734791795,
-        0.662302403295546, 0.672719253852374, 0.6833259549907, 0.694140568427125,
-        0.705184226398132, 0.716482126202646, 0.728064988229839, 0.739971159691273,
-        0.752249564928059, 0.764963678571606, 0.77819659006882, 0.79205900502822,
-        0.806726369054731, 0.822437269975835, 0.839573763094594, 0.858852425095749,
-        1, 1, 1, 1},
-        controlPoints = [
-        6.41617166788097; 6.59657375859249; 6.85956502478188; 7.19550228677957;
-        7.44003141655459; 7.67746343199683; 7.90809030002524; 8.1321863948823;
-        8.35001072138466; 8.56180824123764; 8.76781112389037; 8.96823977601129;
-        9.16330374171574; 9.35320248746118; 9.53812609634101; 9.71825588651749;
-        9.89376496619584; 10.064818734583; 10.2315753364618; 10.394186076569;
-        10.552795798896; 10.7075432351955; 10.8585613263155; 11.0059775194514;
-        11.1499140439677; 11.2904881680785; 11.427812438369; 11.561994903882;
-        11.6931393262684; 11.8213453773153; 11.9467088249962; 12.0693217090492;
-        12.1892725069664; 12.3066462911727; 12.421524878079; 12.5339869696189;
-        12.644108287808; 12.7519617028068; 12.8576173549182; 12.9611427709053;
-        13.06260297498; 13.1620605947781; 13.25957596261; 13.355207212251;
-        13.4490103715159; 13.5410394508422; 13.6313465280923; 13.7199818297721;
-        13.8069938088494; 13.892429219348; 13.9763331878828; 14.0587492822951;
-        14.1397195775398; 14.2192847189711; 14.297483983169; 14.3743553364442;
-        14.4499354911556; 14.524259959973; 14.5973631082143; 14.6692782043857;
-        14.740037469051; 14.8096721221595; 14.8782124289575; 14.9456877446163;
-        15.0121265577065; 15.0775565326579; 15.1420045513451; 15.2054967539465;
-        15.2680585792283; 15.3297148044048; 15.3904895847271; 15.4504064929423;
-        15.5094885587568; 15.5677583084284; 15.6252378046292; 15.6819486867911;
-        15.7379122123276; 15.7931492995096; 15.8476805734722; 15.9015264179811;
-        15.9547070373259; 16.0072425350593; 16.0591530191528; 16.11045874587;
-        16.1611803164475; 16.211338938197; 16.2609567565343; 16.3100572327281;
-        16.3586655540358; 16.4068088127073; 16.4545163733577; 16.501817689937;
-        16.5487496364798; 16.5953631575021; 16.6418467771832; 16.6879750106034;
-        16.7343150270632; 16.8752144692458; 16.9266730020941; 16.9094578790152]);
-
-    function Water_Ph
-      input Modelica.SIunits.AbsolutePressure p "Pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
-      input Integer mode = 0 "IF97 region. 0:automatic";
-
-    protected
-      Integer phase;
-      Integer region;
-      Integer error;
-      Modelica.SIunits.Temperature T;
-      Modelica.SIunits.Density d;
-      Boolean supercritical;
-
-    public
-      output ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro
-        annotation (Placement(transformation(extent={{-90,15},{-43.3333,61.6667}},
-              rotation=0)));
-    protected
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs
-                         g annotation (Placement(transformation(extent={{-90,
-                -85},{-43.3333,-38.3333}}, rotation=0)));
-      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs
-                             f
-        annotation (Placement(transformation(extent={{-23.3333,-85},{23.3333,
-                -38.3333}}, rotation=0)));
-    algorithm
-
-      supercritical := (p >ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT);
-      phase := if ((h < ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hl_p(p))
-                   or (h > ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hv_p(p))
-                   or supercritical) then 1 else 2;
-      region := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_ph(p, h, phase, mode);
-      if (region == 1) then
-        T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tph1(p, h);
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(p, T);
-        pro := ThermoSysPro.Properties.WaterSteam.Common.gibbsToProps_ph(g);
-        pro.x := if (supercritical) then -1 else 0;
-      elseif (region == 2) then
-        T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tph2(p, h);
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(p, T);
-        pro := ThermoSysPro.Properties.WaterSteam.Common.gibbsToProps_ph(g);
-        pro.x := if (supercritical) then -1 else 1;
-      elseif (region == 3) then
-        (d,T,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.dtofph3(p=p, h=h, delp=1.0e-7, delh=1.0e-6);
-        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(d, T);
-        pro := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToProps_ph(f);
-
-        if (h >ThermoSysPro.Properties.WaterSteam.BaseIF97.data.HCRIT) then
-          pro.x := if (supercritical) then -1 else 1;
-        else
-          pro.x := if (supercritical) then -1 else 0;
-        end if;
-      elseif (region == 4) then
-        pro := ThermoSysPro.Properties.WaterSteam.Common.water_ph_r4(p, h);
-      elseif (region == 5) then
-        (T,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.tofph5(p=p, h=h, reldh=1.0e-7);
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g5(p, T);
-        pro := ThermoSysPro.Properties.WaterSteam.Common.gibbsToProps_ph(g);
-        pro.x := if (supercritical) then -1 else 1;
-      else
-        assert(false, "Water_Ph: Incorrect region number (" + String(region) + ")");
-      end if;
-      annotation (
-        derivative(noDerivative=mode) = Water_Ph_der,
-        Icon(coordinateSystem(
-            preserveAspectRatio=false,
-            extent={{-100,-100},{100,100}},
-            grid={2,2}), graphics={
-            Text(extent={{-134,104},{142,44}}, textString=
-                                                   "%name"),
-            Ellipse(
-              extent={{-100,40},{100,-100}},
-              lineColor={255,127,0},
-              fillColor={255,255,255},
-              fillPattern=FillPattern.Solid),
-            Text(
-              extent={{-84,-4},{84,-52}},
-              lineColor={255,127,0},
-              textString=
-                   "fonction")}),
-        Window(
-          x=0.06,
-          y=0.1,
-          width=0.75,
-          height=0.73),
-        Documentation(info="<html>
+within ThermoSysPro.Properties.WaterSteam;
+
+package IF97_packages
+  package IF97_wAJ
+    constant IF97_wAJ.Spline_Utilities.Data IF97_spline(ndim = 1, ncontrol = 100, degree = 3, knots = {2.93063160225403e-007, 2.93063160225403e-007, 2.93063160225403e-007, 2.93063160225403e-007, 0.0150553301018805, 0.0225746360796844, 0.0300841766610507, 0.0375864719559614, 0.0450833779282367, 0.0525763026035424, 0.0600663541987385, 0.0675544420190098, 0.0750413446792581, 0.0825277558142009, 0.0900143143696351, 0.0975016244159301, 0.104990267916964, 0.11248081283071, 0.119973818177067, 0.127469837190213, 0.134969419310924, 0.14247311152242, 0.149981459358957, 0.157495007796453, 0.165014302152702, 0.172539889069826, 0.180072317615317, 0.187612140514708, 0.195159915514515, 0.202716206865773, 0.21028158691427, 0.217856637782066, 0.225441953125109, 0.233038139953034, 0.240645820499176, 0.248265634131007, 0.255898239293619, 0.26354431548115, 0.271204565233372, 0.278879716156774, 0.286570522971491, 0.294277769587339, 0.302002271213962, 0.309744876511783, 0.317506469792076, 0.325287973276035, 0.333090349424309, 0.340914603350119, 0.348761785330786, 0.356632993434437, 0.364529376280738, 0.372452135957019, 0.380402531113975, 0.388381880268579, 0.39639156534589, 0.404433035496425, 0.412507811231662, 0.420617488927502, 0.42876374575417, 0.436948345101518, 0.445173142581185, 0.453440092702033, 0.461751256332929, 0.470108809087968, 0.478515050793845, 0.486972416228223, 0.495483487352128, 0.50405100729972, 0.512677896436249, 0.521367270850924, 0.53012246371707, 0.538947050028345, 0.547844875307676, 0.556820088984304, 0.565877183242573, 0.575021038260507, 0.584256974874285, 0.593590815826759, 0.603028956896544, 0.612578449397273, 0.622247095874125, 0.632043561486359, 0.641977504873387, 0.652059734791795, 0.662302403295546, 0.672719253852374, 0.6833259549907, 0.694140568427125, 0.705184226398132, 0.716482126202646, 0.728064988229839, 0.739971159691273, 0.752249564928059, 0.764963678571606, 0.77819659006882, 0.79205900502822, 0.806726369054731, 0.822437269975835, 0.839573763094594, 0.858852425095749, 1, 1, 1, 1}, controlPoints = [6.41617166788097; 6.59657375859249; 6.85956502478188; 7.19550228677957; 7.44003141655459; 7.67746343199683; 7.90809030002524; 8.1321863948823; 8.35001072138466; 8.56180824123764; 8.76781112389037; 8.96823977601129; 9.16330374171574; 9.35320248746118; 9.53812609634101; 9.71825588651749; 9.89376496619584; 10.064818734583; 10.2315753364618; 10.394186076569; 10.552795798896; 10.7075432351955; 10.8585613263155; 11.0059775194514; 11.1499140439677; 11.2904881680785; 11.427812438369; 11.561994903882; 11.6931393262684; 11.8213453773153; 11.9467088249962; 12.0693217090492; 12.1892725069664; 12.3066462911727; 12.421524878079; 12.5339869696189; 12.644108287808; 12.7519617028068; 12.8576173549182; 12.9611427709053; 13.06260297498; 13.1620605947781; 13.25957596261; 13.355207212251; 13.4490103715159; 13.5410394508422; 13.6313465280923; 13.7199818297721; 13.8069938088494; 13.892429219348; 13.9763331878828; 14.0587492822951; 14.1397195775398; 14.2192847189711; 14.297483983169; 14.3743553364442; 14.4499354911556; 14.524259959973; 14.5973631082143; 14.6692782043857; 14.740037469051; 14.8096721221595; 14.8782124289575; 14.9456877446163; 15.0121265577065; 15.0775565326579; 15.1420045513451; 15.2054967539465; 15.2680585792283; 15.3297148044048; 15.3904895847271; 15.4504064929423; 15.5094885587568; 15.5677583084284; 15.6252378046292; 15.6819486867911; 15.7379122123276; 15.7931492995096; 15.8476805734722; 15.9015264179811; 15.9547070373259; 16.0072425350593; 16.0591530191528; 16.11045874587; 16.1611803164475; 16.211338938197; 16.2609567565343; 16.3100572327281; 16.3586655540358; 16.4068088127073; 16.4545163733577; 16.501817689937; 16.5487496364798; 16.5953631575021; 16.6418467771832; 16.6879750106034; 16.7343150270632; 16.8752144692458; 16.9266730020941; 16.9094578790152]);
+
+    function Water_Ph
+      input Modelica.Units.SI.AbsolutePressure p "Pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+      input Integer mode = 0 "IF97 region. 0:automatic";
+    protected
+      Integer phase;
+      Integer region;
+      Integer error;
+      Modelica.Units.SI.Temperature T;
+      Modelica.Units.SI.Density d;
+      Boolean supercritical;
+    public
+      output ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro annotation(
+        Placement(transformation(extent = {{-90, 15}, {-43.3333, 61.6667}}, rotation = 0)));
+    protected
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs g annotation(
+        Placement(transformation(extent = {{-90, -85}, {-43.3333, -38.3333}}, rotation = 0)));
+      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs f annotation(
+        Placement(transformation(extent = {{-23.3333, -85}, {23.3333, -38.3333}}, rotation = 0)));
+    algorithm
+      supercritical := p > ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT;
+      phase := if h < ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hl_p(p) or h > ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hv_p(p) or supercritical then 1 else 2;
+      region := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_ph(p, h, phase, mode);
+      if region == 1 then
+        T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tph1(p, h);
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(p, T);
+        pro := ThermoSysPro.Properties.WaterSteam.Common.gibbsToProps_ph(g);
+        pro.x := if supercritical then -1 else 0;
+      elseif region == 2 then
+        T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tph2(p, h);
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(p, T);
+        pro := ThermoSysPro.Properties.WaterSteam.Common.gibbsToProps_ph(g);
+        pro.x := if supercritical then -1 else 1;
+      elseif region == 3 then
+        (d, T, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.dtofph3(p = p, h = h, delp = 1.0e-7, delh = 1.0e-6);
+        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(d, T);
+        pro := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToProps_ph(f);
+        if h > ThermoSysPro.Properties.WaterSteam.BaseIF97.data.HCRIT then
+          pro.x := if supercritical then -1 else 1;
+        else
+          pro.x := if supercritical then -1 else 0;
+        end if;
+      elseif region == 4 then
+        pro := ThermoSysPro.Properties.WaterSteam.Common.water_ph_r4(p, h);
+      elseif region == 5 then
+        (T, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.tofph5(p = p, h = h, reldh = 1.0e-7);
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g5(p, T);
+        pro := ThermoSysPro.Properties.WaterSteam.Common.gibbsToProps_ph(g);
+        pro.x := if supercritical then -1 else 1;
+      else
+        assert(false, "Water_Ph: Incorrect region number (" + String(region) + ")");
+      end if;
+      annotation(
+        derivative(noDerivative = mode) = Water_Ph_der,
+        Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}, grid = {2, 2}), graphics = {Text(extent = {{-134, 104}, {142, 44}}, textString = "%name"), Ellipse(extent = {{-100, 40}, {100, -100}}, lineColor = {255, 127, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-84, -4}, {84, -52}}, lineColor = {255, 127, 0}, textString = "fonction")}),
+        Window(x = 0.06, y = 0.1, width = 0.75, height = 0.73),
+        Documentation(info = "<html>
 <p><b>Copyright &copy; EDF 2002 - 2010</b></p>
 </HTML>
 <html>
 <p><b>ThermoSysPro Version 2.0</b></p>
 </HTML>
-"));
-    end Water_Ph;
-
-    function Water_Ps
-      input Modelica.SIunits.AbsolutePressure p "Pressure";
-      input Modelica.SIunits.SpecificEntropy s "Specific entropy";
-      input Integer mode = 0 "IF97 region. 0:automatic";
-
-    protected
-      Integer phase;
-      Integer region;
-      Integer error;
-      Modelica.SIunits.Temperature T;
-      Modelica.SIunits.Density d;
-      Boolean supercritical;
-
-    public
-      output ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ps pro;
-    protected
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs
-                         g annotation (Placement(transformation(extent={{-90,
-                -85},{-43.3333,-38.3333}}, rotation=0)));
-      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs
-                             f
-        annotation (Placement(transformation(extent={{-23.3333,-85},{23.3333,
-                -38.3333}}, rotation=0)));
-    algorithm
-
-      supercritical := (p >ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT);
-      phase := if ((s < ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.sl_p(p))
-                   or (s > ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.sv_p(p))
-                   or supercritical) then 1 else 2;
-
-      region := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_ps(p, s, phase, mode);
-      if (region == 1) then
-        T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tps1(p, s);
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(p, T);
-        pro := ThermoSysPro.Properties.WaterSteam.Common.gibbsToProps_ps(g);
-        pro.x := if (supercritical) then -1 else 0;
-      elseif (region == 2) then
-        T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tps2(p, s);
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(p, T);
-        pro := ThermoSysPro.Properties.WaterSteam.Common.gibbsToProps_ps(g);
-        pro.x := if (supercritical) then -1 else 1;
-      elseif (region == 3) then
-        (d,T,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.dtofps3(p=p, s=s, delp=1.0e-7, dels=1.0e-6);
-        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(d, T);
-        pro := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToProps_ps(f);
-        pro.x := if (supercritical) then -1 else 0;
-      elseif (region == 4) then
-        pro := ThermoSysPro.Properties.WaterSteam.Common.water_ps_r4(p, s);
-      elseif (region == 5) then
-        (T,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.tofps5(p=p, s=s, relds=1.0e-7);
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g5(p, T);
-        pro := ThermoSysPro.Properties.WaterSteam.Common.gibbsToProps_ps(g);
-        pro.x := if (supercritical) then -1 else 1;
-      else
-        assert(false, "Water_Ps: Incorrect region number");
-      end if;
-      annotation (
-        derivative(noDerivative=mode) = Water_Ps_der,
-        Window(
-          x=0.22,
-          y=0.2,
-          width=0.6,
-          height=0.6),
-        Icon(coordinateSystem(
-            preserveAspectRatio=false,
-            extent={{-100,-100},{100,100}},
-            grid={2,2}), graphics={
-            Text(extent={{-134,104},{142,44}}, textString=
-                                                   "%name"),
-            Ellipse(
-              extent={{-100,40},{100,-100}},
-              lineColor={255,127,0},
-              fillColor={255,255,255},
-              fillPattern=FillPattern.Solid),
-            Text(
-              extent={{-84,-4},{84,-52}},
-              lineColor={255,127,0},
-              textString=
-                   "fonction")}),
-        Documentation(info="<html>
+        "));
+    end Water_Ph;
+
+    function Water_Ps
+      input Modelica.Units.SI.AbsolutePressure p "Pressure";
+      input Modelica.Units.SI.SpecificEntropy s "Specific entropy";
+      input Integer mode = 0 "IF97 region. 0:automatic";
+    protected
+      Integer phase;
+      Integer region;
+      Integer error;
+      Modelica.Units.SI.Temperature T;
+      Modelica.Units.SI.Density d;
+      Boolean supercritical;
+    public
+      output ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ps pro;
+    protected
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs g annotation(
+        Placement(transformation(extent = {{-90, -85}, {-43.3333, -38.3333}}, rotation = 0)));
+      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs f annotation(
+        Placement(transformation(extent = {{-23.3333, -85}, {23.3333, -38.3333}}, rotation = 0)));
+    algorithm
+      supercritical := p > ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT;
+      phase := if s < ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.sl_p(p) or s > ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.sv_p(p) or supercritical then 1 else 2;
+      region := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_ps(p, s, phase, mode);
+      if region == 1 then
+        T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tps1(p, s);
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(p, T);
+        pro := ThermoSysPro.Properties.WaterSteam.Common.gibbsToProps_ps(g);
+        pro.x := if supercritical then -1 else 0;
+      elseif region == 2 then
+        T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tps2(p, s);
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(p, T);
+        pro := ThermoSysPro.Properties.WaterSteam.Common.gibbsToProps_ps(g);
+        pro.x := if supercritical then -1 else 1;
+      elseif region == 3 then
+        (d, T, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.dtofps3(p = p, s = s, delp = 1.0e-7, dels = 1.0e-6);
+        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(d, T);
+        pro := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToProps_ps(f);
+        pro.x := if supercritical then -1 else 0;
+      elseif region == 4 then
+        pro := ThermoSysPro.Properties.WaterSteam.Common.water_ps_r4(p, s);
+      elseif region == 5 then
+        (T, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.tofps5(p = p, s = s, relds = 1.0e-7);
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g5(p, T);
+        pro := ThermoSysPro.Properties.WaterSteam.Common.gibbsToProps_ps(g);
+        pro.x := if supercritical then -1 else 1;
+      else
+        assert(false, "Water_Ps: Incorrect region number");
+      end if;
+      annotation(
+        derivative(noDerivative = mode) = Water_Ps_der,
+        Window(x = 0.22, y = 0.2, width = 0.6, height = 0.6),
+        Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}, grid = {2, 2}), graphics = {Text(extent = {{-134, 104}, {142, 44}}, textString = "%name"), Ellipse(extent = {{-100, 40}, {100, -100}}, lineColor = {255, 127, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-84, -4}, {84, -52}}, lineColor = {255, 127, 0}, textString = "fonction")}),
+        Documentation(info = "<html>
 <p><b>Copyright &copy; EDF 2002 - 2010</b></p>
 </HTML>
 <html>
 <p><b>ThermoSysPro Version 2.0</b></p>
 </HTML>
-"));
-    end Water_Ps;
-
-    function Water_sat_P
-      input Modelica.SIunits.AbsolutePressure P "Pressure";
-
-    protected
-      Modelica.SIunits.Temperature T;
-
-    public
-      output ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat
-                                  lsat annotation (Placement(transformation(
-              extent={{-85,15},{-15,85}}, rotation=0)));
-      output ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat
-                                  vsat annotation (Placement(transformation(
-              extent={{15,15},{85,85}}, rotation=0)));
-    protected
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs
-                         gl annotation (Placement(transformation(extent={{-85,
-                -85},{-15,-15}}, rotation=0)));
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs
-                         gv annotation (Placement(transformation(extent={{15,
-                -85},{85,-15}}, rotation=0)));
-    algorithm
-
-      /*  if (not (P < SteamIF97.data.plimit4a)) then
+        "));
+    end Water_Ps;
+
+    function Water_sat_P
+      input Modelica.Units.SI.AbsolutePressure P "Pressure";
+    protected
+      Modelica.Units.SI.Temperature T;
+    public
+      output ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat lsat annotation(
+        Placement(transformation(extent = {{-85, 15}, {-15, 85}}, rotation = 0)));
+      output ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat vsat annotation(
+        Placement(transformation(extent = {{15, 15}, {85, 85}}, rotation = 0)));
+    protected
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs gl annotation(
+        Placement(transformation(extent = {{-85, -85}, {-15, -15}}, rotation = 0)));
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs gv annotation(
+        Placement(transformation(extent = {{15, -85}, {85, -15}}, rotation = 0)));
+    algorithm
+/*  if (not (P < SteamIF97.data.plimit4a)) then
     assert(false, "Eau_sat_P: Pression > 16.5292e6 Pa");
-  end if;*/
-
-      T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tsat(P);
-
-      gl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(P, T);
-      lsat := ThermoSysPro.Properties.WaterSteam.Common.gibbsPropsSat(
-                                   P, T, gl);
-
-      gv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(P, T);
-      vsat := ThermoSysPro.Properties.WaterSteam.Common.gibbsPropsSat(
-                                   P, T, gv);
-      //
-      annotation (
-        derivative = Water_sat_P_der,
-        Window(
-          x=0.34,
-          y=0.21,
-          width=0.6,
-          height=0.6),
-        Icon(coordinateSystem(
-            preserveAspectRatio=false,
-            extent={{-100,-100},{100,100}},
-            grid={2,2}), graphics={
-            Text(extent={{-134,104},{142,44}}, textString=
-                                                   "%name"),
-            Ellipse(
-              extent={{-100,40},{100,-100}},
-              lineColor={255,127,0},
-              fillColor={255,255,255},
-              fillPattern=FillPattern.Solid),
-            Text(
-              extent={{-84,-4},{84,-52}},
-              lineColor={255,127,0},
-              textString=
-                   "fonction")}),
-        Documentation(info="<html>
+  end if;*/
+      T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tsat(P);
+      gl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(P, T);
+      lsat := ThermoSysPro.Properties.WaterSteam.Common.gibbsPropsSat(P, T, gl);
+      gv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(P, T);
+      vsat := ThermoSysPro.Properties.WaterSteam.Common.gibbsPropsSat(P, T, gv);
+//
+      annotation(
+        derivative = Water_sat_P_der,
+        Window(x = 0.34, y = 0.21, width = 0.6, height = 0.6),
+        Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}, grid = {2, 2}), graphics = {Text(extent = {{-134, 104}, {142, 44}}, textString = "%name"), Ellipse(extent = {{-100, 40}, {100, -100}}, lineColor = {255, 127, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-84, -4}, {84, -52}}, lineColor = {255, 127, 0}, textString = "fonction")}),
+        Documentation(info = "<html>
 <p><b>Copyright &copy; EDF 2002 - 2010</b></p>
 </HTML>
 <html>
 <p><b>ThermoSysPro Version 2.0</b></p>
 </HTML>
-"));
-    end Water_sat_P;
-
-    function DynamicViscosity_rhoT
-      input Modelica.SIunits.Density rho "Density";
-      input Modelica.SIunits.Temperature T "Temperature";
-
-      output Modelica.SIunits.DynamicViscosity mu "Dynamic viscosity";
-    algorithm
-
-      mu := ThermoSysPro.Properties.WaterSteam.BaseIF97.Transport.visc_dT(rho, T);
-      annotation (
-        smoothOrder=2,
-        Window(
-          x=0.34,
-          y=0.34,
-          width=0.6,
-          height=0.6),
-        Icon(coordinateSystem(
-            preserveAspectRatio=false,
-            extent={{-100,-100},{100,100}},
-            grid={2,2}), graphics={
-            Text(extent={{-134,104},{142,44}}, textString=
-                                                   "%name"),
-            Ellipse(
-              extent={{-100,40},{100,-100}},
-              lineColor={255,127,0},
-              fillColor={255,255,255},
-              fillPattern=FillPattern.Solid),
-            Text(
-              extent={{-84,-4},{84,-52}},
-              lineColor={255,127,0},
-              textString=
-                   "fonction")}),
-        Documentation(info="<html>
+        "));
+    end Water_sat_P;
+
+    function DynamicViscosity_rhoT
+      input Modelica.Units.SI.Density rho "Density";
+      input Modelica.Units.SI.Temperature T "Temperature";
+      output Modelica.Units.SI.DynamicViscosity mu "Dynamic viscosity";
+    algorithm
+      mu := ThermoSysPro.Properties.WaterSteam.BaseIF97.Transport.visc_dT(rho, T);
+      annotation(
+        smoothOrder = 2,
+        Window(x = 0.34, y = 0.34, width = 0.6, height = 0.6),
+        Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}, grid = {2, 2}), graphics = {Text(extent = {{-134, 104}, {142, 44}}, textString = "%name"), Ellipse(extent = {{-100, 40}, {100, -100}}, lineColor = {255, 127, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-84, -4}, {84, -52}}, lineColor = {255, 127, 0}, textString = "fonction")}),
+        Documentation(info = "<html>
 <p><b>Copyright &copy; EDF 2002 - 2010</b></p>
 </HTML>
 <html>
 <p><b>ThermoSysPro Version 2.0</b></p>
 </HTML>
-"));
-    end DynamicViscosity_rhoT;
-
-    function ThermalConductivity_rhoT
-      input Modelica.SIunits.Density rho "Density";
-      input Modelica.SIunits.Temperature T "Temperature";
-      input Modelica.SIunits.AbsolutePressure P "Pressure";
-      input Integer region = 0 "IF97 region. 0:automatic";
-
-      output Modelica.SIunits.ThermalConductivity lambda "Thermal conductivity";
-    algorithm
-
-      lambda := ThermoSysPro.Properties.WaterSteam.BaseIF97.Transport.cond_industrial_dT(rho, T);
-      annotation (
-        smoothOrder=2,
-        Window(
-          x=0.34,
-          y=0.34,
-          width=0.6,
-          height=0.6),
-        Icon(coordinateSystem(
-            preserveAspectRatio=false,
-            extent={{-100,-100},{100,100}},
-            grid={2,2}), graphics={
-            Text(extent={{-134,104},{142,44}}, textString=
-                                                   "%name"),
-            Ellipse(
-              extent={{-100,40},{100,-100}},
-              lineColor={255,127,0},
-              fillColor={255,255,255},
-              fillPattern=FillPattern.Solid),
-            Text(
-              extent={{-84,-4},{84,-52}},
-              lineColor={255,127,0},
-              textString=
-                   "fonction")}),
-        Documentation(info="<html>
+        "));
+    end DynamicViscosity_rhoT;
+
+    function ThermalConductivity_rhoT
+      input Modelica.Units.SI.Density rho "Density";
+      input Modelica.Units.SI.Temperature T "Temperature";
+      input Modelica.Units.SI.AbsolutePressure P "Pressure";
+      input Integer region = 0 "IF97 region. 0:automatic";
+      output Modelica.Units.SI.ThermalConductivity lambda "Thermal conductivity";
+    algorithm
+      lambda := ThermoSysPro.Properties.WaterSteam.BaseIF97.Transport.cond_industrial_dT(rho, T);
+      annotation(
+        smoothOrder = 2,
+        Window(x = 0.34, y = 0.34, width = 0.6, height = 0.6),
+        Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}, grid = {2, 2}), graphics = {Text(extent = {{-134, 104}, {142, 44}}, textString = "%name"), Ellipse(extent = {{-100, 40}, {100, -100}}, lineColor = {255, 127, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-84, -4}, {84, -52}}, lineColor = {255, 127, 0}, textString = "fonction")}),
+        Documentation(info = "<html>
 <p><b>Copyright &copy; EDF 2002 - 2010</b></p>
 </HTML>
 <html>
 <p><b>ThermoSysPro Version 2.0</b></p>
 </HTML>
-"));
-    end ThermalConductivity_rhoT;
-
-    function SurfaceTension_T
-      input Modelica.SIunits.Temperature T "Temperature";
-
-      output Modelica.SIunits.SurfaceTension sigma "Surface tension";
-    algorithm
-
-      sigma := ThermoSysPro.Properties.WaterSteam.BaseIF97.Transport.surfaceTension(T);
-      annotation (
-        smoothOrder=2,
-        Icon(coordinateSystem(
-            preserveAspectRatio=false,
-            extent={{-100,-100},{100,100}},
-            grid={2,2}), graphics={
-            Text(extent={{-134,104},{142,44}}, textString=
-                                                   "%name"),
-            Ellipse(
-              extent={{-100,40},{100,-100}},
-              lineColor={255,127,0},
-              fillColor={255,255,255},
-              fillPattern=FillPattern.Solid),
-            Text(
-              extent={{-84,-4},{84,-52}},
-              lineColor={255,127,0},
-              textString=
-                   "fonction")}),
-        Window(
-          x=0.33,
-          y=0.34,
-          width=0.6,
-          height=0.6),
-        Documentation(info="<html>
+        "));
+    end ThermalConductivity_rhoT;
+
+    function SurfaceTension_T
+      input Modelica.Units.SI.Temperature T "Temperature";
+      output Modelica.Units.SI.SurfaceTension sigma "Surface tension";
+    algorithm
+      sigma := ThermoSysPro.Properties.WaterSteam.BaseIF97.Transport.surfaceTension(T);
+      annotation(
+        smoothOrder = 2,
+        Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}, grid = {2, 2}), graphics = {Text(extent = {{-134, 104}, {142, 44}}, textString = "%name"), Ellipse(extent = {{-100, 40}, {100, -100}}, lineColor = {255, 127, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-84, -4}, {84, -52}}, lineColor = {255, 127, 0}, textString = "fonction")}),
+        Window(x = 0.33, y = 0.34, width = 0.6, height = 0.6),
+        Documentation(info = "<html>
 <p><b>Copyright &copy; EDF 2002 - 2010</b></p>
 </HTML>
 <html>
 <p><b>ThermoSysPro Version 2.0</b></p>
 </HTML>
-"));
-    end SurfaceTension_T;
-
-    function SpecificEnthalpy_PT
-      input Modelica.SIunits.AbsolutePressure p "Pressure";
-      input Modelica.SIunits.Temperature T "Temperature";
-      input Integer mode = 0 "IF97 region. 0:automatic";
-
-      output Modelica.SIunits.SpecificEnthalpy H "Specific enthalpy";
-
-    protected
-      ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_pT
-                                 pro;
-    algorithm
-
-      pro := ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Water_PT(p, T, mode);
-      H := pro.h;
-      annotation (
-        derivative(noDerivative=mode) = SpecificEnthalpy_PT_der,
-        Icon(graphics={
-            Text(extent={{-134,104},{142,44}}, textString=
-                                                   "%name"),
-            Ellipse(
-              extent={{-100,40},{100,-100}},
-              lineColor={255,127,0},
-              fillColor={255,255,255},
-              fillPattern=FillPattern.Solid),
-            Text(
-              extent={{-84,-4},{84,-52}},
-              lineColor={255,127,0},
-              textString=
-                   "fonction")}),
-        Documentation(info="<html>
+        "));
+    end SurfaceTension_T;
+
+    function SpecificEnthalpy_PT
+      input Modelica.Units.SI.AbsolutePressure p "Pressure";
+      input Modelica.Units.SI.Temperature T "Temperature";
+      input Integer mode = 0 "IF97 region. 0:automatic";
+      output Modelica.Units.SI.SpecificEnthalpy H "Specific enthalpy";
+    protected
+      ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_pT pro;
+    algorithm
+      pro := ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Water_PT(p, T, mode);
+      H := pro.h;
+      annotation(
+        derivative(noDerivative = mode) = SpecificEnthalpy_PT_der,
+        Icon(graphics = {Text(extent = {{-134, 104}, {142, 44}}, textString = "%name"), Ellipse(extent = {{-100, 40}, {100, -100}}, lineColor = {255, 127, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-84, -4}, {84, -52}}, lineColor = {255, 127, 0}, textString = "fonction")}),
+        Documentation(info = "<html>
 <p><b>Copyright &copy; EDF 2002 - 2010</b></p>
 </HTML>
 <html>
 <p><b>ThermoSysPro Version 2.0</b></p>
 </HTML>
-"));
-    end SpecificEnthalpy_PT;
-
-    function Pressure_sat_hl
-      input Modelica.SIunits.SpecificEnthalpy hl
-        "Liquid specific enthalpy on the saturation line";
-
-      output Modelica.SIunits.AbsolutePressure P
-        "Liquid pressure on the saturation line";
-    protected
-      Modelica.SIunits.AbsolutePressure tmp[1];
-    algorithm
-
-      assert(hl > ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hl_p(ThermoSysPro.Properties.WaterSteam.BaseIF97.triple.ptriple),
-        "Pressure_sat_hl called with too low specific enthalpy (below triple point)");
-      assert(hl < ThermoSysPro.Properties.WaterSteam.BaseIF97.critical.HCRIT,
-        "Pressure_sat_hl called with too high specific enthalpy (above critical point)");
-
-      tmp := ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.safeEvaluate(IF97_spline, hl/ThermoSysPro.Properties.WaterSteam.BaseIF97.critical.HCRIT);
-      P := Modelica.Math.exp(tmp[1]);
-      annotation (
-        derivative = Pressure_sat_hl_der,
-        Icon(coordinateSystem(
-            preserveAspectRatio=false,
-            extent={{-100,-100},{100,100}},
-            grid={2,2}), graphics={
-            Text(extent={{-134,104},{142,44}}, textString=
-                                                   "%name"),
-            Ellipse(
-              extent={{-100,40},{100,-100}},
-              lineColor={255,127,0},
-              fillColor={255,255,255},
-              fillPattern=FillPattern.Solid),
-            Text(
-              extent={{-84,-4},{84,-52}},
-              lineColor={255,127,0},
-              textString=
-                   "fonction")}),
-        Documentation(info="<html>
+        "));
+    end SpecificEnthalpy_PT;
+
+    function Pressure_sat_hl
+      input Modelica.Units.SI.SpecificEnthalpy hl "Liquid specific enthalpy on the saturation line";
+      output Modelica.Units.SI.AbsolutePressure P "Liquid pressure on the saturation line";
+    protected
+      Modelica.Units.SI.AbsolutePressure tmp[1];
+    algorithm
+      assert(hl > ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hl_p(ThermoSysPro.Properties.WaterSteam.BaseIF97.triple.ptriple), "Pressure_sat_hl called with too low specific enthalpy (below triple point)");
+      assert(hl < ThermoSysPro.Properties.WaterSteam.BaseIF97.critical.HCRIT, "Pressure_sat_hl called with too high specific enthalpy (above critical point)");
+      tmp := ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.safeEvaluate(IF97_spline, hl / ThermoSysPro.Properties.WaterSteam.BaseIF97.critical.HCRIT);
+      P := Modelica.Math.exp(tmp[1]);
+      annotation(
+        derivative = Pressure_sat_hl_der,
+        Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}, grid = {2, 2}), graphics = {Text(extent = {{-134, 104}, {142, 44}}, textString = "%name"), Ellipse(extent = {{-100, 40}, {100, -100}}, lineColor = {255, 127, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-84, -4}, {84, -52}}, lineColor = {255, 127, 0}, textString = "fonction")}),
+        Documentation(info = "<html>
 <p><b>Version 1.2</b> </p>
 <p><b>Copyright &copy; EDF 2002 - 2010</b></p>
 </HTML>
 <html>
 <p><b>ThermoSysPro_AJ Version 2.0</b></p>
 </HTML>
-"));
-    end Pressure_sat_hl;
-
-    function Water_PT
-      input Modelica.SIunits.AbsolutePressure p "Pressure";
-      input Modelica.SIunits.Temperature T "Temperature";
-      input Integer mode=0 "IF97 region. 0:automatic";
-      output ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_pT pro;
-
-    protected
-      Integer region;
-      Boolean supercritical;
-      Integer error;
-      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs f;
-      Modelica.SIunits.Density d;
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs g;
-    algorithm
-
-      supercritical := (p >ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT);
-      region := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_pT(p, T, mode);
-      if (region == 1) then
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(p, T);
-        pro := ThermoSysPro.Properties.WaterSteam.Common.gibbsToProps_pT(g);
-        pro.x := if (supercritical) then -1 else 0;
-      elseif (region == 2) then
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(p, T);
-        pro := ThermoSysPro.Properties.WaterSteam.Common.gibbsToProps_pT(g);
-        pro.x := if (supercritical) then -1 else 1;
-      elseif (region == 3) then
-        (d,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.dofpt3(p=p, T=T, delp=ThermoSysPro.Properties.WaterSteam.BaseIF97.IterationData.DELP);
-        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(d, T);
-        pro := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToProps_pT(f);
-        pro.x := if (supercritical) then -1 else 0;
-      elseif (region == 5) then
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g5(p, T);
-        pro := ThermoSysPro.Properties.WaterSteam.Common.gibbsToProps_pT(g);
-        pro.x := if (supercritical) then -1 else 1;
-      else
-        assert(false, "Water_PT: Incorrect region number");
-      end if;
-
-      annotation (
-        derivative(noDerivative=mode) = Water_PT_der,
-        Icon(graphics={
-            Text(extent={{-134,104},{142,44}}, textString=
-                                                   "%name"),
-            Ellipse(
-              extent={{-100,40},{100,-100}},
-              lineColor={255,127,0},
-              fillColor={255,255,255},
-              fillPattern=FillPattern.Solid),
-            Text(
-              extent={{-84,-4},{84,-52}},
-              lineColor={255,127,0},
-              textString=
-                   "fonction")}),
-        Documentation(info="<html>
+        "));
+    end Pressure_sat_hl;
+
+    function Water_PT
+      input Modelica.Units.SI.AbsolutePressure p "Pressure";
+      input Modelica.Units.SI.Temperature T "Temperature";
+      input Integer mode = 0 "IF97 region. 0:automatic";
+      output ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_pT pro;
+    protected
+      Integer region;
+      Boolean supercritical;
+      Integer error;
+      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs f;
+      Modelica.Units.SI.Density d;
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs g;
+    algorithm
+      supercritical := p > ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT;
+      region := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_pT(p, T, mode);
+      if region == 1 then
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(p, T);
+        pro := ThermoSysPro.Properties.WaterSteam.Common.gibbsToProps_pT(g);
+        pro.x := if supercritical then -1 else 0;
+      elseif region == 2 then
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(p, T);
+        pro := ThermoSysPro.Properties.WaterSteam.Common.gibbsToProps_pT(g);
+        pro.x := if supercritical then -1 else 1;
+      elseif region == 3 then
+        (d, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.dofpt3(p = p, T = T, delp = ThermoSysPro.Properties.WaterSteam.BaseIF97.IterationData.DELP);
+        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(d, T);
+        pro := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToProps_pT(f);
+        pro.x := if supercritical then -1 else 0;
+      elseif region == 5 then
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g5(p, T);
+        pro := ThermoSysPro.Properties.WaterSteam.Common.gibbsToProps_pT(g);
+        pro.x := if supercritical then -1 else 1;
+      else
+        assert(false, "Water_PT: Incorrect region number");
+      end if;
+      annotation(
+        derivative(noDerivative = mode) = Water_PT_der,
+        Icon(graphics = {Text(extent = {{-134, 104}, {142, 44}}, textString = "%name"), Ellipse(extent = {{-100, 40}, {100, -100}}, lineColor = {255, 127, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-84, -4}, {84, -52}}, lineColor = {255, 127, 0}, textString = "fonction")}),
+        Documentation(info = "<html>
 <p><b>Copyright &copy; EDF 2002 - 2010</b></p>
 </HTML>
 <html>
 <p><b>ThermoSysPro Version 2.0</b></p>
 </HTML>
-"));
-    end Water_PT;
-
-      function Pressure_sat_hl_der
-        input Modelica.SIunits.SpecificEnthalpy hl
-        "Liquid specific enthalpy on the saturation line";
-        input Real hl_der;
-
-        output Real P_der;
-    protected
-        Modelica.SIunits.AbsolutePressure P[1]
-        "Liquid pressure on the saturation line";
-        Real tmp[1];
-      algorithm
-
-        assert(hl > ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hl_p(ThermoSysPro.Properties.WaterSteam.BaseIF97.triple.ptriple),
-        "Pressure_sat_hl_der called with too low specific enthalpy (below triple point)");
-        assert(hl < ThermoSysPro.Properties.WaterSteam.BaseIF97.critical.HCRIT,
-        "Pressure_sat_hl_der called with too high specific enthalpy (above critical point)");
-
-        (P,tmp) := ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.safeEvaluateDer(IF97_spline, hl/ThermoSysPro.Properties.WaterSteam.BaseIF97.critical.HCRIT);
-        P_der := Modelica.Math.exp(P[1])*tmp[1]*hl_der;
-      annotation (
-        Icon(coordinateSystem(
-            preserveAspectRatio=false,
-            extent={{-100,-100},{100,100}},
-            grid={2,2}), graphics={
-            Text(extent={{-134,104},{142,44}}, textString=
-                                                   "%name"),
-            Ellipse(
-              extent={{-100,40},{100,-100}},
-              lineColor={255,127,0},
-              fillColor={255,255,255},
-              fillPattern=FillPattern.Solid),
-            Text(
-              extent={{-84,-4},{84,-52}},
-              lineColor={255,127,0},
-              textString=
-                   "fonction")}),
-        Documentation(info="<html>
+        "));
+    end Water_PT;
+
+    function Pressure_sat_hl_der
+      input Modelica.Units.SI.SpecificEnthalpy hl "Liquid specific enthalpy on the saturation line";
+      input Real hl_der;
+      output Real P_der;
+    protected
+      Modelica.Units.SI.AbsolutePressure P[1] "Liquid pressure on the saturation line";
+      Real tmp[1];
+    algorithm
+      assert(hl > ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hl_p(ThermoSysPro.Properties.WaterSteam.BaseIF97.triple.ptriple), "Pressure_sat_hl_der called with too low specific enthalpy (below triple point)");
+      assert(hl < ThermoSysPro.Properties.WaterSteam.BaseIF97.critical.HCRIT, "Pressure_sat_hl_der called with too high specific enthalpy (above critical point)");
+      (P, tmp) := ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.safeEvaluateDer(IF97_spline, hl / ThermoSysPro.Properties.WaterSteam.BaseIF97.critical.HCRIT);
+      P_der := Modelica.Math.exp(P[1]) * tmp[1] * hl_der;
+      annotation(
+        Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}, grid = {2, 2}), graphics = {Text(extent = {{-134, 104}, {142, 44}}, textString = "%name"), Ellipse(extent = {{-100, 40}, {100, -100}}, lineColor = {255, 127, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-84, -4}, {84, -52}}, lineColor = {255, 127, 0}, textString = "fonction")}),
+        Documentation(info = "<html>
 <p><b>Version 1.2</b> </p>
 <p>Needs to be redone. Iterative functions don&apos;t work for Analytic Jacobian</p>
 <p><b>Copyright &copy; EDF 2002 - 2010</b></p>
@@ -620,2896 +338,1960 @@
 <html>
 <p><b>ThermoSysPro_AJ Version 2.0</b></p>
 </HTML>
-"));
-      end Pressure_sat_hl_der;
-
-    function Water_Ph_der "Derivative function of Water_Ph"
-      input Modelica.SIunits.AbsolutePressure p "Pressure";
-      input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
-      input Integer mode = 0 "Région IF97 - 0:calcul automatique";
-      //input CombiPlant.ThermoFluidPro.Media.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
-
-      input Real p_der "derivative of Pressure";
-      input Real h_der "derivative of Specific enthalpy";
-
-      output ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph der_pro
-        "Derivative";
-
-    protected
-      Integer phase;
-      Integer region;
-      Boolean supercritical;
-
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd g
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd f
-        "dimensionless Helmholtz funcion and dervatives wrt delta and tau";
-      Modelica.SIunits.Temperature T;
-      Modelica.SIunits.SpecificHeatCapacity R "gas constant";
-      Modelica.SIunits.Density rho "density";
-      Real vt "derivative of specific volume w.r.t. temperature";
-      Modelica.SIunits.SpecificHeatCapacity cp "specific heat capacity";
-      Modelica.SIunits.SpecificHeatCapacity cv "specific heat capacity";
-      Real vp "derivative of specific volume w.r.t. pressure";
-      ThermoSysPro.Units.DerPressureByDensity pd
-        "derivative of pressure wrt density";
-      ThermoSysPro.Units.DerPressureByTemperature pt
-        "derivative of pressure wrt temperature";
-      Real dpT "dp/dT derivative of saturation curve";
-      Real dxv "der of x wrt v";
-      Real dvTl "der of v wrt T at boiling";
-      Real dvTv "der of v wrt T at dew";
-      Real dxT "der of x wrt T";
-      Real duTl "der of u wrt T at boiling";
-      Real duTv "der of u wrt T at dew";
-      Real vtt "2nd derivative of specific volume w.r.t. temperature";
-      Real cpt "derivative of cp w.r.t. temperature";
-      Real cvt "derivative of cv w.r.t. temperature";
-      Real dpTT "2nd der of p wrt T";
-      Real dxdd "2nd der of x wrt d";
-      Real dxTd "2nd der of x wrt d and T";
-      Real dvTTl "2nd der of v wrt T at boiling";
-      Real dvTTv "2nd der of v wrt T at dew";
-      Real dxTT " 2nd der of x wrt T";
-      Real duTTl "2nd der of u wrt T at boiling";
-      Real duTTv "2nd der of u wrt T at dew";
-
-      Integer error "error flag for inverse iterations";
-      Modelica.SIunits.SpecificEnthalpy h_liq "liquid specific enthalpy";
-      Modelica.SIunits.Density d_liq "liquid density";
-      Modelica.SIunits.SpecificEnthalpy h_vap "vapour specific enthalpy";
-      Modelica.SIunits.Density d_vap "vapour density";
-      Real x "dryness fraction";
-      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties3rd liq
-        "phase boundary property record";
-      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties3rd vap
-        "phase boundary property record";
-
-      Modelica.SIunits.Temperature t1
-        "temperature at phase boundary, using inverse from region 1";
-      Modelica.SIunits.Temperature t2
-        "temperature at phase boundary, using inverse from region 2";
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd gl
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd gv
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd fl
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd fv
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-      Modelica.SIunits.SpecificVolume v;
-
-      Real ptt "2nd derivative of pressure wrt temperature";
-      Real pdd "2nd derivative of pressure wrt density";
-      Real ptd "mixed derivative of pressure w.r.t. density and temperature";
-      Real vpp "2nd derivative of specific volume w.r.t. pressure";
-      Real vtp
-        "mixed derivative of specific volume w.r.t. pressure and temperature";
-
-      Real vp3 "vp^3";
-      Real ivp3 "1/vp3";
-
-      Real detPH "Determinant";
-      Real dht;
-      Real dhd;
-      Real ddhp;
-      Real ddph;
-      Real dtph;
-      Real dthp;
-      Real detPH_d;
-      Real detPH_t;
-      Real dhtt;
-      Real dhtd;
-      Real ddph_t;
-      Real ddph_d;
-      Real ddhp_t;
-      Real ddhp_d;
-
-      Real duhp_t;
-      Real duph_t;
-      Real duph_d;
-
-      Real dupp;
-      Real duph;
-      Real duhh;
-
-      Real dcp_d;
-
-      Real rho2 "square of density";
-      Real rho3 "cube of density";
-      Real cp3 "cube of specific heat capacity";
-      Real cpcpp;
-      Real quotient;
-      Real vt2;
-      Real pt2;
-      Real pt3;
-
-    algorithm
-      supercritical := (p >ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT);
-      phase := if ((h < ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hl_p(p)) or
-                   (h > ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hv_p(p)) or
-                   supercritical) then 1 else 2;
-      region := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_ph(p, h, phase, mode);
-
-      R :=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
-      if (region == 1) then
-        // get variables
-        T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tph1(p,h);
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1L3(p, T);
-        rho := p/(R*T*g.pi*g.gpi);
-        rho2 := rho*rho;
-        vt := R/p*(g.pi*g.gpi - g.tau*g.pi*g.gpitau);
-        vt2 := vt*vt;
-        cp := -R*g.tau*g.tau*g.gtautau;
-        cp3 := cp*cp*cp;
-        cpcpp := cp*cp*p;
-        vp := R*T/(p*p)*g.pi*g.pi*g.gpipi;
-        v := 1/rho;
-        vtt := R*g.pi/p*g.tau/T*g.tau*g.gpitautau;
-        vtp := R*g.pi*g.pi/(p*p)*(g.gpipi - g.tau*g.gpipitau);
-        vpp := R*T*g.pi*g.pi*g.pi/(p*p*p)*g.gpipipi;
-        cpt := R*g.tau*g.tau/T*(2*g.gtautau + g.tau*g.gtautautau);
-        pt := -g.p/g.T*(g.gpi - g.tau*g.gpitau)/(g.gpipi*g.pi);
-        pd := -g.R*g.T*g.gpi*g.gpi/(g.gpipi);
-        vp3 := vp*vp*vp;
-        ivp3 := 1/vp3;
-        ptt := -(vtt*vp*vp -2.0*vt*vtp*vp +vt2*vpp)*ivp3;
-        pdd := -vpp*ivp3/(rho2*rho2) - 2*v*pd "= pvv/d^4";
-        ptd := (vtp*vp-vt*vpp)*ivp3/rho2 "= -ptv/d^2";
-        cvt := (vp3*cpt + vp*vp*vt2 + 3.0*vp*vp*T*vt*vtt
-          - 3.0*vtp*vp*T*vt2 + T*vt2*vt*vpp)*ivp3;
-
-        // not in cache
-        detPH := cp*pd;
-        dht := cv + pt/rho;
-        dhd := (pd - T*pt/rho)/rho;
-        ddph := dht/ detPH;
-        ddhp := -pt/detPH;
-        dtph := -dhd/detPH;
-        dthp := pd/detPH;
-        detPH_d := cv*pdd + (2.0*pt *(ptd - pt/rho) - ptt*pd)*T/(rho2);
-        detPH_t := cvt*pd + cv*ptd + (pt + 2.0*T*ptt)*pt/rho2;
-        dhtt := cvt + ptt*v;
-        dhtd := (ptd - (T * ptt + pt)*v) *v;
-        ddhp_t := ddhp * (ptt / pt - detPH_t / detPH);
-        ddhp_d := ddhp * (ptd / pt - detPH_d / detPH);
-        ddph_t := ddph * (dhtt / dht - detPH_t / detPH);
-        ddph_d := ddph * (dhtd / dht - detPH_d / detPH);
-        dupp :=-(2.0*cp3*vp + cp3*p*vpp - 2.0*cp*cp*vt*v -
-              2.0*cpcpp*vtp*v - cpcpp*vt*vp + 2.0*cp*cp*T*vt2 +
-              3.0*cpcpp*vt*T*vtp - 4.0*T*vtt*cp*p*vt*v +
-              3.0*T*T*vtt*cp*p*vt2 + cp*p*vtt/rho2 - cpt*p*vt/rho2 +
-              2.0*cpt*p*vt2*v*T - cpt*p*vt2*T^2) / cp3;
-        duph := -(vtp*cpcpp + cp*cp*vt - cp*p*vtt*v + 2.0*cp*p*vt*T*vtt +
-              cpt*p*vt*v - cpt*p*vt2*T)/cp3;
-        duhh := -p*(cp*vtt - cpt*vt) / cp3;
-
-        // calculate derivatives
-        der_pro.x := 0.0;
-        der_pro.duhp := duph*p_der + duhh*h_der;
-        der_pro.duph :=  dupp*p_der + duph* h_der;
-        der_pro.ddph := (ddph * ddph_d + dtph * ddph_t)*p_der +
-           (ddph * ddhp_d + dtph * ddhp_t)*h_der;
-        der_pro.ddhp := (ddhp * ddhp_d + dthp * ddhp_t)*h_der +
-           (ddph * ddhp_d + dtph * ddhp_t)*p_der;
-        der_pro.cp := (-(T * vtt * cp + cpt/rho - cpt * T * vt) / cp)*p_der +
-          cpt/cp*h_der;
-        der_pro.s := -1/(rho*T)*p_der + 1/T*h_der;
-        der_pro.u := (-(p*vp*cp + cp*v - p*vt*v + p*vt2 *T)/cp)*p_der + ((cp - p*vt)/cp)*h_der;
-        der_pro.T := ((-v + T*vt)/cp)*p_der + (1/cp)*h_der;
-        der_pro.d := (-rho2*(vp*cp - vt/rho + T*vt2)/cp)*p_der + (-rho2*vt/(cp))*h_der;
-
-      elseif (region == 2) then
-        // get variables
-        T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tph2(p, h);
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2L3(p, T);
-        rho := p/(R*T*g.pi*g.gpi);
-        rho2 := rho*rho;
-        vt := R/p*(g.pi*g.gpi - g.tau*g.pi*g.gpitau);
-        vt2 := vt*vt;
-        cp := -R*g.tau*g.tau*g.gtautau;
-        cp3 := cp*cp*cp;
-        cpcpp := cp*cp*p;
-        vp := R*T/(p*p)*g.pi*g.pi*g.gpipi;
-        v := 1/rho;
-        vtt := R*g.pi/p*g.tau/T*g.tau*g.gpitautau;
-        vtp := R*g.pi*g.pi/(p*p)*(g.gpipi - g.tau*g.gpipitau);
-        vpp := R*T*g.pi*g.pi*g.pi/(p*p*p)*g.gpipipi;
-        cpt := R*g.tau*g.tau/T*(2*g.gtautau + g.tau*g.gtautautau);
-        pt := -g.p/g.T*(g.gpi - g.tau*g.gpitau)/(g.gpipi*g.pi);
-        pd := -g.R*g.T*g.gpi*g.gpi/(g.gpipi);
-        vp3 := vp*vp*vp;
-        ivp3 := 1/vp3;
-        ptt := -(vtt*vp*vp -2.0*vt*vtp*vp +vt2*vpp)*ivp3;
-        pdd := -vpp*ivp3/(rho2*rho2) - 2*v*pd "= pvv/d^4";
-        ptd := (vtp*vp-vt*vpp)*ivp3/rho2 "= -ptv/d^2";
-        cvt := (vp3*cpt + vp*vp*vt2 + 3.0*vp*vp*T*vt*vtt
-          - 3.0*vtp*vp*T*vt2 + T*vt2*vt*vpp)*ivp3;
-
-        // not in cache
-        detPH := cp*pd;
-        dht := cv + pt/rho;
-        dhd := (pd - T*pt/rho)/rho;
-        ddph := dht/ detPH;
-        ddhp := -pt/detPH;
-        dtph := -dhd/detPH;
-        dthp := pd/detPH;
-        detPH_d := cv*pdd + (2.0*pt *(ptd - pt/rho) - ptt*pd)*T/(rho2);
-        detPH_t := cvt*pd + cv*ptd + (pt + 2.0*T*ptt)*pt/rho2;
-        dhtt := cvt + ptt*v;
-        dhtd := (ptd - (T * ptt + pt)*v) *v;
-        ddhp_t := ddhp * (ptt / pt - detPH_t / detPH);
-        ddhp_d := ddhp * (ptd / pt - detPH_d / detPH);
-        ddph_t := ddph * (dhtt / dht - detPH_t / detPH);
-        ddph_d := ddph * (dhtd / dht - detPH_d / detPH);
-        dupp :=-(2.0*cp3*vp + cp3*p*vpp - 2.0*cp*cp*vt*v -
-              2.0*cpcpp*vtp*v - cpcpp*vt*vp + 2.0*cp*cp*T*vt2 +
-              3.0*cpcpp*vt*T*vtp - 4.0*T*vtt*cp*p*vt*v +
-              3.0*T*T*vtt*cp*p*vt2 + cp*p*vtt/rho2 - cpt*p*vt/rho2 +
-              2.0*cpt*p*vt2*v*T - cpt*p*vt2*T^2) / cp3;
-        duph := -(vtp*cpcpp + cp*cp*vt - cp*p*vtt*v + 2.0*cp*p*vt*T*vtt +
-              cpt*p*vt*v - cpt*p*vt2*T)/cp3;
-        duhh := -p*(cp*vtt - cpt*vt) / cp3;
-
-        // calculate derivatives
-        der_pro.x := 0.0;
-        der_pro.duhp := duph*p_der + duhh*h_der;
-        der_pro.duph :=  dupp*p_der + duph* h_der;
-        der_pro.ddph := (ddph * ddph_d + dtph * ddph_t)*p_der +
-           (ddph * ddhp_d + dtph * ddhp_t)*h_der;
-        der_pro.ddhp := (ddhp * ddhp_d + dthp * ddhp_t)*h_der +
-           (ddph * ddhp_d + dtph * ddhp_t)*p_der;
-        der_pro.cp := (-(T * vtt * cp + cpt/rho - cpt * T * vt) / cp)*p_der + cpt/cp*h_der;
-        der_pro.s := -1/(rho*T)*p_der + 1/T*h_der;
-        der_pro.u := (-(p*vp*cp + cp*v - p*vt*v + p*vt2 *T)/cp)*p_der + ((cp - p*vt)/cp)*h_der;
-        der_pro.T := ((-v + T*vt)/cp)*p_der + (1/cp)*h_der;
-        der_pro.d := (-rho2*(vp*cp - vt/rho + T*vt2)/cp)*p_der + (-rho2*vt/(cp))*h_der;
-
-      elseif (region == 3) then
-        // get variables
-        (rho,T,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.dtofph3(p,h,delp=1.0e-7,delh=1.0e-6);
-        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(rho, T);
-
-        rho2 := rho*rho;
-        rho3 := rho*rho2;
-        v := 1/rho;
-        pd := R*T*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta);
-        pt := R*rho*f.delta*(f.fdelta - f.tau*f.fdeltatau);
-        pt2 := pt*pt;
-        pt3 := pt2*pt;
-        cv := abs(R*(-f.tau*f.tau*f.ftautau))
-          "can be close to neg. infinity near critical point";
-        cp := (rho2*pd*cv + T*pt2)/(rho2*pd);
-        pdd := R*T*f.delta/rho*(2.0*f.fdelta + 4.0*f.delta*f.fdeltadelta +
-             f.delta*f.delta*f.fdeltadeltadelta);
-        ptt := R*rho*f.delta*f.tau*f.tau/T*f.fdeltatautau;
-        ptd := R*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta - 2.0*f.tau*f.fdeltatau
-             -f.delta*f.tau*f.fdeltadeltatau);
-        cvt := R*f.tau*f.tau/T*(2.0*f.ftautau + f.tau*f.ftautautau);
-        cpt := (cvt*pd + cv*ptd + (pt + 2.0*T*ptt)*pt/(rho2) - cp*ptd)/pd;
-
-        // not in cache
-        detPH := cp*pd;
-        dht := cv + pt/rho;
-        dhd := (pd - T*pt/rho)/rho;
-        ddph := dht/ detPH;
-        ddhp := -pt/detPH;
-        dtph := -dhd/detPH;
-        dthp := pd/detPH;
-        detPH_d := cv*pdd + (2.0*pt *(ptd - pt/rho) - ptt*pd) *T/(rho2);
-        detPH_t := cvt*pd + cv*ptd + (pt + 2.0*T*ptt)*pt/rho2;
-        dhtt := cvt + ptt*v;
-        dhtd := (ptd - (T * ptt + pt)*v) *v;
-        ddhp_t := ddhp * (ptt / pt - detPH_t / detPH);
-        ddhp_d := ddhp * (ptd / pt - detPH_d / detPH);
-        ddph_t := ddph * (dhtt / dht - detPH_t / detPH);
-        ddph_d := ddph * (dhtd / dht - detPH_d / detPH);
-
-        dcp_d :=(detPH_d - cp*pdd)/pd;
-
-        quotient := 1/(cv*rho2*pd + T*pt2)^3;
-        dupp := -(-4.0*ptt*p*cv*rho2*pd*T*pt + 2.0*p*cvt*rho2*T*pt2*pd -
-              2.0*ptt*p*T*pt2*rho*pd + 3.0*p*cv^2*rho3*ptd*T*pt +
-              3.0*p*cv*rho*T^2*pt2*ptt - 2.0*pt*p*cv*rho3*ptd*pd +
-              4.0*pt2*p*cv*rho2*ptd*T - 2.0*T^2*pt2*pt3 - 4.0*pt2*cv^2*rho3*pd*T -
-              4.0*pt3*cv*rho2*T*pd - p*cvt*rho*T^2*pt3 + ptt*p*cv*rho3*pd^2 -
-              2.0*p*cv^2*rho2*rho2*ptd*pd + 2.0*p*cv*rho2*pt2*pd +
-              2.0*p*cv*rho*pt3*T - pt*p*cvt*rho3*pd^2 + ptd*p*rho*T*pt3 +
-              5.0*pt*p*cv^2*rho3*pd + 2*pt*p*cv^2*rho2*rho2*pdd + pt2*p*cv*rho3*pdd +
-              2.0*pt2*pt2*p*T - 2.0*cv^3*rho3*rho2*pd^2 - 2.0*pt*cv^2*rho2*rho2*pd^2-
-              2.0*pt2*pt2*cv*rho*T^2 + 2.0*ptt*p*T^2*pt3 - pt3*p*rho*pd +
-              2.0*p*cv^3*rho2*rho2*pd + p*cv^3*rho2*rho3*pdd)*quotient/rho;
-        duph := (-2.0*ptt*p*cv*rho2*pd*T*pt + p*cvt*rho2*T*pt2*pd -
-              2.0*ptt*p*T*pt2*rho*pd - 2.0*pt*p*cv*rho3*ptd*pd +
-              2.0*pt2*p*cv*rho2*ptd*T - T^2*pt3*pt2 - 2*pt3*cv*rho2*T*pd +
-              ptt*p*cv*rho3*pd^2 - p*cv^2*rho2*rho2*ptd*pd + 2.0*p*cv*rho2*pt2*pd -
-              pt*p*cvt*rho3*pd^2 + ptd*p*rho*T*pt3 + 2.0*pt*p*cv^2*rho3*pd +
-              pt*p*cv^2*rho2*rho2*pdd + pt2*p*cv*rho3*pdd + pt2*pt2*p*T -
-              pt*cv^2*rho2*rho2*pd^2 + ptt*p*T^2*pt3 - pt3*p*rho*pd)*quotient;
-        duhh := p*(-pt3*T*ptd + 2.0*ptd*cv*rho2*pd*pt - 2.0*pt2*cv*rho*pd +
-              pt*cvt*rho2*pd^2 - pt2*cv*rho2*pdd + 2.0*pt2*T*ptt*pd -
-              ptt*cv*rho2*pd^2 + pt3*pd)*rho2 *quotient;
-
-        // calculate derivatives
-        der_pro.x := 0.0;
-        der_pro.duhp := duph*p_der + duhh*h_der;
-        der_pro.duph := dupp*p_der + duph* h_der;
-        der_pro.ddph := (ddph * ddph_d + dtph * ddph_t)*p_der +
-           (ddph * ddhp_d + dtph * ddhp_t)*h_der;
-        der_pro.ddhp := (ddhp * ddhp_d + dthp * ddhp_t)*h_der +
-           (ddph * ddhp_d + dtph * ddhp_t)*p_der;
-        der_pro.cp := (ddph * dcp_d + dtph * cpt)*p_der +
-           (ddhp * dcp_d + dthp * cpt)*h_der;
-        der_pro.s := -1/(rho*T)*p_der + 1/T*h_der;
-        der_pro.u := ((cv*rho2*pd - pt*p + T*pt2)/(cv*rho2*pd + T*pt2))*h_der +
-           ((cv*rho2*pd - p*cv*rho - pt*p + T*pt2)/(rho*(cv*rho2*pd + T*pt2)))*p_der;
-        der_pro.T := ((-rho*pd + T*pt)/(rho2*pd*cv+ T*pt*pt))*p_der +
-           ((rho2*pd)/(rho2*pd*cv + T*pt2))*h_der;
-        der_pro.d := ((rho*(cv*rho + pt))/(rho2*pd*cv + T*pt2))*p_der +
-          (-rho2*pt/(rho2*pd*cv + T*pt2))*h_der;
-
-      elseif (region == 4) then
-        // get variables
-        h_liq := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hl_p(p);
-        h_vap := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hv_p(p);
-        x := if (h_vap <> h_liq) then (h - h_liq)/(h_vap - h_liq) else 1.0;
-
-        if p <ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PLIMIT4A then
-          t1 := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tph1(p, h_liq);
-          t2 := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tph2(p, h_vap);
-          gl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1L3(p, t1);
-          gv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2L3(p, t2);
-          liq := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps3rd(gl);
-          vap := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps3rd(gv);
-          T := t1 + x*(t2 - t1);
-        else
-          T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tsat(p);
-          // how to avoid ?
-
-          d_liq := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.rhol_T(T);
-          d_vap := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.rhov_T(T);
-          fl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(d_liq, T);
-          fv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(d_vap, T);
-          liq := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps3rd(fl);
-          vap := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps3rd(fv);
-          //  dpT := BaseIF97.Basic.dptofT(T);
-        end if;
-
-        rho := liq.d*vap.d/(vap.d + x*(liq.d - vap.d));
-        rho2 := rho*rho;
-        rho3 := rho*rho2;
-        v := 1/rho;
-        dxv := if (liq.d <> vap.d) then liq.d*vap.d/(liq.d-vap.d) else 0.0;
-        dpT := if (liq.d <> vap.d) then (vap.s - liq.s)*dxv else ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.dptofT(T);
-
-        dvTl := (liq.pt -dpT)/(liq.pd*liq.d*liq.d);
-        dvTv := (vap.pt -dpT)/(vap.pd*vap.d*vap.d);
-        dxT := -dxv*(dvTl + x*(dvTv-dvTl));
-        duTl := liq.cv + (T*liq.pt-p)*dvTl;
-        duTv := vap.cv + (T*vap.pt-p)*dvTv;
-        cv := duTl + x*(duTv-duTl) + dxT * (vap.u-liq.u);
-        dpTT := dxv*(vap.cv/T-liq.cv/T + dvTv*(vap.pt-dpT)-dvTl*(liq.pt-dpT));
-        dxdd := 2.0*dxv/(rho3);
-        dxTd := dxv*dxv*(dvTv-dvTl)/(rho2);
-        dvTTl := ((liq.ptt-dpTT)/(liq.d*liq.d) + dvTl*(liq.d*dvTl*(2.0*liq.pd + liq.d*liq.pdd)
-             -2.0*liq.ptd))/liq.pd;
-        dvTTv := ((vap.ptt-dpTT)/(vap.d*vap.d) + dvTv*(vap.d*dvTv*(2.0*vap.pd + vap.d*vap.pdd)
-             -2.0*vap.ptd))/vap.pd;
-        dxTT := -dxv*(2.0*dxT*(dvTv-dvTl) + dvTTl + x*(dvTTv-dvTTl));
-        duTTl := liq.cvt +(liq.pt-dpT + T*(2.0*liq.ptt -liq.d*liq.d*liq.ptd *dvTl))*dvTl + (T*
-          liq.pt - p)*dvTTl;
-        duTTv := vap.cvt +(vap.pt-dpT + T*(2.0*vap.ptt -vap.d*vap.d*vap.ptd *dvTv))*dvTv + (T*
-          vap.pt - p)*dvTTv;
-        cvt := duTTl + x *(duTTv -duTTl) + 2.0*dxT*(duTv-duTl) + dxTT *(vap.u-liq.u);
-        ptt := dpTT;
-
-        // not in cache
-        dht := cv + dpT * v;
-        dhd := -T * dpT*v*v;
-        detPH := -dpT * dhd;
-        dtph := 1.0 / dpT;
-        ddph := dht / detPH;
-        ddhp := -dpT / detPH;
-        detPH_d := -2.0 * v;                   /* = detPH_d / detPH */
-        detPH_t := 2.0 * ptt / dpT + 1.0 / T; /* = detPH_t / detPH */
-        dhtt := cvt + ptt * v;
-        dhtd := -(T * ptt + dpT) *v*v;
-        ddhp_t := ddhp * (ptt / dpT - detPH_t);
-        ddhp_d := ddhp * (-detPH_d);
-        ddph_t := ddph * (dhtt / dht - detPH_t);
-        ddph_d := ddph * (dhtd / dht - detPH_d);
-        duhp_t := (ddhp * dpT + p * ddhp_t) / (rho2);
-        duph_t :=(ddph*dpT + p*ddph_t)/(rho2);
-        duph_d :=((-2.0*ddph/rho + ddph_d)*p + 1.0)/(rho2);
-
-        // calculate derivatives
-        der_pro.x := if (h_vap <> h_liq) then h_der/(h_vap - h_liq) else 0.0;
-        der_pro.duhp := (dtph * duhp_t)*p_der;
-        der_pro.duph :=  (ddph * duph_d + dtph * duph_t)*p_der + (dtph * duhp_t)* h_der;
-        der_pro.ddph := (ddph * ddph_d + dtph * ddph_t)*p_der + (ddhp * ddph_d)*h_der;
-        der_pro.ddhp := (ddhp * ddhp_d)*h_der + (ddhp * ddph_d)*p_der;
-        der_pro.cp :=0.0;
-        der_pro.s := -1/(rho*T)*p_der + 1/T*h_der;
-        der_pro.u := ((ddph*p/rho - 1.0)/rho)*p_der + (ddhp*p/(rho2) + 1.0)*h_der;
-        der_pro.T := 1/dpT*p_der;
-        der_pro.d := (rho*(rho*cv/dpT + 1.0)/(dpT*T))*p_der
-           + (-rho2/(dpT*T))*h_der;
-
-      elseif (region == 5) then
-        // get variables
-        (T,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.tofph5(p,h,reldh=1.0e-7);
-        assert(error == 0, "error in inverse iteration of steam tables");
-
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g5L3(p, T);
-        rho := p/(R*T*g.pi*g.gpi);
-        rho2 := rho*rho;
-        vt := R/p*(g.pi*g.gpi - g.tau*g.pi*g.gpitau);
-        vt2 := vt*vt;
-        cp := -R*g.tau*g.tau*g.gtautau;
-        cp3 := cp*cp*cp;
-        cpcpp := cp*cp*p;
-        vp := R*T/(p*p)*g.pi*g.pi*g.gpipi;
-        v := 1/rho;
-        vtt := R*g.pi/p*g.tau/T*g.tau*g.gpitautau;
-        vtp := R*g.pi*g.pi/(p*p)*(g.gpipi - g.tau*g.gpipitau);
-        vpp := R*T*g.pi*g.pi*g.pi/(p*p*p)*g.gpipipi;
-        cpt := R*g.tau*g.tau/T*(2*g.gtautau + g.tau*g.gtautautau);
-        pt := -g.p/g.T*(g.gpi - g.tau*g.gpitau)/(g.gpipi*g.pi);
-        pd := -g.R*g.T*g.gpi*g.gpi/(g.gpipi);
-        vp3 := vp*vp*vp;
-        ivp3 := 1/vp3;
-        ptt := -(vtt*vp*vp -2.0*vt*vtp*vp +vt2*vpp)*ivp3;
-        pdd := -vpp*ivp3/(rho2*rho2) - 2*v*pd "= pvv/d^4";
-        ptd := (vtp*vp-vt*vpp)*ivp3/rho2 "= -ptv/d^2";
-        cvt := (vp3*cpt + vp*vp*vt2 + 3.0*vp*vp*T*vt*vtt
-          - 3.0*vtp*vp*T*vt2 + T*vt2*vt*vpp)*ivp3;
-
-        // not in cache
-        detPH := cp*pd;
-        dht := cv + pt/rho;
-        dhd := (pd - T*pt/rho)/rho;
-        ddph := dht/ detPH;
-        ddhp := -pt/detPH;
-        dtph := -dhd/detPH;
-        dthp := pd/detPH;
-        detPH_d := cv*pdd + (2.0*pt *(ptd - pt/rho) - ptt*pd)*T/(rho2);
-        detPH_t := cvt*pd + cv*ptd + (pt + 2.0*T*ptt)*pt/rho2;
-        dhtt := cvt + ptt*v;
-        dhtd := (ptd - (T * ptt + pt)*v) *v;
-        ddhp_t := ddhp * (ptt / pt - detPH_t / detPH);
-        ddhp_d := ddhp * (ptd / pt - detPH_d / detPH);
-        ddph_t := ddph * (dhtt / dht - detPH_t / detPH);
-        ddph_d := ddph * (dhtd / dht - detPH_d / detPH);
-        dupp :=-(2.0*cp3*vp + cp3*p*vpp - 2.0*cp*cp*vt*v -
-              2.0*cpcpp*vtp*v - cpcpp*vt*vp + 2.0*cp*cp*T*vt2 +
-              3.0*cpcpp*vt*T*vtp - 4.0*T*vtt*cp*p*vt*v +
-              3.0*T*T*vtt*cp*p*vt2 + cp*p*vtt/rho2 - cpt*p*vt/rho2 +
-              2.0*cpt*p*vt2*v*T - cpt*p*vt2*T^2) / cp3;
-        duph := -(vtp*cpcpp + cp*cp*vt - cp*p*vtt*v + 2.0*cp*p*vt*T*vtt +
-              cpt*p*vt*v - cpt*p*vt2*T)/cp3;
-        duhh := -p*(cp*vtt - cpt*vt) / cp3;
-
-        // calculate derivatives
-        der_pro.x := 0.0;
-        der_pro.duhp := duph*p_der + duhh*h_der;
-        der_pro.duph :=  dupp*p_der + duph* h_der;
-        der_pro.ddph := (ddph * ddph_d + dtph * ddph_t)*p_der +
-           (ddph * ddhp_d + dtph * ddhp_t)*h_der;
-        der_pro.ddhp := (ddhp * ddhp_d + dthp * ddhp_t)*h_der +
-           (ddph * ddhp_d + dtph * ddhp_t)*p_der;
-        der_pro.cp := (-(T * vtt * cp + cpt/rho - cpt * T * vt) / cp)*p_der + cpt/cp*h_der;
-        der_pro.s := -1/(rho*T)*p_der + 1/T*h_der;
-        der_pro.u := (-(p*vp*cp + cp*v - p*vt*v + p*vt2 *T)/cp)*p_der + ((cp - p*vt)/cp)*h_der;
-        der_pro.T := ((-v + T*vt)/cp)*p_der + (1/cp)*h_der;
-        der_pro.d := (-rho2*(vp*cp - vt/rho + T*vt2)/cp)*p_der + (-rho2*vt/(cp))*h_der;
-
-      else
-        assert(false, "Water_Ph_der: Incorrect region number");
-      end if;
-
-      annotation (
-        Window(
-          x=0.22,
-          y=0.2,
-          width=0.6,
-          height=0.6),
-        Icon(coordinateSystem(
-            preserveAspectRatio=false,
-            extent={{-100,-100},{100,100}},
-            grid={2,2}), graphics={
-            Text(extent={{-134,104},{142,44}}, textString=
-                                                   "%name"),
-            Ellipse(
-              extent={{-100,40},{100,-100}},
-              lineColor={255,127,0},
-              fillColor={255,255,255},
-              fillPattern=FillPattern.Solid),
-            Text(
-              extent={{-84,-4},{84,-52}},
-              lineColor={255,127,0},
-              textString=
-                   "fonction")}),
-        Documentation(info="<html>
+        "));
+    end Pressure_sat_hl_der;
+
+    function Water_Ph_der "Derivative function of Water_Ph"
+      input Modelica.Units.SI.AbsolutePressure p "Pressure";
+      input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+      input Integer mode = 0 "Région IF97 - 0:calcul automatique";
+      //input CombiPlant.ThermoFluidPro.Media.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
+      input Real p_der "derivative of Pressure";
+      input Real h_der "derivative of Specific enthalpy";
+      output ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph der_pro "Derivative";
+    protected
+      Integer phase;
+      Integer region;
+      Boolean supercritical;
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd g "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd f "dimensionless Helmholtz funcion and dervatives wrt delta and tau";
+      Modelica.Units.SI.Temperature T;
+      Modelica.Units.SI.SpecificHeatCapacity R "gas constant";
+      Modelica.Units.SI.Density rho "density";
+      Real vt "derivative of specific volume w.r.t. temperature";
+      Modelica.Units.SI.SpecificHeatCapacity cp "specific heat capacity";
+      Modelica.Units.SI.SpecificHeatCapacity cv "specific heat capacity";
+      Real vp "derivative of specific volume w.r.t. pressure";
+      ThermoSysPro.Units.DerPressureByDensity pd "derivative of pressure wrt density";
+      ThermoSysPro.Units.DerPressureByTemperature pt "derivative of pressure wrt temperature";
+      Real dpT "dp/dT derivative of saturation curve";
+      Real dxv "der of x wrt v";
+      Real dvTl "der of v wrt T at boiling";
+      Real dvTv "der of v wrt T at dew";
+      Real dxT "der of x wrt T";
+      Real duTl "der of u wrt T at boiling";
+      Real duTv "der of u wrt T at dew";
+      Real vtt "2nd derivative of specific volume w.r.t. temperature";
+      Real cpt "derivative of cp w.r.t. temperature";
+      Real cvt "derivative of cv w.r.t. temperature";
+      Real dpTT "2nd der of p wrt T";
+      Real dxdd "2nd der of x wrt d";
+      Real dxTd "2nd der of x wrt d and T";
+      Real dvTTl "2nd der of v wrt T at boiling";
+      Real dvTTv "2nd der of v wrt T at dew";
+      Real dxTT " 2nd der of x wrt T";
+      Real duTTl "2nd der of u wrt T at boiling";
+      Real duTTv "2nd der of u wrt T at dew";
+      Integer error "error flag for inverse iterations";
+      Modelica.Units.SI.SpecificEnthalpy h_liq "liquid specific enthalpy";
+      Modelica.Units.SI.Density d_liq "liquid density";
+      Modelica.Units.SI.SpecificEnthalpy h_vap "vapour specific enthalpy";
+      Modelica.Units.SI.Density d_vap "vapour density";
+      Real x "dryness fraction";
+      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties3rd liq "phase boundary property record";
+      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties3rd vap "phase boundary property record";
+      Modelica.Units.SI.Temperature t1 "temperature at phase boundary, using inverse from region 1";
+      Modelica.Units.SI.Temperature t2 "temperature at phase boundary, using inverse from region 2";
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd gl "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd gv "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd fl "dimensionless Helmholtz function and dervatives wrt delta and tau";
+      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd fv "dimensionless Helmholtz function and dervatives wrt delta and tau";
+      Modelica.Units.SI.SpecificVolume v;
+      Real ptt "2nd derivative of pressure wrt temperature";
+      Real pdd "2nd derivative of pressure wrt density";
+      Real ptd "mixed derivative of pressure w.r.t. density and temperature";
+      Real vpp "2nd derivative of specific volume w.r.t. pressure";
+      Real vtp "mixed derivative of specific volume w.r.t. pressure and temperature";
+      Real vp3 "vp^3";
+      Real ivp3 "1/vp3";
+      Real detPH "Determinant";
+      Real dht;
+      Real dhd;
+      Real ddhp;
+      Real ddph;
+      Real dtph;
+      Real dthp;
+      Real detPH_d;
+      Real detPH_t;
+      Real dhtt;
+      Real dhtd;
+      Real ddph_t;
+      Real ddph_d;
+      Real ddhp_t;
+      Real ddhp_d;
+      Real duhp_t;
+      Real duph_t;
+      Real duph_d;
+      Real dupp;
+      Real duph;
+      Real duhh;
+      Real dcp_d;
+      Real rho2 "square of density";
+      Real rho3 "cube of density";
+      Real cp3 "cube of specific heat capacity";
+      Real cpcpp;
+      Real quotient;
+      Real vt2;
+      Real pt2;
+      Real pt3;
+    algorithm
+      supercritical := p > ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT;
+      phase := if h < ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hl_p(p) or h > ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hv_p(p) or supercritical then 1 else 2;
+      region := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_ph(p, h, phase, mode);
+      R := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
+      if region == 1 then
+        T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tph1(p, h);
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1L3(p, T);
+        rho := p / (R * T * g.pi * g.gpi);
+        rho2 := rho * rho;
+        vt := R / p * (g.pi * g.gpi - g.tau * g.pi * g.gpitau);
+        vt2 := vt * vt;
+        cp := -R * g.tau * g.tau * g.gtautau;
+        cp3 := cp * cp * cp;
+        cpcpp := cp * cp * p;
+        vp := R * T / (p * p) * g.pi * g.pi * g.gpipi;
+        v := 1 / rho;
+        vtt := R * g.pi / p * g.tau / T * g.tau * g.gpitautau;
+        vtp := R * g.pi * g.pi / (p * p) * (g.gpipi - g.tau * g.gpipitau);
+        vpp := R * T * g.pi * g.pi * g.pi / (p * p * p) * g.gpipipi;
+        cpt := R * g.tau * g.tau / T * (2 * g.gtautau + g.tau * g.gtautautau);
+        pt := -g.p / g.T * (g.gpi - g.tau * g.gpitau) / (g.gpipi * g.pi);
+        pd := -g.R * g.T * g.gpi * g.gpi / g.gpipi;
+        vp3 := vp * vp * vp;
+        ivp3 := 1 / vp3;
+        ptt := -(vtt * vp * vp - 2.0 * vt * vtp * vp + vt2 * vpp) * ivp3;
+        pdd := (-vpp * ivp3 / (rho2 * rho2)) - 2 * v * pd "= pvv/d^4";
+        ptd := (vtp * vp - vt * vpp) * ivp3 / rho2 "= -ptv/d^2";
+        cvt := (vp3 * cpt + vp * vp * vt2 + 3.0 * vp * vp * T * vt * vtt - 3.0 * vtp * vp * T * vt2 + T * vt2 * vt * vpp) * ivp3;
+        detPH := cp * pd;
+        dht := cv + pt / rho;
+        dhd := (pd - T * pt / rho) / rho;
+        ddph := dht / detPH;
+        ddhp := -pt / detPH;
+        dtph := -dhd / detPH;
+        dthp := pd / detPH;
+        detPH_d := cv * pdd + (2.0 * pt * (ptd - pt / rho) - ptt * pd) * T / rho2;
+        detPH_t := cvt * pd + cv * ptd + (pt + 2.0 * T * ptt) * pt / rho2;
+        dhtt := cvt + ptt * v;
+        dhtd := (ptd - (T * ptt + pt) * v) * v;
+        ddhp_t := ddhp * (ptt / pt - detPH_t / detPH);
+        ddhp_d := ddhp * (ptd / pt - detPH_d / detPH);
+        ddph_t := ddph * (dhtt / dht - detPH_t / detPH);
+        ddph_d := ddph * (dhtd / dht - detPH_d / detPH);
+        dupp := -(2.0 * cp3 * vp + cp3 * p * vpp - 2.0 * cp * cp * vt * v - 2.0 * cpcpp * vtp * v - cpcpp * vt * vp + 2.0 * cp * cp * T * vt2 + 3.0 * cpcpp * vt * T * vtp - 4.0 * T * vtt * cp * p * vt * v + 3.0 * T * T * vtt * cp * p * vt2 + cp * p * vtt / rho2 - cpt * p * vt / rho2 + 2.0 * cpt * p * vt2 * v * T - cpt * p * vt2 * T ^ 2) / cp3;
+        duph := -(vtp * cpcpp + cp * cp * vt - cp * p * vtt * v + 2.0 * cp * p * vt * T * vtt + cpt * p * vt * v - cpt * p * vt2 * T) / cp3;
+        duhh := -p * (cp * vtt - cpt * vt) / cp3;
+        der_pro.x := 0.0;
+        der_pro.duhp := duph * p_der + duhh * h_der;
+        der_pro.duph := dupp * p_der + duph * h_der;
+        der_pro.ddph := (ddph * ddph_d + dtph * ddph_t) * p_der + (ddph * ddhp_d + dtph * ddhp_t) * h_der;
+        der_pro.ddhp := (ddhp * ddhp_d + dthp * ddhp_t) * h_der + (ddph * ddhp_d + dtph * ddhp_t) * p_der;
+        der_pro.cp := (-(T * vtt * cp + cpt / rho - cpt * T * vt) / cp) * p_der + cpt / cp * h_der;
+        der_pro.s := (-1 / (rho * T) * p_der) + 1 / T * h_der;
+        der_pro.u := (-(p * vp * cp + cp * v - p * vt * v + p * vt2 * T) / cp) * p_der + (cp - p * vt) / cp * h_der;
+        der_pro.T := ((-v) + T * vt) / cp * p_der + 1 / cp * h_der;
+        der_pro.d := (-rho2 * (vp * cp - vt / rho + T * vt2) / cp) * p_der + (-rho2 * vt / cp) * h_der;
+      elseif region == 2 then
+        T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tph2(p, h);
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2L3(p, T);
+        rho := p / (R * T * g.pi * g.gpi);
+        rho2 := rho * rho;
+        vt := R / p * (g.pi * g.gpi - g.tau * g.pi * g.gpitau);
+        vt2 := vt * vt;
+        cp := -R * g.tau * g.tau * g.gtautau;
+        cp3 := cp * cp * cp;
+        cpcpp := cp * cp * p;
+        vp := R * T / (p * p) * g.pi * g.pi * g.gpipi;
+        v := 1 / rho;
+        vtt := R * g.pi / p * g.tau / T * g.tau * g.gpitautau;
+        vtp := R * g.pi * g.pi / (p * p) * (g.gpipi - g.tau * g.gpipitau);
+        vpp := R * T * g.pi * g.pi * g.pi / (p * p * p) * g.gpipipi;
+        cpt := R * g.tau * g.tau / T * (2 * g.gtautau + g.tau * g.gtautautau);
+        pt := -g.p / g.T * (g.gpi - g.tau * g.gpitau) / (g.gpipi * g.pi);
+        pd := -g.R * g.T * g.gpi * g.gpi / g.gpipi;
+        vp3 := vp * vp * vp;
+        ivp3 := 1 / vp3;
+        ptt := -(vtt * vp * vp - 2.0 * vt * vtp * vp + vt2 * vpp) * ivp3;
+        pdd := (-vpp * ivp3 / (rho2 * rho2)) - 2 * v * pd "= pvv/d^4";
+        ptd := (vtp * vp - vt * vpp) * ivp3 / rho2 "= -ptv/d^2";
+        cvt := (vp3 * cpt + vp * vp * vt2 + 3.0 * vp * vp * T * vt * vtt - 3.0 * vtp * vp * T * vt2 + T * vt2 * vt * vpp) * ivp3;
+        detPH := cp * pd;
+        dht := cv + pt / rho;
+        dhd := (pd - T * pt / rho) / rho;
+        ddph := dht / detPH;
+        ddhp := -pt / detPH;
+        dtph := -dhd / detPH;
+        dthp := pd / detPH;
+        detPH_d := cv * pdd + (2.0 * pt * (ptd - pt / rho) - ptt * pd) * T / rho2;
+        detPH_t := cvt * pd + cv * ptd + (pt + 2.0 * T * ptt) * pt / rho2;
+        dhtt := cvt + ptt * v;
+        dhtd := (ptd - (T * ptt + pt) * v) * v;
+        ddhp_t := ddhp * (ptt / pt - detPH_t / detPH);
+        ddhp_d := ddhp * (ptd / pt - detPH_d / detPH);
+        ddph_t := ddph * (dhtt / dht - detPH_t / detPH);
+        ddph_d := ddph * (dhtd / dht - detPH_d / detPH);
+        dupp := -(2.0 * cp3 * vp + cp3 * p * vpp - 2.0 * cp * cp * vt * v - 2.0 * cpcpp * vtp * v - cpcpp * vt * vp + 2.0 * cp * cp * T * vt2 + 3.0 * cpcpp * vt * T * vtp - 4.0 * T * vtt * cp * p * vt * v + 3.0 * T * T * vtt * cp * p * vt2 + cp * p * vtt / rho2 - cpt * p * vt / rho2 + 2.0 * cpt * p * vt2 * v * T - cpt * p * vt2 * T ^ 2) / cp3;
+        duph := -(vtp * cpcpp + cp * cp * vt - cp * p * vtt * v + 2.0 * cp * p * vt * T * vtt + cpt * p * vt * v - cpt * p * vt2 * T) / cp3;
+        duhh := -p * (cp * vtt - cpt * vt) / cp3;
+        der_pro.x := 0.0;
+        der_pro.duhp := duph * p_der + duhh * h_der;
+        der_pro.duph := dupp * p_der + duph * h_der;
+        der_pro.ddph := (ddph * ddph_d + dtph * ddph_t) * p_der + (ddph * ddhp_d + dtph * ddhp_t) * h_der;
+        der_pro.ddhp := (ddhp * ddhp_d + dthp * ddhp_t) * h_der + (ddph * ddhp_d + dtph * ddhp_t) * p_der;
+        der_pro.cp := (-(T * vtt * cp + cpt / rho - cpt * T * vt) / cp) * p_der + cpt / cp * h_der;
+        der_pro.s := (-1 / (rho * T) * p_der) + 1 / T * h_der;
+        der_pro.u := (-(p * vp * cp + cp * v - p * vt * v + p * vt2 * T) / cp) * p_der + (cp - p * vt) / cp * h_der;
+        der_pro.T := ((-v) + T * vt) / cp * p_der + 1 / cp * h_der;
+        der_pro.d := (-rho2 * (vp * cp - vt / rho + T * vt2) / cp) * p_der + (-rho2 * vt / cp) * h_der;
+      elseif region == 3 then
+        (rho, T, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.dtofph3(p, h, delp = 1.0e-7, delh = 1.0e-6);
+        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(rho, T);
+        rho2 := rho * rho;
+        rho3 := rho * rho2;
+        v := 1 / rho;
+        pd := R * T * f.delta * (2.0 * f.fdelta + f.delta * f.fdeltadelta);
+        pt := R * rho * f.delta * (f.fdelta - f.tau * f.fdeltatau);
+        pt2 := pt * pt;
+        pt3 := pt2 * pt;
+        cv := abs(R * (-f.tau * f.tau * f.ftautau)) "can be close to neg. infinity near critical point";
+        cp := (rho2 * pd * cv + T * pt2) / (rho2 * pd);
+        pdd := R * T * f.delta / rho * (2.0 * f.fdelta + 4.0 * f.delta * f.fdeltadelta + f.delta * f.delta * f.fdeltadeltadelta);
+        ptt := R * rho * f.delta * f.tau * f.tau / T * f.fdeltatautau;
+        ptd := R * f.delta * (2.0 * f.fdelta + f.delta * f.fdeltadelta - 2.0 * f.tau * f.fdeltatau - f.delta * f.tau * f.fdeltadeltatau);
+        cvt := R * f.tau * f.tau / T * (2.0 * f.ftautau + f.tau * f.ftautautau);
+        cpt := (cvt * pd + cv * ptd + (pt + 2.0 * T * ptt) * pt / rho2 - cp * ptd) / pd;
+        detPH := cp * pd;
+        dht := cv + pt / rho;
+        dhd := (pd - T * pt / rho) / rho;
+        ddph := dht / detPH;
+        ddhp := -pt / detPH;
+        dtph := -dhd / detPH;
+        dthp := pd / detPH;
+        detPH_d := cv * pdd + (2.0 * pt * (ptd - pt / rho) - ptt * pd) * T / rho2;
+        detPH_t := cvt * pd + cv * ptd + (pt + 2.0 * T * ptt) * pt / rho2;
+        dhtt := cvt + ptt * v;
+        dhtd := (ptd - (T * ptt + pt) * v) * v;
+        ddhp_t := ddhp * (ptt / pt - detPH_t / detPH);
+        ddhp_d := ddhp * (ptd / pt - detPH_d / detPH);
+        ddph_t := ddph * (dhtt / dht - detPH_t / detPH);
+        ddph_d := ddph * (dhtd / dht - detPH_d / detPH);
+        dcp_d := (detPH_d - cp * pdd) / pd;
+        quotient := 1 / (cv * rho2 * pd + T * pt2) ^ 3;
+        dupp := -((-4.0 * ptt * p * cv * rho2 * pd * T * pt) + 2.0 * p * cvt * rho2 * T * pt2 * pd - 2.0 * ptt * p * T * pt2 * rho * pd + 3.0 * p * cv ^ 2 * rho3 * ptd * T * pt + 3.0 * p * cv * rho * T ^ 2 * pt2 * ptt - 2.0 * pt * p * cv * rho3 * ptd * pd + 4.0 * pt2 * p * cv * rho2 * ptd * T - 2.0 * T ^ 2 * pt2 * pt3 - 4.0 * pt2 * cv ^ 2 * rho3 * pd * T - 4.0 * pt3 * cv * rho2 * T * pd - p * cvt * rho * T ^ 2 * pt3 + ptt * p * cv * rho3 * pd ^ 2 - 2.0 * p * cv ^ 2 * rho2 * rho2 * ptd * pd + 2.0 * p * cv * rho2 * pt2 * pd + 2.0 * p * cv * rho * pt3 * T - pt * p * cvt * rho3 * pd ^ 2 + ptd * p * rho * T * pt3 + 5.0 * pt * p * cv ^ 2 * rho3 * pd + 2 * pt * p * cv ^ 2 * rho2 * rho2 * pdd + pt2 * p * cv * rho3 * pdd + 2.0 * pt2 * pt2 * p * T - 2.0 * cv ^ 3 * rho3 * rho2 * pd ^ 2 - 2.0 * pt * cv ^ 2 * rho2 * rho2 * pd ^ 2 - 2.0 * pt2 * pt2 * cv * rho * T ^ 2 + 2.0 * ptt * p * T ^ 2 * pt3 - pt3 * p * rho * pd + 2.0 * p * cv ^ 3 * rho2 * rho2 * pd + p * cv ^ 3 * rho2 * rho3 * pdd) * quotient / rho;
+        duph := ((-2.0 * ptt * p * cv * rho2 * pd * T * pt) + p * cvt * rho2 * T * pt2 * pd - 2.0 * ptt * p * T * pt2 * rho * pd - 2.0 * pt * p * cv * rho3 * ptd * pd + 2.0 * pt2 * p * cv * rho2 * ptd * T - T ^ 2 * pt3 * pt2 - 2 * pt3 * cv * rho2 * T * pd + ptt * p * cv * rho3 * pd ^ 2 - p * cv ^ 2 * rho2 * rho2 * ptd * pd + 2.0 * p * cv * rho2 * pt2 * pd - pt * p * cvt * rho3 * pd ^ 2 + ptd * p * rho * T * pt3 + 2.0 * pt * p * cv ^ 2 * rho3 * pd + pt * p * cv ^ 2 * rho2 * rho2 * pdd + pt2 * p * cv * rho3 * pdd + pt2 * pt2 * p * T - pt * cv ^ 2 * rho2 * rho2 * pd ^ 2 + ptt * p * T ^ 2 * pt3 - pt3 * p * rho * pd) * quotient;
+        duhh := p * ((-pt3 * T * ptd) + 2.0 * ptd * cv * rho2 * pd * pt - 2.0 * pt2 * cv * rho * pd + pt * cvt * rho2 * pd ^ 2 - pt2 * cv * rho2 * pdd + 2.0 * pt2 * T * ptt * pd - ptt * cv * rho2 * pd ^ 2 + pt3 * pd) * rho2 * quotient;
+        der_pro.x := 0.0;
+        der_pro.duhp := duph * p_der + duhh * h_der;
+        der_pro.duph := dupp * p_der + duph * h_der;
+        der_pro.ddph := (ddph * ddph_d + dtph * ddph_t) * p_der + (ddph * ddhp_d + dtph * ddhp_t) * h_der;
+        der_pro.ddhp := (ddhp * ddhp_d + dthp * ddhp_t) * h_der + (ddph * ddhp_d + dtph * ddhp_t) * p_der;
+        der_pro.cp := (ddph * dcp_d + dtph * cpt) * p_der + (ddhp * dcp_d + dthp * cpt) * h_der;
+        der_pro.s := (-1 / (rho * T) * p_der) + 1 / T * h_der;
+        der_pro.u := (cv * rho2 * pd - pt * p + T * pt2) / (cv * rho2 * pd + T * pt2) * h_der + (cv * rho2 * pd - p * cv * rho - pt * p + T * pt2) / (rho * (cv * rho2 * pd + T * pt2)) * p_der;
+        der_pro.T := ((-rho * pd) + T * pt) / (rho2 * pd * cv + T * pt * pt) * p_der + rho2 * pd / (rho2 * pd * cv + T * pt2) * h_der;
+        der_pro.d := rho * (cv * rho + pt) / (rho2 * pd * cv + T * pt2) * p_der + (-rho2 * pt / (rho2 * pd * cv + T * pt2)) * h_der;
+      elseif region == 4 then
+        h_liq := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hl_p(p);
+        h_vap := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hv_p(p);
+        x := if h_vap <> h_liq then (h - h_liq) / (h_vap - h_liq) else 1.0;
+        if p < ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PLIMIT4A then
+          t1 := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tph1(p, h_liq);
+          t2 := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tph2(p, h_vap);
+          gl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1L3(p, t1);
+          gv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2L3(p, t2);
+          liq := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps3rd(gl);
+          vap := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps3rd(gv);
+          T := t1 + x * (t2 - t1);
+        else
+          T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tsat(p);
+          d_liq := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.rhol_T(T);
+          d_vap := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.rhov_T(T);
+          fl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(d_liq, T);
+          fv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(d_vap, T);
+          liq := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps3rd(fl);
+          vap := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps3rd(fv);
+        end if;
+        rho := liq.d * vap.d / (vap.d + x * (liq.d - vap.d));
+        rho2 := rho * rho;
+        rho3 := rho * rho2;
+        v := 1 / rho;
+        dxv := if liq.d <> vap.d then liq.d * vap.d / (liq.d - vap.d) else 0.0;
+        dpT := if liq.d <> vap.d then (vap.s - liq.s) * dxv else ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.dptofT(T);
+        dvTl := (liq.pt - dpT) / (liq.pd * liq.d * liq.d);
+        dvTv := (vap.pt - dpT) / (vap.pd * vap.d * vap.d);
+        dxT := -dxv * (dvTl + x * (dvTv - dvTl));
+        duTl := liq.cv + (T * liq.pt - p) * dvTl;
+        duTv := vap.cv + (T * vap.pt - p) * dvTv;
+        cv := duTl + x * (duTv - duTl) + dxT * (vap.u - liq.u);
+        dpTT := dxv * (vap.cv / T - liq.cv / T + dvTv * (vap.pt - dpT) - dvTl * (liq.pt - dpT));
+        dxdd := 2.0 * dxv / rho3;
+        dxTd := dxv * dxv * (dvTv - dvTl) / rho2;
+        dvTTl := ((liq.ptt - dpTT) / (liq.d * liq.d) + dvTl * (liq.d * dvTl * (2.0 * liq.pd + liq.d * liq.pdd) - 2.0 * liq.ptd)) / liq.pd;
+        dvTTv := ((vap.ptt - dpTT) / (vap.d * vap.d) + dvTv * (vap.d * dvTv * (2.0 * vap.pd + vap.d * vap.pdd) - 2.0 * vap.ptd)) / vap.pd;
+        dxTT := -dxv * (2.0 * dxT * (dvTv - dvTl) + dvTTl + x * (dvTTv - dvTTl));
+        duTTl := liq.cvt + (liq.pt - dpT + T * (2.0 * liq.ptt - liq.d * liq.d * liq.ptd * dvTl)) * dvTl + (T * liq.pt - p) * dvTTl;
+        duTTv := vap.cvt + (vap.pt - dpT + T * (2.0 * vap.ptt - vap.d * vap.d * vap.ptd * dvTv)) * dvTv + (T * vap.pt - p) * dvTTv;
+        cvt := duTTl + x * (duTTv - duTTl) + 2.0 * dxT * (duTv - duTl) + dxTT * (vap.u - liq.u);
+        ptt := dpTT;
+        dht := cv + dpT * v;
+        dhd := -T * dpT * v * v;
+        detPH := -dpT * dhd;
+        dtph := 1.0 / dpT;
+        ddph := dht / detPH;
+        ddhp := -dpT / detPH;
+        detPH_d := -2.0 * v;
+        detPH_t := 2.0 * ptt / dpT + 1.0 / T;
+        dhtt := cvt + ptt * v;
+        dhtd := -(T * ptt + dpT) * v * v;
+        ddhp_t := ddhp * (ptt / dpT - detPH_t);
+        ddhp_d := ddhp * (-detPH_d);
+        ddph_t := ddph * (dhtt / dht - detPH_t);
+        ddph_d := ddph * (dhtd / dht - detPH_d);
+        duhp_t := (ddhp * dpT + p * ddhp_t) / rho2;
+        duph_t := (ddph * dpT + p * ddph_t) / rho2;
+        duph_d := (((-2.0 * ddph / rho) + ddph_d) * p + 1.0) / rho2;
+        der_pro.x := if h_vap <> h_liq then h_der / (h_vap - h_liq) else 0.0;
+        der_pro.duhp := dtph * duhp_t * p_der;
+        der_pro.duph := (ddph * duph_d + dtph * duph_t) * p_der + dtph * duhp_t * h_der;
+        der_pro.ddph := (ddph * ddph_d + dtph * ddph_t) * p_der + ddhp * ddph_d * h_der;
+        der_pro.ddhp := ddhp * ddhp_d * h_der + ddhp * ddph_d * p_der;
+        der_pro.cp := 0.0;
+        der_pro.s := (-1 / (rho * T) * p_der) + 1 / T * h_der;
+        der_pro.u := (ddph * p / rho - 1.0) / rho * p_der + (ddhp * p / rho2 + 1.0) * h_der;
+        der_pro.T := 1 / dpT * p_der;
+        der_pro.d := rho * (rho * cv / dpT + 1.0) / (dpT * T) * p_der + (-rho2 / (dpT * T)) * h_der;
+      elseif region == 5 then
+        (T, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.tofph5(p, h, reldh = 1.0e-7);
+        assert(error == 0, "error in inverse iteration of steam tables");
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g5L3(p, T);
+        rho := p / (R * T * g.pi * g.gpi);
+        rho2 := rho * rho;
+        vt := R / p * (g.pi * g.gpi - g.tau * g.pi * g.gpitau);
+        vt2 := vt * vt;
+        cp := -R * g.tau * g.tau * g.gtautau;
+        cp3 := cp * cp * cp;
+        cpcpp := cp * cp * p;
+        vp := R * T / (p * p) * g.pi * g.pi * g.gpipi;
+        v := 1 / rho;
+        vtt := R * g.pi / p * g.tau / T * g.tau * g.gpitautau;
+        vtp := R * g.pi * g.pi / (p * p) * (g.gpipi - g.tau * g.gpipitau);
+        vpp := R * T * g.pi * g.pi * g.pi / (p * p * p) * g.gpipipi;
+        cpt := R * g.tau * g.tau / T * (2 * g.gtautau + g.tau * g.gtautautau);
+        pt := -g.p / g.T * (g.gpi - g.tau * g.gpitau) / (g.gpipi * g.pi);
+        pd := -g.R * g.T * g.gpi * g.gpi / g.gpipi;
+        vp3 := vp * vp * vp;
+        ivp3 := 1 / vp3;
+        ptt := -(vtt * vp * vp - 2.0 * vt * vtp * vp + vt2 * vpp) * ivp3;
+        pdd := (-vpp * ivp3 / (rho2 * rho2)) - 2 * v * pd "= pvv/d^4";
+        ptd := (vtp * vp - vt * vpp) * ivp3 / rho2 "= -ptv/d^2";
+        cvt := (vp3 * cpt + vp * vp * vt2 + 3.0 * vp * vp * T * vt * vtt - 3.0 * vtp * vp * T * vt2 + T * vt2 * vt * vpp) * ivp3;
+        detPH := cp * pd;
+        dht := cv + pt / rho;
+        dhd := (pd - T * pt / rho) / rho;
+        ddph := dht / detPH;
+        ddhp := -pt / detPH;
+        dtph := -dhd / detPH;
+        dthp := pd / detPH;
+        detPH_d := cv * pdd + (2.0 * pt * (ptd - pt / rho) - ptt * pd) * T / rho2;
+        detPH_t := cvt * pd + cv * ptd + (pt + 2.0 * T * ptt) * pt / rho2;
+        dhtt := cvt + ptt * v;
+        dhtd := (ptd - (T * ptt + pt) * v) * v;
+        ddhp_t := ddhp * (ptt / pt - detPH_t / detPH);
+        ddhp_d := ddhp * (ptd / pt - detPH_d / detPH);
+        ddph_t := ddph * (dhtt / dht - detPH_t / detPH);
+        ddph_d := ddph * (dhtd / dht - detPH_d / detPH);
+        dupp := -(2.0 * cp3 * vp + cp3 * p * vpp - 2.0 * cp * cp * vt * v - 2.0 * cpcpp * vtp * v - cpcpp * vt * vp + 2.0 * cp * cp * T * vt2 + 3.0 * cpcpp * vt * T * vtp - 4.0 * T * vtt * cp * p * vt * v + 3.0 * T * T * vtt * cp * p * vt2 + cp * p * vtt / rho2 - cpt * p * vt / rho2 + 2.0 * cpt * p * vt2 * v * T - cpt * p * vt2 * T ^ 2) / cp3;
+        duph := -(vtp * cpcpp + cp * cp * vt - cp * p * vtt * v + 2.0 * cp * p * vt * T * vtt + cpt * p * vt * v - cpt * p * vt2 * T) / cp3;
+        duhh := -p * (cp * vtt - cpt * vt) / cp3;
+        der_pro.x := 0.0;
+        der_pro.duhp := duph * p_der + duhh * h_der;
+        der_pro.duph := dupp * p_der + duph * h_der;
+        der_pro.ddph := (ddph * ddph_d + dtph * ddph_t) * p_der + (ddph * ddhp_d + dtph * ddhp_t) * h_der;
+        der_pro.ddhp := (ddhp * ddhp_d + dthp * ddhp_t) * h_der + (ddph * ddhp_d + dtph * ddhp_t) * p_der;
+        der_pro.cp := (-(T * vtt * cp + cpt / rho - cpt * T * vt) / cp) * p_der + cpt / cp * h_der;
+        der_pro.s := (-1 / (rho * T) * p_der) + 1 / T * h_der;
+        der_pro.u := (-(p * vp * cp + cp * v - p * vt * v + p * vt2 * T) / cp) * p_der + (cp - p * vt) / cp * h_der;
+        der_pro.T := ((-v) + T * vt) / cp * p_der + 1 / cp * h_der;
+        der_pro.d := (-rho2 * (vp * cp - vt / rho + T * vt2) / cp) * p_der + (-rho2 * vt / cp) * h_der;
+      else
+        assert(false, "Water_Ph_der: Incorrect region number");
+      end if;
+// get variables
+// not in cache
+// calculate derivatives
+// get variables
+// not in cache
+// calculate derivatives
+// get variables
+// not in cache
+// calculate derivatives
+// get variables
+// how to avoid ?
+//  dpT := BaseIF97.Basic.dptofT(T);
+// not in cache
+/* = detPH_d / detPH */
+/* = detPH_t / detPH */
+// calculate derivatives
+// get variables
+// not in cache
+// calculate derivatives
+      annotation(
+        Window(x = 0.22, y = 0.2, width = 0.6, height = 0.6),
+        Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}, grid = {2, 2}), graphics = {Text(extent = {{-134, 104}, {142, 44}}, textString = "%name"), Ellipse(extent = {{-100, 40}, {100, -100}}, lineColor = {255, 127, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-84, -4}, {84, -52}}, lineColor = {255, 127, 0}, textString = "fonction")}),
+        Documentation(info = "<html>
 <p><b>Copyright &copy; EDF 2002 - 2010</b></p>
 </HTML>
 <html>
 <p><b>ThermoSysPro Version 2.0</b></p>
 </HTML>
-"));
-    end Water_Ph_der;
-
-    function Water_Ps_der
-      input Modelica.SIunits.AbsolutePressure p "Pression";
-      input Modelica.SIunits.SpecificEntropy s "Entropie spécifique";
-      input Integer mode = 0 "Région IF97 - 0:calcul automatique";
-
-      input Real p_der "derivative of Pressure";
-      input Real s_der "derivative of Specific enthropy";
-
-    protected
-      Boolean supercritical;
-
-      // variables taken from auxiliary record
-      Integer phase "phase: 2 for two-phase, 1 for one phase, 0 if unknown";
-      Integer region(min=1, max=5) "IF 97 region";
-      Modelica.SIunits.Temperature T "temperature";
-      Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      Modelica.SIunits.SpecificHeatCapacity R "gas constant";
-      Modelica.SIunits.SpecificHeatCapacity cp "specific heat capacity";
-      Real cpt "derivative of cp w.r.t. temperature";
-      Modelica.SIunits.SpecificHeatCapacity cv "specific heat capacity";
-      Real cvt "derivative of cv w.r.t. temperature";
-      Modelica.SIunits.Density rho "density";
-      ThermoSysPro.Units.DerPressureByTemperature pt
-        "derivative of pressure wrt temperature";
-      ThermoSysPro.Units.DerPressureByDensity pd
-        "derivative of pressure wrt density";
-      Real ptt "2nd derivative of pressure wrt temperature";
-      Real pdd "2nd derivative of pressure wrt density";
-      Real ptd "mixed derivative of pressure w.r.t. density and temperature";
-      Real vt "derivative of specific volume w.r.t. temperature";
-      Real vp "derivative of specific volume w.r.t. pressure";
-      Real vtt "2nd derivative of specific volume w.r.t. temperature";
-      Real vpp "2nd derivative of specific volume w.r.t. pressure";
-      Real vtp
-        "mixed derivative of specific volume w.r.t. pressure and temperature";
-      Real x "dryness fraction";
-      Real dpT "dp/dT derivative of saturation curve";
-      Modelica.SIunits.SpecificEntropy auxs "specific entropy";
-
-      // variables taken from waterBaseProp_ps
-      Integer error "error flag for inverse iterations";
-      Modelica.SIunits.SpecificEntropy s_liq "liquid specific entropy";
-      Modelica.SIunits.Density d_liq "liquid density";
-      Modelica.SIunits.SpecificEntropy s_vap "vapour specific entropy";
-      Modelica.SIunits.Density d_vap "vapour density";
-      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties3rd liq
-        "phase boundary property record";
-      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties3rd vap
-        "phase boundary property record";
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd gl
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd gv
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd fl
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd fv
-        "dimensionless Helmholtz function and dervatives wrt delta and tau";
-      Modelica.SIunits.Temperature t1
-        "temperature at phase boundary, using inverse from region 1";
-      Modelica.SIunits.Temperature t2
-        "temperature at phase boundary, using inverse from region 2";
-
-      // variables needed
-      Real detPH;
-      Real dtsp;
-      Real dtps;
-      Real ddsp;
-      Real ddps;
-      Real dsd;
-
-      Real detPH_t;
-      Real detPH_d;
-
-      Real dcp_t;
-      Real dcp_d;
-
-      Real dcps;
-      Real dcpp;
-
-      Real dxv;
-      Real dxd;
-      Real dvTl;
-      Real dvTv;
-      Real dxT;
-      Real duTl;
-      Real duTv;
-      Real dpTT;
-      Real dxdd;
-      Real dxTd;
-      Real dvTTl;
-      Real dvTTv;
-      Real dxTT;
-      Real duTTl;
-      Real duTTv;
-
-      Real rho2;
-      Real cp3;
-      Real invcp3;
-      Real cpinv;
-      Real vt2;
-      Real pt2;
-      Real pt3;
-      Real quotient;
-
-    public
-      output ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ps pro_der;
-    protected
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd
-                                               g
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau"                    annotation (Placement(
-            transformation(extent={{-90,-85},{-43.3333,-38.3333}}, rotation=0)));
-      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd
-                                                   f
-        "dimensionless Helmholtz funcion and dervatives wrt delta and tau"
-        annotation (Placement(transformation(extent={{-23.3333,-85},{23.3333,
-                -38.3333}}, rotation=0)));
-    algorithm
-      //assert(false,"Water_ph: Derivatives of cp not yet functional");
-      supercritical := (p >ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT);
-      phase := if ((s < ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.sl_p(p)) or
-                   (s > ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.sv_p(p)) or
-                    supercritical) then 1 else 2;
-
-      region := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_ps(p, s, phase, mode);
-
-      R :=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
-      auxs := s;
-      if (region == 1) then
-        T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tps1(p, s);
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1L3(p, T);
-
-        h := R*T*g.tau*g.gtau;
-        rho := p/(R*T*g.pi*g.gpi);
-        rho2 := rho*rho;
-        vt := R/p*(g.pi*g.gpi - g.tau*g.pi*g.gpitau);
-        vt2 := vt*vt;
-        vp := R*T/(p*p)*g.pi*g.pi*g.gpipi;
-        cp := -R*g.tau*g.tau*g.gtautau;
-        cpinv := 1/cp;
-        cp3 := cp*cp*cp;
-        invcp3 := 1/cp3;
-        cv := R*(-g.tau*g.tau*g.gtautau + ((g.gpi - g.tau*g.gpitau)*(g.gpi - g.tau*g.gpitau)/g.gpipi));
-        x := 0.0;
-        vtt := R*g.pi/p*g.tau/T*g.tau*g.gpitautau;
-        vtp := R*g.pi*g.pi/(p*p)*(g.gpipi - g.tau*g.gpipitau);
-        vpp := R*T*g.pi*g.pi*g.pi/(p*p*p)*g.gpipipi;
-        cpt := R*g.tau*g.tau/T*(2*g.gtautau + g.tau*g.gtautautau);
-
-        // calculate derivative
-
-        pro_der.cp := cpinv*T*(-(vtt*cp-cpt*vt)*p_der + cpt*s_der);
-        pro_der.x := 0.0;
-        pro_der.ddps := (-rho2*(cp3*vpp + 3.0*cp*cp*T*vt*vtp +
-                3.0*T*T*vtt*cp*vt2 - T*T*vt2*vt*cpt + T*vt2*vt*cp)*invcp3)*p_der +
-                (-rho2*T*(2.0*vtt*T*vt*cp + cp*cp*vtp - cpt*T*vt2 +
-                cp*vt2)*invcp3)*s_der;
-        pro_der.ddsp := (-rho2*T*(2.0*vtt*T*vt*cp + cp*cp*vtp -
-                cpt*T*vt2 + cp*vt2)*invcp3)*p_der +
-                (-rho2*(-cpt*T*vt + cp*vt + T*vtt*cp)*T*invcp3)*s_der;
-        pro_der.h := p_der/rho + T*s_der;
-        pro_der.u := cpinv*(-p*(vp*cp+T*vt2)*p_der + (cp-p*vt)*T*s_der);
-        pro_der.d := cpinv*(-rho2 *(vp*cp+T*vt2)*p_der + (-rho2*vt*T)*s_der);
-        pro_der.T := (T*cpinv)*(vt*p_der  + s_der);
-
-      elseif (region == 2) then
-        T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tps2(p, s);
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2L3(p, T);
-
-        h := R*T*g.tau*g.gtau;
-        rho := p/(R*T*g.pi*g.gpi);
-        rho2 := rho*rho;
-        vt := R/p*(g.pi*g.gpi - g.tau*g.pi*g.gpitau);
-        vt2 := vt*vt;
-        vp := R*T/(p*p)*g.pi*g.pi*g.gpipi;
-        cp := -R*g.tau*g.tau*g.gtautau;
-        cpinv := 1/cp;
-        cp3 := cp*cp*cp;
-        invcp3 := 1/cp3;
-        cv := R*(-g.tau*g.tau*g.gtautau + ((g.gpi - g.tau*g.gpitau)*(g.gpi - g.tau*g.gpitau)/g.gpipi));
-        x := 0.0;
-        vtt := R*g.pi/p*g.tau/T*g.tau*g.gpitautau;
-        vtp := R*g.pi*g.pi/(p*p)*(g.gpipi - g.tau*g.gpipitau);
-        vpp := R*T*g.pi*g.pi*g.pi/(p*p*p)*g.gpipipi;
-        cpt := R*g.tau*g.tau/T*(2*g.gtautau + g.tau*g.gtautautau);
-
-        // calculate derivative
-
-        pro_der.cp := cpinv*T*(-(vtt*cp-cpt*vt)*p_der + cpt*s_der);
-        pro_der.x := 0.0;
-        pro_der.ddps := (-rho2*(cp3*vpp + 3.0*cp*cp*T*vt*vtp +
-                3.0*T*T*vtt*cp*vt2 - T*T*vt2*vt*cpt + T*vt2*vt*cp)*invcp3)*p_der +
-                (-rho2*T*(2.0*vtt*T*vt*cp + cp*cp*vtp - cpt*T*vt2 +
-                cp*vt2)*invcp3)*s_der;
-        pro_der.ddsp := (-rho2*T*(2.0*vtt*T*vt*cp + cp*cp*vtp -
-                cpt*T*vt2 + cp*vt2)*invcp3)*p_der +
-                (-rho2*(-cpt*T*vt + cp*vt + T*vtt*cp)*T*invcp3)*s_der;
-        pro_der.h := p_der/rho + T*s_der;
-        pro_der.u := cpinv*(-p*(vp*cp+T*vt2)*p_der + (cp-p*vt)*T*s_der);
-        pro_der.d := cpinv*(-rho2 *(vp*cp+T*vt2)*p_der + (-rho2*vt*T)*s_der);
-        pro_der.T := (T*cpinv)*(vt*p_der  + s_der);
-
-      elseif (region == 3) then
-        (rho,T,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.dtofps3(p,s,delp=1.0e-7,dels=1.0e-6);
-        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(rho, T);
-
-        rho2 := rho*rho;
-        h := R*T*(f.tau*f.ftau + f.delta*f.fdelta);
-        auxs := R*(f.tau*f.ftau - f.f);
-        pd := R*T*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta);
-        pt := R*rho*f.delta*(f.fdelta - f.tau*f.fdeltatau);
-        pt2 := pt*pt;
-        pt3 := pt2*pt;
-        cv := abs(R*(-f.tau*f.tau*f.ftautau))
-          "can be close to neg. infinity near critical point";
-        cp := (rho2*pd*cv + T*pt*pt)/(rho*rho*pd);
-        pdd := R*T*f.delta/rho*(2.0*f.fdelta + 4.0*f.delta*f.fdeltadelta +
-             f.delta*f.delta*f.fdeltadeltadelta);
-        ptt := R*rho*f.delta*f.tau*f.tau/T*f.fdeltatautau;
-        ptd := R*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta - 2.0*f.tau*f.fdeltatau
-             -f.delta*f.tau*f.fdeltadeltatau);
-        cvt := R*f.tau*f.tau/T*(2.0*f.ftautau + f.tau*f.ftautautau);
-        x := 0.0;
-
-        // Not in cache
-        dsd := -pt/rho2;
-        detPH := cp*pd;
-
-        dtsp :=T*pd/detPH;
-        dtps :=-T*dsd/detPH;
-        ddsp :=-T*pt/detPH;
-        ddps :=cv/detPH;
-
-        detPH_t := cvt*pd + cv*ptd + (pt + 2.0*T*ptt)*pt/(rho2);
-        detPH_d := cv*pdd + (2.0*pt*(ptd - pt/rho) - ptt*pd)*T/(rho2);
-
-        dcp_t :=(detPH_t - cp*ptd)/pd;
-        dcp_d :=(detPH_d - cp*pdd)/pd;
-
-        dcps := ddsp * dcp_d + dtsp * dcp_t;
-        dcpp := ddps * dcp_d + dtps * dcp_t;
-
-        quotient := 1/(cv*rho2*pd + pt2*T);
-
-        pro_der.cp := dcps*s_der + dcpp*p_der;
-        pro_der.x := 0.0;
-        pro_der.ddps := rho2/(quotient*quotient*quotient)*(-(-cvt*T^2*pt3 + 3.0*cv^2*T*pt*rho2*ptd +
-                3.0*cv*T^2*pt2*ptt + cv*T*pt3 - 2.0*cv^2*rho*pt2*T +
-                cv^3*rho2*rho2*pdd)*p_der +
-                (pt2*T*cvt*rho2*pd + 2*pt2*T*cv*rho2*ptd + pt3*T^2*ptt -
-                pt2*cv*rho2*pd - 2.0*pt*T*ptt*cv*rho2*pd + cv^2*rho2*rho2*pt*pdd -
-                2.0*cv*rho*T*pt3 - cv^2*rho2*rho2*ptd*pd)*T*s_der);
-        pro_der.ddsp := quotient/(rho2*T*pt2)*(-(pt2*T*cvt*rho2*pd + 2.0*pt2*T*cv*rho2*ptd +
-                pt3*T^2*ptt - pt2*cv*rho2*pd - 2.0*pt*T*ptt*cv*rho2*pd +
-                cv^2*rho2*rho2*pt*pdd - 2.0*cv*rho*T*pt3 - cv^2*rho2*rho2*ptd*pd)*p_der -
-                (rho^3*pd^2*T*pt*cvt + 2.0*rho2*rho*pd*T*pt*cv*ptd +
-                2.0*rho*pd*T^2*pt2*ptt - rho2*rho*pd^2*pt*cv - ptt*rho2*rho*T*pd^2*cv -
-                T*pt2*rho2*rho*cv*pdd - T^2*pt3*rho*ptd + 2.0*T^2*pt2*pt2)*s_der);
-        pro_der.h := p_der/rho + T*s_der;
-        pro_der.u := quotient*((cv*rho2*pd-pt*p + pt2*T)*T*s_der + cv*p*p_der);
-        pro_der.d := rho2*quotient*(-T*pt*s_der + cv*p_der);
-        pro_der.T := T*quotient*(pt*p_der + rho2*pd*s_der);
-
-      elseif (region == 4) then
-        s_liq := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.sl_p(p);
-        s_vap := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.sv_p(p);
-        x := if (s_vap <> s_liq) then (s - s_liq)/(s_vap - s_liq) else 1.0;
-        if p < ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PLIMIT4A then
-          t1 := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tps1(p, s_liq);
-          t2 := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tps2(p, s_vap);
-          gl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1L3(p, t1);
-          gv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2L3(p, t2);
-          liq := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps3rd(gl);
-          vap := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps3rd(gv);
-          T := t1 + x*(t2 - t1);
-        else
-          T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tsat(p);
-          d_liq := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.rhol_T(T);
-          d_vap := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.rhov_T(T);
-          fl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(d_liq, T);
-          fv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(d_vap, T);
-          liq := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps3rd(fl);
-          vap := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps3rd(fv);
-        end if;
-        dpT := if (liq.d <> vap.d) then (vap.s - liq.s)*liq.d*vap.d/(liq.d - vap.d) else
-             ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.dptofT(T);
-        h := h + x*(vap.h - liq.h);
-        rho := liq.d*vap.d/(vap.d + x*(liq.d - vap.d));
-        rho2 := rho*rho;
-        //cp := liq.cp + x*(vap.cp - liq.cp);
-        //pt := liq.pt + x*(vap.pt - liq.pt);
-        //pd := liq.pd + x*(vap.pd - liq.pd);
-
-        dxv := if (liq.d <> vap.d) then liq.d*vap.d/(liq.d-vap.d) else 0.0;
-        dxd := -dxv/(rho2);
-        dpT := if (liq.d <> vap.d) then (vap.s - liq.s)*dxv else ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.dptofT(T);
-        dvTl := (liq.pt -dpT)/(liq.pd*liq.d*liq.d);
-        dvTv := (vap.pt -dpT)/(vap.pd*vap.d*vap.d);
-        dxT := -dxv*(dvTl + x*(dvTv-dvTl));
-        duTl := liq.cv + (T*liq.pt-p)*dvTl;
-        duTv := vap.cv + (T*vap.pt-p)*dvTv;
-        cv := duTl + x*(duTv-duTl) + dxT * (vap.u-liq.u);
-        dpTT := dxv*(vap.cv/T-liq.cv/T + dvTv*(vap.pt-dpT)-dvTl*(liq.pt-dpT));
-        dxdd := 2.0*dxv/(rho2*rho);
-        dxTd := dxv*dxv*(dvTv-dvTl)/(rho2);
-        dvTTl := ((liq.ptt-dpTT)/(liq.d*liq.d) + dvTl*(liq.d*dvTl*(2.0*liq.pd + liq.d*liq.pdd)
-             -2.0*liq.ptd))/liq.pd;
-        dvTTv := ((vap.ptt-dpTT)/(vap.d*vap.d) + dvTv*(vap.d*dvTv*(2.0*vap.pd + vap.d*vap.pdd)
-             -2.0*vap.ptd))/vap.pd;
-        dxTT := -dxv*(2.0*dxT*(dvTv-dvTl) + dvTTl + x*(dvTTv-dvTTl));
-        duTTl := liq.cvt +(liq.pt-dpT + T*(2.0*liq.ptt -liq.d*liq.d*liq.ptd *dvTl))*dvTl + (T*
-          liq.pt - p)*dvTTl;
-        duTTv := vap.cvt +(vap.pt-dpT + T*(2.0*vap.ptt -vap.d*vap.d*vap.ptd *dvTv))*dvTv + (T*
-          vap.pt - p)*dvTTv;
-        cvt := duTTl + x *(duTTv -duTTl) + 2.0*dxT*(duTv-duTl) + dxTT *(vap.u-liq.u);
-
-        // not in cache
-        detPH := T*dpT*dpT/(rho2);
-        dtps := 1.0 / dpT;
-        ddsp := -T*dpT/detPH;
-        ddps := cv/detPH;
-
-        ptt :=dpTT;
-
-        // calculate derivatives
-        pro_der.x := if (s_vap <> s_liq) then s_der/(s_vap - s_liq) else 0.0;
-        pro_der.ddps := (-rho2*(-cvt*T*dpT + 3.0*cv*T*ptt + cv*dpT -
-                2.0*cv^2*rho) / (dpT*dpT*dpT*dpT*T*T))*p_der +
-                ((T*ptt - 2.0*cv*rho)*rho2 / (dpT*dpT*dpT*T))*s_der;
-        pro_der.ddsp := (-(T*ptt - 2.0*cv*rho) / (rho2*T*dpT))*p_der +
-                (-2.0 /rho)*s_der;
-        pro_der.cp := 0.0;
-        pro_der.h := p_der/rho + T*s_der;
-        pro_der.u := (ddps*p/rho2)*p_der + (ddsp*p/rho2 + T)*s_der;
-        pro_der.d := ddps*p_der + ddsp*s_der;
-        pro_der.T := dtps*p_der;
-
-      elseif (region == 5) then
-        (T,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.tofps5(p,s,relds=1.0e-7);
-        assert(error == 0, "error in inverse iteration of steam tables");
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g5L3(p, T);
-        h := R*T*g.tau*g.gtau;
-        rho := p/(R*T*g.pi*g.gpi);
-        rho2 := rho*rho;
-        vt := R/p*(g.pi*g.gpi - g.tau*g.pi*g.gpitau);
-        vt2 := vt*vt;
-        vp := R*T/(p*p)*g.pi*g.pi*g.gpipi;
-        cp := -R*g.tau*g.tau*g.gtautau;
-        cpinv := 1/cp;
-        cp3 := cp*cp*cp;
-        invcp3 := 1/cp3;
-        cv := R*(-g.tau*g.tau*g.gtautau + ((g.gpi - g.tau*g.gpitau)*(g.gpi - g.tau*g.gpitau)/g.gpipi));
-        x := 0.0;
-        vtt := R*g.pi/p*g.tau/T*g.tau*g.gpitautau;
-        vtp := R*g.pi*g.pi/(p*p)*(g.gpipi - g.tau*g.gpipitau);
-        vpp := R*T*g.pi*g.pi*g.pi/(p*p*p)*g.gpipipi;
-        cpt := R*g.tau*g.tau/T*(2*g.gtautau + g.tau*g.gtautautau);
-
-        // calculate derivative
-
-        pro_der.cp := cpinv*T*(-(vtt*cp-cpt*vt)*p_der + cpt*s_der);
-        pro_der.x := 0.0;
-        pro_der.ddps := (-rho2*(cp3*vpp + 3.0*cp*cp*T*vt*vtp +
-                3.0*T*T*vtt*cp*vt2 - T*T*vt2*vt*cpt + T*vt2*vt*cp)*invcp3)*p_der +
-                (-rho2*T*(2.0*vtt*T*vt*cp + cp*cp*vtp - cpt*T*vt2 +
-                cp*vt2)*invcp3)*s_der;
-        pro_der.ddsp := (-rho2*T*(2.0*vtt*T*vt*cp + cp*cp*vtp -
-                cpt*T*vt2 + cp*vt2)*invcp3)*p_der +
-                (-rho2*(-cpt*T*vt + cp*vt + T*vtt*cp)*T*invcp3)*s_der;
-        pro_der.h := p_der/rho + T*s_der;
-        pro_der.u := cpinv*(-p*(vp*cp+T*vt2)*p_der + (cp-p*vt)*T*s_der);
-        pro_der.d := cpinv*(-rho2 *(vp*cp+T*vt2)*p_der + (-rho2*vt*T)*s_der);
-        pro_der.T := (T*cpinv)*(vt*p_der  + s_der);
-      else
-        assert(false, "Water_Ps_der: Incorrect region number");
-      end if;
-      annotation (
-        Window(
-          x=0.22,
-          y=0.2,
-          width=0.6,
-          height=0.6),
-        Icon(coordinateSystem(
-            preserveAspectRatio=false,
-            extent={{-100,-100},{100,100}},
-            grid={2,2}), graphics={
-            Text(extent={{-134,104},{142,44}}, textString=
-                                                   "%name"),
-            Ellipse(
-              extent={{-100,40},{100,-100}},
-              lineColor={255,127,0},
-              fillColor={255,255,255},
-              fillPattern=FillPattern.Solid),
-            Text(
-              extent={{-84,-4},{84,-52}},
-              lineColor={255,127,0},
-              textString=
-                   "fonction")}),
-        Documentation(info="<html>
+        "));
+    end Water_Ph_der;
+
+    function Water_Ps_der
+      input Modelica.Units.SI.AbsolutePressure p "Pression";
+      input Modelica.Units.SI.SpecificEntropy s "Entropie spécifique";
+      input Integer mode = 0 "Région IF97 - 0:calcul automatique";
+      input Real p_der "derivative of Pressure";
+      input Real s_der "derivative of Specific enthropy";
+    protected
+      Boolean supercritical;
+      // variables taken from auxiliary record
+      Integer phase "phase: 2 for two-phase, 1 for one phase, 0 if unknown";
+      Integer region(min = 1, max = 5) "IF 97 region";
+      Modelica.Units.SI.Temperature T "temperature";
+      Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      Modelica.Units.SI.SpecificHeatCapacity R "gas constant";
+      Modelica.Units.SI.SpecificHeatCapacity cp "specific heat capacity";
+      Real cpt "derivative of cp w.r.t. temperature";
+      Modelica.Units.SI.SpecificHeatCapacity cv "specific heat capacity";
+      Real cvt "derivative of cv w.r.t. temperature";
+      Modelica.Units.SI.Density rho "density";
+      ThermoSysPro.Units.DerPressureByTemperature pt "derivative of pressure wrt temperature";
+      ThermoSysPro.Units.DerPressureByDensity pd "derivative of pressure wrt density";
+      Real ptt "2nd derivative of pressure wrt temperature";
+      Real pdd "2nd derivative of pressure wrt density";
+      Real ptd "mixed derivative of pressure w.r.t. density and temperature";
+      Real vt "derivative of specific volume w.r.t. temperature";
+      Real vp "derivative of specific volume w.r.t. pressure";
+      Real vtt "2nd derivative of specific volume w.r.t. temperature";
+      Real vpp "2nd derivative of specific volume w.r.t. pressure";
+      Real vtp "mixed derivative of specific volume w.r.t. pressure and temperature";
+      Real x "dryness fraction";
+      Real dpT "dp/dT derivative of saturation curve";
+      Modelica.Units.SI.SpecificEntropy auxs "specific entropy";
+      // variables taken from waterBaseProp_ps
+      Integer error "error flag for inverse iterations";
+      Modelica.Units.SI.SpecificEntropy s_liq "liquid specific entropy";
+      Modelica.Units.SI.Density d_liq "liquid density";
+      Modelica.Units.SI.SpecificEntropy s_vap "vapour specific entropy";
+      Modelica.Units.SI.Density d_vap "vapour density";
+      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties3rd liq "phase boundary property record";
+      ThermoSysPro.Properties.WaterSteam.Common.PhaseBoundaryProperties3rd vap "phase boundary property record";
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd gl "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd gv "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd fl "dimensionless Helmholtz function and dervatives wrt delta and tau";
+      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd fv "dimensionless Helmholtz function and dervatives wrt delta and tau";
+      Modelica.Units.SI.Temperature t1 "temperature at phase boundary, using inverse from region 1";
+      Modelica.Units.SI.Temperature t2 "temperature at phase boundary, using inverse from region 2";
+      // variables needed
+      Real detPH;
+      Real dtsp;
+      Real dtps;
+      Real ddsp;
+      Real ddps;
+      Real dsd;
+      Real detPH_t;
+      Real detPH_d;
+      Real dcp_t;
+      Real dcp_d;
+      Real dcps;
+      Real dcpp;
+      Real dxv;
+      Real dxd;
+      Real dvTl;
+      Real dvTv;
+      Real dxT;
+      Real duTl;
+      Real duTv;
+      Real dpTT;
+      Real dxdd;
+      Real dxTd;
+      Real dvTTl;
+      Real dvTTv;
+      Real dxTT;
+      Real duTTl;
+      Real duTTv;
+      Real rho2;
+      Real cp3;
+      Real invcp3;
+      Real cpinv;
+      Real vt2;
+      Real pt2;
+      Real pt3;
+      Real quotient;
+    public
+      output ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ps pro_der;
+    protected
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd g "dimensionless Gibbs funcion and dervatives wrt pi and tau" annotation(
+        Placement(transformation(extent = {{-90, -85}, {-43.3333, -38.3333}}, rotation = 0)));
+      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd f "dimensionless Helmholtz funcion and dervatives wrt delta and tau" annotation(
+        Placement(transformation(extent = {{-23.3333, -85}, {23.3333, -38.3333}}, rotation = 0)));
+    algorithm
+//assert(false,"Water_ph: Derivatives of cp not yet functional");
+      supercritical := p > ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT;
+      phase := if s < ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.sl_p(p) or s > ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.sv_p(p) or supercritical then 1 else 2;
+      region := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_ps(p, s, phase, mode);
+      R := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
+      auxs := s;
+      if region == 1 then
+        T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tps1(p, s);
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1L3(p, T);
+        h := R * T * g.tau * g.gtau;
+        rho := p / (R * T * g.pi * g.gpi);
+        rho2 := rho * rho;
+        vt := R / p * (g.pi * g.gpi - g.tau * g.pi * g.gpitau);
+        vt2 := vt * vt;
+        vp := R * T / (p * p) * g.pi * g.pi * g.gpipi;
+        cp := -R * g.tau * g.tau * g.gtautau;
+        cpinv := 1 / cp;
+        cp3 := cp * cp * cp;
+        invcp3 := 1 / cp3;
+        cv := R * ((-g.tau * g.tau * g.gtautau) + (g.gpi - g.tau * g.gpitau) * (g.gpi - g.tau * g.gpitau) / g.gpipi);
+        x := 0.0;
+        vtt := R * g.pi / p * g.tau / T * g.tau * g.gpitautau;
+        vtp := R * g.pi * g.pi / (p * p) * (g.gpipi - g.tau * g.gpipitau);
+        vpp := R * T * g.pi * g.pi * g.pi / (p * p * p) * g.gpipipi;
+        cpt := R * g.tau * g.tau / T * (2 * g.gtautau + g.tau * g.gtautautau);
+        pro_der.cp := cpinv * T * ((-(vtt * cp - cpt * vt) * p_der) + cpt * s_der);
+        pro_der.x := 0.0;
+        pro_der.ddps := (-rho2 * (cp3 * vpp + 3.0 * cp * cp * T * vt * vtp + 3.0 * T * T * vtt * cp * vt2 - T * T * vt2 * vt * cpt + T * vt2 * vt * cp) * invcp3) * p_der + (-rho2 * T * (2.0 * vtt * T * vt * cp + cp * cp * vtp - cpt * T * vt2 + cp * vt2) * invcp3) * s_der;
+        pro_der.ddsp := (-rho2 * T * (2.0 * vtt * T * vt * cp + cp * cp * vtp - cpt * T * vt2 + cp * vt2) * invcp3) * p_der + (-rho2 * ((-cpt * T * vt) + cp * vt + T * vtt * cp) * T * invcp3) * s_der;
+        pro_der.h := p_der / rho + T * s_der;
+        pro_der.u := cpinv * ((-p * (vp * cp + T * vt2) * p_der) + (cp - p * vt) * T * s_der);
+        pro_der.d := cpinv * ((-rho2 * (vp * cp + T * vt2) * p_der) + (-rho2 * vt * T) * s_der);
+        pro_der.T := T * cpinv * (vt * p_der + s_der);
+      elseif region == 2 then
+        T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tps2(p, s);
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2L3(p, T);
+        h := R * T * g.tau * g.gtau;
+        rho := p / (R * T * g.pi * g.gpi);
+        rho2 := rho * rho;
+        vt := R / p * (g.pi * g.gpi - g.tau * g.pi * g.gpitau);
+        vt2 := vt * vt;
+        vp := R * T / (p * p) * g.pi * g.pi * g.gpipi;
+        cp := -R * g.tau * g.tau * g.gtautau;
+        cpinv := 1 / cp;
+        cp3 := cp * cp * cp;
+        invcp3 := 1 / cp3;
+        cv := R * ((-g.tau * g.tau * g.gtautau) + (g.gpi - g.tau * g.gpitau) * (g.gpi - g.tau * g.gpitau) / g.gpipi);
+        x := 0.0;
+        vtt := R * g.pi / p * g.tau / T * g.tau * g.gpitautau;
+        vtp := R * g.pi * g.pi / (p * p) * (g.gpipi - g.tau * g.gpipitau);
+        vpp := R * T * g.pi * g.pi * g.pi / (p * p * p) * g.gpipipi;
+        cpt := R * g.tau * g.tau / T * (2 * g.gtautau + g.tau * g.gtautautau);
+        pro_der.cp := cpinv * T * ((-(vtt * cp - cpt * vt) * p_der) + cpt * s_der);
+        pro_der.x := 0.0;
+        pro_der.ddps := (-rho2 * (cp3 * vpp + 3.0 * cp * cp * T * vt * vtp + 3.0 * T * T * vtt * cp * vt2 - T * T * vt2 * vt * cpt + T * vt2 * vt * cp) * invcp3) * p_der + (-rho2 * T * (2.0 * vtt * T * vt * cp + cp * cp * vtp - cpt * T * vt2 + cp * vt2) * invcp3) * s_der;
+        pro_der.ddsp := (-rho2 * T * (2.0 * vtt * T * vt * cp + cp * cp * vtp - cpt * T * vt2 + cp * vt2) * invcp3) * p_der + (-rho2 * ((-cpt * T * vt) + cp * vt + T * vtt * cp) * T * invcp3) * s_der;
+        pro_der.h := p_der / rho + T * s_der;
+        pro_der.u := cpinv * ((-p * (vp * cp + T * vt2) * p_der) + (cp - p * vt) * T * s_der);
+        pro_der.d := cpinv * ((-rho2 * (vp * cp + T * vt2) * p_der) + (-rho2 * vt * T) * s_der);
+        pro_der.T := T * cpinv * (vt * p_der + s_der);
+      elseif region == 3 then
+        (rho, T, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.dtofps3(p, s, delp = 1.0e-7, dels = 1.0e-6);
+        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(rho, T);
+        rho2 := rho * rho;
+        h := R * T * (f.tau * f.ftau + f.delta * f.fdelta);
+        auxs := R * (f.tau * f.ftau - f.f);
+        pd := R * T * f.delta * (2.0 * f.fdelta + f.delta * f.fdeltadelta);
+        pt := R * rho * f.delta * (f.fdelta - f.tau * f.fdeltatau);
+        pt2 := pt * pt;
+        pt3 := pt2 * pt;
+        cv := abs(R * (-f.tau * f.tau * f.ftautau)) "can be close to neg. infinity near critical point";
+        cp := (rho2 * pd * cv + T * pt * pt) / (rho * rho * pd);
+        pdd := R * T * f.delta / rho * (2.0 * f.fdelta + 4.0 * f.delta * f.fdeltadelta + f.delta * f.delta * f.fdeltadeltadelta);
+        ptt := R * rho * f.delta * f.tau * f.tau / T * f.fdeltatautau;
+        ptd := R * f.delta * (2.0 * f.fdelta + f.delta * f.fdeltadelta - 2.0 * f.tau * f.fdeltatau - f.delta * f.tau * f.fdeltadeltatau);
+        cvt := R * f.tau * f.tau / T * (2.0 * f.ftautau + f.tau * f.ftautautau);
+        x := 0.0;
+        dsd := -pt / rho2;
+        detPH := cp * pd;
+        dtsp := T * pd / detPH;
+        dtps := -T * dsd / detPH;
+        ddsp := -T * pt / detPH;
+        ddps := cv / detPH;
+        detPH_t := cvt * pd + cv * ptd + (pt + 2.0 * T * ptt) * pt / rho2;
+        detPH_d := cv * pdd + (2.0 * pt * (ptd - pt / rho) - ptt * pd) * T / rho2;
+        dcp_t := (detPH_t - cp * ptd) / pd;
+        dcp_d := (detPH_d - cp * pdd) / pd;
+        dcps := ddsp * dcp_d + dtsp * dcp_t;
+        dcpp := ddps * dcp_d + dtps * dcp_t;
+        quotient := 1 / (cv * rho2 * pd + pt2 * T);
+        pro_der.cp := dcps * s_der + dcpp * p_der;
+        pro_der.x := 0.0;
+        pro_der.ddps := rho2 / (quotient * quotient * quotient) * ((-((-cvt * T ^ 2 * pt3) + 3.0 * cv ^ 2 * T * pt * rho2 * ptd + 3.0 * cv * T ^ 2 * pt2 * ptt + cv * T * pt3 - 2.0 * cv ^ 2 * rho * pt2 * T + cv ^ 3 * rho2 * rho2 * pdd) * p_der) + (pt2 * T * cvt * rho2 * pd + 2 * pt2 * T * cv * rho2 * ptd + pt3 * T ^ 2 * ptt - pt2 * cv * rho2 * pd - 2.0 * pt * T * ptt * cv * rho2 * pd + cv ^ 2 * rho2 * rho2 * pt * pdd - 2.0 * cv * rho * T * pt3 - cv ^ 2 * rho2 * rho2 * ptd * pd) * T * s_der);
+        pro_der.ddsp := quotient / (rho2 * T * pt2) * ((-(pt2 * T * cvt * rho2 * pd + 2.0 * pt2 * T * cv * rho2 * ptd + pt3 * T ^ 2 * ptt - pt2 * cv * rho2 * pd - 2.0 * pt * T * ptt * cv * rho2 * pd + cv ^ 2 * rho2 * rho2 * pt * pdd - 2.0 * cv * rho * T * pt3 - cv ^ 2 * rho2 * rho2 * ptd * pd) * p_der) - (rho ^ 3 * pd ^ 2 * T * pt * cvt + 2.0 * rho2 * rho * pd * T * pt * cv * ptd + 2.0 * rho * pd * T ^ 2 * pt2 * ptt - rho2 * rho * pd ^ 2 * pt * cv - ptt * rho2 * rho * T * pd ^ 2 * cv - T * pt2 * rho2 * rho * cv * pdd - T ^ 2 * pt3 * rho * ptd + 2.0 * T ^ 2 * pt2 * pt2) * s_der);
+        pro_der.h := p_der / rho + T * s_der;
+        pro_der.u := quotient * ((cv * rho2 * pd - pt * p + pt2 * T) * T * s_der + cv * p * p_der);
+        pro_der.d := rho2 * quotient * ((-T * pt * s_der) + cv * p_der);
+        pro_der.T := T * quotient * (pt * p_der + rho2 * pd * s_der);
+      elseif region == 4 then
+        s_liq := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.sl_p(p);
+        s_vap := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.sv_p(p);
+        x := if s_vap <> s_liq then (s - s_liq) / (s_vap - s_liq) else 1.0;
+        if p < ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PLIMIT4A then
+          t1 := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tps1(p, s_liq);
+          t2 := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tps2(p, s_vap);
+          gl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1L3(p, t1);
+          gv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2L3(p, t2);
+          liq := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps3rd(gl);
+          vap := ThermoSysPro.Properties.WaterSteam.Common.gibbsToBoundaryProps3rd(gv);
+          T := t1 + x * (t2 - t1);
+        else
+          T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tsat(p);
+          d_liq := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.rhol_T(T);
+          d_vap := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.rhov_T(T);
+          fl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(d_liq, T);
+          fv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(d_vap, T);
+          liq := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps3rd(fl);
+          vap := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToBoundaryProps3rd(fv);
+        end if;
+        dpT := if liq.d <> vap.d then (vap.s - liq.s) * liq.d * vap.d / (liq.d - vap.d) else ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.dptofT(T);
+        h := h + x * (vap.h - liq.h);
+        rho := liq.d * vap.d / (vap.d + x * (liq.d - vap.d));
+        rho2 := rho * rho;
+        dxv := if liq.d <> vap.d then liq.d * vap.d / (liq.d - vap.d) else 0.0;
+        dxd := -dxv / rho2;
+        dpT := if liq.d <> vap.d then (vap.s - liq.s) * dxv else ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.dptofT(T);
+        dvTl := (liq.pt - dpT) / (liq.pd * liq.d * liq.d);
+        dvTv := (vap.pt - dpT) / (vap.pd * vap.d * vap.d);
+        dxT := -dxv * (dvTl + x * (dvTv - dvTl));
+        duTl := liq.cv + (T * liq.pt - p) * dvTl;
+        duTv := vap.cv + (T * vap.pt - p) * dvTv;
+        cv := duTl + x * (duTv - duTl) + dxT * (vap.u - liq.u);
+        dpTT := dxv * (vap.cv / T - liq.cv / T + dvTv * (vap.pt - dpT) - dvTl * (liq.pt - dpT));
+        dxdd := 2.0 * dxv / (rho2 * rho);
+        dxTd := dxv * dxv * (dvTv - dvTl) / rho2;
+        dvTTl := ((liq.ptt - dpTT) / (liq.d * liq.d) + dvTl * (liq.d * dvTl * (2.0 * liq.pd + liq.d * liq.pdd) - 2.0 * liq.ptd)) / liq.pd;
+        dvTTv := ((vap.ptt - dpTT) / (vap.d * vap.d) + dvTv * (vap.d * dvTv * (2.0 * vap.pd + vap.d * vap.pdd) - 2.0 * vap.ptd)) / vap.pd;
+        dxTT := -dxv * (2.0 * dxT * (dvTv - dvTl) + dvTTl + x * (dvTTv - dvTTl));
+        duTTl := liq.cvt + (liq.pt - dpT + T * (2.0 * liq.ptt - liq.d * liq.d * liq.ptd * dvTl)) * dvTl + (T * liq.pt - p) * dvTTl;
+        duTTv := vap.cvt + (vap.pt - dpT + T * (2.0 * vap.ptt - vap.d * vap.d * vap.ptd * dvTv)) * dvTv + (T * vap.pt - p) * dvTTv;
+        cvt := duTTl + x * (duTTv - duTTl) + 2.0 * dxT * (duTv - duTl) + dxTT * (vap.u - liq.u);
+        detPH := T * dpT * dpT / rho2;
+        dtps := 1.0 / dpT;
+        ddsp := -T * dpT / detPH;
+        ddps := cv / detPH;
+        ptt := dpTT;
+        pro_der.x := if s_vap <> s_liq then s_der / (s_vap - s_liq) else 0.0;
+        pro_der.ddps := (-rho2 * ((-cvt * T * dpT) + 3.0 * cv * T * ptt + cv * dpT - 2.0 * cv ^ 2 * rho) / (dpT * dpT * dpT * dpT * T * T)) * p_der + (T * ptt - 2.0 * cv * rho) * rho2 / (dpT * dpT * dpT * T) * s_der;
+        pro_der.ddsp := (-(T * ptt - 2.0 * cv * rho) / (rho2 * T * dpT)) * p_der + (-2.0 / rho) * s_der;
+        pro_der.cp := 0.0;
+        pro_der.h := p_der / rho + T * s_der;
+        pro_der.u := ddps * p / rho2 * p_der + (ddsp * p / rho2 + T) * s_der;
+        pro_der.d := ddps * p_der + ddsp * s_der;
+        pro_der.T := dtps * p_der;
+      elseif region == 5 then
+        (T, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.tofps5(p, s, relds = 1.0e-7);
+        assert(error == 0, "error in inverse iteration of steam tables");
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g5L3(p, T);
+        h := R * T * g.tau * g.gtau;
+        rho := p / (R * T * g.pi * g.gpi);
+        rho2 := rho * rho;
+        vt := R / p * (g.pi * g.gpi - g.tau * g.pi * g.gpitau);
+        vt2 := vt * vt;
+        vp := R * T / (p * p) * g.pi * g.pi * g.gpipi;
+        cp := -R * g.tau * g.tau * g.gtautau;
+        cpinv := 1 / cp;
+        cp3 := cp * cp * cp;
+        invcp3 := 1 / cp3;
+        cv := R * ((-g.tau * g.tau * g.gtautau) + (g.gpi - g.tau * g.gpitau) * (g.gpi - g.tau * g.gpitau) / g.gpipi);
+        x := 0.0;
+        vtt := R * g.pi / p * g.tau / T * g.tau * g.gpitautau;
+        vtp := R * g.pi * g.pi / (p * p) * (g.gpipi - g.tau * g.gpipitau);
+        vpp := R * T * g.pi * g.pi * g.pi / (p * p * p) * g.gpipipi;
+        cpt := R * g.tau * g.tau / T * (2 * g.gtautau + g.tau * g.gtautautau);
+        pro_der.cp := cpinv * T * ((-(vtt * cp - cpt * vt) * p_der) + cpt * s_der);
+        pro_der.x := 0.0;
+        pro_der.ddps := (-rho2 * (cp3 * vpp + 3.0 * cp * cp * T * vt * vtp + 3.0 * T * T * vtt * cp * vt2 - T * T * vt2 * vt * cpt + T * vt2 * vt * cp) * invcp3) * p_der + (-rho2 * T * (2.0 * vtt * T * vt * cp + cp * cp * vtp - cpt * T * vt2 + cp * vt2) * invcp3) * s_der;
+        pro_der.ddsp := (-rho2 * T * (2.0 * vtt * T * vt * cp + cp * cp * vtp - cpt * T * vt2 + cp * vt2) * invcp3) * p_der + (-rho2 * ((-cpt * T * vt) + cp * vt + T * vtt * cp) * T * invcp3) * s_der;
+        pro_der.h := p_der / rho + T * s_der;
+        pro_der.u := cpinv * ((-p * (vp * cp + T * vt2) * p_der) + (cp - p * vt) * T * s_der);
+        pro_der.d := cpinv * ((-rho2 * (vp * cp + T * vt2) * p_der) + (-rho2 * vt * T) * s_der);
+        pro_der.T := T * cpinv * (vt * p_der + s_der);
+      else
+        assert(false, "Water_Ps_der: Incorrect region number");
+      end if;
+// calculate derivative
+// calculate derivative
+// Not in cache
+//cp := liq.cp + x*(vap.cp - liq.cp);
+//pt := liq.pt + x*(vap.pt - liq.pt);
+//pd := liq.pd + x*(vap.pd - liq.pd);
+// not in cache
+// calculate derivatives
+// calculate derivative
+      annotation(
+        Window(x = 0.22, y = 0.2, width = 0.6, height = 0.6),
+        Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}, grid = {2, 2}), graphics = {Text(extent = {{-134, 104}, {142, 44}}, textString = "%name"), Ellipse(extent = {{-100, 40}, {100, -100}}, lineColor = {255, 127, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-84, -4}, {84, -52}}, lineColor = {255, 127, 0}, textString = "fonction")}),
+        Documentation(info = "<html>
 <p><b>Copyright &copy; EDF 2002 - 2010</b></p>
 </HTML>
 <html>
 <p><b>ThermoSysPro Version 2.0</b></p>
 </HTML>
-"));
-    end Water_Ps_der;
-
-    function Water_PT_der
-      input Modelica.SIunits.AbsolutePressure p "pressure";
-      input Modelica.SIunits.Temperature   T "Temperature";
-      input Integer mode = 0 "Région IF97 - 0:calcul automatique";
-
-      input Real p_der "Pression";
-      input Real T_der "Température";
-
-      output ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_pT pro_der;
-    protected
-      Integer region;
-      Boolean supercritical;
-      Integer error;
-
-      Modelica.SIunits.Density d;
-
-      // From aux record
-      Modelica.SIunits.Pressure p_aux "pressure";
-      Modelica.SIunits.Temperature T_aux "temperature";
-      Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-      Modelica.SIunits.SpecificHeatCapacity R "gas constant";
-      Modelica.SIunits.SpecificHeatCapacity cp "specific heat capacity";
-      Real cpt "derivative of cp w.r.t. temperature";
-      Modelica.SIunits.SpecificHeatCapacity cv "specific heat capacity";
-      Real cvt "derivative of cv w.r.t. temperature";
-      Modelica.SIunits.Density rho "density";
-      Modelica.SIunits.SpecificEntropy s "specific entropy";
-      ThermoSysPro.Units.DerPressureByTemperature pt
-        "derivative of pressure wrt temperature";
-      ThermoSysPro.Units.DerPressureByDensity pd
-        "derivative of pressure wrt density";
-      Real ptt "2nd derivative of pressure wrt temperature";
-      Real pdd "2nd derivative of pressure wrt density";
-      Real ptd "mixed derivative of pressure w.r.t. density and temperature";
-      Real vt "derivative of specific volume w.r.t. temperature";
-      Real vp "derivative of specific volume w.r.t. pressure";
-      Real vtt "2nd derivative of specific volume w.r.t. temperature";
-      Real vpp "2nd derivative of specific volume w.r.t. pressure";
-      Real vtp
-        "mixed derivative of specific volume w.r.t. pressure and temperature";
-      Real x "dryness fraction";
-      Real dpT "dp/dT derivative of saturation curve";
-
-      // needed
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd g
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd f
-        "dimensionless Helmholtz funcion and dervatives wrt delta and tau";
-      Real vp3 "vp^3";
-      Real ivp3 "1/vp3";
-      Modelica.SIunits.SpecificVolume v;
-
-      Real rho2;
-      Real quotient;
-      Real quotient2;
-      Real pd2;
-      Real pd3;
-      Real pt2;
-      Real pt3;
-    algorithm
-
-      supercritical := (p >ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT);
-      region := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_pT(p, T, mode);
-      R :=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
-      if (region == 1) then
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1L3(p, T);
-        x := 0.0;
-
-        h := R*T*g.tau*g.gtau;
-        s := R*(g.tau*g.gtau - g.g);
-        rho := p/(R*T*g.pi*g.gpi);
-        rho2 := rho*rho;
-        vt := R/p*(g.pi*g.gpi - g.tau*g.pi*g.gpitau);
-        vp := R*T/(p*p)*g.pi*g.pi*g.gpipi;
-        cp := -R*g.tau*g.tau*g.gtautau;
-        cv := R*(-g.tau*g.tau*g.gtautau + ((g.gpi - g.tau*g.gpitau)*(g.gpi - g.tau*g.gpitau)/g.gpipi));
-        vtt := R*g.pi/p*g.tau/T*g.tau*g.gpitautau;
-        vtp := R*g.pi*g.pi/(p*p)*(g.gpipi - g.tau*g.gpipitau);
-        vpp := R*T*g.pi*g.pi*g.pi/(p*p*p)*g.gpipipi;
-        cpt := R*g.tau*g.tau/T*(2*g.gtautau + g.tau*g.gtautautau);
-        pt := -g.p/g.T*(g.gpi - g.tau*g.gpitau)/(g.gpipi*g.pi);
-        pd := -g.R*g.T*g.gpi*g.gpi/(g.gpipi);
-        v := 1/rho;
-        vp3 := vp*vp*vp;
-        ivp3 := 1/vp3;
-        ptt := -(vtt*vp*vp -2.0*vt*vtp*vp +vt*vt*vpp)*ivp3;
-        pdd := -vpp*ivp3/(rho2*rho2) - 2*v*pd;
-        ptd := (vtp*vp-vt*vpp)*ivp3/rho2 "= -ptv/d^2";
-        cvt := (vp3*cpt + vp*vp*vt*vt + 3.0*vp*vp*T*vt*vtt -
-              3.0*vtp*vp*T*vt*vt + T*vt*vt*vt*vpp)*ivp3;
-
-        // calculate the derivatives
-        pro_der.x := 0;
-        pro_der.duTp := (-vt - T*vtt - p*vtp)*p_der +
-              (cpt - p*vtt)*T_der;
-        pro_der.dupT := (-T*vtp - vp - p*vpp)*p_der +
-              (-vt - T*vtt - p*vtp)*T_der;
-        pro_der.ddpT := -rho2*(vpp*p_der + vtp*T_der);
-        pro_der.ddTp := -rho2*(vtp*p_der + vtt*T_der);
-        pro_der.cp := (-T*vtt)*p_der + cpt*T_der;
-        pro_der.s := (-vt)*p_der + (cp/T)*T_der;
-        pro_der.u := (v-T*vt)*p_der + (cp-p*vt)*T_der;
-        pro_der.h := (v - T*vt)*p_der + cp*T_der;
-        pro_der.d := -rho2*(vp*p_der + vt*T_der);
-
-      elseif (region == 2) then
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2L3(p, T);
-        x := 1.0;
-
-        h := R*T*g.tau*g.gtau;
-        s := R*(g.tau*g.gtau - g.g);
-        rho := p/(R*T*g.pi*g.gpi);
-        rho2 := rho*rho;
-        vt := R/p*(g.pi*g.gpi - g.tau*g.pi*g.gpitau);
-        vp := R*T/(p*p)*g.pi*g.pi*g.gpipi;
-        cp := -R*g.tau*g.tau*g.gtautau;
-        cv := R*(-g.tau*g.tau*g.gtautau + ((g.gpi - g.tau*g.gpitau)*(g.gpi - g.tau*g.gpitau)/g.gpipi));
-        vtt := R*g.pi/p*g.tau/T*g.tau*g.gpitautau;
-        vtp := R*g.pi*g.pi/(p*p)*(g.gpipi - g.tau*g.gpipitau);
-        vpp := R*T*g.pi*g.pi*g.pi/(p*p*p)*g.gpipipi;
-        cpt := R*g.tau*g.tau/T*(2*g.gtautau + g.tau*g.gtautautau);
-        pt := -g.p/g.T*(g.gpi - g.tau*g.gpitau)/(g.gpipi*g.pi);
-        pd := -g.R*g.T*g.gpi*g.gpi/(g.gpipi);
-        v := 1/rho;
-        vp3 := vp*vp*vp;
-        ivp3 := 1/vp3;
-        ptt := -(vtt*vp*vp -2.0*vt*vtp*vp +vt*vt*vpp)*ivp3;
-        pdd := -vpp*ivp3/(rho2*rho2) - 2*v*pd;
-        ptd := (vtp*vp-vt*vpp)*ivp3/rho2 "= -ptv/d^2";
-        cvt := (vp3*cpt + vp*vp*vt*vt + 3.0*vp*vp*T*vt*vtt -
-              3.0*vtp*vp*T*vt*vt + T*vt*vt*vt*vpp)*ivp3;
-
-        // calculate the derivatives
-        pro_der.x := 0;
-        pro_der.duTp := (-vt - T*vtt - p*vtp)*p_der +
-              (cpt - p*vtt)*T_der;
-        pro_der.dupT := (-T*vtp - vp - p*vpp)*p_der +
-              (-vt - T*vtt - p*vtp)*T_der;
-        pro_der.ddpT := -rho2*(vpp*p_der + vtp*T_der);
-        pro_der.ddTp := -rho2*(vtp*p_der + vtt*T_der);
-        pro_der.cp := (-T*vtt)*p_der + cpt*T_der;
-        pro_der.s := (-vt)*p_der + (cp/T)*T_der;
-        pro_der.u := (v-T*vt)*p_der + (cp-p*vt)*T_der;
-        pro_der.h := (v - T*vt)*p_der + cp*T_der;
-        pro_der.d := -rho2*(vp*p_der + vt*T_der);
-      elseif (region == 3) then
-        (rho,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.dofpt3(p,T,delp= 1.0e-7);
-        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(rho, T);
-
-        rho2 := rho*rho;
-        h := R*T*(f.tau*f.ftau + f.delta*f.fdelta);
-        s := R*(f.tau*f.ftau - f.f);
-        pd := R*T*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta);
-        pd2 := pd*pd;
-        pd3 := pd*pd2;
-        pt := R*rho*f.delta*(f.fdelta - f.tau*f.fdeltatau);
-        pt2 := pt*pt;
-        pt3 := pt*pt*pt;
-        cv := R*(-f.tau*f.tau*f.ftautau);
-        x := 0.0;
-        pdd := R*T*f.delta/rho*(2.0*f.fdelta + 4.0*f.delta*f.fdeltadelta +
-             f.delta*f.delta*f.fdeltadeltadelta);
-        ptt := R*rho*f.delta*f.tau*f.tau/T*f.fdeltatautau;
-        ptd := R*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta - 2.0*f.tau*f.fdeltatau -
-              f.delta*f.tau*f.fdeltadeltatau);
-        cvt := R*f.tau*f.tau/T*(2.0*f.ftautau + f.tau*f.ftautautau);
-        cpt := (cvt*pd + cv*ptd + (pt + 2.0*T*ptt)*pt/(rho2) -
-              pt*ptd)/pd;
-
-        // calculate the derivatives
-        pro_der.x := 0;
-        quotient := 1/(rho2*pd);
-        quotient2 := quotient/(rho*pd2);
-        pro_der.duTp := quotient2*(-(rho*pd2*T*ptt + ptd*rho*pd*p - 2.0*rho*pd*pt*T*ptd +
-              rho*pd2*pt - 2.0*pt*pd*p + 2.0*pd*pt2*T - pt*pdd*rho*p + pdd*rho*pt2*T)*p_der +
-              (rho2*rho*pd3*cvt - rho*pd2*ptt*p + 3.0*rho*pd2*pt*T*ptt +
-              2.0*ptd*rho*pd*pt*p - 3.0*ptd*rho*pd*pt2*T + rho*pd2*pt2 -
-              2.0*pt2*pd*p + 2.0*T*pt3*pd - pt2*pdd*rho*p + T*pt3*pdd*rho)*T_der);
-        pro_der.dupT := quotient2 *((rho*pd2 - rho*pd*T*ptd - 2.0*pd*p +
-              2.0*pd*T*pt - pdd*rho*p + pdd*rho*T*pt)*p_der -
-              (rho*pd2*T*ptt + ptd*rho*pd*p - 2.0*rho*pd*pt*T*ptd +
-              rho*pd2*pt - 2.0*pt*pd*p + 2.0*pd*pt2*T - pt*pdd*rho*p +
-              pdd*rho*pt2*T)*T_der);
-        pro_der.ddpT := -(1/pd3)*(pdd*p_der + (ptd*pd - pt*pdd)*T_der);
-        pro_der.ddTp := -(1/pd3)*((ptd*pd - pt*pdd)*p_der +
-              (ptt*pd2 - 2.0*pt*ptd*pd + pt2*pdd)*T_der);
-        pro_der.cp := quotient2*(-T*(rho*pd2*ptt - 2.0*rho*pd*pt*ptd +
-              2.0*pd*pt2 + pdd*rho*pt^2)*p_der +
-              (rho2*rho*pd3*cvt + 3.0*rho*pd2*pt*T*ptt + rho*pd2*pt2 -
-              3.0*ptd*rho*pd*pt2*T + 2.0*T*pt3*pd + T*pt3*pdd*rho)*T_der);
-        pro_der.s := quotient*(-pt*p_der + (cv*rho2*pd/T+pt2)*T_der);
-        pro_der.u := quotient*(-(-rho*pd + T*pt)*p_der +
-              (cv*rho2*pd - pt*p + pt2*T)*T_der);
-        pro_der.h := quotient*((-rho*pd + T*pt)*p_der +
-              (rho2*pd*cv + T*pt*pt)*T_der);
-        pro_der.d := (1/pd)*(p_der - pt*T_der);
-
-      elseif (region == 5) then
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g5L3(p, T);
-        x := 1.0;
-
-        h := R*T*g.tau*g.gtau;
-        s := R*(g.tau*g.gtau - g.g);
-        rho := p/(R*T*g.pi*g.gpi);
-        rho2 := rho*rho;
-        vt := R/p*(g.pi*g.gpi - g.tau*g.pi*g.gpitau);
-        vp := R*T/(p*p)*g.pi*g.pi*g.gpipi;
-        cp := -R*g.tau*g.tau*g.gtautau;
-        cv := R*(-g.tau*g.tau*g.gtautau + ((g.gpi - g.tau*g.gpitau)*(g.gpi - g.tau*g.gpitau)/g.gpipi));
-        vtt := R*g.pi/p*g.tau/T*g.tau*g.gpitautau;
-        vtp := R*g.pi*g.pi/(p*p)*(g.gpipi - g.tau*g.gpipitau);
-        vpp := R*T*g.pi*g.pi*g.pi/(p*p*p)*g.gpipipi;
-        cpt := R*g.tau*g.tau/T*(2*g.gtautau + g.tau*g.gtautautau);
-        pt := -g.p/g.T*(g.gpi - g.tau*g.gpitau)/(g.gpipi*g.pi);
-        pd := -g.R*g.T*g.gpi*g.gpi/(g.gpipi);
-        v := 1/rho;
-        vp3 := vp*vp*vp;
-        ivp3 := 1/vp3;
-        ptt := -(vtt*vp*vp -2.0*vt*vtp*vp +vt*vt*vpp)*ivp3;
-        pdd := -vpp*ivp3/(rho2*rho2) - 2*v*pd;
-        ptd := (vtp*vp-vt*vpp)*ivp3/rho2 "= -ptv/d^2";
-        cvt := (vp3*cpt + vp*vp*vt*vt + 3.0*vp*vp*T*vt*vtt -
-              3.0*vtp*vp*T*vt*vt + T*vt*vt*vt*vpp)*ivp3;
-
-        // calculate the derivatives
-        pro_der.x := 0;
-        pro_der.duTp := (-vt - T*vtt - p*vtp)*p_der +
-              (cpt - p*vtt)*T_der;
-        pro_der.dupT := (-T*vtp - vp - p*vpp)*p_der +
-              (-vt - T*vtt - p*vtp)*T_der;
-        pro_der.ddpT := -rho2*(vpp*p_der + vtp*T_der);
-        pro_der.ddTp := -rho2*(vtp*p_der + vtt*T_der);
-        pro_der.cp := (-T*vtt)*p_der + cpt*T_der;
-        pro_der.s := (-vt)*p_der + (cp/T)*T_der;
-        pro_der.u := (v-T*vt)*p_der + (cp-p*vt)*T_der;
-        pro_der.h := (v - T*vt)*p_der + cp*T_der;
-        pro_der.d := -rho2*(vp*p_der + vt*T_der);
-      else
-        assert(false, "Water_pT_der: error in region computation of IF97 steam tables"
-        + "(p = " + String(p) + ", T = " + String(T) + ", region = " + String(region) + ")");
-      end if;
-
-      annotation (
-        Icon(graphics={
-            Text(extent={{-134,104},{142,44}}, textString=
-                                                   "%name"),
-            Ellipse(
-              extent={{-100,40},{100,-100}},
-              lineColor={255,127,0},
-              fillColor={255,255,255},
-              fillPattern=FillPattern.Solid),
-            Text(
-              extent={{-84,-4},{84,-52}},
-              lineColor={255,127,0},
-              textString=
-                   "fonction")}),
-        Documentation(info="<html>
+        "));
+    end Water_Ps_der;
+
+    function Water_PT_der
+      input Modelica.Units.SI.AbsolutePressure p "pressure";
+      input Modelica.Units.SI.Temperature T "Temperature";
+      input Integer mode = 0 "Région IF97 - 0:calcul automatique";
+      input Real p_der "Pression";
+      input Real T_der "Température";
+      output ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_pT pro_der;
+    protected
+      Integer region;
+      Boolean supercritical;
+      Integer error;
+      Modelica.Units.SI.Density d;
+      // From aux record
+      Modelica.Units.SI.Pressure p_aux "pressure";
+      Modelica.Units.SI.Temperature T_aux "temperature";
+      Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+      Modelica.Units.SI.SpecificHeatCapacity R "gas constant";
+      Modelica.Units.SI.SpecificHeatCapacity cp "specific heat capacity";
+      Real cpt "derivative of cp w.r.t. temperature";
+      Modelica.Units.SI.SpecificHeatCapacity cv "specific heat capacity";
+      Real cvt "derivative of cv w.r.t. temperature";
+      Modelica.Units.SI.Density rho "density";
+      Modelica.Units.SI.SpecificEntropy s "specific entropy";
+      ThermoSysPro.Units.DerPressureByTemperature pt "derivative of pressure wrt temperature";
+      ThermoSysPro.Units.DerPressureByDensity pd "derivative of pressure wrt density";
+      Real ptt "2nd derivative of pressure wrt temperature";
+      Real pdd "2nd derivative of pressure wrt density";
+      Real ptd "mixed derivative of pressure w.r.t. density and temperature";
+      Real vt "derivative of specific volume w.r.t. temperature";
+      Real vp "derivative of specific volume w.r.t. pressure";
+      Real vtt "2nd derivative of specific volume w.r.t. temperature";
+      Real vpp "2nd derivative of specific volume w.r.t. pressure";
+      Real vtp "mixed derivative of specific volume w.r.t. pressure and temperature";
+      Real x "dryness fraction";
+      Real dpT "dp/dT derivative of saturation curve";
+      // needed
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd g "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd f "dimensionless Helmholtz funcion and dervatives wrt delta and tau";
+      Real vp3 "vp^3";
+      Real ivp3 "1/vp3";
+      Modelica.Units.SI.SpecificVolume v;
+      Real rho2;
+      Real quotient;
+      Real quotient2;
+      Real pd2;
+      Real pd3;
+      Real pt2;
+      Real pt3;
+    algorithm
+      supercritical := p > ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT;
+      region := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_pT(p, T, mode);
+      R := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
+      if region == 1 then
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1L3(p, T);
+        x := 0.0;
+        h := R * T * g.tau * g.gtau;
+        s := R * (g.tau * g.gtau - g.g);
+        rho := p / (R * T * g.pi * g.gpi);
+        rho2 := rho * rho;
+        vt := R / p * (g.pi * g.gpi - g.tau * g.pi * g.gpitau);
+        vp := R * T / (p * p) * g.pi * g.pi * g.gpipi;
+        cp := -R * g.tau * g.tau * g.gtautau;
+        cv := R * ((-g.tau * g.tau * g.gtautau) + (g.gpi - g.tau * g.gpitau) * (g.gpi - g.tau * g.gpitau) / g.gpipi);
+        vtt := R * g.pi / p * g.tau / T * g.tau * g.gpitautau;
+        vtp := R * g.pi * g.pi / (p * p) * (g.gpipi - g.tau * g.gpipitau);
+        vpp := R * T * g.pi * g.pi * g.pi / (p * p * p) * g.gpipipi;
+        cpt := R * g.tau * g.tau / T * (2 * g.gtautau + g.tau * g.gtautautau);
+        pt := -g.p / g.T * (g.gpi - g.tau * g.gpitau) / (g.gpipi * g.pi);
+        pd := -g.R * g.T * g.gpi * g.gpi / g.gpipi;
+        v := 1 / rho;
+        vp3 := vp * vp * vp;
+        ivp3 := 1 / vp3;
+        ptt := -(vtt * vp * vp - 2.0 * vt * vtp * vp + vt * vt * vpp) * ivp3;
+        pdd := (-vpp * ivp3 / (rho2 * rho2)) - 2 * v * pd;
+        ptd := (vtp * vp - vt * vpp) * ivp3 / rho2 "= -ptv/d^2";
+        cvt := (vp3 * cpt + vp * vp * vt * vt + 3.0 * vp * vp * T * vt * vtt - 3.0 * vtp * vp * T * vt * vt + T * vt * vt * vt * vpp) * ivp3;
+        pro_der.x := 0;
+        pro_der.duTp := ((-vt) - T * vtt - p * vtp) * p_der + (cpt - p * vtt) * T_der;
+        pro_der.dupT := ((-T * vtp) - vp - p * vpp) * p_der + ((-vt) - T * vtt - p * vtp) * T_der;
+        pro_der.ddpT := -rho2 * (vpp * p_der + vtp * T_der);
+        pro_der.ddTp := -rho2 * (vtp * p_der + vtt * T_der);
+        pro_der.cp := (-T * vtt) * p_der + cpt * T_der;
+        pro_der.s := (-vt) * p_der + cp / T * T_der;
+        pro_der.u := (v - T * vt) * p_der + (cp - p * vt) * T_der;
+        pro_der.h := (v - T * vt) * p_der + cp * T_der;
+        pro_der.d := -rho2 * (vp * p_der + vt * T_der);
+      elseif region == 2 then
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2L3(p, T);
+        x := 1.0;
+        h := R * T * g.tau * g.gtau;
+        s := R * (g.tau * g.gtau - g.g);
+        rho := p / (R * T * g.pi * g.gpi);
+        rho2 := rho * rho;
+        vt := R / p * (g.pi * g.gpi - g.tau * g.pi * g.gpitau);
+        vp := R * T / (p * p) * g.pi * g.pi * g.gpipi;
+        cp := -R * g.tau * g.tau * g.gtautau;
+        cv := R * ((-g.tau * g.tau * g.gtautau) + (g.gpi - g.tau * g.gpitau) * (g.gpi - g.tau * g.gpitau) / g.gpipi);
+        vtt := R * g.pi / p * g.tau / T * g.tau * g.gpitautau;
+        vtp := R * g.pi * g.pi / (p * p) * (g.gpipi - g.tau * g.gpipitau);
+        vpp := R * T * g.pi * g.pi * g.pi / (p * p * p) * g.gpipipi;
+        cpt := R * g.tau * g.tau / T * (2 * g.gtautau + g.tau * g.gtautautau);
+        pt := -g.p / g.T * (g.gpi - g.tau * g.gpitau) / (g.gpipi * g.pi);
+        pd := -g.R * g.T * g.gpi * g.gpi / g.gpipi;
+        v := 1 / rho;
+        vp3 := vp * vp * vp;
+        ivp3 := 1 / vp3;
+        ptt := -(vtt * vp * vp - 2.0 * vt * vtp * vp + vt * vt * vpp) * ivp3;
+        pdd := (-vpp * ivp3 / (rho2 * rho2)) - 2 * v * pd;
+        ptd := (vtp * vp - vt * vpp) * ivp3 / rho2 "= -ptv/d^2";
+        cvt := (vp3 * cpt + vp * vp * vt * vt + 3.0 * vp * vp * T * vt * vtt - 3.0 * vtp * vp * T * vt * vt + T * vt * vt * vt * vpp) * ivp3;
+        pro_der.x := 0;
+        pro_der.duTp := ((-vt) - T * vtt - p * vtp) * p_der + (cpt - p * vtt) * T_der;
+        pro_der.dupT := ((-T * vtp) - vp - p * vpp) * p_der + ((-vt) - T * vtt - p * vtp) * T_der;
+        pro_der.ddpT := -rho2 * (vpp * p_der + vtp * T_der);
+        pro_der.ddTp := -rho2 * (vtp * p_der + vtt * T_der);
+        pro_der.cp := (-T * vtt) * p_der + cpt * T_der;
+        pro_der.s := (-vt) * p_der + cp / T * T_der;
+        pro_der.u := (v - T * vt) * p_der + (cp - p * vt) * T_der;
+        pro_der.h := (v - T * vt) * p_der + cp * T_der;
+        pro_der.d := -rho2 * (vp * p_der + vt * T_der);
+      elseif region == 3 then
+        (rho, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.dofpt3(p, T, delp = 1.0e-7);
+        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(rho, T);
+        rho2 := rho * rho;
+        h := R * T * (f.tau * f.ftau + f.delta * f.fdelta);
+        s := R * (f.tau * f.ftau - f.f);
+        pd := R * T * f.delta * (2.0 * f.fdelta + f.delta * f.fdeltadelta);
+        pd2 := pd * pd;
+        pd3 := pd * pd2;
+        pt := R * rho * f.delta * (f.fdelta - f.tau * f.fdeltatau);
+        pt2 := pt * pt;
+        pt3 := pt * pt * pt;
+        cv := R * (-f.tau * f.tau * f.ftautau);
+        x := 0.0;
+        pdd := R * T * f.delta / rho * (2.0 * f.fdelta + 4.0 * f.delta * f.fdeltadelta + f.delta * f.delta * f.fdeltadeltadelta);
+        ptt := R * rho * f.delta * f.tau * f.tau / T * f.fdeltatautau;
+        ptd := R * f.delta * (2.0 * f.fdelta + f.delta * f.fdeltadelta - 2.0 * f.tau * f.fdeltatau - f.delta * f.tau * f.fdeltadeltatau);
+        cvt := R * f.tau * f.tau / T * (2.0 * f.ftautau + f.tau * f.ftautautau);
+        cpt := (cvt * pd + cv * ptd + (pt + 2.0 * T * ptt) * pt / rho2 - pt * ptd) / pd;
+        pro_der.x := 0;
+        quotient := 1 / (rho2 * pd);
+        quotient2 := quotient / (rho * pd2);
+        pro_der.duTp := quotient2 * ((-(rho * pd2 * T * ptt + ptd * rho * pd * p - 2.0 * rho * pd * pt * T * ptd + rho * pd2 * pt - 2.0 * pt * pd * p + 2.0 * pd * pt2 * T - pt * pdd * rho * p + pdd * rho * pt2 * T) * p_der) + (rho2 * rho * pd3 * cvt - rho * pd2 * ptt * p + 3.0 * rho * pd2 * pt * T * ptt + 2.0 * ptd * rho * pd * pt * p - 3.0 * ptd * rho * pd * pt2 * T + rho * pd2 * pt2 - 2.0 * pt2 * pd * p + 2.0 * T * pt3 * pd - pt2 * pdd * rho * p + T * pt3 * pdd * rho) * T_der);
+        pro_der.dupT := quotient2 * ((rho * pd2 - rho * pd * T * ptd - 2.0 * pd * p + 2.0 * pd * T * pt - pdd * rho * p + pdd * rho * T * pt) * p_der - (rho * pd2 * T * ptt + ptd * rho * pd * p - 2.0 * rho * pd * pt * T * ptd + rho * pd2 * pt - 2.0 * pt * pd * p + 2.0 * pd * pt2 * T - pt * pdd * rho * p + pdd * rho * pt2 * T) * T_der);
+        pro_der.ddpT := -1 / pd3 * (pdd * p_der + (ptd * pd - pt * pdd) * T_der);
+        pro_der.ddTp := -1 / pd3 * ((ptd * pd - pt * pdd) * p_der + (ptt * pd2 - 2.0 * pt * ptd * pd + pt2 * pdd) * T_der);
+        pro_der.cp := quotient2 * ((-T * (rho * pd2 * ptt - 2.0 * rho * pd * pt * ptd + 2.0 * pd * pt2 + pdd * rho * pt ^ 2) * p_der) + (rho2 * rho * pd3 * cvt + 3.0 * rho * pd2 * pt * T * ptt + rho * pd2 * pt2 - 3.0 * ptd * rho * pd * pt2 * T + 2.0 * T * pt3 * pd + T * pt3 * pdd * rho) * T_der);
+        pro_der.s := quotient * ((-pt * p_der) + (cv * rho2 * pd / T + pt2) * T_der);
+        pro_der.u := quotient * ((-((-rho * pd) + T * pt) * p_der) + (cv * rho2 * pd - pt * p + pt2 * T) * T_der);
+        pro_der.h := quotient * (((-rho * pd) + T * pt) * p_der + (rho2 * pd * cv + T * pt * pt) * T_der);
+        pro_der.d := 1 / pd * (p_der - pt * T_der);
+      elseif region == 5 then
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g5L3(p, T);
+        x := 1.0;
+        h := R * T * g.tau * g.gtau;
+        s := R * (g.tau * g.gtau - g.g);
+        rho := p / (R * T * g.pi * g.gpi);
+        rho2 := rho * rho;
+        vt := R / p * (g.pi * g.gpi - g.tau * g.pi * g.gpitau);
+        vp := R * T / (p * p) * g.pi * g.pi * g.gpipi;
+        cp := -R * g.tau * g.tau * g.gtautau;
+        cv := R * ((-g.tau * g.tau * g.gtautau) + (g.gpi - g.tau * g.gpitau) * (g.gpi - g.tau * g.gpitau) / g.gpipi);
+        vtt := R * g.pi / p * g.tau / T * g.tau * g.gpitautau;
+        vtp := R * g.pi * g.pi / (p * p) * (g.gpipi - g.tau * g.gpipitau);
+        vpp := R * T * g.pi * g.pi * g.pi / (p * p * p) * g.gpipipi;
+        cpt := R * g.tau * g.tau / T * (2 * g.gtautau + g.tau * g.gtautautau);
+        pt := -g.p / g.T * (g.gpi - g.tau * g.gpitau) / (g.gpipi * g.pi);
+        pd := -g.R * g.T * g.gpi * g.gpi / g.gpipi;
+        v := 1 / rho;
+        vp3 := vp * vp * vp;
+        ivp3 := 1 / vp3;
+        ptt := -(vtt * vp * vp - 2.0 * vt * vtp * vp + vt * vt * vpp) * ivp3;
+        pdd := (-vpp * ivp3 / (rho2 * rho2)) - 2 * v * pd;
+        ptd := (vtp * vp - vt * vpp) * ivp3 / rho2 "= -ptv/d^2";
+        cvt := (vp3 * cpt + vp * vp * vt * vt + 3.0 * vp * vp * T * vt * vtt - 3.0 * vtp * vp * T * vt * vt + T * vt * vt * vt * vpp) * ivp3;
+        pro_der.x := 0;
+        pro_der.duTp := ((-vt) - T * vtt - p * vtp) * p_der + (cpt - p * vtt) * T_der;
+        pro_der.dupT := ((-T * vtp) - vp - p * vpp) * p_der + ((-vt) - T * vtt - p * vtp) * T_der;
+        pro_der.ddpT := -rho2 * (vpp * p_der + vtp * T_der);
+        pro_der.ddTp := -rho2 * (vtp * p_der + vtt * T_der);
+        pro_der.cp := (-T * vtt) * p_der + cpt * T_der;
+        pro_der.s := (-vt) * p_der + cp / T * T_der;
+        pro_der.u := (v - T * vt) * p_der + (cp - p * vt) * T_der;
+        pro_der.h := (v - T * vt) * p_der + cp * T_der;
+        pro_der.d := -rho2 * (vp * p_der + vt * T_der);
+      else
+        assert(false, "Water_pT_der: error in region computation of IF97 steam tables" + "(p = " + String(p) + ", T = " + String(T) + ", region = " + String(region) + ")");
+      end if;
+// calculate the derivatives
+// calculate the derivatives
+// calculate the derivatives
+// calculate the derivatives
+      annotation(
+        Icon(graphics = {Text(extent = {{-134, 104}, {142, 44}}, textString = "%name"), Ellipse(extent = {{-100, 40}, {100, -100}}, lineColor = {255, 127, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-84, -4}, {84, -52}}, lineColor = {255, 127, 0}, textString = "fonction")}),
+        Documentation(info = "<html>
 <p><b>Copyright &copy; EDF 2002 - 2010</b></p>
 </HTML>
 <html>
 <p><b>ThermoSysPro Version 2.0</b></p>
 </HTML>
-"));
-    end Water_PT_der;
-
-    function Water_sat_P_der
-      input Modelica.SIunits.AbsolutePressure P "Pression";
-
-      input Real P_der "derivative of pressure";
-
-    protected
-      Modelica.SIunits.Temperature T;
-      ThermoSysPro.Units.DerPressureByTemperature dpT
-        "dp/dT derivative of saturation curve";
-      Modelica.SIunits.Density d "density";
-      Modelica.SIunits.SpecificHeatCapacity cp
-        "Chaleur spécifique à pression constante";
-      Modelica.SIunits.SpecificHeatCapacity cv "specific heat capacity";
-      Real vt(unit="m3/(kg.K)")
-        "derivative of specific volume w.r.t. temperature";
-      Real vp(unit="m3/(kg.Pa)")
-        "derivative of specific volume w.r.t. pressure";
-      ThermoSysPro.Units.DerPressureByDensity pd
-        "Derivative of pressure wrt density";
-
-      Real vp3 "Third power of vp";
-      Real ivp3 "Inverse of third power of vp";
-
-      Real cvt "Derivative of cv w.r.t. temperature";
-      Real cpt "Derivative of cp w.r.t. temperature";
-
-      Real ptt "2nd derivative of pressure wrt temperature";
+        "));
+    end Water_PT_der;
+
+    function Water_sat_P_der
+      input Modelica.Units.SI.AbsolutePressure P "Pression";
+      input Real P_der "derivative of pressure";
+    protected
+      Modelica.Units.SI.Temperature T;
+      ThermoSysPro.Units.DerPressureByTemperature dpT "dp/dT derivative of saturation curve";
+      Modelica.Units.SI.Density d "density";
+      Modelica.Units.SI.SpecificHeatCapacity cp "Chaleur spécifique à pression constante";
+      Modelica.Units.SI.SpecificHeatCapacity cv "specific heat capacity";
+      Real vt(unit = "m3/(kg.K)") "derivative of specific volume w.r.t. temperature";
+      Real vp(unit = "m3/(kg.Pa)") "derivative of specific volume w.r.t. pressure";
+      ThermoSysPro.Units.DerPressureByDensity pd "Derivative of pressure wrt density";
+      Real vp3 "Third power of vp";
+      Real ivp3 "Inverse of third power of vp";
+      Real cvt "Derivative of cv w.r.t. temperature";
+      Real cpt "Derivative of cp w.r.t. temperature";
+      Real ptt "2nd derivative of pressure wrt temperature";
       /*
-  Real pdd "2nd derivative of pressure wrt density";
-  Real ptd "Mixed derivative of pressure w.r.t. density and temperature";
-  */
-      Real vtt "2nd derivative of specific volume w.r.t. temperature";
-      Real vpp "2nd derivative of specific volume w.r.t. pressure";
-      Real vtp
-        "Mixed derivative of specific volume w.r.t. pressure and temperature";
-
-      Real v "specific volume";
-      Real pv;
-      //Real ptv;
-
-      Real tp;
-      Real p2;
-      Real pi2;
-
-    public
-      output ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat dlsat
-                                        annotation (Placement(transformation(
-              extent={{-85,15},{-15,85}}, rotation=0)));
-      output ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat dvsat
-                                        annotation (Placement(transformation(
-              extent={{15,15},{85,85}}, rotation=0)));
-    protected
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd
-                                               gl
-                               annotation (Placement(transformation(extent={{
-                -85,-85},{-15,-15}}, rotation=0)));
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd
-                                               gv
-                               annotation (Placement(transformation(extent={{15,
-                -85},{85,-15}}, rotation=0)));
-
-    algorithm
-      /*  if (not (P < SteamIF97.data.plimit4a)) then
+        Real pdd "2nd derivative of pressure wrt density";
+        Real ptd "Mixed derivative of pressure w.r.t. density and temperature";
+        */
+      Real vtt "2nd derivative of specific volume w.r.t. temperature";
+      Real vpp "2nd derivative of specific volume w.r.t. pressure";
+      Real vtp "Mixed derivative of specific volume w.r.t. pressure and temperature";
+      Real v "specific volume";
+      Real pv;
+      //Real ptv;
+      Real tp;
+      Real p2;
+      Real pi2;
+    public
+      output ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat dlsat annotation(
+        Placement(transformation(extent = {{-85, 15}, {-15, 85}}, rotation = 0)));
+      output ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat dvsat annotation(
+        Placement(transformation(extent = {{15, 15}, {85, 85}}, rotation = 0)));
+    protected
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd gl annotation(
+        Placement(transformation(extent = {{-85, -85}, {-15, -15}}, rotation = 0)));
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd gv annotation(
+        Placement(transformation(extent = {{15, -85}, {85, -15}}, rotation = 0)));
+    algorithm
+/*  if (not (P < SteamIF97.data.plimit4a)) then
     assert(false, "Eau_sat_P: Pression > 16.5292e6 Pa");
-  end if;*/
-
-      T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tsat(P);
-
-      // get Gibbs derivatives of third order
-      gl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1L3(P, T);
-      gv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2L3(P, T);
-
-      // Precalculs
-      dpT := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.dptofT(T);
-      ptt := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.d2ptofT(T);
-      tp := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.dtsatofp(P);
-      p2 := gl.p*gl.p;
-      pi2 := gl.pi*gl.pi;
-
-      // compute variables for liquid
-      d := gl.p/(gl.R*T*gl.pi*gl.gpi);
-      vp := gl.R*T/(p2)*pi2*gl.gpipi;
-      vt := gl.R/gl.p*gl.pi*(gl.gpi - gl.tau*gl.gpitau);
-      cp := -gl.R*gl.tau*gl.tau*gl.gtautau;
-      v :=1/d;
-      cv := gl.R*(-gl.tau*gl.tau*gl.gtautau +
-          (gl.gpi - gl.tau*gl.gpitau)*(gl.gpi - gl.tau*gl.gpitau)/(gl.gpipi));
-
-      // variables needed only for derivitve of cp
-
-      pd := -gl.R*T*gl.gpi*gl.gpi/(gl.gpipi);
-      pv := -pd*d*d;
-
-      vtt := gl.R*gl.pi/gl.p*gl.tau/T*gl.tau*gl.gpitautau;
-
-      vtp := gl.R*pi2/(p2)*(gl.gpipi - gl.tau*gl.gpipitau);
-      vpp := gl.R*T*pi2*gl.pi/(p2*gl.p)*gl.gpipipi;
-      vp3 := vp*vp*vp;
-      ivp3 := 1/vp3;
-      /*
+  end if;*/
+      T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tsat(P);
+// get Gibbs derivatives of third order
+      gl := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1L3(P, T);
+      gv := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2L3(P, T);
+// Precalculs
+      dpT := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.dptofT(T);
+      ptt := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.d2ptofT(T);
+      tp := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.dtsatofp(P);
+      p2 := gl.p * gl.p;
+      pi2 := gl.pi * gl.pi;
+// compute variables for liquid
+      d := gl.p / (gl.R * T * gl.pi * gl.gpi);
+      vp := gl.R * T / p2 * pi2 * gl.gpipi;
+      vt := gl.R / gl.p * gl.pi * (gl.gpi - gl.tau * gl.gpitau);
+      cp := -gl.R * gl.tau * gl.tau * gl.gtautau;
+      v := 1 / d;
+      cv := gl.R * ((-gl.tau * gl.tau * gl.gtautau) + (gl.gpi - gl.tau * gl.gpitau) * (gl.gpi - gl.tau * gl.gpitau) / gl.gpipi);
+// variables needed only for derivitve of cp
+      pd := -gl.R * T * gl.gpi * gl.gpi / gl.gpipi;
+      pv := -pd * d * d;
+      vtt := gl.R * gl.pi / gl.p * gl.tau / T * gl.tau * gl.gpitautau;
+      vtp := gl.R * pi2 / p2 * (gl.gpipi - gl.tau * gl.gpipitau);
+      vpp := gl.R * T * pi2 * gl.pi / (p2 * gl.p) * gl.gpipipi;
+      vp3 := vp * vp * vp;
+      ivp3 := 1 / vp3;
+/*
   ptt := -(vtt*vp*vp -2.0*vt*vtp*vp + vt*vt*vpp)*ivp3;
 
   ptd := (vtp*vp-vt*vpp)*ivp3/(d*d) "= -ptv/d^2";
   ptv := -ptd/(v*v);
-  */
-
-      cpt := gl.R*gl.tau*gl.tau/T*(2*gl.gtautau + gl.tau*gl.gtautautau);
-      cvt := (vp3*cpt + vp*vp*vt*vt + 3.0*vp*vp*T*vt*vtt -
-              3.0*vtp*vp*T*vt*vt + T*vt*vt*vt*vpp)*ivp3;
-
-      // compute derivatives for liquid
-      //dlsat.u := (cv + (T*dpT - P)*vt)*tp*P_der;
-      dlsat.pt := ptt*tp*P_der;
-      dlsat.cv := cvt*tp*P_der;
-      dlsat.cp := (cvt*tp + vp*dpT + ((v*pv + T*dpT)*vtp + (vp*pv + tp*dpT)*vt))*P_der;
-      //dlsat.cp := (cvt + (vt*dpT + ptt*v) + ((v*pv + T*dpT)*vtt + (vt*pv + v*ptv + dpT + T*ptt)*vt))*tp*P_der;
-      dlsat.h := (v - T*vt)*P_der + cp/dpT*P_der;
-      dlsat.rho := -d*d*(vp + vt/dpT)*P_der;
-      dlsat.T := tp*P_der;
-      dlsat.P := P_der;
-
-      p2 := gv.p*gv.p;
-      pi2 := gv.pi*gv.pi;
-
-      // compute variables for liquid
-      d := gv.p/(gv.R*T*gv.pi*gv.gpi);
-      vp := gv.R*T/(p2)*pi2*gv.gpipi;
-      vt := gv.R/gv.p*gv.pi*(gv.gpi - gv.tau*gv.gpitau);
-      cp := -gv.R*gv.tau*gv.tau*gv.gtautau;
-      v :=1/d;
-      cv := gv.R*(-gv.tau*gv.tau*gv.gtautau +
-        (gv.gpi - gv.tau*gv.gpitau)*(gv.gpi - gv.tau*gv.gpitau)/(gv.gpipi));
-
-      // variables needed only for derivitve of cp
-
-      pd := -gv.R*T*gv.gpi*gv.gpi/(gv.gpipi);
-      pv := -pd*d*d;
-
-      vtt := gv.R*gv.pi/gv.p*gv.tau/T*gv.tau*gv.gpitautau;
-
-      vtp := gv.R*pi2/(p2)*(gv.gpipi - gv.tau*gv.gpipitau);
-      vpp := gv.R*T*pi2*gv.pi/(p2*gv.p)*gv.gpipipi;
-      vp3 := vp*vp*vp;
-      ivp3 := 1/vp3;
-      /*
+  */
+      cpt := gl.R * gl.tau * gl.tau / T * (2 * gl.gtautau + gl.tau * gl.gtautautau);
+      cvt := (vp3 * cpt + vp * vp * vt * vt + 3.0 * vp * vp * T * vt * vtt - 3.0 * vtp * vp * T * vt * vt + T * vt * vt * vt * vpp) * ivp3;
+// compute derivatives for liquid
+//dlsat.u := (cv + (T*dpT - P)*vt)*tp*P_der;
+      dlsat.pt := ptt * tp * P_der;
+      dlsat.cv := cvt * tp * P_der;
+      dlsat.cp := (cvt * tp + vp * dpT + (v * pv + T * dpT) * vtp + (vp * pv + tp * dpT) * vt) * P_der;
+//dlsat.cp := (cvt + (vt*dpT + ptt*v) + ((v*pv + T*dpT)*vtt + (vt*pv + v*ptv + dpT + T*ptt)*vt))*tp*P_der;
+      dlsat.h := (v - T * vt) * P_der + cp / dpT * P_der;
+      dlsat.rho := -d * d * (vp + vt / dpT) * P_der;
+      dlsat.T := tp * P_der;
+      dlsat.P := P_der;
+      p2 := gv.p * gv.p;
+      pi2 := gv.pi * gv.pi;
+// compute variables for liquid
+      d := gv.p / (gv.R * T * gv.pi * gv.gpi);
+      vp := gv.R * T / p2 * pi2 * gv.gpipi;
+      vt := gv.R / gv.p * gv.pi * (gv.gpi - gv.tau * gv.gpitau);
+      cp := -gv.R * gv.tau * gv.tau * gv.gtautau;
+      v := 1 / d;
+      cv := gv.R * ((-gv.tau * gv.tau * gv.gtautau) + (gv.gpi - gv.tau * gv.gpitau) * (gv.gpi - gv.tau * gv.gpitau) / gv.gpipi);
+// variables needed only for derivitve of cp
+      pd := -gv.R * T * gv.gpi * gv.gpi / gv.gpipi;
+      pv := -pd * d * d;
+      vtt := gv.R * gv.pi / gv.p * gv.tau / T * gv.tau * gv.gpitautau;
+      vtp := gv.R * pi2 / p2 * (gv.gpipi - gv.tau * gv.gpipitau);
+      vpp := gv.R * T * pi2 * gv.pi / (p2 * gv.p) * gv.gpipipi;
+      vp3 := vp * vp * vp;
+      ivp3 := 1 / vp3;
+/*
   ptt := -(vtt*vp*vp -2.0*vt*vtp*vp + vt*vt*vpp)*ivp3;
 
   ptd := (vtp*vp-vt*vpp)*ivp3/(d*d) "= -ptv/d^2";
   ptv := -ptd/(v*v);
-  */
-
-      cpt := gv.R*gv.tau*gv.tau/T*(2*gv.gtautau + gv.tau*gv.gtautautau);
-      cvt := (vp3*cpt + vp*vp*vt*vt + 3.0*vp*vp*T*vt*vtt -
-              3.0*vtp*vp*T*vt*vt + T*vt*vt*vt*vpp)*ivp3;
-
-      // Compute the derivatives for vapour
-      //dvsat.u := (cv + (T*dpT - P)*vt)*tp*P_der;
-      dvsat.pt := ptt*tp*P_der;
-      dvsat.cv := cvt*tp*P_der;
-      dvsat.cp := (cvt*tp + vp*dpT + ((v*pv + T*dpT)*vtp + (vp*pv + tp*dpT)*vt))*P_der;
-      //dlsat.cp := (cvt + (vt*dpT + ptt*v) + ((v*pv + T*dpT)*vtt + (vt*pv + v*ptv + dpT + T*ptt)*vt))*tp*P_der;
-      dvsat.h := (v - T*vt)*P_der + cp/dpT*P_der;
-      dvsat.rho := -d*d*(vp + vt/dpT)*P_der;
-      dvsat.T := tp *P_der;
-      dvsat.P := P_der;
-
-      annotation (
-        Window(
-          x=0.34,
-          y=0.21,
-          width=0.6,
-          height=0.6),
-        Icon(coordinateSystem(
-            preserveAspectRatio=false,
-            extent={{-100,-100},{100,100}},
-            grid={2,2}), graphics={
-            Text(extent={{-134,104},{142,44}}, textString=
-                                                   "%name"),
-            Ellipse(
-              extent={{-100,40},{100,-100}},
-              lineColor={255,127,0},
-              fillColor={255,255,255},
-              fillPattern=FillPattern.Solid),
-            Text(
-              extent={{-84,-4},{84,-52}},
-              lineColor={255,127,0},
-              textString=
-                   "fonction")}),
-        Documentation(info="<html>
+  */
+      cpt := gv.R * gv.tau * gv.tau / T * (2 * gv.gtautau + gv.tau * gv.gtautautau);
+      cvt := (vp3 * cpt + vp * vp * vt * vt + 3.0 * vp * vp * T * vt * vtt - 3.0 * vtp * vp * T * vt * vt + T * vt * vt * vt * vpp) * ivp3;
+// Compute the derivatives for vapour
+//dvsat.u := (cv + (T*dpT - P)*vt)*tp*P_der;
+      dvsat.pt := ptt * tp * P_der;
+      dvsat.cv := cvt * tp * P_der;
+      dvsat.cp := (cvt * tp + vp * dpT + (v * pv + T * dpT) * vtp + (vp * pv + tp * dpT) * vt) * P_der;
+//dlsat.cp := (cvt + (vt*dpT + ptt*v) + ((v*pv + T*dpT)*vtt + (vt*pv + v*ptv + dpT + T*ptt)*vt))*tp*P_der;
+      dvsat.h := (v - T * vt) * P_der + cp / dpT * P_der;
+      dvsat.rho := -d * d * (vp + vt / dpT) * P_der;
+      dvsat.T := tp * P_der;
+      dvsat.P := P_der;
+      annotation(
+        Window(x = 0.34, y = 0.21, width = 0.6, height = 0.6),
+        Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}, grid = {2, 2}), graphics = {Text(extent = {{-134, 104}, {142, 44}}, textString = "%name"), Ellipse(extent = {{-100, 40}, {100, -100}}, lineColor = {255, 127, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-84, -4}, {84, -52}}, lineColor = {255, 127, 0}, textString = "fonction")}),
+        Documentation(info = "<html>
 <p><b>Copyright &copy; EDF 2002 - 2010</b></p>
 </HTML>
 <html>
 <p><b>ThermoSysPro Version 2.0</b></p>
 </HTML>
-"));
-    end Water_sat_P_der;
-
-    function SpecificEnthalpy_PT_der
-      input Modelica.SIunits.AbsolutePressure p "pressure";
-      input Modelica.SIunits.Temperature   T "Temperature";
-      input Integer mode = 0 "Région IF97 - 0:calcul automatique";
-
-      input Real p_der "Pression";
-      input Real T_der "Température";
-
-      output Real H "specific enthalpy";
-    protected
-      Integer region;
-      Boolean supercritical;
-      Integer error;
-
-      Modelica.SIunits.SpecificHeatCapacity R "gas constant";
-      Modelica.SIunits.SpecificHeatCapacity cp "specific heat capacity";
-      Modelica.SIunits.SpecificHeatCapacity cv "specific heat capacity";
-      Modelica.SIunits.Density rho "density";
-      ThermoSysPro.Units.DerPressureByTemperature pt
-        "derivative of pressure wrt temperature";
-      ThermoSysPro.Units.DerPressureByDensity pd
-        "derivative of pressure wrt density";
-
-      Real vt "derivative of specific volume w.r.t. temperature";
-
-      // needed
-      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs g
-        "dimensionless Gibbs funcion and dervatives wrt pi and tau";
-      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs f
-        "dimensionless Helmholtz funcion and dervatives wrt delta and tau";
-
-      Real rho2;
-
-    algorithm
-      supercritical := (p >ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT);
-      region := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_pT(p, T, mode);
-      R :=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
-      if (region == 1) then
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(p, T);
-
-        rho := p/(R*T*g.pi*g.gpi);
-        vt := R/p*(g.pi*g.gpi - g.tau*g.pi*g.gtaupi);
-        cp := -R*g.tau*g.tau*g.gtautau;
-
-        H := (1/rho - T*vt)*p_der + cp*T_der;
-
-      elseif (region == 2) then
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(p, T);
-        rho := p/(R*T*g.pi*g.gpi);
-        vt := R/p*(g.pi*g.gpi - g.tau*g.pi*g.gtaupi);
-        cp := -R*g.tau*g.tau*g.gtautau;
-
-        H := (1/rho - T*vt)*p_der + cp*T_der;
-      elseif (region == 3) then
-        (rho,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.dofpt3(p,T,delp= 1.0e-7);
-        rho2 := rho*rho;
-        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(rho, T);
-
-        pd := R*T*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta);
-        pt := R*rho*f.delta*(f.fdelta - f.tau*f.fdeltatau);
-        cv := R*(-f.tau*f.tau*f.ftautau);
-
-        H := 1/(rho2*pd)*((-rho*pd + T*pt)*p_der +
-              (rho2*pd*cv + T*pt*p)*T_der);
-
-      elseif (region == 5) then
-        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g5(p, T);
-        rho := p/(R*T*g.pi*g.gpi);
-        vt := R/p*(g.pi*g.gpi - g.tau*g.pi*g.gtaupi);
-        cp := -R*g.tau*g.tau*g.gtautau;
-
-        H := (1/rho - T*vt)*p_der + cp*T_der;
-      else
-        assert(false, "Water_pT_der: error in region computation of IF97 steam tables"
-        + "(p = " + String(p) + ", T = " + String(T) + ", region = " + String(region) + ")");
-      end if;
-
-      annotation (
-        Icon(graphics={
-            Text(extent={{-134,104},{142,44}}, textString=
-                                                   "%name"),
-            Ellipse(
-              extent={{-100,40},{100,-100}},
-              lineColor={255,127,0},
-              fillColor={255,255,255},
-              fillPattern=FillPattern.Solid),
-            Text(
-              extent={{-84,-4},{84,-52}},
-              lineColor={255,127,0},
-              textString=
-                   "fonction")}),
-        Documentation(info="<html>
+        "));
+    end Water_sat_P_der;
+
+    function SpecificEnthalpy_PT_der
+      input Modelica.Units.SI.AbsolutePressure p "pressure";
+      input Modelica.Units.SI.Temperature T "Temperature";
+      input Integer mode = 0 "Région IF97 - 0:calcul automatique";
+      input Real p_der "Pression";
+      input Real T_der "Température";
+      output Real H "specific enthalpy";
+    protected
+      Integer region;
+      Boolean supercritical;
+      Integer error;
+      Modelica.Units.SI.SpecificHeatCapacity R "gas constant";
+      Modelica.Units.SI.SpecificHeatCapacity cp "specific heat capacity";
+      Modelica.Units.SI.SpecificHeatCapacity cv "specific heat capacity";
+      Modelica.Units.SI.Density rho "density";
+      ThermoSysPro.Units.DerPressureByTemperature pt "derivative of pressure wrt temperature";
+      ThermoSysPro.Units.DerPressureByDensity pd "derivative of pressure wrt density";
+      Real vt "derivative of specific volume w.r.t. temperature";
+      // needed
+      ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs g "dimensionless Gibbs funcion and dervatives wrt pi and tau";
+      ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs f "dimensionless Helmholtz funcion and dervatives wrt delta and tau";
+      Real rho2;
+    algorithm
+      supercritical := p > ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT;
+      region := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_pT(p, T, mode);
+      R := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
+      if region == 1 then
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(p, T);
+        rho := p / (R * T * g.pi * g.gpi);
+        vt := R / p * (g.pi * g.gpi - g.tau * g.pi * g.gtaupi);
+        cp := -R * g.tau * g.tau * g.gtautau;
+        H := (1 / rho - T * vt) * p_der + cp * T_der;
+      elseif region == 2 then
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(p, T);
+        rho := p / (R * T * g.pi * g.gpi);
+        vt := R / p * (g.pi * g.gpi - g.tau * g.pi * g.gtaupi);
+        cp := -R * g.tau * g.tau * g.gtautau;
+        H := (1 / rho - T * vt) * p_der + cp * T_der;
+      elseif region == 3 then
+        (rho, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.dofpt3(p, T, delp = 1.0e-7);
+        rho2 := rho * rho;
+        f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(rho, T);
+        pd := R * T * f.delta * (2.0 * f.fdelta + f.delta * f.fdeltadelta);
+        pt := R * rho * f.delta * (f.fdelta - f.tau * f.fdeltatau);
+        cv := R * (-f.tau * f.tau * f.ftautau);
+        H := 1 / (rho2 * pd) * (((-rho * pd) + T * pt) * p_der + (rho2 * pd * cv + T * pt * p) * T_der);
+      elseif region == 5 then
+        g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g5(p, T);
+        rho := p / (R * T * g.pi * g.gpi);
+        vt := R / p * (g.pi * g.gpi - g.tau * g.pi * g.gtaupi);
+        cp := -R * g.tau * g.tau * g.gtautau;
+        H := (1 / rho - T * vt) * p_der + cp * T_der;
+      else
+        assert(false, "Water_pT_der: error in region computation of IF97 steam tables" + "(p = " + String(p) + ", T = " + String(T) + ", region = " + String(region) + ")");
+      end if;
+      annotation(
+        Icon(graphics = {Text(extent = {{-134, 104}, {142, 44}}, textString = "%name"), Ellipse(extent = {{-100, 40}, {100, -100}}, lineColor = {255, 127, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-84, -4}, {84, -52}}, lineColor = {255, 127, 0}, textString = "fonction")}),
+        Documentation(info = "<html>
 <p><b>Copyright &copy; EDF 2002 - 2010</b></p>
 </HTML>
 <html>
 <p><b>ThermoSysPro Version 2.0</b></p>
 </HTML>
-"));
-    end SpecificEnthalpy_PT_der;
-
-    package Unused
-      "unused functions for which no analytic derivative can be provided"
-      function Water_rhoT
-        input Modelica.SIunits.Density rho "Masse volumique";
-        input Modelica.SIunits.Temperature T "Température";
-        input Integer phase "2: diphasique, 1 sinon";
-        input Integer mode = 0 "Région IF97 - 0:calcul automatique";
-        output ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_dT
-                                          pro;
-
-      protected
-        Integer region;
-        Integer error;
-        Boolean supercritical;
-        Modelica.SIunits.AbsolutePressure p;
-      protected
-        ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs
-                           g annotation (Placement(transformation(extent={{-90,
-                  -85},{-43.3333,-38.3333}}, rotation=0)));
-        ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs
-                               f
-          annotation (Placement(transformation(extent={{-23.3333,-85},{23.3333,
-                  -38.3333}}, rotation=0)));
-      algorithm
-        region := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_dT(rho, T, phase, mode);
-        if (region == 1) then
-          (p,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.pofdt125(d=rho, T=T, reldd=ThermoSysPro.Properties.WaterSteam.BaseIF97.IterationData.DELD, region=1);
-          g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(p, T);
-          supercritical := (p >ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT);
-          pro := ThermoSysPro.Properties.WaterSteam.Common.gibbsToProps_dT(
-                                        g);
-          pro.x := if (supercritical) then -1 else 0;
-        elseif (region == 2) then
-          (p,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.pofdt125(d=rho, T=T, reldd=ThermoSysPro.Properties.WaterSteam.BaseIF97.IterationData.DELD, region=2);
-          g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(p, T);
-          supercritical := (p >ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT);
-          pro := ThermoSysPro.Properties.WaterSteam.Common.gibbsToProps_dT(
-                                        g);
-          pro.x := if (supercritical) then -1 else 1;
-        elseif (region == 3) then
-          f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(rho, T);
-          pro := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToProps_dT(
-                                            f);
-          pro.x := if (supercritical) then -1 else 0;
-          supercritical := (p >ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT);
-        elseif (region == 4) then
-          pro := ThermoSysPro.Properties.WaterSteam.BaseIF97.TwoPhase.waterR4_dT(d=rho, T=T);
-        elseif (region == 5) then
-          (p,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.pofdt125(d=rho, T=T, reldd=ThermoSysPro.Properties.WaterSteam.BaseIF97.IterationData.DELD, region=5);
-          g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g5(p, T);
-          supercritical := (p >ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT);
-          pro := ThermoSysPro.Properties.WaterSteam.Common.gibbsToProps_dT(
-                                        g);
-          pro.x := if (supercritical) then -1 else 1;
-        else
-          assert(false, "Eau_rhoT: Numéro de région incorrect");
-        end if;
-        annotation (
-          Window(
-            x=0.3,
-            y=0.14,
-            width=0.6,
-            height=0.6),
-          Icon(coordinateSystem(
-              preserveAspectRatio=false,
-              extent={{-100,-100},{100,100}},
-              grid={2,2}), graphics={
-              Text(extent={{-134,104},{142,44}}, textString=
-                                                     "%name"),
-              Ellipse(
-                extent={{-100,40},{100,-100}},
-                lineColor={255,127,0},
-                fillColor={255,255,255},
-                fillPattern=FillPattern.Solid),
-              Text(
-                extent={{-84,-4},{84,-52}},
-                lineColor={255,127,0},
-                textString=
-                     "fonction"),
-              Ellipse(
-                extent={{-100,100},{-60,-100}},
-                lineColor={255,0,0},
-                fillColor={255,0,0},
-                fillPattern=FillPattern.Solid)}),
-          Documentation(info="<html>
+        "));
+    end SpecificEnthalpy_PT_der;
+
+    package Unused "unused functions for which no analytic derivative can be provided"
+      function Water_rhoT
+        input Modelica.Units.SI.Density rho "Masse volumique";
+        input Modelica.Units.SI.Temperature T "Température";
+        input Integer phase "2: diphasique, 1 sinon";
+        input Integer mode = 0 "Région IF97 - 0:calcul automatique";
+        output ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_dT pro;
+      protected
+        Integer region;
+        Integer error;
+        Boolean supercritical;
+        Modelica.Units.SI.AbsolutePressure p;
+      protected
+        ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs g annotation(
+          Placement(transformation(extent = {{-90, -85}, {-43.3333, -38.3333}}, rotation = 0)));
+        ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs f annotation(
+          Placement(transformation(extent = {{-23.3333, -85}, {23.3333, -38.3333}}, rotation = 0)));
+      algorithm
+        region := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_dT(rho, T, phase, mode);
+        if region == 1 then
+          (p, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.pofdt125(d = rho, T = T, reldd = ThermoSysPro.Properties.WaterSteam.BaseIF97.IterationData.DELD, region = 1);
+          g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1(p, T);
+          supercritical := p > ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT;
+          pro := ThermoSysPro.Properties.WaterSteam.Common.gibbsToProps_dT(g);
+          pro.x := if supercritical then -1 else 0;
+        elseif region == 2 then
+          (p, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.pofdt125(d = rho, T = T, reldd = ThermoSysPro.Properties.WaterSteam.BaseIF97.IterationData.DELD, region = 2);
+          g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2(p, T);
+          supercritical := p > ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT;
+          pro := ThermoSysPro.Properties.WaterSteam.Common.gibbsToProps_dT(g);
+          pro.x := if supercritical then -1 else 1;
+        elseif region == 3 then
+          f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3(rho, T);
+          pro := ThermoSysPro.Properties.WaterSteam.Common.helmholtzToProps_dT(f);
+          pro.x := if supercritical then -1 else 0;
+          supercritical := p > ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT;
+        elseif region == 4 then
+          pro := ThermoSysPro.Properties.WaterSteam.BaseIF97.TwoPhase.waterR4_dT(d = rho, T = T);
+        elseif region == 5 then
+          (p, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.pofdt125(d = rho, T = T, reldd = ThermoSysPro.Properties.WaterSteam.BaseIF97.IterationData.DELD, region = 5);
+          g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g5(p, T);
+          supercritical := p > ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT;
+          pro := ThermoSysPro.Properties.WaterSteam.Common.gibbsToProps_dT(g);
+          pro.x := if supercritical then -1 else 1;
+        else
+          assert(false, "Eau_rhoT: Numéro de région incorrect");
+        end if;
+        annotation(
+          Window(x = 0.3, y = 0.14, width = 0.6, height = 0.6),
+          Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}, grid = {2, 2}), graphics = {Text(extent = {{-134, 104}, {142, 44}}, textString = "%name"), Ellipse(extent = {{-100, 40}, {100, -100}}, lineColor = {255, 127, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-84, -4}, {84, -52}}, lineColor = {255, 127, 0}, textString = "fonction"), Ellipse(extent = {{-100, 100}, {-60, -100}}, lineColor = {255, 0, 0}, fillColor = {255, 0, 0}, fillPattern = FillPattern.Solid)}),
+          Documentation(info = "<html>
 <p><b>Version 1.0</b></p>
 </HTML>
-"));
-      end Water_rhoT;
-
-      function Water_h_is
-        input Modelica.SIunits.AbsolutePressure p;
-        input Modelica.SIunits.SpecificEntropy s;
-        input Integer phase;
-        input Integer mode = 0;
-        output Modelica.SIunits.SpecificEnthalpy h;
-
-      protected
-        Integer region;
-        Integer error;
-        Modelica.SIunits.Temperature T;
-        Modelica.SIunits.Density d;
-      protected
-        ThermoSysPro.Properties.WaterSteam.Common.HelmholtzData
-                             dTR(R=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O)
-          annotation (Placement(transformation(extent={{-85,15},{-15,85}},
-                rotation=0)));
-        ThermoSysPro.Properties.WaterSteam.Common.GibbsData
-                         pTR(R=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O)
-          annotation (Placement(transformation(extent={{15,15},{85,85}},
-                rotation=0)));
-        ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs
-                           g annotation (Placement(transformation(extent={{-85,
-                  -85},{-15,-15}}, rotation=0)));
-        ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs
-                               f annotation (Placement(transformation(extent={{
-                  15,-85},{85,-15}}, rotation=0)));
-      algorithm
-
-        region := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_ps(p, s, phase, mode);
-        if (region == 1) then
-          h := ThermoSysPro.Properties.WaterSteam.BaseIF97.Isentropic.hofps1(p, s);
-        elseif (region == 2) then
-          h := ThermoSysPro.Properties.WaterSteam.BaseIF97.Isentropic.hofps2(p, s);
-        elseif (region == 3) then
-          (d,T,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.dtofps3(p=p, s=s, delp=1.0e-7, dels=1.0e-6);
-          h := ThermoSysPro.Properties.WaterSteam.BaseIF97.Isentropic.hofdT3(d, T);
-        elseif (region == 4) then
-          h := ThermoSysPro.Properties.WaterSteam.BaseIF97.Isentropic.hofps4(p, s);
-        elseif (region == 5) then
-          (T,error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.tofps5(p=p, s=s, relds=1.0e-7);
-          h := ThermoSysPro.Properties.WaterSteam.BaseIF97.Isentropic.hofpT5(p, T);
-        else
-          assert(false, "Eau_H_is: Numéro de région incorrect");
-        end if;
-        annotation (
-          Window(
-            x=0.27,
-            y=0.15,
-            width=0.6,
-            height=0.6),
-          Icon(coordinateSystem(
-              preserveAspectRatio=false,
-              extent={{-100,-100},{100,100}},
-              grid={2,2}), graphics={
-              Text(extent={{-134,104},{142,44}}, textString=
-                                                     "%name"),
-              Ellipse(
-                extent={{-100,40},{100,-100}},
-                lineColor={255,127,0},
-                fillColor={255,255,255},
-                fillPattern=FillPattern.Solid),
-              Text(
-                extent={{-84,-4},{84,-52}},
-                lineColor={255,127,0},
-                textString=
-                     "fonction"),
-              Ellipse(
-                extent={{-100,100},{-60,-100}},
-                lineColor={255,0,0},
-                fillColor={255,0,0},
-                fillPattern=FillPattern.Solid)}),
-          Documentation(info="<html>
+          "));
+      end Water_rhoT;
+
+      function Water_h_is
+        input Modelica.Units.SI.AbsolutePressure p;
+        input Modelica.Units.SI.SpecificEntropy s;
+        input Integer phase;
+        input Integer mode = 0;
+        output Modelica.Units.SI.SpecificEnthalpy h;
+      protected
+        Integer region;
+        Integer error;
+        Modelica.Units.SI.Temperature T;
+        Modelica.Units.SI.Density d;
+      protected
+        ThermoSysPro.Properties.WaterSteam.Common.HelmholtzData dTR(R = ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O) annotation(
+          Placement(transformation(extent = {{-85, 15}, {-15, 85}}, rotation = 0)));
+        ThermoSysPro.Properties.WaterSteam.Common.GibbsData pTR(R = ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O) annotation(
+          Placement(transformation(extent = {{15, 15}, {85, 85}}, rotation = 0)));
+        ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs g annotation(
+          Placement(transformation(extent = {{-85, -85}, {-15, -15}}, rotation = 0)));
+        ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs f annotation(
+          Placement(transformation(extent = {{15, -85}, {85, -15}}, rotation = 0)));
+      algorithm
+        region := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.region_ps(p, s, phase, mode);
+        if region == 1 then
+          h := ThermoSysPro.Properties.WaterSteam.BaseIF97.Isentropic.hofps1(p, s);
+        elseif region == 2 then
+          h := ThermoSysPro.Properties.WaterSteam.BaseIF97.Isentropic.hofps2(p, s);
+        elseif region == 3 then
+          (d, T, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.dtofps3(p = p, s = s, delp = 1.0e-7, dels = 1.0e-6);
+          h := ThermoSysPro.Properties.WaterSteam.BaseIF97.Isentropic.hofdT3(d, T);
+        elseif region == 4 then
+          h := ThermoSysPro.Properties.WaterSteam.BaseIF97.Isentropic.hofps4(p, s);
+        elseif region == 5 then
+          (T, error) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Inverses.tofps5(p = p, s = s, relds = 1.0e-7);
+          h := ThermoSysPro.Properties.WaterSteam.BaseIF97.Isentropic.hofpT5(p, T);
+        else
+          assert(false, "Eau_H_is: Numéro de région incorrect");
+        end if;
+        annotation(
+          Window(x = 0.27, y = 0.15, width = 0.6, height = 0.6),
+          Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}, grid = {2, 2}), graphics = {Text(extent = {{-134, 104}, {142, 44}}, textString = "%name"), Ellipse(extent = {{-100, 40}, {100, -100}}, lineColor = {255, 127, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-84, -4}, {84, -52}}, lineColor = {255, 127, 0}, textString = "fonction"), Ellipse(extent = {{-100, 100}, {-60, -100}}, lineColor = {255, 0, 0}, fillColor = {255, 0, 0}, fillPattern = FillPattern.Solid)}),
+          Documentation(info = "<html>
 <p><b>Version 1.4</b></p>
 </HTML>
-"));
-      end Water_h_is;
-      annotation (Icon(graphics={
-            Text(
-              extent={{-102,0},{24,-26}},
-              lineColor={242,148,0},
-              textString=
-                   "Thermo"),
-            Text(
-              extent={{-4,8},{68,-34}},
-              lineColor={46,170,220},
-              textString=
-                   "SysPro"),
-            Polygon(
-              points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},
-                  {42,8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},
-                  {-50,6},{-62,2}},
-              lineColor={46,170,220},
-              fillColor={46,170,220},
-              fillPattern=FillPattern.Solid),
-            Polygon(
-              points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{
-                  -46,8},{-42,22},{-42,30},{-44,38}},
-              lineColor={46,170,220},
-              fillColor={46,170,220},
-              fillPattern=FillPattern.Solid),
-            Polygon(
-              points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{
-                  -12,12},{-26,12},{-28,12},{-26,20}},
-              lineColor={46,170,220},
-              fillColor={46,170,220},
-              fillPattern=FillPattern.Solid),
-            Polygon(
-              points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}},
-              lineColor={46,170,220},
-              fillColor={46,170,220},
-              fillPattern=FillPattern.Solid),
-            Rectangle(
-              extent={{-8,30},{-6,26}},
-              lineColor={242,148,0},
-              fillColor={242,148,0},
-              fillPattern=FillPattern.Solid),
-            Rectangle(
-              extent={{-8,36},{-6,32}},
-              lineColor={242,148,0},
-              fillColor={242,148,0},
-              fillPattern=FillPattern.Solid),
-            Rectangle(
-              extent={{-8,42},{-6,38}},
-              lineColor={242,148,0},
-              fillColor={242,148,0},
-              fillPattern=FillPattern.Solid),
-            Rectangle(
-              extent={{-8,48},{-6,44}},
-              lineColor={242,148,0},
-              fillColor={242,148,0},
-              fillPattern=FillPattern.Solid),
-            Polygon(
-              points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}},
-              lineColor={46,170,220},
-              fillColor={46,170,220},
-              fillPattern=FillPattern.Solid),
-            Rectangle(
-              extent={{-4,32},{-2,28}},
-              lineColor={242,148,0},
-              fillColor={242,148,0},
-              fillPattern=FillPattern.Solid),
-            Rectangle(
-              extent={{-4,38},{-2,34}},
-              lineColor={242,148,0},
-              fillColor={242,148,0},
-              fillPattern=FillPattern.Solid),
-            Rectangle(
-              extent={{-4,44},{-2,40}},
-              lineColor={242,148,0},
-              fillColor={242,148,0},
-              fillPattern=FillPattern.Solid),
-            Rectangle(
-              extent={{-4,50},{-2,46}},
-              lineColor={242,148,0},
-              fillColor={242,148,0},
-              fillPattern=FillPattern.Solid),
-            Polygon(
-              points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{-2,
-                  20}},
-              lineColor={46,170,220},
-              fillColor={46,170,220},
-              fillPattern=FillPattern.Solid),
-            Polygon(
-              points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},
-                  {42,6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},
-                  {-50,6},{-62,2}},
-              lineColor={242,148,0},
-              fillColor={242,148,0},
-              fillPattern=FillPattern.Solid),
-            Line(
-              points={{22,12},{22,14},{22,16},{24,14},{20,18}},
-              color={46,170,220},
-              thickness=0.5),
-            Line(
-              points={{26,12},{26,14},{26,16},{28,14},{24,18}},
-              color={46,170,220},
-              thickness=0.5),
-            Line(
-              points={{30,10},{30,12},{30,14},{32,12},{28,16}},
-              color={46,170,220},
-              thickness=0.5),
-            Polygon(
-              points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}},
-              lineColor={46,170,220},
-              fillColor={46,170,220},
-              fillPattern=FillPattern.Solid),
-            Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}),
-            Line(
-              points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}},
-              color={0,0,255},
-              smooth=Smooth.None),
-            Line(
-              points={{80,80},{100,100}},
-              color={0,0,255},
-              smooth=Smooth.None)}));
-    end Unused;
-
-    package Spline_Utilities
-      constant Spline_Utilities.Modelica_Interpolation.Bspline1D.Data IF97_spline(
-          ndim = 1,
-          ncontrol = 100,
-          degree = 3,
-          knots = {
-          2.93063160225403e-007, 2.93063160225403e-007, 2.93063160225403e-007, 2.93063160225403e-007,
-          0.0150553301018805, 0.0225746360796844, 0.0300841766610507, 0.0375864719559614,
-          0.0450833779282367, 0.0525763026035424, 0.0600663541987385, 0.0675544420190098,
-          0.0750413446792581, 0.0825277558142009, 0.0900143143696351, 0.0975016244159301,
-          0.104990267916964, 0.11248081283071, 0.119973818177067, 0.127469837190213,
-          0.134969419310924, 0.14247311152242, 0.149981459358957, 0.157495007796453,
-          0.165014302152702, 0.172539889069826, 0.180072317615317, 0.187612140514708,
-          0.195159915514515, 0.202716206865773, 0.21028158691427, 0.217856637782066,
-          0.225441953125109, 0.233038139953034, 0.240645820499176, 0.248265634131007,
-          0.255898239293619, 0.26354431548115, 0.271204565233372, 0.278879716156774,
-          0.286570522971491, 0.294277769587339, 0.302002271213962, 0.309744876511783,
-          0.317506469792076, 0.325287973276035, 0.333090349424309, 0.340914603350119,
-          0.348761785330786, 0.356632993434437, 0.364529376280738, 0.372452135957019,
-          0.380402531113975, 0.388381880268579, 0.39639156534589, 0.404433035496425,
-          0.412507811231662, 0.420617488927502, 0.42876374575417, 0.436948345101518,
-          0.445173142581185, 0.453440092702033, 0.461751256332929, 0.470108809087968,
-          0.478515050793845, 0.486972416228223, 0.495483487352128, 0.50405100729972,
-          0.512677896436249, 0.521367270850924, 0.53012246371707, 0.538947050028345,
-          0.547844875307676, 0.556820088984304, 0.565877183242573, 0.575021038260507,
-          0.584256974874285, 0.593590815826759, 0.603028956896544, 0.612578449397273,
-          0.622247095874125, 0.632043561486359, 0.641977504873387, 0.652059734791795,
-          0.662302403295546, 0.672719253852374, 0.6833259549907, 0.694140568427125,
-          0.705184226398132, 0.716482126202646, 0.728064988229839, 0.739971159691273,
-          0.752249564928059, 0.764963678571606, 0.77819659006882, 0.79205900502822,
-          0.806726369054731, 0.822437269975835, 0.839573763094594, 0.858852425095749,
-          1, 1, 1, 1},
-          controlPoints = [
-          6.41617166788097; 6.59657375859249; 6.85956502478188; 7.19550228677957;
-          7.44003141655459; 7.67746343199683; 7.90809030002524; 8.1321863948823;
-          8.35001072138466; 8.56180824123764; 8.76781112389037; 8.96823977601129;
-          9.16330374171574; 9.35320248746118; 9.53812609634101; 9.71825588651749;
-          9.89376496619584; 10.064818734583; 10.2315753364618; 10.394186076569;
-          10.552795798896; 10.7075432351955; 10.8585613263155; 11.0059775194514;
-          11.1499140439677; 11.2904881680785; 11.427812438369; 11.561994903882;
-          11.6931393262684; 11.8213453773153; 11.9467088249962; 12.0693217090492;
-          12.1892725069664; 12.3066462911727; 12.421524878079; 12.5339869696189;
-          12.644108287808; 12.7519617028068; 12.8576173549182; 12.9611427709053;
-          13.06260297498; 13.1620605947781; 13.25957596261; 13.355207212251;
-          13.4490103715159; 13.5410394508422; 13.6313465280923; 13.7199818297721;
-          13.8069938088494; 13.892429219348; 13.9763331878828; 14.0587492822951;
-          14.1397195775398; 14.2192847189711; 14.297483983169; 14.3743553364442;
-          14.4499354911556; 14.524259959973; 14.5973631082143; 14.6692782043857;
-          14.740037469051; 14.8096721221595; 14.8782124289575; 14.9456877446163;
-          15.0121265577065; 15.0775565326579; 15.1420045513451; 15.2054967539465;
-          15.2680585792283; 15.3297148044048; 15.3904895847271; 15.4504064929423;
-          15.5094885587568; 15.5677583084284; 15.6252378046292; 15.6819486867911;
-          15.7379122123276; 15.7931492995096; 15.8476805734722; 15.9015264179811;
-          15.9547070373259; 16.0072425350593; 16.0591530191528; 16.11045874587;
-          16.1611803164475; 16.211338938197; 16.2609567565343; 16.3100572327281;
-          16.3586655540358; 16.4068088127073; 16.4545163733577; 16.501817689937;
-          16.5487496364798; 16.5953631575021; 16.6418467771832; 16.6879750106034;
-          16.7343150270632; 16.8752144692458; 16.9266730020941; 16.9094578790152]);
-
-      record Data "Datastructure of a Bspline"
-        parameter Integer ndim(min=1)
-          "Number of dimensions of one control point";
-        parameter Integer ncontrol(min=1) "Number of control points";
-        parameter Integer degree(min=1) "Polynomial degree of the Bspline";
-        Real knots[ncontrol+degree+1] "Knot vector of the Bspline";
-        Real controlPoints[ncontrol,ndim] "[i,:] is data of control point i";
-      end Data;
-
-      function safeEvaluate
-        "Evaluate Bspline at one parameter safely, i.e. points outside the domain of the spline are moved inside the domain."
-        extends Modelica.Icons.Function;
-        input Data spline "Bspline to be evaluated";
-        input Real u "Parameter value at which Bspline shall be evaluated";
-        output Real x[spline.ndim] "Value of Bspline at u";
-      protected
-        Real eps = 1e-10 "accurate enough?";
-        Real umin =  spline.knots[1] + eps*abs(spline.knots[1]);
-        Real umax =  spline.knots[end] - eps*abs(spline.knots[end]);
-        Real ulim;
-      algorithm
-        ulim := min(max(u,umin),umax);
-        x := ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.evaluate(spline, ulim);
-      end safeEvaluate;
-
-        function safeEvaluateDer
-        "Evaluate Bspline at one parameter safely, i.e. points outside the domain of the spline are moved inside the domain."
-          extends Modelica.Icons.Function;
-          input Data spline "Bspline to be evaluated";
-          input Real u "Parameter value at which Bspline shall be evaluated";
-          output Real x[spline.ndim] "Value of Bspline at u";
-          output Real xd[spline.ndim] "First derivative of Bspline at u";
-      protected
-          Real eps = 1e-10 "accurate enough?";
-          Real umin =  spline.knots[1] + eps*abs(spline.knots[1]);
-          Real umax =  spline.knots[end] - eps*abs(spline.knots[end]);
-          Real ulim;
-        algorithm
-          ulim := min(max(u,umin),umax);
-          (x,xd) := evaluateDer(spline, ulim);
-        end safeEvaluateDer;
-
-      function evaluate "Evaluate Bspline at one parameter"
-        extends Modelica.Icons.Function;
-        input Data spline "Bspline to be evaluated";
-        input Real u "Parameter value at which Bspline shall be evaluated";
-        output Real x[spline.ndim] "Value of Bspline at u";
-
-      protected
-        Integer span;
-        Real N[spline.degree+1];
-      algorithm
-        x := zeros(spline.ndim);
-        span := Utilities.n_findSpan(spline.degree, u, spline.knots);
-        N := Utilities.n_BasisFuns(span, u, spline.degree, spline.knots);
-
-        for i in 1:spline.ndim loop
-          x[i] := N*spline.controlPoints[span-spline.degree:span,i];
-        end for;
-      end evaluate;
-
-      function evaluateDer
-        "Evaluate Bspline and its first derivative at one parameter"
-        extends Modelica.Icons.Function;
-        input Data spline "Bspline to be evaluated";
-        input Real u "Parameter value at which Bspline shall be evaluated";
-        output Real x[spline.ndim] "Value of Bspline at u";
-        output Real xd[spline.ndim] "First derivative of Bspline at u";
-      protected
-        Integer span;
-        Real N[2,spline.degree+1];
-      algorithm
-        //Grenzwert von rechts lim (h->0) (f(x+h)-f(x))/h
-        x := zeros(spline.ndim);
-        xd := zeros(spline.ndim);
-
-        span := Utilities.n_findSpan(spline.degree, u, spline.knots);
-        N := Utilities.n_DersBasisFuns(span, u, spline.degree, 1, spline.knots);
-
-        for i in 1:spline.ndim loop
-          x[i] := N[1,:]*spline.controlPoints[span-spline.degree:span,i];
-          xd[i] := N[2,:]*spline.controlPoints[span-spline.degree:span,i];
-        end for;
-
-      end evaluateDer;
-
-      package Utilities "spline utility functions"
-        function n_BasisFuns "Compute the nonvanishing basis functions"
-          extends Modelica.Icons.Function;
-          input Integer i "index";
-          input Real u "parameter";
-          input Integer p "degree";
-          input Real knots[:] "knot vector";
-          output Real N[p+1] "Basis functions";
-        protected
-          Integer j;
-          Integer r;
-          Real left[p+1];
-          Real right[p+1];
-          Real temp;
-          Real saved;
-        algorithm
-          /*
+          "));
+      end Water_h_is;
+      annotation(
+        Icon(graphics = {Text(extent = {{-102, 0}, {24, -26}}, lineColor = {242, 148, 0}, textString = "Thermo"), Text(extent = {{-4, 8}, {68, -34}}, lineColor = {46, 170, 220}, textString = "SysPro"), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-32, 12}, {-16, 14}, {6, 14}, {26, 12}, {42, 8}, {52, 2}, {42, 6}, {28, 10}, {6, 12}, {-12, 12}, {-16, 12}, {-34, 10}, {-50, 6}, {-62, 2}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-44, 38}, {-24, 38}, {-26, 30}, {-26, 22}, {-24, 14}, {-24, 12}, {-46, 8}, {-42, 22}, {-42, 30}, {-44, 38}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-26, 20}, {-20, 20}, {-20, 22}, {-14, 22}, {-14, 20}, {-12, 20}, {-12, 12}, {-26, 12}, {-28, 12}, {-26, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-8, 14}, {-8, 24}, {-6, 24}, {-6, 14}, {-8, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 30}, {-6, 26}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 36}, {-6, 32}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 42}, {-6, 38}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 48}, {-6, 44}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-4, 14}, {-4, 26}, {-2, 26}, {-2, 14}, {-4, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 32}, {-2, 28}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 38}, {-2, 34}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 44}, {-2, 40}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 50}, {-2, 46}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-2, 20}, {8, 20}, {8, 22}, {10, 22}, {18, 22}, {18, 12}, {-4, 14}, {-2, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-36, 10}, {-18, 12}, {6, 12}, {26, 10}, {42, 6}, {52, 0}, {42, 4}, {28, 8}, {6, 10}, {-12, 10}, {-18, 10}, {-38, 8}, {-50, 6}, {-62, 2}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Line(points = {{22, 12}, {22, 14}, {22, 16}, {24, 14}, {20, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{26, 12}, {26, 14}, {26, 16}, {28, 14}, {24, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{30, 10}, {30, 12}, {30, 14}, {32, 12}, {28, 16}}, color = {46, 170, 220}, thickness = 0.5), Polygon(points = {{36, 8}, {36, 30}, {34, 34}, {36, 38}, {40, 38}, {40, 8}, {36, 8}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 80}, {80, -100}}, lineColor = {0, 0, 255}), Line(points = {{-100, 80}, {-80, 100}, {100, 100}, {100, -80}, {80, -100}}, color = {0, 0, 255}, smooth = Smooth.None), Line(points = {{80, 80}, {100, 100}}, color = {0, 0, 255}, smooth = Smooth.None)}));
+    end Unused;
+
+    package Spline_Utilities
+      constant Spline_Utilities.Modelica_Interpolation.Bspline1D.Data IF97_spline(ndim = 1, ncontrol = 100, degree = 3, knots = {2.93063160225403e-007, 2.93063160225403e-007, 2.93063160225403e-007, 2.93063160225403e-007, 0.0150553301018805, 0.0225746360796844, 0.0300841766610507, 0.0375864719559614, 0.0450833779282367, 0.0525763026035424, 0.0600663541987385, 0.0675544420190098, 0.0750413446792581, 0.0825277558142009, 0.0900143143696351, 0.0975016244159301, 0.104990267916964, 0.11248081283071, 0.119973818177067, 0.127469837190213, 0.134969419310924, 0.14247311152242, 0.149981459358957, 0.157495007796453, 0.165014302152702, 0.172539889069826, 0.180072317615317, 0.187612140514708, 0.195159915514515, 0.202716206865773, 0.21028158691427, 0.217856637782066, 0.225441953125109, 0.233038139953034, 0.240645820499176, 0.248265634131007, 0.255898239293619, 0.26354431548115, 0.271204565233372, 0.278879716156774, 0.286570522971491, 0.294277769587339, 0.302002271213962, 0.309744876511783, 0.317506469792076, 0.325287973276035, 0.333090349424309, 0.340914603350119, 0.348761785330786, 0.356632993434437, 0.364529376280738, 0.372452135957019, 0.380402531113975, 0.388381880268579, 0.39639156534589, 0.404433035496425, 0.412507811231662, 0.420617488927502, 0.42876374575417, 0.436948345101518, 0.445173142581185, 0.453440092702033, 0.461751256332929, 0.470108809087968, 0.478515050793845, 0.486972416228223, 0.495483487352128, 0.50405100729972, 0.512677896436249, 0.521367270850924, 0.53012246371707, 0.538947050028345, 0.547844875307676, 0.556820088984304, 0.565877183242573, 0.575021038260507, 0.584256974874285, 0.593590815826759, 0.603028956896544, 0.612578449397273, 0.622247095874125, 0.632043561486359, 0.641977504873387, 0.652059734791795, 0.662302403295546, 0.672719253852374, 0.6833259549907, 0.694140568427125, 0.705184226398132, 0.716482126202646, 0.728064988229839, 0.739971159691273, 0.752249564928059, 0.764963678571606, 0.77819659006882, 0.79205900502822, 0.806726369054731, 0.822437269975835, 0.839573763094594, 0.858852425095749, 1, 1, 1, 1}, controlPoints = [6.41617166788097; 6.59657375859249; 6.85956502478188; 7.19550228677957; 7.44003141655459; 7.67746343199683; 7.90809030002524; 8.1321863948823; 8.35001072138466; 8.56180824123764; 8.76781112389037; 8.96823977601129; 9.16330374171574; 9.35320248746118; 9.53812609634101; 9.71825588651749; 9.89376496619584; 10.064818734583; 10.2315753364618; 10.394186076569; 10.552795798896; 10.7075432351955; 10.8585613263155; 11.0059775194514; 11.1499140439677; 11.2904881680785; 11.427812438369; 11.561994903882; 11.6931393262684; 11.8213453773153; 11.9467088249962; 12.0693217090492; 12.1892725069664; 12.3066462911727; 12.421524878079; 12.5339869696189; 12.644108287808; 12.7519617028068; 12.8576173549182; 12.9611427709053; 13.06260297498; 13.1620605947781; 13.25957596261; 13.355207212251; 13.4490103715159; 13.5410394508422; 13.6313465280923; 13.7199818297721; 13.8069938088494; 13.892429219348; 13.9763331878828; 14.0587492822951; 14.1397195775398; 14.2192847189711; 14.297483983169; 14.3743553364442; 14.4499354911556; 14.524259959973; 14.5973631082143; 14.6692782043857; 14.740037469051; 14.8096721221595; 14.8782124289575; 14.9456877446163; 15.0121265577065; 15.0775565326579; 15.1420045513451; 15.2054967539465; 15.2680585792283; 15.3297148044048; 15.3904895847271; 15.4504064929423; 15.5094885587568; 15.5677583084284; 15.6252378046292; 15.6819486867911; 15.7379122123276; 15.7931492995096; 15.8476805734722; 15.9015264179811; 15.9547070373259; 16.0072425350593; 16.0591530191528; 16.11045874587; 16.1611803164475; 16.211338938197; 16.2609567565343; 16.3100572327281; 16.3586655540358; 16.4068088127073; 16.4545163733577; 16.501817689937; 16.5487496364798; 16.5953631575021; 16.6418467771832; 16.6879750106034; 16.7343150270632; 16.8752144692458; 16.9266730020941; 16.9094578790152]);
+
+      record Data "Datastructure of a Bspline"
+        parameter Integer ndim(min = 1) "Number of dimensions of one control point";
+        parameter Integer ncontrol(min = 1) "Number of control points";
+        parameter Integer degree(min = 1) "Polynomial degree of the Bspline";
+        Real knots[ncontrol + degree + 1] "Knot vector of the Bspline";
+        Real controlPoints[ncontrol, ndim] "[i,:] is data of control point i";
+      end Data;
+
+      function safeEvaluate "Evaluate Bspline at one parameter safely, i.e. points outside the domain of the spline are moved inside the domain."
+        extends Modelica.Icons.Function;
+        input Data spline "Bspline to be evaluated";
+        input Real u "Parameter value at which Bspline shall be evaluated";
+        output Real x[spline.ndim] "Value of Bspline at u";
+      protected
+        Real eps = 1e-10 "accurate enough?";
+        Real umin = spline.knots[1] + eps * abs(spline.knots[1]);
+        Real umax = spline.knots[end] - eps * abs(spline.knots[end]);
+        Real ulim;
+      algorithm
+        ulim := min(max(u, umin), umax);
+        x := ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.evaluate(spline, ulim);
+      end safeEvaluate;
+
+      function safeEvaluateDer "Evaluate Bspline at one parameter safely, i.e. points outside the domain of the spline are moved inside the domain."
+        extends Modelica.Icons.Function;
+        input Data spline "Bspline to be evaluated";
+        input Real u "Parameter value at which Bspline shall be evaluated";
+        output Real x[spline.ndim] "Value of Bspline at u";
+        output Real xd[spline.ndim] "First derivative of Bspline at u";
+      protected
+        Real eps = 1e-10 "accurate enough?";
+        Real umin = spline.knots[1] + eps * abs(spline.knots[1]);
+        Real umax = spline.knots[end] - eps * abs(spline.knots[end]);
+        Real ulim;
+      algorithm
+        ulim := min(max(u, umin), umax);
+        (x, xd) := evaluateDer(spline, ulim);
+      end safeEvaluateDer;
+
+      function evaluate "Evaluate Bspline at one parameter"
+        extends Modelica.Icons.Function;
+        input Data spline "Bspline to be evaluated";
+        input Real u "Parameter value at which Bspline shall be evaluated";
+        output Real x[spline.ndim] "Value of Bspline at u";
+      protected
+        Integer span;
+        Real N[spline.degree + 1];
+      algorithm
+        x := zeros(spline.ndim);
+        span := Utilities.n_findSpan(spline.degree, u, spline.knots);
+        N := Utilities.n_BasisFuns(span, u, spline.degree, spline.knots);
+        for i in 1:spline.ndim loop
+          x[i] := N * spline.controlPoints[span - spline.degree:span, i];
+        end for;
+      end evaluate;
+
+      function evaluateDer "Evaluate Bspline and its first derivative at one parameter"
+        extends Modelica.Icons.Function;
+        input Data spline "Bspline to be evaluated";
+        input Real u "Parameter value at which Bspline shall be evaluated";
+        output Real x[spline.ndim] "Value of Bspline at u";
+        output Real xd[spline.ndim] "First derivative of Bspline at u";
+      protected
+        Integer span;
+        Real N[2, spline.degree + 1];
+      algorithm
+//Grenzwert von rechts lim (h->0) (f(x+h)-f(x))/h
+        x := zeros(spline.ndim);
+        xd := zeros(spline.ndim);
+        span := Utilities.n_findSpan(spline.degree, u, spline.knots);
+        N := Utilities.n_DersBasisFuns(span, u, spline.degree, 1, spline.knots);
+        for i in 1:spline.ndim loop
+          x[i] := N[1, :] * spline.controlPoints[span - spline.degree:span, i];
+          xd[i] := N[2, :] * spline.controlPoints[span - spline.degree:span, i];
+        end for;
+      end evaluateDer;
+
+      package Utilities "spline utility functions"
+        function n_BasisFuns "Compute the nonvanishing basis functions"
+          extends Modelica.Icons.Function;
+          input Integer i "index";
+          input Real u "parameter";
+          input Integer p "degree";
+          input Real knots[:] "knot vector";
+          output Real N[p + 1] "Basis functions";
+        protected
+          Integer j;
+          Integer r;
+          Real left[p + 1];
+          Real right[p + 1];
+          Real temp;
+          Real saved;
+        algorithm
+/*
            The NURBS Book: Algorithm A2.2 (page 70)
-        */
-          N[1] := 1;
-          for j in 1:p loop
-            left[j] := u - knots[i+1-j];
-            right[j] := knots[i+j] - u;
-            saved := 0.0;
-
-            for r in 1:j loop
-              temp := N[r]/(right[r]+left[j-r+1]);
-              N[r] := saved + right[r]*temp;
-              saved := left[j-r+1]*temp;
-
-            end for;
-            N[j+1] := saved;
-          end for;
-        end n_BasisFuns;
-
-        function n_DersBasisFuns
-          "Compute nonzero basis functions and their derivatives"
-          extends Modelica.Icons.Function;
-          input Integer i "index";
-          input Real u "parameter";
-          input Integer p "degree";
-          input Integer n "n-th derivative";
-          input Real knots[:] "knot vector";
-          output Real ders[n+1,p+1] "ders[k,:] is (k-1)-th derivative";
-        protected
-          Integer j;
-          Integer r;
-          Real left[p+1];
-          Real right[p+1];
-          Real temp;
-          Real saved;
-          Real ndu[p+1,p+1];
-          Integer s1;
-          Integer s2;
-          Integer j1;
-          Integer j2;
-          Real a[2,p+1];
-          Real d;
-          Integer rk;
-          Integer pk;
-          Integer prod;
-          Integer tt;
-        algorithm
-          /*
+        */
+          N[1] := 1;
+          for j in 1:p loop
+            left[j] := u - knots[i + 1 - j];
+            right[j] := knots[i + j] - u;
+            saved := 0.0;
+            for r in 1:j loop
+              temp := N[r] / (right[r] + left[j - r + 1]);
+              N[r] := saved + right[r] * temp;
+              saved := left[j - r + 1] * temp;
+            end for;
+            N[j + 1] := saved;
+          end for;
+        end n_BasisFuns;
+
+        function n_DersBasisFuns "Compute nonzero basis functions and their derivatives"
+          extends Modelica.Icons.Function;
+          input Integer i "index";
+          input Real u "parameter";
+          input Integer p "degree";
+          input Integer n "n-th derivative";
+          input Real knots[:] "knot vector";
+          output Real ders[n + 1, p + 1] "ders[k,:] is (k-1)-th derivative";
+        protected
+          Integer j;
+          Integer r;
+          Real left[p + 1];
+          Real right[p + 1];
+          Real temp;
+          Real saved;
+          Real ndu[p + 1, p + 1];
+          Integer s1;
+          Integer s2;
+          Integer j1;
+          Integer j2;
+          Real a[2, p + 1];
+          Real d;
+          Integer rk;
+          Integer pk;
+          Integer prod;
+          Integer tt;
+        algorithm
+/*
            The NURBS Book: Algorithm A2.3 (page 72)
-        */
-          ndu[1,1] := 1;
-          for j in 1:p loop
-            left[j] := u - knots[i+1-j];
-            right[j] := knots[i+j] - u;
-            saved := 0.0;
-
-            for r in 1:j loop
-              ndu[j+1,r] := right[r]+left[j-r+1];
-              temp := ndu[r,j]/ndu[j+1,r];
-              ndu[r,j+1] := saved + right[r]*temp;
-              saved := left[j-r+1]*temp;
-
-            end for;
-            ndu[j+1,j+1] := saved;
-          end for;
-
-          for j in 1:p+1 loop
-            ders[1,j] := ndu[j,p+1];
-          end for;
-
-          for r in 1:p+1 loop
-            s1 := 1;
-            s2 := 2;
-            a[1,1] := 1.0;
-
-            for k in 1:n loop
-              d := 0.0;
-              rk := r-k-1;
-              pk := p-k;
-
-              if r-1>=k then
-                a[s2,1] := a[s1,1]/ndu[pk+2,rk+1];
-                d := a[s2,1]*ndu[rk+1,pk+1];
-
-              end if;
-
-              if rk >= -1 then
-                j1 :=1;
-
-              else
-                j1 :=-rk;
-
-              end if;
-
-              if r-1 <= pk+1 then
-                j2 := k-1;
-
-              else
-                j2 := p-r+1;
-
-              end if;
-
-              for j in j1:j2 loop
-                a[s2,j+1] :=(a[s1, j + 1] - a[s1, j])/ndu[pk + 2, rk + j + 1];
-                d :=d + a[s2, j + 1]*ndu[rk + j + 1, pk + 1];
-
-              end for;
-
-              if r-1 <= pk then
-                a[s2,k+1] := -a[s1,k]/ndu[pk+2,r];
-                d := d + a[s2,k+1]*ndu[r,pk+1];
-
-              end if;
-
-              ders[k+1,r] := d;
-              tt := s1;
-              s1 := s2;
-              s2 := tt;
-
-            end for;
-          end for;
-
-          prod := p;
-
-          for k in 1:n loop
-
-            for j in 1:p+1 loop
-              ders[k+1,j] := ders[k+1,j]*prod;
-
-            end for;
-            prod := prod*(p-k);
-
-          end for;
-
-        end n_DersBasisFuns;
-
-        function n_findSpan "Determine the knot span index"
-          extends Modelica.Icons.Function;
-          input Integer p "degree";
-          input Real u "parameter";
-          input Real knots[:] "knot vector";
-          output Integer i "The knot span index";
-        protected
-          Integer n;
-          Integer low;
-          Integer high;
-          Integer mid;
-        algorithm
-          /*
+        */
+          ndu[1, 1] := 1;
+          for j in 1:p loop
+            left[j] := u - knots[i + 1 - j];
+            right[j] := knots[i + j] - u;
+            saved := 0.0;
+            for r in 1:j loop
+              ndu[j + 1, r] := right[r] + left[j - r + 1];
+              temp := ndu[r, j] / ndu[j + 1, r];
+              ndu[r, j + 1] := saved + right[r] * temp;
+              saved := left[j - r + 1] * temp;
+            end for;
+            ndu[j + 1, j + 1] := saved;
+          end for;
+          for j in 1:p + 1 loop
+            ders[1, j] := ndu[j, p + 1];
+          end for;
+          for r in 1:p + 1 loop
+            s1 := 1;
+            s2 := 2;
+            a[1, 1] := 1.0;
+            for k in 1:n loop
+              d := 0.0;
+              rk := r - k - 1;
+              pk := p - k;
+              if r - 1 >= k then
+                a[s2, 1] := a[s1, 1] / ndu[pk + 2, rk + 1];
+                d := a[s2, 1] * ndu[rk + 1, pk + 1];
+              end if;
+              if rk >= (-1) then
+                j1 := 1;
+              else
+                j1 := -rk;
+              end if;
+              if r - 1 <= pk + 1 then
+                j2 := k - 1;
+              else
+                j2 := p - r + 1;
+              end if;
+              for j in j1:j2 loop
+                a[s2, j + 1] := (a[s1, j + 1] - a[s1, j]) / ndu[pk + 2, rk + j + 1];
+                d := d + a[s2, j + 1] * ndu[rk + j + 1, pk + 1];
+              end for;
+              if r - 1 <= pk then
+                a[s2, k + 1] := -a[s1, k] / ndu[pk + 2, r];
+                d := d + a[s2, k + 1] * ndu[r, pk + 1];
+              end if;
+              ders[k + 1, r] := d;
+              tt := s1;
+              s1 := s2;
+              s2 := tt;
+            end for;
+          end for;
+          prod := p;
+          for k in 1:n loop
+            for j in 1:p + 1 loop
+              ders[k + 1, j] := ders[k + 1, j] * prod;
+            end for;
+            prod := prod * (p - k);
+          end for;
+        end n_DersBasisFuns;
+
+        function n_findSpan "Determine the knot span index"
+          extends Modelica.Icons.Function;
+          input Integer p "degree";
+          input Real u "parameter";
+          input Real knots[:] "knot vector";
+          output Integer i "The knot span index";
+        protected
+          Integer n;
+          Integer low;
+          Integer high;
+          Integer mid;
+        algorithm
+/*
            The NURBS Book: Algorithm A2.1 (page 68)
-        */
-          n:=size(knots,1)-p-1;
-
-          if abs(u-knots[n+1])<10e-12 then
-            i := n;
-          elseif abs(u-knots[1])<10e-12 then
-            i := 1;
-          else
-            low := p;
-            high := n+1;
-            mid := integer((low+high)/2);
-
-            while
-              (u<knots[mid] or u>=knots[mid+1]) loop
-              assert(low+1<high,"Value must be within limits for Utilities.n_findSpan");
-
-              if (u<knots[mid]) then
-                high := mid;
-
-              else
-                low := mid;
-
-              end if;
-              mid := integer((low+high)/2);
-
-            end while;
-            i := mid;
-
-          end if;
-        end n_findSpan;
-
-        annotation (Icon(graphics={
-              Text(
-                extent={{-102,0},{24,-26}},
-                lineColor={242,148,0},
-                textString=
-                     "Thermo"),
-              Text(
-                extent={{-4,8},{68,-34}},
-                lineColor={46,170,220},
-                textString=
-                     "SysPro"),
-              Polygon(
-                points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},
-                    {42,8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,
-                    10},{-50,6},{-62,2}},
-                lineColor={46,170,220},
-                fillColor={46,170,220},
-                fillPattern=FillPattern.Solid),
-              Polygon(
-                points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{
-                    -46,8},{-42,22},{-42,30},{-44,38}},
-                lineColor={46,170,220},
-                fillColor={46,170,220},
-                fillPattern=FillPattern.Solid),
-              Polygon(
-                points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{
-                    -12,12},{-26,12},{-28,12},{-26,20}},
-                lineColor={46,170,220},
-                fillColor={46,170,220},
-                fillPattern=FillPattern.Solid),
-              Polygon(
-                points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}},
-                lineColor={46,170,220},
-                fillColor={46,170,220},
-                fillPattern=FillPattern.Solid),
-              Rectangle(
-                extent={{-8,30},{-6,26}},
-                lineColor={242,148,0},
-                fillColor={242,148,0},
-                fillPattern=FillPattern.Solid),
-              Rectangle(
-                extent={{-8,36},{-6,32}},
-                lineColor={242,148,0},
-                fillColor={242,148,0},
-                fillPattern=FillPattern.Solid),
-              Rectangle(
-                extent={{-8,42},{-6,38}},
-                lineColor={242,148,0},
-                fillColor={242,148,0},
-                fillPattern=FillPattern.Solid),
-              Rectangle(
-                extent={{-8,48},{-6,44}},
-                lineColor={242,148,0},
-                fillColor={242,148,0},
-                fillPattern=FillPattern.Solid),
-              Polygon(
-                points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}},
-                lineColor={46,170,220},
-                fillColor={46,170,220},
-                fillPattern=FillPattern.Solid),
-              Rectangle(
-                extent={{-4,32},{-2,28}},
-                lineColor={242,148,0},
-                fillColor={242,148,0},
-                fillPattern=FillPattern.Solid),
-              Rectangle(
-                extent={{-4,38},{-2,34}},
-                lineColor={242,148,0},
-                fillColor={242,148,0},
-                fillPattern=FillPattern.Solid),
-              Rectangle(
-                extent={{-4,44},{-2,40}},
-                lineColor={242,148,0},
-                fillColor={242,148,0},
-                fillPattern=FillPattern.Solid),
-              Rectangle(
-                extent={{-4,50},{-2,46}},
-                lineColor={242,148,0},
-                fillColor={242,148,0},
-                fillPattern=FillPattern.Solid),
-              Polygon(
-                points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{
-                    -2,20}},
-                lineColor={46,170,220},
-                fillColor={46,170,220},
-                fillPattern=FillPattern.Solid),
-              Polygon(
-                points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},
-                    {42,6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},
-                    {-50,6},{-62,2}},
-                lineColor={242,148,0},
-                fillColor={242,148,0},
-                fillPattern=FillPattern.Solid),
-              Line(
-                points={{22,12},{22,14},{22,16},{24,14},{20,18}},
-                color={46,170,220},
-                thickness=0.5),
-              Line(
-                points={{26,12},{26,14},{26,16},{28,14},{24,18}},
-                color={46,170,220},
-                thickness=0.5),
-              Line(
-                points={{30,10},{30,12},{30,14},{32,12},{28,16}},
-                color={46,170,220},
-                thickness=0.5),
-              Polygon(
-                points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}},
-                lineColor={46,170,220},
-                fillColor={46,170,220},
-                fillPattern=FillPattern.Solid),
-              Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}),
-              Line(
-                points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}},
-                color={0,0,255},
-                smooth=Smooth.None),
-              Line(
-                points={{80,80},{100,100}},
-                color={0,0,255},
-                smooth=Smooth.None)}));
-      end Utilities;
-
-      function linspace "Returns a vector with linear spacing"
-        input Real min;
-        input Real max;
-        input Integer npoints;
-
-        output Real[npoints] res;
-
-      protected
-        Real delta;
-      algorithm
-        res[1] := min;
-        res[end] := max;
-
-        delta := (max - min)/npoints;
-
-        for i in 2:npoints-1 loop
-          res[i] := res[i-1] + delta;
-        end for;
-
-      end linspace;
-
-      function dumpOneSpline
-        "Write Modelica.Interpolation.Bspline1D.Data to file as record (not finished)."
-        import Util = Modelica.Utilities;
-        input String fileName "file name";
-        input String splineName "Name of the spline in the array of records.";
-        input
-          ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.Modelica_Interpolation.Bspline1D.Data
-                                                                                               spline "Data.";
-        input Boolean lastSpline = false;
-        output Boolean status "true if succesful.";
-      protected
-        constant Integer recordsPerLine =  4;
-        Integer nKnots;
-        Integer n;
-        Integer nLeftovers;
-      algorithm
-        assert(spline.ndim == 1, "Bailing out - spline.ndim != 1");
-        // This is only for testing. In the end we'd like to append multiple spline records to a file.
-        //Util.Files.removeFile(fileName);
-        Util.Streams.print("record IF97_spline = ThermoSysPro_addon.IF97.SplineUtilities.Modelica_Interpolation.Bspline1D.Data(", fileName);
-        Util.Streams.print("    ndim = " + integerString(spline.ndim) + ",", fileName);
-        Util.Streams.print("    ncontrol = " + integerString(spline.ncontrol) + ",", fileName);
-        Util.Streams.print("    degree = " + integerString(spline.degree) + ",", fileName);
-        nKnots := size(spline.knots, 1);
-        Util.Streams.print("    knots = {", fileName);
-        // print the knots
-        n := integer(nKnots/recordsPerLine);
-        nLeftovers := nKnots - n*recordsPerLine;
-        // if nLeftOvers == 0 we output the last four records separately
-        // or else we end up with "...xxx, xxx, }" (trailing ',') instead of "...xxx, xxx }"
-        if nLeftovers == 0 then
-          for j in 1:n-1 loop
-            Util.Streams.print("    " + String(spline.knots[recordsPerLine * j - 3], significantDigits=15) + ", " + String(spline.knots[recordsPerLine * j - 2], significantDigits=15) + ", " + String(spline.knots[recordsPerLine * j - 1], significantDigits=15) + ", " + String(spline.knots[recordsPerLine * j], significantDigits=15) + ",",  fileName);
-          end for;
-          Util.Streams.print("    " + String(spline.knots[nKnots - 3], significantDigits=15) + ", " + String(spline.knots[nKnots - 2], significantDigits=15) + ", " + String(spline.knots[nKnots - 1], significantDigits=15) + ", " + String(spline.knots[nKnots], significantDigits=15),  fileName);
-        else
-          for j in 1:n loop
-            Util.Streams.print("    " + String(spline.knots[recordsPerLine * j - 3], significantDigits=15) + ", " + String(spline.knots[recordsPerLine * j - 2], significantDigits=15) + ", " + String(spline.knots[recordsPerLine * j - 1], significantDigits=15) + ", " + String(spline.knots[recordsPerLine * j], significantDigits=15) + ",",  fileName);
-          end for;
-          if nLeftovers == 3 then
-            Util.Streams.print("    " + String(spline.knots[nKnots - 2], significantDigits=15) + ", " + String(spline.knots[nKnots - 1], significantDigits=15) + ", " + String(spline.knots[nKnots], significantDigits=15),  fileName);
-          elseif nLeftovers == 2 then
-            Util.Streams.print("    " + String(spline.knots[nKnots - 1], significantDigits=15) + ", " + String(spline.knots[nKnots], significantDigits=15), fileName);
-          elseif nLeftovers == 1 then
-            Util.Streams.print("    " + String(spline.knots[nKnots], significantDigits=15), fileName);
-          end if;
-        end if;
-        Util.Streams.print("    },", fileName);
-        // print the control points
-        // ncontrol = #controlPoints
-        Util.Streams.print("    controlPoints = [", fileName);
-        n := integer(spline.ncontrol / recordsPerLine);
-        nLeftovers := spline.ncontrol - n * recordsPerLine;
-        // Take care of the case when nLeftovers == 0, see the knot comment above for an explanation.
-        if nLeftovers == 0 then
-          for j in 1:n-1 loop
-            Util.Streams.print("    " + String(spline.controlPoints[recordsPerLine * j - 3, 1], significantDigits=15) + "; " + String(spline.controlPoints[recordsPerLine * j - 2, 1], significantDigits=15) + "; " + String(spline.controlPoints[recordsPerLine * j - 1, 1], significantDigits=15) + "; " + String(spline.controlPoints[recordsPerLine * j, 1], significantDigits=15) + ";",  fileName);
-          end for;
-          Util.Streams.print("    " + String(spline.controlPoints[spline.ncontrol - 3, 1], significantDigits=15) + "; " + String(spline.controlPoints[spline.ncontrol - 2, 1], significantDigits=15) + "; " + String(spline.controlPoints[spline.ncontrol - 1, 1], significantDigits=15) + "; " + String(spline.controlPoints[spline.ncontrol, 1], significantDigits=15),  fileName);
-        else
-          for j in 1:n loop
-            Util.Streams.print("    " + String(spline.controlPoints[recordsPerLine * j - 3, 1], significantDigits=15) + "; " + String(spline.controlPoints[recordsPerLine * j - 2, 1], significantDigits=15) + "; " + String(spline.controlPoints[recordsPerLine * j - 1, 1], significantDigits=15) + "; " + String(spline.controlPoints[recordsPerLine * j, 1], significantDigits=15) + ";",  fileName);
-          end for;
-          if nLeftovers == 3 then
-            Util.Streams.print("    " + String(spline.controlPoints[spline.ncontrol - 2, 1], significantDigits=15) + "; " + String(spline.controlPoints[spline.ncontrol - 1, 1], significantDigits=15) + "; " + String(spline.controlPoints[spline.ncontrol, 1], significantDigits=15),  fileName);
-          elseif nLeftovers == 2 then
-            Util.Streams.print("    " + String(spline.controlPoints[spline.ncontrol - 1, 1], significantDigits=15) + "; " + String(spline.controlPoints[spline.ncontrol, 1], significantDigits=15),  fileName);
-          elseif nLeftovers == 1 then
-            Util.Streams.print("    " + String(spline.controlPoints[spline.ncontrol, 1], significantDigits=15),  fileName);
-          end if;
-        end if;
-        if lastSpline then
-           Util.Streams.print("    ])", fileName);
-        else
-          Util.Streams.print("    ]),", fileName);
-        end if;
-        Util.Streams.print("end IF97_spline;",fileName);
-        status := true;
-        annotation ();
-      end dumpOneSpline;
-
-      package Modelica_Interpolation
-        package Table1D "Table interpolation in one dimension"
-          extends Modelica.Icons.Library;
-
-          function init "Initialize 1-dim. table interpolation"
-            extends Modelica.Icons.Function;
-            input Real table[:, :] "[x, y1(x), y2(x), ..., yn(x)] data points";
-            input Integer degree(min=1) = 1
-              "Polynomial degree of interpolation";
-            output Bspline1D.Data tableSpline(
-              ndim=size(table, 2) - 1,
-              ncontrol=size(table, 1),
-              degree=degree)
-              "Table data in a form which can be quickly interpolated";
-          protected
-            Integer nknots=size(tableSpline.knots, 1);
-            Integer ndim=size(table, 2);
-          algorithm
-            //the first column is the parametrization
-            tableSpline := Bspline1D.init(
-                        table[:, 2:ndim],
-                        table[:, 1],
-                        degree,
-                        false);
-          end init;
-
-          function evaluate "Evaluate Table data at one parameter"
-            extends Modelica.Icons.Function;
-            input Bspline1D.Data tableSpline "Bspline table to be evaluated";
-            input Real x "Parameter value at which table shall be evaluated";
-            output Real y[tableSpline.ndim] "Value of table at x";
-          algorithm
-            y := Bspline1D.evaluate(tableSpline, x);
-          end evaluate;
-
-         function evaluateDer
-            "Evaluate Table data and first derivative at one parameter"
-            extends Modelica.Icons.Function;
-            input
-              ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.Modelica_Interpolation.Bspline1D.Data
-              tableSpline "Bspline table to be evaluated";
-            input Real x
-              "Parameter value at which the table shall be evaluated";
-            output Real y[tableSpline.ndim] "Value of the table at x";
-            output Real yd[tableSpline.ndim]
-              "Value of the first derivative at x";
-         algorithm
-            (y,yd) := Bspline1D.evaluateDer(tableSpline, x);
-         end evaluateDer;
-
-          function evaluateDer2
-            "Evaluate Table data and first and second derivative at one parameter"
-            extends Modelica.Icons.Function;
-            input Bspline1D.Data tableSpline "Bspline table to be evaluated";
-            input Real x
-              "Parameter value at which the table shall be evaluated";
-            output Real y[tableSpline.ndim] "Value of the table at x";
-            output Real yd[tableSpline.ndim]
-              "Value of the first derivative at x";
-            output Real ydd[tableSpline.ndim]
-              "Value of the second derivative at x";
-          algorithm
-            (y,yd,ydd) := Bspline1D.evaluateDer2(tableSpline, x);
-          end evaluateDer2;
-
-          annotation (
-            Window(
-              x=0.45,
-              y=0.01,
-              width=0.44,
-              height=0.65,
-              library=1,
-              autolayout=1),
-            Documentation(info="With this package interpolation with B-Splines
-of 1-dim. tables is provided."));
-        end Table1D;
-
-        package Bspline1D "1-dimensional Bspline interpolation"
-        extends Modelica.Icons.Library;
-
-        record Data "Datastructure of a Bspline"
-          parameter Integer ndim(min=1) "Number of dimensions of one control point";
-          parameter Integer ncontrol(min=1) "Number of control points";
-          parameter Integer degree(min=1) "Polynomial degree of the Bspline";
-          Real knots[ncontrol+degree+1] "Knot vector of the Bspline";
-          Real controlPoints[ncontrol,ndim] "[i,:] is data of control point i";
-        end Data;
-
-        record ParametrizationType "will be later replaced by enumeration"
-          constant Integer Equidistant=1 "not recommended";
-          constant Integer ChordLength=2;
-          constant Integer Centripetal=3 "recommended";
-          constant Integer Foley=4;
-          constant Integer Angular=5;
-          constant Integer AreaBased=6;
-        end ParametrizationType;
-
-          function evaluate "Evaluate Bspline at one parameter"
-            extends Modelica.Icons.Function;
-            input Data spline "Bspline to be evaluated";
-            input Real u "Parameter value at which Bspline shall be evaluated";
-            output Real x[spline.ndim] "Value of Bspline at u";
-
-          protected
-           Integer span;
-           Real N[spline.degree+1];
-          algorithm
-            x := zeros(spline.ndim);
-           span := Utilities.n_findSpan(spline.degree,u,spline.knots);
-            N := Utilities.n_BasisFuns(span,u,spline.degree,spline.knots);
-
-            for i in 1:spline.ndim loop
-             x[i] := N*spline.controlPoints[span-spline.degree:span,i];
-            end for;
-          end evaluate;
-
-          function evaluateDer
-            "Evaluate Bspline and its first derivative at one parameter"
-            extends Modelica.Icons.Function;
-            input Data spline "Bspline to be evaluated";
-            input Real u "Parameter value at which Bspline shall be evaluated";
-            output Real x[spline.ndim] "Value of Bspline at u";
-            output Real xd[spline.ndim] "First derivative of Bspline at u";
-          protected
-           Integer span;
-           Real N[2,spline.degree+1];
-          algorithm
-            //Grenzwert von rechts lim (h->0) (f(x+h)-f(x))/h
-            x := zeros(spline.ndim);
-           xd := zeros(spline.ndim);
-
-           span := Utilities.n_findSpan(spline.degree,u,spline.knots);
-            N := Utilities.n_DersBasisFuns(span,u,spline.degree,1,spline.knots);
-
-            for i in 1:spline.ndim loop
-             x[i] := N[1,:]*spline.controlPoints[span-spline.degree:span,i];
-             xd[i] := N[2,:]*spline.controlPoints[span-spline.degree:span,i];
-            end for;
-
-          end evaluateDer;
-
-          function evaluateDer2
-            "Evaluate Bspline and its first and second derivatives at one parameter"
-            extends Modelica.Icons.Function;
-            input Data spline "Bspline to be evaluated";
-            input Real u "Parameter value at which Bspline shall be evaluated";
-            output Real x[spline.ndim] "Value of Bspline at u";
-            output Real xd[spline.ndim] "First derivative of Bspline at u";
-            output Real xdd[spline.ndim] "Second derivative of Bspline at u";
-          protected
-            Integer span;
-           Real N[3,spline.degree+1];
-          algorithm
-            x := zeros(spline.ndim);
-           xd := zeros(spline.ndim);
-           xdd := zeros(spline.ndim);
-
-           span := Utilities.n_findSpan(spline.degree,u,spline.knots);
-            N := Utilities.n_DersBasisFuns(span,u,spline.degree,2,spline.knots);
-
-            for i in 1:spline.ndim loop
-             x[i] := N[1,:]*spline.controlPoints[span-spline.degree:span,i];
-             xd[i] := N[2,:]*spline.controlPoints[span-spline.degree:span,i];
-             xdd[i] := N[3,:]*spline.controlPoints[span-spline.degree:span,i];
-            end for;
-          end evaluateDer2;
-
-          function evaluateDerN
-            "Evaluate k-th derivative of Bspline at one parameter"
-            extends Modelica.Icons.Function;
-            input Data spline "Bspline to be evaluated";
-            input Real u "Parameter value at which Bspline shall be evaluated";
-            input Integer k(min=0)
-              "Differentation order (0: function value, 1: first derivative, ...)";
-            output Real x_derN[spline.ndim] "k-th derivative of Bspline at u";
-
-          protected
-           Integer span;
-           Real N[k+1,spline.degree+1];
-          algorithm
-            x_derN := zeros(spline.ndim);
-
-           span := Utilities.n_findSpan(spline.degree,u,spline.knots);
-            N := Utilities.n_DersBasisFuns(span,u,spline.degree,k,spline.knots);
-
-            for i in 1:spline.ndim loop
-             x_derN[i] := N[k+1,:]*spline.controlPoints[span-spline.degree:span,i];
-            end for;
-
-          end evaluateDerN;
-
-          function init
-            "Initialize Bspline (end conditions are automatically selected, see docu)"
-            extends Modelica.Icons.Function;
-            input Real points[:, :]
-              "[i,:] is point i on the curve to be interpolated";
-            input Real param[size(points, 1)]
-              "parameterization of the data points (not necessarily in the range 0..1)";
-            input Integer degree(min=1) = 3
-              "Polynomial degree of interpolation (max number of points -1)";
-            input Boolean Bessel = true
-              "If true and degree=3, Bessel end condition is used";
-            output Data spline(
-              ndim=size(points, 2),
-              ncontrol=if Bessel and degree == 3 then size(points, 1) + 2 else
-                  size(points, 1),
-              degree=degree)
-              "Bspline in a form which can be quickly interpolated";
-          protected
-            Integer nknots=size(spline.knots, 1);
-            Integer ndim=size(points, 2);
-          algorithm
-            if (degree == 3 and Bessel) then
-             //Interpolation with Bessel end-conditions
-              spline :=
-                ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.Modelica_Interpolation.Bspline1D.Utilities.interpolationBessel(
-                points, param);
-            else
-              //Interpolation without specifying the end-conditions
-              spline :=
-                ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.Modelica_Interpolation.Bspline1D.Utilities.interpolation(
-                          points,
-                          param,
-                          degree);
-            end if;
-          end init;
-
-          function initDer
-            "Initialize Bspline which interpolates the points and first derivatives"
-            extends Modelica.Icons.Function;
-            input Real points[:, :]
-              "[i,:] is point i on the curve to be interpolated";
-            input Real derivs[size(points,1), size(points,2)]
-              "derivs[i,:] is the derivative at points[i,:]";
-            input Real param[size(points, 1)]
-              "parameterization of the data points (not necessarily in the range 0..1)";
-            input Integer degree(min=2) = 3 "Polynomial degree of interpolation (max: number of points -1)
-    at the moment degree=3 is supported";
-            output Data spline(
-              ndim=size(points, 2),
-              ncontrol=2*size(points, 1),
-              degree=degree)
-              "Bspline in a form which can be quickly interpolated";
-          protected
-            Integer nknots=size(spline.knots, 1);
-            Integer ndim=size(points, 2);
-          algorithm
-            spline := Utilities.interpolationder(
-                      points,
-                      derivs,
-                      param,
-                      degree);
-          end initDer;
-
-          function parametrization
-            "Automatic parameterization of a Bspline in the range 0..1 (if ndim > 1)"
-            extends Modelica.Icons.Function;
-            input Real points[:, :]
-              "[i,:] is point i on the curve to be interpolated";
-            input Integer paramType=ParametrizationType.Centripetal
-              "type of parametrization";
-            output Real param[size(points, 1)]
-              "parametrization of the data points";
-
-          protected
-          Real pi=3.141592653589;
-          Integer i;
-          Integer n_points;
-          Real d;
-          Real d_1[size(points, 2)];
-          Real d_2[size(points, 2)];
-          Real d_3[size(points, 2)];
-          Real phi_1;
-          Real phi_2;
-          Real lambda;
-          Real nu;
-          algorithm
-          //The following types of parametrization are described in the book of
-          //Gerald Farin, Curves and Surfaces in CAGD (page 161 'Finding a Knot
-          //Sequence'). For a comparison of the different parametrizations see
-          //the diploma thesis of Gerhard Schillhuber: 'Geometrische Modellierung
-          //oszillationsarmer Trajektorien von Industrierobotern (TU München)'
-          //(only available in german)
-          n_points := size(points,1);
-            if paramType == ParametrizationType.Equidistant then
-            //---EQUIDISTANT---
-            //the parameters are choosen equidistant
-              param := ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.linspace(
-                                0, 1, size(points, 1));
-
-            elseif paramType == ParametrizationType.ChordLength then
-             param[1] := 0;
-            //---CHORD-LENGTH---
-            //the parameters are choosen proportional to the distances of the points
-              for i in 2:n_points loop
-                d := Utilities.norm(points[i,:] - points[i-1,:]);
-                param[i] := param[i-1]+d;
-              end for;
-              param := param / param[n_points];
-
-            elseif paramType == ParametrizationType.Centripetal then
-             param[1] := 0;
-            //---CENTRIPETAL---
-            //the idea of the centriptal parametrization is to minimize the centripetal
-            //force of an object moving on the curve.
-              for i in 2:n_points loop
-                d := Utilities.norm(points[i,:] - points[i-1,:]);
-                param[i] := param[i-1]+sqrt(d);
-              end for;
-              param := param / param[n_points];
-
-            elseif paramType == ParametrizationType.Foley then
-             param[1] := 0;
-            //---FOLEY---
-            //for computing the parameter the distances and the angle formed by the points
-            //are needed.
-
-              d_2 := (points[2,:] - points[1,:]);
-              d_3 := (points[3,:] - points[2,:]);
-              phi_2 := min(pi - acos((d_2 * d_3) / (Utilities.norm(d_2)*Utilities.norm(d_3))),pi/2);
-              d := Utilities.norm(d_2)*(1 +
-                  3/2 * phi_2 * Utilities.norm(d_3) / (Utilities.norm(d_2)+Utilities.norm(d_3)));
-              param[2] := param[1]+d;
-
-              for i in 3:n_points-1 loop
-                d_1 := (points[i-1,:] - points[i-2,:]);
-                d_2 := (points[i,:] - points[i-1,:]);
-                d_3 := (points[i+1,:] - points[i,:]);
-                phi_1 := min(pi - acos((d_1 * d_2) / (Utilities.norm(d_1)*Utilities.norm(d_2))),pi/2);
-                phi_2 := min(pi - acos((d_2 * d_3) / (Utilities.norm(d_2)*Utilities.norm(d_3))),pi/2);
-                d := Utilities.norm(d_2)*(1 +
-                    3/2 * phi_1 * Utilities.norm(d_1) / (Utilities.norm(d_1)+Utilities.norm(d_2)) +
-                    3/2 * phi_2 * Utilities.norm(d_3) / (Utilities.norm(d_2)+Utilities.norm(d_3)));
-
-                param[i] := param[i-1]+d;
-              end for;
-
-              d_1 := (points[n_points-1,:] - points[n_points-2,:]);
-              d_2 := (points[n_points,:] - points[n_points-1,:]);
-              phi_1 := min(pi - acos((d_1 * d_2) / (Utilities.norm(d_1)*Utilities.norm(d_2))),pi/2);
-              d := Utilities.norm(d_2)*(1 +
-                  3/2 * phi_1 * Utilities.norm(d_1) / (Utilities.norm(d_1)+Utilities.norm(d_2)));
-              param[n_points] := param[n_points-1]+d;
-
-              param := param / param[n_points];
-
-            elseif paramType == ParametrizationType.Angular then
-             param[1] := 0;
-            //---ANGULAR---
-            //this param. is like the Foley parametrization (distances and the angle
-            //are needed).
-             lambda := 1.5;
-              for i in 2:n_points-1 loop
-                d_1 := (points[i,:] - points[i-1,:]);
-                d_2 := (points[i+1,:] - points[i,:]);
-                phi_1 := acos((d_1 * d_2) / (Utilities.norm(d_1)*Utilities.norm(d_2)));
-
-                d := sqrt(Utilities.norm(d_1))*(1 + lambda*phi_1/pi);
-                param[i] := param[i-1]+d;
-              end for;
-              d_1 := (points[n_points-2,:] - points[n_points-1,:]);
-              d_2 := (points[n_points-1,:] - points[n_points,:]);
-              phi_1 := acos((d_2 * d_1) / (Utilities.norm(d_1)*Utilities.norm(d_2)));
-              d := sqrt(Utilities.norm(d_2))*(1 + lambda*phi_1/pi);
-              param[n_points] := param[n_points-1]+d;
-
-              param := param / param[n_points];
-
-            elseif paramType == ParametrizationType.AreaBased then
-             lambda := 2/3;
-            //---AREA-BASED---
-            //the parameters are choosen proportional to the area of the parallelograms
-            //formed by the points.
-              nu := 0.3;
-              param[1] := 0;
-              d_2 := (points[2,:] - points[1,:]);
-              d_3 := (points[3,:] - points[2,:]);
-              phi_2 := max(acos((-d_2 * d_3) / (Utilities.norm(d_2)*Utilities.norm(d_3))),pi/2);
-              d := nu*Utilities.norm(d_2) + (1-nu)*(sin(phi_2)*Utilities.norm(d_3)) / Utilities.norm(d_3);
-              param[2] := param[1]+d;
-
-              for i in 3:n_points-1 loop
-                d_1 := (points[i-1,:] - points[i-2,:]);
-                d_2 := (points[i,:] - points[i-1,:]);
-                d_3 := (points[i+1,:] - points[i,:]);
-                phi_1 := max(acos((-d_1 * d_2) / (Utilities.norm(d_1)*Utilities.norm(d_2))),pi/2);
-                phi_2 := max(acos((-d_2 * d_3) / (Utilities.norm(d_2)*Utilities.norm(d_3))),pi/2);
-
-                d := lambda*Utilities.norm(d_2) +
-                    (1-lambda)*(sin(phi_1)*Utilities.norm(d_1)+sin(phi_2)*Utilities.norm(d_3)) /
-                      (Utilities.norm(d_1)+Utilities.norm(d_3));
-                param[i] := param[i-1]+d;
-              end for;
-              d_1 := (points[n_points-1,:] - points[n_points-2,:]);
-              d_2 := (points[n_points,:] - points[n_points-1,:]);
-              phi_1 := max(acos((-d_1 * d_2) / (Utilities.norm(d_1)*Utilities.norm(d_2))),pi/2);
-              d := nu*Utilities.norm(d_2) + (1-nu)*(sin(phi_1)*Utilities.norm(d_1)) / Utilities.norm(d_1);
-              param[n_points] := param[n_points-1]+d;
-
-              param := param / param[n_points];
-
-            end if;
-          end parametrization;
-
-          function plot
-            "Plot Bspline curve (currently not fully functional, since feature in Dymola missing)"
-            extends Modelica.Icons.Function;
-            input Data spline "Bspline to be plotted";
-            input Integer npoints=100 "Number of points";
-            output Real x[npoints,spline.ndim+1]
-              "Table with u and function value at Bspline curve points";
-          algorithm
-
-          end plot;
-
-          package Utilities "Utility functions for package Bspline1D"
-          extends Modelica.Icons.Library;
-
-            function interpolation
-              "Interpolation of the points with a Bspline of degree n"
-              extends Modelica.Icons.Function;
-              input Real points[:, :]
-                "[i,:] is point i on the curve to be interpolated";
-              input Real param[size(points, 1)]
-                "parameterization of the data points (not necessarily in the range 0..1)";
-              input Integer degree(min=1) = 3
-                "Polynomial degree of interpolation";
-              output Data spline(
-                ndim=size(points, 2),
-                ncontrol=size(points, 1),
-                degree=degree)
-                "Bspline in a form which can be quickly interpolated";
-            protected
-              Real ctrlp[spline.ncontrol,spline.ndim];
-              Real k[spline.ncontrol+degree+1];
-            algorithm
-
-             //old
-             //(ctrlp,k) := interpolation_raw(points,param,degree);
-             (ctrlp,k) := interpolation_bandmatrix(points,param,degree);
-
-             spline.controlPoints := ctrlp;
-             spline.knots := k;
-
-            end interpolation;
-
+        */
+          n := size(knots, 1) - p - 1;
+          if abs(u - knots[n + 1]) < 10e-12 then
+            i := n;
+          elseif abs(u - knots[1]) < 10e-12 then
+            i := 1;
+          else
+            low := p;
+            high := n + 1;
+            mid := integer((low + high) / 2);
+            while u < knots[mid] or u >= knots[mid + 1] loop
+              assert(low + 1 < high, "Value must be within limits for Utilities.n_findSpan");
+              if u < knots[mid] then
+                high := mid;
+              else
+                low := mid;
+              end if;
+              mid := integer((low + high) / 2);
+            end while;
+            i := mid;
+          end if;
+        end n_findSpan;
+        annotation(
+          Icon(graphics = {Text(extent = {{-102, 0}, {24, -26}}, lineColor = {242, 148, 0}, textString = "Thermo"), Text(extent = {{-4, 8}, {68, -34}}, lineColor = {46, 170, 220}, textString = "SysPro"), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-32, 12}, {-16, 14}, {6, 14}, {26, 12}, {42, 8}, {52, 2}, {42, 6}, {28, 10}, {6, 12}, {-12, 12}, {-16, 12}, {-34, 10}, {-50, 6}, {-62, 2}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-44, 38}, {-24, 38}, {-26, 30}, {-26, 22}, {-24, 14}, {-24, 12}, {-46, 8}, {-42, 22}, {-42, 30}, {-44, 38}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-26, 20}, {-20, 20}, {-20, 22}, {-14, 22}, {-14, 20}, {-12, 20}, {-12, 12}, {-26, 12}, {-28, 12}, {-26, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-8, 14}, {-8, 24}, {-6, 24}, {-6, 14}, {-8, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 30}, {-6, 26}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 36}, {-6, 32}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 42}, {-6, 38}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 48}, {-6, 44}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-4, 14}, {-4, 26}, {-2, 26}, {-2, 14}, {-4, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 32}, {-2, 28}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 38}, {-2, 34}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 44}, {-2, 40}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 50}, {-2, 46}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-2, 20}, {8, 20}, {8, 22}, {10, 22}, {18, 22}, {18, 12}, {-4, 14}, {-2, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-36, 10}, {-18, 12}, {6, 12}, {26, 10}, {42, 6}, {52, 0}, {42, 4}, {28, 8}, {6, 10}, {-12, 10}, {-18, 10}, {-38, 8}, {-50, 6}, {-62, 2}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Line(points = {{22, 12}, {22, 14}, {22, 16}, {24, 14}, {20, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{26, 12}, {26, 14}, {26, 16}, {28, 14}, {24, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{30, 10}, {30, 12}, {30, 14}, {32, 12}, {28, 16}}, color = {46, 170, 220}, thickness = 0.5), Polygon(points = {{36, 8}, {36, 30}, {34, 34}, {36, 38}, {40, 38}, {40, 8}, {36, 8}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 80}, {80, -100}}, lineColor = {0, 0, 255}), Line(points = {{-100, 80}, {-80, 100}, {100, 100}, {100, -80}, {80, -100}}, color = {0, 0, 255}, smooth = Smooth.None), Line(points = {{80, 80}, {100, 100}}, color = {0, 0, 255}, smooth = Smooth.None)}));
+      end Utilities;
+
+      function linspace "Returns a vector with linear spacing"
+        input Real min;
+        input Real max;
+        input Integer npoints;
+        output Real[npoints] res;
+      protected
+        Real delta;
+      algorithm
+        res[1] := min;
+        res[end] := max;
+        delta := (max - min) / npoints;
+        for i in 2:npoints - 1 loop
+          res[i] := res[i - 1] + delta;
+        end for;
+      end linspace;
+
+      function dumpOneSpline "Write Modelica.Interpolation.Bspline1D.Data to file as record (not finished)."
+        import Util = Modelica.Utilities;
+        input String fileName "file name";
+        input String splineName "Name of the spline in the array of records.";
+        input ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.Modelica_Interpolation.Bspline1D.Data spline "Data.";
+        input Boolean lastSpline = false;
+        output Boolean status "true if succesful.";
+      protected
+        constant Integer recordsPerLine = 4;
+        Integer nKnots;
+        Integer n;
+        Integer nLeftovers;
+      algorithm
+        assert(spline.ndim == 1, "Bailing out - spline.ndim != 1");
+// This is only for testing. In the end we'd like to append multiple spline records to a file.
+//Util.Files.removeFile(fileName);
+        Util.Streams.print("record IF97_spline = ThermoSysPro_addon.IF97.SplineUtilities.Modelica_Interpolation.Bspline1D.Data(", fileName);
+        Util.Streams.print("    ndim = " + integerString(spline.ndim) + ",", fileName);
+        Util.Streams.print("    ncontrol = " + integerString(spline.ncontrol) + ",", fileName);
+        Util.Streams.print("    degree = " + integerString(spline.degree) + ",", fileName);
+        nKnots := size(spline.knots, 1);
+        Util.Streams.print("    knots = {", fileName);
+// print the knots
+        n := integer(nKnots / recordsPerLine);
+        nLeftovers := nKnots - n * recordsPerLine;
+// if nLeftOvers == 0 we output the last four records separately
+// or else we end up with "...xxx, xxx, }" (trailing ',') instead of "...xxx, xxx }"
+        if nLeftovers == 0 then
+          for j in 1:n - 1 loop
+            Util.Streams.print("    " + String(spline.knots[recordsPerLine * j - 3], significantDigits = 15) + ", " + String(spline.knots[recordsPerLine * j - 2], significantDigits = 15) + ", " + String(spline.knots[recordsPerLine * j - 1], significantDigits = 15) + ", " + String(spline.knots[recordsPerLine * j], significantDigits = 15) + ",", fileName);
+          end for;
+          Util.Streams.print("    " + String(spline.knots[nKnots - 3], significantDigits = 15) + ", " + String(spline.knots[nKnots - 2], significantDigits = 15) + ", " + String(spline.knots[nKnots - 1], significantDigits = 15) + ", " + String(spline.knots[nKnots], significantDigits = 15), fileName);
+        else
+          for j in 1:n loop
+            Util.Streams.print("    " + String(spline.knots[recordsPerLine * j - 3], significantDigits = 15) + ", " + String(spline.knots[recordsPerLine * j - 2], significantDigits = 15) + ", " + String(spline.knots[recordsPerLine * j - 1], significantDigits = 15) + ", " + String(spline.knots[recordsPerLine * j], significantDigits = 15) + ",", fileName);
+          end for;
+          if nLeftovers == 3 then
+            Util.Streams.print("    " + String(spline.knots[nKnots - 2], significantDigits = 15) + ", " + String(spline.knots[nKnots - 1], significantDigits = 15) + ", " + String(spline.knots[nKnots], significantDigits = 15), fileName);
+          elseif nLeftovers == 2 then
+            Util.Streams.print("    " + String(spline.knots[nKnots - 1], significantDigits = 15) + ", " + String(spline.knots[nKnots], significantDigits = 15), fileName);
+          elseif nLeftovers == 1 then
+            Util.Streams.print("    " + String(spline.knots[nKnots], significantDigits = 15), fileName);
+          end if;
+        end if;
+        Util.Streams.print("    },", fileName);
+// print the control points
+// ncontrol = #controlPoints
+        Util.Streams.print("    controlPoints = [", fileName);
+        n := integer(spline.ncontrol / recordsPerLine);
+        nLeftovers := spline.ncontrol - n * recordsPerLine;
+// Take care of the case when nLeftovers == 0, see the knot comment above for an explanation.
+        if nLeftovers == 0 then
+          for j in 1:n - 1 loop
+            Util.Streams.print("    " + String(spline.controlPoints[recordsPerLine * j - 3, 1], significantDigits = 15) + "; " + String(spline.controlPoints[recordsPerLine * j - 2, 1], significantDigits = 15) + "; " + String(spline.controlPoints[recordsPerLine * j - 1, 1], significantDigits = 15) + "; " + String(spline.controlPoints[recordsPerLine * j, 1], significantDigits = 15) + ";", fileName);
+          end for;
+          Util.Streams.print("    " + String(spline.controlPoints[spline.ncontrol - 3, 1], significantDigits = 15) + "; " + String(spline.controlPoints[spline.ncontrol - 2, 1], significantDigits = 15) + "; " + String(spline.controlPoints[spline.ncontrol - 1, 1], significantDigits = 15) + "; " + String(spline.controlPoints[spline.ncontrol, 1], significantDigits = 15), fileName);
+        else
+          for j in 1:n loop
+            Util.Streams.print("    " + String(spline.controlPoints[recordsPerLine * j - 3, 1], significantDigits = 15) + "; " + String(spline.controlPoints[recordsPerLine * j - 2, 1], significantDigits = 15) + "; " + String(spline.controlPoints[recordsPerLine * j - 1, 1], significantDigits = 15) + "; " + String(spline.controlPoints[recordsPerLine * j, 1], significantDigits = 15) + ";", fileName);
+          end for;
+          if nLeftovers == 3 then
+            Util.Streams.print("    " + String(spline.controlPoints[spline.ncontrol - 2, 1], significantDigits = 15) + "; " + String(spline.controlPoints[spline.ncontrol - 1, 1], significantDigits = 15) + "; " + String(spline.controlPoints[spline.ncontrol, 1], significantDigits = 15), fileName);
+          elseif nLeftovers == 2 then
+            Util.Streams.print("    " + String(spline.controlPoints[spline.ncontrol - 1, 1], significantDigits = 15) + "; " + String(spline.controlPoints[spline.ncontrol, 1], significantDigits = 15), fileName);
+          elseif nLeftovers == 1 then
+            Util.Streams.print("    " + String(spline.controlPoints[spline.ncontrol, 1], significantDigits = 15), fileName);
+          end if;
+        end if;
+        if lastSpline then
+          Util.Streams.print("    ])", fileName);
+        else
+          Util.Streams.print("    ]),", fileName);
+        end if;
+        Util.Streams.print("end IF97_spline;", fileName);
+        status := true;
+        annotation();
+      end dumpOneSpline;
+
+      package Modelica_Interpolation
+        package Table1D "Table interpolation in one dimension"
+          extends Modelica.Icons.Package;
+
+          function init "Initialize 1-dim. table interpolation"
+            extends Modelica.Icons.Function;
+            input Real table[:, :] "[x, y1(x), y2(x), ..., yn(x)] data points";
+            input Integer degree(min = 1) = 1 "Polynomial degree of interpolation";
+            output Bspline1D.Data tableSpline(ndim = size(table, 2) - 1, ncontrol = size(table, 1), degree = degree) "Table data in a form which can be quickly interpolated";
+          protected
+            Integer nknots = size(tableSpline.knots, 1);
+            Integer ndim = size(table, 2);
+          algorithm
+//the first column is the parametrization
+            tableSpline := Bspline1D.init(table[:, 2:ndim], table[:, 1], degree, false);
+          end init;
+
+          function evaluate "Evaluate Table data at one parameter"
+            extends Modelica.Icons.Function;
+            input Bspline1D.Data tableSpline "Bspline table to be evaluated";
+            input Real x "Parameter value at which table shall be evaluated";
+            output Real y[tableSpline.ndim] "Value of table at x";
+          algorithm
+            y := Bspline1D.evaluate(tableSpline, x);
+          end evaluate;
+
+          function evaluateDer "Evaluate Table data and first derivative at one parameter"
+            extends Modelica.Icons.Function;
+            input ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.Modelica_Interpolation.Bspline1D.Data tableSpline "Bspline table to be evaluated";
+            input Real x "Parameter value at which the table shall be evaluated";
+            output Real y[tableSpline.ndim] "Value of the table at x";
+            output Real yd[tableSpline.ndim] "Value of the first derivative at x";
+          algorithm
+            (y, yd) := Bspline1D.evaluateDer(tableSpline, x);
+          end evaluateDer;
+
+          function evaluateDer2 "Evaluate Table data and first and second derivative at one parameter"
+            extends Modelica.Icons.Function;
+            input Bspline1D.Data tableSpline "Bspline table to be evaluated";
+            input Real x "Parameter value at which the table shall be evaluated";
+            output Real y[tableSpline.ndim] "Value of the table at x";
+            output Real yd[tableSpline.ndim] "Value of the first derivative at x";
+            output Real ydd[tableSpline.ndim] "Value of the second derivative at x";
+          algorithm
+            (y, yd, ydd) := Bspline1D.evaluateDer2(tableSpline, x);
+          end evaluateDer2;
+          annotation(
+            Window(x = 0.45, y = 0.01, width = 0.44, height = 0.65, library = 1, autolayout = 1),
+            Documentation(info = "With this package interpolation with B-Splines
+of 1-dim. tables is provided."));
+        end Table1D;
+
+        package Bspline1D "1-dimensional Bspline interpolation"
+          extends Modelica.Icons.Package;
+
+          record Data "Datastructure of a Bspline"
+            parameter Integer ndim(min = 1) "Number of dimensions of one control point";
+            parameter Integer ncontrol(min = 1) "Number of control points";
+            parameter Integer degree(min = 1) "Polynomial degree of the Bspline";
+            Real knots[ncontrol + degree + 1] "Knot vector of the Bspline";
+            Real controlPoints[ncontrol, ndim] "[i,:] is data of control point i";
+          end Data;
+
+          record ParametrizationType "will be later replaced by enumeration"
+            constant Integer Equidistant = 1 "not recommended";
+            constant Integer ChordLength = 2;
+            constant Integer Centripetal = 3 "recommended";
+            constant Integer Foley = 4;
+            constant Integer Angular = 5;
+            constant Integer AreaBased = 6;
+          end ParametrizationType;
+
+          function evaluate "Evaluate Bspline at one parameter"
+            extends Modelica.Icons.Function;
+            input Data spline "Bspline to be evaluated";
+            input Real u "Parameter value at which Bspline shall be evaluated";
+            output Real x[spline.ndim] "Value of Bspline at u";
+          protected
+            Integer span;
+            Real N[spline.degree + 1];
+          algorithm
+            x := zeros(spline.ndim);
+            span := Utilities.n_findSpan(spline.degree, u, spline.knots);
+            N := Utilities.n_BasisFuns(span, u, spline.degree, spline.knots);
+            for i in 1:spline.ndim loop
+              x[i] := N * spline.controlPoints[span - spline.degree:span, i];
+            end for;
+          end evaluate;
+
+          function evaluateDer "Evaluate Bspline and its first derivative at one parameter"
+            extends Modelica.Icons.Function;
+            input Data spline "Bspline to be evaluated";
+            input Real u "Parameter value at which Bspline shall be evaluated";
+            output Real x[spline.ndim] "Value of Bspline at u";
+            output Real xd[spline.ndim] "First derivative of Bspline at u";
+          protected
+            Integer span;
+            Real N[2, spline.degree + 1];
+          algorithm
+//Grenzwert von rechts lim (h->0) (f(x+h)-f(x))/h
+            x := zeros(spline.ndim);
+            xd := zeros(spline.ndim);
+            span := Utilities.n_findSpan(spline.degree, u, spline.knots);
+            N := Utilities.n_DersBasisFuns(span, u, spline.degree, 1, spline.knots);
+            for i in 1:spline.ndim loop
+              x[i] := N[1, :] * spline.controlPoints[span - spline.degree:span, i];
+              xd[i] := N[2, :] * spline.controlPoints[span - spline.degree:span, i];
+            end for;
+          end evaluateDer;
+
+          function evaluateDer2 "Evaluate Bspline and its first and second derivatives at one parameter"
+            extends Modelica.Icons.Function;
+            input Data spline "Bspline to be evaluated";
+            input Real u "Parameter value at which Bspline shall be evaluated";
+            output Real x[spline.ndim] "Value of Bspline at u";
+            output Real xd[spline.ndim] "First derivative of Bspline at u";
+            output Real xdd[spline.ndim] "Second derivative of Bspline at u";
+          protected
+            Integer span;
+            Real N[3, spline.degree + 1];
+          algorithm
+            x := zeros(spline.ndim);
+            xd := zeros(spline.ndim);
+            xdd := zeros(spline.ndim);
+            span := Utilities.n_findSpan(spline.degree, u, spline.knots);
+            N := Utilities.n_DersBasisFuns(span, u, spline.degree, 2, spline.knots);
+            for i in 1:spline.ndim loop
+              x[i] := N[1, :] * spline.controlPoints[span - spline.degree:span, i];
+              xd[i] := N[2, :] * spline.controlPoints[span - spline.degree:span, i];
+              xdd[i] := N[3, :] * spline.controlPoints[span - spline.degree:span, i];
+            end for;
+          end evaluateDer2;
+
+          function evaluateDerN "Evaluate k-th derivative of Bspline at one parameter"
+            extends Modelica.Icons.Function;
+            input Data spline "Bspline to be evaluated";
+            input Real u "Parameter value at which Bspline shall be evaluated";
+            input Integer k(min = 0) "Differentation order (0: function value, 1: first derivative, ...)";
+            output Real x_derN[spline.ndim] "k-th derivative of Bspline at u";
+          protected
+            Integer span;
+            Real N[k + 1, spline.degree + 1];
+          algorithm
+            x_derN := zeros(spline.ndim);
+            span := Utilities.n_findSpan(spline.degree, u, spline.knots);
+            N := Utilities.n_DersBasisFuns(span, u, spline.degree, k, spline.knots);
+            for i in 1:spline.ndim loop
+              x_derN[i] := N[k + 1, :] * spline.controlPoints[span - spline.degree:span, i];
+            end for;
+          end evaluateDerN;
+
+          function init "Initialize Bspline (end conditions are automatically selected, see docu)"
+            extends Modelica.Icons.Function;
+            input Real points[:, :] "[i,:] is point i on the curve to be interpolated";
+            input Real param[size(points, 1)] "parameterization of the data points (not necessarily in the range 0..1)";
+            input Integer degree(min = 1) = 3 "Polynomial degree of interpolation (max number of points -1)";
+            input Boolean Bessel = true "If true and degree=3, Bessel end condition is used";
+            output Data spline(ndim = size(points, 2), ncontrol = if Bessel and degree == 3 then size(points, 1) + 2 else size(points, 1), degree = degree) "Bspline in a form which can be quickly interpolated";
+          protected
+            Integer nknots = size(spline.knots, 1);
+            Integer ndim = size(points, 2);
+          algorithm
+            if degree == 3 and Bessel then
+              spline := ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.Modelica_Interpolation.Bspline1D.Utilities.interpolationBessel(points, param);
+            else
+              spline := ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.Modelica_Interpolation.Bspline1D.Utilities.interpolation(points, param, degree);
+            end if;
+//Interpolation with Bessel end-conditions
+//Interpolation without specifying the end-conditions
+          end init;
+
+          function initDer "Initialize Bspline which interpolates the points and first derivatives"
+            extends Modelica.Icons.Function;
+            input Real points[:, :] "[i,:] is point i on the curve to be interpolated";
+            input Real derivs[size(points, 1), size(points, 2)] "derivs[i,:] is the derivative at points[i,:]";
+            input Real param[size(points, 1)] "parameterization of the data points (not necessarily in the range 0..1)";
+            input Integer degree(min = 2) = 3 "Polynomial degree of interpolation (max: number of points -1)
+                at the moment degree=3 is supported";
+            output Data spline(ndim = size(points, 2), ncontrol = 2 * size(points, 1), degree = degree) "Bspline in a form which can be quickly interpolated";
+          protected
+            Integer nknots = size(spline.knots, 1);
+            Integer ndim = size(points, 2);
+          algorithm
+            spline := Utilities.interpolationder(points, derivs, param, degree);
+          end initDer;
+
+          function parametrization "Automatic parameterization of a Bspline in the range 0..1 (if ndim > 1)"
+            extends Modelica.Icons.Function;
+            input Real points[:, :] "[i,:] is point i on the curve to be interpolated";
+            input Integer paramType = ParametrizationType.Centripetal "type of parametrization";
+            output Real param[size(points, 1)] "parametrization of the data points";
+          protected
+            Real pi = 3.141592653589;
+            Integer i;
+            Integer n_points;
+            Real d;
+            Real d_1[size(points, 2)];
+            Real d_2[size(points, 2)];
+            Real d_3[size(points, 2)];
+            Real phi_1;
+            Real phi_2;
+            Real lambda;
+            Real nu;
+          algorithm
+//The following types of parametrization are described in the book of
+//Gerald Farin, Curves and Surfaces in CAGD (page 161 'Finding a Knot
+//Sequence'). For a comparison of the different parametrizations see
+//the diploma thesis of Gerhard Schillhuber: 'Geometrische Modellierung
+//oszillationsarmer Trajektorien von Industrierobotern (TU München)'
+//(only available in german)
+            n_points := size(points, 1);
+            if paramType == ParametrizationType.Equidistant then
+              param := ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.linspace(0, 1, size(points, 1));
+            elseif paramType == ParametrizationType.ChordLength then
+              param[1] := 0;
+              for i in 2:n_points loop
+                d := Utilities.norm(points[i, :] - points[i - 1, :]);
+                param[i] := param[i - 1] + d;
+              end for;
+              param := param / param[n_points];
+            elseif paramType == ParametrizationType.Centripetal then
+              param[1] := 0;
+              for i in 2:n_points loop
+                d := Utilities.norm(points[i, :] - points[i - 1, :]);
+                param[i] := param[i - 1] + sqrt(d);
+              end for;
+              param := param / param[n_points];
+            elseif paramType == ParametrizationType.Foley then
+              param[1] := 0;
+              d_2 := points[2, :] - points[1, :];
+              d_3 := points[3, :] - points[2, :];
+              phi_2 := min(pi - acos(d_2 * d_3 / (Utilities.norm(d_2) * Utilities.norm(d_3))), pi / 2);
+              d := Utilities.norm(d_2) * (1 + 3 / 2 * phi_2 * Utilities.norm(d_3) / (Utilities.norm(d_2) + Utilities.norm(d_3)));
+              param[2] := param[1] + d;
+              for i in 3:n_points - 1 loop
+                d_1 := points[i - 1, :] - points[i - 2, :];
+                d_2 := points[i, :] - points[i - 1, :];
+                d_3 := points[i + 1, :] - points[i, :];
+                phi_1 := min(pi - acos(d_1 * d_2 / (Utilities.norm(d_1) * Utilities.norm(d_2))), pi / 2);
+                phi_2 := min(pi - acos(d_2 * d_3 / (Utilities.norm(d_2) * Utilities.norm(d_3))), pi / 2);
+                d := Utilities.norm(d_2) * (1 + 3 / 2 * phi_1 * Utilities.norm(d_1) / (Utilities.norm(d_1) + Utilities.norm(d_2)) + 3 / 2 * phi_2 * Utilities.norm(d_3) / (Utilities.norm(d_2) + Utilities.norm(d_3)));
+                param[i] := param[i - 1] + d;
+              end for;
+              d_1 := points[n_points - 1, :] - points[n_points - 2, :];
+              d_2 := points[n_points, :] - points[n_points - 1, :];
+              phi_1 := min(pi - acos(d_1 * d_2 / (Utilities.norm(d_1) * Utilities.norm(d_2))), pi / 2);
+              d := Utilities.norm(d_2) * (1 + 3 / 2 * phi_1 * Utilities.norm(d_1) / (Utilities.norm(d_1) + Utilities.norm(d_2)));
+              param[n_points] := param[n_points - 1] + d;
+              param := param / param[n_points];
+            elseif paramType == ParametrizationType.Angular then
+              param[1] := 0;
+              lambda := 1.5;
+              for i in 2:n_points - 1 loop
+                d_1 := points[i, :] - points[i - 1, :];
+                d_2 := points[i + 1, :] - points[i, :];
+                phi_1 := acos(d_1 * d_2 / (Utilities.norm(d_1) * Utilities.norm(d_2)));
+                d := sqrt(Utilities.norm(d_1)) * (1 + lambda * phi_1 / pi);
+                param[i] := param[i - 1] + d;
+              end for;
+              d_1 := points[n_points - 2, :] - points[n_points - 1, :];
+              d_2 := points[n_points - 1, :] - points[n_points, :];
+              phi_1 := acos(d_2 * d_1 / (Utilities.norm(d_1) * Utilities.norm(d_2)));
+              d := sqrt(Utilities.norm(d_2)) * (1 + lambda * phi_1 / pi);
+              param[n_points] := param[n_points - 1] + d;
+              param := param / param[n_points];
+            elseif paramType == ParametrizationType.AreaBased then
+              lambda := 2 / 3;
+              nu := 0.3;
+              param[1] := 0;
+              d_2 := points[2, :] - points[1, :];
+              d_3 := points[3, :] - points[2, :];
+              phi_2 := max(acos((-d_2 * d_3) / (Utilities.norm(d_2) * Utilities.norm(d_3))), pi / 2);
+              d := nu * Utilities.norm(d_2) + (1 - nu) * (sin(phi_2) * Utilities.norm(d_3)) / Utilities.norm(d_3);
+              param[2] := param[1] + d;
+              for i in 3:n_points - 1 loop
+                d_1 := points[i - 1, :] - points[i - 2, :];
+                d_2 := points[i, :] - points[i - 1, :];
+                d_3 := points[i + 1, :] - points[i, :];
+                phi_1 := max(acos((-d_1 * d_2) / (Utilities.norm(d_1) * Utilities.norm(d_2))), pi / 2);
+                phi_2 := max(acos((-d_2 * d_3) / (Utilities.norm(d_2) * Utilities.norm(d_3))), pi / 2);
+                d := lambda * Utilities.norm(d_2) + (1 - lambda) * (sin(phi_1) * Utilities.norm(d_1) + sin(phi_2) * Utilities.norm(d_3)) / (Utilities.norm(d_1) + Utilities.norm(d_3));
+                param[i] := param[i - 1] + d;
+              end for;
+              d_1 := points[n_points - 1, :] - points[n_points - 2, :];
+              d_2 := points[n_points, :] - points[n_points - 1, :];
+              phi_1 := max(acos((-d_1 * d_2) / (Utilities.norm(d_1) * Utilities.norm(d_2))), pi / 2);
+              d := nu * Utilities.norm(d_2) + (1 - nu) * (sin(phi_1) * Utilities.norm(d_1)) / Utilities.norm(d_1);
+              param[n_points] := param[n_points - 1] + d;
+              param := param / param[n_points];
+            end if;
+//---EQUIDISTANT---
+//the parameters are choosen equidistant
+//---CHORD-LENGTH---
+//the parameters are choosen proportional to the distances of the points
+//---CENTRIPETAL---
+//the idea of the centriptal parametrization is to minimize the centripetal
+//force of an object moving on the curve.
+//---FOLEY---
+//for computing the parameter the distances and the angle formed by the points
+//are needed.
+//---ANGULAR---
+//this param. is like the Foley parametrization (distances and the angle
+//are needed).
+//---AREA-BASED---
+//the parameters are choosen proportional to the area of the parallelograms
+//formed by the points.
+          end parametrization;
+
+          function plot "Plot Bspline curve (currently not fully functional, since feature in Dymola missing)"
+            extends Modelica.Icons.Function;
+            input Data spline "Bspline to be plotted";
+            input Integer npoints = 100 "Number of points";
+            output Real x[npoints, spline.ndim + 1] "Table with u and function value at Bspline curve points";
+          algorithm
+
+          end plot;
+
+          package Utilities "Utility functions for package Bspline1D"
+            extends Modelica.Icons.Package;
+
+            function interpolation "Interpolation of the points with a Bspline of degree n"
+              extends Modelica.Icons.Function;
+              input Real points[:, :] "[i,:] is point i on the curve to be interpolated";
+              input Real param[size(points, 1)] "parameterization of the data points (not necessarily in the range 0..1)";
+              input Integer degree(min = 1) = 3 "Polynomial degree of interpolation";
+              output Data spline(ndim = size(points, 2), ncontrol = size(points, 1), degree = degree) "Bspline in a form which can be quickly interpolated";
+            protected
+              Real ctrlp[spline.ncontrol, spline.ndim];
+              Real k[spline.ncontrol + degree + 1];
+            algorithm
+//old
+//(ctrlp,k) := interpolation_raw(points,param,degree);
+              (ctrlp, k) := interpolation_bandmatrix(points, param, degree);
+              spline.controlPoints := ctrlp;
+              spline.knots := k;
+            end interpolation;
+
             function interpolation_bandmatrix "Interpolation of the points with a Bspline of degree n. Do NOT return a Bspline struct.
-  Return the the raw information of control points and knots."
-              import U =
-                ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.Modelica_Interpolation.Bspline1D.Utilities;
-              extends Modelica.Icons.Function;
-              input Real points[:, :]
-                "[i,:] is point i on the curve to be interpolated";
-              input Real param[size(points, 1)]
-                "parameterization of the data points (not necessarily in the range 0..1)";
-              input Integer degree(min=1) = 3
-                "Polynomial degree of interpolation";
-              output Real controlPoints[size(points, 1),size(points, 2)]
-                "Control points";
-              output Real knots[size(points, 1)+degree+1] "knots";
-            protected
-              Integer nknots=size(knots, 1);
-              Integer ndim=size(points, 2);
-              Integer npoints;
-              Integer knots_tech;
-              //Real S[size(points,1),size(points,1)];
-
-              Real u;
-              Integer span;
-              Real evalBasisFuns[degree+1];
-              Real Band[3*degree+1,size(points,1)];
-              Integer kl = degree;
-              Integer ku = degree;
-              Integer info=0;
-              String sout;
-            algorithm
-              /*
+              Return the the raw information of control points and knots."
+              import U = ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.Modelica_Interpolation.Bspline1D.Utilities;
+              extends Modelica.Icons.Function;
+              input Real points[:, :] "[i,:] is point i on the curve to be interpolated";
+              input Real param[size(points, 1)] "parameterization of the data points (not necessarily in the range 0..1)";
+              input Integer degree(min = 1) = 3 "Polynomial degree of interpolation";
+              output Real controlPoints[size(points, 1), size(points, 2)] "Control points";
+              output Real knots[size(points, 1) + degree + 1] "knots";
+            protected
+              Integer nknots = size(knots, 1);
+              Integer ndim = size(points, 2);
+              Integer npoints;
+              Integer knots_tech;
+              //Real S[size(points,1),size(points,1)];
+              Real u;
+              Integer span;
+              Real evalBasisFuns[degree + 1];
+              Real Band[3 * degree + 1, size(points, 1)];
+              Integer kl = degree;
+              Integer ku = degree;
+              Integer info = 0;
+              String sout;
+            algorithm
+/*
   The NURBS Book: Global Interpolation (page 364)
-  */
-              npoints := size(points,1);
-
-             // build the knots
-             //     1:  knots = parameter (for testing)
-             //     2:  knots are built with averaging
-             //     3:  knots equidistant (for testing)
-             knots_tech := 2;
-
-             if knots_tech == 1 then
-                knots[1:degree] := ones(degree)*param[1];
-                knots[degree+1:npoints+degree] := param;
-                knots[npoints+degree+1:npoints+2*degree] := ones(degree)*param[npoints];
-
-             end if;
-
-             if knots_tech == 2 then
-             // with averaging to avoid a singularity system of equation
-                knots[1:degree+1] := ones(degree+1)*param[1];
-                for j in 1:npoints-degree-1 loop
-                   knots[degree+j+1] := sum(param[j+1:j+degree])/degree;
-                end for;
-                knots[npoints+1:npoints+degree+1] := ones(degree+1)*param[npoints];
-
-             end if;
-
-             if knots_tech == 3 then
-                knots[1:degree+1] := ones(degree+1)*param[1];
-                for j in 1:npoints-1 loop
-                   knots[degree+j+1] := j/(npoints-1);
-                end for;
-                knots[npoints+degree+1:npoints+2*degree] := ones(degree)*param[npoints];
-
-             end if;
-
-             // build the equation system
-            // S := zeros(npoints,npoints);
-
-             for i in 1:npoints loop
-               u := param[i];
-               span := U.n_findSpan(degree,u,knots);
-               //S[i,span-degree:span] := n_BasisFuns(span,u,degree,knots);
-               evalBasisFuns := U.n_BasisFuns(span,u,degree,knots);
-
-               for j in 1:degree+1 loop
-                 Band[kl+1+ku+i-span+degree-j+1,span-degree+j-1]:=evalBasisFuns[j];
-            //Band[kl+1+ku+i-span+degree-j+1,span-degree+j-1]:=10*i+span-degree-1+j;
-
-               end for;
-
-             end for;
-
-            /*
+  */
+              npoints := size(points, 1);
+// build the knots
+//     1:  knots = parameter (for testing)
+//     2:  knots are built with averaging
+//     3:  knots equidistant (for testing)
+              knots_tech := 2;
+              if knots_tech == 1 then
+                knots[1:degree] := ones(degree) * param[1];
+                knots[degree + 1:npoints + degree] := param;
+                knots[npoints + degree + 1:npoints + 2 * degree] := ones(degree) * param[npoints];
+              end if;
+              if knots_tech == 2 then
+                knots[1:degree + 1] := ones(degree + 1) * param[1];
+                for j in 1:npoints - degree - 1 loop
+                  knots[degree + j + 1] := sum(param[j + 1:j + degree]) / degree;
+                end for;
+                knots[npoints + 1:npoints + degree + 1] := ones(degree + 1) * param[npoints];
+              end if;
+// with averaging to avoid a singularity system of equation
+              if knots_tech == 3 then
+                knots[1:degree + 1] := ones(degree + 1) * param[1];
+                for j in 1:npoints - 1 loop
+                  knots[degree + j + 1] := j / (npoints - 1);
+                end for;
+                knots[npoints + degree + 1:npoints + 2 * degree] := ones(degree) * param[npoints];
+              end if;
+// build the equation system
+// S := zeros(npoints,npoints);
+              for i in 1:npoints loop
+                u := param[i];
+                span := U.n_findSpan(degree, u, knots);
+                evalBasisFuns := U.n_BasisFuns(span, u, degree, knots);
+                for j in 1:degree + 1 loop
+                  Band[kl + 1 + ku + i - span + degree - j + 1, span - degree + j - 1] := evalBasisFuns[j];
+                end for;
+              end for;
+//S[i,span-degree:span] := n_BasisFuns(span,u,degree,knots);
+//Band[kl+1+ku+i-span+degree-j+1,span-degree+j-1]:=10*i+span-degree-1+j;
+/*
 for i in 1:npoints loop
     sout :="i = " + String(i) + ":";
     for j in 1:degree+1 loop
@@ -3517,507 +2299,382 @@
     end for;
     Utilities.ModelicaMessage(sout + "\n");
 end for;
-*/
-
-             // solve the equation system
-              (controlPoints,info) :=
-                ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.Modelica_Interpolation.Utilities.solveBandedWithMatrix(
-                            kl,
-                            ku,
-                            Band,
-                            points);
-             // assert(info == 0, "Error when computing spline coefficients");
-
-            if info <> 0 then
-              // if solving with band matrix is not succesful, use full matrix
-              (controlPoints,knots) := U.interpolation_raw(points,param,degree);
-
-            end if;
-
-            end interpolation_bandmatrix;
-
+*/
+// solve the equation system
+              (controlPoints, info) := ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.Modelica_Interpolation.Utilities.solveBandedWithMatrix(kl, ku, Band, points);
+// assert(info == 0, "Error when computing spline coefficients");
+              if info <> 0 then
+                (controlPoints, knots) := U.interpolation_raw(points, param, degree);
+              end if;
+// if solving with band matrix is not succesful, use full matrix
+            end interpolation_bandmatrix;
+
             function interpolation_raw "Interpolation of the points with a Bspline of degree n. Do NOT return a Bspline struct.
-  Return the the raw information of control points and knots."
-            //  import Modelica_Interpolation;
-              extends Modelica.Icons.Function;
-              input Real points[:, :]
-                "[i,:] is point i on the curve to be interpolated";
-              input Real param[size(points, 1)]
-                "parameterization of the data points (not necessarily in the range 0..1)";
-              input Integer degree(min=1) = 3
-                "Polynomial degree of interpolation";
-              output Real controlPoints[size(points, 1),size(points, 2)]
-                "Control points";
-              output Real knots[size(points, 1)+degree+1] "knots";
-            protected
-              Integer nknots=size(knots, 1);
-              Integer ndim=size(points, 2);
-              Integer npoints;
-              Integer knots_tech;
-              Real S[size(points,1),size(points,1)];
-              Real u;
-              Integer span;
-            algorithm
-              /*
+              Return the the raw information of control points and knots."
+              //  import Modelica_Interpolation;
+              extends Modelica.Icons.Function;
+              input Real points[:, :] "[i,:] is point i on the curve to be interpolated";
+              input Real param[size(points, 1)] "parameterization of the data points (not necessarily in the range 0..1)";
+              input Integer degree(min = 1) = 3 "Polynomial degree of interpolation";
+              output Real controlPoints[size(points, 1), size(points, 2)] "Control points";
+              output Real knots[size(points, 1) + degree + 1] "knots";
+            protected
+              Integer nknots = size(knots, 1);
+              Integer ndim = size(points, 2);
+              Integer npoints;
+              Integer knots_tech;
+              Real S[size(points, 1), size(points, 1)];
+              Real u;
+              Integer span;
+            algorithm
+/*
   The NURBS Book: Global Interpolation (page 364)
-  */
-              npoints := size(points,1);
-
-             // build the knots
-             //     1:  knots = parameter (for testing)
-             //     2:  knots are built with averaging
-             //     3:  knots equidistant (for testing)
-             knots_tech := 2;
-
-             if knots_tech == 1 then
-                knots[1:degree] := ones(degree)*param[1];
-                knots[degree+1:npoints+degree] := param;
-                knots[npoints+degree+1:npoints+2*degree] := ones(degree)*param[npoints];
-
-             end if;
-
-             if knots_tech == 2 then
-             // with averaging to avoid a singularity system of equation
-                knots[1:degree+1] := ones(degree+1)*param[1];
-                for j in 1:npoints-degree-1 loop
-                   knots[degree+j+1] := sum(param[j+1:j+degree])/degree;
-                end for;
-                knots[npoints+1:npoints+degree+1] := ones(degree+1)*param[npoints];
-
-             end if;
-
-             if knots_tech == 3 then
-                knots[1:degree+1] := ones(degree+1)*param[1];
-                for j in 1:npoints-1 loop
-                   knots[degree+j+1] := j/(npoints-1);
-                end for;
-                knots[npoints+degree+1:npoints+2*degree] := ones(degree)*param[npoints];
-
-             end if;
-
-             // build the equation system
-             S := zeros(npoints,npoints);
-
-             for i in 1:npoints loop
-               u := param[i];
-               span := n_findSpan(degree,u,knots);
-               S[i,span-degree:span] := n_BasisFuns(span,u,degree,knots);
-
-             end for;
-
-             // solve the equation system
-              controlPoints :=
-                ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.Modelica_Interpolation.Utilities.solveMatrix(
-                S, points);
-
-            end interpolation_raw;
-
-            function interpolationBessel
-              "Interpolation of the points with a Bspline of degree 3 and Bessel end condition"
-            //  import Modelica_Interpolation;
-              extends Modelica.Icons.Function;
-              input Real points[:, :]
-                "[i,:] is point i on the curve to be interpolated";
-              input Real param[size(points, 1)]
-                "parameterization of the data points (not necessarily in the range 0..1)";
-              output Data Bspline(
-                ndim=size(points, 2),
-                ncontrol=(size(points, 1) + 2),
-                degree=3) "Bspline in a form which can be quickly interpolated";
-            protected
-              Integer ndim=size(points, 2);
-              Real S[size(points,1)-2,size(points,1)-2];
-              Real u;
-              Real u2;
-              Real nik[4];
-              Real nik2[4];
-              Integer degree;
-              Real knots[size(points,1)+2*3];
-              Integer n_data;
-              Real alpha;
-              Real beta;
-              Real a[ndim];
-              Real rs[        ndim];
-              Real re[                 ndim];
-              Real p_vec[Bspline.ncontrol-4,Bspline.ndim];
-              Integer span;
-            algorithm
-              /*
+  */
+              npoints := size(points, 1);
+// build the knots
+//     1:  knots = parameter (for testing)
+//     2:  knots are built with averaging
+//     3:  knots equidistant (for testing)
+              knots_tech := 2;
+              if knots_tech == 1 then
+                knots[1:degree] := ones(degree) * param[1];
+                knots[degree + 1:npoints + degree] := param;
+                knots[npoints + degree + 1:npoints + 2 * degree] := ones(degree) * param[npoints];
+              end if;
+              if knots_tech == 2 then
+                knots[1:degree + 1] := ones(degree + 1) * param[1];
+                for j in 1:npoints - degree - 1 loop
+                  knots[degree + j + 1] := sum(param[j + 1:j + degree]) / degree;
+                end for;
+                knots[npoints + 1:npoints + degree + 1] := ones(degree + 1) * param[npoints];
+              end if;
+// with averaging to avoid a singularity system of equation
+              if knots_tech == 3 then
+                knots[1:degree + 1] := ones(degree + 1) * param[1];
+                for j in 1:npoints - 1 loop
+                  knots[degree + j + 1] := j / (npoints - 1);
+                end for;
+                knots[npoints + degree + 1:npoints + 2 * degree] := ones(degree) * param[npoints];
+              end if;
+// build the equation system
+              S := zeros(npoints, npoints);
+              for i in 1:npoints loop
+                u := param[i];
+                span := n_findSpan(degree, u, knots);
+                S[i, span - degree:span] := n_BasisFuns(span, u, degree, knots);
+              end for;
+// solve the equation system
+              controlPoints := ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.Modelica_Interpolation.Utilities.solveMatrix(S, points);
+            end interpolation_raw;
+
+            function interpolationBessel "Interpolation of the points with a Bspline of degree 3 and Bessel end condition"
+              //  import Modelica_Interpolation;
+              extends Modelica.Icons.Function;
+              input Real points[:, :] "[i,:] is point i on the curve to be interpolated";
+              input Real param[size(points, 1)] "parameterization of the data points (not necessarily in the range 0..1)";
+              output Data Bspline(ndim = size(points, 2), ncontrol = size(points, 1) + 2, degree = 3) "Bspline in a form which can be quickly interpolated";
+            protected
+              Integer ndim = size(points, 2);
+              Real S[size(points, 1) - 2, size(points, 1) - 2];
+              Real u;
+              Real u2;
+              Real nik[4];
+              Real nik2[4];
+              Integer degree;
+              Real knots[size(points, 1) + 2 * 3];
+              Integer n_data;
+              Real alpha;
+              Real beta;
+              Real a[ndim];
+              Real rs[ndim];
+              Real re[ndim];
+              Real p_vec[Bspline.ncontrol - 4, Bspline.ndim];
+              Integer span;
+            algorithm
+/*
   Farin: Curves and Surfaces for CAGD (page 157)
-  */
-              degree := 3;
-
-             n_data := size(points,1);
-
-             //build the knots
-
-             knots[1:degree] := ones(3)*param[1];
-             knots[degree+1:n_data+degree] := param;
-             knots[n_data+degree+1:n_data+2*degree] := ones(3)*param[n_data];
-
-              Bspline.controlPoints := zeros(n_data+2,Bspline.ndim);
-             Bspline.controlPoints[1,:] := points[1,:];
-             Bspline.controlPoints[n_data+2,:] := points[n_data,:];
-
-             alpha := (param[3]-param[2])/(param[3]-param[1]);
-             beta := 1-alpha;
-             a := (points[2,:] - (alpha^2)*points[1,:] - (beta^2)*points[3,:])/(2*alpha*beta);
-             Bspline.controlPoints[2,:] := (2/3)*(alpha*points[1,:] + beta*a) + points[1,:]/3;
-
-             alpha := (param[n_data-2]-param[n_data-1])/(param[n_data-2]-param[n_data]);
-             beta := (1-alpha);
-             a := (points[n_data-1,:] - (alpha^2)*points[n_data,:] - (beta^2)*points[n_data-2,:])/(2*alpha*beta);
-             Bspline.controlPoints[n_data+1,:] := (2/3)*(alpha*points[n_data,:] + beta*a) + points[n_data,:]/3;
-
-             // build the equation system
-             S := zeros(n_data-2,n_data-2);
-
-             u2 := param[2];
-             span := n_findSpan(degree,u2,knots);
-             nik2 := n_BasisFuns(span,u2,degree,knots);
-             S[1,1:2] := nik2[2:3];
-             rs := points[2,:] - Bspline.controlPoints[2,:]*nik2[1];
-
-             for i in 1:n_data-4 loop
-               u := param[i+2];
-               span := n_findSpan(degree,u,knots);
-              nik := n_BasisFuns(span,u,degree,knots);
-               S[i+1,i:i+2] := nik[1:3];
-
-             end for;
-             u := param[n_data-1];
-             span := n_findSpan(degree,u,knots);
-             nik := n_BasisFuns(span,u,degree,knots);
-             S[n_data-2,n_data-3:n_data-2] := nik[1:2];
-
-             re := points[n_data-1,:] - Bspline.controlPoints[n_data+1,:]*nik[3];
-             p_vec[1,:] := rs;
-             p_vec[2:n_data-3,:] := points[3:n_data-2,:];
-             p_vec[n_data-2,:] := re;
-
-             // solve the equation system
-              Bspline.controlPoints[3:n_data, :] :=
-                ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.Modelica_Interpolation.Utilities.solveMatrix(
-                S, p_vec);
-
-             Bspline.knots := knots;
-
-            end interpolationBessel;
-
-            function interpolationder
-              "Interpolation of the points and its first derivatives with a Bspline of degree n"
-            //  import Modelica_Interpolation;
-              extends Modelica.Icons.Function;
-              input Real points[:, :]
-                "[i,:] is point i on the curve to be interpolated";
-              input Real derivs[size(points,1), size(points,2)]
-                "derivs[i,:] is the derivative at points[i,:]";
-              input Real param[size(points, 1)]
-                "parameterization of the data points (not necessarily in the range 0..1)";
-              input Integer degree(min=2) = 3
-                "Polynomial degree of interpolation";
-              output Data spline(
-                ndim=size(points, 2),
-                ncontrol=2*size(points, 1),
-                degree=degree)
-                "Bspline in a form which can be quickly interpolated";
-            protected
-              Integer nknots=size(spline.knots, 1);
-              Integer ndim=size(points, 2);
-              Integer npoints;
-              Integer i;
-              Integer k;
-              Real S[2*size(points,1),2*size(points,1)];
-              Real u;
-              Real b[2*size(points,1),size(points, 2)];
-              Integer span;
-              Real N[2,degree+1];
-            algorithm
-              /*
+  */
+              degree := 3;
+              n_data := size(points, 1);
+//build the knots
+              knots[1:degree] := ones(3) * param[1];
+              knots[degree + 1:n_data + degree] := param;
+              knots[n_data + degree + 1:n_data + 2 * degree] := ones(3) * param[n_data];
+              Bspline.controlPoints := zeros(n_data + 2, Bspline.ndim);
+              Bspline.controlPoints[1, :] := points[1, :];
+              Bspline.controlPoints[n_data + 2, :] := points[n_data, :];
+              alpha := (param[3] - param[2]) / (param[3] - param[1]);
+              beta := 1 - alpha;
+              a := (points[2, :] - alpha ^ 2 * points[1, :] - beta ^ 2 * points[3, :]) / (2 * alpha * beta);
+              Bspline.controlPoints[2, :] := 2 / 3 * (alpha * points[1, :] + beta * a) + points[1, :] / 3;
+              alpha := (param[n_data - 2] - param[n_data - 1]) / (param[n_data - 2] - param[n_data]);
+              beta := 1 - alpha;
+              a := (points[n_data - 1, :] - alpha ^ 2 * points[n_data, :] - beta ^ 2 * points[n_data - 2, :]) / (2 * alpha * beta);
+              Bspline.controlPoints[n_data + 1, :] := 2 / 3 * (alpha * points[n_data, :] + beta * a) + points[n_data, :] / 3;
+// build the equation system
+              S := zeros(n_data - 2, n_data - 2);
+              u2 := param[2];
+              span := n_findSpan(degree, u2, knots);
+              nik2 := n_BasisFuns(span, u2, degree, knots);
+              S[1, 1:2] := nik2[2:3];
+              rs := points[2, :] - Bspline.controlPoints[2, :] * nik2[1];
+              for i in 1:n_data - 4 loop
+                u := param[i + 2];
+                span := n_findSpan(degree, u, knots);
+                nik := n_BasisFuns(span, u, degree, knots);
+                S[i + 1, i:i + 2] := nik[1:3];
+              end for;
+              u := param[n_data - 1];
+              span := n_findSpan(degree, u, knots);
+              nik := n_BasisFuns(span, u, degree, knots);
+              S[n_data - 2, n_data - 3:n_data - 2] := nik[1:2];
+              re := points[n_data - 1, :] - Bspline.controlPoints[n_data + 1, :] * nik[3];
+              p_vec[1, :] := rs;
+              p_vec[2:n_data - 3, :] := points[3:n_data - 2, :];
+              p_vec[n_data - 2, :] := re;
+// solve the equation system
+              Bspline.controlPoints[3:n_data, :] := ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.Modelica_Interpolation.Utilities.solveMatrix(S, p_vec);
+              Bspline.knots := knots;
+            end interpolationBessel;
+
+            function interpolationder "Interpolation of the points and its first derivatives with a Bspline of degree n"
+              //  import Modelica_Interpolation;
+              extends Modelica.Icons.Function;
+              input Real points[:, :] "[i,:] is point i on the curve to be interpolated";
+              input Real derivs[size(points, 1), size(points, 2)] "derivs[i,:] is the derivative at points[i,:]";
+              input Real param[size(points, 1)] "parameterization of the data points (not necessarily in the range 0..1)";
+              input Integer degree(min = 2) = 3 "Polynomial degree of interpolation";
+              output Data spline(ndim = size(points, 2), ncontrol = 2 * size(points, 1), degree = degree) "Bspline in a form which can be quickly interpolated";
+            protected
+              Integer nknots = size(spline.knots, 1);
+              Integer ndim = size(points, 2);
+              Integer npoints;
+              Integer i;
+              Integer k;
+              Real S[2 * size(points, 1), 2 * size(points, 1)];
+              Real u;
+              Real b[2 * size(points, 1), size(points, 2)];
+              Integer span;
+              Real N[2, degree + 1];
+            algorithm
+/*
   The NURBS Book: Global Interpolation (page 373)
 
-  */
-              npoints := size(points,1);
-
-             // compute the knots
-             // the goal is a banded linear system
-
-             k :=  integer(degree/2);
-             spline.knots[1:degree+1] := ones(degree+1)*param[1];
-
-             if degree == 2*k then
-               //degree is even
-               k := k-1;
-
-               for j in 1:k loop
-               spline.knots[degree+1+j] := param[j+1];
-
-              end for;
-
-              for j in 1:npoints-(k+1) loop
-                spline.knots[degree+k+2*j] := (param[j+k]+param[j+k+1])/2;
-                spline.knots[degree+k+2*j+1] := param[j+k+1];
-
-              end for;
-
-              for j in 1:k loop
-               spline.knots[2*npoints-k+j] := param[npoints-k+j-1];
-
-              end for;
-
-             else
-               //degree is odd
-
-              for j in 1:k loop
-               spline.knots[degree+1+j] := spline.knots[degree+1] + j*(param[k+1]-param[1])/k;
-
-              end for;
-
-              for j in 1:npoints-(k+1) loop
-                spline.knots[degree+k+2*j] := (2*param[j+k]+param[j+k+1])/3;
-                spline.knots[degree+k+2*j+1] := (param[j+k]+2*param[j+k+1])/3;
-
-              end for;
-
-              for j in 1:k loop
-               spline.knots[2*npoints-k+j] := spline.knots[2*npoints-k] + j*(param[npoints]-param[npoints-k])/k;
-
-              end for;
-
-             end if;
-
-             spline.knots[2*npoints+1:2*npoints+degree+1] := ones(degree+1)*param[npoints];
-
-             // build the equation system
-             S := zeros(2*npoints,2*npoints);
-
-             for i in 1:npoints loop
-               u := param[i];
-               span := n_findSpan(spline.degree,u,spline.knots);
-               N := Utilities.n_DersBasisFuns(span,u,spline.degree,1,spline.knots);
-               S[2*i-1:2*i,span-spline.degree:span] := N;
-               b[2*i-1,:] := points[i,:];
-              b[2*i,:] := derivs[i,:];
-
-             end for;
-
-             // solve the equation system
-              spline.controlPoints :=
-                ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.Modelica_Interpolation.Utilities.solveMatrix(
-                S, b);
-            end interpolationder;
-
-            function n_BasisFuns "Compute the nonvanishing basis functions"
-             extends Modelica.Icons.Function;
-              input Integer i "index";
-              input Real u "parameter";
-              input Integer p "degree";
-              input Real knots[:] "knot vector";
-              output Real N[p+1] "Basis functions";
-            protected
-              Integer j;
-              Integer r;
-              Real left[p+1];
-              Real right[p+1];
-              Real temp;
-              Real saved;
-            algorithm
-             /*
+  */
+              npoints := size(points, 1);
+// compute the knots
+// the goal is a banded linear system
+              k := integer(degree / 2);
+              spline.knots[1:degree + 1] := ones(degree + 1) * param[1];
+              if degree == 2 * k then
+                k := k - 1;
+                for j in 1:k loop
+                  spline.knots[degree + 1 + j] := param[j + 1];
+                end for;
+                for j in 1:npoints - (k + 1) loop
+                  spline.knots[degree + k + 2 * j] := (param[j + k] + param[j + k + 1]) / 2;
+                  spline.knots[degree + k + 2 * j + 1] := param[j + k + 1];
+                end for;
+                for j in 1:k loop
+                  spline.knots[2 * npoints - k + j] := param[npoints - k + j - 1];
+                end for;
+              else
+                for j in 1:k loop
+                  spline.knots[degree + 1 + j] := spline.knots[degree + 1] + j * (param[k + 1] - param[1]) / k;
+                end for;
+                for j in 1:npoints - (k + 1) loop
+                  spline.knots[degree + k + 2 * j] := (2 * param[j + k] + param[j + k + 1]) / 3;
+                  spline.knots[degree + k + 2 * j + 1] := (param[j + k] + 2 * param[j + k + 1]) / 3;
+                end for;
+                for j in 1:k loop
+                  spline.knots[2 * npoints - k + j] := spline.knots[2 * npoints - k] + j * (param[npoints] - param[npoints - k]) / k;
+                end for;
+              end if;
+//degree is even
+//degree is odd
+              spline.knots[2 * npoints + 1:2 * npoints + degree + 1] := ones(degree + 1) * param[npoints];
+// build the equation system
+              S := zeros(2 * npoints, 2 * npoints);
+              for i in 1:npoints loop
+                u := param[i];
+                span := n_findSpan(spline.degree, u, spline.knots);
+                N := Utilities.n_DersBasisFuns(span, u, spline.degree, 1, spline.knots);
+                S[2 * i - 1:2 * i, span - spline.degree:span] := N;
+                b[2 * i - 1, :] := points[i, :];
+                b[2 * i, :] := derivs[i, :];
+              end for;
+// solve the equation system
+              spline.controlPoints := ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.Modelica_Interpolation.Utilities.solveMatrix(S, b);
+            end interpolationder;
+
+            function n_BasisFuns "Compute the nonvanishing basis functions"
+              extends Modelica.Icons.Function;
+              input Integer i "index";
+              input Real u "parameter";
+              input Integer p "degree";
+              input Real knots[:] "knot vector";
+              output Real N[p + 1] "Basis functions";
+            protected
+              Integer j;
+              Integer r;
+              Real left[p + 1];
+              Real right[p + 1];
+              Real temp;
+              Real saved;
+            algorithm
+/*
   The NURBS Book: Algorithm A2.2 (page 70)
-  */
-              N[1] := 1;
-              for j in 1:p loop
-               left[j] := u - knots[i+1-j];
-               right[j] := knots[i+j] - u;
-               saved := 0.0;
-
-               for r in 1:j loop
-                temp := N[r]/(right[r]+left[j-r+1]);
-                N[r] := saved + right[r]*temp;
-                saved := left[j-r+1]*temp;
-
-              end for;
-              N[j+1] := saved;
-              end for;
-            end n_BasisFuns;
-
-            function n_DersBasisFuns
-              "Compute nonzero basis functions and their derivatives"
-             extends Modelica.Icons.Function;
-              input Integer i "index";
-              input Real u "parameter";
-              input Integer p "degree";
-              input Integer n "n-th derivative";
-              input Real knots[:] "knot vector";
-              output Real ders[n+1,p+1] "ders[k,:] is (k-1)-th derivative";
-            protected
-              Integer j;
-              Integer r;
-              Real left[p+1];
-              Real right[p+1];
-              Real temp;
-              Real saved;
-              Real ndu[p+1,p+1];
-              Integer s1;
-              Integer s2;
-              Integer j1;
-              Integer j2;
-              Real a[2,p+1];
-              Real d;
-              Integer rk;
-              Integer pk;
-              Integer prod;
-              Integer tt;
-            algorithm
-             /*
+  */
+              N[1] := 1;
+              for j in 1:p loop
+                left[j] := u - knots[i + 1 - j];
+                right[j] := knots[i + j] - u;
+                saved := 0.0;
+                for r in 1:j loop
+                  temp := N[r] / (right[r] + left[j - r + 1]);
+                  N[r] := saved + right[r] * temp;
+                  saved := left[j - r + 1] * temp;
+                end for;
+                N[j + 1] := saved;
+              end for;
+            end n_BasisFuns;
+
+            function n_DersBasisFuns "Compute nonzero basis functions and their derivatives"
+              extends Modelica.Icons.Function;
+              input Integer i "index";
+              input Real u "parameter";
+              input Integer p "degree";
+              input Integer n "n-th derivative";
+              input Real knots[:] "knot vector";
+              output Real ders[n + 1, p + 1] "ders[k,:] is (k-1)-th derivative";
+            protected
+              Integer j;
+              Integer r;
+              Real left[p + 1];
+              Real right[p + 1];
+              Real temp;
+              Real saved;
+              Real ndu[p + 1, p + 1];
+              Integer s1;
+              Integer s2;
+              Integer j1;
+              Integer j2;
+              Real a[2, p + 1];
+              Real d;
+              Integer rk;
+              Integer pk;
+              Integer prod;
+              Integer tt;
+            algorithm
+/*
   The NURBS Book: Algorithm A2.3 (page 72)
-  */
-              ndu[1,1] := 1;
-              for j in 1:p loop
-               left[j] := u - knots[i+1-j];
-               right[j] := knots[i+j] - u;
-               saved := 0.0;
-
-               for r in 1:j loop
-                ndu[j+1,r] := right[r]+left[j-r+1];
-                temp := ndu[r,j]/ndu[j+1,r];
-                ndu[r,j+1] := saved + right[r]*temp;
-                saved := left[j-r+1]*temp;
-
-              end for;
-              ndu[j+1,j+1] := saved;
-              end for;
-
-              for j in 1:p+1 loop
-               ders[1,j] := ndu[j,p+1];
-              end for;
-
-              for r in 1:p+1 loop
-               s1 := 1;
-               s2 := 2;
-               a[1,1] := 1.0;
-
-               for k in 1:n loop
-                d := 0.0;
-                rk := r-k-1;
-                pk := p-k;
-
-                if r-1>=k then
-                 a[s2,1] := a[s1,1]/ndu[pk+2,rk+1];
-                 d := a[s2,1]*ndu[rk+1,pk+1];
-
-                end if;
-
-                if rk >= -1 then
-                 j1 :=1;
-
-                else
-                 j1 :=-rk;
-
-                end if;
-
-                if r-1 <= pk+1 then
-                 j2 := k-1;
-
-                else
-                 j2 := p-r+1;
-
-                end if;
-
-                for j in j1:j2 loop
-                 a[s2,j+1] :=(a[s1, j + 1] - a[s1, j])/ndu[pk + 2, rk + j + 1];
-                 d :=d + a[s2, j + 1]*ndu[rk + j + 1, pk + 1];
-
-                end for;
-
-                if r-1 <= pk then
-                 a[s2,k+1] := -a[s1,k]/ndu[pk+2,r];
-                 d := d + a[s2,k+1]*ndu[r,pk+1];
-
-                end if;
-
-                ders[k+1,r] := d;
-                tt := s1;
-                s1 := s2;
-                s2 := tt;
-
-               end for;
-              end for;
-
-              prod := p;
-
-             for k in 1:n loop
-
-               for j in 1:p+1 loop
-                ders[k+1,j] := ders[k+1,j]*prod;
-
-               end for;
-               prod := prod*(p-k);
-
-             end for;
-
-            end n_DersBasisFuns;
-
-            function n_findSpan "Determine the knot span index"
-             extends Modelica.Icons.Function;
-              input Integer p "degree";
-              input Real u "parameter";
-              input Real knots[:] "knot vector";
-              output Integer i "The knot span index";
-            protected
-              Integer n;
-              Integer low;
-              Integer high;
-              Integer mid;
-            algorithm
-             /*
+  */
+              ndu[1, 1] := 1;
+              for j in 1:p loop
+                left[j] := u - knots[i + 1 - j];
+                right[j] := knots[i + j] - u;
+                saved := 0.0;
+                for r in 1:j loop
+                  ndu[j + 1, r] := right[r] + left[j - r + 1];
+                  temp := ndu[r, j] / ndu[j + 1, r];
+                  ndu[r, j + 1] := saved + right[r] * temp;
+                  saved := left[j - r + 1] * temp;
+                end for;
+                ndu[j + 1, j + 1] := saved;
+              end for;
+              for j in 1:p + 1 loop
+                ders[1, j] := ndu[j, p + 1];
+              end for;
+              for r in 1:p + 1 loop
+                s1 := 1;
+                s2 := 2;
+                a[1, 1] := 1.0;
+                for k in 1:n loop
+                  d := 0.0;
+                  rk := r - k - 1;
+                  pk := p - k;
+                  if r - 1 >= k then
+                    a[s2, 1] := a[s1, 1] / ndu[pk + 2, rk + 1];
+                    d := a[s2, 1] * ndu[rk + 1, pk + 1];
+                  end if;
+                  if rk >= (-1) then
+                    j1 := 1;
+                  else
+                    j1 := -rk;
+                  end if;
+                  if r - 1 <= pk + 1 then
+                    j2 := k - 1;
+                  else
+                    j2 := p - r + 1;
+                  end if;
+                  for j in j1:j2 loop
+                    a[s2, j + 1] := (a[s1, j + 1] - a[s1, j]) / ndu[pk + 2, rk + j + 1];
+                    d := d + a[s2, j + 1] * ndu[rk + j + 1, pk + 1];
+                  end for;
+                  if r - 1 <= pk then
+                    a[s2, k + 1] := -a[s1, k] / ndu[pk + 2, r];
+                    d := d + a[s2, k + 1] * ndu[r, pk + 1];
+                  end if;
+                  ders[k + 1, r] := d;
+                  tt := s1;
+                  s1 := s2;
+                  s2 := tt;
+                end for;
+              end for;
+              prod := p;
+              for k in 1:n loop
+                for j in 1:p + 1 loop
+                  ders[k + 1, j] := ders[k + 1, j] * prod;
+                end for;
+                prod := prod * (p - k);
+              end for;
+            end n_DersBasisFuns;
+
+            function n_findSpan "Determine the knot span index"
+              extends Modelica.Icons.Function;
+              input Integer p "degree";
+              input Real u "parameter";
+              input Real knots[:] "knot vector";
+              output Integer i "The knot span index";
+            protected
+              Integer n;
+              Integer low;
+              Integer high;
+              Integer mid;
+            algorithm
+/*
   The NURBS Book: Algorithm A2.1 (page 68)
-  */
-              n:=size(knots,1)-p-1;
-
-             if abs(u-knots[n+1])<10e-12 then
-              i := n;
-
-             else
-              low := p;
-              high := n+1;
-              mid := integer((low+high)/2);
-
-              while
-                   (u<knots[mid] or u>=knots[mid+1]) loop
-                   assert(low+1<high,"Value must be within limits for Bspline1D.Utilities.n_findSpan");
-
-               if (u<knots[mid]) then
-                 high := mid;
-
-               else
-                 low := mid;
-
-               end if;
-               mid := integer((low+high)/2);
-
-              end while;
-              i := mid;
-
-             end if;
-            end n_findSpan;
-
-            function norm "The euklidian norm of a vector"
-             extends Modelica.Icons.Function;
-              input Real v[:] "A vector";
-              output Real n "The norm of the vector";
-            algorithm
-              n:=sqrt(v*v);
-            end norm;
-          annotation (
-            Window(
-              x=0.45,
-              y=0.01,
-              width=0.44,
-              height=0.65,
-              library=1,
-              autolayout=1),
-            Documentation(info="<HTML>
+  */
+              n := size(knots, 1) - p - 1;
+              if abs(u - knots[n + 1]) < 10e-12 then
+                i := n;
+              else
+                low := p;
+                high := n + 1;
+                mid := integer((low + high) / 2);
+                while u < knots[mid] or u >= knots[mid + 1] loop
+                  assert(low + 1 < high, "Value must be within limits for Bspline1D.Utilities.n_findSpan");
+                  if u < knots[mid] then
+                    high := mid;
+                  else
+                    low := mid;
+                  end if;
+                  mid := integer((low + high) / 2);
+                end while;
+                i := mid;
+              end if;
+            end n_findSpan;
+
+            function norm "The euklidian norm of a vector"
+              extends Modelica.Icons.Function;
+              input Real v[:] "A vector";
+              output Real n "The norm of the vector";
+            algorithm
+              n := sqrt(v * v);
+            end norm;
+            annotation(
+              Window(x = 0.45, y = 0.01, width = 0.44, height = 0.65, library = 1, autolayout = 1),
+              Documentation(info = "<HTML>
 <p>
 Utility functions are provided here which are usually not called directly
 by a user, but are needed in the functions of this package
@@ -4057,17 +2714,11 @@
 Modelica in file \"Modelica/package.mo\".
 </i></p>
 </HTML>
-"));
-          end Utilities;
-        annotation (
-          Window(
-            x=0.45,
-            y=0.01,
-            width=0.44,
-            height=0.65,
-            library=1,
-            autolayout=1),
-          Documentation(info="<HTML>
+              "));
+          end Utilities;
+          annotation(
+            Window(x = 0.45, y = 0.01, width = 0.44, height = 0.65, library = 1, autolayout = 1),
+            Documentation(info = "<HTML>
 <p>
 With this package 1-dimensional interpolation with B-Splines
 is performed.
@@ -4103,124 +2754,114 @@
 Modelica in file \"Modelica/package.mo\".
 </i></p>
 </HTML>
-"));
-        end Bspline1D;
-
-        package Utilities "Utility functions for package Interpolation"
-        extends Modelica.Icons.Library;
-
-          function curveLength "Computes the length of the curve from a to b"
-            import
-              ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.Modelica_Interpolation;
-           extends Modelica.Icons.Function;
-           input Modelica_Interpolation.Bspline1D.Data                                         spline
-              "Bspline data";
-           input Real a "left end";
-           input Real b "right end";
-           input Real err = 1e-8 "relative error";
-           output Real I "curve length from a to b";
-
-          protected
-            Real m;
-            Real h;
-            Real alpha;
-            Real beta;
-            Real x1 = 0.942882415695480;
-            Real x2 = 0.641853342345781;
-            Real x3 = 0.236383199662150;
-           Real x[13];
-           Real y[13];
-           Real fa;
-           Real fb;
-           Real i1;
-           Real i2;
-           Real is;
-           Real erri1;
-           Real erri2;
-           Real R;
-           Real tol;
-           Real eps = 1e-16;
-           Integer s;
-
-          package internal "Funtions to be used only in function curveLength"
-              import
-                ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.Modelica_Interpolation;
-
-           function quadStep "Recursive function used by curveLength"
-            input ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.Modelica_Interpolation.Bspline1D.Data
-                  spline;
-            input Real a "right interval end";
-            input Real b "left interval end";
-            input Real fa "function value at a";
-            input Real fb "function value at b";
-            input Real is "first approximation of the integral";
-            output Real I "Integral value";
-              protected
-            Real m;
-            Real h;
-            Real alpha;
-            Real beta;
-            Real x[5];
-            Real y[5];
-            Real mll;
-            Real ml;
-            Real mr;
-            Real mrr;
-            Real fmll;
-            Real fml;
-            Real fm;
-            Real fmr;
-            Real fmrr;
-            Real i1;
-            Real i2;
-           algorithm
-             h := (b-a)/2; m := (a+b)/2;
-             alpha := sqrt(2/3); beta := 1/sqrt(5);
-             mll := m-alpha*h; ml := m-beta*h; mr := m+beta*h; mrr := m+alpha*h;
-             x := {mll,ml,m,mr,mrr};
-             y := eval(spline,x);
-             fmll := y[1]; fml := y[2]; fm := y[3]; fmr := y[4]; fmrr := y[5];
-             i2 := (h/6)*(fa+fb+5*(fml+fmr));
-             i1 := (h/1470)*(77*(fa+fb)+432*(fmll+fmrr)+625*(fml+fmr)
-                +672*fm);
-
-             if
-               (is+(i1-i2)==is) or (mll<=a) or (b<=mrr) then
-               I := i1;
-
-             else
-               I := quadStep(spline,a,mll,fa,fmll,is)+
-                 quadStep(spline,mll,ml,fmll,fml,is)+
-                 quadStep(spline,ml,m,fml,fm,is)+
-                 quadStep(spline,m,mr,fm,fmr,is)+
-                 quadStep(spline,mr,mrr,fmr,fmrr,is)+
-                 quadStep(spline,mrr,b,fmrr,fb,is);
-
-             end if;
-           end quadStep;
-
-           function eval "evaluate the integrand"
-             input Modelica_Interpolation.Bspline1D.Data spline "Bspline data";
-             input Real u[:]
-                  "parameters at which the integrand shall be evaluated";
-             output Real f[size(u,1)];
-              protected
-             Real xd[spline.ndim];
-             Integer n;
-           algorithm
-             //the integrand is sqrt(xd*xd) (where xd is the first derivative)
-            n := size(u,1);
-
-            for i in 1:n loop
-              xd := Modelica_Interpolation.Bspline1D.evaluateDerN(spline,u[i],1);
-             f[i] := sqrt(xd*xd);
-
-            end for;
-           end eval;
-          end internal;
-
-          algorithm
-           /*
+            "));
+        end Bspline1D;
+
+        package Utilities "Utility functions for package Interpolation"
+          extends Modelica.Icons.Package;
+
+          function curveLength "Computes the length of the curve from a to b"
+            import ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.Modelica_Interpolation;
+            extends Modelica.Icons.Function;
+            input Modelica_Interpolation.Bspline1D.Data spline "Bspline data";
+            input Real a "left end";
+            input Real b "right end";
+            input Real err = 1e-8 "relative error";
+            output Real I "curve length from a to b";
+          protected
+            Real m;
+            Real h;
+            Real alpha;
+            Real beta;
+            Real x1 = 0.942882415695480;
+            Real x2 = 0.641853342345781;
+            Real x3 = 0.236383199662150;
+            Real x[13];
+            Real y[13];
+            Real fa;
+            Real fb;
+            Real i1;
+            Real i2;
+            Real is;
+            Real erri1;
+            Real erri2;
+            Real R;
+            Real tol;
+            Real eps = 1e-16;
+            Integer s;
+
+            package internal "Funtions to be used only in function curveLength"
+              import ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.Modelica_Interpolation;
+
+              function quadStep "Recursive function used by curveLength"
+                input ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.Modelica_Interpolation.Bspline1D.Data spline;
+                input Real a "right interval end";
+                input Real b "left interval end";
+                input Real fa "function value at a";
+                input Real fb "function value at b";
+                input Real is "first approximation of the integral";
+                output Real I "Integral value";
+              protected
+                Real m;
+                Real h;
+                Real alpha;
+                Real beta;
+                Real x[5];
+                Real y[5];
+                Real mll;
+                Real ml;
+                Real mr;
+                Real mrr;
+                Real fmll;
+                Real fml;
+                Real fm;
+                Real fmr;
+                Real fmrr;
+                Real i1;
+                Real i2;
+              algorithm
+                h := (b - a) / 2;
+                m := (a + b) / 2;
+                alpha := sqrt(2 / 3);
+                beta := 1 / sqrt(5);
+                mll := m - alpha * h;
+                ml := m - beta * h;
+                mr := m + beta * h;
+                mrr := m + alpha * h;
+                x := {mll, ml, m, mr, mrr};
+                y := eval(spline, x);
+                fmll := y[1];
+                fml := y[2];
+                fm := y[3];
+                fmr := y[4];
+                fmrr := y[5];
+                i2 := h / 6 * (fa + fb + 5 * (fml + fmr));
+                i1 := h / 1470 * (77 * (fa + fb) + 432 * (fmll + fmrr) + 625 * (fml + fmr) + 672 * fm);
+                if is + i1 - i2 == is or mll <= a or b <= mrr then
+                  I := i1;
+                else
+                  I := quadStep(spline, a, mll, fa, fmll, is) + quadStep(spline, mll, ml, fmll, fml, is) + quadStep(spline, ml, m, fml, fm, is) + quadStep(spline, m, mr, fm, fmr, is) + quadStep(spline, mr, mrr, fmr, fmrr, is) + quadStep(spline, mrr, b, fmrr, fb, is);
+                end if;
+              end quadStep;
+
+              function eval "evaluate the integrand"
+                input Modelica_Interpolation.Bspline1D.Data spline "Bspline data";
+                input Real u[:] "parameters at which the integrand shall be evaluated";
+                output Real f[size(u, 1)];
+              protected
+                Real xd[spline.ndim];
+                Integer n;
+              algorithm
+//the integrand is sqrt(xd*xd) (where xd is the first derivative)
+                n := size(u, 1);
+                for i in 1:n loop
+                  xd := Modelica_Interpolation.Bspline1D.evaluateDerN(spline, u[i], 1);
+                  f[i] := sqrt(xd * xd);
+                end for;
+              end eval;
+            end internal;
+          algorithm
+/*
         Numerically evaluate integral using adaptive
         Lobatto rule.
         see Walter Gander: Adaptive Quadrature - Revisited, 1998
@@ -4230,58 +2871,56 @@
         y[:] = f(x[:]) are function values at the nodes
                 here (arc length computation): the integrand f is the
                 absolute value of the first derivative of the curve (Bspline)
-        */
-           tol := err;
-            m := (a+b)/2; h:=(b - a)/2;
-            alpha := sqrt(2/3); beta:=1/sqrt(5);
-            x := {a,m-x1*h,m-alpha*h,m-x2*h,m-beta*h,m-x3*h,m,m+x3*h,
-                  m+beta*h,m+x2*h,m+alpha*h,m+x1*h,b};
-            y := internal.eval(spline,x);
-            fa := y[1]; fb := y[13];
-            i2 := (h/6)*(y[1]+y[13]+5*(y[5]+y[9]));
-            i1 := (h/1470)*(77*(y[1]+y[13])+432*(y[3]+y[11])+
-               625*(y[5]+y[9])+672*y[7]);
-            is := h*(0.0158271919734802*(y[1]+y[13])+0.0942738402188500
-               *(y[2]+y[12])+0.155071987336585*(y[3]+y[11])+0.188821573960182
-                               *(y[4]+y[10])+0.199773405226859
-               *(y[5]+y[9])+0.224926465333340*(y[6]+y[8])
-               +0.242611071901408*y[7]);
-            s := sign(is);
-            if
-              (s==0) then s := 1; end if;
-            erri1 := abs(i1-is);
-            erri2 := abs(i2-is);
-            R := 1;
-            if
-              (erri2<>0) then R := erri1/erri2; end if;
-            if
-              (R>0 and R<1) then tol := tol/R; end if;
-            is := s*abs(is)*tol/eps;
-            if
-              (is==0) then is := b-a; end if;
-            I := internal.quadStep(spline,a,b,fa,fb,is);
-
-          end curveLength;
-
-          function dgbsv
-            "Solve real system of linear equations A*X=B with a banded A matrix and a B matrix (copy from protected package Matrices.Lapack)"
-            extends Modelica.Icons.Function;
-                input Integer n "Number of equations";
-                input Integer kLower "Number of lower bands";
-                input Integer kUpper "Number of upper bands";
-                input Real A[2*kLower + kUpper + 1, n];
-                input Real B[n, :];
-                output Real X[n, size(B, 2)]=B;
-                output Integer info;
-
-          protected
-                Real Awork[size(A, 1), size(A, 2)]=A;
-                Integer ipiv[n];
-
-              external "FORTRAN 77" dgbsv(n, kLower, kUpper, size(B, 2), Awork, size(
-                  Awork, 1), ipiv, X, n, info) annotation (Library="Lapack");
-                annotation (
-                  Documentation(info="Lapack documentation:
+        */
+            tol := err;
+            m := (a + b) / 2;
+            h := (b - a) / 2;
+            alpha := sqrt(2 / 3);
+            beta := 1 / sqrt(5);
+            x := {a, m - x1 * h, m - alpha * h, m - x2 * h, m - beta * h, m - x3 * h, m, m + x3 * h, m + beta * h, m + x2 * h, m + alpha * h, m + x1 * h, b};
+            y := internal.eval(spline, x);
+            fa := y[1];
+            fb := y[13];
+            i2 := h / 6 * (y[1] + y[13] + 5 * (y[5] + y[9]));
+            i1 := h / 1470 * (77 * (y[1] + y[13]) + 432 * (y[3] + y[11]) + 625 * (y[5] + y[9]) + 672 * y[7]);
+            is := h * (0.0158271919734802 * (y[1] + y[13]) + 0.0942738402188500 * (y[2] + y[12]) + 0.155071987336585 * (y[3] + y[11]) + 0.188821573960182 * (y[4] + y[10]) + 0.199773405226859 * (y[5] + y[9]) + 0.224926465333340 * (y[6] + y[8]) + 0.242611071901408 * y[7]);
+            s := sign(is);
+            if s == 0 then
+              s := 1;
+            end if;
+            erri1 := abs(i1 - is);
+            erri2 := abs(i2 - is);
+            R := 1;
+            if erri2 <> 0 then
+              R := erri1 / erri2;
+            end if;
+            if R > 0 and R < 1 then
+              tol := tol / R;
+            end if;
+            is := s * abs(is) * tol / eps;
+            if is == 0 then
+              is := b - a;
+            end if;
+            I := internal.quadStep(spline, a, b, fa, fb, is);
+          end curveLength;
+
+          function dgbsv "Solve real system of linear equations A*X=B with a banded A matrix and a B matrix (copy from protected package Matrices.Lapack)"
+            extends Modelica.Icons.Function;
+            input Integer n "Number of equations";
+            input Integer kLower "Number of lower bands";
+            input Integer kUpper "Number of upper bands";
+            input Real A[2 * kLower + kUpper + 1, n];
+            input Real B[n, :];
+            output Real X[n, size(B, 2)] = B;
+            output Integer info;
+          protected
+            Real Awork[size(A, 1), size(A, 2)] = A;
+            Integer ipiv[n];
+          
+            external "FORTRAN 77" dgbsv(n, kLower, kUpper, size(B, 2), Awork, size(Awork, 1), ipiv, X, n, info) annotation(
+              Library = "Lapack");
+            annotation(
+              Documentation(info = "Lapack documentation:
 Purpose
 =======
 DGBSV computes the solution to a real system of linear equations
@@ -4344,29 +2983,24 @@
    a31  a42  a53  a64   *    *      m31  m42  m53  m64   *    *
 Array elements marked * are not used by the routine; elements marked
 + need not be set on entry, but are required by the routine to store
-elements of U because of fill-in resulting from the row interchanges."),
-                  Window(
-                    x=0.4,
-                    y=0.4,
-                    width=0.6,
-                    height=0.6));
-          end dgbsv;
-
-          function dgesv
-            "Solve real system of linear equations A*X=B with a B matrix (copy from protected package Matrices.Lapack)"
-            extends Modelica.Icons.Function;
-            input Real A[:, size(A, 1)];
-            input Real B[size(A, 1), :];
-            output Real X[size(A, 1), size(B, 2)]=B;
-            output Integer info;
-          protected
-            Real Awork[size(A, 1), size(A, 1)]=A;
-            Integer ipiv[size(A, 1)];
-
-          external "FORTRAN 77" dgesv(size(A, 1), size(B, 2), Awork, size(A, 1), ipiv,
-               X, size(A, 1), info) annotation (Library="Lapack");
-            annotation (
-              Documentation(info="Lapack documentation:
+elements of U because of fill-in resulting from the row interchanges."),
+              Window(x = 0.4, y = 0.4, width = 0.6, height = 0.6));
+          end dgbsv;
+
+          function dgesv "Solve real system of linear equations A*X=B with a B matrix (copy from protected package Matrices.Lapack)"
+            extends Modelica.Icons.Function;
+            input Real A[:, size(A, 1)];
+            input Real B[size(A, 1), :];
+            output Real X[size(A, 1), size(B, 2)] = B;
+            output Integer info;
+          protected
+            Real Awork[size(A, 1), size(A, 1)] = A;
+            Integer ipiv[size(A, 1)];
+          
+            external "FORTRAN 77" dgesv(size(A, 1), size(B, 2), Awork, size(A, 1), ipiv, X, size(A, 1), info) annotation(
+              Library = "Lapack");
+            annotation(
+              Documentation(info = "Lapack documentation:
     Purpose
     =======
     DGESV computes the solution to a real system of linear equations
@@ -4408,278 +3042,205 @@
 
                   has been completed, but the factor U is exactly
                   singular, so the solution could not be computed.
-"),           Window(
-                x=0.4,
-                y=0.4,
-                width=0.6,
-                height=0.6));
-          end dgesv;
-
-          function dummy "Dummy Bspline"
-            // import Modelica_Interpolation;
-           extends Modelica.Icons.Function;
-            input Integer nd "Dimension";
-            input Integer nc "Number of control points";
-            input Integer deg "degree";
-            output
-              ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.Modelica_Interpolation.Bspline1D.Data
-              spline(
-              ndim=nd,
-              ncontrol=nc,
-              degree=deg) "A dummy Bspline with zero entries";
-          protected
-            Integer j;
-          algorithm
-            j:=1;
-          end dummy;
-
-          function getNumberControlPoints "Return the number of control points"
-           extends Modelica.Icons.Function;
-            input Real r[:, :]
-              "r[i,:] is position vector to point i on the curve";
-            input Integer degree "degree of the Bspline";
-            output Integer ncontrol "number of control points";
-          protected
-            Integer n;
-            Integer multi;
-            Integer begin;
-            Real delta[size(r,2)];
-            Integer j;
-            Integer jstart;
-          algorithm
-           n := size(r,1);
-
-           //delete multiple start data points
-           multi := 1;
-
-           for j in 1:n-1 loop
-            delta := r[1,:] - r[1+j,:];
-
-            if sqrt(delta*delta) < 1e-12 then
-             multi := multi + 1;
-
-            end if;
-
-           end for;
-           begin := multi;
-
-           //delete multiple end data points
-           multi := 0;
-
-           for j in 1:n-1 loop
-            delta := r[n,:] - r[n-j,:];
-
-            if sqrt(delta*delta) < 1e-12 then
-             multi := multi + 1;
-
-            end if;
-
-           end for;
-           n := n-multi;
-
-           ncontrol := n;
-           jstart := begin;
-
-           for j in begin+1:n-1 loop
-             delta := r[j,:] - r[j-1,:];
-
-             if sqrt(delta*delta) < 1e-12 then
-
-               if j-1-jstart >= 1 and j-1-jstart < degree then
-                 //an interpolation with a Bspline of degree = p needs
-                 //p+1 data points. If there are less than p+1, insert
-                 //virtual data points to get p+1.
-               ncontrol := ncontrol + degree - (j-1 - jstart);
-
-              end if;
-              jstart := j;
-              delta := r[j+1,:] - r[j,:];
-
-              if sqrt(delta*delta) < 1e-12 then
-               //triple data point; delete one data point
-               ncontrol := ncontrol - 1;
-               jstart := j+1;
-
-              end if;
-
-             end if;
-            end for;
-
-            //end
-            if n-jstart < degree then
-             ncontrol := ncontrol + degree - (n-jstart);
-            end if;
-
-           //multiple start data points
-           ncontrol := ncontrol - begin + 1;
-
-           //if Bessel and degree==3 then size(r, 1)+2 else size(r, 1)
-
-          end getNumberControlPoints;
-
-          function getNumberControlPoints2
-            "Return the number of control points"
-           extends Modelica.Icons.Function;
-            input Real r[:, :]
-              "r[i,:] is position vector to point i on the curve";
-            input Real T[size(r, 1), 3, 3]
-              "T[i,:,:] is transformation matrix from base frame to path frame at point i";
-            input Integer degree "degree of the Bspline";
-            output Integer ncontrol "number of control points";
-          protected
-           Integer n;
-            Real data[size(r,1),7];
-            Real q[4];
-            Real q_old[     4];
-          algorithm
-           n := size(r,1);
-
-           data := zeros(size(r,1),7);
-            data[:,1:3] := r;
-
-            // T2Quat
-            // Get the quaternions of the transformation matrix
-            // Choose the quaternions (+q or -q) which form the smallest angle with
-            // the previous quaternions
-            for i in 1:size(r,1) loop
-              q := T2quat(T[i, :, :]);
-
-             if (i > 1 and (q_old*q) < 0) then
-                q := -q;
-
-            end if;
-            data[i,4:7] := q;
-            q_old := q;
-            end for;
-
-            ncontrol := getNumberControlPoints(data,degree);
-
-          end getNumberControlPoints2;
-
-          function quat2T
-            "Compute transformation matrix from non-consistent quaternions"
-            extends Modelica.Icons.Function;
-            input Real q[4] "Quaternions (non-consistent)";
-            output Real T[3,3] "orthogonal transformation matrix";
-
-          algorithm
-           T[1,1] := q[1]^2 + q[2]^2 - q[3]^2 - q[4]^2;
-           T[2,2] := q[1]^2 - q[2]^2 + q[3]^2 - q[4]^2;
-           T[3,3] := q[1]^2 - q[2]^2 - q[3]^2 + q[4]^2;
-           T[1,2] := 2*(q[2]*q[3] + q[1]*q[4]);
-           T[1,3] := 2*(q[2]*q[4] - q[1]*q[3]);
-           T[2,1] := 2*(q[2]*q[3] - q[1]*q[4]);
-           T[2,3] := 2*(q[3]*q[4] + q[1]*q[2]);
-           T[3,1] := 2*(q[2]*q[4] + q[1]*q[3]);
-           T[3,2] := 2*(q[3]*q[4] - q[1]*q[2]);
-           //make the quaternions consistent
-           T := T/(q*q);
-
-          end quat2T;
-
-          function solveBandedWithMatrix
-            "Solve linear system with banded system matrix and right hand side matrix (similar to Modelica.Matrices.solve)"
-            extends Modelica.Icons.Function;
-            input Integer kLower "Number of lower bands";
-            input Integer kUpper "Number of upper bands";
-            input Real A[2*kLower + kUpper + 1, :] "Matrix A of A*X = B";
-            input Real B[size(A, 2), :] "Matrix B of A*X = B";
-            output Real X[size(A, 2), size(B, 2)]=B
-              "Matrix X such that A*X = B";
-            output Integer info;
-          algorithm
-            (X,info) := dgbsv(size(A,2), kLower, kUpper, A, B);
+              "),
+              Window(x = 0.4, y = 0.4, width = 0.6, height = 0.6));
+          end dgesv;
+
+          function dummy "Dummy Bspline"
+            // import Modelica_Interpolation;
+            extends Modelica.Icons.Function;
+            input Integer nd "Dimension";
+            input Integer nc "Number of control points";
+            input Integer deg "degree";
+            output ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.Modelica_Interpolation.Bspline1D.Data spline(ndim = nd, ncontrol = nc, degree = deg) "A dummy Bspline with zero entries";
+          protected
+            Integer j;
+          algorithm
+            j := 1;
+          end dummy;
+
+          function getNumberControlPoints "Return the number of control points"
+            extends Modelica.Icons.Function;
+            input Real r[:, :] "r[i,:] is position vector to point i on the curve";
+            input Integer degree "degree of the Bspline";
+            output Integer ncontrol "number of control points";
+          protected
+            Integer n;
+            Integer multi;
+            Integer begin;
+            Real delta[size(r, 2)];
+            Integer j;
+            Integer jstart;
+          algorithm
+            n := size(r, 1);
+//delete multiple start data points
+            multi := 1;
+            for j in 1:n - 1 loop
+              delta := r[1, :] - r[1 + j, :];
+              if sqrt(delta * delta) < 1e-12 then
+                multi := multi + 1;
+              end if;
+            end for;
+            begin := multi;
+//delete multiple end data points
+            multi := 0;
+            for j in 1:n - 1 loop
+              delta := r[n, :] - r[n - j, :];
+              if sqrt(delta * delta) < 1e-12 then
+                multi := multi + 1;
+              end if;
+            end for;
+            n := n - multi;
+            ncontrol := n;
+            jstart := begin;
+            for j in begin + 1:n - 1 loop
+              delta := r[j, :] - r[j - 1, :];
+              if sqrt(delta * delta) < 1e-12 then
+                if j - 1 - jstart >= 1 and j - 1 - jstart < degree then
+                  ncontrol := ncontrol + degree - (j - 1 - jstart);
+                end if;
+                jstart := j;
+                delta := r[j + 1, :] - r[j, :];
+                if sqrt(delta * delta) < 1e-12 then
+                  ncontrol := ncontrol - 1;
+                  jstart := j + 1;
+                end if;
+              end if;
+            end for;
+//an interpolation with a Bspline of degree = p needs
+//p+1 data points. If there are less than p+1, insert
+//virtual data points to get p+1.
+//triple data point; delete one data point
+//end
+            if n - jstart < degree then
+              ncontrol := ncontrol + degree - (n - jstart);
+            end if;
+//multiple start data points
+            ncontrol := ncontrol - begin + 1;
+//if Bessel and degree==3 then size(r, 1)+2 else size(r, 1)
+          end getNumberControlPoints;
+
+          function getNumberControlPoints2 "Return the number of control points"
+            extends Modelica.Icons.Function;
+            input Real r[:, :] "r[i,:] is position vector to point i on the curve";
+            input Real T[size(r, 1), 3, 3] "T[i,:,:] is transformation matrix from base frame to path frame at point i";
+            input Integer degree "degree of the Bspline";
+            output Integer ncontrol "number of control points";
+          protected
+            Integer n;
+            Real data[size(r, 1), 7];
+            Real q[4];
+            Real q_old[4];
+          algorithm
+            n := size(r, 1);
+            data := zeros(size(r, 1), 7);
+            data[:, 1:3] := r;
+// T2Quat
+// Get the quaternions of the transformation matrix
+// Choose the quaternions (+q or -q) which form the smallest angle with
+// the previous quaternions
+            for i in 1:size(r, 1) loop
+              q := T2quat(T[i, :, :]);
+              if i > 1 and q_old * q < 0 then
+                q := -q;
+              end if;
+              data[i, 4:7] := q;
+              q_old := q;
+            end for;
+            ncontrol := getNumberControlPoints(data, degree);
+          end getNumberControlPoints2;
+
+          function quat2T "Compute transformation matrix from non-consistent quaternions"
+            extends Modelica.Icons.Function;
+            input Real q[4] "Quaternions (non-consistent)";
+            output Real T[3, 3] "orthogonal transformation matrix";
+          algorithm
+            T[1, 1] := q[1] ^ 2 + q[2] ^ 2 - q[3] ^ 2 - q[4] ^ 2;
+            T[2, 2] := q[1] ^ 2 - q[2] ^ 2 + q[3] ^ 2 - q[4] ^ 2;
+            T[3, 3] := q[1] ^ 2 - q[2] ^ 2 - q[3] ^ 2 + q[4] ^ 2;
+            T[1, 2] := 2 * (q[2] * q[3] + q[1] * q[4]);
+            T[1, 3] := 2 * (q[2] * q[4] - q[1] * q[3]);
+            T[2, 1] := 2 * (q[2] * q[3] - q[1] * q[4]);
+            T[2, 3] := 2 * (q[3] * q[4] + q[1] * q[2]);
+            T[3, 1] := 2 * (q[2] * q[4] + q[1] * q[3]);
+            T[3, 2] := 2 * (q[3] * q[4] - q[1] * q[2]);
+//make the quaternions consistent
+            T := T / (q * q);
+          end quat2T;
+
+          function solveBandedWithMatrix "Solve linear system with banded system matrix and right hand side matrix (similar to Modelica.Matrices.solve)"
+            extends Modelica.Icons.Function;
+            input Integer kLower "Number of lower bands";
+            input Integer kUpper "Number of upper bands";
+            input Real A[2 * kLower + kUpper + 1, :] "Matrix A of A*X = B";
+            input Real B[size(A, 2), :] "Matrix B of A*X = B";
+            output Real X[size(A, 2), size(B, 2)] = B "Matrix X such that A*X = B";
+            output Integer info;
+          algorithm
+            (X, info) := dgbsv(size(A, 2), kLower, kUpper, A, B);
             assert(info == 0, "Solving a linear system of equations with function
 \"Modelica_Interpolation.Utilities.solveBandedWithMatrix\" is not possible, since matrix A
-is singular, i.e., no unique solution exists.");
-          end solveBandedWithMatrix;
-
-          function solveMatrix
-            "Solve linear system with right hand side matrix (similar to Modelica_Interpolation.Utilities.solveMatrix)"
-            extends Modelica.Icons.Function;
-            input Real A[:, size(A, 1)] "Matrix A of A*X = B";
-            input Real B[size(A, 1), :] "Matrix B of A*X = B";
-            output Real X[size(B, 1), size(B, 2)]=B
-              "Matrix X such that A*X = B";
-          protected
-            Integer info;
-          algorithm
-            (X,info) := dgesv(A, B);
+is singular, i.e., no unique solution exists.");
+          end solveBandedWithMatrix;
+
+          function solveMatrix "Solve linear system with right hand side matrix (similar to Modelica_Interpolation.Utilities.solveMatrix)"
+            extends Modelica.Icons.Function;
+            input Real A[:, size(A, 1)] "Matrix A of A*X = B";
+            input Real B[size(A, 1), :] "Matrix B of A*X = B";
+            output Real X[size(B, 1), size(B, 2)] = B "Matrix X such that A*X = B";
+          protected
+            Integer info;
+          algorithm
+            (X, info) := dgesv(A, B);
             assert(info == 0, "Solving a linear system of equations with function
 \"Modelica_Interpolation.Utilities.solveMatrix\" is not possible, since matrix A
-is singular, i.e., no unique solution exists.");
-          end solveMatrix;
-
-          function T2quat "Compute Quaternions from a transformation matrix"
-            extends Modelica.Icons.Function;
-            input Real T[3,3] "transformation matrix";
-            output Real q[4] "Quaternions of T (q and -q have same T)";
-
-          protected
-            Real branch "only for test purposes";
-            Real paux;
-            Real paux4;
-            Real c1;
-            Real c2;
-            Real c3;
-            Real c4;
-            Real p4limit=0.1;
-            Real c4limit=4*p4limit*p4limit;
-
-          algorithm
-           c1 := 1 + T[1,1] - T[2,2] - T[3,3];
-           c2 := 1 + T[2,2] - T[1,1] - T[3,3];
-           c3 := 1 + T[3,3] - T[1,1] - T[2,2];
-           c4 := 1 + T[1,1] + T[2,2] + T[3,3];
-
-           if (c4 > c4limit) or (c4 > c1 and c4 > c2 and c4 > c3) then
-              branch := 4;
-              paux := sqrt(c4)/2;
-              paux4 := 4*paux;
-              q := {paux,
-                   (T[2,3] - T[3,2])/paux4,
-                   (T[3,1] - T[1,3])/paux4,
-                   (T[1,2] - T[2,1])/paux4};
-
-           elseif c1 > c2 and c1 > c3 and c1 > c4 then
-              branch := 1;
-              paux := sqrt(c1)/2;
-              paux4 := 4*paux;
-              q := {(T[2,3] - T[3,2])/paux4,
-                   paux,
-                   (T[1,2] + T[2,1])/paux4,
-                   (T[1,3] + T[3,1])/paux4};
-
-           elseif c2 > c1 and c2 > c3 and c2 > c4 then
-              branch := 2;
-              paux := sqrt(c2)/2;
-              paux4 := 4*paux;
-              q := {(T[3,1] - T[1,3])/paux4,
-                   (T[1,2] + T[2,1])/paux4,
-                   paux,
-                   (T[2,3] + T[3,2])/paux4};
-
-           else
-              branch := 3;
-              paux := sqrt(c3)/2;
-              paux4 := 4*paux;
-              q := {(T[1,2] - T[2,1])/paux4,
-                   (T[1,3] + T[3,1])/paux4,
-                   (T[2,3] + T[3,2])/paux4,
-                   paux};
-
-           end if;
-
-          end T2quat;
-        annotation (
-          Window(
-            x=0.45,
-            y=0.01,
-            width=0.44,
-            height=0.65,
-            library=1,
-            autolayout=1),
-          Documentation(info="<HTML>
+is singular, i.e., no unique solution exists.");
+          end solveMatrix;
+
+          function T2quat "Compute Quaternions from a transformation matrix"
+            extends Modelica.Icons.Function;
+            input Real T[3, 3] "transformation matrix";
+            output Real q[4] "Quaternions of T (q and -q have same T)";
+          protected
+            Real branch "only for test purposes";
+            Real paux;
+            Real paux4;
+            Real c1;
+            Real c2;
+            Real c3;
+            Real c4;
+            Real p4limit = 0.1;
+            Real c4limit = 4 * p4limit * p4limit;
+          algorithm
+            c1 := 1 + T[1, 1] - T[2, 2] - T[3, 3];
+            c2 := 1 + T[2, 2] - T[1, 1] - T[3, 3];
+            c3 := 1 + T[3, 3] - T[1, 1] - T[2, 2];
+            c4 := 1 + T[1, 1] + T[2, 2] + T[3, 3];
+            if c4 > c4limit or c4 > c1 and c4 > c2 and c4 > c3 then
+              branch := 4;
+              paux := sqrt(c4) / 2;
+              paux4 := 4 * paux;
+              q := {paux, (T[2, 3] - T[3, 2]) / paux4, (T[3, 1] - T[1, 3]) / paux4, (T[1, 2] - T[2, 1]) / paux4};
+            elseif c1 > c2 and c1 > c3 and c1 > c4 then
+              branch := 1;
+              paux := sqrt(c1) / 2;
+              paux4 := 4 * paux;
+              q := {(T[2, 3] - T[3, 2]) / paux4, paux, (T[1, 2] + T[2, 1]) / paux4, (T[1, 3] + T[3, 1]) / paux4};
+            elseif c2 > c1 and c2 > c3 and c2 > c4 then
+              branch := 2;
+              paux := sqrt(c2) / 2;
+              paux4 := 4 * paux;
+              q := {(T[3, 1] - T[1, 3]) / paux4, (T[1, 2] + T[2, 1]) / paux4, paux, (T[2, 3] + T[3, 2]) / paux4};
+            else
+              branch := 3;
+              paux := sqrt(c3) / 2;
+              paux4 := 4 * paux;
+              q := {(T[1, 2] - T[2, 1]) / paux4, (T[1, 3] + T[3, 1]) / paux4, (T[2, 3] + T[3, 2]) / paux4, paux};
+            end if;
+          end T2quat;
+          annotation(
+            Window(x = 0.45, y = 0.01, width = 0.44, height = 0.65, library = 1, autolayout = 1),
+            Documentation(info = "<HTML>
 <p>
 Utility functions are provided here which are usually not called directly
 by a user, but are needed in the functions of this package
@@ -4718,534 +3279,47 @@
 Modelica in file \"Modelica/package.mo\".
 </i></p>
 </HTML>
-"));
-        end Utilities;
-        annotation (Icon(graphics={
-              Text(
-                extent={{-102,0},{24,-26}},
-                lineColor={242,148,0},
-                textString=
-                     "Thermo"),
-              Text(
-                extent={{-4,8},{68,-34}},
-                lineColor={46,170,220},
-                textString=
-                     "SysPro"),
-              Polygon(
-                points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},
-                    {42,8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,
-                    10},{-50,6},{-62,2}},
-                lineColor={46,170,220},
-                fillColor={46,170,220},
-                fillPattern=FillPattern.Solid),
-              Polygon(
-                points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{
-                    -46,8},{-42,22},{-42,30},{-44,38}},
-                lineColor={46,170,220},
-                fillColor={46,170,220},
-                fillPattern=FillPattern.Solid),
-              Polygon(
-                points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{
-                    -12,12},{-26,12},{-28,12},{-26,20}},
-                lineColor={46,170,220},
-                fillColor={46,170,220},
-                fillPattern=FillPattern.Solid),
-              Polygon(
-                points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}},
-                lineColor={46,170,220},
-                fillColor={46,170,220},
-                fillPattern=FillPattern.Solid),
-              Rectangle(
-                extent={{-8,30},{-6,26}},
-                lineColor={242,148,0},
-                fillColor={242,148,0},
-                fillPattern=FillPattern.Solid),
-              Rectangle(
-                extent={{-8,36},{-6,32}},
-                lineColor={242,148,0},
-                fillColor={242,148,0},
-                fillPattern=FillPattern.Solid),
-              Rectangle(
-                extent={{-8,42},{-6,38}},
-                lineColor={242,148,0},
-                fillColor={242,148,0},
-                fillPattern=FillPattern.Solid),
-              Rectangle(
-                extent={{-8,48},{-6,44}},
-                lineColor={242,148,0},
-                fillColor={242,148,0},
-                fillPattern=FillPattern.Solid),
-              Polygon(
-                points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}},
-                lineColor={46,170,220},
-                fillColor={46,170,220},
-                fillPattern=FillPattern.Solid),
-              Rectangle(
-                extent={{-4,32},{-2,28}},
-                lineColor={242,148,0},
-                fillColor={242,148,0},
-                fillPattern=FillPattern.Solid),
-              Rectangle(
-                extent={{-4,38},{-2,34}},
-                lineColor={242,148,0},
-                fillColor={242,148,0},
-                fillPattern=FillPattern.Solid),
-              Rectangle(
-                extent={{-4,44},{-2,40}},
-                lineColor={242,148,0},
-                fillColor={242,148,0},
-                fillPattern=FillPattern.Solid),
-              Rectangle(
-                extent={{-4,50},{-2,46}},
-                lineColor={242,148,0},
-                fillColor={242,148,0},
-                fillPattern=FillPattern.Solid),
-              Polygon(
-                points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{
-                    -2,20}},
-                lineColor={46,170,220},
-                fillColor={46,170,220},
-                fillPattern=FillPattern.Solid),
-              Polygon(
-                points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},
-                    {42,6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},
-                    {-50,6},{-62,2}},
-                lineColor={242,148,0},
-                fillColor={242,148,0},
-                fillPattern=FillPattern.Solid),
-              Line(
-                points={{22,12},{22,14},{22,16},{24,14},{20,18}},
-                color={46,170,220},
-                thickness=0.5),
-              Line(
-                points={{26,12},{26,14},{26,16},{28,14},{24,18}},
-                color={46,170,220},
-                thickness=0.5),
-              Line(
-                points={{30,10},{30,12},{30,14},{32,12},{28,16}},
-                color={46,170,220},
-                thickness=0.5),
-              Polygon(
-                points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}},
-                lineColor={46,170,220},
-                fillColor={46,170,220},
-                fillPattern=FillPattern.Solid),
-              Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}),
-              Line(
-                points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}},
-                color={0,0,255},
-                smooth=Smooth.None),
-              Line(
-                points={{80,80},{100,100}},
-                color={0,0,255},
-                smooth=Smooth.None)}));
-      end Modelica_Interpolation;
-
-      model PhaseBoundary "Model used to create the phase boundary"
-
-        parameter Integer npoints=100;
-        Real p[npoints] "pressure";
-        Real hl[npoints] "liquid specific enthalpy";
-        Real hv[npoints] "vapour specific enthalpy";
-
-        parameter Real TMAX=ThermoSysPro.Properties.WaterSteam.BaseIF97.critical.TCRIT;
-        //parameter Real TMAX=32.938;
-        parameter Real TMIN = ThermoSysPro.Properties.WaterSteam.BaseIF97.triple.Ttriple-0.01;
-      protected
-        Real[npoints] T "temperature";
-
-      algorithm
-        T := ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.linspace(
-                      TMIN,TMAX,npoints);
-
-        p[1]  := ThermoSysPro.Properties.WaterSteam.BaseIF97.triple.ptriple;
-        for i in 2:npoints-1 loop
-          p[i]  := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.psat(T[i]);
-        end for;
-        p[end]  := ThermoSysPro.Properties.WaterSteam.BaseIF97.critical.PCRIT;
-
-        for i in 1:npoints loop
-          hl[i] := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hl_p(p[i]);
-          hv[i] := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hv_p(p[i]);
-        end for;
-
-        annotation (
-          Icon(graphics));
-      end PhaseBoundary;
-      annotation (Icon(graphics={
-            Text(
-              extent={{-102,0},{24,-26}},
-              lineColor={242,148,0},
-              textString=
-                   "Thermo"),
-            Text(
-              extent={{-4,8},{68,-34}},
-              lineColor={46,170,220},
-              textString=
-                   "SysPro"),
-            Polygon(
-              points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},
-                  {42,8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},
-                  {-50,6},{-62,2}},
-              lineColor={46,170,220},
-              fillColor={46,170,220},
-              fillPattern=FillPattern.Solid),
-            Polygon(
-              points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{
-                  -46,8},{-42,22},{-42,30},{-44,38}},
-              lineColor={46,170,220},
-              fillColor={46,170,220},
-              fillPattern=FillPattern.Solid),
-            Polygon(
-              points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{
-                  -12,12},{-26,12},{-28,12},{-26,20}},
-              lineColor={46,170,220},
-              fillColor={46,170,220},
-              fillPattern=FillPattern.Solid),
-            Polygon(
-              points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}},
-              lineColor={46,170,220},
-              fillColor={46,170,220},
-              fillPattern=FillPattern.Solid),
-            Rectangle(
-              extent={{-8,30},{-6,26}},
-              lineColor={242,148,0},
-              fillColor={242,148,0},
-              fillPattern=FillPattern.Solid),
-            Rectangle(
-              extent={{-8,36},{-6,32}},
-              lineColor={242,148,0},
-              fillColor={242,148,0},
-              fillPattern=FillPattern.Solid),
-            Rectangle(
-              extent={{-8,42},{-6,38}},
-              lineColor={242,148,0},
-              fillColor={242,148,0},
-              fillPattern=FillPattern.Solid),
-            Rectangle(
-              extent={{-8,48},{-6,44}},
-              lineColor={242,148,0},
-              fillColor={242,148,0},
-              fillPattern=FillPattern.Solid),
-            Polygon(
-              points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}},
-              lineColor={46,170,220},
-              fillColor={46,170,220},
-              fillPattern=FillPattern.Solid),
-            Rectangle(
-              extent={{-4,32},{-2,28}},
-              lineColor={242,148,0},
-              fillColor={242,148,0},
-              fillPattern=FillPattern.Solid),
-            Rectangle(
-              extent={{-4,38},{-2,34}},
-              lineColor={242,148,0},
-              fillColor={242,148,0},
-              fillPattern=FillPattern.Solid),
-            Rectangle(
-              extent={{-4,44},{-2,40}},
-              lineColor={242,148,0},
-              fillColor={242,148,0},
-              fillPattern=FillPattern.Solid),
-            Rectangle(
-              extent={{-4,50},{-2,46}},
-              lineColor={242,148,0},
-              fillColor={242,148,0},
-              fillPattern=FillPattern.Solid),
-            Polygon(
-              points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{-2,
-                  20}},
-              lineColor={46,170,220},
-              fillColor={46,170,220},
-              fillPattern=FillPattern.Solid),
-            Polygon(
-              points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},
-                  {42,6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},
-                  {-50,6},{-62,2}},
-              lineColor={242,148,0},
-              fillColor={242,148,0},
-              fillPattern=FillPattern.Solid),
-            Line(
-              points={{22,12},{22,14},{22,16},{24,14},{20,18}},
-              color={46,170,220},
-              thickness=0.5),
-            Line(
-              points={{26,12},{26,14},{26,16},{28,14},{24,18}},
-              color={46,170,220},
-              thickness=0.5),
-            Line(
-              points={{30,10},{30,12},{30,14},{32,12},{28,16}},
-              color={46,170,220},
-              thickness=0.5),
-            Polygon(
-              points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}},
-              lineColor={46,170,220},
-              fillColor={46,170,220},
-              fillPattern=FillPattern.Solid),
-            Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}),
-            Line(
-              points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}},
-              color={0,0,255},
-              smooth=Smooth.None),
-            Line(
-              points={{80,80},{100,100}},
-              color={0,0,255},
-              smooth=Smooth.None)}));
-    end Spline_Utilities;
-
-    annotation (
-      Icon(coordinateSystem(
-          preserveAspectRatio=false,
-          extent={{-100,-100},{100,100}},
-          grid={2,2},
-          initialScale=0.1), graphics={
-          Text(
-            extent={{-102,0},{24,-26}},
-            lineColor={242,148,0},
-            textString=
-                 "Thermo"),
-          Text(
-            extent={{-4,8},{68,-34}},
-            lineColor={46,170,220},
-            textString=
-                 "SysPro"),
-          Polygon(
-            points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},{
-                42,8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},{
-                -50,6},{-62,2}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{-46,
-                8},{-42,22},{-42,30},{-44,38}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{-12,
-                12},{-26,12},{-28,12},{-26,20}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,30},{-6,26}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,36},{-6,32}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,42},{-6,38}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-8,48},{-6,44}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,32},{-2,28}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,38},{-2,34}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,44},{-2,40}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Rectangle(
-            extent={{-4,50},{-2,46}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{-2,
-                20}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Polygon(
-            points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},{
-                42,6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},{
-                -50,6},{-62,2}},
-            lineColor={242,148,0},
-            fillColor={242,148,0},
-            fillPattern=FillPattern.Solid),
-          Line(
-            points={{22,12},{22,14},{22,16},{24,14},{20,18}},
-            color={46,170,220},
-            thickness=0.5),
-          Line(
-            points={{26,12},{26,14},{26,16},{28,14},{24,18}},
-            color={46,170,220},
-            thickness=0.5),
-          Line(
-            points={{30,10},{30,12},{30,14},{32,12},{28,16}},
-            color={46,170,220},
-            thickness=0.5),
-          Polygon(
-            points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}},
-            lineColor={46,170,220},
-            fillColor={46,170,220},
-            fillPattern=FillPattern.Solid),
-          Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}),
-          Line(
-            points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}},
-            color={0,0,255},
-            smooth=Smooth.None),
-          Line(
-            points={{80,80},{100,100}},
-            color={0,0,255},
-            smooth=Smooth.None)}),
-      Window(
-        x=0.05,
-        y=0.51,
-        width=0.25,
-        height=0.26,
-        library=1,
-        autolayout=1),
-      Documentation(info="<html>
+            "));
+        end Utilities;
+        annotation(
+          Icon(graphics = {Text(extent = {{-102, 0}, {24, -26}}, lineColor = {242, 148, 0}, textString = "Thermo"), Text(extent = {{-4, 8}, {68, -34}}, lineColor = {46, 170, 220}, textString = "SysPro"), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-32, 12}, {-16, 14}, {6, 14}, {26, 12}, {42, 8}, {52, 2}, {42, 6}, {28, 10}, {6, 12}, {-12, 12}, {-16, 12}, {-34, 10}, {-50, 6}, {-62, 2}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-44, 38}, {-24, 38}, {-26, 30}, {-26, 22}, {-24, 14}, {-24, 12}, {-46, 8}, {-42, 22}, {-42, 30}, {-44, 38}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-26, 20}, {-20, 20}, {-20, 22}, {-14, 22}, {-14, 20}, {-12, 20}, {-12, 12}, {-26, 12}, {-28, 12}, {-26, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-8, 14}, {-8, 24}, {-6, 24}, {-6, 14}, {-8, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 30}, {-6, 26}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 36}, {-6, 32}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 42}, {-6, 38}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 48}, {-6, 44}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-4, 14}, {-4, 26}, {-2, 26}, {-2, 14}, {-4, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 32}, {-2, 28}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 38}, {-2, 34}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 44}, {-2, 40}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 50}, {-2, 46}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-2, 20}, {8, 20}, {8, 22}, {10, 22}, {18, 22}, {18, 12}, {-4, 14}, {-2, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-36, 10}, {-18, 12}, {6, 12}, {26, 10}, {42, 6}, {52, 0}, {42, 4}, {28, 8}, {6, 10}, {-12, 10}, {-18, 10}, {-38, 8}, {-50, 6}, {-62, 2}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Line(points = {{22, 12}, {22, 14}, {22, 16}, {24, 14}, {20, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{26, 12}, {26, 14}, {26, 16}, {28, 14}, {24, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{30, 10}, {30, 12}, {30, 14}, {32, 12}, {28, 16}}, color = {46, 170, 220}, thickness = 0.5), Polygon(points = {{36, 8}, {36, 30}, {34, 34}, {36, 38}, {40, 38}, {40, 8}, {36, 8}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 80}, {80, -100}}, lineColor = {0, 0, 255}), Line(points = {{-100, 80}, {-80, 100}, {100, 100}, {100, -80}, {80, -100}}, color = {0, 0, 255}, smooth = Smooth.None), Line(points = {{80, 80}, {100, 100}}, color = {0, 0, 255}, smooth = Smooth.None)}));
+      end Modelica_Interpolation;
+
+      model PhaseBoundary "Model used to create the phase boundary"
+        parameter Integer npoints = 100;
+        Real p[npoints] "pressure";
+        Real hl[npoints] "liquid specific enthalpy";
+        Real hv[npoints] "vapour specific enthalpy";
+        parameter Real TMAX = ThermoSysPro.Properties.WaterSteam.BaseIF97.critical.TCRIT;
+        //parameter Real TMAX=32.938;
+        parameter Real TMIN = ThermoSysPro.Properties.WaterSteam.BaseIF97.triple.Ttriple - 0.01;
+      protected
+        Real[npoints] T "temperature";
+      algorithm
+        T := ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Spline_Utilities.linspace(TMIN, TMAX, npoints);
+        p[1] := ThermoSysPro.Properties.WaterSteam.BaseIF97.triple.ptriple;
+        for i in 2:npoints - 1 loop
+          p[i] := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.psat(T[i]);
+        end for;
+        p[end] := ThermoSysPro.Properties.WaterSteam.BaseIF97.critical.PCRIT;
+        for i in 1:npoints loop
+          hl[i] := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hl_p(p[i]);
+          hv[i] := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hv_p(p[i]);
+        end for;
+        annotation(
+          Icon(graphics));
+      end PhaseBoundary;
+      annotation(
+        Icon(graphics = {Text(extent = {{-102, 0}, {24, -26}}, lineColor = {242, 148, 0}, textString = "Thermo"), Text(extent = {{-4, 8}, {68, -34}}, lineColor = {46, 170, 220}, textString = "SysPro"), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-32, 12}, {-16, 14}, {6, 14}, {26, 12}, {42, 8}, {52, 2}, {42, 6}, {28, 10}, {6, 12}, {-12, 12}, {-16, 12}, {-34, 10}, {-50, 6}, {-62, 2}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-44, 38}, {-24, 38}, {-26, 30}, {-26, 22}, {-24, 14}, {-24, 12}, {-46, 8}, {-42, 22}, {-42, 30}, {-44, 38}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-26, 20}, {-20, 20}, {-20, 22}, {-14, 22}, {-14, 20}, {-12, 20}, {-12, 12}, {-26, 12}, {-28, 12}, {-26, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-8, 14}, {-8, 24}, {-6, 24}, {-6, 14}, {-8, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 30}, {-6, 26}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 36}, {-6, 32}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 42}, {-6, 38}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 48}, {-6, 44}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-4, 14}, {-4, 26}, {-2, 26}, {-2, 14}, {-4, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 32}, {-2, 28}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 38}, {-2, 34}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 44}, {-2, 40}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 50}, {-2, 46}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-2, 20}, {8, 20}, {8, 22}, {10, 22}, {18, 22}, {18, 12}, {-4, 14}, {-2, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-36, 10}, {-18, 12}, {6, 12}, {26, 10}, {42, 6}, {52, 0}, {42, 4}, {28, 8}, {6, 10}, {-12, 10}, {-18, 10}, {-38, 8}, {-50, 6}, {-62, 2}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Line(points = {{22, 12}, {22, 14}, {22, 16}, {24, 14}, {20, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{26, 12}, {26, 14}, {26, 16}, {28, 14}, {24, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{30, 10}, {30, 12}, {30, 14}, {32, 12}, {28, 16}}, color = {46, 170, 220}, thickness = 0.5), Polygon(points = {{36, 8}, {36, 30}, {34, 34}, {36, 38}, {40, 38}, {40, 8}, {36, 8}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 80}, {80, -100}}, lineColor = {0, 0, 255}), Line(points = {{-100, 80}, {-80, 100}, {100, 100}, {100, -80}, {80, -100}}, color = {0, 0, 255}, smooth = Smooth.None), Line(points = {{80, 80}, {100, 100}}, color = {0, 0, 255}, smooth = Smooth.None)}));
+    end Spline_Utilities;
+    annotation(
+      Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}, grid = {2, 2}, initialScale = 0.1), graphics = {Text(extent = {{-102, 0}, {24, -26}}, lineColor = {242, 148, 0}, textString = "Thermo"), Text(extent = {{-4, 8}, {68, -34}}, lineColor = {46, 170, 220}, textString = "SysPro"), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-32, 12}, {-16, 14}, {6, 14}, {26, 12}, {42, 8}, {52, 2}, {42, 6}, {28, 10}, {6, 12}, {-12, 12}, {-16, 12}, {-34, 10}, {-50, 6}, {-62, 2}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-44, 38}, {-24, 38}, {-26, 30}, {-26, 22}, {-24, 14}, {-24, 12}, {-46, 8}, {-42, 22}, {-42, 30}, {-44, 38}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-26, 20}, {-20, 20}, {-20, 22}, {-14, 22}, {-14, 20}, {-12, 20}, {-12, 12}, {-26, 12}, {-28, 12}, {-26, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-8, 14}, {-8, 24}, {-6, 24}, {-6, 14}, {-8, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 30}, {-6, 26}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 36}, {-6, 32}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 42}, {-6, 38}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 48}, {-6, 44}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-4, 14}, {-4, 26}, {-2, 26}, {-2, 14}, {-4, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 32}, {-2, 28}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 38}, {-2, 34}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 44}, {-2, 40}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 50}, {-2, 46}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-2, 20}, {8, 20}, {8, 22}, {10, 22}, {18, 22}, {18, 12}, {-4, 14}, {-2, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-36, 10}, {-18, 12}, {6, 12}, {26, 10}, {42, 6}, {52, 0}, {42, 4}, {28, 8}, {6, 10}, {-12, 10}, {-18, 10}, {-38, 8}, {-50, 6}, {-62, 2}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Line(points = {{22, 12}, {22, 14}, {22, 16}, {24, 14}, {20, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{26, 12}, {26, 14}, {26, 16}, {28, 14}, {24, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{30, 10}, {30, 12}, {30, 14}, {32, 12}, {28, 16}}, color = {46, 170, 220}, thickness = 0.5), Polygon(points = {{36, 8}, {36, 30}, {34, 34}, {36, 38}, {40, 38}, {40, 8}, {36, 8}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 80}, {80, -100}}, lineColor = {0, 0, 255}), Line(points = {{-100, 80}, {-80, 100}, {100, 100}, {100, -80}, {80, -100}}, color = {0, 0, 255}, smooth = Smooth.None), Line(points = {{80, 80}, {100, 100}}, color = {0, 0, 255}, smooth = Smooth.None)}),
+      Window(x = 0.05, y = 0.51, width = 0.25, height = 0.26, library = 1, autolayout = 1),
+      Documentation(info = "<html>
 <p><b>Version 1.2</b></p>
 </HTML>
-"));
-  end IF97_wAJ;
-  annotation (Icon(graphics={
-        Text(
-          extent={{-102,0},{24,-26}},
-          lineColor={242,148,0},
-          textString=
-               "Thermo"),
-        Text(
-          extent={{-4,8},{68,-34}},
-          lineColor={46,170,220},
-          textString=
-               "SysPro"),
-        Polygon(
-          points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},{42,
-              8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},{-50,6},
-              {-62,2}},
-          lineColor={46,170,220},
-          fillColor={46,170,220},
-          fillPattern=FillPattern.Solid),
-        Polygon(
-          points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{-46,8},
-              {-42,22},{-42,30},{-44,38}},
-          lineColor={46,170,220},
-          fillColor={46,170,220},
-          fillPattern=FillPattern.Solid),
-        Polygon(
-          points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{-12,12},
-              {-26,12},{-28,12},{-26,20}},
-          lineColor={46,170,220},
-          fillColor={46,170,220},
-          fillPattern=FillPattern.Solid),
-        Polygon(
-          points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}},
-          lineColor={46,170,220},
-          fillColor={46,170,220},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-8,30},{-6,26}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-8,36},{-6,32}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-8,42},{-6,38}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-8,48},{-6,44}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Polygon(
-          points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}},
-          lineColor={46,170,220},
-          fillColor={46,170,220},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-4,32},{-2,28}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-4,38},{-2,34}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-4,44},{-2,40}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-4,50},{-2,46}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Polygon(
-          points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{-2,20}},
-          lineColor={46,170,220},
-          fillColor={46,170,220},
-          fillPattern=FillPattern.Solid),
-        Polygon(
-          points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},{42,
-              6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},{-50,6},
-              {-62,2}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Line(
-          points={{22,12},{22,14},{22,16},{24,14},{20,18}},
-          color={46,170,220},
-          thickness=0.5),
-        Line(
-          points={{26,12},{26,14},{26,16},{28,14},{24,18}},
-          color={46,170,220},
-          thickness=0.5),
-        Line(
-          points={{30,10},{30,12},{30,14},{32,12},{28,16}},
-          color={46,170,220},
-          thickness=0.5),
-        Polygon(
-          points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}},
-          lineColor={46,170,220},
-          fillColor={46,170,220},
-          fillPattern=FillPattern.Solid),
-        Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}),
-        Line(
-          points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}},
-          color={0,0,255},
-          smooth=Smooth.None),
-        Line(
-          points={{80,80},{100,100}},
-          color={0,0,255},
-          smooth=Smooth.None)}));
-
-end IF97_packages;
+      "));
+  end IF97_wAJ;
+  annotation(
+    Icon(graphics = {Text(extent = {{-102, 0}, {24, -26}}, lineColor = {242, 148, 0}, textString = "Thermo"), Text(extent = {{-4, 8}, {68, -34}}, lineColor = {46, 170, 220}, textString = "SysPro"), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-32, 12}, {-16, 14}, {6, 14}, {26, 12}, {42, 8}, {52, 2}, {42, 6}, {28, 10}, {6, 12}, {-12, 12}, {-16, 12}, {-34, 10}, {-50, 6}, {-62, 2}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-44, 38}, {-24, 38}, {-26, 30}, {-26, 22}, {-24, 14}, {-24, 12}, {-46, 8}, {-42, 22}, {-42, 30}, {-44, 38}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-26, 20}, {-20, 20}, {-20, 22}, {-14, 22}, {-14, 20}, {-12, 20}, {-12, 12}, {-26, 12}, {-28, 12}, {-26, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-8, 14}, {-8, 24}, {-6, 24}, {-6, 14}, {-8, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 30}, {-6, 26}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 36}, {-6, 32}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 42}, {-6, 38}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 48}, {-6, 44}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-4, 14}, {-4, 26}, {-2, 26}, {-2, 14}, {-4, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 32}, {-2, 28}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 38}, {-2, 34}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 44}, {-2, 40}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 50}, {-2, 46}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-2, 20}, {8, 20}, {8, 22}, {10, 22}, {18, 22}, {18, 12}, {-4, 14}, {-2, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-36, 10}, {-18, 12}, {6, 12}, {26, 10}, {42, 6}, {52, 0}, {42, 4}, {28, 8}, {6, 10}, {-12, 10}, {-18, 10}, {-38, 8}, {-50, 6}, {-62, 2}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Line(points = {{22, 12}, {22, 14}, {22, 16}, {24, 14}, {20, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{26, 12}, {26, 14}, {26, 16}, {28, 14}, {24, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{30, 10}, {30, 12}, {30, 14}, {32, 12}, {28, 16}}, color = {46, 170, 220}, thickness = 0.5), Polygon(points = {{36, 8}, {36, 30}, {34, 34}, {36, 38}, {40, 38}, {40, 8}, {36, 8}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 80}, {80, -100}}, lineColor = {0, 0, 255}), Line(points = {{-100, 80}, {-80, 100}, {100, 100}, {100, -80}, {80, -100}}, color = {0, 0, 255}, smooth = Smooth.None), Line(points = {{80, 80}, {100, 100}}, color = {0, 0, 255}, smooth = Smooth.None)}));
+end IF97_packages;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam: IF97_packages.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam: IF97_packages.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam/InitLimits.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam/InitLimits.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam/InitLimits.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam/InitLimits.mo"	2022-03-10 09:58:28.048150467 +0000
@@ -3,98 +3,98 @@
   constant Real MINPOS=1.0e-9
     "minimal value for physical variables which are always > 0.0";
 
-  constant Modelica.SIunits.Area AMIN=MINPOS "Minimum surface";
-  constant Modelica.SIunits.Area AMAX=1.0e5 "Maximum surface";
-  constant Modelica.SIunits.Area ANOM=1.0 "Nominal surface";
-  constant Modelica.SIunits.Density DMIN=MINPOS "Minimum density";
-  constant Modelica.SIunits.Density DMAX=1.0e5 "Maximum densitye";
-  constant Modelica.SIunits.Density DNOM=998.0 "Nominal density";
-  constant Modelica.SIunits.ThermalConductivity LAMMIN=MINPOS
+  constant Modelica.Units.SI.Area AMIN=MINPOS "Minimum surface";
+  constant Modelica.Units.SI.Area AMAX=1.0e5 "Maximum surface";
+  constant Modelica.Units.SI.Area ANOM=1.0 "Nominal surface";
+  constant Modelica.Units.SI.Density DMIN=MINPOS "Minimum density";
+  constant Modelica.Units.SI.Density DMAX=1.0e5 "Maximum densitye";
+  constant Modelica.Units.SI.Density DNOM=998.0 "Nominal density";
+  constant Modelica.Units.SI.ThermalConductivity LAMMIN=MINPOS
     "Minimum thermal conductivity";
-  constant Modelica.SIunits.ThermalConductivity LAMNOM=1.0
+  constant Modelica.Units.SI.ThermalConductivity LAMNOM=1.0
     "Nominal thermal conductivity";
-  constant Modelica.SIunits.ThermalConductivity LAMMAX=1000.0
+  constant Modelica.Units.SI.ThermalConductivity LAMMAX=1000.0
     "Maximum thermal conductivity";
-  constant Modelica.SIunits.DynamicViscosity ETAMIN=MINPOS
+  constant Modelica.Units.SI.DynamicViscosity ETAMIN=MINPOS
     "Minimum dynamic viscosity";
-  constant Modelica.SIunits.DynamicViscosity ETAMAX=1.0e8
+  constant Modelica.Units.SI.DynamicViscosity ETAMAX=1.0e8
     "Maximum dynamic viscosity";
-  constant Modelica.SIunits.DynamicViscosity ETANOM=100.0
+  constant Modelica.Units.SI.DynamicViscosity ETANOM=100.0
     "Nominal dynamic viscosity";
-  constant Modelica.SIunits.Energy EMIN=-1.0e10 "Minimum energy";
-  constant Modelica.SIunits.Energy EMAX=1.0e10 "Maximum energy";
-  constant Modelica.SIunits.Energy ENOM=1.0e3 "Nominal energy";
-  constant Modelica.SIunits.Entropy SMIN=-1.0e6 "Minimum entropy";
-  constant Modelica.SIunits.Entropy SMAX=1.0e6 "Maximum entropy";
-  constant Modelica.SIunits.Entropy SNOM=1.0e3 "Nominal entropy";
-  constant Modelica.SIunits.MassFlowRate MDOTMIN=-1.0e5
+  constant Modelica.Units.SI.Energy EMIN=-1.0e10 "Minimum energy";
+  constant Modelica.Units.SI.Energy EMAX=1.0e10 "Maximum energy";
+  constant Modelica.Units.SI.Energy ENOM=1.0e3 "Nominal energy";
+  constant Modelica.Units.SI.Entropy SMIN=-1.0e6 "Minimum entropy";
+  constant Modelica.Units.SI.Entropy SMAX=1.0e6 "Maximum entropy";
+  constant Modelica.Units.SI.Entropy SNOM=1.0e3 "Nominal entropy";
+  constant Modelica.Units.SI.MassFlowRate MDOTMIN=-1.0e5
     "Minimum mass flow rate";
-  constant Modelica.SIunits.MassFlowRate MDOTMAX=1.0e5 "Maximum mass flow rate";
-  constant Modelica.SIunits.MassFlowRate MDOTNOM=1.0 "Nominal mass flow rate";
+  constant Modelica.Units.SI.MassFlowRate MDOTMAX=1.0e5 "Maximum mass flow rate";
+  constant Modelica.Units.SI.MassFlowRate MDOTNOM=1.0 "Nominal mass flow rate";
   constant ThermoSysPro.Units.MassFraction MASSXMIN=-1.0*MINPOS
     "Minimum mass fraction";
   constant ThermoSysPro.Units.MassFraction MASSXMAX=1.0 "Maximum mass fraction";
   constant ThermoSysPro.Units.MassFraction MASSXNOM=0.1 "Nominal mass fraction";
-  constant Modelica.SIunits.Mass MMIN=1.0*MINPOS "Minimum mass";
-  constant Modelica.SIunits.Mass MMAX=1.0e8 "Maximum mass";
-  constant Modelica.SIunits.Mass MNOM=1.0 "Nominal mass";
-  constant Modelica.SIunits.Power POWMIN=-1.0e8 "Minimum power";
-  constant Modelica.SIunits.Power POWMAX=1.0e8 "Maximum power";
-  constant Modelica.SIunits.Power POWNOM=1.0e3 "Nominal power";
-  constant Modelica.SIunits.AbsolutePressure PMIN=100.0 "Minimum pressure";
-  constant Modelica.SIunits.AbsolutePressure PMAX=1.0e9 "Maximum pressure";
-  constant Modelica.SIunits.AbsolutePressure PNOM=1.0e5 "Nominal pressure";
-  constant Modelica.SIunits.AbsolutePressure COMPPMIN=-1.0*MINPOS
+
+  constant Modelica.Units.SI.Mass MMIN=1.0*MINPOS "Minimum mass";
+  constant Modelica.Units.SI.Mass MMAX=1.0e8 "Maximum mass";
+  constant Modelica.Units.SI.Mass MNOM=1.0 "Nominal mass";
+  constant Modelica.Units.SI.Power POWMIN=-1.0e8 "Minimum power";
+  constant Modelica.Units.SI.Power POWMAX=1.0e8 "Maximum power";
+  constant Modelica.Units.SI.Power POWNOM=1.0e3 "Nominal power";
+  constant Modelica.Units.SI.AbsolutePressure PMIN=100.0 "Minimum pressure";
+  constant Modelica.Units.SI.AbsolutePressure PMAX=1.0e9 "Maximum pressure";
+  constant Modelica.Units.SI.AbsolutePressure PNOM=1.0e5 "Nominal pressure";
+  constant Modelica.Units.SI.AbsolutePressure COMPPMIN=-1.0*MINPOS
     "Minimum pressure";
-  constant Modelica.SIunits.AbsolutePressure COMPPMAX=1.0e8 "Maximum pressure";
-  constant Modelica.SIunits.AbsolutePressure COMPPNOM=1.0e5 "Nominal pressure";
-  constant Modelica.SIunits.RatioOfSpecificHeatCapacities KAPPAMIN=1.0
+  constant Modelica.Units.SI.AbsolutePressure COMPPMAX=1.0e8 "Maximum pressure";
+  constant Modelica.Units.SI.AbsolutePressure COMPPNOM=1.0e5 "Nominal pressure";
+  constant Modelica.Units.SI.RatioOfSpecificHeatCapacities KAPPAMIN=1.0
     "Minimum isentropic exponent";
-  constant Modelica.SIunits.RatioOfSpecificHeatCapacities KAPPAMAX=Modelica.Constants.inf
+  constant Modelica.Units.SI.RatioOfSpecificHeatCapacities KAPPAMAX=Modelica.Constants.inf
     "Maximum isentropic exponent";
-  constant Modelica.SIunits.RatioOfSpecificHeatCapacities KAPPANOM=1.2
+  constant Modelica.Units.SI.RatioOfSpecificHeatCapacities KAPPANOM=1.2
     "Nominal isentropic exponent";
-  constant Modelica.SIunits.SpecificEnergy SEMIN=-1.0e8
+  constant Modelica.Units.SI.SpecificEnergy SEMIN=-1.0e8
     "Minimum specific energy";
-  constant Modelica.SIunits.SpecificEnergy SEMAX=1.0e8
+  constant Modelica.Units.SI.SpecificEnergy SEMAX=1.0e8
     "Maximum specific energy";
-  constant Modelica.SIunits.SpecificEnergy SENOM=1.0e6
+  constant Modelica.Units.SI.SpecificEnergy SENOM=1.0e6
     "Nominal specific energy";
-  constant Modelica.SIunits.SpecificEnthalpy SHMIN=-1.0e6
+  constant Modelica.Units.SI.SpecificEnthalpy SHMIN=-1.0e6
     "Minimum specific enthalpy";
-  constant Modelica.SIunits.SpecificEnthalpy SHMAX=1.0e8
+  constant Modelica.Units.SI.SpecificEnthalpy SHMAX=1.0e8
     "Maximum specific enthalpy";
-  constant Modelica.SIunits.SpecificEnthalpy SHNOM=1.0e6
+  constant Modelica.Units.SI.SpecificEnthalpy SHNOM=1.0e6
     "Nominal specific enthalpy";
-  constant Modelica.SIunits.SpecificEntropy SSMIN=-1.0e6
+  constant Modelica.Units.SI.SpecificEntropy SSMIN=-1.0e6
     "Minimum specific entropy";
-  constant Modelica.SIunits.SpecificEntropy SSMAX=1.0e6
+  constant Modelica.Units.SI.SpecificEntropy SSMAX=1.0e6
     "Maximum specific entropy";
-  constant Modelica.SIunits.SpecificEntropy SSNOM=1.0e3
+  constant Modelica.Units.SI.SpecificEntropy SSNOM=1.0e3
     "Nominal specific entropy";
-  constant Modelica.SIunits.SpecificHeatCapacity CPMIN=MINPOS
+  constant Modelica.Units.SI.SpecificHeatCapacity CPMIN=MINPOS
     "Minimum specific heat capacity";
-  constant Modelica.SIunits.SpecificHeatCapacity CPMAX=Modelica.Constants.inf
+  constant Modelica.Units.SI.SpecificHeatCapacity CPMAX=Modelica.Constants.inf
     "Maximum specific heat capacity";
-  constant Modelica.SIunits.SpecificHeatCapacity CPNOM=1.0e3
+  constant Modelica.Units.SI.SpecificHeatCapacity CPNOM=1.0e3
     "Nominal specific heat capacity";
-  constant Modelica.SIunits.Temperature TMIN=200 "Minimum temperature";
-  constant Modelica.SIunits.Temperature TMAX=6000 "Maximum temperature";
-  constant Modelica.SIunits.Temperature TNOM=320.0 "Nominal temperature";
-  constant Modelica.SIunits.ThermalConductivity LMIN=MINPOS
+  constant Modelica.Units.SI.Temperature TMIN=200 "Minimum temperature";
+  constant Modelica.Units.SI.Temperature TMAX=6000 "Maximum temperature";
+  constant Modelica.Units.SI.Temperature TNOM=320.0 "Nominal temperature";
+  constant Modelica.Units.SI.ThermalConductivity LMIN=MINPOS
     "Minimum thermal conductivity";
-  constant Modelica.SIunits.ThermalConductivity LMAX=500.0
+  constant Modelica.Units.SI.ThermalConductivity LMAX=500.0
     "Maximum thermal conductivity";
-  constant Modelica.SIunits.ThermalConductivity LNOM=1.0
+  constant Modelica.Units.SI.ThermalConductivity LNOM=1.0
     "Nominal thermal conductivity";
-  constant Modelica.SIunits.Velocity VELMIN=-1.0e5 "Minimum velocity";
-  constant Modelica.SIunits.Velocity VELMAX=Modelica.Constants.inf
+  constant Modelica.Units.SI.Velocity VELMIN=-1.0e5 "Minimum velocity";
+  constant Modelica.Units.SI.Velocity VELMAX=Modelica.Constants.inf
     "Maximum velocity";
-  constant Modelica.SIunits.Velocity VELNOM=1.0 "Nominal velocity";
-  constant Modelica.SIunits.Volume VMIN=0.0 "Minimum volume";
-  constant Modelica.SIunits.Volume VMAX=1.0e5 "Maximum volume";
-  constant Modelica.SIunits.Volume VNOM=1.0e-3 "Nominal volume";
-
+  constant Modelica.Units.SI.Velocity VELNOM=1.0 "Nominal velocity";
+  constant Modelica.Units.SI.Volume VMIN=0.0 "Minimum volume";
+  constant Modelica.Units.SI.Volume VMAX=1.0e5 "Maximum volume";
+  constant Modelica.Units.SI.Volume VNOM=1.0e-3 "Nominal volume";
   annotation (
     Icon(graphics={
         Text(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam/Region.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam/Region.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam/Region.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam/Region.mo"	2022-03-10 09:58:27.984150459 +0000
@@ -1,421 +1,245 @@
-within ThermoSysPro.Properties.WaterSteam;
-package Region
-  function boilingcurveL3_p "properties on the boiling curve"
-    extends Modelica.Icons.Function;
-    input Modelica.SIunits.Pressure p "pressure";
-    output
-      ThermoSysPro.Properties.WaterSteam.Common.IF97PhaseBoundaryProperties3rd
-      bpro "property record";
-  protected
-    ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd g
-      "dimensionless Gibbs funcion and dervatives";
-    ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd f
-      "dimensionless Helmholtz function and dervatives";
-    Modelica.SIunits.Pressure plim=min(p,ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT
-                                                     - 1e-7)
-      "pressure limited to critical pressure - epsilon";
-    Modelica.SIunits.SpecificVolume v "Specific Volume";
-    Real vp3 "vp^3";
-    Real ivp3 "1/vp^3";
-    Real pv "partial derivative of p w.r.t v";
-    Real pv2 "pv^2";
-    Real pv3 "pv^3";
-    Real ptv "2nd partial derivative of p w.r.t t and v";
-    Real pvv "2nd partial derivative of p w.r.t v and v";
-  algorithm
-    g.R := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
-    bpro.T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tsat(plim);
-    (bpro.dpT,bpro.dpTT) :=
-      ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.d2ptofT(bpro.T);
-    // need derivative of dpT
-  //  g.Region3boundary := bpro.T > data.TLIMIT1;
-    if not bpro.T > ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TLIMIT1 then
-      g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1L3(
-                      p, bpro.T);
-      bpro.d := p/(g.R*bpro.T*g.pi*g.gpi);
-      bpro.h := if p > plim then ThermoSysPro.Properties.WaterSteam.BaseIF97.data.HCRIT
-         else g.R*bpro.T*g.tau*g.gtau;
-      bpro.s := g.R*(g.tau*g.gtau - g.g);
-      bpro.cp := -g.R*g.tau*g.tau*g.gtautau;
-      bpro.vt := g.R/p*(g.pi*g.gpi - g.tau*g.pi*g.gpitau);
-      bpro.vp := g.R*bpro.T/(p*p)*g.pi*g.pi*g.gpipi;
-      bpro.pt := -p/bpro.T*(g.gpi - g.tau*g.gpitau)/(g.gpipi*g.pi);
-      bpro.pd := -g.R*bpro.T*g.gpi*g.gpi/(g.gpipi);
-      bpro.vtt := g.R*g.pi/p*g.tau/bpro.T*g.tau*g.gpitautau;
-      bpro.vtp := g.R*g.pi*g.pi/(p*p)*(g.gpipi - g.tau*g.gpipitau);
-      bpro.vpp := g.R*bpro.T*g.pi*g.pi*g.pi/(p*p*p)*g.gpipipi;
-      bpro.cpt := g.R*g.tau*g.tau/bpro.T*(2*g.gtautau + g.tau*g.gtautautau);
-      v := 1/bpro.d;
-      vp3 := bpro.vp*bpro.vp*bpro.vp;
-      ivp3 := 1/vp3;
-      bpro.ptt := -(bpro.vtt*bpro.vp*bpro.vp -2.0*bpro.vt*bpro.vtp*bpro.vp +bpro.vt*bpro.vt*bpro.vpp)*ivp3;
-      bpro.pdd := -bpro.vpp*ivp3*v*v*v*v - 2*v*bpro.pd "= pvv/d^4";
-      bpro.ptd := (bpro.vtp*bpro.vp-bpro.vt*bpro.vpp)*ivp3*v*v "= -ptv/d^2";
-      bpro.cvt := (vp3*bpro.cpt + bpro.vp*bpro.vp*bpro.vt*bpro.vt + 3.0*bpro.vp*bpro.vp*bpro.T*bpro.vt*bpro.vtt
-        - 3.0*bpro.vtp*bpro.vp*bpro.T*bpro.vt*bpro.vt + bpro.T*bpro.vt*bpro.vt*bpro.vt*bpro.vpp)*ivp3;
-    else
-      bpro.d :=
-        ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.rhol_p_R4b(plim);
-      f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(
-                      bpro.d, bpro.T);
-      bpro.h := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hl_p_R4b(
-        plim);
-      // g.R*bpro.T*(f.tau*f.ftau + f.delta*f.fdelta);
-      bpro.s := f.R*(f.tau*f.ftau - f.f);
-      bpro.cv := g.R*(-f.tau*f.tau*f.ftautau);
-      bpro.pt := g.R*bpro.d*f.delta*(f.fdelta - f.tau*f.fdeltatau);
-      bpro.pd := g.R*bpro.T*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta);
-      pv := (-f.d*f.d*bpro.pd);
-      bpro.vp := 1/pv;
-      bpro.vt := -bpro.pt/pv;
-      bpro.pdd := f.R*bpro.T*f.delta/bpro.d*(2.0*f.fdelta + 4.0*f.delta*f.fdeltadelta +
-           f.delta*f.delta*f.fdeltadeltadelta);
-      bpro.ptt := f.R*bpro.d*f.delta*f.tau*f.tau/bpro.T*f.fdeltatautau;
-      bpro.ptd := f.R*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta - 2.0*f.tau*f.fdeltatau
-       -f.delta*f.tau*f.fdeltadeltatau);
-      bpro.cvt := f.R*f.tau*f.tau/bpro.T*(2.0*f.ftautau + f.tau*f.ftautautau);
-      bpro.cpt := (bpro.cvt*bpro.pd + bpro.cv*bpro.ptd + (bpro.pt + 2.0*bpro.T*bpro.ptt)*bpro.pt/(bpro.d*bpro.d)
-       - bpro.cp*bpro.ptd)/bpro.pd;
-      pv2 := pv*pv;
-      pv3 := pv2*pv;
-      pvv := bpro.pdd*f.d*f.d*f.d*f.d;
-      ptv := (-f.d*f.d*bpro.ptd);
-      bpro.vpp := -pvv/pv3;
-      bpro.vtt := -(bpro.ptt*pv2 -2.0*bpro.pt*ptv*pv + bpro.pt*bpro.pt*pvv)/pv3;
-      bpro.vtp := (-ptv*pv + bpro.pt*pvv)/pv3;
-    end if;
-  end boilingcurveL3_p;
-
-  function dewcurveL3_p "properties on the dew curve"
-    extends Modelica.Icons.Function;
-    input Modelica.SIunits.Pressure p "pressure";
-    output
-      ThermoSysPro.Properties.WaterSteam.Common.IF97PhaseBoundaryProperties3rd
-      bpro "property record";
-  protected
-    ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd g
-      "dimensionless Gibbs funcion and dervatives";
-    ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd f
-      "dimensionless Helmholtz function and dervatives";
-    Modelica.SIunits.Pressure plim=min(p,ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT
-                                                     - 1e-7)
-      "pressure limited to critical pressure - epsilon";
-    Modelica.SIunits.SpecificVolume v "Specific Volume";
-    Real vp3 "vp^3";
-    Real ivp3 "1/vp^3";
-    Real pv "partial derivative of p w.r.t v";
-    Real pv2 "pv^2";
-    Real pv3 "pv^3";
-    Real ptv "2nd partial derivative of p w.r.t t and v";
-    Real pvv "2nd partial derivative of p w.r.t v and v";
-  algorithm
-    bpro.T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tsat(plim);
-    (bpro.dpT,bpro.dpTT) :=
-      ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.d2ptofT(bpro.T);
-    // need derivative of dpT
-  //  bpro.region3boundary := bpro.T > data.TLIMIT1;
-    if not bpro.T > ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TLIMIT1 then
-      g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2L3(
-                      p, bpro.T);
-      bpro.d := p/(g.R*bpro.T*g.pi*g.gpi);
-      bpro.h := if p > plim then ThermoSysPro.Properties.WaterSteam.BaseIF97.data.HCRIT
-         else g.R*bpro.T*g.tau*g.gtau;
-      bpro.s := g.R*(g.tau*g.gtau - g.g);
-      bpro.cp := -g.R*g.tau*g.tau*g.gtautau;
-      bpro.vt := g.R/p*(g.pi*g.gpi - g.tau*g.pi*g.gpitau);
-      bpro.vp := g.R*bpro.T/(p*p)*g.pi*g.pi*g.gpipi;
-      bpro.pt := -p/bpro.T*(g.gpi - g.tau*g.gpitau)/(g.gpipi*g.pi);
-      bpro.pd := -g.R*bpro.T*g.gpi*g.gpi/(g.gpipi);
-      bpro.vtt := g.R*g.pi/p*g.tau/bpro.T*g.tau*g.gpitautau;
-      bpro.vtp := g.R*g.pi*g.pi/(p*p)*(g.gpipi - g.tau*g.gpipitau);
-      bpro.vpp := g.R*bpro.T*g.pi*g.pi*g.pi/(p*p*p)*g.gpipipi;
-      bpro.cpt := g.R*g.tau*g.tau/bpro.T*(2*g.gtautau + g.tau*g.gtautautau);
-      v := 1/bpro.d;
-      vp3 := bpro.vp*bpro.vp*bpro.vp;
-      ivp3 := 1/vp3;
-      bpro.ptt := -(bpro.vtt*bpro.vp*bpro.vp -2.0*bpro.vt*bpro.vtp*bpro.vp +bpro.vt*bpro.vt*bpro.vpp)*ivp3;
-      bpro.pdd := -bpro.vpp*ivp3*v*v*v*v - 2*v*bpro.pd "= pvv/d^4";
-      bpro.ptd := (bpro.vtp*bpro.vp-bpro.vt*bpro.vpp)*ivp3*v*v "= -ptv/d^2";
-      bpro.cvt := (vp3*bpro.cpt + bpro.vp*bpro.vp*bpro.vt*bpro.vt + 3.0*bpro.vp*bpro.vp*bpro.T*bpro.vt*bpro.vtt
-        - 3.0*bpro.vtp*bpro.vp*bpro.T*bpro.vt*bpro.vt + bpro.T*bpro.vt*bpro.vt*bpro.vt*bpro.vpp)*ivp3;
-    else
-      bpro.d :=
-        ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.rhov_p_R4b(plim);
-      f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(
-                      bpro.d, bpro.T);
-      bpro.h := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hv_p_R4b(
-        plim);
-      // f.R*bpro.T*(f.tau*f.ftau + f.delta*f.fdelta);
-      bpro.s := f.R*(f.tau*f.ftau - f.f);
-      bpro.cv := f.R*(-f.tau*f.tau*f.ftautau);
-      bpro.pt := f.R*bpro.d*f.delta*(f.fdelta - f.tau*f.fdeltatau);
-      bpro.pd := f.R*bpro.T*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta);
-      pv := (-f.d*f.d*bpro.pd);
-      bpro.vp := 1/pv;
-      bpro.vt := -bpro.pt/pv;
-      bpro.pdd := f.R*bpro.T*f.delta/bpro.d*(2.0*f.fdelta + 4.0*f.delta*f.fdeltadelta +
-           f.delta*f.delta*f.fdeltadeltadelta);
-      bpro.ptt := f.R*bpro.d*f.delta*f.tau*f.tau/bpro.T*f.fdeltatautau;
-      bpro.ptd := f.R*f.delta*(2.0*f.fdelta + f.delta*f.fdeltadelta - 2.0*f.tau*f.fdeltatau
-    -f.delta*f.tau*f.fdeltadeltatau);
-      bpro.cvt := f.R*f.tau*f.tau/bpro.T*(2.0*f.ftautau + f.tau*f.ftautautau);
-      bpro.cpt := (bpro.cvt*bpro.pd + bpro.cv*bpro.ptd + (bpro.pt + 2.0*bpro.T*bpro.ptt)*bpro.pt/(bpro.d*bpro.d)
-    - bpro.cp*bpro.ptd)/bpro.pd;
-      pv2 := pv*pv;
-      pv3 := pv2*pv;
-      pvv := bpro.pdd*f.d*f.d*f.d*f.d;
-      ptv := (-f.d*f.d*bpro.ptd);
-      bpro.vpp := -pvv/pv3;
-      bpro.vtt := -(bpro.ptt*pv2 -2.0*bpro.pt*ptv*pv + bpro.pt*bpro.pt*pvv)/pv3;
-      bpro.vtp := (-ptv*pv + bpro.pt*pvv)/pv3;
-    end if;
-  end dewcurveL3_p;
-
-  function hvl_dp
-    "derivative function for the specific enthalpy along the phase boundary"
-    extends Modelica.Icons.Function;
-    input Modelica.SIunits.Pressure p "pressure";
-    input
-      ThermoSysPro.Properties.WaterSteam.Common.IF97PhaseBoundaryProperties3rd
-      bpro "property record";
-    output Real dh_dp
-      "derivative of specific enthalpy along the phase boundary";
-  algorithm
-      dh_dp := (1/bpro.d - bpro.T*bpro.vt) + bpro.cp/bpro.dpT;
-      // dh_dp_der := vp - (T*vpt + dTp*vt) + d/dp(cp/(dp/dT))
-    annotation (
-      derivative(noDerivative=bpro) = hvl_dp_der,
-      Inline=false,
-      LateInline=true);
-  end hvl_dp;
-
-  function hvl_dp_der
-    "derivative function for the specific enthalpy along the phase boundary"
-    extends Modelica.Icons.Function;
-    input Modelica.SIunits.Pressure p "pressure";
-    input
-      ThermoSysPro.Properties.WaterSteam.Common.IF97PhaseBoundaryProperties3rd
-      bpro "property record";
-    input Real p_der "Pressure derivative";
-    output Real dh_dp_der
-      "Second derivative of specific enthalpy along the phase boundary";
-  protected
-    Real cpp "Derivative of cp w.r.t. p";
-    Real pv "partial derivative of p w.r.t. v";
-    Real pv2 "pv*pv";
-    Real pv3 "pv*pv*pv";
-    Real ptv "2nd partial derivative of p w.r.t t and v";
-    Real pvv "2nd partial derivative of p w.r.t v and v";
-  algorithm
-    pv :=-bpro.d*bpro.d*bpro.pd;
-    pv2 := pv*pv;
-    pv3 := pv2*pv;
-    pvv := bpro.pdd*bpro.d*bpro.d*bpro.d*bpro.d;
-    ptv := (-bpro.d*bpro.d*bpro.ptd);
-    cpp := (bpro.T*(bpro.ptt*pv2 - 2.0*bpro.pt*ptv*pv + bpro.pt*bpro.pt*pvv))/pv3
-      "T*(ptt*pv^2 - 2*pt*ptv*pv + pt^2*pvv)/pv^3";
-    dh_dp_der := 0.0;
-  //   dh_dp_der := 1/pv - (bpro.T*bpro.vtp + bpro.dpT*bpro.vt) +
-  //     cpp/bpro.dpT - bpro.cp*(bpro.dpTT*bpro.dpT)/(bpro.dpT*bpro.dpT);
-  //     //d/dp(cp/(dp/dT))
-
-    annotation (Icon(graphics={Rectangle(
-            extent={{-100,100},{100,-100}},
-            lineColor={255,0,0},
-            lineThickness=0.5)}));
-  end hvl_dp_der;
-
-    function dhl_dp
-    "derivative of liquid specific enthalpy on the boundary between regions 4 and 3 or 1 w.r.t pressure"
-
-    extends Modelica.Icons.Function;
-    input Modelica.SIunits.Pressure p "pressure";
-    output Modelica.SIunits.DerEnthalpyByPressure dh_dp
-      "specific enthalpy derivative w.r.t. pressure";
-    algorithm
-    dh_dp := ThermoSysPro.Properties.WaterSteam.Region.hvl_dp(p,
-      ThermoSysPro.Properties.WaterSteam.Region.boilingcurveL3_p(p));
-    annotation(smoothOrder=2);
-    end dhl_dp;
-
-  function dhv_dp
-    "derivative of vapour specific enthalpy on the boundary between regions 4 and 3 or 1 w.r.t pressure"
-
-    extends Modelica.Icons.Function;
-    input Modelica.SIunits.Pressure p "pressure";
-    output Modelica.SIunits.DerEnthalpyByPressure dh_dp
-      "specific enthalpy derivative w.r.t. pressure";
-  algorithm
-    dh_dp := ThermoSysPro.Properties.WaterSteam.Region.hvl_dp(p,
-      ThermoSysPro.Properties.WaterSteam.Region.dewcurveL3_p(p));
-    annotation(smoothOrder=2);
-  end dhv_dp;
-
-  function drhovl_dp
-    extends Modelica.Icons.Function;
-    input Modelica.SIunits.Pressure p "saturation pressure";
-    input
-      ThermoSysPro.Properties.WaterSteam.Common.IF97PhaseBoundaryProperties3rd
-      bpro "property record";
-    output Real dd_dp(unit="kg/(m3.Pa)")
-      "derivative of density along the phase boundary";
-  algorithm
-    dd_dp := -bpro.d*bpro.d*(bpro.vp + bpro.vt/bpro.dpT);
-    annotation (
-      derivative(noDerivative=bpro) = drhovl_dp_der,
-      Inline=false,
-      LateInline=true);
-  end drhovl_dp;
-
-  function drhol_dp "derivative of density of saturated water w.r.t. pressure"
-    extends Modelica.Icons.Function;
-    input Modelica.SIunits.Pressure p "saturation pressure";
-    output Modelica.SIunits.DerDensityByPressure dd_dp
-      "derivative of density of water at the boiling point";
-  algorithm
-    dd_dp := ThermoSysPro.Properties.WaterSteam.Region.drhovl_dp(p,
-      ThermoSysPro.Properties.WaterSteam.Region.boilingcurveL3_p(p));
-  end drhol_dp;
-
-  function drhov_dp "derivative of density of saturated steam w.r.t. pressure"
-    extends Modelica.Icons.Function;
-    input Modelica.SIunits.Pressure p "saturation pressure";
-    output Modelica.SIunits.DerDensityByPressure dd_dp
-      "derivative of density of water at the boiling point";
-  algorithm
-    dd_dp := ThermoSysPro.Properties.WaterSteam.Region.drhovl_dp(p,
-      ThermoSysPro.Properties.WaterSteam.Region.dewcurveL3_p(p));
-  end drhov_dp;
-
-  function drhovl_dp_der
-    "Time derivative of density derivative along phase boundary"
-    extends Modelica.Icons.Function;
-    input Modelica.SIunits.Pressure p "saturation pressure";
-    input
-      ThermoSysPro.Properties.WaterSteam.Common.IF97PhaseBoundaryProperties3rd
-      bpro "property record";
-    input Real p_der "Time derivative of pressure";
-    output Real dd_dp_der "derivative of density along the phase boundary";
-  algorithm
-    dd_dp_der := 0.0;
-  end drhovl_dp_der;
-  annotation (Icon(graphics={
-        Text(
-          extent={{-102,0},{24,-26}},
-          lineColor={242,148,0},
-          textString=
-               "Thermo"),
-        Text(
-          extent={{-4,8},{68,-34}},
-          lineColor={46,170,220},
-          textString=
-               "SysPro"),
-        Polygon(
-          points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},{42,
-              8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},{-50,6},
-              {-62,2}},
-          lineColor={46,170,220},
-          fillColor={46,170,220},
-          fillPattern=FillPattern.Solid),
-        Polygon(
-          points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{-46,8},
-              {-42,22},{-42,30},{-44,38}},
-          lineColor={46,170,220},
-          fillColor={46,170,220},
-          fillPattern=FillPattern.Solid),
-        Polygon(
-          points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{-12,12},
-              {-26,12},{-28,12},{-26,20}},
-          lineColor={46,170,220},
-          fillColor={46,170,220},
-          fillPattern=FillPattern.Solid),
-        Polygon(
-          points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}},
-          lineColor={46,170,220},
-          fillColor={46,170,220},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-8,30},{-6,26}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-8,36},{-6,32}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-8,42},{-6,38}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-8,48},{-6,44}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Polygon(
-          points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}},
-          lineColor={46,170,220},
-          fillColor={46,170,220},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-4,32},{-2,28}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-4,38},{-2,34}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-4,44},{-2,40}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Rectangle(
-          extent={{-4,50},{-2,46}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Polygon(
-          points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{-2,20}},
-          lineColor={46,170,220},
-          fillColor={46,170,220},
-          fillPattern=FillPattern.Solid),
-        Polygon(
-          points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},{42,
-              6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},{-50,6},
-              {-62,2}},
-          lineColor={242,148,0},
-          fillColor={242,148,0},
-          fillPattern=FillPattern.Solid),
-        Line(
-          points={{22,12},{22,14},{22,16},{24,14},{20,18}},
-          color={46,170,220},
-          thickness=0.5),
-        Line(
-          points={{26,12},{26,14},{26,16},{28,14},{24,18}},
-          color={46,170,220},
-          thickness=0.5),
-        Line(
-          points={{30,10},{30,12},{30,14},{32,12},{28,16}},
-          color={46,170,220},
-          thickness=0.5),
-        Polygon(
-          points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}},
-          lineColor={46,170,220},
-          fillColor={46,170,220},
-          fillPattern=FillPattern.Solid),
-        Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}),
-        Line(
-          points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}},
-          color={0,0,255},
-          smooth=Smooth.None),
-        Line(
-          points={{80,80},{100,100}},
-          color={0,0,255},
-          smooth=Smooth.None)}));
-
-end Region;
+within ThermoSysPro.Properties.WaterSteam;
+
+package Region
+  function boilingcurveL3_p "properties on the boiling curve"
+    extends Modelica.Icons.Function;
+    input Modelica.Units.SI.Pressure p "pressure";
+    output ThermoSysPro.Properties.WaterSteam.Common.IF97PhaseBoundaryProperties3rd bpro "property record";
+  protected
+    ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd g "dimensionless Gibbs funcion and dervatives";
+    ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd f "dimensionless Helmholtz function and dervatives";
+    Modelica.Units.SI.Pressure plim = min(p, ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT - 1e-7) "pressure limited to critical pressure - epsilon";
+    Modelica.Units.SI.SpecificVolume v "Specific Volume";
+    Real vp3 "vp^3";
+    Real ivp3 "1/vp^3";
+    Real pv "partial derivative of p w.r.t v";
+    Real pv2 "pv^2";
+    Real pv3 "pv^3";
+    Real ptv "2nd partial derivative of p w.r.t t and v";
+    Real pvv "2nd partial derivative of p w.r.t v and v";
+  algorithm
+    g.R := ThermoSysPro.Properties.WaterSteam.BaseIF97.data.RH2O;
+    bpro.T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tsat(plim);
+    (bpro.dpT, bpro.dpTT) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.d2ptofT(bpro.T);
+// need derivative of dpT
+//  g.Region3boundary := bpro.T > data.TLIMIT1;
+    if not bpro.T > ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TLIMIT1 then
+      g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g1L3(p, bpro.T);
+      bpro.d := p / (g.R * bpro.T * g.pi * g.gpi);
+      bpro.h := if p > plim then ThermoSysPro.Properties.WaterSteam.BaseIF97.data.HCRIT else g.R * bpro.T * g.tau * g.gtau;
+      bpro.s := g.R * (g.tau * g.gtau - g.g);
+      bpro.cp := -g.R * g.tau * g.tau * g.gtautau;
+      bpro.vt := g.R / p * (g.pi * g.gpi - g.tau * g.pi * g.gpitau);
+      bpro.vp := g.R * bpro.T / (p * p) * g.pi * g.pi * g.gpipi;
+      bpro.pt := -p / bpro.T * (g.gpi - g.tau * g.gpitau) / (g.gpipi * g.pi);
+      bpro.pd := -g.R * bpro.T * g.gpi * g.gpi / g.gpipi;
+      bpro.vtt := g.R * g.pi / p * g.tau / bpro.T * g.tau * g.gpitautau;
+      bpro.vtp := g.R * g.pi * g.pi / (p * p) * (g.gpipi - g.tau * g.gpipitau);
+      bpro.vpp := g.R * bpro.T * g.pi * g.pi * g.pi / (p * p * p) * g.gpipipi;
+      bpro.cpt := g.R * g.tau * g.tau / bpro.T * (2 * g.gtautau + g.tau * g.gtautautau);
+      v := 1 / bpro.d;
+      vp3 := bpro.vp * bpro.vp * bpro.vp;
+      ivp3 := 1 / vp3;
+      bpro.ptt := -(bpro.vtt * bpro.vp * bpro.vp - 2.0 * bpro.vt * bpro.vtp * bpro.vp + bpro.vt * bpro.vt * bpro.vpp) * ivp3;
+      bpro.pdd := (-bpro.vpp * ivp3 * v * v * v * v) - 2 * v * bpro.pd "= pvv/d^4";
+      bpro.ptd := (bpro.vtp * bpro.vp - bpro.vt * bpro.vpp) * ivp3 * v * v "= -ptv/d^2";
+      bpro.cvt := (vp3 * bpro.cpt + bpro.vp * bpro.vp * bpro.vt * bpro.vt + 3.0 * bpro.vp * bpro.vp * bpro.T * bpro.vt * bpro.vtt - 3.0 * bpro.vtp * bpro.vp * bpro.T * bpro.vt * bpro.vt + bpro.T * bpro.vt * bpro.vt * bpro.vt * bpro.vpp) * ivp3;
+    else
+      bpro.d := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.rhol_p_R4b(plim);
+      f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(bpro.d, bpro.T);
+      bpro.h := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hl_p_R4b(plim);
+      bpro.s := f.R * (f.tau * f.ftau - f.f);
+      bpro.cv := g.R * (-f.tau * f.tau * f.ftautau);
+      bpro.pt := g.R * bpro.d * f.delta * (f.fdelta - f.tau * f.fdeltatau);
+      bpro.pd := g.R * bpro.T * f.delta * (2.0 * f.fdelta + f.delta * f.fdeltadelta);
+      pv := -f.d * f.d * bpro.pd;
+      bpro.vp := 1 / pv;
+      bpro.vt := -bpro.pt / pv;
+      bpro.pdd := f.R * bpro.T * f.delta / bpro.d * (2.0 * f.fdelta + 4.0 * f.delta * f.fdeltadelta + f.delta * f.delta * f.fdeltadeltadelta);
+      bpro.ptt := f.R * bpro.d * f.delta * f.tau * f.tau / bpro.T * f.fdeltatautau;
+      bpro.ptd := f.R * f.delta * (2.0 * f.fdelta + f.delta * f.fdeltadelta - 2.0 * f.tau * f.fdeltatau - f.delta * f.tau * f.fdeltadeltatau);
+      bpro.cvt := f.R * f.tau * f.tau / bpro.T * (2.0 * f.ftautau + f.tau * f.ftautautau);
+      bpro.cpt := (bpro.cvt * bpro.pd + bpro.cv * bpro.ptd + (bpro.pt + 2.0 * bpro.T * bpro.ptt) * bpro.pt / (bpro.d * bpro.d) - bpro.cp * bpro.ptd) / bpro.pd;
+      pv2 := pv * pv;
+      pv3 := pv2 * pv;
+      pvv := bpro.pdd * f.d * f.d * f.d * f.d;
+      ptv := -f.d * f.d * bpro.ptd;
+      bpro.vpp := -pvv / pv3;
+      bpro.vtt := -(bpro.ptt * pv2 - 2.0 * bpro.pt * ptv * pv + bpro.pt * bpro.pt * pvv) / pv3;
+      bpro.vtp := ((-ptv * pv) + bpro.pt * pvv) / pv3;
+    end if;
+// g.R*bpro.T*(f.tau*f.ftau + f.delta*f.fdelta);
+  end boilingcurveL3_p;
+
+  function dewcurveL3_p "properties on the dew curve"
+    extends Modelica.Icons.Function;
+    input Modelica.Units.SI.Pressure p "pressure";
+    output ThermoSysPro.Properties.WaterSteam.Common.IF97PhaseBoundaryProperties3rd bpro "property record";
+  protected
+    ThermoSysPro.Properties.WaterSteam.Common.GibbsDerivs3rd g "dimensionless Gibbs funcion and dervatives";
+    ThermoSysPro.Properties.WaterSteam.Common.HelmholtzDerivs3rd f "dimensionless Helmholtz function and dervatives";
+    Modelica.Units.SI.Pressure plim = min(p, ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT - 1e-7) "pressure limited to critical pressure - epsilon";
+    Modelica.Units.SI.SpecificVolume v "Specific Volume";
+    Real vp3 "vp^3";
+    Real ivp3 "1/vp^3";
+    Real pv "partial derivative of p w.r.t v";
+    Real pv2 "pv^2";
+    Real pv3 "pv^3";
+    Real ptv "2nd partial derivative of p w.r.t t and v";
+    Real pvv "2nd partial derivative of p w.r.t v and v";
+  algorithm
+    bpro.T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tsat(plim);
+    (bpro.dpT, bpro.dpTT) := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.d2ptofT(bpro.T);
+// need derivative of dpT
+//  bpro.region3boundary := bpro.T > data.TLIMIT1;
+    if not bpro.T > ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TLIMIT1 then
+      g := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.g2L3(p, bpro.T);
+      bpro.d := p / (g.R * bpro.T * g.pi * g.gpi);
+      bpro.h := if p > plim then ThermoSysPro.Properties.WaterSteam.BaseIF97.data.HCRIT else g.R * bpro.T * g.tau * g.gtau;
+      bpro.s := g.R * (g.tau * g.gtau - g.g);
+      bpro.cp := -g.R * g.tau * g.tau * g.gtautau;
+      bpro.vt := g.R / p * (g.pi * g.gpi - g.tau * g.pi * g.gpitau);
+      bpro.vp := g.R * bpro.T / (p * p) * g.pi * g.pi * g.gpipi;
+      bpro.pt := -p / bpro.T * (g.gpi - g.tau * g.gpitau) / (g.gpipi * g.pi);
+      bpro.pd := -g.R * bpro.T * g.gpi * g.gpi / g.gpipi;
+      bpro.vtt := g.R * g.pi / p * g.tau / bpro.T * g.tau * g.gpitautau;
+      bpro.vtp := g.R * g.pi * g.pi / (p * p) * (g.gpipi - g.tau * g.gpipitau);
+      bpro.vpp := g.R * bpro.T * g.pi * g.pi * g.pi / (p * p * p) * g.gpipipi;
+      bpro.cpt := g.R * g.tau * g.tau / bpro.T * (2 * g.gtautau + g.tau * g.gtautautau);
+      v := 1 / bpro.d;
+      vp3 := bpro.vp * bpro.vp * bpro.vp;
+      ivp3 := 1 / vp3;
+      bpro.ptt := -(bpro.vtt * bpro.vp * bpro.vp - 2.0 * bpro.vt * bpro.vtp * bpro.vp + bpro.vt * bpro.vt * bpro.vpp) * ivp3;
+      bpro.pdd := (-bpro.vpp * ivp3 * v * v * v * v) - 2 * v * bpro.pd "= pvv/d^4";
+      bpro.ptd := (bpro.vtp * bpro.vp - bpro.vt * bpro.vpp) * ivp3 * v * v "= -ptv/d^2";
+      bpro.cvt := (vp3 * bpro.cpt + bpro.vp * bpro.vp * bpro.vt * bpro.vt + 3.0 * bpro.vp * bpro.vp * bpro.T * bpro.vt * bpro.vtt - 3.0 * bpro.vtp * bpro.vp * bpro.T * bpro.vt * bpro.vt + bpro.T * bpro.vt * bpro.vt * bpro.vt * bpro.vpp) * ivp3;
+    else
+      bpro.d := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.rhov_p_R4b(plim);
+      f := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.f3L3(bpro.d, bpro.T);
+      bpro.h := ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hv_p_R4b(plim);
+      bpro.s := f.R * (f.tau * f.ftau - f.f);
+      bpro.cv := f.R * (-f.tau * f.tau * f.ftautau);
+      bpro.pt := f.R * bpro.d * f.delta * (f.fdelta - f.tau * f.fdeltatau);
+      bpro.pd := f.R * bpro.T * f.delta * (2.0 * f.fdelta + f.delta * f.fdeltadelta);
+      pv := -f.d * f.d * bpro.pd;
+      bpro.vp := 1 / pv;
+      bpro.vt := -bpro.pt / pv;
+      bpro.pdd := f.R * bpro.T * f.delta / bpro.d * (2.0 * f.fdelta + 4.0 * f.delta * f.fdeltadelta + f.delta * f.delta * f.fdeltadeltadelta);
+      bpro.ptt := f.R * bpro.d * f.delta * f.tau * f.tau / bpro.T * f.fdeltatautau;
+      bpro.ptd := f.R * f.delta * (2.0 * f.fdelta + f.delta * f.fdeltadelta - 2.0 * f.tau * f.fdeltatau - f.delta * f.tau * f.fdeltadeltatau);
+      bpro.cvt := f.R * f.tau * f.tau / bpro.T * (2.0 * f.ftautau + f.tau * f.ftautautau);
+      bpro.cpt := (bpro.cvt * bpro.pd + bpro.cv * bpro.ptd + (bpro.pt + 2.0 * bpro.T * bpro.ptt) * bpro.pt / (bpro.d * bpro.d) - bpro.cp * bpro.ptd) / bpro.pd;
+      pv2 := pv * pv;
+      pv3 := pv2 * pv;
+      pvv := bpro.pdd * f.d * f.d * f.d * f.d;
+      ptv := -f.d * f.d * bpro.ptd;
+      bpro.vpp := -pvv / pv3;
+      bpro.vtt := -(bpro.ptt * pv2 - 2.0 * bpro.pt * ptv * pv + bpro.pt * bpro.pt * pvv) / pv3;
+      bpro.vtp := ((-ptv * pv) + bpro.pt * pvv) / pv3;
+    end if;
+// f.R*bpro.T*(f.tau*f.ftau + f.delta*f.fdelta);
+  end dewcurveL3_p;
+
+  function hvl_dp "derivative function for the specific enthalpy along the phase boundary"
+    extends Modelica.Icons.Function;
+    input Modelica.Units.SI.Pressure p "pressure";
+    input ThermoSysPro.Properties.WaterSteam.Common.IF97PhaseBoundaryProperties3rd bpro "property record";
+    output Real dh_dp "derivative of specific enthalpy along the phase boundary";
+  algorithm
+    dh_dp := 1 / bpro.d - bpro.T * bpro.vt + bpro.cp / bpro.dpT;
+// dh_dp_der := vp - (T*vpt + dTp*vt) + d/dp(cp/(dp/dT))
+    annotation(
+      derivative(noDerivative = bpro) = hvl_dp_der,
+      Inline = false,
+      LateInline = true);
+  end hvl_dp;
+
+  function hvl_dp_der "derivative function for the specific enthalpy along the phase boundary"
+    extends Modelica.Icons.Function;
+    input Modelica.Units.SI.Pressure p "pressure";
+    input ThermoSysPro.Properties.WaterSteam.Common.IF97PhaseBoundaryProperties3rd bpro "property record";
+    input Real p_der "Pressure derivative";
+    output Real dh_dp_der "Second derivative of specific enthalpy along the phase boundary";
+  protected
+    Real cpp "Derivative of cp w.r.t. p";
+    Real pv "partial derivative of p w.r.t. v";
+    Real pv2 "pv*pv";
+    Real pv3 "pv*pv*pv";
+    Real ptv "2nd partial derivative of p w.r.t t and v";
+    Real pvv "2nd partial derivative of p w.r.t v and v";
+  algorithm
+    pv := -bpro.d * bpro.d * bpro.pd;
+    pv2 := pv * pv;
+    pv3 := pv2 * pv;
+    pvv := bpro.pdd * bpro.d * bpro.d * bpro.d * bpro.d;
+    ptv := -bpro.d * bpro.d * bpro.ptd;
+    cpp := bpro.T * (bpro.ptt * pv2 - 2.0 * bpro.pt * ptv * pv + bpro.pt * bpro.pt * pvv) / pv3 "T*(ptt*pv^2 - 2*pt*ptv*pv + pt^2*pvv)/pv^3";
+    dh_dp_der := 0.0;
+//   dh_dp_der := 1/pv - (bpro.T*bpro.vtp + bpro.dpT*bpro.vt) +
+//     cpp/bpro.dpT - bpro.cp*(bpro.dpTT*bpro.dpT)/(bpro.dpT*bpro.dpT);
+//     //d/dp(cp/(dp/dT))
+    annotation(
+      Icon(graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {255, 0, 0}, lineThickness = 0.5)}));
+  end hvl_dp_der;
+
+  function dhl_dp "derivative of liquid specific enthalpy on the boundary between regions 4 and 3 or 1 w.r.t pressure"
+    extends Modelica.Icons.Function;
+    input Modelica.Units.SI.Pressure p "pressure";
+    output Modelica.Units.SI.DerEnthalpyByPressure dh_dp "specific enthalpy derivative w.r.t. pressure";
+  algorithm
+    dh_dp := ThermoSysPro.Properties.WaterSteam.Region.hvl_dp(p, ThermoSysPro.Properties.WaterSteam.Region.boilingcurveL3_p(p));
+    annotation(
+      smoothOrder = 2);
+  end dhl_dp;
+
+  function dhv_dp "derivative of vapour specific enthalpy on the boundary between regions 4 and 3 or 1 w.r.t pressure"
+    extends Modelica.Icons.Function;
+    input Modelica.Units.SI.Pressure p "pressure";
+    output Modelica.Units.SI.DerEnthalpyByPressure dh_dp "specific enthalpy derivative w.r.t. pressure";
+  algorithm
+    dh_dp := ThermoSysPro.Properties.WaterSteam.Region.hvl_dp(p, ThermoSysPro.Properties.WaterSteam.Region.dewcurveL3_p(p));
+    annotation(
+      smoothOrder = 2);
+  end dhv_dp;
+
+  function drhovl_dp
+    extends Modelica.Icons.Function;
+    input Modelica.Units.SI.Pressure p "saturation pressure";
+    input ThermoSysPro.Properties.WaterSteam.Common.IF97PhaseBoundaryProperties3rd bpro "property record";
+    output Real dd_dp(unit = "kg/(m3.Pa)") "derivative of density along the phase boundary";
+  algorithm
+    dd_dp := -bpro.d * bpro.d * (bpro.vp + bpro.vt / bpro.dpT);
+    annotation(
+      derivative(noDerivative = bpro) = drhovl_dp_der,
+      Inline = false,
+      LateInline = true);
+  end drhovl_dp;
+
+  function drhol_dp "derivative of density of saturated water w.r.t. pressure"
+    extends Modelica.Icons.Function;
+    input Modelica.Units.SI.Pressure p "saturation pressure";
+    output Modelica.Units.SI.DerDensityByPressure dd_dp "derivative of density of water at the boiling point";
+  algorithm
+    dd_dp := ThermoSysPro.Properties.WaterSteam.Region.drhovl_dp(p, ThermoSysPro.Properties.WaterSteam.Region.boilingcurveL3_p(p));
+  end drhol_dp;
+
+  function drhov_dp "derivative of density of saturated steam w.r.t. pressure"
+    extends Modelica.Icons.Function;
+    input Modelica.Units.SI.Pressure p "saturation pressure";
+    output Modelica.Units.SI.DerDensityByPressure dd_dp "derivative of density of water at the boiling point";
+  algorithm
+    dd_dp := ThermoSysPro.Properties.WaterSteam.Region.drhovl_dp(p, ThermoSysPro.Properties.WaterSteam.Region.dewcurveL3_p(p));
+  end drhov_dp;
+
+  function drhovl_dp_der "Time derivative of density derivative along phase boundary"
+    extends Modelica.Icons.Function;
+    input Modelica.Units.SI.Pressure p "saturation pressure";
+    input ThermoSysPro.Properties.WaterSteam.Common.IF97PhaseBoundaryProperties3rd bpro "property record";
+    input Real p_der "Time derivative of pressure";
+    output Real dd_dp_der "derivative of density along the phase boundary";
+  algorithm
+    dd_dp_der := 0.0;
+  end drhovl_dp_der;
+  annotation(
+    Icon(graphics = {Text(extent = {{-102, 0}, {24, -26}}, lineColor = {242, 148, 0}, textString = "Thermo"), Text(extent = {{-4, 8}, {68, -34}}, lineColor = {46, 170, 220}, textString = "SysPro"), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-32, 12}, {-16, 14}, {6, 14}, {26, 12}, {42, 8}, {52, 2}, {42, 6}, {28, 10}, {6, 12}, {-12, 12}, {-16, 12}, {-34, 10}, {-50, 6}, {-62, 2}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-44, 38}, {-24, 38}, {-26, 30}, {-26, 22}, {-24, 14}, {-24, 12}, {-46, 8}, {-42, 22}, {-42, 30}, {-44, 38}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-26, 20}, {-20, 20}, {-20, 22}, {-14, 22}, {-14, 20}, {-12, 20}, {-12, 12}, {-26, 12}, {-28, 12}, {-26, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-8, 14}, {-8, 24}, {-6, 24}, {-6, 14}, {-8, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 30}, {-6, 26}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 36}, {-6, 32}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 42}, {-6, 38}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-8, 48}, {-6, 44}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-4, 14}, {-4, 26}, {-2, 26}, {-2, 14}, {-4, 14}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 32}, {-2, 28}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 38}, {-2, 34}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 44}, {-2, 40}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-4, 50}, {-2, 46}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-2, 20}, {8, 20}, {8, 22}, {10, 22}, {18, 22}, {18, 12}, {-4, 14}, {-2, 20}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Polygon(points = {{-62, 2}, {-58, 4}, {-48, 8}, {-36, 10}, {-18, 12}, {6, 12}, {26, 10}, {42, 6}, {52, 0}, {42, 4}, {28, 8}, {6, 10}, {-12, 10}, {-18, 10}, {-38, 8}, {-50, 6}, {-62, 2}}, lineColor = {242, 148, 0}, fillColor = {242, 148, 0}, fillPattern = FillPattern.Solid), Line(points = {{22, 12}, {22, 14}, {22, 16}, {24, 14}, {20, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{26, 12}, {26, 14}, {26, 16}, {28, 14}, {24, 18}}, color = {46, 170, 220}, thickness = 0.5), Line(points = {{30, 10}, {30, 12}, {30, 14}, {32, 12}, {28, 16}}, color = {46, 170, 220}, thickness = 0.5), Polygon(points = {{36, 8}, {36, 30}, {34, 34}, {36, 38}, {40, 38}, {40, 8}, {36, 8}}, lineColor = {46, 170, 220}, fillColor = {46, 170, 220}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-100, 80}, {80, -100}}, lineColor = {0, 0, 255}), Line(points = {{-100, 80}, {-80, 100}, {100, 100}, {100, -80}, {80, -100}}, color = {0, 0, 255}, smooth = Smooth.None), Line(points = {{80, 80}, {100, 100}}, color = {0, 0, 255}, smooth = Smooth.None)}));
+end Region;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam: Region.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteam: Region.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda1Td_dT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda1Td_dT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda1Td_dT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda1Td_dT.mo"	2022-03-10 09:58:27.836150441 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Conductivity;
 function dlambda1Td_dT
   "Derivative of conductivity wrt. specific enthalpy at constant pressure in liquid region for given density and temperature"
- input Modelica.SIunits.Density d "Density";
- input Modelica.SIunits.Temperature T "Temperature";
+ input Modelica.Units.SI.Density d "Density";
+ input Modelica.Units.SI.Temperature T "Temperature";
  output Real dlambdaTd
     "Derivative of conductivity wrt. temperature at constant density";
   lambda1_dT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda1dT_dT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda1dT_dT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda1dT_dT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda1dT_dT.mo"	2022-03-10 09:58:27.828150439 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Conductivity;
 function dlambda1dT_dT
   "Derivative of conductivity wrt. pressure at constant specific enthalpy in liquid region for given density and temperature"
- input Modelica.SIunits.Density d "Density";
- input Modelica.SIunits.Temperature T "Temperature";
+ input Modelica.Units.SI.Density d "Density";
+ input Modelica.Units.SI.Temperature T "Temperature";
  output Real dlambdadT
     "Derivative of conductivity wrt. density at constant temperature";
   lambda1_dT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda1hp_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda1hp_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda1hp_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda1hp_Ph.mo"	2022-03-10 09:58:27.820150438 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Conductivity;
 function dlambda1hp_Ph
   "Derivative of conductivity wrt. specific enthalpy at constant pressure in liquid region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real dlambdahp
     "Derivative of conductivity wrt. specific enthalpy at constant pressure";
   lambda1_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda1ph_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda1ph_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda1ph_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda1ph_Ph.mo"	2022-03-10 09:58:27.812150438 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Conductivity;
 function dlambda1ph_Ph
   "Derivative of conductivity wrt. pressure at constant specific enthalpy in liquid region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real dlambdaph
     "Derivative of conductivity wrt. pressure at constant specific enthalpy";
   lambda1_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda2Td_dT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda2Td_dT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda2Td_dT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda2Td_dT.mo"	2022-03-10 09:58:27.804150437 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Conductivity;
 function dlambda2Td_dT
   "Derivative of conductivity wrt. specific enthalpy at constant pressure in vapor region for given density and temperature"
- input Modelica.SIunits.Density d "Density";
- input Modelica.SIunits.Temperature T "Temperature";
+ input Modelica.Units.SI.Density d "Density";
+ input Modelica.Units.SI.Temperature T "Temperature";
  output Real dlambdaTd
     "Derivative of conductivity wrt.  temperature at constant density";
   lambda2_dT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda2dT_dT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda2dT_dT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda2dT_dT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda2dT_dT.mo"	2022-03-10 09:58:27.800150435 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Conductivity;
 function dlambda2dT_dT
   "Derivative of conductivity wrt. pressure at constant specific enthalpy in vapor region for given density and temperature"
- input Modelica.SIunits.Density d "Density";
- input Modelica.SIunits.Temperature T "Temperature";
+ input Modelica.Units.SI.Density d "Density";
+ input Modelica.Units.SI.Temperature T "Temperature";
  output Real dlambdadT
     "Derivative of conductivity wrt. density at constant temperature";
   lambda2_dT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda2hp_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda2hp_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda2hp_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda2hp_Ph.mo"	2022-03-10 09:58:27.792150435 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Conductivity;
 function dlambda2hp_Ph
   "Derivative of conductivity wrt. specific enthalpy at constant pressure in vapor region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real dlambdahp
     "Derivative of conductivity wrt. specific enthalpy at constant pressure";
   lambda2_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda2ph_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda2ph_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda2ph_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/dlambda2ph_Ph.mo"	2022-03-10 09:58:27.784150433 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Conductivity;
 function dlambda2ph_Ph
   "Derivative of conductivity wrt. pressure at constant specific enthalpy in vapor region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real dlambdaph
     "Derivative of conductivity wrt. pressure at constant specific enthalpy";
   lambda2_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/lambda1_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/lambda1_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/lambda1_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/lambda1_Ph.mo"	2022-03-10 09:58:27.780150434 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Conductivity;
 function lambda1_Ph
   "Conductivity in liquid region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
- output Modelica.SIunits.ThermalConductivity  lambda "Thermal conductivity";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+ output Modelica.Units.SI.ThermalConductivity  lambda "Thermal conductivity";
   lambda1_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/lambda1_dT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/lambda1_dT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/lambda1_dT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/lambda1_dT.mo"	2022-03-10 09:58:27.768150432 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Conductivity;
 function lambda1_dT
   "Conductivity in liquid region for given density and temperature"
- input Modelica.SIunits.Density d "Density";
- input Modelica.SIunits.Temperature T "Temperature";
- output Modelica.SIunits.ThermalConductivity  lambda "Thermal conductivity";
+ input Modelica.Units.SI.Density d "Density";
+ input Modelica.Units.SI.Temperature T "Temperature";
+ output Modelica.Units.SI.ThermalConductivity  lambda "Thermal conductivity";
   lambda1_dT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/lambda2_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/lambda2_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/lambda2_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/lambda2_Ph.mo"	2022-03-10 09:58:27.752150429 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Conductivity;
 function lambda2_Ph
   "Conductivity in vapor region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
- output Modelica.SIunits.ThermalConductivity  lambda "Thermal conductivity";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+ output Modelica.Units.SI.ThermalConductivity  lambda "Thermal conductivity";
   lambda2_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/lambda2_dT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/lambda2_dT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/lambda2_dT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Conductivity/lambda2_dT.mo"	2022-03-10 09:58:27.740150427 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Conductivity;
 function lambda2_dT
   "Conductivity in vapor region for given density and temperature"
- input Modelica.SIunits.Density d "Density";
- input Modelica.SIunits.Temperature T "Temperature";
- output Modelica.SIunits.ThermalConductivity  lambda "Thermal conductivity";
+ input Modelica.Units.SI.Density d "Density";
+ input Modelica.Units.SI.Temperature T "Temperature";
+ output Modelica.Units.SI.ThermalConductivity  lambda "Thermal conductivity";
   lambda2_dT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d1_PT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d1_PT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d1_PT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d1_PT.mo"	2022-03-10 09:58:27.684150422 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Density;
 function d1_PT "Density in liquid region for given pressure and temperature"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.Temperature T "Temperature";
- output Modelica.SIunits.Density d "Density";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.Temperature T "Temperature";
+ output Modelica.Units.SI.Density d "Density";
   d1_PT_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d1_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d1_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d1_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d1_Ph.mo"	2022-03-10 09:58:27.664150418 +0000
@@ -1,10 +1,10 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Density;
 function d1_Ph
   "Density in liquid region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
- output Modelica.SIunits.Density d "Density";
- protected
+
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+ output Modelica.Units.SI.Density d "Density"; protected
   d1_Ph_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d1_Ps.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d1_Ps.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d1_Ps.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d1_Ps.mo"	2022-03-10 09:58:27.648150417 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Density;
 function d1_Ps
   "Density in liquid region for given pressure and specific entropy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEntropy s "Specific entropy";
- output Modelica.SIunits.Density d "Density";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEntropy s "Specific entropy";
+ output Modelica.Units.SI.Density d "Density";
   d1_Ps_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d1sat_T.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d1sat_T.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d1sat_T.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d1sat_T.mo"	2022-03-10 09:58:27.632150414 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Density;
 function d1sat_T "density at liquid saturation for given temperature"
 
-  input Modelica.SIunits.Temperature T "Temperature";
-  output Modelica.SIunits.Density d "density";
-  protected d1sat_T_coef coef
+
+  input Modelica.Units.SI.Temperature T "Temperature";
+  output Modelica.Units.SI.Density d "density";  protected d1sat_T_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
   d := ThermoSysPro.Properties.WaterSteamSimple.Utilities.polynomial_x_order5(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2_PT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2_PT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2_PT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2_PT.mo"	2022-03-10 09:58:27.612150411 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Density;
 function d2_PT "Density in vapor region for given pressure and temperature"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.Temperature T "Temperature";
- output Modelica.SIunits.Density d "Density";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.Temperature T "Temperature";
+ output Modelica.Units.SI.Density d "Density";
   d1_PT_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2_Ph.mo"	2022-03-10 09:58:27.584150409 +0000
@@ -1,10 +1,10 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Density;
 function d2_Ph
   "Density in steam region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
- output Modelica.SIunits.Density d "Density";
-  protected
+
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+ output Modelica.Units.SI.Density d "Density";  protected
   d2_Ph_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2_Ps.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2_Ps.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2_Ps.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2_Ps.mo"	2022-03-10 09:58:27.564150406 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Density;
 function d2_Ps
   "Density in liquid region for given pressure and specific entropy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEntropy s "Specific entropy";
- output Modelica.SIunits.Density d "Density";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEntropy s "Specific entropy";
+ output Modelica.Units.SI.Density d "Density";
   d2_Ps_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2d1hh_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2d1hh_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2d1hh_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2d1hh_Ph.mo"	2022-03-10 09:58:27.532150401 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Density;
 function d2d1hh_Ph
   "Second derivative of density wrt. enthalpy in liquid region for given pressure and enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real d2dhh;
  protected d1_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2d1hp_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2d1hp_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2d1hp_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2d1hp_Ph.mo"	2022-03-10 09:58:27.516150399 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Density;
 function d2d1hp_Ph
   "Second derivative of density wrt. enthalpy and pressure in liquid region for given pressure and enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real d2dhp;
 
   protected d1_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2d1pp_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2d1pp_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2d1pp_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2d1pp_Ph.mo"	2022-03-10 09:58:27.452150392 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Density;
 function d2d1pp_Ph
   "Second derivative of density wrt. pressure in liquid region for given pressure and enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real d2dpp;
  protected d1_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2d2hh_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2d2hh_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2d2hh_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2d2hh_Ph.mo"	2022-03-10 09:58:27.448150391 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Density;
 function d2d2hh_Ph
   "Second derivative of density wrt. enthalpy in vapor region for given pressure and enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real d2dhh;
  protected d2_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2d2hp_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2d2hp_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2d2hp_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2d2hp_Ph.mo"	2022-03-10 09:58:27.440150390 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Density;
 function d2d2hp_Ph
   "Second derivative of density wrt. enthalpy and pressure in vapor region for given pressure and enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real d2dhp;
 
   protected d2_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2d2pp_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2d2pp_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2d2pp_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2d2pp_Ph.mo"	2022-03-10 09:58:27.432150390 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Density;
 function d2d2pp_Ph
   "Second derivative of density wrt. pressure in vapor region for given pressure and enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real d2dpp;
  protected d2_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2sat_T.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2sat_T.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2sat_T.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/d2sat_T.mo"	2022-03-10 09:58:27.420150388 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Density;
 function d2sat_T "density at vapor saturation for given temperature"
 
-  input Modelica.SIunits.Temperature T "Temperature";
-  output Modelica.SIunits.Density d "density";
-  protected d2sat_T_coef coef
+
+  input Modelica.Units.SI.Temperature T "Temperature";
+  output Modelica.Units.SI.Density d "density";  protected d2sat_T_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
   d := 10^(ThermoSysPro.Properties.WaterSteamSimple.Utilities.polynomial_x_order5(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd1Tp_PT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd1Tp_PT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd1Tp_PT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd1Tp_PT.mo"	2022-03-10 09:58:27.404150385 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Density;
 function dd1Tp_PT
   "Derivative of density wrt. temperature at constant pressure in liquid region for given pressure and temperature"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.Temperature T "temperature";
- output Modelica.SIunits.DerDensityByTemperature ddTp
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.Temperature T "temperature";
+ output Modelica.Units.SI.DerDensityByTemperature ddTp
     "Derivative of density wrt. temperature at constant pressure";
   d1_PT_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd1hp_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd1hp_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd1hp_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd1hp_Ph.mo"	2022-03-10 09:58:27.392150383 +0000
@@ -1,11 +1,11 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Density;
 function dd1hp_Ph
   "Derivative of density wrt. specific enthalpy at constant pressure in liquid region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
- output Modelica.SIunits.DerDensityByEnthalpy ddhp
-    "Derivative of density wrt. specific enthalpy at constant pressure";
-  protected
+
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+ output Modelica.Units.SI.DerDensityByEnthalpy ddhp
+    "Derivative of density wrt. specific enthalpy at constant pressure";  protected
   d1_Ph_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd1pT_PT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd1pT_PT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd1pT_PT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd1pT_PT.mo"	2022-03-10 09:58:27.380150382 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Density;
 function dd1pT_PT
   "Derivative of density wrt. pressure at constant temperature in liquid region for given pressure and temperature"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.Temperature T "temperature";
- output Modelica.SIunits.DerDensityByPressure ddpT
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.Temperature T "temperature";
+ output Modelica.Units.SI.DerDensityByPressure ddpT
     "Derivative of density wrt. pressure at constant specific entropy";
   d1_PT_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd1ph_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd1ph_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd1ph_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd1ph_Ph.mo"	2022-03-10 09:58:27.372150381 +0000
@@ -1,11 +1,11 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Density;
 function dd1ph_Ph
   "Derivative of density wrt. pressure at constant specific enthalpy in liquid region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
- output Modelica.SIunits.DerDensityByPressure ddph
-    "Derivative of density wrt. pressure at constant specific enthalpy";
-  protected
+
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+ output Modelica.Units.SI.DerDensityByPressure ddph
+    "Derivative of density wrt. pressure at constant specific enthalpy";  protected
   d1_Ph_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd1ps_Ps.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd1ps_Ps.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd1ps_Ps.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd1ps_Ps.mo"	2022-03-10 09:58:27.364150380 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Density;
 function dd1ps_Ps
   "Derivative of density wrt. pressure at constant specific entropy in liquid region for given pressure and specific entropy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEntropy s "Specific entropy";
- output Modelica.SIunits.DerDensityByPressure ddps
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEntropy s "Specific entropy";
+ output Modelica.Units.SI.DerDensityByPressure ddps
     "Derivative of density wrt. pressure at constant specific entropy";
   d1_Ps_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd1sp_Ps.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd1sp_Ps.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd1sp_Ps.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd1sp_Ps.mo"	2022-03-10 09:58:27.356150380 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Density;
 function dd1sp_Ps
   "Derivative of density wrt. specific entropy at constant pressure in liquid region for given pressure and specific entropy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEntropy s "Specific entropy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEntropy s "Specific entropy";
  output ThermoSysPro.Units.DerDensityByEntropy ddsp
     "Derivative of density wrt. specific enthalpy at constant pressure";
   d1_Ps_coef coef
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd2Tp_PT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd2Tp_PT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd2Tp_PT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd2Tp_PT.mo"	2022-03-10 09:58:27.352150379 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Density;
 function dd2Tp_PT
   "Derivative of density wrt. temperature at constant pressure in vapor region for given pressure and temperature"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.Temperature T "temperature";
- output Modelica.SIunits.DerDensityByTemperature ddTp
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.Temperature T "temperature";
+ output Modelica.Units.SI.DerDensityByTemperature ddTp
     "Derivative of density wrt. temperature at constant pressure";
   d1_PT_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd2hp_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd2hp_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd2hp_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd2hp_Ph.mo"	2022-03-10 09:58:27.344150378 +0000
@@ -1,11 +1,11 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Density;
 function dd2hp_Ph
   "Derivative of density wrt. specific enthalpy at constant pressure in steam region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
- output Modelica.SIunits.DerDensityByEnthalpy ddhp
-    "Derivative of density wrt. specific enthalpy at constant pressure";
- protected d2_Ph_coef coef
+
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+ output Modelica.Units.SI.DerDensityByEnthalpy ddhp
+    "Derivative of density wrt. specific enthalpy at constant pressure"; protected d2_Ph_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd2pT_PT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd2pT_PT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd2pT_PT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd2pT_PT.mo"	2022-03-10 09:58:27.332150377 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Density;
 function dd2pT_PT
   "Derivative of density wrt. pressure at constant temperature in vapor region for given pressure and temperature"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.Temperature T "temperature";
- output Modelica.SIunits.DerDensityByPressure ddpT
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.Temperature T "temperature";
+ output Modelica.Units.SI.DerDensityByPressure ddpT
     "Derivative of density wrt. pressure at constant specific entropy";
   d1_PT_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd2ph_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd2ph_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd2ph_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd2ph_Ph.mo"	2022-03-10 09:58:27.324150376 +0000
@@ -1,11 +1,11 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Density;
 function dd2ph_Ph
   "Derivative of density wrt. pressure at constant specific enthalpy in steam region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
- output Modelica.SIunits.DerDensityByPressure ddph
-    "Derivative of density wrt. pressure at constant specific enthalpy";
- protected d2_Ph_coef coef
+
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+ output Modelica.Units.SI.DerDensityByPressure ddph
+    "Derivative of density wrt. pressure at constant specific enthalpy"; protected d2_Ph_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd2ps_Ps.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd2ps_Ps.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd2ps_Ps.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd2ps_Ps.mo"	2022-03-10 09:58:27.316150374 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Density;
 function dd2ps_Ps
   "Derivative of density wrt. pressure at constant specific entropy in liquid region for given pressure and specific entropy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEntropy s "Specific entropy";
- output Modelica.SIunits.DerDensityByPressure ddps
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEntropy s "Specific entropy";
+ output Modelica.Units.SI.DerDensityByPressure ddps
     "Derivative of density wrt. pressure at constant specific entropy";
   d2_Ps_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd2sp_Ps.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd2sp_Ps.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd2sp_Ps.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Density/dd2sp_Ps.mo"	2022-03-10 09:58:27.308150373 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Density;
 function dd2sp_Ps
   "Derivative of density wrt. specific entropy at constant pressure in liquid region for given pressure and specific entropy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEntropy s "Specific entropy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEntropy s "Specific entropy";
  output ThermoSysPro.Units.DerDensityByEntropy ddsp
     "Derivative of density wrt. specific enthalpy at constant pressure";
   d2_Ps_coef coef
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/d2u1hh_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/d2u1hh_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/d2u1hh_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/d2u1hh_Ph.mo"	2022-03-10 09:58:27.248150366 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Energy;
 function d2u1hh_Ph
   "Second derivative of specific inner energy wrt. enthalpy in liquid region for given pressure and enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real d2uhh;
  protected u1_Ph_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/d2u1hp_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/d2u1hp_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/d2u1hp_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/d2u1hp_Ph.mo"	2022-03-10 09:58:27.236150365 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Energy;
 function d2u1hp_Ph
   "Second derivative of specific inner energy wrt. enthalpy and pressure in liquid region for given pressure and enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real d2uhp;
 
  protected u1_Ph_coef coef
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/d2u1pp_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/d2u1pp_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/d2u1pp_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/d2u1pp_Ph.mo"	2022-03-10 09:58:27.228150363 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Energy;
 function d2u1pp_Ph
   "Second derivative of specific inner energy wrt. pressure in liquid region for given pressure and enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real d2upp;
  protected u1_Ph_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/d2u2hh_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/d2u2hh_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/d2u2hh_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/d2u2hh_Ph.mo"	2022-03-10 09:58:27.220150362 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Energy;
 function d2u2hh_Ph
   "Second derivative of specific inner energy wrt. enthalpy in vapor region for given pressure and enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real d2uhh;
  protected u2_Ph_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/d2u2hp_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/d2u2hp_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/d2u2hp_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/d2u2hp_Ph.mo"	2022-03-10 09:58:27.208150360 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Energy;
 function d2u2hp_Ph
   "Second derivative of specific inner energy wrt. enthalpy and pressure in vapor region for given pressure and enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real d2uhp;
   protected 
   u2_Ph_coef coef
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/d2u2pp_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/d2u2pp_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/d2u2pp_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/d2u2pp_Ph.mo"	2022-03-10 09:58:27.200150359 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Energy;
 function d2u2pp_Ph
   "Second derivative of specific inner energy wrt. pressure in vapor region for given pressure and enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real d2upp;
  protected u2_Ph_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du1Tp_PT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du1Tp_PT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du1Tp_PT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du1Tp_PT.mo"	2022-03-10 09:58:27.192150359 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Energy;
 function du1Tp_PT
   "Derivative of inner energy wrt. temperature at constant pressure in liquid region for given pressure and temperature"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.Temperature T "temperature";
- output Modelica.SIunits.SpecificHeatCapacity duTp
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.Temperature T "temperature";
+ output Modelica.Units.SI.SpecificHeatCapacity duTp
     "Derivative of density wrt. temperature at constant pressure";
   u1_PT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du1hp_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du1hp_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du1hp_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du1hp_Ph.mo"	2022-03-10 09:58:27.184150357 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Energy;
 function du1hp_Ph
   "Derivative of specific inner energy wrt. specific enthalpy at constant pressure in liquid region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real duhp(unit = "1")
     "Derivative of specific inner energy wrt. specific enthalpy at constant pressure";
   protected
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du1pT_PT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du1pT_PT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du1pT_PT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du1pT_PT.mo"	2022-03-10 09:58:27.176150356 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Energy;
 function du1pT_PT
   "Derivative of inner energy wrt. pressure at constant temperature in liquid region for given pressure and temperature"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.Temperature T "temperature";
- output Modelica.SIunits.DerEnergyByPressure dupT
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.Temperature T "temperature";
+ output Modelica.Units.SI.DerEnergyByPressure dupT
     "Derivative of inner energy wrt. pressure at constant specific entropy";
   u1_PT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du1ph_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du1ph_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du1ph_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du1ph_Ph.mo"	2022-03-10 09:58:27.172150357 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Energy;
 function du1ph_Ph
   "Derivative of specific inner energy wrt. pressure at constant specific enthalpy in liquid region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real duph(unit="m3/kg")
     "Derivative of specific inner energy wrt. pressure at constant specific enthalpy";
   protected
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du2Tp_PT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du2Tp_PT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du2Tp_PT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du2Tp_PT.mo"	2022-03-10 09:58:27.164150355 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Energy;
 function du2Tp_PT
   "Derivative of inner energy wrt. temperature at constant pressure in vapor region for given pressure and temperature"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.Temperature T "temperature";
- output Modelica.SIunits.SpecificHeatCapacity duTp
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.Temperature T "temperature";
+ output Modelica.Units.SI.SpecificHeatCapacity duTp
     "Derivative of density wrt. temperature at constant pressure";
   u2_PT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du2hp_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du2hp_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du2hp_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du2hp_Ph.mo"	2022-03-10 09:58:27.160150355 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Energy;
 function du2hp_Ph
   "Derivative of specific inner energy wrt. specific enthalpy at constant pressure in vapor region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real duhp(unit = "1")
     "Derivative of specific inner energy wrt. specific enthalpy at constant pressure";
   protected u2_Ph_coef coef
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du2pT_PT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du2pT_PT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du2pT_PT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du2pT_PT.mo"	2022-03-10 09:58:27.152150353 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Energy;
 function du2pT_PT
   "Derivative of inner energy wrt. pressure at constant temperature in vapor region for given pressure and temperature"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.Temperature T "temperature";
- output Modelica.SIunits.DerEnergyByPressure dupT
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.Temperature T "temperature";
+ output Modelica.Units.SI.DerEnergyByPressure dupT
     "Derivative of inner energy wrt. pressure at constant specific entropy";
   u2_PT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du2ph_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du2ph_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du2ph_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/du2ph_Ph.mo"	2022-03-10 09:58:27.144150352 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Energy;
 function du2ph_Ph
   "Derivative of specific inner energy wrt. pressure at constant specific enthalpy in vapor region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real duph(unit="m3/kg")
     "Derivative of specific inner energy wrt. pressure at constant specific enthalpy";
   protected u2_Ph_coef coef
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/u1_PT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/u1_PT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/u1_PT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/u1_PT.mo"	2022-03-10 09:58:27.132150351 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Energy;
 function u1_PT
   "Specific inner energy in liquid region for given pressure and temperature"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.Temperature T "Temperature";
- output Modelica.SIunits.SpecificEnergy u "Specific inner energy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.Temperature T "Temperature";
+ output Modelica.Units.SI.SpecificEnergy u "Specific inner energy";
   u1_PT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/u1_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/u1_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/u1_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/u1_Ph.mo"	2022-03-10 09:58:27.116150350 +0000
@@ -1,10 +1,10 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Energy;
 function u1_Ph
   "Specific inner energy in liquid region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
- output Modelica.SIunits.SpecificEnergy u "Specific inner energy";
- protected
+
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+ output Modelica.Units.SI.SpecificEnergy u "Specific inner energy"; protected
   u1_Ph_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/u2_PT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/u2_PT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/u2_PT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/u2_PT.mo"	2022-03-10 09:58:27.100150347 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Energy;
 function u2_PT
   "Specific inner energy in vapor region for given pressure and temperature"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.Temperature T "Temperature";
- output Modelica.SIunits.SpecificEnergy u "Specific inner energy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.Temperature T "Temperature";
+ output Modelica.Units.SI.SpecificEnergy u "Specific inner energy";
   u2_PT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/u2_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/u2_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/u2_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Energy/u2_Ph.mo"	2022-03-10 09:58:27.036150339 +0000
@@ -1,10 +1,10 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Energy;
 function u2_Ph
   "Specific inner energy in vapor region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
- output Modelica.SIunits.SpecificEnergy u "Specific inner energy";
- protected
+
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+ output Modelica.Units.SI.SpecificEnergy u "Specific inner energy"; protected
   u2_Ph_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/d2h1satpp_P.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/d2h1satpp_P.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/d2h1satpp_P.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/d2h1satpp_P.mo"	2022-03-10 09:58:27.004150335 +0000
@@ -2,7 +2,7 @@
 function d2h1satpp_P
   "derivative of specific enthalpy at liquid saturation wrt. pressure"
 
-  input Modelica.SIunits.Pressure p "pressure";
+  input Modelica.Units.SI.Pressure p "pressure";
   output Real d2hpp "second derivative of enthalpy";
   protected h1sat_P_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/d2h2satpp_P.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/d2h2satpp_P.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/d2h2satpp_P.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/d2h2satpp_P.mo"	2022-03-10 09:58:26.996150334 +0000
@@ -2,7 +2,7 @@
 function d2h2satpp_P
   "derivative of specific enthalpy at vapor saturation wrt. pressure"
 
-  input Modelica.SIunits.Pressure p "pressure";
+  input Modelica.Units.SI.Pressure p "pressure";
   output Real d2hpp "derivative of enthalpy";
   protected
   h2sat_P_coef1 coef1;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh1Td_dT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh1Td_dT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh1Td_dT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh1Td_dT.mo"	2022-03-10 09:58:26.980150331 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Enthalpy;
 function dh1Td_dT
   "Derivative of specific enthalpy wrt. specific entropy at constant density in liquid region for given density and temperature"
- input Modelica.SIunits.Density d "Density";
- input Modelica.SIunits.Temperature T "Temperature";
+ input Modelica.Units.SI.Density d "Density";
+ input Modelica.Units.SI.Temperature T "Temperature";
  output Real dhTd
     "Derivative of specific enthalpy wrt. temperature at constant density";
   h1_dT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh1Tp_PT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh1Tp_PT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh1Tp_PT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh1Tp_PT.mo"	2022-03-10 09:58:26.972150331 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Enthalpy;
 function dh1Tp_PT
   "Derivative of specific enthalpy wrt. specific entropy at constant pressure in liquid region for given pressure and temperature"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.Temperature T "Temperature";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.Temperature T "Temperature";
  output Real dhTp
     "Derivative of specific enthalpy wrt. temperature at constant pressure";
   h1_PT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh1dT_dT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh1dT_dT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh1dT_dT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh1dT_dT.mo"	2022-03-10 09:58:26.964150330 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Enthalpy;
 function dh1dT_dT
   "Derivative of specific enthalpy wrt. density at constant specific enthalpy in liquid region for given density and temperature"
-input Modelica.SIunits.Density d "Density";
- input Modelica.SIunits.Temperature T "Temperature";
+input Modelica.Units.SI.Density d "Density";
+ input Modelica.Units.SI.Temperature T "Temperature";
  output Real dhdT
     "Derivative of specific enthalpy wrt. density at constant temperature";
   h1_dT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh1pT_PT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh1pT_PT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh1pT_PT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh1pT_PT.mo"	2022-03-10 09:58:26.948150327 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Enthalpy;
 function dh1pT_PT
   "Derivative of specific enthalpy wrt. pressure at constant specific enthalpy in liquid region for given pressure and temperature"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.Temperature T "Temperature";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.Temperature T "Temperature";
  output Real dhpT
     "Derivative of specific enthalpy wrt. pressure at constant temperature";
   h1_PT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh1ps_Ps.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh1ps_Ps.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh1ps_Ps.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh1ps_Ps.mo"	2022-03-10 09:58:26.940150327 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Enthalpy;
 function dh1ps_Ps
   "Derivative of specific enthalpy wrt. pressure at constant specific enthalpy in liquid region for given pressure and specific entropy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEntropy s "Specific entropy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEntropy s "Specific entropy";
  output Real dhps
     "Derivative of specific enthalpy wrt. pressure at constant specific entropy";
   h1_Ps_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh1satp_P.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh1satp_P.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh1satp_P.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh1satp_P.mo"	2022-03-10 09:58:26.928150325 +0000
@@ -2,7 +2,7 @@
 function dh1satp_P
   "derivative of specific enthalpy at liquid saturation wrt. pressure"
 
-  input Modelica.SIunits.Pressure p "pressure";
+  input Modelica.Units.SI.Pressure p "pressure";
   output Real dhp(unit="m3/kg") "derivative of enthalpy";
   protected h1sat_P_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh1sp_Ps.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh1sp_Ps.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh1sp_Ps.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh1sp_Ps.mo"	2022-03-10 09:58:26.920150325 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Enthalpy;
 function dh1sp_Ps
   "Derivative of specific enthalpy wrt. specific entropy at constant pressure in liquid region for given pressure and specific entropy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEntropy s "Specific entropy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEntropy s "Specific entropy";
  output Real dhsp
     "Derivative of specific enthalpy wrt. specific enthalpy at constant pressure";
   h1_Ps_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh2Td_dT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh2Td_dT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh2Td_dT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh2Td_dT.mo"	2022-03-10 09:58:26.912150323 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Enthalpy;
 function dh2Td_dT
   "Derivative of specific enthalpy wrt. specific entropy at constant density in vapor region for given density and temperature"
- input Modelica.SIunits.Density d "Density";
- input Modelica.SIunits.Temperature T "Temperature";
+ input Modelica.Units.SI.Density d "Density";
+ input Modelica.Units.SI.Temperature T "Temperature";
  output Real dhTd
     "Derivative of specific enthalpy wrt. temperature at constant density";
   h2_dT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh2Tp_PT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh2Tp_PT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh2Tp_PT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh2Tp_PT.mo"	2022-03-10 09:58:26.900150321 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Enthalpy;
 function dh2Tp_PT
   "Derivative of specific enthalpy wrt. specific entropy at constant pressure in vapor region for given pressure and temperature"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.Temperature T "Temperature";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.Temperature T "Temperature";
  output Real dhTp
     "Derivative of specific enthalpy wrt. temperature at constant pressure";
   h2_PT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh2dT_dT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh2dT_dT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh2dT_dT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh2dT_dT.mo"	2022-03-10 09:58:26.892150320 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Enthalpy;
 function dh2dT_dT
   "Derivative of specific enthalpy wrt. density at constant specific enthalpy in vapor region for given density and temperature"
-input Modelica.SIunits.Density d "Density";
- input Modelica.SIunits.Temperature T "Temperature";
+input Modelica.Units.SI.Density d "Density";
+ input Modelica.Units.SI.Temperature T "Temperature";
  output Real dhdT
     "Derivative of specific enthalpy wrt. density at constant temperature";
   h2_dT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh2pT_PT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh2pT_PT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh2pT_PT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh2pT_PT.mo"	2022-03-10 09:58:26.884150319 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Enthalpy;
 function dh2pT_PT
   "Derivative of specific enthalpy wrt. pressure at constant specific enthalpy in vapor region for given pressure and temperature"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.Temperature T "Temperature";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.Temperature T "Temperature";
  output Real dhpT
     "Derivative of specific enthalpy wrt. pressure at constant specific entropy";
   h2_PT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh2ps_Ps.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh2ps_Ps.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh2ps_Ps.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh2ps_Ps.mo"	2022-03-10 09:58:26.872150318 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Enthalpy;
 function dh2ps_Ps
   "Derivative of specific enthalpy wrt. pressure at constant specific enthalpy in vapor region for given pressure and specific entropy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEntropy s "Specific entropy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEntropy s "Specific entropy";
  output Real dhps
     "Derivative of specific enthalpy wrt. pressure at constant specific entropy";
   h2_Ps_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh2satp_P.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh2satp_P.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh2satp_P.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh2satp_P.mo"	2022-03-10 09:58:26.864150318 +0000
@@ -2,7 +2,7 @@
 function dh2satp_P
   "derivative of specific enthalpy at vapor saturation wrt. pressure"
 
-  input Modelica.SIunits.Pressure p "pressure";
+  input Modelica.Units.SI.Pressure p "pressure";
   output Real dhp(unit="m3/kg") "derivative of enthalpy";
   protected
   h2sat_P_coef1 coef1;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh2sp_Ps.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh2sp_Ps.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh2sp_Ps.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/dh2sp_Ps.mo"	2022-03-10 09:58:26.824150311 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Enthalpy;
 function dh2sp_Ps
   "Derivative of specific enthalpy wrt. specific entropy at constant pressure in vapor region for given pressure and specific entropy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEntropy s "Specific entropy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEntropy s "Specific entropy";
  output Real dhsp
     "Derivative of specific enthalpy wrt. specific entropy at constant pressure";
   h2_Ps_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h1_PT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h1_PT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h1_PT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h1_PT.mo"	2022-03-10 09:58:26.816150311 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Enthalpy;
 function h1_PT
   "Specific enthalpy in liquid region for given pressure and temperature"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.Temperature T "Temperature";
- output Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.Temperature T "Temperature";
+ output Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
   h1_PT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h1_Ps.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h1_Ps.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h1_Ps.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h1_Ps.mo"	2022-03-10 09:58:26.804150309 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Enthalpy;
 function h1_Ps
   "Specific enthalpy in liquid region for given pressure and specific entropy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEntropy s "Specific entropy";
- output Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEntropy s "Specific entropy";
+ output Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
   h1_Ps_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h1_dT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h1_dT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h1_dT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h1_dT.mo"	2022-03-10 09:58:26.792150307 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Enthalpy;
 function h1_dT
   "Specific enthalpy in liquid region for given density and temperature"
- input Modelica.SIunits.Density d "Density";
- input Modelica.SIunits.Temperature T "Temperature";
- output Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.Density d "Density";
+ input Modelica.Units.SI.Temperature T "Temperature";
+ output Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
   h1_dT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h1sat_P.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h1sat_P.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h1sat_P.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h1sat_P.mo"	2022-03-10 09:58:26.780150306 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Enthalpy;
 function h1sat_P "specific enthalpy at liquid saturation for given pressure"
 
-  input Modelica.SIunits.Pressure p "pressure";
-  output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-  protected
+
+  input Modelica.Units.SI.Pressure p "pressure";
+  output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";  protected
   h1sat_P_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h2_PT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h2_PT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h2_PT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h2_PT.mo"	2022-03-10 09:58:26.772150305 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Enthalpy;
 function h2_PT
   "Specific enthalpy in vapor region for given pressure and temperature"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.Temperature T "Temperature";
- output Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.Temperature T "Temperature";
+ output Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
   h2_PT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h2_Ps.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h2_Ps.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h2_Ps.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h2_Ps.mo"	2022-03-10 09:58:26.760150303 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Enthalpy;
 function h2_Ps
   "Specific enthalpy in vapor region for given pressure and specific entropy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEntropy s "Specific entropy";
- output Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEntropy s "Specific entropy";
+ output Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
   h2_Ps_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h2_dT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h2_dT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h2_dT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h2_dT.mo"	2022-03-10 09:58:26.744150302 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Enthalpy;
 function h2_dT
   "Specific enthalpy in vapor region for given density and temperature"
- input Modelica.SIunits.Density d "Density";
- input Modelica.SIunits.Temperature T "Temperature";
- output Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.Density d "Density";
+ input Modelica.Units.SI.Temperature T "Temperature";
+ output Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
   h1_dT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h2sat_P.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h2sat_P.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h2sat_P.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Enthalpy/h2sat_P.mo"	2022-03-10 09:58:26.732150300 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Enthalpy;
 function h2sat_P "specific enthalpy at vapor saturation for given pressure"
 
-  input Modelica.SIunits.Pressure p "pressure";
-  output Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
+  input Modelica.Units.SI.Pressure p "pressure";
+  output Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
   protected
   h2sat_P_coef1 coef1;
   h2sat_P_coef2 coef2;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/ds1hp_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/ds1hp_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/ds1hp_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/ds1hp_Ph.mo"	2022-03-10 09:58:26.664150291 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Entropy;
 function ds1hp_Ph
   "Derivative of specific entropy wrt. specific enthalpy at constant pressure in liquid region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real dshp
     "Derivative of specific entropy wrt. specific enthalpy at constant pressure";
   s1_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/ds1ph_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/ds1ph_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/ds1ph_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/ds1ph_Ph.mo"	2022-03-10 09:58:26.656150291 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Entropy;
 function ds1ph_Ph
   "Derivative of specific entropy wrt. pressure at constant specific enthalpy in liquid region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real dsph
     "Derivative of specific entropy wrt. pressure at constant specific enthalpy";
   protected s1_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/ds1satp_P.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/ds1satp_P.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/ds1satp_P.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/ds1satp_P.mo"	2022-03-10 09:58:26.648150290 +0000
@@ -2,7 +2,7 @@
 function ds1satp_P
   "derivative of specificentropy wrt. pressure at liquid saturation for given pressure"
 
-  input Modelica.SIunits.Pressure p "pressure";
+  input Modelica.Units.SI.Pressure p "pressure";
   output Real dsp(unit="m3/(kg.K)") "derivative of entropy";
   s1sat_P_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/ds2hp_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/ds2hp_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/ds2hp_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/ds2hp_Ph.mo"	2022-03-10 09:58:26.644150289 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Entropy;
 function ds2hp_Ph
   "Derivative of specific entropy wrt. specific enthalpy at constant pressure in vapor region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real dshp
     "Derivative of specific entropy wrt. specific enthalpy at constant pressure";
   s2_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/ds2ph_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/ds2ph_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/ds2ph_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/ds2ph_Ph.mo"	2022-03-10 09:58:26.636150289 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Entropy;
 function ds2ph_Ph
   "Derivative of specific entropy wrt. pressure at constant specific enthalpy in vapor region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real dsph
     "Derivative of specific entropy wrt. pressure at constant specific enthalpy";
   protected s2_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/ds2satp_P.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/ds2satp_P.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/ds2satp_P.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/ds2satp_P.mo"	2022-03-10 09:58:26.624150287 +0000
@@ -2,7 +2,7 @@
 function ds2satp_P
   "derivative of specificentropy wrt. pressure at vapor saturation for given pressure"
 
-  input Modelica.SIunits.Pressure p "pressure";
+  input Modelica.Units.SI.Pressure p "pressure";
   output Real dsp(unit="m3/(kg.K)") "derivative of entropy";
   s2sat_P_coef1 coef1;
   s2sat_P_coef2 coef2;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/s1_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/s1_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/s1_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/s1_Ph.mo"	2022-03-10 09:58:26.616150286 +0000
@@ -1,10 +1,10 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Entropy;
 function s1_Ph
   "Specific entropy in liquid region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
- output Modelica.SIunits.SpecificEntropy s "Specific entropy";
- protected
+
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+ output Modelica.Units.SI.SpecificEntropy s "Specific entropy"; protected
   s1_Ph_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/s1sat_P.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/s1sat_P.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/s1sat_P.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/s1sat_P.mo"	2022-03-10 09:58:26.604150285 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Entropy;
 function s1sat_P "specificentropy at liquid saturation for given pressure"
-  input Modelica.SIunits.Pressure p "pressure";
-  output Modelica.SIunits.SpecificEntropy s "specific entropy";
+  input Modelica.Units.SI.Pressure p "pressure";
+  output Modelica.Units.SI.SpecificEntropy s "specific entropy";
   s1sat_P_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
   s := ThermoSysPro.Properties.WaterSteamSimple.Utilities.polynomial_x_order7(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/s2_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/s2_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/s2_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/s2_Ph.mo"	2022-03-10 09:58:26.592150283 +0000
@@ -1,10 +1,10 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Entropy;
 function s2_Ph
   "Specific entropy in vapor region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
- output Modelica.SIunits.SpecificEntropy s "Specific entropy";
- protected
+
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+ output Modelica.Units.SI.SpecificEntropy s "Specific entropy"; protected
   s2_Ph_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/s2sat_P.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/s2sat_P.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/s2sat_P.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Entropy/s2sat_P.mo"	2022-03-10 09:58:26.568150279 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Entropy;
 function s2sat_P "specificentropy at vapor saturation for given pressure"
 
-  input Modelica.SIunits.Pressure p "pressure";
-  output Modelica.SIunits.SpecificEntropy s "specific entropy";
+  input Modelica.Units.SI.Pressure p "pressure";
+  output Modelica.Units.SI.SpecificEntropy s "specific entropy";
   s2sat_P_coef1 coef1;
   s2sat_P_coef2 coef2;
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/cp1_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/cp1_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/cp1_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/cp1_Ph.mo"	2022-03-10 09:58:26.516150274 +0000
@@ -1,11 +1,11 @@
 within ThermoSysPro.Properties.WaterSteamSimple.HeatCapacity;
 function cp1_Ph
   "Specific heat capacity at constant presure in liquid region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
- output Modelica.SIunits.SpecificHeatCapacity cp
-    "Specific heat capacity at constant presure";
-  protected
+
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+ output Modelica.Units.SI.SpecificHeatCapacity cp
+    "Specific heat capacity at constant presure";  protected
   cp1_Ph_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/cp2_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/cp2_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/cp2_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/cp2_Ph.mo"	2022-03-10 09:58:26.480150268 +0000
@@ -1,11 +1,11 @@
 within ThermoSysPro.Properties.WaterSteamSimple.HeatCapacity;
 function cp2_Ph
   "Specific heat capacity at constant presure in vapor region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
- output Modelica.SIunits.SpecificHeatCapacity cp
-    "Specific heat capacity at constant presure";
-  protected
+
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+ output Modelica.Units.SI.SpecificHeatCapacity cp
+    "Specific heat capacity at constant presure";  protected
   cp2_Ph_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/cv1_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/cv1_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/cv1_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/cv1_Ph.mo"	2022-03-10 09:58:26.464150266 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.HeatCapacity;
 function cv1_Ph
   "Specific heat capacity at constant volume in liquid region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
- output Modelica.SIunits.SpecificHeatCapacity cv
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+ output Modelica.Units.SI.SpecificHeatCapacity cv
     "Specific heat capacity at constant volume";
   cv1_Ph_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/cv2_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/cv2_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/cv2_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/cv2_Ph.mo"	2022-03-10 09:58:26.452150266 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.HeatCapacity;
 function cv2_Ph
   "Specific heat capacity at constant volume in vapor region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
- output Modelica.SIunits.SpecificHeatCapacity cv
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+ output Modelica.Units.SI.SpecificHeatCapacity cv
     "Specific heat capacity at constant volume";
   cv2_Ph_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcp1hp_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcp1hp_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcp1hp_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcp1hp_Ph.mo"	2022-03-10 09:58:26.436150263 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.HeatCapacity;
 function dcp1hp_Ph
   "Derivative of specific heat capacity wrt. specific enthalpy at constant pressure in liquid region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real dcphp
     "Derivative of specific heat capacity wrt. specific enthalpy at constant pressure";
   cp1_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcp1ph_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcp1ph_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcp1ph_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcp1ph_Ph.mo"	2022-03-10 09:58:26.432150262 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.HeatCapacity;
 function dcp1ph_Ph
   "Derivative of specific heat capacity wrt. pressure at constant specific enthalpy in liquid region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real dcpph
     "Derivative of specific heat capacity wrt. pressure at constant specific enthalpy";
   protected cp1_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcp2hp_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcp2hp_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcp2hp_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcp2hp_Ph.mo"	2022-03-10 09:58:26.424150261 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.HeatCapacity;
 function dcp2hp_Ph
   "Derivative of specific heat capacity wrt. specific enthalpy at constant pressure in vapor region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real dcphp
     "Derivative of specific heat capacity wrt. specific enthalpy at constant pressure";
   cp2_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcp2ph_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcp2ph_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcp2ph_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcp2ph_Ph.mo"	2022-03-10 09:58:26.420150260 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.HeatCapacity;
 function dcp2ph_Ph
   "Derivative of specific heat capacity wrt. pressure at constant specific enthalpy in vapor region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real dcpph
     "Derivative of specific heat capacity wrt. pressure at constant specific enthalpy";
  protected cp2_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcv1hp_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcv1hp_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcv1hp_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcv1hp_Ph.mo"	2022-03-10 09:58:26.412150259 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.HeatCapacity;
 function dcv1hp_Ph
   "Derivative of specific heat capacity wrt. specific enthalpy at constant pressure in liquid region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real dcvhp
     "Derivative of specific heat capacity wrt. specific enthalpy at constant pressure";
   cv1_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcv1ph_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcv1ph_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcv1ph_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcv1ph_Ph.mo"	2022-03-10 09:58:26.408150260 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.HeatCapacity;
 function dcv1ph_Ph
   "Derivative of specific heat capacity wrt. pressure at constant specific enthalpy in liquid region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real dcvph
     "Derivative of specific heat capacity wrt. pressure at constant specific enthalpy";
   cv1_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcv2hp_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcv2hp_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcv2hp_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcv2hp_Ph.mo"	2022-03-10 09:58:26.404150259 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.HeatCapacity;
 function dcv2hp_Ph
   "Derivative of specific heat capacity wrt. specific enthalpy at constant pressure in vapor region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real dcvhp
     "Derivative of specific heat capacity wrt. specific enthalpy at constant pressure";
   cv2_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcv2ph_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcv2ph_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcv2ph_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/HeatCapacity/dcv2ph_Ph.mo"	2022-03-10 09:58:26.396150258 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.HeatCapacity;
 function dcv2ph_Ph
   "Derivative of specific heat capacity wrt. pressure at constant specific enthalpy in vapor region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real dcvph
     "Derivative of specific heat capacity wrt. pressure at constant specific enthalpy";
   cv2_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/InitLimits/package.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/InitLimits/package.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/InitLimits/package.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/InitLimits/package.mo"	2022-03-10 09:58:26.388150256 +0000
@@ -4,99 +4,99 @@
   constant Real MINPOS=1.0e-9
   "minimal value for physical variables which are always > 0.0";
 
-  constant Modelica.SIunits.Area AMIN=MINPOS "Minimum surface";
-  constant Modelica.SIunits.Area AMAX=1.0e5 "Maximum surface";
-  constant Modelica.SIunits.Area ANOM=1.0 "Nominal surface";
-  constant Modelica.SIunits.Density DMIN=MINPOS "Minimum density";
-  constant Modelica.SIunits.Density DMAX=1.0e5 "Maximum densitye";
-  constant Modelica.SIunits.Density DNOM=998.0 "Nominal density";
-  constant Modelica.SIunits.ThermalConductivity LAMMIN=MINPOS
+  constant Modelica.Units.SI.Area AMIN=MINPOS "Minimum surface";
+  constant Modelica.Units.SI.Area AMAX=1.0e5 "Maximum surface";
+  constant Modelica.Units.SI.Area ANOM=1.0 "Nominal surface";
+  constant Modelica.Units.SI.Density DMIN=MINPOS "Minimum density";
+  constant Modelica.Units.SI.Density DMAX=1.0e5 "Maximum densitye";
+  constant Modelica.Units.SI.Density DNOM=998.0 "Nominal density";
+  constant Modelica.Units.SI.ThermalConductivity LAMMIN=MINPOS
   "Minimum thermal conductivity";
-  constant Modelica.SIunits.ThermalConductivity LAMNOM=1.0
+  constant Modelica.Units.SI.ThermalConductivity LAMNOM=1.0
   "Nominal thermal conductivity";
-  constant Modelica.SIunits.ThermalConductivity LAMMAX=1000.0
+  constant Modelica.Units.SI.ThermalConductivity LAMMAX=1000.0
   "Maximum thermal conductivity";
-  constant Modelica.SIunits.DynamicViscosity ETAMIN=MINPOS
+  constant Modelica.Units.SI.DynamicViscosity ETAMIN=MINPOS
   "Minimum dynamic viscosity";
-  constant Modelica.SIunits.DynamicViscosity ETAMAX=1.0e8
+  constant Modelica.Units.SI.DynamicViscosity ETAMAX=1.0e8
   "Maximum dynamic viscosity";
-  constant Modelica.SIunits.DynamicViscosity ETANOM=100.0
+  constant Modelica.Units.SI.DynamicViscosity ETANOM=100.0
   "Nominal dynamic viscosity";
-  constant Modelica.SIunits.Energy EMIN=-1.0e10 "Minimum energy";
-  constant Modelica.SIunits.Energy EMAX=1.0e10 "Maximum energy";
-  constant Modelica.SIunits.Energy ENOM=1.0e3 "Nominal energy";
-  constant Modelica.SIunits.Entropy SMIN=-1.0e6 "Minimum entropy";
-  constant Modelica.SIunits.Entropy SMAX=1.0e6 "Maximum entropy";
-  constant Modelica.SIunits.Entropy SNOM=1.0e3 "Nominal entropy";
-  constant Modelica.SIunits.MassFlowRate MDOTMIN=-1.0e5
+  constant Modelica.Units.SI.Energy EMIN=-1.0e10 "Minimum energy";
+  constant Modelica.Units.SI.Energy EMAX=1.0e10 "Maximum energy";
+  constant Modelica.Units.SI.Energy ENOM=1.0e3 "Nominal energy";
+  constant Modelica.Units.SI.Entropy SMIN=-1.0e6 "Minimum entropy";
+  constant Modelica.Units.SI.Entropy SMAX=1.0e6 "Maximum entropy";
+  constant Modelica.Units.SI.Entropy SNOM=1.0e3 "Nominal entropy";
+  constant Modelica.Units.SI.MassFlowRate MDOTMIN=-1.0e5
   "Minimum mass flow rate";
-  constant Modelica.SIunits.MassFlowRate MDOTMAX=1.0e5 "Maximum mass flow rate";
-  constant Modelica.SIunits.MassFlowRate MDOTNOM=1.0 "Nominal mass flow rate";
+  constant Modelica.Units.SI.MassFlowRate MDOTMAX=1.0e5 "Maximum mass flow rate";
+  constant Modelica.Units.SI.MassFlowRate MDOTNOM=1.0 "Nominal mass flow rate";
   constant ThermoSysPro.Units.MassFraction MASSXMIN=-1.0*MINPOS
   "Minimum mass fraction";
   constant ThermoSysPro.Units.MassFraction MASSXMAX=1.0 "Maximum mass fraction";
   constant ThermoSysPro.Units.MassFraction MASSXNOM=0.1 "Nominal mass fraction";
-  constant Modelica.SIunits.Mass MMIN=1.0*MINPOS "Minimum mass";
-  constant Modelica.SIunits.Mass MMAX=1.0e8 "Maximum mass";
-  constant Modelica.SIunits.Mass MNOM=1.0 "Nominal mass";
-  constant Modelica.SIunits.Power POWMIN=-1.0e8 "Minimum power";
-  constant Modelica.SIunits.Power POWMAX=1.0e8 "Maximum power";
-  constant Modelica.SIunits.Power POWNOM=1.0e3 "Nominal power";
-  constant Modelica.SIunits.AbsolutePressure PMIN=100.0 "Minimum pressure";
-  constant Modelica.SIunits.AbsolutePressure PMAX=1.0e9 "Maximum pressure";
-  constant Modelica.SIunits.AbsolutePressure PNOM=1.0e5 "Nominal pressure";
-  constant Modelica.SIunits.AbsolutePressure COMPPMIN=-1.0*MINPOS
+
+
+  constant Modelica.Units.SI.Mass MMIN=1.0*MINPOS "Minimum mass";
+  constant Modelica.Units.SI.Mass MMAX=1.0e8 "Maximum mass";
+  constant Modelica.Units.SI.Mass MNOM=1.0 "Nominal mass";
+  constant Modelica.Units.SI.Power POWMIN=-1.0e8 "Minimum power";
+  constant Modelica.Units.SI.Power POWMAX=1.0e8 "Maximum power";
+  constant Modelica.Units.SI.Power POWNOM=1.0e3 "Nominal power";
+  constant Modelica.Units.SI.AbsolutePressure PMIN=100.0 "Minimum pressure";
+  constant Modelica.Units.SI.AbsolutePressure PMAX=1.0e9 "Maximum pressure";
+  constant Modelica.Units.SI.AbsolutePressure PNOM=1.0e5 "Nominal pressure";
+  constant Modelica.Units.SI.AbsolutePressure COMPPMIN=-1.0*MINPOS
   "Minimum pressure";
-  constant Modelica.SIunits.AbsolutePressure COMPPMAX=1.0e8 "Maximum pressure";
-  constant Modelica.SIunits.AbsolutePressure COMPPNOM=1.0e5 "Nominal pressure";
-  constant Modelica.SIunits.RatioOfSpecificHeatCapacities KAPPAMIN=1.0
+  constant Modelica.Units.SI.AbsolutePressure COMPPMAX=1.0e8 "Maximum pressure";
+  constant Modelica.Units.SI.AbsolutePressure COMPPNOM=1.0e5 "Nominal pressure";
+  constant Modelica.Units.SI.RatioOfSpecificHeatCapacities KAPPAMIN=1.0
   "Minimum isentropic exponent";
-  constant Modelica.SIunits.RatioOfSpecificHeatCapacities KAPPAMAX=Modelica.Constants.inf
+  constant Modelica.Units.SI.RatioOfSpecificHeatCapacities KAPPAMAX=Modelica.Constants.inf
   "Maximum isentropic exponent";
-  constant Modelica.SIunits.RatioOfSpecificHeatCapacities KAPPANOM=1.2
+  constant Modelica.Units.SI.RatioOfSpecificHeatCapacities KAPPANOM=1.2
   "Nominal isentropic exponent";
-  constant Modelica.SIunits.SpecificEnergy SEMIN=-1.0e8
+  constant Modelica.Units.SI.SpecificEnergy SEMIN=-1.0e8
   "Minimum specific energy";
-  constant Modelica.SIunits.SpecificEnergy SEMAX=1.0e8
+  constant Modelica.Units.SI.SpecificEnergy SEMAX=1.0e8
   "Maximum specific energy";
-  constant Modelica.SIunits.SpecificEnergy SENOM=1.0e6
+  constant Modelica.Units.SI.SpecificEnergy SENOM=1.0e6
   "Nominal specific energy";
-  constant Modelica.SIunits.SpecificEnthalpy SHMIN=-1.0e6
+  constant Modelica.Units.SI.SpecificEnthalpy SHMIN=-1.0e6
   "Minimum specific enthalpy";
-  constant Modelica.SIunits.SpecificEnthalpy SHMAX=1.0e8
+  constant Modelica.Units.SI.SpecificEnthalpy SHMAX=1.0e8
   "Maximum specific enthalpy";
-  constant Modelica.SIunits.SpecificEnthalpy SHNOM=1.0e6
+  constant Modelica.Units.SI.SpecificEnthalpy SHNOM=1.0e6
   "Nominal specific enthalpy";
-  constant Modelica.SIunits.SpecificEntropy SSMIN=-1.0e6
+  constant Modelica.Units.SI.SpecificEntropy SSMIN=-1.0e6
   "Minimum specific entropy";
-  constant Modelica.SIunits.SpecificEntropy SSMAX=1.0e6
+  constant Modelica.Units.SI.SpecificEntropy SSMAX=1.0e6
   "Maximum specific entropy";
-  constant Modelica.SIunits.SpecificEntropy SSNOM=1.0e3
+  constant Modelica.Units.SI.SpecificEntropy SSNOM=1.0e3
   "Nominal specific entropy";
-  constant Modelica.SIunits.SpecificHeatCapacity CPMIN=MINPOS
+  constant Modelica.Units.SI.SpecificHeatCapacity CPMIN=MINPOS
   "Minimum specific heat capacity";
-  constant Modelica.SIunits.SpecificHeatCapacity CPMAX=Modelica.Constants.inf
+  constant Modelica.Units.SI.SpecificHeatCapacity CPMAX=Modelica.Constants.inf
   "Maximum specific heat capacity";
-  constant Modelica.SIunits.SpecificHeatCapacity CPNOM=1.0e3
+  constant Modelica.Units.SI.SpecificHeatCapacity CPNOM=1.0e3
   "Nominal specific heat capacity";
-  constant Modelica.SIunits.Temperature TMIN=200 "Minimum temperature";
-  constant Modelica.SIunits.Temperature TMAX=6000 "Maximum temperature";
-  constant Modelica.SIunits.Temperature TNOM=320.0 "Nominal temperature";
-  constant Modelica.SIunits.ThermalConductivity LMIN=MINPOS
+  constant Modelica.Units.SI.Temperature TMIN=200 "Minimum temperature";
+  constant Modelica.Units.SI.Temperature TMAX=6000 "Maximum temperature";
+  constant Modelica.Units.SI.Temperature TNOM=320.0 "Nominal temperature";
+  constant Modelica.Units.SI.ThermalConductivity LMIN=MINPOS
   "Minimum thermal conductivity";
-  constant Modelica.SIunits.ThermalConductivity LMAX=500.0
+  constant Modelica.Units.SI.ThermalConductivity LMAX=500.0
   "Maximum thermal conductivity";
-  constant Modelica.SIunits.ThermalConductivity LNOM=1.0
+  constant Modelica.Units.SI.ThermalConductivity LNOM=1.0
   "Nominal thermal conductivity";
-  constant Modelica.SIunits.Velocity VELMIN=-1.0e5 "Minimum velocity";
-  constant Modelica.SIunits.Velocity VELMAX=Modelica.Constants.inf
+  constant Modelica.Units.SI.Velocity VELMIN=-1.0e5 "Minimum velocity";
+  constant Modelica.Units.SI.Velocity VELMAX=Modelica.Constants.inf
   "Maximum velocity";
-  constant Modelica.SIunits.Velocity VELNOM=1.0 "Nominal velocity";
-  constant Modelica.SIunits.Volume VMIN=0.0 "Minimum volume";
-  constant Modelica.SIunits.Volume VMAX=1.0e5 "Maximum volume";
-  constant Modelica.SIunits.Volume VNOM=1.0e-3 "Nominal volume";
-
-
+  constant Modelica.Units.SI.Velocity VELNOM=1.0 "Nominal velocity";
+  constant Modelica.Units.SI.Volume VMIN=0.0 "Minimum volume";
+  constant Modelica.Units.SI.Volume VMAX=1.0e5 "Maximum volume";
+  constant Modelica.Units.SI.Volume VNOM=1.0e-3 "Nominal volume";
   annotation (
     Icon(graphics={
       Text(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/d2psatTT_T.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/d2psatTT_T.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/d2psatTT_T.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/d2psatTT_T.mo"	2022-03-10 09:58:26.296150246 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Pressure;
 function d2psatTT_T "Second derivative of saturation pressure wrt. temperature"
- input Modelica.SIunits.Temperature T "Temperature";
+ input Modelica.Units.SI.Temperature T "Temperature";
  output Real d2pTT "Second derivative of pressure";
   psat_T_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/dpTd_dT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/dpTd_dT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/dpTd_dT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/dpTd_dT.mo"	2022-03-10 09:58:26.288150245 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Pressure;
 function dpTd_dT
   "Derivative of pressure wrt. specific entropy at constant density in liquid region for given density and temperature"
- input Modelica.SIunits.Density d "Density";
- input Modelica.SIunits.Temperature T "Temperature";
+ input Modelica.Units.SI.Density d "Density";
+ input Modelica.Units.SI.Temperature T "Temperature";
  output Real dpTd "Derivative of pressure wrt. temperature at constant density";
  p_dT_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/dpdT_dT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/dpdT_dT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/dpdT_dT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/dpdT_dT.mo"	2022-03-10 09:58:26.284150243 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Pressure;
 function dpdT_dT
   "Derivative of pressure wrt. density at constant specific enthalpy in liquid region for given density and temperature"
-input Modelica.SIunits.Density d "Density";
- input Modelica.SIunits.Temperature T "Temperature";
+input Modelica.Units.SI.Density d "Density";
+ input Modelica.Units.SI.Temperature T "Temperature";
  output Real dpdT "Derivative of pressure wrt. density at constant temperature";
   p_dT_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/dpsat1h_h.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/dpsat1h_h.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/dpsat1h_h.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/dpsat1h_h.mo"	2022-03-10 09:58:26.276150243 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Pressure;
 function dpsat1h_h "Derivative of saturation pressure wrt. specific enthalpy"
- input Modelica.SIunits.SpecificEnthalpy h "Enthalpy";
+ input Modelica.Units.SI.SpecificEnthalpy h "Enthalpy";
  output Real dph "Pressure";
   psat1_h_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/dpsatT_T.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/dpsatT_T.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/dpsatT_T.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/dpsatT_T.mo"	2022-03-10 09:58:26.268150241 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Pressure;
 function dpsatT_T "Derivative of saturation pressure wrt. temperature"
- input Modelica.SIunits.Temperature T "Temperature";
+ input Modelica.Units.SI.Temperature T "Temperature";
  output Real dpT "Derivative of pressure";
   psat_T_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/p_dT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/p_dT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/p_dT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/p_dT.mo"	2022-03-10 09:58:26.260150240 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Pressure;
 function p_dT "Pressure in liquid region for given density and temperature"
- input Modelica.SIunits.Density d "Density";
- input Modelica.SIunits.Temperature T "Temperature";
- output Modelica.SIunits.Pressure p "Pressure";
+ input Modelica.Units.SI.Density d "Density";
+ input Modelica.Units.SI.Temperature T "Temperature";
+ output Modelica.Units.SI.Pressure p "Pressure";
   p_dT_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/psat1_h.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/psat1_h.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/psat1_h.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/psat1_h.mo"	2022-03-10 09:58:26.248150239 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Pressure;
 function psat1_h "Saturation pressure for given specific enthalpy"
- input Modelica.SIunits.SpecificEnthalpy h "Enthalpy";
- output Modelica.SIunits.Pressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Enthalpy";
+ output Modelica.Units.SI.Pressure p "Pressure";
   psat1_h_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/psat_T.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/psat_T.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/psat_T.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Pressure/psat_T.mo"	2022-03-10 09:58:26.232150238 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Pressure;
 function psat_T "Saturation pressure for given temperature"
- input Modelica.SIunits.Temperature T "Temperature";
- output Modelica.SIunits.Pressure p "Pressure";
+ input Modelica.Units.SI.Temperature T "Temperature";
+ output Modelica.Units.SI.Pressure p "Pressure";
   psat_T_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/PropThermoSat.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/PropThermoSat.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/PropThermoSat.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/PropThermoSat.mo"	2022-03-10 09:58:26.220150236 +0000
@@ -1,13 +1,13 @@
 within ThermoSysPro.Properties.WaterSteamSimple;
 record PropThermoSat
-  Modelica.SIunits.AbsolutePressure P "Pressure";
-  Modelica.SIunits.Temperature T "Temperature";
-  Modelica.SIunits.Density rho "Density";
-  Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
-  Modelica.SIunits.SpecificHeatCapacity cp
+  Modelica.Units.SI.AbsolutePressure P "Pressure";
+  Modelica.Units.SI.Temperature T "Temperature";
+  Modelica.Units.SI.Density rho "Density";
+  Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+  Modelica.Units.SI.SpecificHeatCapacity cp
     "Specific heat capacity at constant pressure";
   Real pt "Derivative of pressure wrt. temperature";
-  Modelica.SIunits.SpecificHeatCapacity cv
+  Modelica.Units.SI.SpecificHeatCapacity cv
     "Specific heat capacity at constant volume";
   annotation (
     Window(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/DynamicViscosity_rhoT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/DynamicViscosity_rhoT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/DynamicViscosity_rhoT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/DynamicViscosity_rhoT.mo"	2022-03-10 09:58:26.188150232 +0000
@@ -1,12 +1,12 @@
 within ThermoSysPro.Properties.WaterSteamSimple.SimpleWater;
 function DynamicViscosity_rhoT
-  input Modelica.SIunits.Density rho "Density";
-  input Modelica.SIunits.Temperature T "Temperature";
+  input Modelica.Units.SI.Density rho "Density";
+  input Modelica.Units.SI.Temperature T "Temperature";
 
-  output Modelica.SIunits.DynamicViscosity mu "Dynamic viscosity";
+  output Modelica.Units.SI.DynamicViscosity mu "Dynamic viscosity";
 protected
-  Modelica.SIunits.Density d1sat;
-  Modelica.SIunits.Density d2sat;
+  Modelica.Units.SI.Density d1sat;
+  Modelica.Units.SI.Density d2sat;
   Real x;
 
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Pressure_sat_hl.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Pressure_sat_hl.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Pressure_sat_hl.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Pressure_sat_hl.mo"	2022-03-10 09:58:26.176150230 +0000
@@ -1,11 +1,11 @@
 within ThermoSysPro.Properties.WaterSteamSimple.SimpleWater;
 function Pressure_sat_hl
-  input Modelica.SIunits.SpecificEnthalpy hl
+
+  input Modelica.Units.SI.SpecificEnthalpy hl
     "Liquid specific enthalpy on the saturation line";
 
-  output Modelica.SIunits.AbsolutePressure p
+  output Modelica.Units.SI.AbsolutePressure p
     "Liquid pressure on the saturation line";
-
 algorithm
   assert(hl > ThermoSysPro.Properties.WaterSteamSimple.Enthalpy.h1sat_P(
     ThermoSysPro.Properties.WaterSteamSimple.triple.ptriple),
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Pressure_sat_hl_der.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Pressure_sat_hl_der.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Pressure_sat_hl_der.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Pressure_sat_hl_der.mo"	2022-03-10 09:58:26.168150230 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.WaterSteamSimple.SimpleWater;
 function Pressure_sat_hl_der
-  input Modelica.SIunits.SpecificEnthalpy hl
+  input Modelica.Units.SI.SpecificEnthalpy hl
     "Liquid specific enthalpy on the saturation line";
   input Real hl_der;
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/SpecificEnthalpy_PT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/SpecificEnthalpy_PT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/SpecificEnthalpy_PT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/SpecificEnthalpy_PT.mo"	2022-03-10 09:58:26.160150227 +0000
@@ -1,10 +1,10 @@
 within ThermoSysPro.Properties.WaterSteamSimple.SimpleWater;
 function SpecificEnthalpy_PT
-  input Modelica.SIunits.AbsolutePressure p "Pressure";
-  input Modelica.SIunits.Temperature T "Temperature";
+  input Modelica.Units.SI.AbsolutePressure p "Pressure";
+  input Modelica.Units.SI.Temperature T "Temperature";
   input Integer mode = 0 "IF97 region. 0:automatic";
 
-  output Modelica.SIunits.SpecificEnthalpy H "Specific enthalpy";
+  output Modelica.Units.SI.SpecificEnthalpy H "Specific enthalpy";
 
 protected
   Integer region;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/SpecificEnthalpy_PT_der.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/SpecificEnthalpy_PT_der.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/SpecificEnthalpy_PT_der.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/SpecificEnthalpy_PT_der.mo"	2022-03-10 09:58:26.124150224 +0000
@@ -1,7 +1,7 @@
-﻿within ThermoSysPro.Properties.WaterSteamSimple.SimpleWater;
+within ThermoSysPro.Properties.WaterSteamSimple.SimpleWater;
 function SpecificEnthalpy_PT_der
-  input Modelica.SIunits.AbsolutePressure p "pressure";
-  input Modelica.SIunits.Temperature   T "Temperature";
+  input Modelica.Units.SI.AbsolutePressure p "pressure";
+  input Modelica.Units.SI.Temperature   T "Temperature";
   input Integer mode = 0 "Région IF97 - 0:calcul automatique";
 
   input Real p_der "Pression";
@@ -20,22 +20,19 @@
   region := ThermoSysPro.Properties.WaterSteamSimple.region_pT(
     p,
     T,
-    mode);
-
-  // Partial derivatives
-  if (region == 1) then
-    dhp := ThermoSysPro.Properties.WaterSteamSimple.Enthalpy.dh1pT_PT(p, T);
-    dhT := ThermoSysPro.Properties.WaterSteamSimple.Enthalpy.dh1Tp_PT(p, T);
-  elseif (region == 2) then
-    dhp := ThermoSysPro.Properties.WaterSteamSimple.Enthalpy.dh2pT_PT(p, T);
-    dhT := ThermoSysPro.Properties.WaterSteamSimple.Enthalpy.dh2Tp_PT(p, T);
-  else
-    assert(false, "Water_PT: Incorrect region number");
-  end if;
-
-  // Temporal derivative
-  h_der:=dhp*p_der + dhT*T_der;
-
+    mode);
+// Partial derivatives
+  if region == 1 then
+    dhp := ThermoSysPro.Properties.WaterSteamSimple.Enthalpy.dh1pT_PT(p, T);
+    dhT := ThermoSysPro.Properties.WaterSteamSimple.Enthalpy.dh1Tp_PT(p, T);
+  elseif region == 2 then
+    dhp := ThermoSysPro.Properties.WaterSteamSimple.Enthalpy.dh2pT_PT(p, T);
+    dhT := ThermoSysPro.Properties.WaterSteamSimple.Enthalpy.dh2Tp_PT(p, T);
+  else
+    assert(false, "Water_PT: Incorrect region number");
+  end if;
+// Temporal derivative
+  h_der := dhp * p_der + dhT * T_der;
   annotation (
     Icon(graphics={
         Text(extent={{-134,104},{142,44}}, textString=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/SurfaceTension_T.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/SurfaceTension_T.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/SurfaceTension_T.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/SurfaceTension_T.mo"	2022-03-10 09:58:26.112150222 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.SimpleWater;
 function SurfaceTension_T
-  input Modelica.SIunits.Temperature T "Temperature";
+  input Modelica.Units.SI.Temperature T "Temperature";
 
-  output Modelica.SIunits.SurfaceTension sigma "Surface tension";
+  output Modelica.Units.SI.SurfaceTension sigma "Surface tension";
 algorithm
   sigma :=
     ThermoSysPro.Properties.WaterSteamSimple.SurfaceTension.SurfaceTension_T(T);
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/ThermalConductivity_rhoT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/ThermalConductivity_rhoT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/ThermalConductivity_rhoT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/ThermalConductivity_rhoT.mo"	2022-03-10 09:58:26.104150220 +0000
@@ -1,12 +1,12 @@
 within ThermoSysPro.Properties.WaterSteamSimple.SimpleWater;
 function ThermalConductivity_rhoT
-  input Modelica.SIunits.Density rho "Density";
-  input Modelica.SIunits.Temperature T "Temperature";
+  input Modelica.Units.SI.Density rho "Density";
+  input Modelica.Units.SI.Temperature T "Temperature";
 
-  output Modelica.SIunits.ThermalConductivity lambda "Thermal conductivity";
+  output Modelica.Units.SI.ThermalConductivity lambda "Thermal conductivity";
 protected
-  Modelica.SIunits.Density d1sat;
-  Modelica.SIunits.Density d2sat;
+  Modelica.Units.SI.Density d1sat;
+  Modelica.Units.SI.Density d2sat;
   Real x;
 
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Water_PT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Water_PT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Water_PT.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Water_PT.mo"	2022-03-10 09:58:26.096150219 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Properties.WaterSteamSimple.SimpleWater;
 function Water_PT
-  input Modelica.SIunits.AbsolutePressure p "Pressure";
-  input Modelica.SIunits.Temperature T "Temperature";
+  input Modelica.Units.SI.AbsolutePressure p "Pressure";
+  input Modelica.Units.SI.Temperature T "Temperature";
   input Integer mode=0 "IF97 region. 0:automatic";
   output ThermoSysPro.Properties.WaterSteamSimple.ThermoProperties_pT pro;
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Water_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Water_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Water_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Water_Ph.mo"	2022-03-10 09:58:26.084150218 +0000
@@ -1,19 +1,19 @@
 within ThermoSysPro.Properties.WaterSteamSimple.SimpleWater;
 function Water_Ph
-  input Modelica.SIunits.AbsolutePressure p "Pressure";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+  input Modelica.Units.SI.AbsolutePressure p "Pressure";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
   input Integer mode = 0 "IF97 region. 0:automatic";
   output ThermoSysPro.Properties.WaterSteamSimple.ThermoProperties_ph pro
     annotation (Placement(transformation(extent={{-90,15},{-43.3333,61.6667}},
           rotation=0)));
 
-  //Integer phase;
+//Integer phase;
 protected
   Integer  region;
 
 algorithm
-  //phase := ThermoSysPro.Properties.WaterSteamSimple.phase_ph(p,h);
- // region :=ThermoSysPro.Properties.WaterSteamSimple.region_ph(p,h,phase,mode);
+//phase := ThermoSysPro.Properties.WaterSteamSimple.phase_ph(p,h);
+// region :=ThermoSysPro.Properties.WaterSteamSimple.region_ph(p,h,phase,mode);
   region := ThermoSysPro.Properties.WaterSteamSimple.region_ph(
     p,
     h,
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Water_Ph_der.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Water_Ph_der.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Water_Ph_der.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Water_Ph_der.mo"	2022-03-10 09:58:26.072150216 +0000
@@ -1,23 +1,22 @@
-﻿within ThermoSysPro.Properties.WaterSteamSimple.SimpleWater;
+within ThermoSysPro.Properties.WaterSteamSimple.SimpleWater;
 function Water_Ph_der "Derivative function of Water_Ph"
-  input Modelica.SIunits.AbsolutePressure p "Pressure";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+  input Modelica.Units.SI.AbsolutePressure p "Pressure";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
   input Integer mode = 0 "Région IF97 - 0:calcul automatique";
-  //input CombiPlant.ThermoFluidPro.Media.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
-
+  //input CombiPlant.ThermoFluidPro.Media.Common.IF97TwoPhaseAnalytic aux "auxiliary record";
   input Real p_der "derivative of Pressure";
   input Real h_der "derivative of Specific enthalpy";
 
   output ThermoSysPro.Properties.WaterSteamSimple.ThermoProperties_ph der_pro
     "Derivative";
 
- // Integer phase;
+// Integer phase;
 protected
   Integer region;
 
 algorithm
-  //phase := ThermoSysPro.Properties.WaterSteamSimple.phase_ph(p,h);
-  //region :=ThermoSysPro.Properties.WaterSteamSimple.region_ph(p,h,phase,mode);
+//phase := ThermoSysPro.Properties.WaterSteamSimple.phase_ph(p,h);
+//region :=ThermoSysPro.Properties.WaterSteamSimple.region_ph(p,h,phase,mode);
   region := ThermoSysPro.Properties.WaterSteamSimple.region_ph(
     p,
     h,
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Water_Ps.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Water_Ps.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Water_Ps.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Water_Ps.mo"	2022-03-10 09:58:26.060150216 +0000
@@ -1,16 +1,16 @@
 within ThermoSysPro.Properties.WaterSteamSimple.SimpleWater;
 function Water_Ps
-  input Modelica.SIunits.AbsolutePressure p "Pressure";
-  input Modelica.SIunits.SpecificEntropy s "Specific entropy";
+  input Modelica.Units.SI.AbsolutePressure p "Pressure";
+  input Modelica.Units.SI.SpecificEntropy s "Specific entropy";
   input Integer mode = 0 "IF97 region. 0:automatic";
   output ThermoSysPro.Properties.WaterSteamSimple.ThermoProperties_ps pro;
 
-//  Integer phase;
+//  Integer phase;
 protected
   Integer region;
 
 algorithm
-  //phase := ThermoSysPro.Properties.WaterSteamSimple.phase_ps(p, s);
+//phase := ThermoSysPro.Properties.WaterSteamSimple.phase_ps(p, s);
   region := ThermoSysPro.Properties.WaterSteamSimple.region_ps(
     p,
     s,
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Water_sat_P.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Water_sat_P.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Water_sat_P.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Water_sat_P.mo"	2022-03-10 09:58:26.048150214 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.SimpleWater;
 function Water_sat_P
-  input Modelica.SIunits.AbsolutePressure p "Pressure";
+  input Modelica.Units.SI.AbsolutePressure p "Pressure";
 
 protected
-  Modelica.SIunits.Temperature T;
+  Modelica.Units.SI.Temperature T;
 
 public
   output ThermoSysPro.Properties.WaterSteamSimple.PropThermoSat lsat
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Water_sat_P_der.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Water_sat_P_der.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Water_sat_P_der.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SimpleWater/Water_sat_P_der.mo"	2022-03-10 09:58:26.032150211 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.WaterSteamSimple.SimpleWater;
 function Water_sat_P_der
-  input Modelica.SIunits.AbsolutePressure p "Pression";
+  input Modelica.Units.SI.AbsolutePressure p "Pression";
 
   input Real p_der "derivative of pressure";
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SurfaceTension/SurfaceTension_T.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SurfaceTension/SurfaceTension_T.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SurfaceTension/SurfaceTension_T.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/SurfaceTension/SurfaceTension_T.mo"	2022-03-10 09:58:25.996150207 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Properties.WaterSteamSimple.SurfaceTension;
 function SurfaceTension_T "Surface tension for given temperature"
- input Modelica.SIunits.Temperature T "Temperature";
- output Modelica.SIunits.SurfaceTension sigma "Surface tension";
+ input Modelica.Units.SI.Temperature T "Temperature";
+ output Modelica.Units.SI.SurfaceTension sigma "Surface tension";
   SurfaceTension_T_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/T1_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/T1_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/T1_Ph.mo"	2022-03-10 09:57:37.988144124 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/T1_Ph.mo"	2022-03-10 09:58:25.960150203 +0000
@@ -1,10 +1,10 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Temperature;
 function T1_Ph
   "Temperature in liquid region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
- output Modelica.SIunits.Temperature T "Temperature";
- protected
+
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+ output Modelica.Units.SI.Temperature T "Temperature"; protected
   T1_Ph_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/T2_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/T2_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/T2_Ph.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/T2_Ph.mo"	2022-03-10 09:58:25.944150200 +0000
@@ -1,10 +1,10 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Temperature;
 function T2_Ph
   "Temperature in vapor region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
- output Modelica.SIunits.Temperature T "Temperature";
-  protected
+
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+ output Modelica.Units.SI.Temperature T "Temperature";  protected
   T2_Ph_coef coef
     annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/Tsat_P.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/Tsat_P.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/Tsat_P.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/Tsat_P.mo"	2022-03-10 09:58:25.900150195 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Temperature;
 function Tsat_P "temperature at saturation for given pressure"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- output Modelica.SIunits.Temperature T "Temperature";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ output Modelica.Units.SI.Temperature T "Temperature";
   Tsat_P_coef coef annotation (Placement(transformation(extent={{-100,
             80},{-80,100}})));
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/dT1hp_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/dT1hp_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/dT1hp_Ph.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/dT1hp_Ph.mo"	2022-03-10 09:58:25.888150193 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Temperature;
 function dT1hp_Ph
   "Derivative of temperature wrt. enthalpy at constant pressure in liquid region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real dThp
     "Derivative of temperature wrt. specific enthalpy at constant pressure";
   T1_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/dT1ph_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/dT1ph_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/dT1ph_Ph.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/dT1ph_Ph.mo"	2022-03-10 09:58:25.880150192 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Temperature;
 function dT1ph_Ph
   "Derivative of temperature wrt. pressure at constant specific enthalpy in liquid region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real dTph
     "Derivative of temperature wrt. pressure at constant specific enthalpy";
   protected
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/dT2hp_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/dT2hp_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/dT2hp_Ph.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/dT2hp_Ph.mo"	2022-03-10 09:58:25.872150192 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Temperature;
 function dT2hp_Ph
   "Derivative of temperature wrt. specific enthalpy at constant pressure in vapor region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real dThp
     "Derivative of temperature wrt. specific enthalpy at constant pressure";
   T2_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/dT2ph_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/dT2ph_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/dT2ph_Ph.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/dT2ph_Ph.mo"	2022-03-10 09:58:25.864150190 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Temperature;
 function dT2ph_Ph
   "Derivative of temperature wrt. pressure at constant specific enthalpy in vapor region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real dTph
     "Derivative of temperature wrt. pressure at constant specific enthalpy";
  protected
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/dTsatp_P.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/dTsatp_P.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/dTsatp_P.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Temperature/dTsatp_P.mo"	2022-03-10 09:58:25.860150190 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Temperature;
 function dTsatp_P "derivative of temperature at saturation wrt. pressure"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
  output Real dTp "derivative of temperature wrt. pressure";
   Tsat_P_coef coef annotation (Placement(transformation(extent={{-100,
             80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/ThermoProperties_pT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/ThermoProperties_pT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/ThermoProperties_pT.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/ThermoProperties_pT.mo"	2022-03-10 09:58:25.852150190 +0000
@@ -1,33 +1,33 @@
 within ThermoSysPro.Properties.WaterSteamSimple;
 record ThermoProperties_pT
-  Modelica.SIunits.Density d(
+  Modelica.Units.SI.Density d(
     min=WaterSteam.InitLimits.DMIN,
     max=WaterSteam.InitLimits.DMAX,
     nominal=WaterSteam.InitLimits.DNOM) "Density";
-  Modelica.SIunits.SpecificEnthalpy h(
+  Modelica.Units.SI.SpecificEnthalpy h(
     min=WaterSteam.InitLimits.SHMIN,
     max=WaterSteam.InitLimits.SHMAX,
     nominal=WaterSteam.InitLimits.SHNOM) "Specific enthalpy";
-  Modelica.SIunits.SpecificEnergy u(
+  Modelica.Units.SI.SpecificEnergy u(
     min=WaterSteam.InitLimits.SEMIN,
     max=WaterSteam.InitLimits.SEMAX,
     nominal=WaterSteam.InitLimits.SENOM) "Specific inner energy";
-  Modelica.SIunits.SpecificEntropy s(
+  Modelica.Units.SI.SpecificEntropy s(
     min=WaterSteam.InitLimits.SSMIN,
     max=WaterSteam.InitLimits.SSMAX,
     nominal=WaterSteam.InitLimits.SSNOM) "Specific entropy";
-  Modelica.SIunits.SpecificHeatCapacity cp(
+  Modelica.Units.SI.SpecificHeatCapacity cp(
     min=WaterSteam.InitLimits.CPMIN,
     max=WaterSteam.InitLimits.CPMAX,
     nominal=WaterSteam.InitLimits.CPNOM)
     "Specific heat capacity at constant presure";
-  Modelica.SIunits.DerDensityByTemperature ddTp
+  Modelica.Units.SI.DerDensityByTemperature ddTp
     "Derivative of the density wrt. temperature at constant pressure";
-  Modelica.SIunits.DerDensityByPressure ddpT
+  Modelica.Units.SI.DerDensityByPressure ddpT
     "Derivative of the density wrt. presure at constant temperature";
-  Modelica.SIunits.DerEnergyByPressure dupT
+  Modelica.Units.SI.DerEnergyByPressure dupT
     "Derivative of the inner energy wrt. pressure at constant temperature";
-  Modelica.SIunits.SpecificHeatCapacity duTp
+  Modelica.Units.SI.SpecificHeatCapacity duTp
     "Derivative of the inner energy wrt. temperature at constant pressure";
   ThermoSysPro.Units.MassFraction x "Vapor mass fraction";
   annotation (
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/ThermoProperties_ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/ThermoProperties_ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/ThermoProperties_ph.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/ThermoProperties_ph.mo"	2022-03-10 09:58:25.836150187 +0000
@@ -1,28 +1,28 @@
 within ThermoSysPro.Properties.WaterSteamSimple;
 record ThermoProperties_ph
-  Modelica.SIunits.Temperature T(
+  Modelica.Units.SI.Temperature T(
     min=InitLimits.TMIN,
     max=InitLimits.TMAX,
     nominal=InitLimits.TNOM) "Temperature";
-  Modelica.SIunits.Density d(
+  Modelica.Units.SI.Density d(
     min=InitLimits.DMIN,
     max=InitLimits.DMAX,
     nominal=InitLimits.DNOM) "Density";
-  Modelica.SIunits.SpecificEnergy u(
+  Modelica.Units.SI.SpecificEnergy u(
     min=InitLimits.SEMIN,
     max=InitLimits.SEMAX,
     nominal=InitLimits.SENOM) "Specific inner energy";
-  Modelica.SIunits.SpecificEntropy s(
+  Modelica.Units.SI.SpecificEntropy s(
     min=InitLimits.SSMIN,
     max=InitLimits.SSMAX,
     nominal=InitLimits.SSNOM) "Specific entropy";
-  Modelica.SIunits.SpecificHeatCapacity cp(
+  Modelica.Units.SI.SpecificHeatCapacity cp(
     min=InitLimits.CPMIN,
     max=InitLimits.CPMAX,
     nominal=InitLimits.CPNOM) "Specific heat capacity at constant presure";
-  Modelica.SIunits.DerDensityByEnthalpy ddhp
+  Modelica.Units.SI.DerDensityByEnthalpy ddhp
     "Derivative of density wrt. specific enthalpy at constant pressure";
-  Modelica.SIunits.DerDensityByPressure ddph
+  Modelica.Units.SI.DerDensityByPressure ddph
     "Derivative of density wrt. pressure at constant specific enthalpy";
   Real duph(unit="m3/kg")
     "Derivative of specific inner energy wrt. pressure at constant specific enthalpy";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/ThermoProperties_ps.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/ThermoProperties_ps.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/ThermoProperties_ps.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/ThermoProperties_ps.mo"	2022-03-10 09:58:25.812150183 +0000
@@ -1,29 +1,29 @@
 within ThermoSysPro.Properties.WaterSteamSimple;
 record ThermoProperties_ps
-  Modelica.SIunits.Temperature T(
+  Modelica.Units.SI.Temperature T(
     min=WaterSteam.InitLimits.TMIN,
     max=WaterSteam.InitLimits.TMAX,
     nominal=WaterSteam.InitLimits.TNOM) "Temperature";
-  Modelica.SIunits.Density d(
+  Modelica.Units.SI.Density d(
     min=WaterSteam.InitLimits.DMIN,
     max=WaterSteam.InitLimits.DMAX,
     nominal=WaterSteam.InitLimits.DNOM) "Density";
-  Modelica.SIunits.SpecificEnergy u(
+  Modelica.Units.SI.SpecificEnergy u(
     min=WaterSteam.InitLimits.SEMIN,
     max=WaterSteam.InitLimits.SEMAX,
     nominal=WaterSteam.InitLimits.SENOM) "Specific inner energy";
-  Modelica.SIunits.SpecificEnthalpy h(
+  Modelica.Units.SI.SpecificEnthalpy h(
     min=WaterSteam.InitLimits.SHMIN,
     max=WaterSteam.InitLimits.SHMAX,
     nominal=WaterSteam.InitLimits.SHNOM) "Specific enthalpy";
-  Modelica.SIunits.SpecificHeatCapacity cp(
+  Modelica.Units.SI.SpecificHeatCapacity cp(
     min=WaterSteam.InitLimits.CPMIN,
     max=WaterSteam.InitLimits.CPMAX,
     nominal=WaterSteam.InitLimits.CPNOM)
     "Specific heat capacity at constant pressure";
   ThermoSysPro.Units.DerDensityByEntropy ddsp
     "Derivative of the density wrt. specific entropy at constant pressure";
-  Modelica.SIunits.DerDensityByPressure ddps
+  Modelica.Units.SI.DerDensityByPressure ddps
     "Derivative of the density wrt. pressure at constant specific entropy";
   ThermoSysPro.Units.MassFraction x "Vapor mass fraction";
   annotation (
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Utilities/logBase10.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Utilities/logBase10.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Utilities/logBase10.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Utilities/logBase10.mo"	2022-03-10 09:58:25.736150174 +0000
@@ -3,6 +3,6 @@
   input Real x;
   output Real y;
 algorithm
-  //y:= log10(x);
+//y:= log10(x);
   y:=log10(abs(x)+1e-10);
 end logBase10;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/calculette_T.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/calculette_T.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/calculette_T.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/calculette_T.mo"	2022-03-10 09:58:25.380150129 +0000
@@ -1,23 +1,23 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Validation;
 model calculette_T
-  parameter Modelica.SIunits.Temperature T_min = 275;
-  parameter Modelica.SIunits.Temperature T_max = 350;
-  parameter Modelica.SIunits.Density d = 15;
- Modelica.SIunits.Temperature T;
+  parameter Modelica.Units.SI.Temperature T_min = 275;
+  parameter Modelica.Units.SI.Temperature T_max = 350;
+  parameter Modelica.Units.SI.Density d = 15;
+ Modelica.Units.SI.Temperature T;
 
-  Modelica.SIunits.Density d1sat;
-  Modelica.SIunits.Density d2sat;
-  Modelica.SIunits.SurfaceTension sigma_polynomial;
-  Modelica.SIunits.SurfaceTension sigma_IF97;
+  Modelica.Units.SI.Density d1sat;
+  Modelica.Units.SI.Density d2sat;
+  Modelica.Units.SI.SurfaceTension sigma_polynomial;
+  Modelica.Units.SI.SurfaceTension sigma_IF97;
 
-  Modelica.SIunits.Pressure Psat;
-  Modelica.SIunits.DynamicViscosity mu1;
-  Modelica.SIunits.DynamicViscosity mu2;
-  Modelica.SIunits.DynamicViscosity mu_polynomial "Dynamic viscosity";
-  Modelica.SIunits.DynamicViscosity mu_IF97 "Dynamic viscosity";
+  Modelica.Units.SI.Pressure Psat;
+  Modelica.Units.SI.DynamicViscosity mu1;
+  Modelica.Units.SI.DynamicViscosity mu2;
+  Modelica.Units.SI.DynamicViscosity mu_polynomial "Dynamic viscosity";
+  Modelica.Units.SI.DynamicViscosity mu_IF97 "Dynamic viscosity";
   Real titre;
 protected
-  parameter Modelica.SIunits.Time dt = 10000;
+  parameter Modelica.Units.SI.Time dt = 10000;
   Real x = time/dt;
 
 equation
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/calculette_d.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/calculette_d.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/calculette_d.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/calculette_d.mo"	2022-03-10 09:58:25.368150127 +0000
@@ -1,25 +1,25 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Validation;
 model calculette_d
-  parameter Modelica.SIunits.Temperature T= 350;
-  parameter Modelica.SIunits.Density d_min = 0.1;
-  parameter Modelica.SIunits.Density d_max = 1000;
-  Modelica.SIunits.Density d;
-  Modelica.SIunits.Pressure p;
-  Modelica.SIunits.DynamicViscosity mu_polynomial "Dynamic viscosity";
-  Modelica.SIunits.ThermalConductivity  lambda_polynomial
+  parameter Modelica.Units.SI.Temperature T= 350;
+  parameter Modelica.Units.SI.Density d_min = 0.1;
+  parameter Modelica.Units.SI.Density d_max = 1000;
+  Modelica.Units.SI.Density d;
+  Modelica.Units.SI.Pressure p;
+  Modelica.Units.SI.DynamicViscosity mu_polynomial "Dynamic viscosity";
+  Modelica.Units.SI.ThermalConductivity  lambda_polynomial
     "Thermal conductivity";
-  Modelica.SIunits.DynamicViscosity mu_IF97 "Dynamic viscosity";
-  Modelica.SIunits.ThermalConductivity  lambda_IF97 "Thermal conductivity";
+  Modelica.Units.SI.DynamicViscosity mu_IF97 "Dynamic viscosity";
+  Modelica.Units.SI.ThermalConductivity  lambda_IF97 "Thermal conductivity";
 
-  Modelica.SIunits.DynamicViscosity mu1;
-  Modelica.SIunits.DynamicViscosity mu2;
+  Modelica.Units.SI.DynamicViscosity mu1;
+  Modelica.Units.SI.DynamicViscosity mu2;
 
-  Modelica.SIunits.Density d1sat;
-  Modelica.SIunits.Density d2sat;
+  Modelica.Units.SI.Density d1sat;
+  Modelica.Units.SI.Density d2sat;
   Real titre;
 
 protected
-  parameter Modelica.SIunits.Time dt = 10000;
+  parameter Modelica.Units.SI.Time dt = 10000;
   Real x = time/dt;
 
 equation
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/calculette_h.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/calculette_h.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/calculette_h.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/calculette_h.mo"	2022-03-10 09:58:25.352150125 +0000
@@ -1,21 +1,21 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Validation;
 model calculette_h
-  parameter Modelica.SIunits.Pressure p = 50e5;
-  parameter Modelica.SIunits.SpecificEnthalpy h_min = 1e5;
-  parameter Modelica.SIunits.SpecificEnthalpy h_max = 5e6;
-  Modelica.SIunits.SpecificEnthalpy h;
-  Modelica.SIunits.SpecificEnthalpy h1sat;
-  Modelica.SIunits.SpecificEnthalpy h2sat;
-  Modelica.SIunits.Temperature T1;
-  Modelica.SIunits.Temperature Tsat1;
-  Modelica.SIunits.SpecificEnthalpy h1sat_IF97;
-  Modelica.SIunits.SpecificEnthalpy h2sat_IF97;
+  parameter Modelica.Units.SI.Pressure p = 50e5;
+  parameter Modelica.Units.SI.SpecificEnthalpy h_min = 1e5;
+  parameter Modelica.Units.SI.SpecificEnthalpy h_max = 5e6;
+  Modelica.Units.SI.SpecificEnthalpy h;
+  Modelica.Units.SI.SpecificEnthalpy h1sat;
+  Modelica.Units.SI.SpecificEnthalpy h2sat;
+  Modelica.Units.SI.Temperature T1;
+  Modelica.Units.SI.Temperature Tsat1;
+  Modelica.Units.SI.SpecificEnthalpy h1sat_IF97;
+  Modelica.Units.SI.SpecificEnthalpy h2sat_IF97;
 
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro_IF97;
   ThermoSysPro.Properties.WaterSteamSimple.ThermoProperties_ph pro_polynomial;
 
 protected
-  parameter Modelica.SIunits.Time dt = 10000;
+  parameter Modelica.Units.SI.Time dt = 10000;
   Real x = time/dt;
 
 equation
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/calculette_p.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/calculette_p.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/calculette_p.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/calculette_p.mo"	2022-03-10 09:58:25.344150124 +0000
@@ -1,22 +1,22 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Validation;
 model calculette_p
-  parameter Modelica.SIunits.SpecificEnthalpy h = 5e5;
-  parameter Modelica.SIunits.Pressure p_min = 0.1e5;
-  parameter Modelica.SIunits.Pressure p_max = 220e5;
-  Modelica.SIunits.Pressure p;
-  Modelica.SIunits.SpecificEnthalpy h1sat;
-  Modelica.SIunits.SpecificEnthalpy h2sat;
-  Modelica.SIunits.SpecificEntropy s1sat;
-  Modelica.SIunits.SpecificEntropy s2sat;
-  Modelica.SIunits.SpecificEnthalpy h1sat_IF97;
-  Modelica.SIunits.SpecificEnthalpy h2sat_IF97;
-  Modelica.SIunits.Temperature T1;
-  Modelica.SIunits.Temperature Tsat1;
+  parameter Modelica.Units.SI.SpecificEnthalpy h = 5e5;
+  parameter Modelica.Units.SI.Pressure p_min = 0.1e5;
+  parameter Modelica.Units.SI.Pressure p_max = 220e5;
+  Modelica.Units.SI.Pressure p;
+  Modelica.Units.SI.SpecificEnthalpy h1sat;
+  Modelica.Units.SI.SpecificEnthalpy h2sat;
+  Modelica.Units.SI.SpecificEntropy s1sat;
+  Modelica.Units.SI.SpecificEntropy s2sat;
+  Modelica.Units.SI.SpecificEnthalpy h1sat_IF97;
+  Modelica.Units.SI.SpecificEnthalpy h2sat_IF97;
+  Modelica.Units.SI.Temperature T1;
+  Modelica.Units.SI.Temperature Tsat1;
 
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro_IF97;
   ThermoSysPro.Properties.WaterSteamSimple.ThermoProperties_ph pro_polynomial;
 protected
-  parameter Modelica.SIunits.Time dt = 10000;
+  parameter Modelica.Units.SI.Time dt = 10000;
   Real x = time/dt;
 
 equation
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/generate_data_dT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/generate_data_dT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/generate_data_dT.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/generate_data_dT.mo"	2022-03-10 09:58:25.304150120 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Validation;
 model generate_data_dT
-  import Modelica.SIunits.*;
+  import Modelica.Units.SI.*;
   parameter Density d_min = 15;
   parameter Density d_max = 1000;
   parameter Density delta_d(min = 1) = 25;
@@ -8,11 +8,11 @@
   parameter Temperature T_max = 1000;
   parameter Temperature  delta_T(min = 1) = 50;
 
-  Modelica.SIunits.DynamicViscosity mu_polynomial "Dynamic viscosity";
-  Modelica.SIunits.ThermalConductivity  lambda_polynomial
+  Modelica.Units.SI.DynamicViscosity mu_polynomial "Dynamic viscosity";
+  Modelica.Units.SI.ThermalConductivity  lambda_polynomial
     "Thermal conductivity";
-  Modelica.SIunits.DynamicViscosity mu_IF97 "Dynamic viscosity";
-  Modelica.SIunits.ThermalConductivity  lambda_IF97 "Thermal conductivity";
+  Modelica.Units.SI.DynamicViscosity mu_IF97 "Dynamic viscosity";
+  Modelica.Units.SI.ThermalConductivity  lambda_IF97 "Thermal conductivity";
 
 protected
   parameter Integer n_d =  integer((d_max - d_min)/delta_d);
@@ -28,47 +28,30 @@
    output SpecificEnthalpy T[n_T];
 
 algorithm
-  i_mat :=0;
-  for i_d in 1:n_d loop
-    d[i_d] := d_min + (i_d-1)*delta_d;
-    for i_T in 1:n_T loop
-      T[i_T] := T_min + (i_T-1)*delta_T;
-
-      //Properties
-      mu_polynomial :=
-        ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.DynamicViscosity_rhoT(
-        d[i_d], T[i_T]);
-
-      lambda_polynomial :=
-        ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.ThermalConductivity_rhoT(
-        d[i_d], T[i_T]);
-
-      mu_IF97 := ThermoSysPro.Properties.WaterSteam.IF97.DynamicViscosity_rhoT(
-         d[i_d],
-         T[i_T]);
-
-      lambda_IF97 := ThermoSysPro.Properties.WaterSteam.IF97.ThermalConductivity_rhoT(
-          d[i_d],
-         T[i_T],0,0);
-
-      //Store results
-      i_mat := i_mat + 1;
-      res_polynomial[i_mat,1] := d[i_d];
-      res_polynomial[i_mat,2] := T[i_T];
-      res_polynomial[i_mat,3] := mu_polynomial;
-      res_polynomial[i_mat,4] := lambda_polynomial;
-
-      res_IF97[i_mat,1] := d[i_d];
-      res_IF97[i_mat,2] := T[i_T];
-      res_IF97[i_mat,3] := mu_IF97;
-      res_IF97[i_mat,4] := lambda_IF97;
-
-    end for;
-
-  end for;
-
- //Write results
- DymolaCommands.MatrixIO.writeMatrix("res_polynomial_lbdmu_dT.mat","res_polynomial",res_polynomial);
+  i_mat :=0;
+ for i_d in 1:n_d loop
+    d[i_d] := d_min + (i_d - 1) * delta_d;
+    for i_T in 1:n_T loop
+      T[i_T] := T_min + (i_T - 1) * delta_T;
+      mu_polynomial := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.DynamicViscosity_rhoT(d[i_d], T[i_T]);
+      lambda_polynomial := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.ThermalConductivity_rhoT(d[i_d], T[i_T]);
+      mu_IF97 := ThermoSysPro.Properties.WaterSteam.IF97.DynamicViscosity_rhoT(d[i_d], T[i_T]);
+      lambda_IF97 := ThermoSysPro.Properties.WaterSteam.IF97.ThermalConductivity_rhoT(d[i_d], T[i_T], 0, 0);
+      i_mat := i_mat + 1;
+      res_polynomial[i_mat, 1] := d[i_d];
+      res_polynomial[i_mat, 2] := T[i_T];
+      res_polynomial[i_mat, 3] := mu_polynomial;
+      res_polynomial[i_mat, 4] := lambda_polynomial;
+      res_IF97[i_mat, 1] := d[i_d];
+      res_IF97[i_mat, 2] := T[i_T];
+      res_IF97[i_mat, 3] := mu_IF97;
+      res_IF97[i_mat, 4] := lambda_IF97;
+    end for;
+  end for;
+//Properties
+//Store results
+//Write results
+  DymolaCommands.MatrixIO.writeMatrix("res_polynomial_lbdmu_dT.mat", "res_polynomial", res_polynomial);
  DymolaCommands.MatrixIO.writeMatrix("res_IF97_lbdmu_dT.mat","res_IF97",res_IF97);
 
   annotation (Icon(graphics={
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/generate_data_lowpressure_ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/generate_data_lowpressure_ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/generate_data_lowpressure_ph.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/generate_data_lowpressure_ph.mo"	2022-03-10 09:58:25.284150118 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Validation;
 model generate_data_lowpressure_ph
-  import Modelica.SIunits.*;
+  import Modelica.Units.SI.*;
   parameter Pressure p_min = 0.01e5;
   parameter Pressure p_max = 10e5;
   parameter Pressure delta_p(min = 1) = 1e5;
@@ -10,8 +10,8 @@
 
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro_polynomial;
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro_IF97;
- // Integer i_p;
- // Integer i_h;
+ // Integer i_p;
+ // Integer i_h;
 protected
   parameter Integer n_p =  integer((p_max - p_min)/delta_p);
   parameter Integer n_h = integer((h_max - h_min)/delta_h);
@@ -25,56 +25,44 @@
    output SpecificEnthalpy h[n_h];
 
 algorithm
-  i_mat :=0;
-  for i_p in 1:n_p loop
-    p[i_p] := p_min + (i_p-1)*delta_p;
-    for i_h in 1:n_h loop
-      h[i_h] := h_min + (i_h-1)*delta_h;
-
-      //Properties
-      pro_IF97 := ThermoSysPro.Properties.Fluid.Ph(
-         p[i_p],
-         h[i_h],
-         0,1);
-
-       pro_polynomial := ThermoSysPro.Properties.Fluid.Ph(
-         p[i_p],
-         h[i_h],
-         0,3);
-
-      //Store results
-      i_mat := i_mat + 1;
-      res_polynomial[i_mat,1] := p[i_p];
-      res_polynomial[i_mat,2] := h[i_h];
-      res_polynomial[i_mat,3] := pro_polynomial.x;
-      res_polynomial[i_mat,4] := pro_polynomial.T;
-      res_polynomial[i_mat,5] := pro_polynomial.d;
-      res_polynomial[i_mat,6] := pro_polynomial.u;
-      res_polynomial[i_mat,7] := pro_polynomial.s;
-      res_polynomial[i_mat,8] := pro_polynomial.cp;
-      res_polynomial[i_mat,9] := pro_polynomial.ddhp;
-      res_polynomial[i_mat,10] := pro_polynomial.ddph;
-      res_polynomial[i_mat,11] := pro_polynomial.duph;
-      res_polynomial[i_mat,12] := pro_polynomial.duhp;
-
-      res_IF97[i_mat,1] := p[i_p];
-      res_IF97[i_mat,2] := h[i_h];
-      res_IF97[i_mat,3] := pro_IF97.x;
-      res_IF97[i_mat,4] := pro_IF97.T;
-      res_IF97[i_mat,5] := pro_IF97.d;
-      res_IF97[i_mat,6] := pro_IF97.u;
-      res_IF97[i_mat,7] := pro_IF97.s;
-      res_IF97[i_mat,8] := pro_IF97.cp;
-      res_IF97[i_mat,9] := pro_IF97.ddhp;
-      res_IF97[i_mat,10] := pro_IF97.ddph;
-      res_IF97[i_mat,11] := pro_IF97.duph;
-      res_IF97[i_mat,12] := pro_IF97.duhp;
-    end for;
-
-  end for;
-
- //Write results
- DymolaCommands.MatrixIO.writeMatrix("res_polynomial_lowpressure_ph.mat","res_polynomial",res_polynomial);
+  i_mat :=0;
+ for i_p in 1:n_p loop
+    p[i_p] := p_min + (i_p - 1) * delta_p;
+    for i_h in 1:n_h loop
+      h[i_h] := h_min + (i_h - 1) * delta_h;
+      pro_IF97 := ThermoSysPro.Properties.Fluid.Ph(p[i_p], h[i_h], 0, 1);
+      pro_polynomial := ThermoSysPro.Properties.Fluid.Ph(p[i_p], h[i_h], 0, 3);
+      i_mat := i_mat + 1;
+      res_polynomial[i_mat, 1] := p[i_p];
+      res_polynomial[i_mat, 2] := h[i_h];
+      res_polynomial[i_mat, 3] := pro_polynomial.x;
+      res_polynomial[i_mat, 4] := pro_polynomial.T;
+      res_polynomial[i_mat, 5] := pro_polynomial.d;
+      res_polynomial[i_mat, 6] := pro_polynomial.u;
+      res_polynomial[i_mat, 7] := pro_polynomial.s;
+      res_polynomial[i_mat, 8] := pro_polynomial.cp;
+      res_polynomial[i_mat, 9] := pro_polynomial.ddhp;
+      res_polynomial[i_mat, 10] := pro_polynomial.ddph;
+      res_polynomial[i_mat, 11] := pro_polynomial.duph;
+      res_polynomial[i_mat, 12] := pro_polynomial.duhp;
+      res_IF97[i_mat, 1] := p[i_p];
+      res_IF97[i_mat, 2] := h[i_h];
+      res_IF97[i_mat, 3] := pro_IF97.x;
+      res_IF97[i_mat, 4] := pro_IF97.T;
+      res_IF97[i_mat, 5] := pro_IF97.d;
+      res_IF97[i_mat, 6] := pro_IF97.u;
+      res_IF97[i_mat, 7] := pro_IF97.s;
+      res_IF97[i_mat, 8] := pro_IF97.cp;
+      res_IF97[i_mat, 9] := pro_IF97.ddhp;
+      res_IF97[i_mat, 10] := pro_IF97.ddph;
+      res_IF97[i_mat, 11] := pro_IF97.duph;
+      res_IF97[i_mat, 12] := pro_IF97.duhp;
+    end for;
+  end for;
+//Properties
+//Store results
+//Write results
+  DymolaCommands.MatrixIO.writeMatrix("res_polynomial_lowpressure_ph.mat", "res_polynomial", res_polynomial);
  DymolaCommands.MatrixIO.writeMatrix("res_IF97_lowpressure_ph.mat","res_IF97",res_IF97);
 
   annotation (Icon(graphics={
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/generate_data_supercritique_ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/generate_data_supercritique_ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/generate_data_supercritique_ph.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/generate_data_supercritique_ph.mo"	2022-03-10 09:58:25.268150114 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Validation;
 model generate_data_supercritique_ph
-  import Modelica.SIunits.*;
+  import Modelica.Units.SI.*;
   parameter Pressure p_min = 200e5;
   parameter Pressure p_max = 400e5;
   parameter Pressure delta_p(min = 1) = 10e5;
@@ -24,56 +24,44 @@
    output SpecificEnthalpy h[n_h];
 
 algorithm
-  i_mat :=0;
-  for i_p in 1:n_p loop
-    p[i_p] := p_min + (i_p-1)*delta_p;
-    for i_h in 1:n_h loop
-      h[i_h] := h_min + (i_h-1)*delta_h;
-
-      //Properties
-      pro_IF97 := ThermoSysPro.Properties.Fluid.Ph(
-         p[i_p],
-         h[i_h],
-         0,1);
-
-       pro_polynomial := ThermoSysPro.Properties.Fluid.Ph(
-         p[i_p],
-         h[i_h],
-         0,3);
-
-      //Store results
-      i_mat := i_mat + 1;
-      res_polynomial[i_mat,1] := p[i_p];
-      res_polynomial[i_mat,2] := h[i_h];
-      res_polynomial[i_mat,3] := pro_polynomial.x;
-      res_polynomial[i_mat,4] := pro_polynomial.T;
-      res_polynomial[i_mat,5] := pro_polynomial.d;
-      res_polynomial[i_mat,6] := pro_polynomial.u;
-      res_polynomial[i_mat,7] := pro_polynomial.s;
-      res_polynomial[i_mat,8] := pro_polynomial.cp;
-      res_polynomial[i_mat,9] := pro_polynomial.ddhp;
-      res_polynomial[i_mat,10] := pro_polynomial.ddph;
-      res_polynomial[i_mat,11] := pro_polynomial.duph;
-      res_polynomial[i_mat,12] := pro_polynomial.duhp;
-
-      res_IF97[i_mat,1] := p[i_p];
-      res_IF97[i_mat,2] := h[i_h];
-      res_IF97[i_mat,3] := pro_IF97.x;
-      res_IF97[i_mat,4] := pro_IF97.T;
-      res_IF97[i_mat,5] := pro_IF97.d;
-      res_IF97[i_mat,6] := pro_IF97.u;
-      res_IF97[i_mat,7] := pro_IF97.s;
-      res_IF97[i_mat,8] := pro_IF97.cp;
-      res_IF97[i_mat,9] := pro_IF97.ddhp;
-      res_IF97[i_mat,10] := pro_IF97.ddph;
-      res_IF97[i_mat,11] := pro_IF97.duph;
-      res_IF97[i_mat,12] := pro_IF97.duhp;
-    end for;
-
-  end for;
-
- //Write results
- DymolaCommands.MatrixIO.writeMatrix("res_polynomial_supercritique_ph.mat","res_polynomial",res_polynomial);
+  i_mat :=0;
+ for i_p in 1:n_p loop
+    p[i_p] := p_min + (i_p - 1) * delta_p;
+    for i_h in 1:n_h loop
+      h[i_h] := h_min + (i_h - 1) * delta_h;
+      pro_IF97 := ThermoSysPro.Properties.Fluid.Ph(p[i_p], h[i_h], 0, 1);
+      pro_polynomial := ThermoSysPro.Properties.Fluid.Ph(p[i_p], h[i_h], 0, 3);
+      i_mat := i_mat + 1;
+      res_polynomial[i_mat, 1] := p[i_p];
+      res_polynomial[i_mat, 2] := h[i_h];
+      res_polynomial[i_mat, 3] := pro_polynomial.x;
+      res_polynomial[i_mat, 4] := pro_polynomial.T;
+      res_polynomial[i_mat, 5] := pro_polynomial.d;
+      res_polynomial[i_mat, 6] := pro_polynomial.u;
+      res_polynomial[i_mat, 7] := pro_polynomial.s;
+      res_polynomial[i_mat, 8] := pro_polynomial.cp;
+      res_polynomial[i_mat, 9] := pro_polynomial.ddhp;
+      res_polynomial[i_mat, 10] := pro_polynomial.ddph;
+      res_polynomial[i_mat, 11] := pro_polynomial.duph;
+      res_polynomial[i_mat, 12] := pro_polynomial.duhp;
+      res_IF97[i_mat, 1] := p[i_p];
+      res_IF97[i_mat, 2] := h[i_h];
+      res_IF97[i_mat, 3] := pro_IF97.x;
+      res_IF97[i_mat, 4] := pro_IF97.T;
+      res_IF97[i_mat, 5] := pro_IF97.d;
+      res_IF97[i_mat, 6] := pro_IF97.u;
+      res_IF97[i_mat, 7] := pro_IF97.s;
+      res_IF97[i_mat, 8] := pro_IF97.cp;
+      res_IF97[i_mat, 9] := pro_IF97.ddhp;
+      res_IF97[i_mat, 10] := pro_IF97.ddph;
+      res_IF97[i_mat, 11] := pro_IF97.duph;
+      res_IF97[i_mat, 12] := pro_IF97.duhp;
+    end for;
+  end for;
+//Properties
+//Store results
+//Write results
+  DymolaCommands.MatrixIO.writeMatrix("res_polynomial_supercritique_ph.mat", "res_polynomial", res_polynomial);
  DymolaCommands.MatrixIO.writeMatrix("res_IF97_supercritique_ph.mat","res_IF97",res_IF97);
 
   annotation (Icon(graphics={
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/generate_data_twophase_ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/generate_data_twophase_ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/generate_data_twophase_ph.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/generate_data_twophase_ph.mo"	2022-03-10 09:58:25.248150112 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Validation;
 model generate_data_twophase_ph
-  import Modelica.SIunits.*;
+  import Modelica.Units.SI.*;
   parameter Pressure p_min = 1e5;
   parameter Pressure p_max = 220e5;
   parameter Pressure delta_p(min = 1) = 20e5;
@@ -10,8 +10,8 @@
 
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro_polynomial;
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro_IF97;
- // Integer i_p;
- // Integer i_h;
+ // Integer i_p;
+ // Integer i_h;
 protected
   parameter Integer n_p =  integer((p_max - p_min)/delta_p);
   parameter Integer n_h = integer((h_max - h_min)/delta_h);
@@ -25,56 +25,44 @@
    output SpecificEnthalpy h[n_h];
 
 algorithm
-  i_mat :=0;
-  for i_p in 1:n_p loop
-    p[i_p] := p_min + (i_p-1)*delta_p;
-    for i_h in 1:n_h loop
-      h[i_h] := h_min + (i_h-1)*delta_h;
-
-      //Properties
-      pro_IF97 := ThermoSysPro.Properties.Fluid.Ph(
-         p[i_p],
-         h[i_h],
-         0,1);
-
-       pro_polynomial := ThermoSysPro.Properties.Fluid.Ph(
-         p[i_p],
-         h[i_h],
-         0,3);
-
-      //Store results
-      i_mat := i_mat + 1;
-      res_polynomial[i_mat,1] := p[i_p];
-      res_polynomial[i_mat,2] := h[i_h];
-      res_polynomial[i_mat,3] := pro_polynomial.x;
-      res_polynomial[i_mat,4] := pro_polynomial.T;
-      res_polynomial[i_mat,5] := pro_polynomial.d;
-      res_polynomial[i_mat,6] := pro_polynomial.u;
-      res_polynomial[i_mat,7] := pro_polynomial.s;
-      res_polynomial[i_mat,8] := pro_polynomial.cp;
-      res_polynomial[i_mat,9] := pro_polynomial.ddhp;
-      res_polynomial[i_mat,10] := pro_polynomial.ddph;
-      res_polynomial[i_mat,11] := pro_polynomial.duph;
-      res_polynomial[i_mat,12] := pro_polynomial.duhp;
-
-      res_IF97[i_mat,1] := p[i_p];
-      res_IF97[i_mat,2] := h[i_h];
-      res_IF97[i_mat,3] := pro_IF97.x;
-      res_IF97[i_mat,4] := pro_IF97.T;
-      res_IF97[i_mat,5] := pro_IF97.d;
-      res_IF97[i_mat,6] := pro_IF97.u;
-      res_IF97[i_mat,7] := pro_IF97.s;
-      res_IF97[i_mat,8] := pro_IF97.cp;
-      res_IF97[i_mat,9] := pro_IF97.ddhp;
-      res_IF97[i_mat,10] := pro_IF97.ddph;
-      res_IF97[i_mat,11] := pro_IF97.duph;
-      res_IF97[i_mat,12] := pro_IF97.duhp;
-    end for;
-
-  end for;
-
- //Write results
- DymolaCommands.MatrixIO.writeMatrix("res_polynomial_twophase_ph.mat","res_polynomial",res_polynomial);
+  i_mat :=0;
+ for i_p in 1:n_p loop
+    p[i_p] := p_min + (i_p - 1) * delta_p;
+    for i_h in 1:n_h loop
+      h[i_h] := h_min + (i_h - 1) * delta_h;
+      pro_IF97 := ThermoSysPro.Properties.Fluid.Ph(p[i_p], h[i_h], 0, 1);
+      pro_polynomial := ThermoSysPro.Properties.Fluid.Ph(p[i_p], h[i_h], 0, 3);
+      i_mat := i_mat + 1;
+      res_polynomial[i_mat, 1] := p[i_p];
+      res_polynomial[i_mat, 2] := h[i_h];
+      res_polynomial[i_mat, 3] := pro_polynomial.x;
+      res_polynomial[i_mat, 4] := pro_polynomial.T;
+      res_polynomial[i_mat, 5] := pro_polynomial.d;
+      res_polynomial[i_mat, 6] := pro_polynomial.u;
+      res_polynomial[i_mat, 7] := pro_polynomial.s;
+      res_polynomial[i_mat, 8] := pro_polynomial.cp;
+      res_polynomial[i_mat, 9] := pro_polynomial.ddhp;
+      res_polynomial[i_mat, 10] := pro_polynomial.ddph;
+      res_polynomial[i_mat, 11] := pro_polynomial.duph;
+      res_polynomial[i_mat, 12] := pro_polynomial.duhp;
+      res_IF97[i_mat, 1] := p[i_p];
+      res_IF97[i_mat, 2] := h[i_h];
+      res_IF97[i_mat, 3] := pro_IF97.x;
+      res_IF97[i_mat, 4] := pro_IF97.T;
+      res_IF97[i_mat, 5] := pro_IF97.d;
+      res_IF97[i_mat, 6] := pro_IF97.u;
+      res_IF97[i_mat, 7] := pro_IF97.s;
+      res_IF97[i_mat, 8] := pro_IF97.cp;
+      res_IF97[i_mat, 9] := pro_IF97.ddhp;
+      res_IF97[i_mat, 10] := pro_IF97.ddph;
+      res_IF97[i_mat, 11] := pro_IF97.duph;
+      res_IF97[i_mat, 12] := pro_IF97.duhp;
+    end for;
+  end for;
+//Properties
+//Store results
+//Write results
+  DymolaCommands.MatrixIO.writeMatrix("res_polynomial_twophase_ph.mat", "res_polynomial", res_polynomial);
  DymolaCommands.MatrixIO.writeMatrix("res_IF97_twophase_ph.mat","res_IF97",res_IF97);
 
   annotation (Icon(graphics={
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/generate_data_twophase_ps.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/generate_data_twophase_ps.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/generate_data_twophase_ps.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/generate_data_twophase_ps.mo"	2022-03-10 09:58:25.232150110 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Validation;
 model generate_data_twophase_ps
-  import Modelica.SIunits.*;
+  import Modelica.Units.SI.*;
   parameter Pressure p_min = 1e5;
   parameter Pressure p_max = 150e5;
   parameter Pressure delta_p(min = 1) = 10e5;
@@ -24,53 +24,40 @@
    output SpecificEnthalpy s[n_s];
 
 algorithm
-  i_mat :=0;
-  for i_p in 1:n_p loop
-    p[i_p] := p_min + (i_p-1)*delta_p;
-    for i_s in 1:n_s loop
-      s[i_s] := s_min + (i_s-1)*delta_s;
-
-      //Properties
-      pro_IF97 := ThermoSysPro.Properties.Fluid.Ps(
-         p[i_p],
-         s[i_s],
-         0,3);
-
-      pro_polynomial := ThermoSysPro.Properties.Fluid.Ps(
-         p[i_p],
-         s[i_s],
-         0,3);
-
-      //Store results
-      i_mat := i_mat + 1;
-      res_polynomial[i_mat,1] := p[i_p];
-      res_polynomial[i_mat,2] := s[i_s];
-      res_polynomial[i_mat,3] := pro_polynomial.x;
-      res_polynomial[i_mat,4] := pro_polynomial.T;
-      res_polynomial[i_mat,5] := pro_polynomial.d;
-      res_polynomial[i_mat,6] := pro_polynomial.u;
-      res_polynomial[i_mat,7] := pro_polynomial.h;
-      res_polynomial[i_mat,8] := pro_polynomial.cp;
-      res_polynomial[i_mat,9] := pro_polynomial.ddsp;
-      res_polynomial[i_mat,10] := pro_polynomial.ddps;
-
-      res_IF97[i_mat,1] := p[i_p];
-      res_IF97[i_mat,2] := s[i_s];
-      res_IF97[i_mat,3] := pro_IF97.x;
-      res_IF97[i_mat,4] := pro_IF97.T;
-      res_IF97[i_mat,5] := pro_IF97.d;
-      res_IF97[i_mat,6] := pro_IF97.u;
-      res_IF97[i_mat,7] := pro_IF97.h;
-      res_IF97[i_mat,8] := pro_IF97.cp;
-      res_IF97[i_mat,9] := pro_IF97.ddsp;
-      res_IF97[i_mat,10] := pro_IF97.ddps;
-
-    end for;
-
-  end for;
-
- //Write results
- DymolaCommands.MatrixIO.writeMatrix("res_polynomial_twophase_ps.mat","res_polynomial",res_polynomial);
+  i_mat :=0;
+ for i_p in 1:n_p loop
+    p[i_p] := p_min + (i_p - 1) * delta_p;
+    for i_s in 1:n_s loop
+      s[i_s] := s_min + (i_s - 1) * delta_s;
+      pro_IF97 := ThermoSysPro.Properties.Fluid.Ps(p[i_p], s[i_s], 0, 3);
+      pro_polynomial := ThermoSysPro.Properties.Fluid.Ps(p[i_p], s[i_s], 0, 3);
+      i_mat := i_mat + 1;
+      res_polynomial[i_mat, 1] := p[i_p];
+      res_polynomial[i_mat, 2] := s[i_s];
+      res_polynomial[i_mat, 3] := pro_polynomial.x;
+      res_polynomial[i_mat, 4] := pro_polynomial.T;
+      res_polynomial[i_mat, 5] := pro_polynomial.d;
+      res_polynomial[i_mat, 6] := pro_polynomial.u;
+      res_polynomial[i_mat, 7] := pro_polynomial.h;
+      res_polynomial[i_mat, 8] := pro_polynomial.cp;
+      res_polynomial[i_mat, 9] := pro_polynomial.ddsp;
+      res_polynomial[i_mat, 10] := pro_polynomial.ddps;
+      res_IF97[i_mat, 1] := p[i_p];
+      res_IF97[i_mat, 2] := s[i_s];
+      res_IF97[i_mat, 3] := pro_IF97.x;
+      res_IF97[i_mat, 4] := pro_IF97.T;
+      res_IF97[i_mat, 5] := pro_IF97.d;
+      res_IF97[i_mat, 6] := pro_IF97.u;
+      res_IF97[i_mat, 7] := pro_IF97.h;
+      res_IF97[i_mat, 8] := pro_IF97.cp;
+      res_IF97[i_mat, 9] := pro_IF97.ddsp;
+      res_IF97[i_mat, 10] := pro_IF97.ddps;
+    end for;
+  end for;
+//Properties
+//Store results
+//Write results
+  DymolaCommands.MatrixIO.writeMatrix("res_polynomial_twophase_ps.mat", "res_polynomial", res_polynomial);
  DymolaCommands.MatrixIO.writeMatrix("res_IF97_twophase_ps.mat","res_IF97",res_IF97);
 
   annotation (Icon(graphics={
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/generate_data_watersat.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/generate_data_watersat.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/generate_data_watersat.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Validation/generate_data_watersat.mo"	2022-03-10 09:58:25.220150110 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Validation;
 model generate_data_watersat
-  import Modelica.SIunits.*;
+  import Modelica.Units.SI.*;
   parameter Pressure p_min = 1e5;
   parameter Pressure p_max = 220e5;
   parameter Pressure delta_p(min = 1) = 20e5;
@@ -10,8 +10,8 @@
   ThermoSysPro.Properties.WaterSteamSimple.PropThermoSat pro2_polynomial;
   ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat pro2_IF97;
 
- // Integer i_p;
- // Integer i_h;
+// Integer i_p;
+ // Integer i_h;
 protected
   parameter Integer n_p =  integer((p_max - p_min)/delta_p);
 
@@ -24,53 +24,43 @@
    output AbsolutePressure p[n_p];
 
 algorithm
-  i_mat :=0;
-  for i_p in 1:n_p loop
-    p[i_p] := p_min + (i_p-1)*delta_p;
-
-      //Properties
-    (pro1_IF97,pro2_IF97) :=
-      ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_sat_P(p[i_p]);
-
-      (pro1_polynomial,pro2_polynomial) := ThermoSysPro.Properties.WaterSteam.IF97.Water_sat_P(
-         p[i_p]);
-
-      //Store results
-      i_mat := i_mat + 1;
-
-      //Liquid
-      res1_polynomial[i_mat,1] := 1;
-      res1_polynomial[i_mat,2] := p[i_p];
-      res1_polynomial[i_mat,3] := pro1_polynomial.T;
-      res1_polynomial[i_mat,4] := pro1_polynomial.rho;
-      res1_polynomial[i_mat,5] := pro1_polynomial.h;
-      res1_polynomial[i_mat,6] := pro1_polynomial.cp;
-
-      res1_IF97[i_mat,1] := 1;
-      res1_IF97[i_mat,2] := p[i_p];
-      res1_IF97[i_mat,3] := pro1_IF97.T;
-      res1_IF97[i_mat,4] := pro1_IF97.rho;
-      res1_IF97[i_mat,5] := pro1_IF97.h;
-      res1_IF97[i_mat,6] := pro1_IF97.cp;
-
-      //Vapour
-      res2_polynomial[i_mat,1] := 1;
-      res2_polynomial[i_mat,2] := p[i_p];
-      res2_polynomial[i_mat,3] := pro2_polynomial.T;
-      res2_polynomial[i_mat,4] := pro2_polynomial.rho;
-      res2_polynomial[i_mat,5] := pro2_polynomial.h;
-      res2_polynomial[i_mat,6] := pro2_polynomial.cp;
-
-      res2_IF97[i_mat,1] := 1;
-      res2_IF97[i_mat,2] := p[i_p];
-      res2_IF97[i_mat,3] := pro2_IF97.T;
-      res2_IF97[i_mat,4] := pro2_IF97.rho;
-      res2_IF97[i_mat,5] := pro2_IF97.h;
-      res2_IF97[i_mat,6] := pro2_IF97.cp;
-  end for;
-
- //Write results
- DymolaCommands.MatrixIO.writeMatrix("res_polynomial_sat1.mat","res1_polynomial",res1_polynomial);
+  i_mat :=0;
+ for i_p in 1:n_p loop
+    p[i_p] := p_min + (i_p - 1) * delta_p;
+    (pro1_IF97, pro2_IF97) := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_sat_P(p[i_p]);
+    (pro1_polynomial, pro2_polynomial) := ThermoSysPro.Properties.WaterSteam.IF97.Water_sat_P(p[i_p]);
+    i_mat := i_mat + 1;
+    res1_polynomial[i_mat, 1] := 1;
+    res1_polynomial[i_mat, 2] := p[i_p];
+    res1_polynomial[i_mat, 3] := pro1_polynomial.T;
+    res1_polynomial[i_mat, 4] := pro1_polynomial.rho;
+    res1_polynomial[i_mat, 5] := pro1_polynomial.h;
+    res1_polynomial[i_mat, 6] := pro1_polynomial.cp;
+    res1_IF97[i_mat, 1] := 1;
+    res1_IF97[i_mat, 2] := p[i_p];
+    res1_IF97[i_mat, 3] := pro1_IF97.T;
+    res1_IF97[i_mat, 4] := pro1_IF97.rho;
+    res1_IF97[i_mat, 5] := pro1_IF97.h;
+    res1_IF97[i_mat, 6] := pro1_IF97.cp;
+    res2_polynomial[i_mat, 1] := 1;
+    res2_polynomial[i_mat, 2] := p[i_p];
+    res2_polynomial[i_mat, 3] := pro2_polynomial.T;
+    res2_polynomial[i_mat, 4] := pro2_polynomial.rho;
+    res2_polynomial[i_mat, 5] := pro2_polynomial.h;
+    res2_polynomial[i_mat, 6] := pro2_polynomial.cp;
+    res2_IF97[i_mat, 1] := 1;
+    res2_IF97[i_mat, 2] := p[i_p];
+    res2_IF97[i_mat, 3] := pro2_IF97.T;
+    res2_IF97[i_mat, 4] := pro2_IF97.rho;
+    res2_IF97[i_mat, 5] := pro2_IF97.h;
+    res2_IF97[i_mat, 6] := pro2_IF97.cp;
+  end for;
+//Properties
+//Store results
+//Liquid
+//Vapour
+//Write results
+  DymolaCommands.MatrixIO.writeMatrix("res_polynomial_sat1.mat", "res1_polynomial", res1_polynomial);
  DymolaCommands.MatrixIO.writeMatrix("res_IF97_sat1.mat","res1_IF97",res1_IF97);
  DymolaCommands.MatrixIO.writeMatrix("res_polynomial_sat2.mat","res2_polynomial",res2_polynomial);
  DymolaCommands.MatrixIO.writeMatrix("res_IF97_sat2.mat","res2_IF97",res2_IF97);
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu1Td_dT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu1Td_dT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu1Td_dT.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu1Td_dT.mo"	2022-03-10 09:58:25.196150106 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Viscosity;
 function dmu1Td_dT
   "Derivative of viscosity wrt. specific enthalpy at constant pressure in liquid region for given density and temperature"
-input Modelica.SIunits.Density d "Density";
- input Modelica.SIunits.Temperature T "Temperature";
+input Modelica.Units.SI.Density d "Density";
+ input Modelica.Units.SI.Temperature T "Temperature";
  output Real dmuTd
     "Derivative of viscosity wrt. temperature at constant density";
   mu1_dT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu1dT_dT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu1dT_dT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu1dT_dT.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu1dT_dT.mo"	2022-03-10 09:58:25.184150105 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Viscosity;
 function dmu1dT_dT
   "Derivative of viscosity wrt. pressure at constant specific enthalpy in liquid region for given density and temperature"
- input Modelica.SIunits.Density d "Density";
- input Modelica.SIunits.Temperature T "Temperature";
+ input Modelica.Units.SI.Density d "Density";
+ input Modelica.Units.SI.Temperature T "Temperature";
  output Real dmudT
     "Derivative of viscosity wrt. density at constant temperature";
   mu1_dT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu1hp_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu1hp_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu1hp_Ph.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu1hp_Ph.mo"	2022-03-10 09:58:25.164150102 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Viscosity;
 function dmu1hp_Ph
   "Derivative of viscosity wrt. specific enthalpy at constant pressure in liquid region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real dmuhp
     "Derivative of viscosity wrt. specific enthalpy at constant pressure";
   mu1_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu1ph_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu1ph_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu1ph_Ph.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu1ph_Ph.mo"	2022-03-10 09:58:25.152150101 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Viscosity;
 function dmu1ph_Ph
   "Derivative of viscosity wrt. pressure at constant specific enthalpy in liquid region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real dmuph
     "Derivative of viscosity wrt. pressure at constant specific enthalpy";
   mu1_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu2Td_dT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu2Td_dT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu2Td_dT.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu2Td_dT.mo"	2022-03-10 09:58:25.144150100 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Viscosity;
 function dmu2Td_dT
   "Derivative of viscosity wrt. specific enthalpy at constant pressure in vapor region for given density and temperature"
-input Modelica.SIunits.Density d "Density";
- input Modelica.SIunits.Temperature T "Temperature";
+input Modelica.Units.SI.Density d "Density";
+ input Modelica.Units.SI.Temperature T "Temperature";
  output Real dmuTd
     "Derivative of viscosity wrt. temperature at constant density";
   mu2_dT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu2dT_dT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu2dT_dT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu2dT_dT.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu2dT_dT.mo"	2022-03-10 09:58:25.136150098 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Viscosity;
 function dmu2dT_dT
   "Derivative of viscosity wrt. pressure at constant specific enthalpy in vapor region for given density and temperature"
- input Modelica.SIunits.Density d "Density";
- input Modelica.SIunits.Temperature T "Temperature";
+ input Modelica.Units.SI.Density d "Density";
+ input Modelica.Units.SI.Temperature T "Temperature";
  output Real dmudT
     "Derivative of viscosity wrt. density at constant temperature";
   mu2_dT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu2hp_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu2hp_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu2hp_Ph.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu2hp_Ph.mo"	2022-03-10 09:58:25.124150096 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Viscosity;
 function dmu2hp_Ph
   "Derivative of viscosity wrt. specific enthalpy at constant pressure in vapor region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real dmuhp
     "Derivative of viscosity wrt. specific enthalpy at constant pressure";
   mu2_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu2ph_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu2ph_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu2ph_Ph.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/dmu2ph_Ph.mo"	2022-03-10 09:58:25.116150095 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Viscosity;
 function dmu2ph_Ph
   "Derivative of viscosity wrt. pressure at constant specific enthalpy in vapor region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
  output Real dmuph
     "Derivative of viscosity wrt. pressure at constant specific enthalpy";
   mu2_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/mu1_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/mu1_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/mu1_Ph.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/mu1_Ph.mo"	2022-03-10 09:58:25.108150095 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Viscosity;
 function mu1_Ph
   "Viscosity in liquid region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
- output Modelica.SIunits.DynamicViscosity mu "Dynamic viscosity";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+ output Modelica.Units.SI.DynamicViscosity mu "Dynamic viscosity";
   mu1_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/mu1_dT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/mu1_dT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/mu1_dT.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/mu1_dT.mo"	2022-03-10 09:58:25.064150089 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Viscosity;
 function mu1_dT "Viscosity in liquid region for given density and temperature"
-input Modelica.SIunits.Density d "Density";
- input Modelica.SIunits.Temperature T "Temperature";
- output Modelica.SIunits.DynamicViscosity mu "Dynamic viscosity";
- protected mu1_dT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
+
+input Modelica.Units.SI.Density d "Density";
+ input Modelica.Units.SI.Temperature T "Temperature";
+ output Modelica.Units.SI.DynamicViscosity mu "Dynamic viscosity"; protected mu1_dT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
 
   mu := ThermoSysPro.Properties.WaterSteamSimple.Utilities.polynomial_x_order7(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/mu2_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/mu2_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/mu2_Ph.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/mu2_Ph.mo"	2022-03-10 09:58:25.048150086 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Viscosity;
 function mu2_Ph
   "Viscosity in vapor region for given pressure and specific enthalpy"
- input Modelica.SIunits.AbsolutePressure p "Pressure";
- input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
- output Modelica.SIunits.DynamicViscosity mu "Dynamic viscosity";
+ input Modelica.Units.SI.AbsolutePressure p "Pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
+ output Modelica.Units.SI.DynamicViscosity mu "Dynamic viscosity";
   mu2_Ph_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/mu2_dT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/mu2_dT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/mu2_dT.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/Viscosity/mu2_dT.mo"	2022-03-10 09:58:25.036150085 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Properties.WaterSteamSimple.Viscosity;
 function mu2_dT "Viscosity in vapor region for given density and temperature"
-input Modelica.SIunits.Density d "Density";
- input Modelica.SIunits.Temperature T "Temperature";
- output Modelica.SIunits.DynamicViscosity mu "Dynamic viscosity";
- protected mu2_dT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
+
+input Modelica.Units.SI.Density d "Density";
+ input Modelica.Units.SI.Temperature T "Temperature";
+ output Modelica.Units.SI.DynamicViscosity mu "Dynamic viscosity"; protected mu2_dT_coef coef annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
 algorithm
 
   mu := ThermoSysPro.Properties.WaterSteamSimple.Utilities.polynomial_xy_order3(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/critical.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/critical.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/critical.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/critical.mo"	2022-03-10 09:58:24.996150080 +0000
@@ -1,13 +1,13 @@
 within ThermoSysPro.Properties.WaterSteamSimple;
 record critical "critical point data"
   extends Modelica.Icons.Record;
-  constant Modelica.SIunits.Pressure PCRIT=22064000.0 "the critical pressure";
-  constant Modelica.SIunits.Temperature TCRIT=647.096
+  constant Modelica.Units.SI.Pressure PCRIT=22064000.0 "the critical pressure";
+  constant Modelica.Units.SI.Temperature TCRIT=647.096
     "the critical temperature";
-  constant Modelica.SIunits.Density DCRIT=322.0 "the critical density";
-  constant Modelica.SIunits.SpecificEnthalpy HCRIT=2087546.84511715
+  constant Modelica.Units.SI.Density DCRIT=322.0 "the critical density";
+  constant Modelica.Units.SI.SpecificEnthalpy HCRIT=2087546.84511715
     "the calculated specific enthalpy at the critical point";
-  constant Modelica.SIunits.SpecificEntropy SCRIT=4412.02148223476
+  constant Modelica.Units.SI.SpecificEntropy SCRIT=4412.02148223476
     "the calculated specific entropy at the critical point";
   annotation (Documentation(info="<HTML>
  <h4>Record description</h4>
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/phase_ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/phase_ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/phase_ph.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/phase_ph.mo"	2022-03-10 09:58:24.988150080 +0000
@@ -1,12 +1,12 @@
 within ThermoSysPro.Properties.WaterSteamSimple;
 function phase_ph "return the current phase"
- input Modelica.SIunits.Pressure p "pressure";
- input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
+ input Modelica.Units.SI.Pressure p "pressure";
+ input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
  output Integer phase=0 "phase: 2 for two-phase, 1 for one phase";
 
 protected
-  Modelica.SIunits.SpecificEnthalpy h1sat "bubble enthalpy";
-  Modelica.SIunits.SpecificEnthalpy h2sat "dew enthalpy";
+  Modelica.Units.SI.SpecificEnthalpy h1sat "bubble enthalpy";
+  Modelica.Units.SI.SpecificEnthalpy h2sat "dew enthalpy";
   Boolean supercritical;
 
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/phase_ps.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/phase_ps.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/phase_ps.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/phase_ps.mo"	2022-03-10 09:58:24.976150078 +0000
@@ -1,12 +1,12 @@
 within ThermoSysPro.Properties.WaterSteamSimple;
 function phase_ps "return the current phase"
- input Modelica.SIunits.Pressure p "pressure";
- input Modelica.SIunits.SpecificEntropy s "specific entropy";
+ input Modelica.Units.SI.Pressure p "pressure";
+ input Modelica.Units.SI.SpecificEntropy s "specific entropy";
  output Integer phase=0 "phase: 2 for two-phase, 1 for one phase";
 
 protected
-  Modelica.SIunits.SpecificEntropy s1sat "bubble entropy";
-  Modelica.SIunits.SpecificEntropy s2sat "dew entropy";
+  Modelica.Units.SI.SpecificEntropy s1sat "bubble entropy";
+  Modelica.Units.SI.SpecificEntropy s2sat "dew entropy";
   Boolean supercritical;
 
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop1_PT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop1_PT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop1_PT.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop1_PT.mo"	2022-03-10 09:58:24.968150078 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple;
 function prop1_PT
   "thermodynamics properties in region 1, independent variables p and T "
-  input Modelica.SIunits.AbsolutePressure p "Pressure";
-  input Modelica.SIunits.Temperature T "temperature";
+  input Modelica.Units.SI.AbsolutePressure p "Pressure";
+  input Modelica.Units.SI.Temperature T "temperature";
 
   output ThermoSysPro.Properties.WaterSteamSimple.ThermoProperties_pT pro;
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop1_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop1_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop1_Ph.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop1_Ph.mo"	2022-03-10 09:58:24.960150075 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple;
 function prop1_Ph
   "thermodynamics properties in region 1, independent variables p and h "
-  input Modelica.SIunits.AbsolutePressure p "Pressure";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+  input Modelica.Units.SI.AbsolutePressure p "Pressure";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
 
  output ThermoSysPro.Properties.WaterSteamSimple.ThermoProperties_ph pro;
 algorithm
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop1_Ph_der.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop1_Ph_der.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop1_Ph_der.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop1_Ph_der.mo"	2022-03-10 09:58:24.952150074 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Properties.WaterSteamSimple;
 function prop1_Ph_der
-  input Modelica.SIunits.AbsolutePressure p "Pressure";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+  input Modelica.Units.SI.AbsolutePressure p "Pressure";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
 
   input Real p_der "derivative of Pressure";
   input Real h_der "derivative of Specific enthalpy";
@@ -28,8 +28,8 @@
   Real d2uhh "Second derivative of specific inner energy wrt. enthalpy";
   Real d2upp "Second derivative of specific inner energy wrt. pressure";
 
-algorithm
-  //First derivatives
+algorithm
+//First derivatives
   dTp := ThermoSysPro.Properties.WaterSteamSimple.Temperature.dT1ph_Ph(p, h);
   dTh := ThermoSysPro.Properties.WaterSteamSimple.Temperature.dT1ph_Ph(p, h);
   ddp := ThermoSysPro.Properties.WaterSteamSimple.Density.dd1ph_Ph(p, h);
@@ -46,9 +46,8 @@
   der_pro.u := dup*p_der + duh*h_der;
   der_pro.s := dsp*p_der + dsh*h_der;
   der_pro.cp := dcp*p_der + dch*h_der;
-  der_pro.x :=0;
-
-  //Second derivatives
+  der_pro.x :=0;
+//Second derivatives
   d2dhp := ThermoSysPro.Properties.WaterSteamSimple.Density.d2d1hp_Ph(p, h);
   d2dhh := ThermoSysPro.Properties.WaterSteamSimple.Density.d2d1hh_Ph(p, h);
   d2dpp := ThermoSysPro.Properties.WaterSteamSimple.Density.d2d1pp_Ph(p, h);
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop1_Ps.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop1_Ps.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop1_Ps.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop1_Ps.mo"	2022-03-10 09:58:24.940150073 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple;
 function prop1_Ps
   "thermodynamics properties in region 1, independent variables p and s "
-  input Modelica.SIunits.AbsolutePressure p "Pressure";
-  input Modelica.SIunits.SpecificEntropy s "Specific entropy";
+  input Modelica.Units.SI.AbsolutePressure p "Pressure";
+  input Modelica.Units.SI.SpecificEntropy s "Specific entropy";
 
   output ThermoSysPro.Properties.WaterSteamSimple.ThermoProperties_ps pro;
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop2_PT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop2_PT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop2_PT.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop2_PT.mo"	2022-03-10 09:58:24.932150072 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple;
 function prop2_PT
   "thermodynamics properties in region 2, independent variables p and T "
-  input Modelica.SIunits.AbsolutePressure p "Pressure";
-  input Modelica.SIunits.Temperature T "temperature";
+  input Modelica.Units.SI.AbsolutePressure p "Pressure";
+  input Modelica.Units.SI.Temperature T "temperature";
 
   output ThermoSysPro.Properties.WaterSteamSimple.ThermoProperties_pT pro;
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop2_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop2_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop2_Ph.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop2_Ph.mo"	2022-03-10 09:58:24.920150070 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple;
 function prop2_Ph
   "thermodynamics properties in region 2, independent variables p and h "
-  input Modelica.SIunits.AbsolutePressure p "Pressure";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+  input Modelica.Units.SI.AbsolutePressure p "Pressure";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
 
   output ThermoSysPro.Properties.WaterSteamSimple.ThermoProperties_ph pro;
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop2_Ph_der.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop2_Ph_der.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop2_Ph_der.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop2_Ph_der.mo"	2022-03-10 09:58:24.912150070 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Properties.WaterSteamSimple;
 function prop2_Ph_der
-  input Modelica.SIunits.AbsolutePressure p "Pressure";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+  input Modelica.Units.SI.AbsolutePressure p "Pressure";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
 
   input Real p_der "derivative of Pressure";
   input Real h_der "derivative of Specific enthalpy";
@@ -28,8 +28,8 @@
   Real d2uhh "Second derivative of specific inner energy wrt. enthalpy";
   Real d2upp "Second derivative of specific inner energy wrt. pressure";
 
-algorithm
-  //First derivatives
+algorithm
+//First derivatives
   dTp := ThermoSysPro.Properties.WaterSteamSimple.Temperature.dT2ph_Ph(p, h);
   dTh := ThermoSysPro.Properties.WaterSteamSimple.Temperature.dT2ph_Ph(p, h);
   ddp := ThermoSysPro.Properties.WaterSteamSimple.Density.dd2ph_Ph(p, h);
@@ -46,9 +46,8 @@
   der_pro.u := dup*p_der + duh*h_der;
   der_pro.s := dsp*p_der + dsh*h_der;
   der_pro.cp := dcp*p_der + dch*h_der;
-  der_pro.x :=0;
-
-  //Second derivatives
+  der_pro.x :=0;
+//Second derivatives
   d2dhp := ThermoSysPro.Properties.WaterSteamSimple.Density.d2d2hp_Ph(p, h);
   d2dhh := ThermoSysPro.Properties.WaterSteamSimple.Density.d2d2hh_Ph(p, h);
   d2dpp := ThermoSysPro.Properties.WaterSteamSimple.Density.d2d2pp_Ph(p, h);
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop2_Ps.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop2_Ps.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop2_Ps.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop2_Ps.mo"	2022-03-10 09:58:24.896150067 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Properties.WaterSteamSimple;
 function prop2_Ps
   "thermodynamics properties in region 2, independent variables p and h "
-  input Modelica.SIunits.AbsolutePressure p "Pressure";
-  input Modelica.SIunits.SpecificEntropy s "Specific entropy";
+  input Modelica.Units.SI.AbsolutePressure p "Pressure";
+  input Modelica.Units.SI.SpecificEntropy s "Specific entropy";
 
   output ThermoSysPro.Properties.WaterSteamSimple.ThermoProperties_ps pro;
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop4_Ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop4_Ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop4_Ph.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop4_Ph.mo"	2022-03-10 09:58:24.856150062 +0000
@@ -1,34 +1,34 @@
 within ThermoSysPro.Properties.WaterSteamSimple;
 function prop4_Ph
   "thermodynamics properties in region 4, independent variables p and h "
-  input Modelica.SIunits.AbsolutePressure p "Pressure";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+  input Modelica.Units.SI.AbsolutePressure p "Pressure";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
 
   output ThermoSysPro.Properties.WaterSteamSimple.ThermoProperties_ph pro;
 
 protected
-  Modelica.SIunits.SpecificEnthalpy h1sat
+  Modelica.Units.SI.SpecificEnthalpy h1sat
     "Specific enthalpy at liquid saturation";
-  Modelica.SIunits.SpecificEnthalpy h2sat
+  Modelica.Units.SI.SpecificEnthalpy h2sat
     "Specific enthalpy at vapor saturation";
-  Modelica.SIunits.Temperature T1sat "Temperature at liquid saturation";
-  Modelica.SIunits.Temperature T2sat "Temperature at vapor saturation";
-  Modelica.SIunits.Density d1sat "Density at liquid saturation";
-  Modelica.SIunits.Density d2sat "Density at vapor saturation";
-  Modelica.SIunits.SpecificEnergy u1sat
+  Modelica.Units.SI.Temperature T1sat "Temperature at liquid saturation";
+  Modelica.Units.SI.Temperature T2sat "Temperature at vapor saturation";
+  Modelica.Units.SI.Density d1sat "Density at liquid saturation";
+  Modelica.Units.SI.Density d2sat "Density at vapor saturation";
+  Modelica.Units.SI.SpecificEnergy u1sat
     "Specific inner energy at liquid saturation";
-  Modelica.SIunits.SpecificEnergy u2sat
+  Modelica.Units.SI.SpecificEnergy u2sat
     "Specific inner energy at vapor saturation";
-  Modelica.SIunits.SpecificEntropy s1sat
+  Modelica.Units.SI.SpecificEntropy s1sat
     "Specific entropy at liquid saturation";
-  Modelica.SIunits.SpecificEntropy s2sat "Specific entropy at vapor saturation";
-  Modelica.SIunits.SpecificHeatCapacity cp1sat
+  Modelica.Units.SI.SpecificEntropy s2sat "Specific entropy at vapor saturation";
+  Modelica.Units.SI.SpecificHeatCapacity cp1sat
     "Specific heat capacity at liquid saturation";
-  Modelica.SIunits.SpecificHeatCapacity cp2sat
+  Modelica.Units.SI.SpecificHeatCapacity cp2sat
     "Specific heat capacity at vapor saturation";
-  Modelica.SIunits.DerDensityByPressure dd1satp
+  Modelica.Units.SI.DerDensityByPressure dd1satp
     "Derivate of density at liquid saturation wrt. pressure";
-  Modelica.SIunits.DerDensityByPressure dd2satp
+  Modelica.Units.SI.DerDensityByPressure dd2satp
     "Derivative of density at vapor saturation wrt. pressure";
   Real du1satp(unit="m3/kg")
     "Derivative of specific inner energy at liquid saturation wrt. pressure";
@@ -70,8 +70,7 @@
   pro.s := (1-x)*s1sat + x*s2sat;
 
   pro.cp := (1-x)*cp1sat + x*cp2sat;
-
-  // Derivatives
+// Derivatives
   dxh :=1/(h2sat - h1sat);
   dxp := -(dh1satp + x*(dh2satp - dh1satp))/(h2sat - h1sat);
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop4_Ph_der.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop4_Ph_der.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop4_Ph_der.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop4_Ph_der.mo"	2022-03-10 09:58:24.828150060 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.Properties.WaterSteamSimple;
 function prop4_Ph_der
-  input Modelica.SIunits.AbsolutePressure p "Pressure";
-  input Modelica.SIunits.SpecificEnthalpy h "Specific enthalpy";
+  input Modelica.Units.SI.AbsolutePressure p "Pressure";
+  input Modelica.Units.SI.SpecificEnthalpy h "Specific enthalpy";
 
   input Real p_der "derivative of Pressure";
   input Real h_der "derivative of Specific enthalpy";
@@ -10,30 +10,30 @@
     "Derivative";
 
 protected
-  Modelica.SIunits.SpecificEnthalpy h1sat
+  Modelica.Units.SI.SpecificEnthalpy h1sat
     "Specific enthalpy at liquid saturation";
-  Modelica.SIunits.SpecificEnthalpy h2sat
+  Modelica.Units.SI.SpecificEnthalpy h2sat
     "Specific enthalpy at vapor saturation";
   ThermoSysPro.Units.MassFraction x "Vapor mass fraction";
   Real dxh "Derivative of quality wrt. enthalpy";
   Real dxp "Derivative of quality wrt. pressure";
   Real x_der "Derivative of quality wrt. time";
-  Modelica.SIunits.Density d1sat "Density at liquid saturation";
-  Modelica.SIunits.Density d2sat "Density at vapor saturation";
-  Modelica.SIunits.SpecificEnergy u1sat
+  Modelica.Units.SI.Density d1sat "Density at liquid saturation";
+  Modelica.Units.SI.Density d2sat "Density at vapor saturation";
+  Modelica.Units.SI.SpecificEnergy u1sat
     "Specific inner energy at liquid saturation";
-  Modelica.SIunits.SpecificEnergy u2sat
+  Modelica.Units.SI.SpecificEnergy u2sat
     "Specific inner energy at vapor saturation";
-  Modelica.SIunits.SpecificEntropy s1sat
+  Modelica.Units.SI.SpecificEntropy s1sat
     "Specific entropy at liquid saturation";
-  Modelica.SIunits.SpecificEntropy s2sat "Specific entropy at vapor saturation";
-  Modelica.SIunits.SpecificHeatCapacity cp1sat
+  Modelica.Units.SI.SpecificEntropy s2sat "Specific entropy at vapor saturation";
+  Modelica.Units.SI.SpecificHeatCapacity cp1sat
     "Specific heat capacity at liquid saturation";
-  Modelica.SIunits.SpecificHeatCapacity cp2sat
+  Modelica.Units.SI.SpecificHeatCapacity cp2sat
     "Specific heat capacity at vapor saturation";
-  Modelica.SIunits.DerDensityByPressure dd1satp
+  Modelica.Units.SI.DerDensityByPressure dd1satp
     "Derivative of density at liquid saturation wrt. pressure";
-  Modelica.SIunits.DerDensityByPressure dd2satp
+  Modelica.Units.SI.DerDensityByPressure dd2satp
     "Derivative of density at vapor saturation wrt. pressure";
   Real du1satp
     "Derivative of specific inner energy at liquid saturation wrt. pressure";
@@ -68,7 +68,7 @@
   Real cp2sat_der
     "Derivative of specific heat capacity at vapor saturation wrt. time";
 
-  Modelica.SIunits.Density d "Density";
+  Modelica.Units.SI.Density d "Density";
   Real d_der "Derivative of density wrt. time";
   Real d2xhp "Second derivative of quality wrt. enthalpy and pressure";
   Real d2xhh "Second derivative of quality wrt. enthalpy";
@@ -124,38 +124,31 @@
   dcp1satp := ThermoSysPro.Properties.WaterSteamSimple.HeatCapacity.dcp1ph_Ph(p,
     h1sat);
   dcp2satp := ThermoSysPro.Properties.WaterSteamSimple.HeatCapacity.dcp2ph_Ph(p,
-    h2sat);
-
-  // Quality derivative
-  x_der := dxp*p_der + dxh*h_der;
-  der_pro.x := x_der;
-
-  // Specific inner energy derivative
-  u1sat_der :=du1satp*p_der;
+    h2sat);
+// Quality derivative
+  x_der := dxp * p_der + dxh * h_der;
+  der_pro.x := x_der;
+// Specific inner energy derivative
+  u1sat_der := du1satp * p_der;
   u2sat_der :=du2satp*p_der;
-  der_pro.u := -x_der*u1sat + (1-x)*u1sat_der + x_der*u2sat + x*u2sat_der;
-
-  // Specific entropy derivative
-  s1sat_der :=ds1satp*p_der;
+  der_pro.u := -x_der*u1sat + (1-x)*u1sat_der + x_der*u2sat + x*u2sat_der;
+// Specific entropy derivative
+  s1sat_der := ds1satp * p_der;
   s2sat_der :=ds2satp*p_der;
-  der_pro.s := -x_der*s1sat + (1-x)*s1sat_der + x_der*s2sat + x*s2sat_der;
-
-  // Specific heat capacity derivative
-  cp1sat_der :=dcp1satp*p_der;
+  der_pro.s := -x_der*s1sat + (1-x)*s1sat_der + x_der*s2sat + x*s2sat_der;
+// Specific heat capacity derivative
+  cp1sat_der := dcp1satp * p_der;
   cp2sat_der :=dcp2satp*p_der;
-  der_pro.cp := -x_der*cp1sat + (1-x)*cp1sat_der + x_der*cp2sat + x*cp2sat_der;
-
-  // Density derivative
-  d1sat_der :=dd1satp*p_der;
+  der_pro.cp := -x_der*cp1sat + (1-x)*cp1sat_der + x_der*cp2sat + x*cp2sat_der;
+// Density derivative
+  d1sat_der := dd1satp * p_der;
   d2sat_der :=dd2satp*p_der;
   d_der := -x_der/d1sat + (1 - x)*(-1/d1sat^2)*d1sat_der + x_der/d2sat + x*(-1/d2sat^2)*d2sat_der;
-  der_pro.d := d_der;
-
-  // Temperature derivative
-  der_pro.T := 0;
-
-  //Second derivative
-  dxh_der := d2xhh*h_der;
+  der_pro.d := d_der;
+// Temperature derivative
+  der_pro.T := 0;
+//Second derivative
+  dxh_der := d2xhh * h_der;
   dxp_der := d2xpp*p_der;
   dd1satp_der := d2d1satpp*p_der;
   dd2satp_der := d2d2satpp*p_der;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop4_Ps.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop4_Ps.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop4_Ps.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/prop4_Ps.mo"	2022-03-10 09:58:24.796150054 +0000
@@ -1,34 +1,34 @@
 within ThermoSysPro.Properties.WaterSteamSimple;
 function prop4_Ps
   "thermodynamics properties in region 4, independent variables p and h "
-  input Modelica.SIunits.AbsolutePressure p "Pressure";
-  input Modelica.SIunits.SpecificEntropy s "Specific entropy";
+  input Modelica.Units.SI.AbsolutePressure p "Pressure";
+  input Modelica.Units.SI.SpecificEntropy s "Specific entropy";
 
   output ThermoSysPro.Properties.WaterSteamSimple.ThermoProperties_ps pro;
 
 protected
-  Modelica.SIunits.SpecificEnthalpy h1sat
+  Modelica.Units.SI.SpecificEnthalpy h1sat
     "Specific enthalpy at liquid saturation";
-  Modelica.SIunits.SpecificEnthalpy h2sat
+  Modelica.Units.SI.SpecificEnthalpy h2sat
     "Specific enthalpy at vapor saturation";
-  Modelica.SIunits.Temperature T1sat "Temperature at liquid saturation";
-  Modelica.SIunits.Temperature T2sat "Temperature at vapor saturation";
-  Modelica.SIunits.Density d1sat "Density at liquid saturation";
-  Modelica.SIunits.Density d2sat "Density at vapor saturation";
-  Modelica.SIunits.SpecificEnergy u1sat
+  Modelica.Units.SI.Temperature T1sat "Temperature at liquid saturation";
+  Modelica.Units.SI.Temperature T2sat "Temperature at vapor saturation";
+  Modelica.Units.SI.Density d1sat "Density at liquid saturation";
+  Modelica.Units.SI.Density d2sat "Density at vapor saturation";
+  Modelica.Units.SI.SpecificEnergy u1sat
     "Specific inner energy at liquid saturation";
-  Modelica.SIunits.SpecificEnergy u2sat
+  Modelica.Units.SI.SpecificEnergy u2sat
     "Specific inner energy at vapor saturation";
-  Modelica.SIunits.SpecificEntropy s1sat
+  Modelica.Units.SI.SpecificEntropy s1sat
     "Specific entropy at liquid saturation";
-  Modelica.SIunits.SpecificEntropy s2sat "Specific entropy at vapor saturation";
-  Modelica.SIunits.SpecificHeatCapacity cp1sat
+  Modelica.Units.SI.SpecificEntropy s2sat "Specific entropy at vapor saturation";
+  Modelica.Units.SI.SpecificHeatCapacity cp1sat
     "Specific heat capacity at liquid saturation";
-  Modelica.SIunits.SpecificHeatCapacity cp2sat
+  Modelica.Units.SI.SpecificHeatCapacity cp2sat
     "Specific heat capacity at vapor saturation";
-  Modelica.SIunits.DerDensityByPressure dd1satp
+  Modelica.Units.SI.DerDensityByPressure dd1satp
     "Derivate of density at liquid saturation wrt. pressure";
-  Modelica.SIunits.DerDensityByPressure dd2satp
+  Modelica.Units.SI.DerDensityByPressure dd2satp
     "Derivative of density at vapor saturation wrt. pressure";
   Real du1satp(unit="m3/kg")
     "Derivative of specific inner energy at liquid saturation wrt. pressure";
@@ -72,8 +72,7 @@
   pro.u := (1-x)*u1sat + x*u2sat;
 
   pro.cp := (1-x)*cp1sat + x*cp2sat;
-
-  // Derivatives
+// Derivatives
   dxs := 1/(s2sat - s1sat);
   dxp := -(dh1satp + x*(dh2satp - dh1satp))/(h2sat - h1sat);
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/propsat1_P.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/propsat1_P.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/propsat1_P.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/propsat1_P.mo"	2022-03-10 09:58:24.776150052 +0000
@@ -1,10 +1,10 @@
 within ThermoSysPro.Properties.WaterSteamSimple;
 function propsat1_P
-  input Modelica.SIunits.AbsolutePressure p "Pressure";
+  input Modelica.Units.SI.AbsolutePressure p "Pressure";
   output ThermoSysPro.Properties.WaterSteamSimple.PropThermoSat pro;
 
 protected
-  Modelica.SIunits.SpecificEnthalpy hl "bubble enthalpy";
+  Modelica.Units.SI.SpecificEnthalpy hl "bubble enthalpy";
 
 algorithm
   hl := Enthalpy.h1sat_P(p);
@@ -14,6 +14,6 @@
   pro.rho := ThermoSysPro.Properties.WaterSteamSimple.Density.d1_Ph(p, hl);
   pro.h := hl;
   pro.cp := ThermoSysPro.Properties.WaterSteamSimple.HeatCapacity.cp1_Ph(p, hl);
-  pro.pt := 1; //NA
+  pro.pt := 1; //NA
   pro.cv := ThermoSysPro.Properties.WaterSteamSimple.HeatCapacity.cv1_Ph(p, hl);
 end propsat1_P;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/propsat1_P_der.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/propsat1_P_der.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/propsat1_P_der.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/propsat1_P_der.mo"	2022-03-10 09:58:24.764150050 +0000
@@ -1,11 +1,11 @@
 within ThermoSysPro.Properties.WaterSteamSimple;
 function propsat1_P_der
-  input Modelica.SIunits.AbsolutePressure p "Pressure";
+  input Modelica.Units.SI.AbsolutePressure p "Pressure";
   input Real p_der "derivative of Pressure";
   output ThermoSysPro.Properties.WaterSteamSimple.PropThermoSat der_pro;
 
 protected
-  Modelica.SIunits.SpecificEnthalpy hl "bubble enthalpy";
+  Modelica.Units.SI.SpecificEnthalpy hl "bubble enthalpy";
 
 algorithm
   hl := Enthalpy.h1sat_P(p);
@@ -19,7 +19,7 @@
     ThermoSysPro.Properties.WaterSteamSimple.Enthalpy.dh1satp_P(p);
   der_pro.cp := p_der*
     ThermoSysPro.Properties.WaterSteamSimple.HeatCapacity.dcp1ph_Ph(p, hl);
-  der_pro.pt := 1; //NA
+  der_pro.pt := 1; //NA
   der_pro.cv := p_der*
     ThermoSysPro.Properties.WaterSteamSimple.HeatCapacity.dcv1ph_Ph(p, hl);
 end propsat1_P_der;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/propsat2_P.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/propsat2_P.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/propsat2_P.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/propsat2_P.mo"	2022-03-10 09:58:24.760150051 +0000
@@ -1,10 +1,10 @@
 within ThermoSysPro.Properties.WaterSteamSimple;
 function propsat2_P
-  input Modelica.SIunits.AbsolutePressure p "Pressure";
+  input Modelica.Units.SI.AbsolutePressure p "Pressure";
   output ThermoSysPro.Properties.WaterSteamSimple.PropThermoSat pro;
 
 protected
-  Modelica.SIunits.SpecificEnthalpy hv "dew enthalpy";
+  Modelica.Units.SI.SpecificEnthalpy hv "dew enthalpy";
 
 algorithm
   hv := Enthalpy.h2sat_P(p);
@@ -14,6 +14,6 @@
   pro.rho := ThermoSysPro.Properties.WaterSteamSimple.Density.d2_Ph(p, hv);
   pro.h := hv;
   pro.cp := ThermoSysPro.Properties.WaterSteamSimple.HeatCapacity.cp2_Ph(p, hv);
-  pro.pt := 1; //NA
+  pro.pt := 1; //NA
   pro.cv := ThermoSysPro.Properties.WaterSteamSimple.HeatCapacity.cv2_Ph(p, hv);
 end propsat2_P;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/propsat2_P_der.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/propsat2_P_der.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/propsat2_P_der.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/propsat2_P_der.mo"	2022-03-10 09:58:24.752150049 +0000
@@ -1,11 +1,11 @@
 within ThermoSysPro.Properties.WaterSteamSimple;
 function propsat2_P_der
-  input Modelica.SIunits.AbsolutePressure p "Pressure";
+  input Modelica.Units.SI.AbsolutePressure p "Pressure";
   input Real p_der "derivative of Pressure";
   output ThermoSysPro.Properties.WaterSteamSimple.PropThermoSat der_pro;
 
 protected
-  Modelica.SIunits.SpecificEnthalpy hv "dew enthalpy";
+  Modelica.Units.SI.SpecificEnthalpy hv "dew enthalpy";
 
 algorithm
   hv := Enthalpy.h2sat_P(p);
@@ -19,7 +19,7 @@
     ThermoSysPro.Properties.WaterSteamSimple.Enthalpy.dh2satp_P(p);
   der_pro.cp := p_der*
     ThermoSysPro.Properties.WaterSteamSimple.HeatCapacity.dcp2ph_Ph(p, hv);
-  der_pro.pt := 1; //NA
+  der_pro.pt := 1; //NA
   der_pro.cv := p_der*
     ThermoSysPro.Properties.WaterSteamSimple.HeatCapacity.dcv2ph_Ph(p, hv);
 end propsat2_P_der;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/region_pT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/region_pT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/region_pT.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/region_pT.mo"	2022-03-10 09:58:24.744150048 +0000
@@ -1,14 +1,14 @@
 within ThermoSysPro.Properties.WaterSteamSimple;
 function region_pT
   "return the current region (valid values: 1,2) for given pressure and temperature"
- input Modelica.SIunits.Pressure p "pressure";
- input Modelica.SIunits.Temperature T "temperature";
+ input Modelica.Units.SI.Pressure p "pressure";
+ input Modelica.Units.SI.Temperature T "temperature";
  input Integer mode=0 "mode: 0 means check, otherwise assume region=mode";
  output Integer region "region (valid values: 1,2)";
 
 protected
-  Modelica.SIunits.Temperature Tsat "bubble entropy";
-  Modelica.SIunits.SpecificEnthalpy sv "dew entropy";
+  Modelica.Units.SI.Temperature Tsat "bubble entropy";
+  Modelica.Units.SI.SpecificEnthalpy sv "dew entropy";
 algorithm
   Tsat := ThermoSysPro.Properties.WaterSteamSimple.Temperature.Tsat_P(p);
   if (mode <> 0) then
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/region_ph.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/region_ph.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/region_ph.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/region_ph.mo"	2022-03-10 09:58:24.724150046 +0000
@@ -1,46 +1,44 @@
-within ThermoSysPro.Properties.WaterSteamSimple;
-function region_ph
-  "return the current region (valid values: 1,2,4) for given pressure and specific enthalpy"
- input Modelica.SIunits.Pressure p "pressure";
- input Modelica.SIunits.SpecificEnthalpy h "specific enthalpy";
-// input Integer phase=0 "phase: 2 for two-phase, 1 for one phase";
- input Integer mode=0 "mode: 0 means check, otherwise assume region=mode";
- output Integer region "region (valid values: 1,2,4)";
-  // If mode is different from 0, no checking for the region is done and
-  // the mode is assumed to be the correct region. This can be used to
-  // implement e.g. water-only steamtables when mode == 1
-protected
-  Modelica.SIunits.SpecificEnthalpy hl "bubble enthalpy";
-  Modelica.SIunits.SpecificEnthalpy hv "dew enthalpy";
-  Integer phase;
-  Boolean supercritical;
-
-algorithm
-  if (mode <> 0) then
-    region := mode;
-  else
-    // check for regions 1, 2 and 4
-    supercritical := (p > ThermoSysPro.Properties.WaterSteamSimple.critical.PCRIT);
-    if supercritical then
-      if h < ThermoSysPro.Properties.WaterSteamSimple.critical.HCRIT then
-       region:= 1;
-      else
-       region:= 2;
-      end if;
-    else
-      hl := Enthalpy.h1sat_P(p);
-      hv := Enthalpy.h2sat_P(p);
-      phase := if ((h < hl) or (h > hv)) then 1 else 2;
-      if (phase == 2) then
-        region := 4;
-      else
-        if (h < hl) then
-          region:= 1;
-        elseif (h>hv) then
-          region := 2;
-        end if;
-      end if;
-    end if;
-  end if;
-
-end region_ph;
+within ThermoSysPro.Properties.WaterSteamSimple;
+
+function region_ph "return the current region (valid values: 1,2,4) for given pressure and specific enthalpy"
+  input Modelica.Units.SI.Pressure p "pressure";
+  input Modelica.Units.SI.SpecificEnthalpy h "specific enthalpy";
+  // input Integer phase=0 "phase: 2 for two-phase, 1 for one phase";
+  input Integer mode = 0 "mode: 0 means check, otherwise assume region=mode";
+  output Integer region "region (valid values: 1,2,4)";
+  // If mode is different from 0, no checking for the region is done and
+  // the mode is assumed to be the correct region. This can be used to
+  // implement e.g. water-only steamtables when mode == 1
+protected
+  Modelica.Units.SI.SpecificEnthalpy hl "bubble enthalpy";
+  Modelica.Units.SI.SpecificEnthalpy hv "dew enthalpy";
+  Integer phase;
+  Boolean supercritical;
+algorithm
+  if mode <> 0 then
+    region := mode;
+  else
+    supercritical := p > ThermoSysPro.Properties.WaterSteamSimple.critical.PCRIT;
+    if supercritical then
+      if h < ThermoSysPro.Properties.WaterSteamSimple.critical.HCRIT then
+        region := 1;
+      else
+        region := 2;
+      end if;
+    else
+      hl := Enthalpy.h1sat_P(p);
+      hv := Enthalpy.h2sat_P(p);
+      phase := if h < hl or h > hv then 1 else 2;
+      if phase == 2 then
+        region := 4;
+      else
+        if h < hl then
+          region := 1;
+        elseif h > hv then
+          region := 2;
+        end if;
+      end if;
+    end if;
+  end if;
+// check for regions 1, 2 and 4
+end region_ph;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple: region_ph.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple: region_ph.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/region_ps.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/region_ps.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/region_ps.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/region_ps.mo"	2022-03-10 09:58:24.708150045 +0000
@@ -1,47 +1,43 @@
-within ThermoSysPro.Properties.WaterSteamSimple;
-function region_ps
-  "return the current region (valid values: 1,2,4) for given pressure and specific entropy"
- input Modelica.SIunits.Pressure p "pressure";
- input Modelica.SIunits.SpecificEntropy s "specific entropy";
- input Integer mode=0 "mode: 0 means check, otherwise assume region=mode";
- output Integer region "region (valid values: 1,2,4)";
-  // If mode is different from 0, no checking for the region is done and
-  // the mode is assumed to be the correct region. This can be used to
-  // implement e.g. water-only steamtables when mode == 1
-
-protected
- Modelica.SIunits.SpecificEntropy sl "bubble entropy";
- Modelica.SIunits.SpecificEntropy sv "dew entropy";
-
- Integer phase;
- Boolean supercritical;
-
-algorithm
-   if (mode <> 0) then
-     region := mode;
-   else
-     // check for regions 1, 2 and 4
-     supercritical := (p > ThermoSysPro.Properties.WaterSteamSimple.critical.PCRIT);
-     if supercritical then
-       if s < ThermoSysPro.Properties.WaterSteamSimple.critical.SCRIT then
-        region:= 1;
-       else
-        region:= 2;
-       end if;
-     else
-       sl := Entropy.s1sat_P(p);
-       sv := Entropy.s2sat_P(p);
-       phase := if ((s < sl) or (s > sv)) then 1 else 2;
-       if (phase == 2) then
-         region := 4;
-       else
-         if (s < sl) then
-           region:= 1;
-         elseif (s > sv) then
-           region := 2;
-         end if;
-       end if;
-     end if;
-   end if;
-
-end region_ps;
+within ThermoSysPro.Properties.WaterSteamSimple;
+
+function region_ps "return the current region (valid values: 1,2,4) for given pressure and specific entropy"
+  input Modelica.Units.SI.Pressure p "pressure";
+  input Modelica.Units.SI.SpecificEntropy s "specific entropy";
+  input Integer mode = 0 "mode: 0 means check, otherwise assume region=mode";
+  output Integer region "region (valid values: 1,2,4)";
+  // If mode is different from 0, no checking for the region is done and
+  // the mode is assumed to be the correct region. This can be used to
+  // implement e.g. water-only steamtables when mode == 1
+protected
+  Modelica.Units.SI.SpecificEntropy sl "bubble entropy";
+  Modelica.Units.SI.SpecificEntropy sv "dew entropy";
+  Integer phase;
+  Boolean supercritical;
+algorithm
+  if mode <> 0 then
+    region := mode;
+  else
+    supercritical := p > ThermoSysPro.Properties.WaterSteamSimple.critical.PCRIT;
+    if supercritical then
+      if s < ThermoSysPro.Properties.WaterSteamSimple.critical.SCRIT then
+        region := 1;
+      else
+        region := 2;
+      end if;
+    else
+      sl := Entropy.s1sat_P(p);
+      sv := Entropy.s2sat_P(p);
+      phase := if s < sl or s > sv then 1 else 2;
+      if phase == 2 then
+        region := 4;
+      else
+        if s < sl then
+          region := 1;
+        elseif s > sv then
+          region := 2;
+        end if;
+      end if;
+    end if;
+  end if;
+// check for regions 1, 2 and 4
+end region_ps;
\ No newline at end of file
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple: region_ps.mo.after
Only in converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple: region_ps.mo.before
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/triple.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/triple.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/triple.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Properties/WaterSteamSimple/triple.mo"	2022-03-10 09:58:24.700150042 +0000
@@ -1,13 +1,13 @@
 within ThermoSysPro.Properties.WaterSteamSimple;
 record triple "triple point data"
   extends Modelica.Icons.Record;
-  constant Modelica.SIunits.Temperature Ttriple=273.16
+  constant Modelica.Units.SI.Temperature Ttriple=273.16
     "the triple point temperature";
-  constant Modelica.SIunits.Pressure ptriple=611.657
+  constant Modelica.Units.SI.Pressure ptriple=611.657
     "the triple point temperature";
-  constant Modelica.SIunits.Density dltriple=999.792520031617642
+  constant Modelica.Units.SI.Density dltriple=999.792520031617642
     "the triple point liquid density";
-  constant Modelica.SIunits.Density dvtriple=0.485457572477861372e-2
+  constant Modelica.Units.SI.Density dvtriple=0.485457572477861372e-2
     "the triple point vapour density";
   annotation (Documentation(info="<HTML>
  <h4>Record description</h4>
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Solar/Collectors/FresnelField.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Solar/Collectors/FresnelField.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Solar/Collectors/FresnelField.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Solar/Collectors/FresnelField.mo"	2022-03-10 09:58:24.672150040 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.Solar.Collectors;
 model FresnelField "FresnelField"
-  parameter Modelica.SIunits.Area A=50e4 "Aperture area of the collectors";
+  parameter Modelica.Units.SI.Area A=50e4 "Aperture area of the collectors";
   parameter Integer mode_efficency=1
     "1:Definition of each parameter : rho, a, tau , geo. 2:Definition of the global optical efficency";
   parameter Real eta0=0.625 "Global optical efficency at normal irradiation";
@@ -10,10 +10,10 @@
   parameter Real geo=0.725 "Geometric default factor";
   parameter Real dispo=1 "Mean disponibility of the field";
     parameter Real clean=1 "Mean cleanliness factor";
-  parameter Modelica.SIunits.Length h=7.4 "Height of a collector";
-  parameter Modelica.SIunits.Length w=11.46 "Aperture width of a collector";
-  parameter Modelica.SIunits.Diameter D=0.07 "External tube diameter";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer hc=1
+  parameter Modelica.Units.SI.Length h=7.4 "Height of a collector";
+  parameter Modelica.Units.SI.Length w=11.46 "Aperture width of a collector";
+  parameter Modelica.Units.SI.Diameter D=0.07 "External tube diameter";
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer hc=1
     "Heat transfer coefficient";
   parameter Real F12=1 "View factor to surroundings,radiation heat loss";
   parameter Real Emi=0.8 "Tube emissivity";
@@ -33,13 +33,13 @@
   parameter Real B5=3e-10
     "x^5 coefficient of the KT caracteristics KT=f(thetaT)";
   parameter Real B6=0 "x^6 coefficient of the KT caracteristics KT=f(thetaT)";
-  parameter Modelica.SIunits.Temperature T0= 300 "Atmospheric temperature";
+  parameter Modelica.Units.SI.Temperature T0= 300 "Atmospheric temperature";
   parameter Integer Ns=10 "Number of cells (sections) in the field";
   parameter ThermoSysPro.Units.Angle_deg SunA0=90
     "Sun azimuth angle by default";
   parameter ThermoSysPro.Units.Angle_deg SunG0=1e-6
     "Sun elevation angle by default";
-  parameter Modelica.SIunits.Irradiance SunDNI0=1000
+  parameter Modelica.Units.SI.Irradiance SunDNI0=1000
     "Direct normal irradiance by default";
 
 protected
@@ -47,17 +47,17 @@
   parameter Real eps=1e-6 "epsilon";
 
 public
-  Modelica.SIunits.Length L(start=44.8) "Length of a collector";
-  Modelica.SIunits.Power dPth[Ns](start=fill(80e7/Ns,Ns))
+  Modelica.Units.SI.Length L(start=44.8) "Length of a collector";
+  Modelica.Units.SI.Power dPth[Ns](start=fill(80e7/Ns,Ns))
     "Thermal Power transfered to the fluid for each section";
   Real ETA0(start=0.625) "Definition of efficency at normal irradiation";
   Real sin_alphaS(start=1) "Used in the definition of thetaL and thetaT";
   Real track "Mean sun tracking system factor";
-  Modelica.SIunits.Power Pth(start=563e6)
+  Modelica.Units.SI.Power Pth(start=563e6)
     "Thermal Power transfered to the the fluid";
-  Modelica.SIunits.Power Qrec(start=625e6)
+  Modelica.Units.SI.Power Qrec(start=625e6)
     "Thermal Power received by the receptor";
-  Modelica.SIunits.Power Qloss(start=625e5) "Thermal loss on the receptor";
+  Modelica.Units.SI.Power Qloss(start=625e5) "Thermal loss on the receptor";
   ThermoSysPro.Units.Angle_deg thetaT(start=0) "Transversal incidence angle";
   ThermoSysPro.Units.Angle_deg thetaL(start=0) "Longitudinal incidence angle";
   Real KT(start=1) "Transversal incidence modifier fonction";
@@ -66,10 +66,10 @@
     "Mean tempertaure difference";
   ThermoSysPro.Units.Angle_deg gammaS(start=90) "Sun azimuth angle";
   ThermoSysPro.Units.Angle_deg alphaS(start=1e-6) "Sun elevation angle";
-  Modelica.SIunits.Irradiance DNI(start=2000) "Direct normal irradiance";
-  Modelica.SIunits.Temperature T[Ns](start=fill(300,Ns))
+  Modelica.Units.SI.Irradiance DNI(start=2000) "Direct normal irradiance";
+  Modelica.Units.SI.Temperature T[Ns](start=fill(300,Ns))
     "Pipe wall Temperature ";
-  Modelica.SIunits.Power dQloss[Ns](start=fill(563e6/Ns,Ns))
+  Modelica.Units.SI.Power dQloss[Ns](start=fill(563e6/Ns,Ns))
     "Thermal loss on the receptor by each cell (section)";
 
   ThermoSysPro.InstrumentationAndControl.Connectors.InputReal SunG
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Solar/Collectors/SolarCollector.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Solar/Collectors/SolarCollector.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Solar/Collectors/SolarCollector.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Solar/Collectors/SolarCollector.mo"	2022-03-10 09:58:24.608150032 +0000
@@ -1,12 +1,12 @@
-﻿within ThermoSysPro.Solar.Collectors;
+within ThermoSysPro.Solar.Collectors;
 model SolarCollector "Solar Collector"
-  parameter Modelica.SIunits.Length f=1 "Focal length";
+  parameter Modelica.Units.SI.Length f=1 "Focal length";
   parameter Real RimAngle=70 "Rim Angle";
-  parameter Modelica.SIunits.Length L=1 "Absorber pipe length or collector length";
+  parameter Modelica.Units.SI.Length L=1 "Absorber pipe length or collector length";
   parameter Integer Ns=10 "Number of cells";
-  parameter Modelica.SIunits.Diameter DTube=0.1 "Tube diameter";
-  parameter Modelica.SIunits.Diameter DGlass=0.11 "Glass diameter";
-  parameter Modelica.SIunits.Length e=1.e-4 "Glass thickness";
+  parameter Modelica.Units.SI.Diameter DTube=0.1 "Tube diameter";
+  parameter Modelica.Units.SI.Diameter DGlass=0.11 "Glass diameter";
+  parameter Modelica.Units.SI.Length e=1.e-4 "Glass thickness";
   parameter Real F12=1 "View factor to surroundings,radiation heat loss";
   parameter Real TauN=0.91 "Glass transmittivity at normal incidence";
   parameter Real AlphaN=0.97 "Tube absorptivity at normal incidence";
@@ -15,14 +15,14 @@
   parameter Real EpsGlass=0.86 "Glass emissivity";
   parameter Real R=0.8 "Mirror reflectivity";
   parameter Real Gamma=0.83 "Intercept factor";
-  parameter Modelica.SIunits.ThermalConductivity Lambda=0.00262
+  parameter Modelica.Units.SI.ThermalConductivity Lambda=0.00262
     "Gas thermal conductivity";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer h=3.06
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer h=3.06
     "Heat transfer coefficient";
-  parameter Modelica.SIunits.SpecificHeatCapacity cp_glass=720
+  parameter Modelica.Units.SI.SpecificHeatCapacity cp_glass=720
     "Glass heat capacity";
-  parameter Modelica.SIunits.Density rho_glass=2500 "Glass density";
-  parameter Modelica.SIunits.Temperature T0=350
+  parameter Modelica.Units.SI.Density rho_glass=2500 "Glass density";
+  parameter Modelica.Units.SI.Temperature T0=350
     "Initial temperature (active if steady_state=false)";
   parameter Boolean steady_state=true
     "true: start from steady state - false: start from T0";
@@ -34,33 +34,32 @@
 public
   Real PhiSun(start=1) "Radiation flux";
   Real Theta(start=0) "Incidence angle";
-  Modelica.SIunits.Temperature Twall[Ns](start=fill(350,Ns))
+  Modelica.Units.SI.Temperature Twall[Ns](start=fill(350,Ns))
     "Pipe wall temperature";
-  Modelica.SIunits.Temperature Tatm(start=300) "Atmospheric temperature";
+  Modelica.Units.SI.Temperature Tatm(start=300) "Atmospheric temperature";
   Real WTube[Ns](start=fill(1,Ns)) "Flux to the pipe";
-  Modelica.SIunits.Area AReflector(start=1) "Reflector surface";
-  Modelica.SIunits.Area AGlass(start=1) "Glass surface";
-  Modelica.SIunits.Area ATube(start=1) "Pipe surface";
-  Modelica.SIunits.Mass dM(start=1) "Glass mass";
+  Modelica.Units.SI.Area AReflector(start=1) "Reflector surface";
+  Modelica.Units.SI.Area AGlass(start=1) "Glass surface";
+  Modelica.Units.SI.Area ATube(start=1) "Pipe surface";
+  Modelica.Units.SI.Mass dM(start=1) "Glass mass";
   Real OptEff(start=1) "Optical efficiency";
   Real IAM(start=1) "Incidence angle modifier";
   Real TauAlphaN(start=1) "Transmittivity-absorptivity factor";
-  Modelica.SIunits.Power WRadWall[Ns](start=fill(0,Ns)) "Radiation of the wall";
-  Modelica.SIunits.Power WConvWall[Ns](start=fill(0,Ns))
+  Modelica.Units.SI.Power WRadWall[Ns](start=fill(0,Ns)) "Radiation of the wall";
+  Modelica.Units.SI.Power WConvWall[Ns](start=fill(0,Ns))
     "Convection of the wall";
-  Modelica.SIunits.Power WCondWall[Ns](start=fill(0,Ns))
+  Modelica.Units.SI.Power WCondWall[Ns](start=fill(0,Ns))
     "Conduction of the wall";
-  Modelica.SIunits.Power WRadGlass[Ns](start=fill(0,Ns))
+  Modelica.Units.SI.Power WRadGlass[Ns](start=fill(0,Ns))
     "Radiation of the glass layer";
-  Modelica.SIunits.Power WConvGlass[Ns](start=fill(0,Ns))
+  Modelica.Units.SI.Power WConvGlass[Ns](start=fill(0,Ns))
     "Convection of the glass layer";
-  Modelica.SIunits.Power WAbsGlass[Ns](start=fill(0,Ns))
+  Modelica.Units.SI.Power WAbsGlass[Ns](start=fill(0,Ns))
     "Absorption of the glass layer";
-  Modelica.SIunits.Temperature Tsky(start=300) "Sky temperature";
-  Modelica.SIunits.Temperature Tglass[Ns](start=fill(300,Ns))
+  Modelica.Units.SI.Temperature Tsky(start=300) "Sky temperature";
+  Modelica.Units.SI.Temperature Tglass[Ns](start=fill(300,Ns))
     "Glass temperature";
-  //Modelica.SIunits.Power WW ;
-
+  //Modelica.SIunits.Power WW ;
   ThermoSysPro.InstrumentationAndControl.Connectors.InputReal ISun
     "Flux (W/m²)"
     annotation (Placement(transformation(extent={{-250,100},{-230,120}},
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Solar/HeatExchangers/DynamicOnePhaseFlowPipe_Oil.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Solar/HeatExchangers/DynamicOnePhaseFlowPipe_Oil.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Solar/HeatExchangers/DynamicOnePhaseFlowPipe_Oil.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Solar/HeatExchangers/DynamicOnePhaseFlowPipe_Oil.mo"	2022-03-10 09:58:24.528150021 +0000
@@ -1,27 +1,26 @@
-﻿within ThermoSysPro.Solar.HeatExchangers;
+within ThermoSysPro.Solar.HeatExchangers;
 model DynamicOnePhaseFlowPipe_Oil "Dynamic one-phase flow pipe Oil"
-  parameter Modelica.SIunits.Length L=10. "Pipe length";
-  parameter Modelica.SIunits.Diameter D=0.2 "Internal pipe diameter";
+  parameter Modelica.Units.SI.Length L=10. "Pipe length";
+  parameter Modelica.Units.SI.Diameter D=0.2 "Internal pipe diameter";
   parameter Real rugosrel=0.0007 "Pipe relative roughness";
   parameter Integer ntubes=1 "Number of pipes in parallel";
-  parameter Modelica.SIunits.Position z1=0 "Pipe inlet altitude";
-  parameter Modelica.SIunits.Position z2=0 "Pipe outlet altitude";
+  parameter Modelica.Units.SI.Position z1=0 "Pipe inlet altitude";
+  parameter Modelica.Units.SI.Position z2=0 "Pipe outlet altitude";
   parameter Real dpfCorr=1.00
     "Corrective term for the friction pressure loss (dpf) for each node";
   parameter Real hcCorr=1.00
     "Corrective term for the heat exchange coefficient (hc) for each node";
   parameter Integer Ns=10 "Number of segments";
-  parameter Modelica.SIunits.Temperature T0[Ns]=fill(290, Ns)
+  parameter Modelica.Units.SI.Temperature T0[Ns]=fill(290, Ns)
     "Initial fluid temperature (active if steady_state = false and option_temperature = 1)";
-  parameter Modelica.SIunits.SpecificEnthalpy h0[Ns]=fill(1e5, Ns)
+  parameter Modelica.Units.SI.SpecificEnthalpy h0[Ns]=fill(1e5, Ns)
     "Initial fluid specific enthalpy (active if steady_state = false and option_temperature = 2)";
- // parameter Boolean inertia=true
- //   "true: momentum balance equation with inertia - false: without inertia";
+ // parameter Boolean inertia=true
+  //   "true: momentum balance equation with inertia - false: without inertia";
   parameter Boolean advection=false
     "true: momentum balance equation with advection terme - false: without advection terme";
- // parameter Boolean dynamic_mass_balance=true
- //   "true: dynamic mass balance equation - false: static mass balance equation";
-
+ // parameter Boolean dynamic_mass_balance=true
+  //   "true: dynamic mass balance equation - false: static mass balance equation";
   parameter Boolean steady_state=true
     "true: start from steady state - false: start from T0 (if option_temperature=1) or h0 (if option_temperature=2)";
   parameter Integer option_temperature=1
@@ -32,60 +31,60 @@
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 protected
-  constant Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  constant Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
   constant Real pi=Modelica.Constants.pi "pi";
   parameter Real eps=1.e-0 "Small number for pressure loss equation";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow rate for continuous flow reversal";
   parameter Integer N=Ns + 1
     "Number of hydraulic nodes (= number of thermal nodes + 1)";
-  parameter Modelica.SIunits.Area A=ntubes*pi*D^2/4
+  parameter Modelica.Units.SI.Area A=ntubes*pi*D^2/4
     "Internal cross sectional pipe area";
-  parameter Modelica.SIunits.Diameter Di=ntubes*D "Internal pipe diameter";
-  parameter Modelica.SIunits.PathLength dx1=L/(N - 1)
+  parameter Modelica.Units.SI.Diameter Di=ntubes*D "Internal pipe diameter";
+  parameter Modelica.Units.SI.PathLength dx1=L/(N - 1)
     "Length of a thermal node";
-  parameter Modelica.SIunits.PathLength dx2=L/N "Length of a hydraulic node";
-  parameter Modelica.SIunits.Area dSi=pi*Di*dx1
+  parameter Modelica.Units.SI.PathLength dx2=L/N "Length of a hydraulic node";
+  parameter Modelica.Units.SI.Area dSi=pi*Di*dx1
     "Internal heat exchange area for a node";
 
 public
-  Modelica.SIunits.AbsolutePressure P[N + 1](start=fill(1.e5, N + 1), nominal=fill(1.e5, N + 1))
+  Modelica.Units.SI.AbsolutePressure P[N + 1](start=fill(1.e5, N + 1), nominal=fill(1.e5, N + 1))
     "Fluid pressure in node i";
-  Modelica.SIunits.MassFlowRate Q[N](start=fill(10, N), nominal=fill(10, N))
+  Modelica.Units.SI.MassFlowRate Q[N](start=fill(10, N), nominal=fill(10, N))
     "Mass flow rate in node i";
-  Modelica.SIunits.SpecificEnthalpy h[N + 1](start=fill(1.e5, N + 1), nominal=fill(1.e6, N + 1))
+  Modelica.Units.SI.SpecificEnthalpy h[N + 1](start=fill(1.e5, N + 1), nominal=fill(1.e6, N + 1))
     "Fluid specific enthalpy in node i";
-  Modelica.SIunits.SpecificEnthalpy hb[N]
+  Modelica.Units.SI.SpecificEnthalpy hb[N]
     "Fluid specific enthalpy at the boundary of node i";
-  Modelica.SIunits.Density rho1[N - 1](start=fill(998, N - 1), nominal=fill(1, N - 1))
+  Modelica.Units.SI.Density rho1[N - 1](start=fill(998, N - 1), nominal=fill(1, N - 1))
     "Fluid density in thermal node i";
-  Modelica.SIunits.Density rho2[N](start=fill(998, N), nominal=fill(1, N))
+  Modelica.Units.SI.Density rho2[N](start=fill(998, N), nominal=fill(1, N))
     "Fluid density in hydraulic node i";
-  Modelica.SIunits.Density rhoc[N + 1](start=fill(998, N + 1), nominal=fill(1, N + 1))
+  Modelica.Units.SI.Density rhoc[N + 1](start=fill(998, N + 1), nominal=fill(1, N + 1))
     "Fluid density at the boudary of node i";
-  Modelica.SIunits.Power dW1[N - 1](start=fill(3.e5, N - 1), nominal=fill(3.e5, N - 1))
+  Modelica.Units.SI.Power dW1[N - 1](start=fill(3.e5, N - 1), nominal=fill(3.e5, N - 1))
     "Thermal power exchanged on the water side for node i";
-  Modelica.SIunits.Power W1t "Total power exchanged on the water side";
-  Modelica.SIunits.Temperature Tp[N - 1](start=T0) "Wall temperature in node i";
-  Modelica.SIunits.CoefficientOfHeatTransfer hc[N - 1](start=fill(2000, N - 1), nominal=fill(200, N - 1))
+  Modelica.Units.SI.Power W1t "Total power exchanged on the water side";
+  Modelica.Units.SI.Temperature Tp[N - 1](start=T0) "Wall temperature in node i";
+  Modelica.Units.SI.CoefficientOfHeatTransfer hc[N - 1](start=fill(2000, N - 1), nominal=fill(200, N - 1))
     "Fluid heat exchange coefficient in node i";
-  Modelica.SIunits.ReynoldsNumber Re1[N - 1](start=fill(6.e4, N - 1), nominal=fill(0.5e4, N - 1))
+  Modelica.Units.SI.ReynoldsNumber Re1[N - 1](start=fill(6.e4, N - 1), nominal=fill(0.5e4, N - 1))
     "Fluid Reynolds number in thermal node i";
-  Modelica.SIunits.ReynoldsNumber Re2[N](start=fill(6.e4, N), nominal=fill(0.5e4, N))
+  Modelica.Units.SI.ReynoldsNumber Re2[N](start=fill(6.e4, N), nominal=fill(0.5e4, N))
     "Fluid Reynolds number in hydraulic node i";
   Real Pr[N - 1](start=fill(4, N - 1), nominal=fill(1, N - 1))
     "Fluid Prandtl number in node i";
-  Modelica.SIunits.ThermalConductivity k[N - 1](start=fill(0.6, N - 1), nominal=fill(0.6, N - 1))
+  Modelica.Units.SI.ThermalConductivity k[N - 1](start=fill(0.6, N - 1), nominal=fill(0.6, N - 1))
     "Fluid thermal conductivity in node i";
-  Modelica.SIunits.DynamicViscosity mu1[N - 1](start=fill(2.e-4, N - 1), nominal=fill(2.e-4, N - 1))
+  Modelica.Units.SI.DynamicViscosity mu1[N - 1](start=fill(2.e-4, N - 1), nominal=fill(2.e-4, N - 1))
     "Fluid dynamic viscosity in thermal node i";
-  Modelica.SIunits.DynamicViscosity mu2[N](start=fill(2.e-4, N), nominal=fill(2.e-4, N))
+  Modelica.Units.SI.DynamicViscosity mu2[N](start=fill(2.e-4, N), nominal=fill(2.e-4, N))
     "Fluid dynamic viscosity in hydraulic node i";
-  Modelica.SIunits.SpecificHeatCapacity cp[N - 1](start=fill(4000, N - 1), nominal=fill(4000, N - 1))
+  Modelica.Units.SI.SpecificHeatCapacity cp[N - 1](start=fill(4000, N - 1), nominal=fill(4000, N - 1))
     "Fluid specific heat capacity";
-  Modelica.SIunits.Temperature T1[N - 1] "Fluid temperature in thermal node i";
-  Modelica.SIunits.Temperature T2[N] "Fluid temperature in hydraulic node i";
+  Modelica.Units.SI.Temperature T1[N - 1] "Fluid temperature in thermal node i";
+  Modelica.Units.SI.Temperature T2[N] "Fluid temperature in hydraulic node i";
   ThermoSysPro.Units.DifferentialPressure dpa[N]
     "Advection term for the mass balance equation in node i";
   ThermoSysPro.Units.DifferentialPressure dpf[N]
@@ -95,7 +94,7 @@
   Real khi[N] "Hydraulic pressure loss coefficient in node i";
   Real lambda[N](start=fill(0.03, N), nominal=fill(0.03, N))
     "Friction pressure loss coefficient in node i";
-  Modelica.SIunits.Area Stot "Internal heat exchange area";
+  Modelica.Units.SI.Area Stot "Internal heat exchange area";
 
 public
   WaterSteam.Connectors.FluidInlet C1
@@ -116,8 +115,8 @@
 
     if (option_temperature == 1) then
       for i in 2:N loop
-//EEEEEEEEEreur
-        //h[i] = ThermoSysPro.Properties.WaterSteam.IF97.SpecificEnthalpy_PT(P[i], T0[i - 1], mode);
+//EEEEEEEEEreur
+//h[i] = ThermoSysPro.Properties.WaterSteam.IF97.SpecificEnthalpy_PT(P[i], T0[i - 1], mode);
         h[i] = ThermoSysPro.Properties.Oil_TherminolVP1.Enthalpy_T( T0[i - 1]);
       end for;
     elseif (option_temperature == 2) then
@@ -162,102 +161,81 @@
   hb[N] = C2.h;
 
   h[1] = C1.h_vol;
-  h[N + 1] = C2.h_vol;
-
-  /* Mass and energy balance equations (thermal nodes) */
-  for i in 1:N - 1 loop
-    /* Mass balance equation */
-//    if dynamic_mass_balance then
-//      A*(pro1[i].ddph*der(P[i + 1]) + pro1[i].ddhp*der(h[i + 1]))*dx1 = Q[i] - Q[i + 1];
-//    else
-      0 = Q[i] - Q[i + 1];
-//    end if;
-
-    /* Energy balance equation */
-//    if dynamic_mass_balance then
-//      A*(-der(P[i + 1]) + rho1[i]*der(h[i + 1]))*dx1 = hb[i]*Q[i] - hb[i + 1]*Q[i + 1] + dW1[i];
-//    else
-      A*rho1[i]*der(h[i + 1])*dx1 = hb[i]*Q[i] - hb[i + 1]*Q[i + 1] + dW1[i];
-//    end if;
-
-    /* Heat transfer at the wall */
-    dW1[i] = hc[i]*dSi*(Tp[i] - T1[i]);
-
-    /* Fluid thermodynamic properties */
-    T1[i] = ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h[i + 1]);
-    rho1[i] = ThermoSysPro.Properties.Oil_TherminolVP1.Density_T(T1[i]);
-    cp[i] =ThermoSysPro.Properties.Oil_TherminolVP1.SpecificHeatCp_T( T1[i]);
-    mu1[i] = ThermoSysPro.Properties.Oil_TherminolVP1.DynamicViscosity_T(T1[i]);
-    k[i] = ThermoSysPro.Properties.Oil_TherminolVP1.ThermalConductivity_T(T1[i]);
-
-    /* Heat exchange coefficient (using the Dittus-Boelter correlation) */
-    //hc[i] = noEvent(if ((Re1[i] > 1.e-6) and (Pr[i] > 1.e-6)) then hcCorr*0.023*k[i]/D*Re1[i]^0.8*Pr[i]^0.4 else 0);
-    if noEvent( Re1[i] > 2000) then
-      hc[i] = noEvent(if (Pr[i] > 1.e-6) then hcCorr*0.023*k[i]/D*Re1[i]^0.8*Pr[i]^0.4 else 200);
-    else
-      // Lévêque equation
-      hc[i] = hcCorr*3.66*k[i]/D;
-    end if;
-
-    Pr[i] = mu1[i]*cp[i]/k[i];
-    Re1[i] = noEvent(abs(4*(Q[i] + Q[i + 1])/2/(pi*Di*mu1[i])));
-
-  end for;
-
-  /* Momentum balance equations (hydraulic nodes) */
-  for i in 1:N loop
-    /* Flow reversal */
-    if continuous_flow_reversal then
-      0 = noEvent(if (Q[i] > Qeps) then hb[i] - h[i] else if (Q[i] < -Qeps) then
-        hb[i] - h[i + 1] else hb[i] - 0.5*((h[i] - h[i + 1])*Modelica.Math.sin(pi
-        *Q[i]/2/Qeps) + h[i + 1] + h[i]));
-    else
-      0 = if (Q[i] > 0) then hb[i] - h[i] else hb[i] - h[i + 1];
-    end if;
-
-    /* Momentum balance equation */
-//    if inertia then
-//      1/A*der(Q[i])*dx2 = P[i] - P[i + 1] - dpf[i] - dpg[i] - dpa[i];
-//    else
-      P[i] - P[i + 1] - dpf[i] - dpg[i] - dpa[i] = 0;
-//    end if;
-
-    /* Advection term */
-    if advection then
-      dpa[i] = noEvent(Q[i]*abs(Q[i])*(1/rhoc[i + 1] - 1/rhoc[i])/A^2);
-    else
-      dpa[i] = 0;
-    end if;
-
-    /* Gravity pressure losses */
-    dpg[i] = rho2[i]*g*(z2 - z1)*dx2/L;
-
-    /* Friction pressure losses */
-    dpf[i] = noEvent(dpfCorr*khi[i]*Q[i]*abs(Q[i])/(2*A^2*rho2[i]));
-
-    khi[i] = lambda[i]*dx2/D;
-
-    lambda[i] = if noEvent(Re2[i] > 1) then 0.25*(Modelica.Math.log10(13/Re2[i] + rugosrel/3.7/D))^(-2) else 0.01;
-
-    Re2[i] = noEvent(abs(4*Q[i]/(pi*Di*mu2[i])));
-
-    /* Fluid thermodynamic properties */
-    T2[i] = ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(hb[i]);
-    rho2[i] = ThermoSysPro.Properties.Oil_TherminolVP1.Density_T(T2[i]);
-    mu2[i] = ThermoSysPro.Properties.Oil_TherminolVP1.DynamicViscosity_T(T2[i]);
-
+  h[N + 1] = C2.h_vol;
+/* Mass and energy balance equations (thermal nodes) */
+  for i in 1:N - 1 loop
+/* Mass balance equation */
+//    if dynamic_mass_balance then
+//      A*(pro1[i].ddph*der(P[i + 1]) + pro1[i].ddhp*der(h[i + 1]))*dx1 = Q[i] - Q[i + 1];
+//    else
+    0 = Q[i] - Q[i + 1];
+//    end if;
+/* Energy balance equation */
+//    if dynamic_mass_balance then
+//      A*(-der(P[i + 1]) + rho1[i]*der(h[i + 1]))*dx1 = hb[i]*Q[i] - hb[i + 1]*Q[i + 1] + dW1[i];
+//    else
+    A * rho1[i] * der(h[i + 1]) * dx1 = hb[i] * Q[i] - hb[i + 1] * Q[i + 1] + dW1[i];
+//    end if;
+/* Heat transfer at the wall */
+    dW1[i] = hc[i] * dSi * (Tp[i] - T1[i]);
+/* Fluid thermodynamic properties */
+    T1[i] = ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h[i + 1]);
+    rho1[i] = ThermoSysPro.Properties.Oil_TherminolVP1.Density_T(T1[i]);
+    cp[i] = ThermoSysPro.Properties.Oil_TherminolVP1.SpecificHeatCp_T(T1[i]);
+    mu1[i] = ThermoSysPro.Properties.Oil_TherminolVP1.DynamicViscosity_T(T1[i]);
+    k[i] = ThermoSysPro.Properties.Oil_TherminolVP1.ThermalConductivity_T(T1[i]);
+/* Heat exchange coefficient (using the Dittus-Boelter correlation) */
+//hc[i] = noEvent(if ((Re1[i] > 1.e-6) and (Pr[i] > 1.e-6)) then hcCorr*0.023*k[i]/D*Re1[i]^0.8*Pr[i]^0.4 else 0);
+    if noEvent(Re1[i] > 2000) then
+      hc[i] = noEvent(if Pr[i] > 1.e-6 then hcCorr * 0.023 * k[i] / D * Re1[i] ^ 0.8 * Pr[i] ^ 0.4 else 200);
+    else
+// Lévêque equation
+      hc[i] = hcCorr * 3.66 * k[i] / D;
+    end if;
+    Pr[i] = mu1[i] * cp[i] / k[i];
+    Re1[i] = noEvent(abs(4 * (Q[i] + Q[i + 1]) / 2 / (pi * Di * mu1[i])));
+  end for;
+/* Momentum balance equations (hydraulic nodes) */
+  for i in 1:N loop
+/* Flow reversal */
+    if continuous_flow_reversal then
+      0 = noEvent(if Q[i] > Qeps then hb[i] - h[i] else if Q[i] < (-Qeps) then hb[i] - h[i + 1] else hb[i] - 0.5 * ((h[i] - h[i + 1]) * Modelica.Math.sin(pi * Q[i] / 2 / Qeps) + h[i + 1] + h[i]));
+    else
+      0 = if Q[i] > 0 then hb[i] - h[i] else hb[i] - h[i + 1];
+    end if;
+/* Momentum balance equation */
+//    if inertia then
+//      1/A*der(Q[i])*dx2 = P[i] - P[i + 1] - dpf[i] - dpg[i] - dpa[i];
+//    else
+    P[i] - P[i + 1] - dpf[i] - dpg[i] - dpa[i] = 0;
+//    end if;
+/* Advection term */
+    if advection then
+      dpa[i] = noEvent(Q[i] * abs(Q[i]) * (1 / rhoc[i + 1] - 1 / rhoc[i]) / A ^ 2);
+    else
+      dpa[i] = 0;
+    end if;
+/* Gravity pressure losses */
+    dpg[i] = rho2[i] * g * (z2 - z1) * dx2 / L;
+/* Friction pressure losses */
+    dpf[i] = noEvent(dpfCorr * khi[i] * Q[i] * abs(Q[i]) / (2 * A ^ 2 * rho2[i]));
+    khi[i] = lambda[i] * dx2 / D;
+    lambda[i] = if noEvent(Re2[i] > 1) then 0.25 * Modelica.Math.log10(13 / Re2[i] + rugosrel / 3.7 / D) ^ (-2) else 0.01;
+    Re2[i] = noEvent(abs(4 * Q[i] / (pi * Di * mu2[i])));
+/* Fluid thermodynamic properties */
+    T2[i] = ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(hb[i]);
+    rho2[i] = ThermoSysPro.Properties.Oil_TherminolVP1.Density_T(T2[i]);
+    mu2[i] = ThermoSysPro.Properties.Oil_TherminolVP1.DynamicViscosity_T(T2[i]);
   end for;
 
   /* Fluid densities at the boundaries of the nodes */
   for i in 2:N loop
     rhoc[i] = rho1[i - 1];
-  end for;
-
-  //proc[1] = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(P[1], h[1], mode);
-  //proc[2] = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(P[N + 1],h[N + 1], mode);
-  //rhoc[1] = proc[1].d;
-  //rhoc[N + 1] = proc[2].d;
-
+  end for;
+//proc[1] = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(P[1], h[1], mode);
+//proc[2] = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(P[N + 1],h[N + 1], mode);
+//rhoc[1] = proc[1].d;
+//rhoc[N + 1] = proc[2].d;
   rhoc[1] = rho1[1];
   rhoc[N + 1] = rhoc[N];
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Solar/HeatExchangers/DynamicOnePhaseFlowPipe_SaltOil.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Solar/HeatExchangers/DynamicOnePhaseFlowPipe_SaltOil.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Solar/HeatExchangers/DynamicOnePhaseFlowPipe_SaltOil.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Solar/HeatExchangers/DynamicOnePhaseFlowPipe_SaltOil.mo"	2022-03-10 09:58:24.440150010 +0000
@@ -1,19 +1,19 @@
-﻿within ThermoSysPro.Solar.HeatExchangers;
+within ThermoSysPro.Solar.HeatExchangers;
 model DynamicOnePhaseFlowPipe_SaltOil "Dynamic one-phase flow pipe Salt-Oil"
-  parameter Modelica.SIunits.Length L=10. "Pipe length";
-  parameter Modelica.SIunits.Diameter D=0.2 "Internal pipe diameter";
+  parameter Modelica.Units.SI.Length L=10. "Pipe length";
+  parameter Modelica.Units.SI.Diameter D=0.2 "Internal pipe diameter";
   parameter Real rugosrel=0.0007 "Pipe relative roughness";
   parameter Integer ntubes=1 "Number of pipes in parallel";
-  parameter Modelica.SIunits.Position z1=0 "Pipe inlet altitude";
-  parameter Modelica.SIunits.Position z2=0 "Pipe outlet altitude";
+  parameter Modelica.Units.SI.Position z1=0 "Pipe inlet altitude";
+  parameter Modelica.Units.SI.Position z2=0 "Pipe outlet altitude";
   parameter Real dpfCorr=1.00
     "Corrective term for the friction pressure loss (dpf) for each node";
   parameter Real hcCorr=1.00
     "Corrective term for the heat exchange coefficient (hc) for each node";
   parameter Integer Ns=10 "Number of segments";
-  parameter Modelica.SIunits.Temperature T0[Ns]=fill(290, Ns)
+  parameter Modelica.Units.SI.Temperature T0[Ns]=fill(290, Ns)
     "Initial fluid temperature (active if steady_state = false)";
-  parameter Modelica.SIunits.SpecificEnthalpy h0[Ns]=fill(1e5, Ns)
+  parameter Modelica.Units.SI.SpecificEnthalpy h0[Ns]=fill(1e5, Ns)
     "Initial fluid specific enthalpy (active if steady_state = false)";
   parameter Boolean advection=false
     "true: momentum balance equation with advection terme - false: without advection terme";
@@ -26,60 +26,60 @@
   parameter Integer fluid=1 "1: Oil (TherminolVP1) - 2: Salt (KNO3-NaNO3)";
 
 protected
-  constant Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  constant Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
   constant Real pi=Modelica.Constants.pi "pi";
   parameter Real eps=1.e-0 "Small number for pressure loss equation";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow rate for continuous flow reversal";
   parameter Integer N=Ns + 1
     "Number of hydraulic nodes (= number of thermal nodes + 1)";
-  parameter Modelica.SIunits.Area A=ntubes*pi*D^2/4
+  parameter Modelica.Units.SI.Area A=ntubes*pi*D^2/4
     "Internal cross sectional pipe area";
-  parameter Modelica.SIunits.Diameter Di=ntubes*D "Internal pipe diameter";
-  parameter Modelica.SIunits.PathLength dx1=L/(N - 1)
+  parameter Modelica.Units.SI.Diameter Di=ntubes*D "Internal pipe diameter";
+  parameter Modelica.Units.SI.PathLength dx1=L/(N - 1)
     "Length of a thermal node";
-  parameter Modelica.SIunits.PathLength dx2=L/N "Length of a hydraulic node";
-  parameter Modelica.SIunits.Area dSi=pi*Di*dx1
+  parameter Modelica.Units.SI.PathLength dx2=L/N "Length of a hydraulic node";
+  parameter Modelica.Units.SI.Area dSi=pi*Di*dx1
     "Internal heat exchange area for a node";
 
 public
-  Modelica.SIunits.AbsolutePressure P[N + 1](start=fill(1.e5, N + 1), nominal=fill(1.e5, N + 1))
+  Modelica.Units.SI.AbsolutePressure P[N + 1](start=fill(1.e5, N + 1), nominal=fill(1.e5, N + 1))
     "Fluid pressure in node i";
-  Modelica.SIunits.MassFlowRate Q[N](start=fill(10, N), nominal=fill(10, N))
+  Modelica.Units.SI.MassFlowRate Q[N](start=fill(10, N), nominal=fill(10, N))
     "Mass flow rate in node i";
-  Modelica.SIunits.SpecificEnthalpy h[N + 1](start=fill(1.e5, N + 1), nominal=fill(1.e6, N + 1))
+  Modelica.Units.SI.SpecificEnthalpy h[N + 1](start=fill(1.e5, N + 1), nominal=fill(1.e6, N + 1))
     "Fluid specific enthalpy in node i";
-  Modelica.SIunits.SpecificEnthalpy hb[N]
+  Modelica.Units.SI.SpecificEnthalpy hb[N]
     "Fluid specific enthalpy at the boundary of node i";
-  Modelica.SIunits.Density rho1[N - 1](start=fill(998, N - 1), nominal=fill(1, N - 1))
+  Modelica.Units.SI.Density rho1[N - 1](start=fill(998, N - 1), nominal=fill(1, N - 1))
     "Fluid density in thermal node i";
-  Modelica.SIunits.Density rho2[N](start=fill(998, N), nominal=fill(1, N))
+  Modelica.Units.SI.Density rho2[N](start=fill(998, N), nominal=fill(1, N))
     "Fluid density in hydraulic node i";
-  Modelica.SIunits.Density rhoc[N + 1](start=fill(998, N + 1), nominal=fill(1, N + 1))
+  Modelica.Units.SI.Density rhoc[N + 1](start=fill(998, N + 1), nominal=fill(1, N + 1))
     "Fluid density at the boudary of node i";
-  Modelica.SIunits.Power dW1[N - 1](start=fill(3.e5, N - 1), nominal=fill(3.e5, N - 1))
+  Modelica.Units.SI.Power dW1[N - 1](start=fill(3.e5, N - 1), nominal=fill(3.e5, N - 1))
     "Thermal power exchanged on the water side for node i";
-  Modelica.SIunits.Power W1t "Total power exchanged on the water side";
-  Modelica.SIunits.Temperature Tp[N - 1](start=T0) "Wall temperature in node i";
-  Modelica.SIunits.CoefficientOfHeatTransfer hc[N - 1](start=fill(2000, N - 1), nominal=fill(200, N - 1))
+  Modelica.Units.SI.Power W1t "Total power exchanged on the water side";
+  Modelica.Units.SI.Temperature Tp[N - 1](start=T0) "Wall temperature in node i";
+  Modelica.Units.SI.CoefficientOfHeatTransfer hc[N - 1](start=fill(2000, N - 1), nominal=fill(200, N - 1))
     "Fluid heat exchange coefficient in node i";
-  Modelica.SIunits.ReynoldsNumber Re1[N - 1](start=fill(6.e4, N - 1), nominal=fill(0.5e4, N - 1))
+  Modelica.Units.SI.ReynoldsNumber Re1[N - 1](start=fill(6.e4, N - 1), nominal=fill(0.5e4, N - 1))
     "Fluid Reynolds number in thermal node i";
-  Modelica.SIunits.ReynoldsNumber Re2[N](start=fill(6.e4, N), nominal=fill(0.5e4, N))
+  Modelica.Units.SI.ReynoldsNumber Re2[N](start=fill(6.e4, N), nominal=fill(0.5e4, N))
     "Fluid Reynolds number in hydraulic node i";
   Real Pr[N - 1](start=fill(4, N - 1), nominal=fill(1, N - 1))
     "Fluid Prandtl number in node i";
-  Modelica.SIunits.ThermalConductivity k[N - 1](start=fill(0.6, N - 1), nominal=fill(0.6, N - 1))
+  Modelica.Units.SI.ThermalConductivity k[N - 1](start=fill(0.6, N - 1), nominal=fill(0.6, N - 1))
     "Fluid thermal conductivity in node i";
-  Modelica.SIunits.DynamicViscosity mu1[N - 1](start=fill(2.e-4, N - 1), nominal=fill(2.e-4, N - 1))
+  Modelica.Units.SI.DynamicViscosity mu1[N - 1](start=fill(2.e-4, N - 1), nominal=fill(2.e-4, N - 1))
     "Fluid dynamic viscosity in thermal node i";
-  Modelica.SIunits.DynamicViscosity mu2[N](start=fill(2.e-4, N), nominal=fill(2.e-4, N))
+  Modelica.Units.SI.DynamicViscosity mu2[N](start=fill(2.e-4, N), nominal=fill(2.e-4, N))
     "Fluid dynamic viscosity in hydraulic node i";
-  Modelica.SIunits.SpecificHeatCapacity cp[N - 1](start=fill(4000, N - 1), nominal=fill(4000, N - 1))
+  Modelica.Units.SI.SpecificHeatCapacity cp[N - 1](start=fill(4000, N - 1), nominal=fill(4000, N - 1))
     "Fluid specific heat capacity";
-  Modelica.SIunits.Temperature T1[N - 1] "Fluid temperature in thermal node i";
-  Modelica.SIunits.Temperature T2[N] "Fluid temperature in hydraulic node i";
+  Modelica.Units.SI.Temperature T1[N - 1] "Fluid temperature in thermal node i";
+  Modelica.Units.SI.Temperature T2[N] "Fluid temperature in hydraulic node i";
   ThermoSysPro.Units.DifferentialPressure dpa[N]
     "Advection term for the mass balance equation in node i";
   ThermoSysPro.Units.DifferentialPressure dpf[N]
@@ -89,7 +89,7 @@
   Real khi[N] "Hydraulic pressure loss coefficient in node i";
   Real lambda[N](start=fill(0.03, N), nominal=fill(0.03, N))
     "Friction pressure loss coefficient in node i";
-  Modelica.SIunits.Area Stot "Internal heat exchange area";
+  Modelica.Units.SI.Area Stot "Internal heat exchange area";
 
 public
   WaterSteam.Connectors.FluidInlet C1
@@ -130,48 +130,41 @@
   hb[N] = C2.h;
 
   h[1] = C1.h_vol;
-  h[N + 1] = C2.h_vol;
-
-  /* Mass and energy balance equations (thermal nodes) */
-  for i in 1:N - 1 loop
-    /* Mass balance equation */
-    0 = Q[i] - Q[i + 1];
-
-    /* Energy balance equation */
-    A*rho1[i]*der(h[i + 1])*dx1 = hb[i]*Q[i] - hb[i + 1]*Q[i + 1] + dW1[i];
-
-    /* Heat transfer at the wall */
-    dW1[i] = hc[i]*dSi*(Tp[i] - T1[i]);
-
-    /* Fluid thermodynamic properties */
-    if (fluid == 1) then
-      T1[i] = ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h[i + 1]);
-      rho1[i] = ThermoSysPro.Properties.Oil_TherminolVP1.Density_T(T1[i]);
-      cp[i] = ThermoSysPro.Properties.Oil_TherminolVP1.SpecificHeatCp_T( T1[i]);
-      mu1[i] = ThermoSysPro.Properties.Oil_TherminolVP1.DynamicViscosity_T(T1[i]);
-      k[i] = ThermoSysPro.Properties.Oil_TherminolVP1.ThermalConductivity_T(T1[i]);
-    elseif (fluid == 2) then
-      T1[i] = ThermoSysPro.Properties.MoltenSalt.Temperature_h(h[i + 1]);
-      rho1[i] = ThermoSysPro.Properties.MoltenSalt.Density_T(T1[i]);
-      cp[i] = ThermoSysPro.Properties.MoltenSalt.SpecificHeatCapacityCp_T( T1[i]);
-      mu1[i] = ThermoSysPro.Properties.MoltenSalt.DynamicViscosity_T(T1[i]);
-      k[i] = ThermoSysPro.Properties.MoltenSalt.ThermalConductivity_T(T1[i]);
-    else
-      assert(false, "DynamicOnePhaseFlowPipe_SaltOil: invalid option");
-    end if;
-
-    /* Heat exchange coefficient (using the Dittus-Boelter correlation) */
-    //hc[i] = noEvent(if ((Re1[i] > 1.e-6) and (Pr[i] > 1.e-6)) then hcCorr*0.023*k[i]/D*Re1[i]^0.8*Pr[i]^0.4 else 0);
-    if noEvent( Re1[i] > 2000) then
-      hc[i] = noEvent(if (Pr[i] > 1.e-6) then hcCorr*0.023*k[i]/D*Re1[i]^0.8*Pr[i]^0.4 else 200);
-    else
-      // Lévêque equation
-      hc[i] = hcCorr*3.66*k[i]/D;
-    end if;
-
-    Pr[i] = mu1[i]*cp[i]/k[i];
-    Re1[i] = noEvent(abs(4*(Q[i] + Q[i + 1])/2/(pi*Di*mu1[i])));
-
+  h[N + 1] = C2.h_vol;
+/* Mass and energy balance equations (thermal nodes) */
+  for i in 1:N - 1 loop
+/* Mass balance equation */
+    0 = Q[i] - Q[i + 1];
+/* Energy balance equation */
+    A * rho1[i] * der(h[i + 1]) * dx1 = hb[i] * Q[i] - hb[i + 1] * Q[i + 1] + dW1[i];
+/* Heat transfer at the wall */
+    dW1[i] = hc[i] * dSi * (Tp[i] - T1[i]);
+/* Fluid thermodynamic properties */
+    if fluid == 1 then
+      T1[i] = ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h[i + 1]);
+      rho1[i] = ThermoSysPro.Properties.Oil_TherminolVP1.Density_T(T1[i]);
+      cp[i] = ThermoSysPro.Properties.Oil_TherminolVP1.SpecificHeatCp_T(T1[i]);
+      mu1[i] = ThermoSysPro.Properties.Oil_TherminolVP1.DynamicViscosity_T(T1[i]);
+      k[i] = ThermoSysPro.Properties.Oil_TherminolVP1.ThermalConductivity_T(T1[i]);
+    elseif fluid == 2 then
+      T1[i] = ThermoSysPro.Properties.MoltenSalt.Temperature_h(h[i + 1]);
+      rho1[i] = ThermoSysPro.Properties.MoltenSalt.Density_T(T1[i]);
+      cp[i] = ThermoSysPro.Properties.MoltenSalt.SpecificHeatCapacityCp_T(T1[i]);
+      mu1[i] = ThermoSysPro.Properties.MoltenSalt.DynamicViscosity_T(T1[i]);
+      k[i] = ThermoSysPro.Properties.MoltenSalt.ThermalConductivity_T(T1[i]);
+    else
+      assert(false, "DynamicOnePhaseFlowPipe_SaltOil: invalid option");
+    end if;
+/* Heat exchange coefficient (using the Dittus-Boelter correlation) */
+//hc[i] = noEvent(if ((Re1[i] > 1.e-6) and (Pr[i] > 1.e-6)) then hcCorr*0.023*k[i]/D*Re1[i]^0.8*Pr[i]^0.4 else 0);
+    if noEvent(Re1[i] > 2000) then
+      hc[i] = noEvent(if Pr[i] > 1.e-6 then hcCorr * 0.023 * k[i] / D * Re1[i] ^ 0.8 * Pr[i] ^ 0.4 else 200);
+    else
+// Lévêque equation
+      hc[i] = hcCorr * 3.66 * k[i] / D;
+    end if;
+    Pr[i] = mu1[i] * cp[i] / k[i];
+    Re1[i] = noEvent(abs(4 * (Q[i] + Q[i + 1]) / 2 / (pi * Di * mu1[i])));
   end for;
 
   /* Momentum balance equations (hydraulic nodes) */
@@ -225,13 +218,11 @@
   /* Fluid densities at the boundaries of the nodes */
   for i in 2:N loop
     rhoc[i] = rho1[i - 1];
-  end for;
-
-  //proc[1] = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(P[1], h[1], mode);
-  //proc[2] = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(P[N + 1],h[N + 1], mode);
-  //rhoc[1] = proc[1].d;
-  //rhoc[N + 1] = proc[2].d;
-
+  end for;
+//proc[1] = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(P[1], h[1], mode);
+//proc[2] = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(P[N + 1],h[N + 1], mode);
+//rhoc[1] = proc[1].d;
+//rhoc[N + 1] = proc[2].d;
   rhoc[1] = rho1[1];
   rhoc[N + 1] = rhoc[N];
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Solar/Junctions/MassFlowMultiplier.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Solar/Junctions/MassFlowMultiplier.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Solar/Junctions/MassFlowMultiplier.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Solar/Junctions/MassFlowMultiplier.mo"	2022-03-10 09:58:24.332149996 +0000
@@ -2,15 +2,15 @@
 model MassFlowMultiplier "Mass flow multipliier"
   parameter Real alpha=2 "Flow multiplier";
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 public
-  Modelica.SIunits.AbsolutePressure P(start=10e5) "Fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy";
-  Modelica.SIunits.Temperature T "Fluid temperature";
 
+  Modelica.Units.SI.AbsolutePressure P(start=10e5) "Fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
 public
   WaterSteam.Connectors.FluidInlet Ce
     annotation (Placement(transformation(extent={{-110,-10},{-90,10}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Thermal/BoundaryConditions/HeatSink.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Thermal/BoundaryConditions/HeatSink.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Thermal/BoundaryConditions/HeatSink.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Thermal/BoundaryConditions/HeatSink.mo"	2022-03-10 09:58:24.276149989 +0000
@@ -4,9 +4,9 @@
   parameter Integer N=1;
 
 public
-  Modelica.SIunits.Temperature T[N] "Sink temperature";
-  Modelica.SIunits.Power W[N] "Heat power received by the sink";
 
+  Modelica.Units.SI.Temperature T[N] "Sink temperature";
+  Modelica.Units.SI.Power W[N] "Heat power received by the sink";
 public
   input ThermoSysPro.Thermal.Connectors.ThermalPort C[N]
                                                        annotation (Placement(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Thermal/BoundaryConditions/HeatSource.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Thermal/BoundaryConditions/HeatSource.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Thermal/BoundaryConditions/HeatSource.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Thermal/BoundaryConditions/HeatSource.mo"	2022-03-10 09:58:24.264149987 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Thermal.BoundaryConditions;
 model HeatSource "Heat source"
-  parameter Modelica.SIunits.Temperature T0[:]={300}
+  parameter Modelica.Units.SI.Temperature T0[:]={300}
     "Source temperature (active if option_temperature=1)";
-  parameter Modelica.SIunits.Power W0[:]={2e6}
+  parameter Modelica.Units.SI.Power W0[:]={2e6}
     "Heat power emitted by the source (active if option_temperature=2)";
   parameter Integer option_temperature=1
     "1:temperature fixed - 2:heat power fixed";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Thermal/Connectors.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Thermal/Connectors.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Thermal/Connectors.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Thermal/Connectors.mo"	2022-03-10 09:58:24.212149981 +0000
@@ -1,8 +1,8 @@
 within ThermoSysPro.Thermal;
 package Connectors "Connectors"
   connector ThermalPort "Thermal connector"
-    Modelica.SIunits.Temperature T "Temperature";
-    flow Modelica.SIunits.HeatFlowRate W
+    Modelica.Units.SI.Temperature T "Temperature";
+    flow Modelica.Units.SI.HeatFlowRate W
       "Thermal flow rate. Positive when going into the component";
     annotation (
       Diagram(coordinateSystem(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Thermal/HeatTransfer/ConvectiveHeatFlow.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Thermal/HeatTransfer/ConvectiveHeatFlow.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Thermal/HeatTransfer/ConvectiveHeatFlow.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Thermal/HeatTransfer/ConvectiveHeatFlow.mo"	2022-03-10 09:58:24.176149976 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.Thermal.HeatTransfer;
 model ConvectiveHeatFlow "Convective heat flow"
-  parameter Modelica.SIunits.Area A[:]={1} "Heat exchange surface";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer k[:]={1000}
-    "Heat exchange coefficient";
 
+  parameter Modelica.Units.SI.Area A[:]={1} "Heat exchange surface";
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer k[:]={1000}
+    "Heat exchange coefficient";
 protected
   parameter Integer N=size(A, 1);
 public
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Thermal/HeatTransfer/HeatExchangerWall.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Thermal/HeatTransfer/HeatExchangerWall.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Thermal/HeatTransfer/HeatExchangerWall.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Thermal/HeatTransfer/HeatExchangerWall.mo"	2022-03-10 09:58:24.168149975 +0000
@@ -1,15 +1,15 @@
 within ThermoSysPro.Thermal.HeatTransfer;
 model HeatExchangerWall "Heat exchanger wall"
-  parameter Modelica.SIunits.Length L=1 "Tube length";
-  parameter Modelica.SIunits.Diameter D=0.2 "Internal tube diameter";
-  parameter Modelica.SIunits.Thickness e=2.e-3 "Wall thickness";
-  parameter Modelica.SIunits.ThermalConductivity lambda=26
+  parameter Modelica.Units.SI.Length L=1 "Tube length";
+  parameter Modelica.Units.SI.Diameter D=0.2 "Internal tube diameter";
+  parameter Modelica.Units.SI.Thickness e=2.e-3 "Wall thickness";
+  parameter Modelica.Units.SI.ThermalConductivity lambda=26
     "Wall thermal conductivity";
   parameter Integer Ns=1 "Number of sections inside the wall";
-  parameter Modelica.SIunits.SpecificHeatCapacity cpw=1000
+  parameter Modelica.Units.SI.SpecificHeatCapacity cpw=1000
     "Wall specific heat capacity";
-  parameter Modelica.SIunits.Density rhow=7800 "Wall density";
-  parameter Modelica.SIunits.Temperature T0=350
+  parameter Modelica.Units.SI.Density rhow=7800 "Wall density";
+  parameter Modelica.Units.SI.Temperature T0=350
     "Initial temperature (active if steady_state=false)";
   parameter Boolean steady_state=true
     "true: start from steady state - false: start from T0";
@@ -17,20 +17,20 @@
 
 protected
   constant Real pi=Modelica.Constants.pi "pi";
-  parameter Modelica.SIunits.Length dx=L/Ns "Section length";
-  parameter Modelica.SIunits.Mass dM=ntubes*rhow*pi*((D + 2*e)^2 - D^2)/4*dx
+  parameter Modelica.Units.SI.Length dx=L/Ns "Section length";
+  parameter Modelica.Units.SI.Mass dM=ntubes*rhow*pi*((D + 2*e)^2 - D^2)/4*dx
     "Wall section mass";
 
 public
-  Modelica.SIunits.Power dW1[Ns](start=fill(3.e5, Ns), nominal=fill(3.e5, Ns))
+  Modelica.Units.SI.Power dW1[Ns](start=fill(3.e5, Ns), nominal=fill(3.e5, Ns))
     "Power in section i of side 1";
-  Modelica.SIunits.Power dW2[Ns](start=fill(3.e5, Ns), nominal=fill(3.e5, Ns))
+  Modelica.Units.SI.Power dW2[Ns](start=fill(3.e5, Ns), nominal=fill(3.e5, Ns))
     "Power in section i of side 2";
-  Modelica.SIunits.Temperature Tp1[Ns](start=fill(300, Ns))
+  Modelica.Units.SI.Temperature Tp1[Ns](start=fill(300, Ns))
     "Wall temperature in section i of side 1";
-  Modelica.SIunits.Temperature Tp2[Ns](start=fill(300, Ns))
+  Modelica.Units.SI.Temperature Tp2[Ns](start=fill(300, Ns))
     "Wall temperature in section i of side 2";
-  Modelica.SIunits.Temperature Tp[Ns](start=fill(300, Ns))
+  Modelica.Units.SI.Temperature Tp[Ns](start=fill(300, Ns))
     "Average wall temperature in section i";
 
   ThermoSysPro.Thermal.Connectors.ThermalPort WT2[Ns] "Side 2"
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Thermal/HeatTransfer/HeatExchangerWallCounterFlow.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Thermal/HeatTransfer/HeatExchangerWallCounterFlow.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Thermal/HeatTransfer/HeatExchangerWallCounterFlow.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Thermal/HeatTransfer/HeatExchangerWallCounterFlow.mo"	2022-03-10 09:58:24.148149973 +0000
@@ -1,15 +1,15 @@
 within ThermoSysPro.Thermal.HeatTransfer;
 model HeatExchangerWallCounterFlow "Heat exchanger wall counter flow "
-  parameter Modelica.SIunits.Length L=1 "Tube length";
-  parameter Modelica.SIunits.Diameter D=0.2 "Internal tube diameter";
-  parameter Modelica.SIunits.Thickness e=2.e-3 "Wall thickness";
-  parameter Modelica.SIunits.ThermalConductivity lambda=26
+  parameter Modelica.Units.SI.Length L=1 "Tube length";
+  parameter Modelica.Units.SI.Diameter D=0.2 "Internal tube diameter";
+  parameter Modelica.Units.SI.Thickness e=2.e-3 "Wall thickness";
+  parameter Modelica.Units.SI.ThermalConductivity lambda=26
     "Wall thermal conductivity";
   parameter Integer Ns=1 "Number of sections inside the wall";
-  parameter Modelica.SIunits.SpecificHeatCapacity cpw=1000
+  parameter Modelica.Units.SI.SpecificHeatCapacity cpw=1000
     "Wall specific heat capacity";
-  parameter Modelica.SIunits.Density rhow=7800 "Wall density";
-  parameter Modelica.SIunits.Temperature T0=350
+  parameter Modelica.Units.SI.Density rhow=7800 "Wall density";
+  parameter Modelica.Units.SI.Temperature T0=350
     "Initial temperature (active if steady_state=false)";
   parameter Boolean steady_state=true
     "true: start from steady state - false: start from T0";
@@ -17,20 +17,20 @@
 
 protected
   constant Real pi=Modelica.Constants.pi "pi";
-  parameter Modelica.SIunits.Length dx=L/Ns "Section length";
-  parameter Modelica.SIunits.Mass dM=ntubes*rhow*pi*((D + 2*e)^2 - D^2)/4*dx
+  parameter Modelica.Units.SI.Length dx=L/Ns "Section length";
+  parameter Modelica.Units.SI.Mass dM=ntubes*rhow*pi*((D + 2*e)^2 - D^2)/4*dx
     "Wall section mass";
 
 public
-  Modelica.SIunits.Power dW1[Ns](start=fill(3.e5, Ns), nominal=fill(3.e5, Ns))
+  Modelica.Units.SI.Power dW1[Ns](start=fill(3.e5, Ns), nominal=fill(3.e5, Ns))
     "Power in section i of side 1";
-  Modelica.SIunits.Power dW2[Ns](start=fill(3.e5, Ns), nominal=fill(3.e5, Ns))
+  Modelica.Units.SI.Power dW2[Ns](start=fill(3.e5, Ns), nominal=fill(3.e5, Ns))
     "Power in section i of side 2";
-  Modelica.SIunits.Temperature Tp1[Ns](start=fill(300, Ns))
+  Modelica.Units.SI.Temperature Tp1[Ns](start=fill(300, Ns))
     "Wall temperature in section i of side 1";
-  Modelica.SIunits.Temperature Tp2[Ns](start=fill(300, Ns))
+  Modelica.Units.SI.Temperature Tp2[Ns](start=fill(300, Ns))
     "Wall temperature in section i of side 2";
-  Modelica.SIunits.Temperature Tp[Ns](start=fill(300, Ns))
+  Modelica.Units.SI.Temperature Tp[Ns](start=fill(300, Ns))
     "Average wall temperature in section i";
 
   ThermoSysPro.Thermal.Connectors.ThermalPort WT2[Ns] "Side 2"
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Thermal/HeatTransfer/HeatExchangerWallWithLosses.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Thermal/HeatTransfer/HeatExchangerWallWithLosses.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Thermal/HeatTransfer/HeatExchangerWallWithLosses.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Thermal/HeatTransfer/HeatExchangerWallWithLosses.mo"	2022-03-10 09:58:24.128149971 +0000
@@ -1,21 +1,21 @@
 within ThermoSysPro.Thermal.HeatTransfer;
 model HeatExchangerWallWithLosses "Heat exchanger wall"
-  parameter Modelica.SIunits.Length L=10 "Tube length";
-  parameter Modelica.SIunits.Diameter D=0.03 "Internal tube diameter";
-  parameter Modelica.SIunits.Diameter D_rec=24 "receiver diameter";
-  parameter Modelica.SIunits.Diameter L_rec=10
+  parameter Modelica.Units.SI.Length L=10 "Tube length";
+  parameter Modelica.Units.SI.Diameter D=0.03 "Internal tube diameter";
+  parameter Modelica.Units.SI.Diameter D_rec=24 "receiver diameter";
+  parameter Modelica.Units.SI.Diameter L_rec=10
     "receiver height (characteristic length";
-  parameter Modelica.SIunits.Thickness e=2.e-3 "Wall thickness";
+  parameter Modelica.Units.SI.Thickness e=2.e-3 "Wall thickness";
   parameter Real Sc=0.5
     "Decrease factor of the external heat exchange surface for Solar Receiver or Boiler ";
 
-  parameter Modelica.SIunits.ThermalConductivity lambda=21
+  parameter Modelica.Units.SI.ThermalConductivity lambda=21
     "Thermal conductivity of the pipes";
   parameter Real Eps=0.6 "Tube emissivity";
-  parameter Modelica.SIunits.Thickness e_ins=0.1 "Insulation thickness";
-  parameter Modelica.SIunits.ThermalConductivity lambda_ins=0.035
+  parameter Modelica.Units.SI.Thickness e_ins=0.1 "Insulation thickness";
+  parameter Modelica.Units.SI.ThermalConductivity lambda_ins=0.035
     "Equivalent thermal conductivity of Insulation + pipes";
-  constant Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  constant Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
 
   parameter Real hcCorr1=1.00
@@ -24,10 +24,10 @@
     "Corrective term for Natural convection losses coefficient for each node";
 
   parameter Integer Ns=1 "Number of sections inside the wall";
-  parameter Modelica.SIunits.SpecificHeatCapacity cpw=480
+  parameter Modelica.Units.SI.SpecificHeatCapacity cpw=480
     "Wall specific heat capacity";
-  parameter Modelica.SIunits.Density rhow=7800 "Wall density";
-  parameter Modelica.SIunits.Temperature T0=350
+  parameter Modelica.Units.SI.Density rhow=7800 "Wall density";
+  parameter Modelica.Units.SI.Temperature T0=350
     "Initial temperature (active if steady_state=false)";
 
   parameter Boolean steady_state=true
@@ -37,53 +37,52 @@
 protected
   constant Real pi=Modelica.Constants.pi "pi";
   constant Real sigma=5.67e-8 "Bolzmann constant";
-  parameter Modelica.SIunits.Length dx=L/Ns "Section length";
+  parameter Modelica.Units.SI.Length dx=L/Ns "Section length";
   parameter Real ksD=(D+2*e)/(2*D_rec) "apparent roughness of the receiver";
-  parameter Modelica.SIunits.Mass dM=ntubes*rhow*pi*((D + 2*e)^2 - D^2)/4*dx
+  parameter Modelica.Units.SI.Mass dM=ntubes*rhow*pi*((D + 2*e)^2 - D^2)/4*dx
     "Wall section mass";
 public
-  Modelica.SIunits.Power dW1[Ns](start=fill(3.e5, Ns), nominal=fill(3.e5, Ns))
+  Modelica.Units.SI.Power dW1[Ns](start=fill(3.e5, Ns), nominal=fill(3.e5, Ns))
     "Power in section i of side 1";
-  Modelica.SIunits.Power dW2[Ns](start=fill(3.e5, Ns), nominal=fill(3.e5, Ns))
+  Modelica.Units.SI.Power dW2[Ns](start=fill(3.e5, Ns), nominal=fill(3.e5, Ns))
     "Power in section i of side 2";
-  Modelica.SIunits.Power WRad[Ns](start=fill(0,Ns))
+  Modelica.Units.SI.Power WRad[Ns](start=fill(0,Ns))
     "Radiation of the wall layer";
-  Modelica.SIunits.Power WConv[Ns](start=fill(0,Ns))
+  Modelica.Units.SI.Power WConv[Ns](start=fill(0,Ns))
     "Convection of the wall layer";
- Modelica.SIunits.Power Wrad_Total;
- Modelica.SIunits.Power Wconv_Total;
-  Modelica.SIunits.Temperature Tatm(start=300) "Atmospheric temperature";
-  Modelica.SIunits.Temperature Tfilm(start=300) "mean fluid temperature";
-  Modelica.SIunits.ThermalConductivity lambda_air( start=0.03)
+ Modelica.Units.SI.Power Wrad_Total;
+ Modelica.Units.SI.Power Wconv_Total;
+  Modelica.Units.SI.Temperature Tatm(start=300) "Atmospheric temperature";
+  Modelica.Units.SI.Temperature Tfilm(start=300) "mean fluid temperature";
+  Modelica.Units.SI.ThermalConductivity lambda_air( start=0.03)
     "Air thermal conductivity";
-  Modelica.SIunits.Density rho_air( start=1) "Air density";
-  Modelica.SIunits.Density mu_air( start=1e-6) "Air viscosity";
-  Modelica.SIunits.Temperature Tsky(start=300) "Sky temperature";
-  Modelica.SIunits.Temperature Tp1[Ns](start=fill(300, Ns))
+  Modelica.Units.SI.Density rho_air( start=1) "Air density";
+  Modelica.Units.SI.Density mu_air( start=1e-6) "Air viscosity";
+  Modelica.Units.SI.Temperature Tsky(start=300) "Sky temperature";
+  Modelica.Units.SI.Temperature Tp1[Ns](start=fill(300, Ns))
     "Wall temperature in section i of side 1";
-  Modelica.SIunits.Temperature Tp2[Ns](start=fill(300, Ns))
+  Modelica.Units.SI.Temperature Tp2[Ns](start=fill(300, Ns))
     "Wall temperature in section i of side 2";
-  Modelica.SIunits.Temperature Tp[Ns](start=fill(300, Ns))
+  Modelica.Units.SI.Temperature Tp[Ns](start=fill(300, Ns))
     "Average wall temperature in section i";
-  Modelica.SIunits.Temperature Tpm(start=300) "Average wall temperature";
-  Modelica.SIunits.CoefficientOfHeatTransfer hc_n[Ns](start=fill(5, Ns))
+  Modelica.Units.SI.Temperature Tpm(start=300) "Average wall temperature";
+  Modelica.Units.SI.CoefficientOfHeatTransfer hc_n[Ns](start=fill(5, Ns))
     "Natural Convection losses coefficient";
-  Modelica.SIunits.CoefficientOfHeatTransfer hc_f(start=11)
+  Modelica.Units.SI.CoefficientOfHeatTransfer hc_f(start=11)
     "Forced Convection losses coefficient";
-Modelica.SIunits.CoefficientOfHeatTransfer hc_f1(start=11)
+Modelica.Units.SI.CoefficientOfHeatTransfer hc_f1(start=11)
     "Forced Convection losses coefficient";
-Modelica.SIunits.CoefficientOfHeatTransfer hc_f2(start=11)
+Modelica.Units.SI.CoefficientOfHeatTransfer hc_f2(start=11)
     "Forced Convection losses coefficient";
-Modelica.SIunits.CoefficientOfHeatTransfer hc_f3(start=11)
+Modelica.Units.SI.CoefficientOfHeatTransfer hc_f3(start=11)
     "Forced Convection losses coefficient";
-  Modelica.SIunits.CoefficientOfHeatTransfer hc[Ns](start=fill(5, Ns))
+  Modelica.Units.SI.CoefficientOfHeatTransfer hc[Ns](start=fill(5, Ns))
     "Mixed Convection losses coefficient";
-  Modelica.SIunits.Velocity v_wind(start=2) "Wind Velocity";
-  Modelica.SIunits.ReynoldsNumber Re(start=6.e4) "Fluid Reynolds number ";
-  Modelica.SIunits.GrashofNumber Gr[Ns](start=fill(1.e9, Ns))
+  Modelica.Units.SI.Velocity v_wind(start=2) "Wind Velocity";
+  Modelica.Units.SI.ReynoldsNumber Re(start=6.e4) "Fluid Reynolds number ";
+  Modelica.Units.SI.GrashofNumber Gr[Ns](start=fill(1.e9, Ns))
     "Fluid Grashof number ";
- //Modelica.SIunits.Power WLosses[Ns](start=fill(10,Ns));
-
+ //Modelica.SIunits.Power WLosses[Ns](start=fill(10,Ns));
   ThermoSysPro.Thermal.Connectors.ThermalPort WT2[Ns] "Side 2"
     annotation (Placement(transformation(extent={{-10,10},{10,30}}, rotation=0)));
   ThermoSysPro.Thermal.Connectors.ThermalPort WT1[Ns] "Side 1"
@@ -186,9 +185,7 @@
     /* Convection and conduction losses: For the conduction losses: the Receiver is considered as plain wall and */
     /* For simplify: We take the Temperature of the Inside of the Insulation wall is equal to Tp1 and Outside Temperature to Tatm */
     WConv[i] = noEvent( if (Tp2[i] > Tatm) then (Sc*pi*(D+2*e)*dx*ntubes*hc[i]*(Tp2[i] - Tatm)) + (Sc*pi*(D+2*e)*dx*ntubes*lambda_ins/e_ins)*(Tp1[i] - Tatm) else 0);
-
-    //WLosses [i] = WConv[i] + WRad[i];
-
+//WLosses [i] = WConv[i] + WRad[i];
   end for;
 
 Wrad_Total=sum(WRad);
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Units.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Units.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Units.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/Units.mo"	2022-03-10 09:58:24.060149962 +0000
@@ -57,8 +57,8 @@
 "));
 
   type Pressure_bar = Real (final quantity="Pressure", final unit="bar");
-  type DifferentialPressure = Modelica.SIunits.AbsolutePressure(nominal=1.0e5, start=1.0e5, min=-1.0e9, max=1.0e9);
-  type DifferentialTemperature = Modelica.SIunits.Temperature(nominal=100, start=0, min=-6000, max=6000);
+  type DifferentialPressure = Modelica.Units.SI.AbsolutePressure(nominal=1.0e5, start=1.0e5, min=-1.0e9, max=1.0e9);
+  type DifferentialTemperature = Modelica.Units.SI.Temperature(nominal=100, start=0, min=-6000, max=6000);
   type SonicConductance = Real (final quantity="Sonic conductance", final unit="m3/(s.Pa)")
                                                               annotation (
       Documentation(info="<html>
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/BoundaryConditions/RefP.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/BoundaryConditions/RefP.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/BoundaryConditions/RefP.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/BoundaryConditions/RefP.mo"	2022-03-10 09:58:23.916149943 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.WaterSolution.BoundaryConditions;
 model RefP "Fixed pressure reference"
-  parameter Modelica.SIunits.AbsolutePressure P0=1.e5 "Fixed fluid pressure";
+  parameter Modelica.Units.SI.AbsolutePressure P0=1.e5 "Fixed fluid pressure";
 
   Connectors.WaterSolutionInlet C1
     annotation (Placement(transformation(extent={{-110,-10},{-90,10}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/BoundaryConditions/RefQ.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/BoundaryConditions/RefQ.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/BoundaryConditions/RefQ.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/BoundaryConditions/RefQ.mo"	2022-03-10 09:58:23.908149942 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.WaterSolution.BoundaryConditions;
 model RefQ "Fixed mass flow reference"
-  parameter Modelica.SIunits.MassFlowRate Q0=1.e5 "Fixed fluid mass flow";
+  parameter Modelica.Units.SI.MassFlowRate Q0=1.e5 "Fixed fluid mass flow";
 
   Connectors.WaterSolutionInlet C1
     annotation (Placement(transformation(extent={{-110,-10},{-90,10}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/BoundaryConditions/RefT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/BoundaryConditions/RefT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/BoundaryConditions/RefT.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/BoundaryConditions/RefT.mo"	2022-03-10 09:58:23.888149941 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.WaterSolution.BoundaryConditions;
 model RefT "Fixed temperature reference"
-  parameter Modelica.SIunits.Temperature T0=320 "Fixed fluid temperature";
+  parameter Modelica.Units.SI.Temperature T0=320 "Fixed fluid temperature";
 
   Connectors.WaterSolutionInlet C1
     annotation (Placement(transformation(extent={{-110,-10},{-90,10}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/BoundaryConditions/Sink.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/BoundaryConditions/Sink.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/BoundaryConditions/Sink.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/BoundaryConditions/Sink.mo"	2022-03-10 09:58:23.860149936 +0000
@@ -1,10 +1,8 @@
 within ThermoSysPro.WaterSolution.BoundaryConditions;
 model Sink "Sink"
-
-public
-  Modelica.SIunits.AbsolutePressure P "Sink pressure";
-  Modelica.SIunits.MassFlowRate Q "Mass flow rate";
-  Modelica.SIunits.Temperature T "Sink Temperature";
+  Modelica.Units.SI.AbsolutePressure P "Sink pressure";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow rate";
+  Modelica.Units.SI.Temperature T "Sink Temperature";
   Real Xh2o "h2o mas fraction";
 
   ThermoSysPro.WaterSolution.Connectors.WaterSolutionInlet Ce
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/BoundaryConditions/SinkP.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/BoundaryConditions/SinkP.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/BoundaryConditions/SinkP.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/BoundaryConditions/SinkP.mo"	2022-03-10 09:58:23.844149935 +0000
@@ -1,14 +1,14 @@
 within ThermoSysPro.WaterSolution.BoundaryConditions;
 model SinkP "Pressure sink"
-  parameter Modelica.SIunits.AbsolutePressure P0=300000 "Source pressure";
-  parameter Modelica.SIunits.Temperature T0=290 "Source temperature";
+  parameter Modelica.Units.SI.AbsolutePressure P0=300000 "Source pressure";
+  parameter Modelica.Units.SI.Temperature T0=290 "Source temperature";
   parameter Real Xh2o0=0.05 "Source water mass fraction";
 
 public
-  Modelica.SIunits.AbsolutePressure P "Fluid pressure";
-  Modelica.SIunits.MassFlowRate Q "Mass flow";
-  Modelica.SIunits.Temperature T "Fluid temperature";
-  Modelica.SIunits.SpecificEnthalpy Xh2o "Water mass fraction";
+  Modelica.Units.SI.AbsolutePressure P "Fluid pressure";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
+  Modelica.Units.SI.SpecificEnthalpy Xh2o "Water mass fraction";
 public
   ThermoSysPro.InstrumentationAndControl.Connectors.InputReal IPressure
     annotation (Placement(transformation(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/BoundaryConditions/SourceP.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/BoundaryConditions/SourceP.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/BoundaryConditions/SourceP.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/BoundaryConditions/SourceP.mo"	2022-03-10 09:58:23.824149933 +0000
@@ -1,14 +1,14 @@
 within ThermoSysPro.WaterSolution.BoundaryConditions;
 model SourceP "Pressure source"
-  parameter Modelica.SIunits.AbsolutePressure P0=300000 "Source pressure";
-  parameter Modelica.SIunits.Temperature T0=290 "Source temperature";
+  parameter Modelica.Units.SI.AbsolutePressure P0=300000 "Source pressure";
+  parameter Modelica.Units.SI.Temperature T0=290 "Source temperature";
   parameter Real Xh2o0=0.5 "Source water mass fraction";
 
 public
-  Modelica.SIunits.AbsolutePressure P "Fluid pressure";
-  Modelica.SIunits.MassFlowRate Q "Mass flow";
-  Modelica.SIunits.Temperature T "Fluid temperature";
-  Modelica.SIunits.SpecificEnthalpy Xh2o "Water mass fraction";
+  Modelica.Units.SI.AbsolutePressure P "Fluid pressure";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
+  Modelica.Units.SI.SpecificEnthalpy Xh2o "Water mass fraction";
 public
   ThermoSysPro.InstrumentationAndControl.Connectors.InputReal ITemperature
     annotation (Placement(transformation(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/BoundaryConditions/SourcePQ.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/BoundaryConditions/SourcePQ.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/BoundaryConditions/SourcePQ.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/BoundaryConditions/SourcePQ.mo"	2022-03-10 09:58:23.796149928 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.WaterSolution.BoundaryConditions;
 model SourcePQ "Pressure and mass flow source"
 
-  parameter Modelica.SIunits.AbsolutePressure P=1.e5 "Source presure";
-  parameter Modelica.SIunits.MassFlowRate Q=10 "Mass flow rate";
-  parameter Modelica.SIunits.Temperature T=300 "Source temperature";
+  parameter Modelica.Units.SI.AbsolutePressure P=1.e5 "Source presure";
+  parameter Modelica.Units.SI.MassFlowRate Q=10 "Mass flow rate";
+  parameter Modelica.Units.SI.Temperature T=300 "Source temperature";
   parameter Real Xh2o=0.05 "h2o mass fraction";
 
   ThermoSysPro.WaterSolution.Connectors.WaterSolutionOutlet Cs
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/Connectors.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/Connectors.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/Connectors.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/Connectors.mo"	2022-03-10 09:58:23.784149926 +0000
@@ -1,9 +1,9 @@
 within ThermoSysPro.WaterSolution;
 package Connectors "Connectors"
   connector WaterSolutionInlet "Water solution inlet"
-    Modelica.SIunits.AbsolutePressure P "Fluid pressure in the control volume";
-    Modelica.SIunits.Temperature T "Fluid temperature in the control volume";
-    Modelica.SIunits.MassFlowRate Q
+    Modelica.Units.SI.AbsolutePressure P "Fluid pressure in the control volume";
+    Modelica.Units.SI.Temperature T "Fluid temperature in the control volume";
+    Modelica.Units.SI.MassFlowRate Q
       "Mass flow of the fluid crossing the boundary of the control volume";
     Real Xh2o "H20 mass fraction of the solution in the control volume";
 
@@ -42,9 +42,9 @@
   end WaterSolutionInlet;
 
   connector WaterSolutionOutlet "Water solution outlet"
-    Modelica.SIunits.AbsolutePressure P "Fluid pressure in the control volume";
-    Modelica.SIunits.Temperature T "Fluid temperature in the control volume";
-    Modelica.SIunits.MassFlowRate Q
+    Modelica.Units.SI.AbsolutePressure P "Fluid pressure in the control volume";
+    Modelica.Units.SI.Temperature T "Fluid temperature in the control volume";
+    Modelica.Units.SI.MassFlowRate Q
       "Mass flow of the fluid crossing the boundary of the control volume";
     Real Xh2o "H20 mass fraction of the solution in the control volume";
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/HeatExchangers/ExchangerEfficiency.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/HeatExchangers/ExchangerEfficiency.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/HeatExchangers/ExchangerEfficiency.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/HeatExchangers/ExchangerEfficiency.mo"	2022-03-10 09:58:23.712149918 +0000
@@ -3,43 +3,43 @@
   "H2O/LiBr solution heat exchanger with prescribed efficiency"
   parameter Real Eff=0.9
     "Thermal exchange efficiency (between 0 and 1 =W/Wmax)";
-  parameter Modelica.SIunits.AbsolutePressure DPc=0
+  parameter Modelica.Units.SI.AbsolutePressure DPc=0
     "Pressure loss in the hot fluid as a percent of the pressure at the inlet";
-  parameter Modelica.SIunits.AbsolutePressure DPf=0
+  parameter Modelica.Units.SI.AbsolutePressure DPf=0
     "Pressure loss in the cold fluid as a percent of the pressure at the inlet";
 
 public
-  Modelica.SIunits.Power W(start=1e6) "Power exchanged";
-  Modelica.SIunits.Temperature Tec(start=500)
+  Modelica.Units.SI.Power W(start=1e6) "Power exchanged";
+  Modelica.Units.SI.Temperature Tec(start=500)
     "Hot fluid temperature at the inlet";
-  Modelica.SIunits.Temperature Tsc(start=400)
+  Modelica.Units.SI.Temperature Tsc(start=400)
     "Hot fluid temperature at the outlet";
-  Modelica.SIunits.Temperature Tef(start=350)
+  Modelica.Units.SI.Temperature Tef(start=350)
     "Cold fluid temperature at the inlet";
-  Modelica.SIunits.Temperature Tsf(start=450)
+  Modelica.Units.SI.Temperature Tsf(start=450)
     "Cold fluid temperature at the outlet";
-  Modelica.SIunits.SpecificEnthalpy Hec(start=5e5)
+  Modelica.Units.SI.SpecificEnthalpy Hec(start=5e5)
     "Hot fluid specific enthalpy at the inlet";
-  Modelica.SIunits.SpecificEnthalpy Hsc(start=2e5)
+  Modelica.Units.SI.SpecificEnthalpy Hsc(start=2e5)
     "Hot fluid specific enthalpy at the outlet";
-  Modelica.SIunits.SpecificEnthalpy Hef(start=1e5)
+  Modelica.Units.SI.SpecificEnthalpy Hef(start=1e5)
     "Cold fluid specific enthalpy at the inlet";
-  Modelica.SIunits.SpecificEnthalpy Hsf(start=4e5)
+  Modelica.Units.SI.SpecificEnthalpy Hsf(start=4e5)
     "Cold fluid specific enthalpy at the outlet";
-  Modelica.SIunits.Power Wmax(start=1e6) "Maximum exchangeable power";
-  Modelica.SIunits.Power Wmaxf(start=1e6)
+  Modelica.Units.SI.Power Wmax(start=1e6) "Maximum exchangeable power";
+  Modelica.Units.SI.Power Wmaxf(start=1e6)
     "Maximum power acceptable by the cold fluid";
-  Modelica.SIunits.Power Wmaxc(start=1e6)
+  Modelica.Units.SI.Power Wmaxc(start=1e6)
     "Maximum power releasable by the hot fluid";
-  Modelica.SIunits.SpecificEnthalpy Hmaxf(start=1e5)
+  Modelica.Units.SI.SpecificEnthalpy Hmaxf(start=1e5)
     "Maximum specific enthalpy reachable by the cold fluid";
-  Modelica.SIunits.SpecificEnthalpy Hminc(start=1e5)
+  Modelica.Units.SI.SpecificEnthalpy Hminc(start=1e5)
     "Minimum specific enthalpy reachable by the hot fluid";
   Real Xc(start=0.5) "H2O mass fraction in the hot fluid";
   Real Xf(start=0.5) "H2O mass fraction in the cold fluid";
-  Modelica.SIunits.MassFlowRate Qc(start=100) "Hot fluid mass flow rate";
-  Modelica.SIunits.MassFlowRate Qf(start=100) "Cold fluid mass flow rate";
-  Modelica.SIunits.SpecificEnthalpy Hliq(start=4e5)
+  Modelica.Units.SI.MassFlowRate Qc(start=100) "Hot fluid mass flow rate";
+  Modelica.Units.SI.MassFlowRate Qf(start=100) "Cold fluid mass flow rate";
+  Modelica.Units.SI.SpecificEnthalpy Hliq(start=4e5)
     "Liquid water specific enthalpy at the cold inlet";
   ThermoSysPro.Units.DifferentialTemperature DTc_ec(start=10)
     "Difference with the cristallisation temperature at the hot inlet";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/Machines/StaticCentrifugalPump.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/Machines/StaticCentrifugalPump.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/Machines/StaticCentrifugalPump.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/Machines/StaticCentrifugalPump.mo"	2022-03-10 09:58:23.580149901 +0000
@@ -7,7 +7,7 @@
     "Product of the pump mechanical and electrical efficiencies";
   parameter Boolean adiabatic_compression=false
     "true: adiabatic compression - false: non adiabatic compression";
-  parameter Modelica.SIunits.Density rho=1000 "Fluid density";
+  parameter Modelica.Units.SI.Density rho=1000 "Fluid density";
 
   parameter Real a1=-88.67
     "x^2 coef. of the pump characteristics hn = f(vol_flow) (s2/m5)";
@@ -24,24 +24,24 @@
     "Constant coef. of the pump efficiency characteristics rh = f(vol_flow) (s.u.)";
 
 protected
-  constant Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  constant Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
   parameter Real eps=1.e-6 "Small number";
   parameter Real rhmin=0.20 "Minimum efficiency to avoid zero crossings";
 
 public
   Real rh "Hydraulic efficiency";
-  Modelica.SIunits.Length hn(start=10) "Pump head";
+  Modelica.Units.SI.Length hn(start=10) "Pump head";
   Real R "Ratio VRot/VRotn (s.u.)";
-  Modelica.SIunits.MassFlowRate Q(start=500) "Mass flow";
-  Modelica.SIunits.VolumeFlowRate Qv(start=0.5) "Volumetric flow";
-  Modelica.SIunits.Power Wh "Hydraulic power";
-  Modelica.SIunits.Power Wm "Motor power";
-  Modelica.SIunits.AbsolutePressure deltaP
+  Modelica.Units.SI.MassFlowRate Q(start=500) "Mass flow";
+  Modelica.Units.SI.VolumeFlowRate Qv(start=0.5) "Volumetric flow";
+  Modelica.Units.SI.Power Wh "Hydraulic power";
+  Modelica.Units.SI.Power Wm "Motor power";
+  Modelica.Units.SI.AbsolutePressure deltaP
     "Pressure difference between the outlet and the inlet";
-  Modelica.SIunits.SpecificEnthalpy h1 "Fluid specific enthalpy at the inlet";
-  Modelica.SIunits.SpecificEnthalpy h2 "Fluid specific enthalpy at the outlet";
-  Modelica.SIunits.SpecificEnthalpy deltaH
+  Modelica.Units.SI.SpecificEnthalpy h1 "Fluid specific enthalpy at the inlet";
+  Modelica.Units.SI.SpecificEnthalpy h2 "Fluid specific enthalpy at the outlet";
+  Modelica.Units.SI.SpecificEnthalpy deltaH
     "Specific enthalpy variation between the outlet and the inlet";
   ThermoSysPro.WaterSolution.Connectors.WaterSolutionInlet C1
     annotation (Placement(transformation(extent={{-110,-10},{-90,10}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/Machines/StaticCentrifugalPumpNom.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/Machines/StaticCentrifugalPumpNom.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/Machines/StaticCentrifugalPumpNom.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/Machines/StaticCentrifugalPumpNom.mo"	2022-03-10 09:58:23.560149899 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.WaterSolution.Machines;
 model StaticCentrifugalPumpNom
   "Static centrigugal pump with nominal operating point"
-  parameter Modelica.SIunits.MassFlowRate Qnom=1 "Nominal mass flow";
+  parameter Modelica.Units.SI.MassFlowRate Qnom=1 "Nominal mass flow";
   parameter ThermoSysPro.Units.DifferentialPressure DPnom=1e5
     "Nominal pressure increase";
   parameter Real A=0.15 "x^2 coef. of the pump characteristics (A>0)";
@@ -11,11 +11,11 @@
 public
   ThermoSysPro.Units.DifferentialPressure deltaP(start=1e5)
     "Pressure difference between the outlet and the inlet";
-  Modelica.SIunits.SpecificEnthalpy He(start = 1e3)
+  Modelica.Units.SI.SpecificEnthalpy He(start = 1e3)
     "Fluid specific enthalpy at the inlet";
-  Modelica.SIunits.SpecificEnthalpy Hs(start = 1e3)
+  Modelica.Units.SI.SpecificEnthalpy Hs(start = 1e3)
     "Fluid specific enthalpy at the outlet";
-  Modelica.SIunits.Power W(start=1e6) "Mechanical power of the pump";
+  Modelica.Units.SI.Power W(start=1e6) "Mechanical power of the pump";
 
   Connectors.WaterSolutionInlet Ce
     annotation (Placement(transformation(extent={{-100,-10},{-80,10}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/PressureLosses/SingularPressureLoss.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/PressureLosses/SingularPressureLoss.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/PressureLosses/SingularPressureLoss.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSolution/PressureLosses/SingularPressureLoss.mo"	2022-03-10 09:58:23.528149895 +0000
@@ -1,7 +1,7 @@
 within ThermoSysPro.WaterSolution.PressureLosses;
 model SingularPressureLoss "Singular pressure loss"
   parameter Real K=10 "Friction pressure loss coefficient";
-  parameter Modelica.SIunits.Density rho=1000 "Fluid density";
+  parameter Modelica.Units.SI.Density rho=1000 "Fluid density";
 
 protected
   parameter Real eps=1.e-3 "Small number for pressure loss equation";
@@ -9,8 +9,8 @@
 public
   ThermoSysPro.Units.DifferentialPressure deltaPf(start=1.e2)
     "Friction pressure loss";
-  Modelica.SIunits.MassFlowRate Q(start=500) "Mass flow";
-  Modelica.SIunits.Temperature T(start=290) "Fluid temperature";
+  Modelica.Units.SI.MassFlowRate Q(start=500) "Mass flow";
+  Modelica.Units.SI.Temperature T(start=290) "Fluid temperature";
 
   ThermoSysPro.WaterSolution.Connectors.WaterSolutionInlet C1
     annotation (Placement(transformation(extent={{-100,-10},{-80,10}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Boilers/ElectricBoiler.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Boilers/ElectricBoiler.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Boilers/ElectricBoiler.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Boilers/ElectricBoiler.mo"	2022-03-10 09:58:23.488149889 +0000
@@ -1,18 +1,18 @@
 within ThermoSysPro.WaterSteam.Boilers;
 model ElectricBoiler "Electric boiler"
-  parameter Modelica.SIunits.Power W=1e6 "Electrical power";
+  parameter Modelica.Units.SI.Power W=1e6 "Electrical power";
   parameter Real eta = 100 "Boiler efficiency (percent)";
   parameter ThermoSysPro.Units.DifferentialPressure deltaP=0 "Pressure loss";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 public
-  Modelica.SIunits.Temperature Te(start=300) "Inlet temperature";
-  Modelica.SIunits.Temperature Ts(start=500) "Outlet temperature";
-  Modelica.SIunits.MassFlowRate Q(start=100) "Mass flow";
-  Modelica.SIunits.SpecificEnthalpy deltaH
-    "Specific enthalpy variation between the outlet and the inlet";
 
+  Modelica.Units.SI.Temperature Te(start=300) "Inlet temperature";
+  Modelica.Units.SI.Temperature Ts(start=500) "Outlet temperature";
+  Modelica.Units.SI.MassFlowRate Q(start=100) "Mass flow";
+  Modelica.Units.SI.SpecificEnthalpy deltaH
+    "Specific enthalpy variation between the outlet and the inlet";
 public
   Connectors.FluidInlet Ce
                           annotation (Placement(transformation(extent={{-110,
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/PlugA.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/PlugA.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/PlugA.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/PlugA.mo"	2022-03-10 09:58:23.440149884 +0000
@@ -1,10 +1,8 @@
 within ThermoSysPro.WaterSteam.BoundaryConditions;
 model PlugA "Plug"
-
-public
-  Modelica.SIunits.AbsolutePressure P "Fluid pressure";
-  Modelica.SIunits.MassFlowRate Q "Mass flow rate";
-  Modelica.SIunits.SpecificEnthalpy h "Fluid specific enthalpy";
+  Modelica.Units.SI.AbsolutePressure P "Fluid pressure";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow rate";
+  Modelica.Units.SI.SpecificEnthalpy h "Fluid specific enthalpy";
 
   Connectors.FluidOutlet C                annotation (Placement(transformation(
           extent={{90,-10},{110,10}}, rotation=0)));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/PlugB.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/PlugB.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/PlugB.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/PlugB.mo"	2022-03-10 09:58:23.424149881 +0000
@@ -1,10 +1,8 @@
 within ThermoSysPro.WaterSteam.BoundaryConditions;
 model PlugB "Plug"
-
-public
-  Modelica.SIunits.AbsolutePressure P "Fluid pressure";
-  Modelica.SIunits.MassFlowRate Q "Mass flow rate";
-  Modelica.SIunits.SpecificEnthalpy h "Fluid specific enthalpy";
+  Modelica.Units.SI.AbsolutePressure P "Fluid pressure";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow rate";
+  Modelica.Units.SI.SpecificEnthalpy h "Fluid specific enthalpy";
 
   Connectors.FluidInlet C
     annotation (Placement(transformation(extent={{-110,-10},{-90,10}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/RefH.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/RefH.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/RefH.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/RefH.mo"	2022-03-10 09:58:23.356149873 +0000
@@ -1,17 +1,17 @@
 within ThermoSysPro.WaterSteam.BoundaryConditions;
 model RefH "Fixed specific enthalpy reference"
-  parameter Modelica.SIunits.SpecificEnthalpy h0=1.e5
+  parameter Modelica.Units.SI.SpecificEnthalpy h0=1.e5
     "Fixed fluid specific enthalpy";
   parameter Boolean continuous_flow_reversal=false
     "true: continuous flow reversal - false: discontinuous flow reversal";
 
 protected
   constant Real pi=Modelica.Constants.pi "pi";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow rate for continuous flow reversal";
 
 public
-  Modelica.SIunits.MassFlowRate Q "Mass flow rate";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow rate";
   Connectors.FluidInlet C1
     annotation (Placement(transformation(extent={{-110,-10},{-90,10}}, rotation=
            0)));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/RefP.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/RefP.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/RefP.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/RefP.mo"	2022-03-10 09:58:23.340149870 +0000
@@ -1,17 +1,17 @@
 within ThermoSysPro.WaterSteam.BoundaryConditions;
 model RefP "Fixed pressure reference"
-  parameter Modelica.SIunits.AbsolutePressure P0=1.e5 "Fixed fluid pressure";
+  parameter Modelica.Units.SI.AbsolutePressure P0=1.e5 "Fixed fluid pressure";
   parameter Boolean continuous_flow_reversal=false
     "true: continuous flow reversal - false: discontinuous flow reversal";
 
 protected
   constant Real pi=Modelica.Constants.pi "pi";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow rate for continuous flow reversal";
 
 public
-  Modelica.SIunits.MassFlowRate Q "Mass flow rate";
-  Modelica.SIunits.SpecificEnthalpy h "Fluid specific enthalpy";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow rate";
+  Modelica.Units.SI.SpecificEnthalpy h "Fluid specific enthalpy";
   Connectors.FluidInlet C1
     annotation (Placement(transformation(extent={{-110,-10},{-90,10}}, rotation=
            0)));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/RefQ.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/RefQ.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/RefQ.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/RefQ.mo"	2022-03-10 09:58:23.320149869 +0000
@@ -1,16 +1,16 @@
 within ThermoSysPro.WaterSteam.BoundaryConditions;
 model RefQ "Fixed mass flow reference"
-  parameter Modelica.SIunits.MassFlowRate Q0=10 "Fixed fluid mass flow";
+  parameter Modelica.Units.SI.MassFlowRate Q0=10 "Fixed fluid mass flow";
   parameter Boolean continuous_flow_reversal=false
     "true: continuous flow reversal - false: discontinuous flow reversal";
 
 protected
   constant Real pi=Modelica.Constants.pi "pi";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow rate for continuous flow reversal";
 
 public
-  Modelica.SIunits.MassFlowRate Q "Mass flow rate";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow rate";
 
   Connectors.FluidInlet C1
     annotation (Placement(transformation(extent={{-110,-10},{-90,10}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/RefT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/RefT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/RefT.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/RefT.mo"	2022-03-10 09:58:23.304149866 +0000
@@ -1,6 +1,6 @@
 within ThermoSysPro.WaterSteam.BoundaryConditions;
 model RefT "Fixed temperature reference"
-  parameter Modelica.SIunits.Temperature T0=290 "Fixed fluid temperature";
+  parameter Modelica.Units.SI.Temperature T0=290 "Fixed fluid temperature";
   parameter Boolean continuous_flow_reversal=false
     "true: continuous flow reversal - false: discontinuous flow reversal";
   parameter Integer mode=0
@@ -8,13 +8,13 @@
 
 protected
   constant Real pi=Modelica.Constants.pi "pi";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow rate for continuous flow reversal";
 
 public
-  Modelica.SIunits.AbsolutePressure P "Fluid pressure";
-  Modelica.SIunits.MassFlowRate Q "Mass flow rate";
-  Modelica.SIunits.SpecificEnthalpy h "Fluid specific enthalpy";
+  Modelica.Units.SI.AbsolutePressure P "Fluid pressure";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow rate";
+  Modelica.Units.SI.SpecificEnthalpy h "Fluid specific enthalpy";
   Connectors.FluidInlet C1
     annotation (Placement(transformation(extent={{-110,-10},{-90,10}}, rotation=
            0)));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/Sink.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/Sink.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/Sink.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/Sink.mo"	2022-03-10 09:58:23.288149865 +0000
@@ -1,13 +1,13 @@
 within ThermoSysPro.WaterSteam.BoundaryConditions;
 model Sink "Water/steam sink"
-  parameter Modelica.SIunits.SpecificEnthalpy h0=100000
+  parameter Modelica.Units.SI.SpecificEnthalpy h0=100000
     "Fluid specific enthalpy (active if IEnthalpy connector is not connected)";
 
 public
-  Modelica.SIunits.AbsolutePressure P "Fluid pressure";
-  Modelica.SIunits.MassFlowRate Q "Mass flow rate";
-  Modelica.SIunits.SpecificEnthalpy h "Fluid specific enthalpy";
 
+  Modelica.Units.SI.AbsolutePressure P "Fluid pressure";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow rate";
+  Modelica.Units.SI.SpecificEnthalpy h "Fluid specific enthalpy";
 public
   ThermoSysPro.InstrumentationAndControl.Connectors.InputReal ISpecificEnthalpy
     annotation (Placement(transformation(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/SinkP.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/SinkP.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/SinkP.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/SinkP.mo"	2022-03-10 09:58:23.280149864 +0000
@@ -1,9 +1,9 @@
-﻿within ThermoSysPro.WaterSteam.BoundaryConditions;
+within ThermoSysPro.WaterSteam.BoundaryConditions;
 model SinkP "Water/steam sink with fixed pressure"
-  parameter Modelica.SIunits.AbsolutePressure P0=100000 "Sink pressure";
-  parameter Modelica.SIunits.Temperature T0=290
+  parameter Modelica.Units.SI.AbsolutePressure P0=100000 "Sink pressure";
+  parameter Modelica.Units.SI.Temperature T0=290
     "Sink temperature (active if option_temperature=1)";
-  parameter Modelica.SIunits.SpecificEnthalpy h0=100000
+  parameter Modelica.Units.SI.SpecificEnthalpy h0=100000
     "Sink specific enthalpy (active if option_temperature=2)";
   parameter Integer option_temperature=1
     "1:temperature fixed - 2:specific enthalpy fixed";
@@ -11,10 +11,10 @@
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 public
-  Modelica.SIunits.AbsolutePressure P "Fluid pressure";
-  Modelica.SIunits.MassFlowRate Q "Mass flow rate";
-  Modelica.SIunits.Temperature T "Fluid temperature";
-  Modelica.SIunits.SpecificEnthalpy h "Fluid enthalpy";
+  Modelica.Units.SI.AbsolutePressure P "Fluid pressure";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow rate";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
+  Modelica.Units.SI.SpecificEnthalpy h "Fluid enthalpy";
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro
     "Propriétés de l'eau"
     annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/SinkPQ.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/SinkPQ.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/SinkPQ.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/SinkPQ.mo"	2022-03-10 09:58:23.264149861 +0000
@@ -1,17 +1,17 @@
 within ThermoSysPro.WaterSteam.BoundaryConditions;
 model SinkPQ "Water/steam sink with fixed pressure and mass flow rate"
-  parameter Modelica.SIunits.AbsolutePressure P0=100000
+  parameter Modelica.Units.SI.AbsolutePressure P0=100000
     "Fluid pressure (active if IPressure connector is not connected)";
-  parameter Modelica.SIunits.MassFlowRate Q0=100
+  parameter Modelica.Units.SI.MassFlowRate Q0=100
     "Mass flow (active if IMassFlow connector is not connected)";
-  parameter Modelica.SIunits.SpecificEnthalpy h0=100000
+  parameter Modelica.Units.SI.SpecificEnthalpy h0=100000
     "Fluid specific enthalpy (active if IEnthalpy connector is not connected)";
 
 public
-  Modelica.SIunits.AbsolutePressure P "Fluid pressure";
-  Modelica.SIunits.MassFlowRate Q "Mass flow rate";
-  Modelica.SIunits.SpecificEnthalpy h "Fluid specific enthalpy";
 
+  Modelica.Units.SI.AbsolutePressure P "Fluid pressure";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow rate";
+  Modelica.Units.SI.SpecificEnthalpy h "Fluid specific enthalpy";
 public
   ThermoSysPro.InstrumentationAndControl.Connectors.InputReal IMassFlow
     annotation (Placement(transformation(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/SinkQ.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/SinkQ.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/SinkQ.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/SinkQ.mo"	2022-03-10 09:58:23.248149858 +0000
@@ -1,15 +1,15 @@
 within ThermoSysPro.WaterSteam.BoundaryConditions;
 model SinkQ "Water/steam sink with fixed mass flow rate"
-  parameter Modelica.SIunits.MassFlowRate Q0=100
+  parameter Modelica.Units.SI.MassFlowRate Q0=100
     "Mass flow (active if IMassFlow connector is not connected)";
-  parameter Modelica.SIunits.SpecificEnthalpy h0=100000
+  parameter Modelica.Units.SI.SpecificEnthalpy h0=100000
     "Fluid specific enthalpy (active if IEnthalpy connector is not connected)";
 
 public
-  Modelica.SIunits.AbsolutePressure P "Fluid pressure";
-  Modelica.SIunits.MassFlowRate Q "Mass flow rate";
-  Modelica.SIunits.SpecificEnthalpy h "Fluid specific enthalpy";
 
+  Modelica.Units.SI.AbsolutePressure P "Fluid pressure";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow rate";
+  Modelica.Units.SI.SpecificEnthalpy h "Fluid specific enthalpy";
 public
   ThermoSysPro.InstrumentationAndControl.Connectors.InputReal IMassFlow
     annotation (Placement(transformation(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/Source.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/Source.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/Source.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/Source.mo"	2022-03-10 09:58:23.236149858 +0000
@@ -1,13 +1,13 @@
 within ThermoSysPro.WaterSteam.BoundaryConditions;
 model Source "Water/steam source"
-  parameter Modelica.SIunits.SpecificEnthalpy h0=100000
+  parameter Modelica.Units.SI.SpecificEnthalpy h0=100000
     "Fluid specific enthalpy (active if IEnthalpy connector is not connected)";
 
 public
-  Modelica.SIunits.AbsolutePressure P "Fluid pressure";
-  Modelica.SIunits.MassFlowRate Q "Mass flow rate";
-  Modelica.SIunits.SpecificEnthalpy h "Fluid specific enthalpy";
 
+  Modelica.Units.SI.AbsolutePressure P "Fluid pressure";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow rate";
+  Modelica.Units.SI.SpecificEnthalpy h "Fluid specific enthalpy";
 public
   ThermoSysPro.InstrumentationAndControl.Connectors.InputReal ISpecificEnthalpy
     annotation (Placement(transformation(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/SourceP.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/SourceP.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/SourceP.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/SourceP.mo"	2022-03-10 09:58:23.228149856 +0000
@@ -1,9 +1,9 @@
-﻿within ThermoSysPro.WaterSteam.BoundaryConditions;
+within ThermoSysPro.WaterSteam.BoundaryConditions;
 model SourceP "Water/steam source with fixed pressure"
-  parameter Modelica.SIunits.AbsolutePressure P0=300000 "Source pressure";
-  parameter Modelica.SIunits.Temperature T0=290
+  parameter Modelica.Units.SI.AbsolutePressure P0=300000 "Source pressure";
+  parameter Modelica.Units.SI.Temperature T0=290
     "Source temperature (active if option_temperature=1)";
-  parameter Modelica.SIunits.SpecificEnthalpy h0=100000
+  parameter Modelica.Units.SI.SpecificEnthalpy h0=100000
     "Source specific enthalpy (active if option_temperature=2)";
   parameter Integer option_temperature=1
     "1:temperature fixed - 2:specific enthalpy fixed";
@@ -11,10 +11,10 @@
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 public
-  Modelica.SIunits.AbsolutePressure P "Fluid pressure";
-  Modelica.SIunits.MassFlowRate Q "Mass flow rate";
-  Modelica.SIunits.Temperature T "Fluid temperature";
-  Modelica.SIunits.SpecificEnthalpy h "Fluid enthalpy";
+  Modelica.Units.SI.AbsolutePressure P "Fluid pressure";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow rate";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
+  Modelica.Units.SI.SpecificEnthalpy h "Fluid enthalpy";
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro
     "Propriétés de l'eau"
     annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/SourcePQ.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/SourcePQ.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/SourcePQ.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/SourcePQ.mo"	2022-03-10 09:58:23.208149854 +0000
@@ -1,17 +1,17 @@
 within ThermoSysPro.WaterSteam.BoundaryConditions;
 model SourcePQ "Water/steam source with fixed pressure and mass flow rate"
-  parameter Modelica.SIunits.AbsolutePressure P0=300000
+  parameter Modelica.Units.SI.AbsolutePressure P0=300000
     "Fluid pressure (active if IPressure connector is not connected)";
-  parameter Modelica.SIunits.MassFlowRate Q0=100
+  parameter Modelica.Units.SI.MassFlowRate Q0=100
     "Mass flow (active if IMassFlow connector is not connected)";
-  parameter Modelica.SIunits.SpecificEnthalpy h0=100000
+  parameter Modelica.Units.SI.SpecificEnthalpy h0=100000
     "Fluid specific enthalpy (active if IEnthalpy connector is not connected)";
 
 public
-  Modelica.SIunits.AbsolutePressure P "Fluid pressure";
-  Modelica.SIunits.MassFlowRate Q "Mass flow rate";
-  Modelica.SIunits.SpecificEnthalpy h "Fluid specific enthalpy";
 
+  Modelica.Units.SI.AbsolutePressure P "Fluid pressure";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow rate";
+  Modelica.Units.SI.SpecificEnthalpy h "Fluid specific enthalpy";
 public
   ThermoSysPro.InstrumentationAndControl.Connectors.InputReal IMassFlow
     annotation (Placement(transformation(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/SourceQ.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/SourceQ.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/SourceQ.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/BoundaryConditions/SourceQ.mo"	2022-03-10 09:58:23.180149851 +0000
@@ -1,15 +1,15 @@
 within ThermoSysPro.WaterSteam.BoundaryConditions;
 model SourceQ "Water/steam source with fixed mass flow rate"
-  parameter Modelica.SIunits.MassFlowRate Q0=100
+  parameter Modelica.Units.SI.MassFlowRate Q0=100
     "Mass flow (active if IMassFlow connector is not connected)";
-  parameter Modelica.SIunits.SpecificEnthalpy h0=100000
+  parameter Modelica.Units.SI.SpecificEnthalpy h0=100000
     "Fluid specific enthalpy (active if IEnthalpy connector is not connected)";
 
 public
-  Modelica.SIunits.AbsolutePressure P "Fluid pressure";
-  Modelica.SIunits.MassFlowRate Q "Mass flow rate";
-  Modelica.SIunits.SpecificEnthalpy h "Fluid specific enthalpy";
 
+  Modelica.Units.SI.AbsolutePressure P "Fluid pressure";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow rate";
+  Modelica.Units.SI.SpecificEnthalpy h "Fluid specific enthalpy";
 public
   ThermoSysPro.InstrumentationAndControl.Connectors.InputReal IMassFlow
     annotation (Placement(transformation(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Connectors.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Connectors.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Connectors.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Connectors.mo"	2022-03-10 09:58:23.156149847 +0000
@@ -1,13 +1,13 @@
 within ThermoSysPro.WaterSteam;
 package Connectors "Connectors"
   connector FluidInlet "Water/steam inlet fluid connector"
-    Modelica.SIunits.AbsolutePressure P(start=1.e5)
+    Modelica.Units.SI.AbsolutePressure P(start=1.e5)
       "Fluid pressure in the control volume";
-    Modelica.SIunits.SpecificEnthalpy h_vol(start=1.e5)
+    Modelica.Units.SI.SpecificEnthalpy h_vol(start=1.e5)
       "Fluid specific enthalpy in the control volume";
-    Modelica.SIunits.MassFlowRate Q(start=500)
+    Modelica.Units.SI.MassFlowRate Q(start=500)
       "Mass flow rate of the fluid crossing the boundary of the control volume";
-    Modelica.SIunits.SpecificEnthalpy h(start=1.e5)
+    Modelica.Units.SI.SpecificEnthalpy h(start=1.e5)
       "Specific enthalpy of the fluid crossing the boundary of the control volume";
 
     input Boolean a=true
@@ -43,13 +43,13 @@
   end FluidInlet;
 
   connector FluidInletI "Internal water/steam inlet fluid connector"
-    Modelica.SIunits.AbsolutePressure P(start=1.e5)
+    Modelica.Units.SI.AbsolutePressure P(start=1.e5)
       "Fluid pressure in the control volume";
-    Modelica.SIunits.SpecificEnthalpy h_vol(start=1.e5)
+    Modelica.Units.SI.SpecificEnthalpy h_vol(start=1.e5)
       "Fluid specific enthalpy in the control volume";
-    Modelica.SIunits.MassFlowRate Q(start=500)
+    Modelica.Units.SI.MassFlowRate Q(start=500)
       "Mass flow rate of the fluid crossing the boundary of the control volume";
-    Modelica.SIunits.SpecificEnthalpy h(start=1.e5)
+    Modelica.Units.SI.SpecificEnthalpy h(start=1.e5)
       "Specific enthalpy of the fluid crossing the boundary of the control volume";
 
     input Boolean a
@@ -85,13 +85,13 @@
   end FluidInletI;
 
   connector FluidOutlet "Water/steam outlet fluid connector"
-    Modelica.SIunits.AbsolutePressure P(start=1.e5)
+    Modelica.Units.SI.AbsolutePressure P(start=1.e5)
       "Fluid pressure in the control volume";
-    Modelica.SIunits.SpecificEnthalpy h_vol(start=1.e5)
+    Modelica.Units.SI.SpecificEnthalpy h_vol(start=1.e5)
       "Fluid specific enthalpy in the control volume";
-    Modelica.SIunits.MassFlowRate Q(start=500)
+    Modelica.Units.SI.MassFlowRate Q(start=500)
       "Mass flow rate of the fluid crossing the boundary of the control volume";
-    Modelica.SIunits.SpecificEnthalpy h(start=1.e5)
+    Modelica.Units.SI.SpecificEnthalpy h(start=1.e5)
       "Specific enthalpy of the fluid crossing the boundary of the control volume";
 
     output Boolean a
@@ -127,13 +127,13 @@
   end FluidOutlet;
 
   connector FluidOutletI "Internal water/steam outlet fluid connector"
-    Modelica.SIunits.AbsolutePressure P(start=1.e5)
+    Modelica.Units.SI.AbsolutePressure P(start=1.e5)
       "Fluid pressure in the control volume";
-    Modelica.SIunits.SpecificEnthalpy h_vol(start=1.e5)
+    Modelica.Units.SI.SpecificEnthalpy h_vol(start=1.e5)
       "Fluid specific enthalpy in the control volume";
-    Modelica.SIunits.MassFlowRate Q(start=500)
+    Modelica.Units.SI.MassFlowRate Q(start=500)
       "Mass flow rate of the fluid crossing the boundary of the control volume";
-    Modelica.SIunits.SpecificEnthalpy h(start=1.e5)
+    Modelica.Units.SI.SpecificEnthalpy h(start=1.e5)
       "Specific enthalpy of the fluid crossing the boundary of the control volume";
 
     output Boolean a
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/CoolingTower.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/CoolingTower.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/CoolingTower.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/CoolingTower.mo"	2022-03-10 09:58:23.056149834 +0000
@@ -1,19 +1,19 @@
-﻿within ThermoSysPro.WaterSteam.HeatExchangers;
+within ThermoSysPro.WaterSteam.HeatExchangers;
 model CoolingTower "Cooling tower"
 
   parameter Integer fluid=1
     "<html>Fluid number: <br>1 - Water/Steam <br>7 - WaterSteamSimple </html>";
-  parameter Modelica.SIunits.AbsolutePressure Patm=101325
+  parameter Modelica.Units.SI.AbsolutePressure Patm=101325
     "Pressure above the fluid level";
-  parameter Modelica.SIunits.MassFlowRate Qesp=0.001;
+  parameter Modelica.Units.SI.MassFlowRate Qesp=0.001;
 
   // ---------------------   Geometrical parameters ------------------------------------------
-  parameter Modelica.SIunits.Area A=13114 "Tower cross-sectional aera";
+  parameter Modelica.Units.SI.Area A=13114 "Tower cross-sectional aera";
   parameter Real a1=1/z1 "Water/air interfacial area for the packing (m2/m3)";
-  parameter Modelica.SIunits.Height z1 = 1.6
+  parameter Modelica.Units.SI.Height z1 = 1.6
     "Height of the packing heat exchange zone";
 
-  // ----------------------  Mixing law parameters -------------------------------------------
+// ----------------------  Mixing law parameters -------------------------------------------
   parameter Real lambda=1.227 "Beta packing exchange parameter";
   parameter Real Y=0.51 "Beta packing exchange parameter";
   parameter Real p_Beta1=0
@@ -21,7 +21,7 @@
   Real Beta1
     "Coefficient de tranfert de masse d'évaporation calculé avec nn et lambda (packing)";
 
-  // ---------------------- Air parameter at the inlet of the tower --------------------------
+// ---------------------- Air parameter at the inlet of the tower --------------------------
   parameter Real Xo2as(start=0.234) "O2 mass fraction in dry air";
 
   parameter Boolean steady_state=true "true: start from steady state";
@@ -32,131 +32,131 @@
   constant Real pi=Modelica.Constants.pi "pi";
   parameter Real g=9.81 "Gravity constant";
 
-  // ----------------------  Zone 1 : packing   --------------------------
+// ----------------------  Zone 1 : packing   --------------------------
 public
   parameter Boolean packing_zone_activated=true
     "true: activation of the packing zone";
 
-  Modelica.SIunits.Volume dV "Volume of the packing exchange zone";
+  Modelica.Units.SI.Volume dV "Volume of the packing exchange zone";
   Real xeH2o "Air humidity at the inlet (kg/kg)";
-  Modelica.SIunits.MassFlowRate QsAir2
+  Modelica.Units.SI.MassFlowRate QsAir2
     "Ambiant air mass flow at the inlet of the packing zone";
-  Modelica.SIunits.SpecificEnthalpy HmAir2(start=100000)
+  Modelica.Units.SI.SpecificEnthalpy HmAir2(start=100000)
     "Ambiant air specific enthalpy at the inlet of the packing zone";
-  Modelica.SIunits.AbsolutePressure PeAir2
+  Modelica.Units.SI.AbsolutePressure PeAir2
     "Ambiant air pressure at the inlet of the packing zone";
-  Modelica.SIunits.Temperature Teair1(start=284.16)
+  Modelica.Units.SI.Temperature Teair1(start=284.16)
     "Ambiant air temperature at the inlet of the packing zone";
   Real xeH2o1 "Ambiant air humidity at the inlet of the packing zone (kg/kg)";
-  Modelica.SIunits.MassFlowRate QsAir1
+  Modelica.Units.SI.MassFlowRate QsAir1
     "Hot air mass flow at the outlet of the packing zone";
-  Modelica.SIunits.SpecificEnthalpy HmAir1( start=100000)
+  Modelica.Units.SI.SpecificEnthalpy HmAir1( start=100000)
     "Hot air specific enthalpy at the outlet of the packing zone";
-  Modelica.SIunits.Temperature Tsair1(start=300)
+  Modelica.Units.SI.Temperature Tsair1(start=300)
     "Hot air temperature at the outlet of the packing zone";
   Real xsH2o1 "Hot air humidity at the outlet of the packing zone (kg/kg)";
   Real xsO2 "Hot air O2 mass fraction at the outlet of the packing zone";
-  Modelica.SIunits.AbsolutePressure PeEau1
+  Modelica.Units.SI.AbsolutePressure PeEau1
     "Hot water pressure at the inlet of the packing zone";
-  Modelica.SIunits.MassFlowRate QeEau1
+  Modelica.Units.SI.MassFlowRate QeEau1
     "Hot water mass flow rate at the inlet of the packing zone";
-  Modelica.SIunits.SpecificEnthalpy HeEau1
+  Modelica.Units.SI.SpecificEnthalpy HeEau1
     "Hot water specific enthalpy at the inlet of the packing zone";
-  Modelica.SIunits.Temperature Teeau1
+  Modelica.Units.SI.Temperature Teeau1
     "Hot water temperature at the inlet of the packing zone";
-  Modelica.SIunits.MassFlowRate QsEau1
+  Modelica.Units.SI.MassFlowRate QsEau1
     "Cold water pressure at the outlet of the packing zone";
-  Modelica.SIunits.Temperature Tseau1( start = 300)
+  Modelica.Units.SI.Temperature Tseau1( start = 300)
     "Cold water tempretaure at the outlet of the packing zone";
-  Modelica.SIunits.SpecificEnthalpy HmEau1(start=200000)
+  Modelica.Units.SI.SpecificEnthalpy HmEau1(start=200000)
     "Cold water specific enthalpy at the outlet of the packing zone";
-  Modelica.SIunits.Power dw1
+  Modelica.Units.SI.Power dw1
     "Cooling power given by water convection and evaporation in the packing zone";
-  Modelica.SIunits.SpecificEnthalpy Hs1
+  Modelica.Units.SI.SpecificEnthalpy Hs1
     "Air specific enthalpy in the packing zone";
-  Modelica.SIunits.SpecificEnthalpy Hse1
+  Modelica.Units.SI.SpecificEnthalpy Hse1
     "Air specific enthalpy saturated at Teau in the packing zone";
-  Modelica.SIunits.MassFlowRate Qevap1
+  Modelica.Units.SI.MassFlowRate Qevap1
     "Evaporation mass flow in the packing zone";
-  Modelica.SIunits.Volume Vair1(start=20000) "Air volume in the packing zone";
-  Modelica.SIunits.Volume Veau1(start=2000) "Water volume in the packing zone";
-  Modelica.SIunits.Density rhoEair1 "Air density at the inlet";
-  Modelica.SIunits.DynamicViscosity muEair1 "Air viscosity at the inlet";
-  Modelica.SIunits.SpecificHeatCapacity CpEair1
+  Modelica.Units.SI.Volume Vair1(start=20000) "Air volume in the packing zone";
+  Modelica.Units.SI.Volume Veau1(start=2000) "Water volume in the packing zone";
+  Modelica.Units.SI.Density rhoEair1 "Air density at the inlet";
+  Modelica.Units.SI.DynamicViscosity muEair1 "Air viscosity at the inlet";
+  Modelica.Units.SI.SpecificHeatCapacity CpEair1
     "Air specific heat capacity at the inlet";
-  Modelica.SIunits.ThermalConductivity lambdaEair1
+  Modelica.Units.SI.ThermalConductivity lambdaEair1
     "Air thermal conductivity at the inlet";
-  Modelica.SIunits.Density rhoSair1 "Air density at the outlet";
-  Modelica.SIunits.DynamicViscosity muSair1 "Air viscosity at the outlet";
-  Modelica.SIunits.SpecificHeatCapacity CpSair1
+  Modelica.Units.SI.Density rhoSair1 "Air density at the outlet";
+  Modelica.Units.SI.DynamicViscosity muSair1 "Air viscosity at the outlet";
+  Modelica.Units.SI.SpecificHeatCapacity CpSair1
     "Air specific heat capacity at the outlet";
-  Modelica.SIunits.ThermalConductivity lambdaSair1
+  Modelica.Units.SI.ThermalConductivity lambdaSair1
     "Air thermal conductivity at the outlet";
-  Modelica.SIunits.Density rho1 "Water density";
+  Modelica.Units.SI.Density rho1 "Water density";
 
-  // ----------------------  Zone 2 : rain   --------------------------
+// ----------------------  Zone 2 : rain   --------------------------
   parameter Boolean rain_zone_activated=true "Activation of the rain zone";
-  parameter Modelica.SIunits.Area A2=A "Flow cross-sectional area in the tower";
-  parameter Modelica.SIunits.Height z2=z1
+  parameter Modelica.Units.SI.Area A2=A "Flow cross-sectional area in the tower";
+  parameter Modelica.Units.SI.Height z2=z1
     "Height of the exchange zone in the rain zone";
-  parameter Modelica.SIunits.Diameter Dg=0.005 "Droplets diameter";
+  parameter Modelica.Units.SI.Diameter Dg=0.005 "Droplets diameter";
   parameter Real p_Beta2=0
     "If > 0, the mass transfer coef. is fixed, otherwise it is computed";
 
   Real Beta2 "Transfer coefficient for the rain";
-  Modelica.SIunits.Velocity Ug(start=1) "Droplets velocity";
-  Modelica.SIunits.Velocity Ua "Air velocity";
+  Modelica.Units.SI.Velocity Ug(start=1) "Droplets velocity";
+  Modelica.Units.SI.Velocity Ua "Air velocity";
   Real a2 "Interfacial area water/air (m2/m3) (rain zone)";
-  Modelica.SIunits.PrandtlNumber Pr "Droplets Prandtl number";
-  Modelica.SIunits.NusseltNumber Nu "Droplets Nusselt number";
-  Modelica.SIunits.ReynoldsNumber Re "Droplets Reynols number";
-  Modelica.SIunits.Volume dV2 "Volume of the rain exchange zone";
-  Modelica.SIunits.MassFlowRate QeAir2
+  Modelica.Units.SI.PrandtlNumber Pr "Droplets Prandtl number";
+  Modelica.Units.SI.NusseltNumber Nu "Droplets Nusselt number";
+  Modelica.Units.SI.ReynoldsNumber Re "Droplets Reynols number";
+  Modelica.Units.SI.Volume dV2 "Volume of the rain exchange zone";
+  Modelica.Units.SI.MassFlowRate QeAir2
     "Air mass flow rate at the inlet of the rain zone";
-  Modelica.SIunits.SpecificEnthalpy HeAir2
+  Modelica.Units.SI.SpecificEnthalpy HeAir2
     "Air specific enthalpy at the inlet of the rain zone";
-  Modelica.SIunits.Temperature Teair2
+  Modelica.Units.SI.Temperature Teair2
     "Air temperature at the inlet of the rain zone";
-  Modelica.SIunits.Temperature Tsair2
+  Modelica.Units.SI.Temperature Tsair2
     "Air temperature at the outlet of the rain zone";
-  Modelica.SIunits.Temperature Teeau2
+  Modelica.Units.SI.Temperature Teeau2
     "Hot water temperature at the inlet of the rain zone";
-  Modelica.SIunits.Temperature Tseau2
+  Modelica.Units.SI.Temperature Tseau2
     "Cold water temperature at the outlet of the rain zone";
-  Modelica.SIunits.MassFlowRate QsEau2
+  Modelica.Units.SI.MassFlowRate QsEau2
     "Cold water mass flow rate at the outlet of the rain zone";
-  Modelica.SIunits.MassFlowRate Qevap2
+  Modelica.Units.SI.MassFlowRate Qevap2
     "Evaporation mass flow rate in the rain zone";
   Real xsH2o2 "Air humidity at the outlet of the rain zone (kg/kg)";
-  Modelica.SIunits.Power dw2
+  Modelica.Units.SI.Power dw2
     "Thermal power exchanged between the air and the droplets by convection and evaporation in the rain zone";
-  Modelica.SIunits.SpecificEnthalpy Hs2
+  Modelica.Units.SI.SpecificEnthalpy Hs2
     "Air specific enthalpy at temprature Tair in the rain zone";
-  Modelica.SIunits.SpecificEnthalpy Hse2
+  Modelica.Units.SI.SpecificEnthalpy Hse2
     "Air specific enthalpy saturated at temperature Teau in the rain zone";
   Real ng "Number of droplets";
-  Modelica.SIunits.Volume Vair2(start=20000)
+  Modelica.Units.SI.Volume Vair2(start=20000)
     "Air volume in the rain exchange zone";
-  Modelica.SIunits.Volume Veau2(start=2000)
+  Modelica.Units.SI.Volume Veau2(start=2000)
     "Water volume in the rain exchange zone";
-  Modelica.SIunits.SpecificEnthalpy HmEau2(start=200000)
+  Modelica.Units.SI.SpecificEnthalpy HmEau2(start=200000)
     "Average specific enthalpy in the rain zone";
-  Modelica.SIunits.Area SEAU "Contact area air/water";
-  Modelica.SIunits.Density rhoEair2(start=1) "Air density at the inlet";
-  Modelica.SIunits.DynamicViscosity muEair2(start=1e-6)
+  Modelica.Units.SI.Area SEAU "Contact area air/water";
+  Modelica.Units.SI.Density rhoEair2(start=1) "Air density at the inlet";
+  Modelica.Units.SI.DynamicViscosity muEair2(start=1e-6)
     "Air viscosity at the inlet";
-  Modelica.SIunits.SpecificHeatCapacity CpEair2(start=1000)
+  Modelica.Units.SI.SpecificHeatCapacity CpEair2(start=1000)
     "Air specific heat capacity at the inlet";
-  Modelica.SIunits.ThermalConductivity lambdaEair2(start=0.05)
+  Modelica.Units.SI.ThermalConductivity lambdaEair2(start=0.05)
     "Air thermal conductivity at the inlet";
-  Modelica.SIunits.Density rhoSair2 "Air density at the outlet";
-  Modelica.SIunits.DynamicViscosity muSair2(start=1e-6)
+  Modelica.Units.SI.Density rhoSair2 "Air density at the outlet";
+  Modelica.Units.SI.DynamicViscosity muSair2(start=1e-6)
     "Air viscosity at the outlet";
-  Modelica.SIunits.SpecificHeatCapacity CpSair2(start=1000)
+  Modelica.Units.SI.SpecificHeatCapacity CpSair2(start=1000)
     "Air specific heat capacity at the outlet";
-  Modelica.SIunits.ThermalConductivity lambdaSair2(start=0.05)
+  Modelica.Units.SI.ThermalConductivity lambdaSair2(start=0.05)
     "Air thermal conductivity at the outlet";
-  Modelica.SIunits.Density rho2(start=995) "Water density";
+  Modelica.Units.SI.Density rho2(start=995) "Water density";
   Real ddairhp1 "dérivé de la masse volumique de l'air par rapport à H paching";
   Real ddairhp2 "dérivé de la masse volumique de l'air par rapport à H pluie";
   Real Xh2oTeau1 "Fraction massique en H2o de l'air a Teeau zone 1";
@@ -196,7 +196,7 @@
     if (rain_zone_activated == true) and (packing_zone_activated == true) then
       der(HmAir1) = 0;
       der(HmEau1) = 0;
-      //////////der(HmAir2) = 0;
+//////////der(HmAir2) = 0;
       der(HmEau2) = 0;
     elseif (packing_zone_activated == true) then
       der(HmAir1) = 0;
@@ -260,14 +260,12 @@
 
   /* Water outlet */
   Cws2.Q = QsEau2;
-  Cws2.P = PeEau1;
-
-  //--------------------------------------------------------------------
-  // Zone 1 : packing
-  //--------------------------------------------------------------------
-
-  /* Volume of the packing exchange zone */
-  dV = A*z1;
+  Cws2.P = PeEau1;
+//--------------------------------------------------------------------
+// Zone 1 : packing
+//--------------------------------------------------------------------
+/* Volume of the packing exchange zone */
+  dV = A * z1;
   dV = Vair1 + Veau1;
 
   /* Mass balance equation for the air */
@@ -287,14 +285,12 @@
   end if;
 
   /* Air humidity at the outlet of the zone */
-  xsH2o1 = xeH2o1 + Qevap1/QsAir2;
-
-  //--------------------------------------------------------------------
-  // Zone 2 : rain
-  //--------------------------------------------------------------------
-
-  /* Volume of the rain exchange zone */
-  dV2 = A2*z2;
+  xsH2o1 = xeH2o1 + Qevap1/QsAir2;
+//--------------------------------------------------------------------
+// Zone 2 : rain
+//--------------------------------------------------------------------
+/* Volume of the rain exchange zone */
+  dV2 = A2 * z2;
   dV2 = Vair2 + Veau2;
 
   /* Mass balance equation for the air */
@@ -315,83 +311,57 @@
 
   /* Air humidity at the outlet of the zone */
   xsH2o2 = xeH2o + Qevap2/QeAir2;
-  xeH2o1 = xsH2o2;
-
-  if (rain_zone_activated == true) and (packing_zone_activated == true) then
-
-    /* Mass balance equation for the water in zone 1 */
-    der(Veau1)*pro_output1.d + Veau1*pro_output1.ddhp*der(HmEau1) = QeEau1 - QsEau1 - Qevap1;
-
-    /* Power exchanged between water and air in zone 1 */
-    dw1 = Beta1 *(Hse1 - Hs1)*a1*dV;
-
-    /* Evaporation mass flow rate in zone 1 */
-    Qevap1 = Beta1*(ThermoSysPro.Properties.FlueGases.XSat(Teeau1, PeAir2) - xeH2o1)*Vair1/z1;
-
-    /* Mass balance equation for the water in zone 2 */
-    der(Veau2)*pro_output2.d + Veau2*pro_output2.ddhp*der(HmEau2) = QsEau1 - QsEau2 - Qevap2;
-
-    /* Power exchanged between the droplets and the air in zone 2 */
-    dw2 = Beta2 *(Hse2 - Hs2)*a2*dV2;
-
-    /* Evaporation mass flow rate in zone 2 */
-    Qevap2 = Beta2*(ThermoSysPro.Properties.FlueGases.XSat(Teeau2, PeAir2) - xeH2o)*Vair2/z2;
-
-    // convergence si permanent false
-    //????????? correcte ????????????
-    QsEau1 - QsEau2 = Qevap2;
-
-    Cws1.h_vol = HmEau1;
-    Cws2.h_vol = HmEau2;
-
-  elseif (packing_zone_activated == true) then   // Packing zone
-
-    /* Mass balance equation for the water in zone 1 */
-    der(Veau1)*pro_output1.d + Veau1*pro_output1.ddhp*der(HmEau1) = QeEau1 - QsEau1 - Qevap1;
-
-    /* Power exchanged between water and air in zone 1 */
-    dw1 = Beta1 *(Hse1 - Hs1)*a1*dV;
-
-    /* Evaporation mass flow rate in zone 1 */
-    Qevap1 = Beta1*(ThermoSysPro.Properties.FlueGases.XSat(Teeau1, PeAir2) - xeH2o1)*Vair1/z1;
-
-    Veau2 = 0;
-
-    /* Power exchanged between the droplets and the air in zone 2 */
-    dw2 = 0;
-
-    /* Evaporation mass flow rate in zone 2 */
-    Qevap2 =  0;
-
-    HmEau2 = HmEau1;
-
-    Cws1.h_vol = HmEau1;
-    Cws2.h_vol = HmEau1;
-
-  elseif (rain_zone_activated == true) then  // Rain zone
-
-    Veau1 = 0;
-
-    /* Power exchanged between water and air in zone 1 */
-    dw1 = 0;
-
-    /* Evaporation mass flow rate in zone 1 */
-    Qevap1  =  0;
-
-    /* Mass balance equation in zone 2 */
-    der(Veau2)*pro_output2.d + Veau2*pro_output2.ddhp*der(HmEau2) = QsEau1 - QsEau2 - Qevap2;
-
-    /* Power exchanged between the droplets and the air in zone 2 */
-    dw2 = Beta2 *(Hse2-Hs2)*a2*dV2;
-
-    /* Evaporation mass flow rate in zone 2 */
-    Qevap2 = Beta2*(ThermoSysPro.Properties.FlueGases.XSat(Teeau2, PeAir2) - xeH2o)*Vair2/z2;
-
-    HmEau1 = HeEau1;
-
-    Cws1.h_vol = HmEau2;
-    Cws2.h_vol = HmEau2;
-
+  xeH2o1 = xsH2o2;
+  if rain_zone_activated == true and packing_zone_activated == true then
+/* Mass balance equation for the water in zone 1 */
+    der(Veau1) * pro_output1.d + Veau1 * pro_output1.ddhp * der(HmEau1) = QeEau1 - QsEau1 - Qevap1;
+/* Power exchanged between water and air in zone 1 */
+    dw1 = Beta1 * (Hse1 - Hs1) * a1 * dV;
+/* Evaporation mass flow rate in zone 1 */
+    Qevap1 = Beta1 * (ThermoSysPro.Properties.FlueGases.XSat(Teeau1, PeAir2) - xeH2o1) * Vair1 / z1;
+/* Mass balance equation for the water in zone 2 */
+    der(Veau2) * pro_output2.d + Veau2 * pro_output2.ddhp * der(HmEau2) = QsEau1 - QsEau2 - Qevap2;
+/* Power exchanged between the droplets and the air in zone 2 */
+    dw2 = Beta2 * (Hse2 - Hs2) * a2 * dV2;
+/* Evaporation mass flow rate in zone 2 */
+    Qevap2 = Beta2 * (ThermoSysPro.Properties.FlueGases.XSat(Teeau2, PeAir2) - xeH2o) * Vair2 / z2;
+// convergence si permanent false
+//????????? correcte ????????????
+    QsEau1 - QsEau2 = Qevap2;
+    Cws1.h_vol = HmEau1;
+    Cws2.h_vol = HmEau2;
+  elseif packing_zone_activated == true then
+// Packing zone
+/* Mass balance equation for the water in zone 1 */
+    der(Veau1) * pro_output1.d + Veau1 * pro_output1.ddhp * der(HmEau1) = QeEau1 - QsEau1 - Qevap1;
+/* Power exchanged between water and air in zone 1 */
+    dw1 = Beta1 * (Hse1 - Hs1) * a1 * dV;
+/* Evaporation mass flow rate in zone 1 */
+    Qevap1 = Beta1 * (ThermoSysPro.Properties.FlueGases.XSat(Teeau1, PeAir2) - xeH2o1) * Vair1 / z1;
+    Veau2 = 0;
+/* Power exchanged between the droplets and the air in zone 2 */
+    dw2 = 0;
+/* Evaporation mass flow rate in zone 2 */
+    Qevap2 = 0;
+    HmEau2 = HmEau1;
+    Cws1.h_vol = HmEau1;
+    Cws2.h_vol = HmEau1;
+  elseif rain_zone_activated == true then
+// Rain zone
+    Veau1 = 0;
+/* Power exchanged between water and air in zone 1 */
+    dw1 = 0;
+/* Evaporation mass flow rate in zone 1 */
+    Qevap1 = 0;
+/* Mass balance equation in zone 2 */
+    der(Veau2) * pro_output2.d + Veau2 * pro_output2.ddhp * der(HmEau2) = QsEau1 - QsEau2 - Qevap2;
+/* Power exchanged between the droplets and the air in zone 2 */
+    dw2 = Beta2 * (Hse2 - Hs2) * a2 * dV2;
+/* Evaporation mass flow rate in zone 2 */
+    Qevap2 = Beta2 * (ThermoSysPro.Properties.FlueGases.XSat(Teeau2, PeAir2) - xeH2o) * Vair2 / z2;
+    HmEau1 = HeEau1;
+    Cws1.h_vol = HmEau2;
+    Cws2.h_vol = HmEau2;
   end if;
 
   /* Reynols number for the droplets */
@@ -416,95 +386,72 @@
   Ua= Cair1.Q/(rhoEair2*A2);
 
   /* Droplets velocity */
-  der(Ug) = -18*muEair2*(1 + 0.15*Re^0.687)/(rho2*Dg^2)*(Ug + Ua)^2 + g;
-
-  //--------------------------------------------------------------------
-  // Fluid thermodynamic properties in the packing zone
-  //--------------------------------------------------------------------
-
-  /* Air properties as a function of temperature and humidity */
-
-  // Air inlet
-  rhoEair1 = ThermoSysPro.Properties.FlueGases.FlueGases_rho(Cair1.P, Teair1, Cair1.Xco2, xsH2o2, Xo2as*(1 - xsH2o2), Cair1.Xso2);
+  der(Ug) = -18*muEair2*(1 + 0.15*Re^0.687)/(rho2*Dg^2)*(Ug + Ua)^2 + g;
+//--------------------------------------------------------------------
+// Fluid thermodynamic properties in the packing zone
+//--------------------------------------------------------------------
+/* Air properties as a function of temperature and humidity */
+// Air inlet
+  rhoEair1 = ThermoSysPro.Properties.FlueGases.FlueGases_rho(Cair1.P, Teair1, Cair1.Xco2, xsH2o2, Xo2as * (1 - xsH2o2), Cair1.Xso2);
   CpEair1  = ThermoSysPro.Properties.FlueGases.FlueGases_cp(Cair1.P, Teair1, Cair1.Xco2, xsH2o2, Xo2as*(1 - xsH2o2), Cair1.Xso2);
   muEair1  = ThermoSysPro.Properties.FlueGases.FlueGases_mu(Cair1.P, Teair1, Cair1.Xco2, xsH2o2, Xo2as*(1 - xsH2o2), Cair1.Xso2);
-  lambdaEair1 = ThermoSysPro.Properties.FlueGases.FlueGases_k(Cair1.P, Teair1, Cair1.Xco2, xsH2o2, Xo2as*(1 - xsH2o2), Cair1.Xso2);
-
-  // Air outlet
-  rhoSair1 = ThermoSysPro.Properties.FlueGases.FlueGases_rho(Cair1.P, Tsair1, Cair2.Xco2, xsH2o1, Xo2as*(1 - xsH2o1), Cair2.Xso2);
+  lambdaEair1 = ThermoSysPro.Properties.FlueGases.FlueGases_k(Cair1.P, Teair1, Cair1.Xco2, xsH2o2, Xo2as*(1 - xsH2o2), Cair1.Xso2);
+// Air outlet
+  rhoSair1 = ThermoSysPro.Properties.FlueGases.FlueGases_rho(Cair1.P, Tsair1, Cair2.Xco2, xsH2o1, Xo2as * (1 - xsH2o1), Cair2.Xso2);
   CpSair1  = ThermoSysPro.Properties.FlueGases.FlueGases_cp(Cair1.P, Tsair1, Cair2.Xco2, xsH2o1, Xo2as*(1 - xsH2o1), Cair2.Xso2);
   muSair1  = ThermoSysPro.Properties.FlueGases.FlueGases_mu(Cair1.P, Tsair1, Cair2.Xco2, xsH2o1, Xo2as*(1 - xsH2o1), Cair2.Xso2);
-  lambdaSair1 = ThermoSysPro.Properties.FlueGases.FlueGases_k(Cair1.P, Tsair1, Cair2.Xco2, xsH2o1, Xo2as*(1 - xsH2o1), Cair2.Xso2);
-
-  // Air temperature at the inlet of zone 1
-  // changed from Fluegases_T to FlueGases_h to provide a differentiable function
-  HmAir2 = ThermoSysPro.Properties.FlueGases.FlueGases_h(Cair1.P, Teair1, Cair1.Xco2, xsH2o2, Xo2as*(1-xsH2o2), Cair1.Xso2);
-
-
-  // Air temperature at the outlet of zone 1
-  // changed from Fluegases_T to FlueGases_h to provide a differentiable function
-  HmAir1 = ThermoSysPro.Properties.FlueGases.FlueGases_h(Cair1.P, Tsair1, Cair1.Xco2, xsH2o1, Xo2as*(1 - xsH2o1), Cair1.Xso2);
-
-  //
-  Xh2oTeau1 = ThermoSysPro.Properties.FlueGases.XSat(Teeau1, PeAir2);
-
-  // Specific enthalpy of the air saturated with water
-  Hs1 = ThermoSysPro.Properties.FlueGases.FlueGases_h(Cair1.P, Teair1, Cair1.Xco2, xsH2o2, Xo2as*(1 - xsH2o2), Cair1.Xso2);
-  Hse1 = ThermoSysPro.Properties.FlueGases.FlueGases_h(Cair1.P, Teeau1, Cair1.Xco2, Xh2oTeau1,  Xo2as*(1 - Xh2oTeau1), Cair1.Xso2);
-
-  // Partial derivatives of the air density
-  ddairhp1 = ThermoSysPro.Properties.FlueGases.FlueGases_drhodh(Cair1.P, Tsair1, Cair2.Xco2, xsH2o1, Xo2as*(1 - xsH2o1), Cair2.Xso2);
-  ddairhp2 = ThermoSysPro.Properties.FlueGases.FlueGases_drhodh(Cair1.P, Tsair2, Cair1.Xco2, xsH2o2, Xo2as*(1 - xsH2o2), Cair1.Xso2);
-
-  /* Water properties as a function of pressure and specific enthalpy */
-
-  // Water inlet
+  lambdaSair1 = ThermoSysPro.Properties.FlueGases.FlueGases_k(Cair1.P, Tsair1, Cair2.Xco2, xsH2o1, Xo2as*(1 - xsH2o1), Cair2.Xso2);
+// Air temperature at the inlet of zone 1
+// changed from Fluegases_T to FlueGases_h to provide a differentiable function
+  HmAir2 = ThermoSysPro.Properties.FlueGases.FlueGases_h(Cair1.P, Teair1, Cair1.Xco2, xsH2o2, Xo2as * (1 - xsH2o2), Cair1.Xso2);
+// Air temperature at the outlet of zone 1
+// changed from Fluegases_T to FlueGases_h to provide a differentiable function
+  HmAir1 = ThermoSysPro.Properties.FlueGases.FlueGases_h(Cair1.P, Tsair1, Cair1.Xco2, xsH2o1, Xo2as * (1 - xsH2o1), Cair1.Xso2);
+//
+  Xh2oTeau1 = ThermoSysPro.Properties.FlueGases.XSat(Teeau1, PeAir2);
+// Specific enthalpy of the air saturated with water
+  Hs1 = ThermoSysPro.Properties.FlueGases.FlueGases_h(Cair1.P, Teair1, Cair1.Xco2, xsH2o2, Xo2as * (1 - xsH2o2), Cair1.Xso2);
+  Hse1 = ThermoSysPro.Properties.FlueGases.FlueGases_h(Cair1.P, Teeau1, Cair1.Xco2, Xh2oTeau1,  Xo2as*(1 - Xh2oTeau1), Cair1.Xso2);
+// Partial derivatives of the air density
+  ddairhp1 = ThermoSysPro.Properties.FlueGases.FlueGases_drhodh(Cair1.P, Tsair1, Cair2.Xco2, xsH2o1, Xo2as * (1 - xsH2o1), Cair2.Xso2);
+  ddairhp2 = ThermoSysPro.Properties.FlueGases.FlueGases_drhodh(Cair1.P, Tsair2, Cair1.Xco2, xsH2o2, Xo2as*(1 - xsH2o2), Cair1.Xso2);
+/* Water properties as a function of pressure and specific enthalpy */
+// Water inlet
   pro_input1 = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(PeEau1, HeEau1, mode);
   Teeau1 = pro_input1.T;
-  rho1 = pro_input1.d;
-
-  // Water outlet
+  rho1 = pro_input1.d;
+// Water outlet
   pro_output1 = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(PeEau1, HmEau1, mode);
-  Tseau1 = pro_output1.T;
-
-  //--------------------------------------------------------------------
-  // Fluid thermodynamic properties in the rain zone
-  //--------------------------------------------------------------------
-
-  /* Air properties as a function of temperature and humidity */
-
-  // Air inlet
+  Tseau1 = pro_output1.T;
+//--------------------------------------------------------------------
+// Fluid thermodynamic properties in the rain zone
+//--------------------------------------------------------------------
+/* Air properties as a function of temperature and humidity */
+// Air inlet
   rhoEair2 = ThermoSysPro.Properties.FlueGases.FlueGases_rho(Cair1.P, Teair2, Cair1.Xco2, Cair1.Xh2o, Cair1.Xo2, Cair1.Xso2);
   CpEair2  = ThermoSysPro.Properties.FlueGases.FlueGases_cp(Cair1.P, Teair2, Cair1.Xco2, Cair1.Xh2o, Cair1.Xo2, Cair1.Xso2);
   muEair2  = ThermoSysPro.Properties.FlueGases.FlueGases_mu(Cair1.P, Teair2, Cair1.Xco2, Cair1.Xh2o, Cair1.Xo2, Cair1.Xso2);
-  lambdaEair2 = ThermoSysPro.Properties.FlueGases.FlueGases_k(Cair1.P, Teair2, Cair1.Xco2, Cair1.Xh2o, Cair1.Xo2, Cair1.Xso2);
-
-  // Air outlet
-  rhoSair2 = ThermoSysPro.Properties.FlueGases.FlueGases_rho(Cair2.P, Tsair2, Cair1.Xco2, xsH2o2, Xo2as*(1 - xsH2o2), Cair1.Xso2);
+  lambdaEair2 = ThermoSysPro.Properties.FlueGases.FlueGases_k(Cair1.P, Teair2, Cair1.Xco2, Cair1.Xh2o, Cair1.Xo2, Cair1.Xso2);
+// Air outlet
+  rhoSair2 = ThermoSysPro.Properties.FlueGases.FlueGases_rho(Cair2.P, Tsair2, Cair1.Xco2, xsH2o2, Xo2as * (1 - xsH2o2), Cair1.Xso2);
   CpSair2 = ThermoSysPro.Properties.FlueGases.FlueGases_cp(Cair2.P, Tsair2, Cair1.Xco2, xsH2o2, Xo2as*(1 - xsH2o2), Cair1.Xso2);
   muSair2 = ThermoSysPro.Properties.FlueGases.FlueGases_mu(Cair2.P, Tsair2, Cair1.Xco2, xsH2o2, Xo2as*(1 - xsH2o2), Cair1.Xso2);
-  lambdaSair2 = ThermoSysPro.Properties.FlueGases.FlueGases_k(Cair2.P, Tsair2, Cair1.Xco2, xsH2o2, Xo2as*(1 - xsH2o2), Cair1.Xso2);
-
-  // Air specific enthalpy at the inlet
-  HeAir2  =  ThermoSysPro.Properties.FlueGases.FlueGases_h(Cair1.P, Teair2, Cair1.Xco2, Cair1.Xh2o, Cair1.Xo2, Cair1.Xso2);
-
-  // Air temperature at the outlet
-  // changed from Fluegases_T to FlueGases_h to provide a differentiable function
-  HmAir2  = ThermoSysPro.Properties.FlueGases.FlueGases_h(Cair2.P, Tsair2, Cair1.Xco2, xsH2o2, Xo2as*(1 - xsH2o2), Cair1.Xso2);
-
-  //
-  Xh2oTeau2 = ThermoSysPro.Properties.FlueGases.XSat(Teeau2, PeAir2);
-
-  // Specific enthalpy of the air saturated with water
-  Hs2  =  ThermoSysPro.Properties.FlueGases.FlueGases_h(Cair1.P, Teair2, Cair1.Xco2, Cair1.Xh2o, Cair1.Xo2, Cair1.Xso2);
-  Hse2 =  ThermoSysPro.Properties.FlueGases.FlueGases_h(Cair1.P, Teeau2, Cair1.Xco2, Xh2oTeau2, Xo2as*(1 - Xh2oTeau2), Cair1.Xso2);
-
-  // Water inlet
+  lambdaSair2 = ThermoSysPro.Properties.FlueGases.FlueGases_k(Cair2.P, Tsair2, Cair1.Xco2, xsH2o2, Xo2as*(1 - xsH2o2), Cair1.Xso2);
+// Air specific enthalpy at the inlet
+  HeAir2 = ThermoSysPro.Properties.FlueGases.FlueGases_h(Cair1.P, Teair2, Cair1.Xco2, Cair1.Xh2o, Cair1.Xo2, Cair1.Xso2);
+// Air temperature at the outlet
+// changed from Fluegases_T to FlueGases_h to provide a differentiable function
+  HmAir2 = ThermoSysPro.Properties.FlueGases.FlueGases_h(Cair2.P, Tsair2, Cair1.Xco2, xsH2o2, Xo2as * (1 - xsH2o2), Cair1.Xso2);
+//
+  Xh2oTeau2 = ThermoSysPro.Properties.FlueGases.XSat(Teeau2, PeAir2);
+// Specific enthalpy of the air saturated with water
+  Hs2 = ThermoSysPro.Properties.FlueGases.FlueGases_h(Cair1.P, Teair2, Cair1.Xco2, Cair1.Xh2o, Cair1.Xo2, Cair1.Xso2);
+  Hse2 =  ThermoSysPro.Properties.FlueGases.FlueGases_h(Cair1.P, Teeau2, Cair1.Xco2, Xh2oTeau2, Xo2as*(1 - Xh2oTeau2), Cair1.Xso2);
+// Water inlet
   pro_input2 = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(PeEau1, HmEau1, mode);
   Teeau2 = pro_input2.T;
-  rho2 = pro_input2.d;
-
-  // Water outlet
+  rho2 = pro_input2.d;
+// Water outlet
   pro_output2 = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(PeEau1, HmEau2, mode);
   Tseau2 = pro_output2.T;
 
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicCondenser.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicCondenser.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicCondenser.mo"	2022-03-10 09:57:37.992144125 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicCondenser.mo"	2022-03-10 09:58:22.884149813 +0000
@@ -1,31 +1,30 @@
 within ThermoSysPro.WaterSteam.HeatExchangers;
 model DynamicCondenser "Dynamic Cavity"
-  //parameter Modelica.SIunits.Volume Vc=4510 "Cavity total volume";
+  //parameter Modelica.SIunits.Volume Vc=4510 "Cavity total volume";
   parameter Real Vf0=0.066
     "Fraction of initial liquid volume in the Cavity (0 < Vf0 < 1)";
-  parameter Modelica.SIunits.Pressure P0c=1e4 "INitial pressure in the Cavity";
-  parameter Modelica.SIunits.Radius Rv=1.0
+  parameter Modelica.Units.SI.Pressure P0c=1e4 "INitial pressure in the Cavity";
+  parameter Modelica.Units.SI.Radius Rv=1.0
     "Radius of the Cavity cross-sectional area";
-  parameter Modelica.SIunits.Length Lv=15 "Cavity length";
-  parameter Modelica.SIunits.Length L2=14 "Pipes length";
-  parameter Modelica.SIunits.Length Lc=2.5
+  parameter Modelica.Units.SI.Length Lv=15 "Cavity length";
+  parameter Modelica.Units.SI.Length L2=14 "Pipes length";
+  parameter Modelica.Units.SI.Length Lc=2.5
     "support plate spacing in cooling zone(Chicanes)";
-  parameter Modelica.SIunits.Diameter Dc=0.016
+  parameter Modelica.Units.SI.Diameter Dc=0.016
     "Internal diameter of the cooling pipes";
-  parameter Modelica.SIunits.Thickness ec=2.e-3
+  parameter Modelica.Units.SI.Thickness ec=2.e-3
     "Thickness of the cooling pipes";
   parameter Integer Ns=10 "Number of segments for pipes";
   parameter Integer ntubest=10000 "Number of total pipes in Cavity ";
   parameter Integer ntubesV=200 "Numbers of pipes in a vertical plan in Cavity";
-  parameter Modelica.SIunits.SpecificHeatCapacity cp=460
+  parameter Modelica.Units.SI.SpecificHeatCapacity cp=460
     "Specific heat capacity of the metal of the cooling pipes";
-  parameter Modelica.SIunits.Density rho=7900
+  parameter Modelica.Units.SI.Density rho=7900
     "Density of the metal of the cooling pipes";
-  parameter Modelica.SIunits.ThermalConductivity lambda=26
+  parameter Modelica.Units.SI.ThermalConductivity lambda=26
     "Wall thermal conductivity of the cooling pipes";
-  //parameter Modelica.SIunits.CoefficientOfHeatTransfer hcond=25000
-  //  "Heat transfer coefficient between the vapor and the cooling pipes";
-
+  //parameter Modelica.SIunits.CoefficientOfHeatTransfer hcond=25000
+  //  "Heat transfer coefficient between the vapor and the cooling pipes";
   Volumes.TwoPhaseCavityOnePipe DynamicCondenser(
     Vf0=Vf0,
     P0=P0c,
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicOnePhaseFlowPipe.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicOnePhaseFlowPipe.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicOnePhaseFlowPipe.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicOnePhaseFlowPipe.mo"	2022-03-10 09:58:22.828149806 +0000
@@ -1,19 +1,19 @@
 within ThermoSysPro.WaterSteam.HeatExchangers;
 model DynamicOnePhaseFlowPipe "Dynamic one-phase flow pipe"
-  parameter Modelica.SIunits.Length L=10. "Pipe length";
-  parameter Modelica.SIunits.Diameter D=0.2 "Internal pipe diameter";
+  parameter Modelica.Units.SI.Length L=10. "Pipe length";
+  parameter Modelica.Units.SI.Diameter D=0.2 "Internal pipe diameter";
   parameter Real rugosrel=0.0007 "Pipe relative roughness";
   parameter Integer ntubes=1 "Number of pipes in parallel";
-  parameter Modelica.SIunits.Position z1=0 "Pipe inlet altitude";
-  parameter Modelica.SIunits.Position z2=0 "Pipe outlet altitude";
+  parameter Modelica.Units.SI.Position z1=0 "Pipe inlet altitude";
+  parameter Modelica.Units.SI.Position z2=0 "Pipe outlet altitude";
   parameter Real dpfCorr=1.00
     "Corrective term for the friction pressure loss (dpf) for each node";
   parameter Real hcCorr=1.00
     "Corrective term for the heat exchange coefficient (hc) for each node";
   parameter Integer Ns=10 "Number of segments";
-  parameter Modelica.SIunits.Temperature T0[Ns]=fill(290, Ns)
+  parameter Modelica.Units.SI.Temperature T0[Ns]=fill(290, Ns)
     "Initial fluid temperature (active if steady_state = false and option_temperature = 1)";
-  parameter Modelica.SIunits.SpecificEnthalpy h0[Ns]=fill(1e5, Ns)
+  parameter Modelica.Units.SI.SpecificEnthalpy h0[Ns]=fill(1e5, Ns)
     "Initial fluid specific enthalpy (active if steady_state = false and option_temperature = 2)";
   parameter Boolean inertia=true
     "true: momentum balance equation with inertia - false: without inertia";
@@ -33,60 +33,60 @@
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 protected
-  constant Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  constant Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
   constant Real pi=Modelica.Constants.pi "pi";
   parameter Real eps=1.e-0 "Small number for pressure loss equation";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow rate for continuous flow reversal";
   parameter Integer N=Ns + 1
     "Number of hydraulic nodes (= number of thermal nodes + 1)";
-  parameter Modelica.SIunits.Area A=ntubes*pi*D^2/4
+  parameter Modelica.Units.SI.Area A=ntubes*pi*D^2/4
     "Internal cross sectional pipe area";
-  parameter Modelica.SIunits.Diameter Di=ntubes*D "Internal pipe diameter";
-  parameter Modelica.SIunits.PathLength dx1=L/(N - 1)
+  parameter Modelica.Units.SI.Diameter Di=ntubes*D "Internal pipe diameter";
+  parameter Modelica.Units.SI.PathLength dx1=L/(N - 1)
     "Length of a thermal node";
-  parameter Modelica.SIunits.PathLength dx2=L/N "Length of a hydraulic node";
-  parameter Modelica.SIunits.Area dSi=pi*Di*dx1
+  parameter Modelica.Units.SI.PathLength dx2=L/N "Length of a hydraulic node";
+  parameter Modelica.Units.SI.Area dSi=pi*Di*dx1
     "Internal heat exchange area for a node";
 
 public
-  Modelica.SIunits.AbsolutePressure P[N + 1](start=fill(1.e5, N + 1), nominal=fill(1.e5, N + 1))
+  Modelica.Units.SI.AbsolutePressure P[N + 1](start=fill(1.e5, N + 1), nominal=fill(1.e5, N + 1))
     "Fluid pressure in node i";
-  Modelica.SIunits.MassFlowRate Q[N](start=fill(10, N), nominal=fill(10, N))
+  Modelica.Units.SI.MassFlowRate Q[N](start=fill(10, N), nominal=fill(10, N))
     "Mass flow rate in node i";
-  Modelica.SIunits.SpecificEnthalpy h[N + 1](start=fill(1.e5, N + 1), nominal=fill(1.e6, N + 1))
+  Modelica.Units.SI.SpecificEnthalpy h[N + 1](start=fill(1.e5, N + 1), nominal=fill(1.e6, N + 1))
     "Fluid specific enthalpy in node i";
-  Modelica.SIunits.SpecificEnthalpy hb[N]
+  Modelica.Units.SI.SpecificEnthalpy hb[N]
     "Fluid specific enthalpy at the boundary of node i";
-  Modelica.SIunits.Density rho1[N - 1](start=fill(998, N - 1), nominal=fill(1, N - 1))
+  Modelica.Units.SI.Density rho1[N - 1](start=fill(998, N - 1), nominal=fill(1, N - 1))
     "Fluid density in thermal node i";
-  Modelica.SIunits.Density rho2[N](start=fill(998, N), nominal=fill(1, N))
+  Modelica.Units.SI.Density rho2[N](start=fill(998, N), nominal=fill(1, N))
     "Fluid density in hydraulic node i";
-  Modelica.SIunits.Density rhoc[N + 1](start=fill(998, N + 1), nominal=fill(1, N + 1))
+  Modelica.Units.SI.Density rhoc[N + 1](start=fill(998, N + 1), nominal=fill(1, N + 1))
     "Fluid density at the boudary of node i";
-  Modelica.SIunits.Power dW1[N - 1](start=fill(3.e5, N - 1), nominal=fill(3.e5, N - 1))
+  Modelica.Units.SI.Power dW1[N - 1](start=fill(3.e5, N - 1), nominal=fill(3.e5, N - 1))
     "Thermal power exchanged on the water side for node i";
-  Modelica.SIunits.Power W1t "Total power exchanged on the water side";
-  Modelica.SIunits.Temperature Tp[N - 1](start=T0) "Wall temperature in node i";
-  Modelica.SIunits.CoefficientOfHeatTransfer hc[N - 1](start=fill(2000, N - 1), nominal=fill(200, N - 1))
+  Modelica.Units.SI.Power W1t "Total power exchanged on the water side";
+  Modelica.Units.SI.Temperature Tp[N - 1](start=T0) "Wall temperature in node i";
+  Modelica.Units.SI.CoefficientOfHeatTransfer hc[N - 1](start=fill(2000, N - 1), nominal=fill(200, N - 1))
     "Fluid heat exchange coefficient in node i";
-  Modelica.SIunits.ReynoldsNumber Re1[N - 1](start=fill(6.e4, N - 1), nominal=fill(0.5e4, N - 1))
+  Modelica.Units.SI.ReynoldsNumber Re1[N - 1](start=fill(6.e4, N - 1), nominal=fill(0.5e4, N - 1))
     "Fluid Reynolds number in thermal node i";
-  Modelica.SIunits.ReynoldsNumber Re2[N](start=fill(6.e4, N), nominal=fill(0.5e4, N))
+  Modelica.Units.SI.ReynoldsNumber Re2[N](start=fill(6.e4, N), nominal=fill(0.5e4, N))
     "Fluid Reynolds number in hydraulic node i";
   Real Pr[N - 1](start=fill(4, N - 1), nominal=fill(1, N - 1))
     "Fluid Prandtl number in node i";
-  Modelica.SIunits.ThermalConductivity k[N - 1](start=fill(0.6, N - 1), nominal=fill(0.6, N - 1))
+  Modelica.Units.SI.ThermalConductivity k[N - 1](start=fill(0.6, N - 1), nominal=fill(0.6, N - 1))
     "Fluid thermal conductivity in node i";
-  Modelica.SIunits.DynamicViscosity mu1[N - 1](start=fill(2.e-4, N - 1), nominal=fill(2.e-4, N - 1))
+  Modelica.Units.SI.DynamicViscosity mu1[N - 1](start=fill(2.e-4, N - 1), nominal=fill(2.e-4, N - 1))
     "Fluid dynamic viscosity in thermal node i";
-  Modelica.SIunits.DynamicViscosity mu2[N](start=fill(2.e-4, N), nominal=fill(2.e-4, N))
+  Modelica.Units.SI.DynamicViscosity mu2[N](start=fill(2.e-4, N), nominal=fill(2.e-4, N))
     "Fluid dynamic viscosity in hydraulic node i";
-  Modelica.SIunits.SpecificHeatCapacity cp[N - 1](start=fill(4000, N - 1), nominal=fill(4000, N - 1))
+  Modelica.Units.SI.SpecificHeatCapacity cp[N - 1](start=fill(4000, N - 1), nominal=fill(4000, N - 1))
     "Fluid specific heat capacity";
-  Modelica.SIunits.Temperature T1[N - 1] "Fluid temperature in thermal node i";
-  Modelica.SIunits.Temperature T2[N] "Fluid temperature in hydraulic node i";
+  Modelica.Units.SI.Temperature T1[N - 1] "Fluid temperature in thermal node i";
+  Modelica.Units.SI.Temperature T2[N] "Fluid temperature in hydraulic node i";
   ThermoSysPro.Units.DifferentialPressure dpa[N]
     "Advection term for the mass balance equation in node i";
   ThermoSysPro.Units.DifferentialPressure dpf[N]
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicOnePhaseFlowShell.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicOnePhaseFlowShell.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicOnePhaseFlowShell.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicOnePhaseFlowShell.mo"	2022-03-10 09:58:22.748149795 +0000
@@ -1,25 +1,25 @@
 within ThermoSysPro.WaterSteam.HeatExchangers;
 model DynamicOnePhaseFlowShell "Dynamic one-phase flow shell"
   parameter Integer option_arrangement = 1 "1:triangle - 2: square";
-  parameter Modelica.SIunits.Length L=12 "Shell length";
-  parameter Modelica.SIunits.Diameter Ds = 1 "shell internal diameter";
-  parameter Modelica.SIunits.Diameter De = 0.019 "tube external diameter";
-  parameter Modelica.SIunits.Distance dc = 0.030
+  parameter Modelica.Units.SI.Length L=12 "Shell length";
+  parameter Modelica.Units.SI.Diameter Ds = 1 "shell internal diameter";
+  parameter Modelica.Units.SI.Diameter De = 0.019 "tube external diameter";
+  parameter Modelica.Units.SI.Distance dc = 0.030
     "Central distance of two tubes";
-  parameter Modelica.SIunits.Length B = 1.2
+  parameter Modelica.Units.SI.Length B = 1.2
     "distance between two plates in the shell";
   parameter Real rugosrel=0.0007 "Pipe relative roughness";
   parameter Integer ntubes=500 "Number of pipes in parallel";
-  parameter Modelica.SIunits.Position z1=0 "Pipe inlet altitude";
-  parameter Modelica.SIunits.Position z2=0 "Pipe outlet altitude";
+  parameter Modelica.Units.SI.Position z1=0 "Pipe inlet altitude";
+  parameter Modelica.Units.SI.Position z2=0 "Pipe outlet altitude";
   parameter Real dpfCorr=1.00
     "Corrective term for the friction pressure loss (dpf) for each node";
   parameter Real hcCorr=1.00
     "Corrective term for the heat exchange coefficient (hc) for each node";
   parameter Integer Ns=10 "Number of segments";
-  parameter Modelica.SIunits.Temperature T0[Ns]=fill(290, Ns)
+  parameter Modelica.Units.SI.Temperature T0[Ns]=fill(290, Ns)
     "Initial fluid temperature (active if steady_state = false and option_temperature = 1)";
-  parameter Modelica.SIunits.SpecificEnthalpy h0[Ns]=fill(1e5, Ns)
+  parameter Modelica.Units.SI.SpecificEnthalpy h0[Ns]=fill(1e5, Ns)
     "Initial fluid specific enthalpy (active if steady_state = false and option_temperature = 2)";
   parameter Boolean inertia=true
     "true: momentum balance equation with inertia - false: without inertia";
@@ -39,67 +39,67 @@
     "true: continuous flow reversal - false: discontinuous flow reversal";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
-  parameter Modelica.SIunits.Area As = B*Ds*dt/dc
+  parameter Modelica.Units.SI.Area As = B*Ds*dt/dc
     "maximum cross sectional area of flow in shell";
-  parameter Modelica.SIunits.Area A = pi*Ds^2/4 - ntubes*pi*De^2/4
+  parameter Modelica.Units.SI.Area A = pi*Ds^2/4 - ntubes*pi*De^2/4
     "Liquid cross sectional in shell";
 
 protected
   parameter Integer Nb = integer(floor(L/B));
-  parameter Modelica.SIunits.Distance dt = dc - De "distance between two tubes";
-  constant Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  parameter Modelica.Units.SI.Distance dt = dc - De "distance between two tubes";
+  constant Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
   constant Real pi=Modelica.Constants.pi "pi";
   parameter Real eps=1.e-0 "Small number for pressure loss equation";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow rate for continuous flow reversal";
   parameter Integer N=Ns + 1
     "Number of hydraulic nodes (= number of thermal nodes + 1)";
-  parameter Modelica.SIunits.Diameter Deq = if (option_arrangement ==1) then (3.464*dc^2 - pi*De^2)/(pi*De) else if (option_arrangement ==2) then (4*dc^2 - pi*De^2)/(pi*De) else De
+  parameter Modelica.Units.SI.Diameter Deq = if (option_arrangement ==1) then (3.464*dc^2 - pi*De^2)/(pi*De) else if (option_arrangement ==2) then (4*dc^2 - pi*De^2)/(pi*De) else De
     "equivalent diameter of triangle arrangement between tubes";
-  parameter Modelica.SIunits.Area dSi=pi*De*ntubes*dx1
+  parameter Modelica.Units.SI.Area dSi=pi*De*ntubes*dx1
     "Internal heat exchange area for a node";
-  parameter Modelica.SIunits.PathLength dx1=L/(N - 1)
+  parameter Modelica.Units.SI.PathLength dx1=L/(N - 1)
     "Length of a thermal node";
-  parameter Modelica.SIunits.PathLength dx2=L/N "Length of a hydraulic node";
+  parameter Modelica.Units.SI.PathLength dx2=L/N "Length of a hydraulic node";
 
 public
-  Modelica.SIunits.AbsolutePressure P[N + 1](start=fill(1.e5, N + 1), nominal=fill(1.e5, N + 1))
+  Modelica.Units.SI.AbsolutePressure P[N + 1](start=fill(1.e5, N + 1), nominal=fill(1.e5, N + 1))
     "Fluid pressure in node i";
-  Modelica.SIunits.MassFlowRate Q[N](start=fill(10, N), nominal=fill(10, N))
+  Modelica.Units.SI.MassFlowRate Q[N](start=fill(10, N), nominal=fill(10, N))
     "Mass flow rate in node i";
-  Modelica.SIunits.SpecificEnthalpy h[N + 1](start=fill(1.e5, N + 1), nominal=fill(1.e6, N + 1))
+  Modelica.Units.SI.SpecificEnthalpy h[N + 1](start=fill(1.e5, N + 1), nominal=fill(1.e6, N + 1))
     "Fluid specific enthalpy in node i";
-  Modelica.SIunits.SpecificEnthalpy hb[N]
+  Modelica.Units.SI.SpecificEnthalpy hb[N]
     "Fluid specific enthalpy at the boundary of node i";
-  Modelica.SIunits.Density rho1[N - 1](start=fill(998, N - 1), nominal=fill(1, N - 1))
+  Modelica.Units.SI.Density rho1[N - 1](start=fill(998, N - 1), nominal=fill(1, N - 1))
     "Fluid density in thermal node i";
-  Modelica.SIunits.Density rho2[N](start=fill(998, N), nominal=fill(1, N))
+  Modelica.Units.SI.Density rho2[N](start=fill(998, N), nominal=fill(1, N))
     "Fluid density in hydraulic node i";
-  Modelica.SIunits.Density rhoc[N + 1](start=fill(998, N + 1), nominal=fill(1, N + 1))
+  Modelica.Units.SI.Density rhoc[N + 1](start=fill(998, N + 1), nominal=fill(1, N + 1))
     "Fluid density at the boudary of node i";
-  Modelica.SIunits.Power dW1[N - 1](start=fill(3.e5, N - 1), nominal=fill(3.e5, N - 1))
+  Modelica.Units.SI.Power dW1[N - 1](start=fill(3.e5, N - 1), nominal=fill(3.e5, N - 1))
     "Thermal power exchanged on the water side for node i";
-  Modelica.SIunits.Power W1t "Total power exchanged on the water side";
-  Modelica.SIunits.Temperature Tp[N - 1](start=T0) "Wall temperature in node i";
-  Modelica.SIunits.CoefficientOfHeatTransfer hc[N - 1](start=fill(2000, N - 1), nominal=fill(200, N - 1))
+  Modelica.Units.SI.Power W1t "Total power exchanged on the water side";
+  Modelica.Units.SI.Temperature Tp[N - 1](start=T0) "Wall temperature in node i";
+  Modelica.Units.SI.CoefficientOfHeatTransfer hc[N - 1](start=fill(2000, N - 1), nominal=fill(200, N - 1))
     "Fluid heat exchange coefficient in node i";
-  Modelica.SIunits.ReynoldsNumber Re1[N - 1](start=fill(6.e4, N - 1), nominal=fill(0.5e4, N - 1))
+  Modelica.Units.SI.ReynoldsNumber Re1[N - 1](start=fill(6.e4, N - 1), nominal=fill(0.5e4, N - 1))
     "Fluid Reynolds number in thermal node i";
-  Modelica.SIunits.ReynoldsNumber Re2[N](start=fill(6.e4, N), nominal=fill(0.5e4, N))
+  Modelica.Units.SI.ReynoldsNumber Re2[N](start=fill(6.e4, N), nominal=fill(0.5e4, N))
     "Fluid Reynolds number in hydraulic node i";
   Real Pr[N - 1](start=fill(4, N - 1), nominal=fill(1, N - 1))
     "Fluid Prandtl number in node i";
-  Modelica.SIunits.ThermalConductivity k[N - 1](start=fill(0.6, N - 1), nominal=fill(0.6, N - 1))
+  Modelica.Units.SI.ThermalConductivity k[N - 1](start=fill(0.6, N - 1), nominal=fill(0.6, N - 1))
     "Fluid thermal conductivity in node i";
-  Modelica.SIunits.DynamicViscosity mu1[N - 1](start=fill(2.e-4, N - 1), nominal=fill(2.e-4, N - 1))
+  Modelica.Units.SI.DynamicViscosity mu1[N - 1](start=fill(2.e-4, N - 1), nominal=fill(2.e-4, N - 1))
     "Fluid dynamic viscosity in thermal node i";
-  Modelica.SIunits.DynamicViscosity mu2[N](start=fill(2.e-4, N), nominal=fill(2.e-4, N))
+  Modelica.Units.SI.DynamicViscosity mu2[N](start=fill(2.e-4, N), nominal=fill(2.e-4, N))
     "Fluid dynamic viscosity in hydraulic node i";
-  Modelica.SIunits.SpecificHeatCapacity cp[N - 1](start=fill(4000, N - 1), nominal=fill(4000, N - 1))
+  Modelica.Units.SI.SpecificHeatCapacity cp[N - 1](start=fill(4000, N - 1), nominal=fill(4000, N - 1))
     "Fluid specific heat capacity";
-  Modelica.SIunits.Temperature T1[N - 1] "Fluid temperature in thermal node i";
-  Modelica.SIunits.Temperature T2[N] "Fluid temperature in hydraulic node i";
+  Modelica.Units.SI.Temperature T1[N - 1] "Fluid temperature in thermal node i";
+  Modelica.Units.SI.Temperature T2[N] "Fluid temperature in hydraulic node i";
   ThermoSysPro.Units.DifferentialPressure dpa[N]
     "Advection term for the mass balance equation in node i";
   ThermoSysPro.Units.DifferentialPressure dpf[N]
@@ -108,7 +108,7 @@
     "Gravity pressure loss in node i";
   Real lambda[N](start=fill(0.03, N), nominal=fill(0.03, N))
     "Friction pressure loss coefficient in node i";
-  Modelica.SIunits.Diameter Deq1;
+  Modelica.Units.SI.Diameter Deq1;
 
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro1[
                                                               N - 1]
@@ -189,97 +189,76 @@
   hb[N] = C2.h;
 
   h[1] = C1.h_vol;
-  h[N + 1] = C2.h_vol;
-
-  /* Mass and energy balance equations (thermal nodes) */
-  for i in 1:N - 1 loop
-    /* Mass balance equation */
-    if dynamic_mass_balance then
-      A*(pro1[i].ddph*der(P[i + 1]) + pro1[i].ddhp*der(h[i + 1]))*dx1 = Q[i] - Q[i + 1];
-    else
-      0 = Q[i] - Q[i + 1];
-    end if;
-
-    /* Energy balance equation */
-    if dynamic_energy_balance then
-      if simplified_dynamic_energy_balance then
-        A*(-der(P[i + 1]) + rho1[i]*der(h[i + 1]))*dx1 = hb[i]*Q[i] - hb[i + 1]*Q[i + 1] + dW1[i];
-      else
-        A*((h[i + 1]*pro1[i].ddph - 1)*der(P[i + 1]) + (h[i + 1]*pro1[i].ddhp + rho1[i])*der(h[i + 1]))*dx1 = hb[i]*Q[i] - hb[i + 1]*Q[i + 1] + dW1[i];
-      end if;
-    else
-      A*rho1[i]*der(h[i + 1])*dx1 = hb[i]*Q[i] - hb[i + 1]*Q[i + 1] + dW1[i];
-    end if;
-
-    /* Heat transfer at the wall */
-    dW1[i] = hc[i]*dSi*(Tp[i] - T1[i]);
-
-    /* Fluid thermodynamic properties */
-    pro1[i] = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(P[i + 1], h[i + 1], mode);
-
-    rho1[i] = pro1[i].d;
-    T1[i] = pro1[i].T;
-
-    (lsat[i],vsat[i]) = ThermoSysPro.Properties.WaterSteam.IF97.Water_sat_P(P[i + 1]);
-
-    cp[i] = pro1[i].cp;
-
-    mu1[i] = ThermoSysPro.Properties.WaterSteam.IF97.DynamicViscosity_rhoT(rho1[i], T1[i]);
-    k[i] = noEvent(ThermoSysPro.Properties.WaterSteam.IF97.ThermalConductivity_rhoT(rho1[i], T1[i], P[i + 1]));
-
-    /* Heat exchange coefficient (using the Dittus-Boelter correlation) */
-    Pr[i] = mu1[i]*cp[i]/k[i];
-    Re1[i] = noEvent(abs(De*(Q[i] + Q[i + 1])/(2*As*mu1[i])));
-
-    hc[i] = hcCorr*(noEvent(if (Re1[i] < 2000) then 0.5*(k[i]/De)*Re1[i]^0.507*Pr[i]^0.33 else if ((Re1[i] > 2000) and (Re1[i] < 1e6)) then 0.36 * (k[i]/De) *Re1[i]^0.55*Pr[i]^0.33 else 0.023*k[i]/De*Re1[i]^0.8*Pr[i]^0.4));
-    //hc[i] = noEvent(if ((Re1[i] > 1.e-6) and (Pr[i] > 1.e-6)) then hcCorr*0.023*k[i]/D*Re1[i]^0.8*Pr[i]^0.4 else 0);
-
-  end for;
-
-  /* Momentum balance equations (hydraulic nodes) */
-  for i in 1:N loop
-    /* Flow reversal */
-    if continuous_flow_reversal then
-      0 = noEvent(if (Q[i] > Qeps) then hb[i] - h[i] else if (Q[i] < -Qeps) then
-        hb[i] - h[i + 1] else hb[i] - 0.5*((h[i] - h[i + 1])*Modelica.Math.sin(pi*Q[i]/2/Qeps) + h[i + 1] + h[i]));
-    else
-      0 = if (Q[i] > 0) then hb[i] - h[i] else hb[i] - h[i + 1];
-    end if;
-
-    /* Momentum balance equation */
-    if inertia then
-      1/As*der(Q[i])*dx2 = P[i] - P[i + 1] - dpf[i] - dpg[i] - dpa[i];
-    else
-      P[i] - P[i + 1] - dpf[i] - dpg[i] - dpa[i] = 0;
-    end if;
-
-    /* Advection term */
-    if advection then
-      dpa[i] = Q[i]^2*(1/rhoc[i + 1] - 1/rhoc[i])/As^2;
-    else
-      dpa[i] = 0;
-    end if;
-
-    /* Fluid thermodynamic properties */
-    pro2[i] = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph((P[i] + P[i + 1])/2,hb[i], mode);
-
-    rho2[i] = pro2[i].d;
-    T2[i] = pro2[i].T;
-
-    mu2[i] = ThermoSysPro.Properties.WaterSteam.IF97.DynamicViscosity_rhoT(rho2[i], T2[i]);
-    //Re2[i] = noEvent(abs(Deq*Q[i]/(As*mu2[i])));
-    Re2[i] = noEvent(De*abs(Q[i])/(As*mu2[i]));
-
-    /* Gravity pressure losses */
-    dpg[i] = rho2[i]*g*(z2 - z1)*dx2/L;
-
-    /* Friction pressure losses */
-    // Ds/dc is the number of rows
-    //dpf[i] = noEvent(dpfCorr*Ds/dc*lambda[i]*Q[i]*abs(Q[i])/(2*As^2*rho2[i]));
-   dpf[i] = noEvent(dpfCorr*Ds/dc*(Nb +1)*lambda[i]*Q[i]*abs(Q[i])/(2*As^2*rho2[i])/N);
-
-    //lambda[i] = if noEvent(Re2[i] > 1) then 0.25*(Modelica.Math.log10(13/Re2[i] + rugosrel/3.7/De))^(-2) else 0.01;
-    lambda[i] = Modelica.Math.exp(0.576-0.19*Modelica.Math.log(Re2[i]));
+  h[N + 1] = C2.h_vol;
+/* Mass and energy balance equations (thermal nodes) */
+  for i in 1:N - 1 loop
+/* Mass balance equation */
+    if dynamic_mass_balance then
+      A * (pro1[i].ddph * der(P[i + 1]) + pro1[i].ddhp * der(h[i + 1])) * dx1 = Q[i] - Q[i + 1];
+    else
+      0 = Q[i] - Q[i + 1];
+    end if;
+/* Energy balance equation */
+    if dynamic_energy_balance then
+      if simplified_dynamic_energy_balance then
+        A * ((-der(P[i + 1])) + rho1[i] * der(h[i + 1])) * dx1 = hb[i] * Q[i] - hb[i + 1] * Q[i + 1] + dW1[i];
+      else
+        A * ((h[i + 1] * pro1[i].ddph - 1) * der(P[i + 1]) + (h[i + 1] * pro1[i].ddhp + rho1[i]) * der(h[i + 1])) * dx1 = hb[i] * Q[i] - hb[i + 1] * Q[i + 1] + dW1[i];
+      end if;
+    else
+      A * rho1[i] * der(h[i + 1]) * dx1 = hb[i] * Q[i] - hb[i + 1] * Q[i + 1] + dW1[i];
+    end if;
+/* Heat transfer at the wall */
+    dW1[i] = hc[i] * dSi * (Tp[i] - T1[i]);
+/* Fluid thermodynamic properties */
+    pro1[i] = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(P[i + 1], h[i + 1], mode);
+    rho1[i] = pro1[i].d;
+    T1[i] = pro1[i].T;
+    (lsat[i], vsat[i]) = ThermoSysPro.Properties.WaterSteam.IF97.Water_sat_P(P[i + 1]);
+    cp[i] = pro1[i].cp;
+    mu1[i] = ThermoSysPro.Properties.WaterSteam.IF97.DynamicViscosity_rhoT(rho1[i], T1[i]);
+    k[i] = noEvent(ThermoSysPro.Properties.WaterSteam.IF97.ThermalConductivity_rhoT(rho1[i], T1[i], P[i + 1]));
+/* Heat exchange coefficient (using the Dittus-Boelter correlation) */
+    Pr[i] = mu1[i] * cp[i] / k[i];
+    Re1[i] = noEvent(abs(De * (Q[i] + Q[i + 1]) / (2 * As * mu1[i])));
+    hc[i] = hcCorr * noEvent(if Re1[i] < 2000 then 0.5 * (k[i] / De) * Re1[i] ^ 0.507 * Pr[i] ^ 0.33 else if Re1[i] > 2000 and Re1[i] < 1e6 then 0.36 * (k[i] / De) * Re1[i] ^ 0.55 * Pr[i] ^ 0.33 else 0.023 * k[i] / De * Re1[i] ^ 0.8 * Pr[i] ^ 0.4);
+//hc[i] = noEvent(if ((Re1[i] > 1.e-6) and (Pr[i] > 1.e-6)) then hcCorr*0.023*k[i]/D*Re1[i]^0.8*Pr[i]^0.4 else 0);
+  end for;
+/* Momentum balance equations (hydraulic nodes) */
+  for i in 1:N loop
+/* Flow reversal */
+    if continuous_flow_reversal then
+      0 = noEvent(if Q[i] > Qeps then hb[i] - h[i] else if Q[i] < (-Qeps) then hb[i] - h[i + 1] else hb[i] - 0.5 * ((h[i] - h[i + 1]) * Modelica.Math.sin(pi * Q[i] / 2 / Qeps) + h[i + 1] + h[i]));
+    else
+      0 = if Q[i] > 0 then hb[i] - h[i] else hb[i] - h[i + 1];
+    end if;
+/* Momentum balance equation */
+    if inertia then
+      1 / As * der(Q[i]) * dx2 = P[i] - P[i + 1] - dpf[i] - dpg[i] - dpa[i];
+    else
+      P[i] - P[i + 1] - dpf[i] - dpg[i] - dpa[i] = 0;
+    end if;
+/* Advection term */
+    if advection then
+      dpa[i] = Q[i] ^ 2 * (1 / rhoc[i + 1] - 1 / rhoc[i]) / As ^ 2;
+    else
+      dpa[i] = 0;
+    end if;
+/* Fluid thermodynamic properties */
+    pro2[i] = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph((P[i] + P[i + 1]) / 2, hb[i], mode);
+    rho2[i] = pro2[i].d;
+    T2[i] = pro2[i].T;
+    mu2[i] = ThermoSysPro.Properties.WaterSteam.IF97.DynamicViscosity_rhoT(rho2[i], T2[i]);
+//Re2[i] = noEvent(abs(Deq*Q[i]/(As*mu2[i])));
+    Re2[i] = noEvent(De * abs(Q[i]) / (As * mu2[i]));
+/* Gravity pressure losses */
+    dpg[i] = rho2[i] * g * (z2 - z1) * dx2 / L;
+/* Friction pressure losses */
+// Ds/dc is the number of rows
+//dpf[i] = noEvent(dpfCorr*Ds/dc*lambda[i]*Q[i]*abs(Q[i])/(2*As^2*rho2[i]));
+    dpf[i] = noEvent(dpfCorr * Ds / dc * (Nb + 1) * lambda[i] * Q[i] * abs(Q[i]) / (2 * As ^ 2 * rho2[i]) / N);
+//lambda[i] = if noEvent(Re2[i] > 1) then 0.25*(Modelica.Math.log10(13/Re2[i] + rugosrel/3.7/De))^(-2) else 0.01;
+    lambda[i] = Modelica.Math.exp(0.576 - 0.19 * Modelica.Math.log(Re2[i]));
   end for;
 
   /* Fluid densities at the boundaries of the nodes */
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicTwoFlowHeatExchangerShell.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicTwoFlowHeatExchangerShell.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicTwoFlowHeatExchangerShell.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicTwoFlowHeatExchangerShell.mo"	2022-03-10 09:58:22.600149777 +0000
@@ -3,14 +3,14 @@
   "Dynamic exchanger water/steam - water/steam"
   import ThermoSysPro;
 
-  parameter Modelica.SIunits.Length L=1 "Exchanger length";
-  parameter Modelica.SIunits.Position z1=0 "Exchanger inlet altitude";
-  parameter Modelica.SIunits.Position z2=0 "Exchanger outlet altitude";
+  parameter Modelica.Units.SI.Length L=1 "Exchanger length";
+  parameter Modelica.Units.SI.Position z1=0 "Exchanger inlet altitude";
+  parameter Modelica.Units.SI.Position z2=0 "Exchanger outlet altitude";
   parameter Integer Ns=1 "Numver of segments";
-  parameter Modelica.SIunits.Diameter Dint=0.1 "Pipe internal diameter";
-  parameter Modelica.SIunits.Diameter Dext=0.11 "Pipe external diameter";
-  //parameter Modelica.SIunits.Diameter Ds = 0.39 "shell internal diameter";
-  //parameter Modelica.SIunits.Diameter De = 0.019 "tube external diameter";
+  parameter Modelica.Units.SI.Diameter Dint=0.1 "Pipe internal diameter";
+  parameter Modelica.Units.SI.Diameter Dext=0.11 "Pipe external diameter";
+  //parameter Modelica.SIunits.Diameter Ds = 0.39 "shell internal diameter";
+  //parameter Modelica.SIunits.Diameter De = 0.019 "tube external diameter";
   parameter Integer Ntubes=1 "Number of pipes in parallel";
 
   ThermoSysPro.WaterSteam.HeatExchangers.DynamicOnePhaseFlowShell
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicTwoPhaseFlowPipe.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicTwoPhaseFlowPipe.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicTwoPhaseFlowPipe.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicTwoPhaseFlowPipe.mo"	2022-03-10 09:58:22.580149775 +0000
@@ -1,19 +1,19 @@
 within ThermoSysPro.WaterSteam.HeatExchangers;
 model DynamicTwoPhaseFlowPipe "Dynamic two-phase flow pipe"
-  parameter Modelica.SIunits.Length L=10. "Pipe length";
-  parameter Modelica.SIunits.Diameter D=0.2 "Internal pipe diameter";
-  parameter Modelica.SIunits.Length rugosrel=0.0007 "Pipe relative roughness";
+  parameter Modelica.Units.SI.Length L=10. "Pipe length";
+  parameter Modelica.Units.SI.Diameter D=0.2 "Internal pipe diameter";
+  parameter Modelica.Units.SI.Length rugosrel=0.0007 "Pipe relative roughness";
   parameter Integer ntubes=1 "Number of pipes in parallel";
-  parameter Modelica.SIunits.Position z1=0 "Pipe inlet altitude";
-  parameter Modelica.SIunits.Position z2=0 "Pipe outlet altitude";
+  parameter Modelica.Units.SI.Position z1=0 "Pipe inlet altitude";
+  parameter Modelica.Units.SI.Position z2=0 "Pipe outlet altitude";
   parameter Real rgliss=1 "Phase slip coefficient";
   parameter Integer a=4200 "Phase pressure loss coefficient";
   parameter Real dpfCorr=1.00
     "Corrective term for the friction pressure loss (dpf) for each node";
   parameter Integer Ns=10 "Number of segments";
-  parameter Modelica.SIunits.Temperature T0[Ns]=fill(300, Ns)
+  parameter Modelica.Units.SI.Temperature T0[Ns]=fill(300, Ns)
     "Initial fluid temperature (active if steady_state = false and option_temperature = 1)" annotation(Evaluate=false);
-  parameter Modelica.SIunits.SpecificEnthalpy h0[Ns]=fill(1e5, Ns)
+  parameter Modelica.Units.SI.SpecificEnthalpy h0[Ns]=fill(1e5, Ns)
     "Initial fluid specific enthalpy (active if steady_state = false and option_temperature = 2)";
   parameter Boolean inertia=true
     "true: momentum balance equation with inertia - false: without inertia";
@@ -33,112 +33,112 @@
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 protected
-  constant Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  constant Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
   constant Real pi=Modelica.Constants.pi "pi";
   parameter Real eps=1.e-0 "Small number for pressure loss equation";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow rate for continuous flow reversal";
   parameter Integer N=Ns + 1
     "Number of hydraulic nodes (= number of thermal nodes + 1)";
-  parameter Modelica.SIunits.Area A=ntubes*pi*D^2/4
+  parameter Modelica.Units.SI.Area A=ntubes*pi*D^2/4
     "Internal cross sectional pipe area";
-  parameter Modelica.SIunits.Diameter Di=ntubes*D "Internal pipe diameter";
-  parameter Modelica.SIunits.PathLength dx1=L/(N - 1)
+  parameter Modelica.Units.SI.Diameter Di=ntubes*D "Internal pipe diameter";
+  parameter Modelica.Units.SI.PathLength dx1=L/(N - 1)
     "Length of a thermal node";
-  parameter Modelica.SIunits.PathLength dx2=L/N "Length of a hydraulic node";
-  parameter Modelica.SIunits.Area dSi=pi*Di*dx1
+  parameter Modelica.Units.SI.PathLength dx2=L/N "Length of a hydraulic node";
+  parameter Modelica.Units.SI.Area dSi=pi*Di*dx1
     "Internal heat exchange area for a node";
   parameter Real Mmol=18.015 "Water molar mass";
-  parameter Modelica.SIunits.AbsolutePressure pcrit=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT
+  parameter Modelica.Units.SI.AbsolutePressure pcrit=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT
     "Critical pressure";
-  parameter Modelica.SIunits.Temperature Tcrit=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TCRIT
+  parameter Modelica.Units.SI.Temperature Tcrit=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TCRIT
     "Critical temperature";
-  parameter Modelica.SIunits.AbsolutePressure ptriple=ThermoSysPro.Properties.WaterSteam.BaseIF97.triple.ptriple
+  parameter Modelica.Units.SI.AbsolutePressure ptriple=ThermoSysPro.Properties.WaterSteam.BaseIF97.triple.ptriple
     "Triple point pressure";
   parameter Real xb1=0.0002 "Min value for vapor mass fraction";
   parameter Real xb2=0.85 "Max value for vapor mass fraction";
 
 public
-  Modelica.SIunits.AbsolutePressure P[N + 1](start=fill(1.e5, N + 1), nominal=fill(1.e5, N + 1))
+  Modelica.Units.SI.AbsolutePressure P[N + 1](start=fill(1.e5, N + 1), nominal=fill(1.e5, N + 1))
     "Fluid pressure in node i";
-  Modelica.SIunits.MassFlowRate Q[N](start=fill(10, N), nominal=fill(10, N))
+  Modelica.Units.SI.MassFlowRate Q[N](start=fill(10, N), nominal=fill(10, N))
     "Mass flow rate in node i";
-  Modelica.SIunits.SpecificEnthalpy h[N + 1](start=fill(1.e5, N + 1), nominal=fill(1.e6, N + 1))
+  Modelica.Units.SI.SpecificEnthalpy h[N + 1](start=fill(1.e5, N + 1), nominal=fill(1.e6, N + 1))
     "Fluid specific enthalpy in node i";
-  Modelica.SIunits.SpecificEnthalpy hb[N]
+  Modelica.Units.SI.SpecificEnthalpy hb[N]
     "Fluid specific enthalpy at the boundary of node i";
-  Modelica.SIunits.AbsolutePressure Pb[N + 1](start=fill(1.e5, N + 1), nominal=fill(1.e5, N + 1))
+  Modelica.Units.SI.AbsolutePressure Pb[N + 1](start=fill(1.e5, N + 1), nominal=fill(1.e5, N + 1))
     "Bounded fluid pressure in node i";
-  Modelica.SIunits.Density rho1[N - 1](start=fill(998, N - 1), nominal=fill(1, N - 1))
+  Modelica.Units.SI.Density rho1[N - 1](start=fill(998, N - 1), nominal=fill(1, N - 1))
     "Fluid density in thermal node i";
-  Modelica.SIunits.Density rho2[N](start=fill(998, N), nominal=fill(1, N))
+  Modelica.Units.SI.Density rho2[N](start=fill(998, N), nominal=fill(1, N))
     "Fluid density in hydraulic node i";
-  Modelica.SIunits.Density rhoc[N + 1](start=fill(998, N + 1), nominal=fill(1, N + 1))
+  Modelica.Units.SI.Density rhoc[N + 1](start=fill(998, N + 1), nominal=fill(1, N + 1))
     "Fluid density at the boudary of node i";
-  Modelica.SIunits.Power dW1[N - 1](start=fill(3.e5, N - 1), nominal=fill(3.e5, N - 1))
+  Modelica.Units.SI.Power dW1[N - 1](start=fill(3.e5, N - 1), nominal=fill(3.e5, N - 1))
     "Thermal power exchanged on the liquid side for node i";
-  Modelica.SIunits.Power W1t "Total power exchanged on the liquid side";
-  Modelica.SIunits.Temperature Tp1[N - 1](each start = 500.0)
+  Modelica.Units.SI.Power W1t "Total power exchanged on the liquid side";
+  Modelica.Units.SI.Temperature Tp1[N - 1](each start = 500.0)
     "Wall temperature in node i";
-  Modelica.SIunits.CoefficientOfHeatTransfer hi[N - 1](start=fill(2000, N - 1), nominal=fill(2.e4, N - 1))
+  Modelica.Units.SI.CoefficientOfHeatTransfer hi[N - 1](start=fill(2000, N - 1), nominal=fill(2.e4, N - 1))
     "Fluid heat exchange coefficient in node i";
-  Modelica.SIunits.CoefficientOfHeatTransfer hcl[N - 1](start=fill(2000, N - 1), nominal=fill(200, N - 1))
+  Modelica.Units.SI.CoefficientOfHeatTransfer hcl[N - 1](start=fill(2000, N - 1), nominal=fill(200, N - 1))
     "Fluid heat exchange coefficient in node i for the liquid fraction";
-  Modelica.SIunits.CoefficientOfHeatTransfer hcv[N - 1](start=fill(0, N - 1), nominal=fill(200, N - 1))
+  Modelica.Units.SI.CoefficientOfHeatTransfer hcv[N - 1](start=fill(0, N - 1), nominal=fill(200, N - 1))
     "Fluid heat exchange coefficient in node i for the vapor fraction";
   Real S[N - 1] "Corrective terme correctif for nucleation removal";
   Real E[N - 1] "Corrective term for hcl";
-  Modelica.SIunits.CoefficientOfHeatTransfer heb[N - 1](start=fill(0, N - 1), nominal=fill(5.e5, N - 1))
+  Modelica.Units.SI.CoefficientOfHeatTransfer heb[N - 1](start=fill(0, N - 1), nominal=fill(5.e5, N - 1))
     "Fluid heat exchange coefficient for vaporization in thermal node i";
-  Modelica.SIunits.ReynoldsNumber Rel1[N - 1](start=fill(6.e4, N - 1), nominal=fill(0.5e4, N - 1))
+  Modelica.Units.SI.ReynoldsNumber Rel1[N - 1](start=fill(6.e4, N - 1), nominal=fill(0.5e4, N - 1))
     "Reynolds number in thermal node i for the liquid";
-  Modelica.SIunits.ReynoldsNumber Rel2[N](start=fill(6.e4, N), nominal=fill(0.5e4, N))
+  Modelica.Units.SI.ReynoldsNumber Rel2[N](start=fill(6.e4, N), nominal=fill(0.5e4, N))
     "Reynolds number in hydraulic node i for the liquid";
-  Modelica.SIunits.ReynoldsNumber Rev1[N - 1](start=fill(0.1e4, N - 1), nominal=fill(5.e5, N - 1))
+  Modelica.Units.SI.ReynoldsNumber Rev1[N - 1](start=fill(0.1e4, N - 1), nominal=fill(5.e5, N - 1))
     "Reynolds number in thermal node i for the vapor";
-  Modelica.SIunits.ReynoldsNumber Rev2[N](start=fill(0.1e4, N), nominal=fill(5.e5, N))
+  Modelica.Units.SI.ReynoldsNumber Rev2[N](start=fill(0.1e4, N), nominal=fill(5.e5, N))
     "Reynolds number in hydraulic node i for the vapor";
   Real Prl[N - 1](start=fill(4, N - 1), nominal=fill(1, N - 1))
     "Fluid Prandtl number in node i for the liquid";
   Real Prv[N - 1](start=fill(1, N - 1), nominal=fill(1, N - 1))
     "Fluid Prandtl number in node i for the vapor";
-  Modelica.SIunits.ThermalConductivity kl[N - 1](start=fill(0.6, N - 1), nominal=fill(0.6, N - 1))
+  Modelica.Units.SI.ThermalConductivity kl[N - 1](start=fill(0.6, N - 1), nominal=fill(0.6, N - 1))
     "Thermal conductivity in node i for the liquid";
-  Modelica.SIunits.ThermalConductivity kv[N - 1](start=fill(0.03, N - 1), nominal=fill(0.03, N - 1))
+  Modelica.Units.SI.ThermalConductivity kv[N - 1](start=fill(0.03, N - 1), nominal=fill(0.03, N - 1))
     "Thermal conductivity in node i for the vapor";
   Real xv1[N - 1] "Vapor mass fraction in thermal node i";
   Real xv2[N] "Vapor mass fraction in hydraulic node i";
   Real xbs[N - 1] "Bounded upper value for the vapor mass fraction";
   Real xbi[N - 1] "Bounded lower value for the vapor mass fraction";
-  Modelica.SIunits.DynamicViscosity mul1[N - 1](start=fill(2.e-4, N - 1), nominal=fill(2.e-4, N - 1))
+  Modelica.Units.SI.DynamicViscosity mul1[N - 1](start=fill(2.e-4, N - 1), nominal=fill(2.e-4, N - 1))
     "Dynamic viscosity in thermal node i for the liquid";
-  Modelica.SIunits.DynamicViscosity mul2[N](start=fill(2.e-4, N), nominal=fill(2.e-4, N))
+  Modelica.Units.SI.DynamicViscosity mul2[N](start=fill(2.e-4, N), nominal=fill(2.e-4, N))
     "Dynamic viscosity in hydraulic node i for the liquid";
-  Modelica.SIunits.DynamicViscosity muv1[N - 1](start=fill(1.e-5, N - 1), nominal=fill(1.e-4, N - 1))
+  Modelica.Units.SI.DynamicViscosity muv1[N - 1](start=fill(1.e-5, N - 1), nominal=fill(1.e-4, N - 1))
     "Dynamic viscosity in thermal node i for the vapor";
-  Modelica.SIunits.DynamicViscosity muv2[N](start=fill(1.e-5, N), nominal=fill(1.e-4, N))
+  Modelica.Units.SI.DynamicViscosity muv2[N](start=fill(1.e-5, N), nominal=fill(1.e-4, N))
     "Dynamic viscosity in hydraulic node i for the vapor";
-  Modelica.SIunits.SpecificHeatCapacity cpl[N - 1](start=fill(4000, N - 1), nominal=fill(4000, N - 1))
+  Modelica.Units.SI.SpecificHeatCapacity cpl[N - 1](start=fill(4000, N - 1), nominal=fill(4000, N - 1))
     "Specific heat capacity for the liquid";
-  Modelica.SIunits.SpecificHeatCapacity cpv[N - 1](start=fill(2000, N - 1), nominal=fill(2000, N - 1))
+  Modelica.Units.SI.SpecificHeatCapacity cpv[N - 1](start=fill(2000, N - 1), nominal=fill(2000, N - 1))
     "Specific heat capacity for the vapor";
   Real Bo[N - 1](start=fill(0, N - 1), nominal=fill(4.e-4, N - 1))
     "Boiling number";
   Real Xtt[N - 1](start=fill(1, N - 1), nominal=fill(1, N - 1))
     "Martinelli number";
-  Modelica.SIunits.SpecificEnthalpy lv[N - 1](start=fill(2.e6, N - 1), nominal=fill(2.e6, N - 1))
+  Modelica.Units.SI.SpecificEnthalpy lv[N - 1](start=fill(2.e6, N - 1), nominal=fill(2.e6, N - 1))
     "Specific enthalpy for vaporisation";
-  Modelica.SIunits.Density rhol1[N - 1](start=fill(998, N - 1), nominal=fill(998, N - 1))
+  Modelica.Units.SI.Density rhol1[N - 1](start=fill(998, N - 1), nominal=fill(998, N - 1))
     "Fluid density in thermal node i for the liquid";
-  Modelica.SIunits.Density rhol2[N](start=fill(998, N), nominal=fill(998, N))
+  Modelica.Units.SI.Density rhol2[N](start=fill(998, N), nominal=fill(998, N))
     "Fluid density in hydraulic node i for the liquid";
-  Modelica.SIunits.Density rhov1[N - 1](start=fill(1, N - 1), nominal=fill(1, N - 1))
+  Modelica.Units.SI.Density rhov1[N - 1](start=fill(1, N - 1), nominal=fill(1, N - 1))
     "Fluid density in thermal node i for the vapor";
-  Modelica.SIunits.Density rhov2[N](start=fill(1, N), nominal=fill(1, N))
+  Modelica.Units.SI.Density rhov2[N](start=fill(1, N), nominal=fill(1, N))
     "Fluid density in hydraulic node i for the vapor";
-  Modelica.SIunits.Temperature T1[N - 1] "Fluid temperature in thermal node i";
-  Modelica.SIunits.Temperature T2[N] "Fluid temperature in hydraulic node i";
+  Modelica.Units.SI.Temperature T1[N - 1] "Fluid temperature in thermal node i";
+  Modelica.Units.SI.Temperature T2[N] "Fluid temperature in hydraulic node i";
   ThermoSysPro.Units.DifferentialPressure dpa[N]
     "Advection term for the mass balance equation in node i";
   ThermoSysPro.Units.DifferentialPressure dpf[N]
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicTwoPhaseFlowRiser.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicTwoPhaseFlowRiser.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicTwoPhaseFlowRiser.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicTwoPhaseFlowRiser.mo"	2022-03-10 09:58:22.448149758 +0000
@@ -1,11 +1,11 @@
-﻿within ThermoSysPro.WaterSteam.HeatExchangers;
+within ThermoSysPro.WaterSteam.HeatExchangers;
 model DynamicTwoPhaseFlowRiser "Riser: Dynamic two-phase flow pipe"
-  parameter Modelica.SIunits.Length L=10. "Pipe length";
-  parameter Modelica.SIunits.Diameter D=0.02 "Hydraulic diameter";
-  parameter Modelica.SIunits.Length rugosrel=0.0007 "Pipe relative roughness";
+  parameter Modelica.Units.SI.Length L=10. "Pipe length";
+  parameter Modelica.Units.SI.Diameter D=0.02 "Hydraulic diameter";
+  parameter Modelica.Units.SI.Length rugosrel=0.0007 "Pipe relative roughness";
   parameter Integer ntubes=1 "Number of pipes in parallel";
-  parameter Modelica.SIunits.Position z1=0 "Pipe inlet altitude";
-  parameter Modelica.SIunits.Position z2=0 "Pipe outlet altitude";
+  parameter Modelica.Units.SI.Position z1=0 "Pipe inlet altitude";
+  parameter Modelica.Units.SI.Position z2=0 "Pipe outlet altitude";
   parameter Real rgliss=1 "Phase slip coefficient";
   parameter Integer a=4200 "Phase pressure loss coefficient";
   parameter Real dpfCorr=1.00
@@ -13,9 +13,9 @@
   parameter Real hcCorr=1.00
     "Corrective term for the heat exchange coefficient (hc) for each node";
   parameter Integer Ns=10 "Number of segments";
-  parameter Modelica.SIunits.Temperature T0[Ns]=fill(300, Ns)
+  parameter Modelica.Units.SI.Temperature T0[Ns]=fill(300, Ns)
     "Initial fluid temperature (active if steady_state = false and option_temperature = 1)" annotation(Evaluate=false);
-  parameter Modelica.SIunits.SpecificEnthalpy h0[Ns]=fill(1e5, Ns)
+  parameter Modelica.Units.SI.SpecificEnthalpy h0[Ns]=fill(1e5, Ns)
     "Initial fluid specific enthalpy (active if steady_state = false and option_temperature = 2)";
   parameter Boolean inertia=true
     "true: momentum balance equation with inertia - false: without inertia";
@@ -35,116 +35,116 @@
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 protected
-  constant Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  constant Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
   constant Real pi=Modelica.Constants.pi "pi";
   parameter Real eps=1.e-0 "Small number for pressure loss equation";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow rate for continuous flow reversal";
   parameter Integer N=Ns + 1
     "Number of hydraulic nodes (= number of thermal nodes + 1)";
-  parameter Modelica.SIunits.Area A=ntubes*pi*D^2/4
+  parameter Modelica.Units.SI.Area A=ntubes*pi*D^2/4
     "Internal cross sectional pipe area";
-  parameter Modelica.SIunits.Diameter Di=ntubes*D "Internal pipe diameter";
-  parameter Modelica.SIunits.PathLength dx1=L/(N - 1)
+  parameter Modelica.Units.SI.Diameter Di=ntubes*D "Internal pipe diameter";
+  parameter Modelica.Units.SI.PathLength dx1=L/(N - 1)
     "Length of a thermal node";
-  parameter Modelica.SIunits.PathLength dx2=L/N "Length of a hydraulic node";
-  parameter Modelica.SIunits.Area dSi=pi*Di*dx1
+  parameter Modelica.Units.SI.PathLength dx2=L/N "Length of a hydraulic node";
+  parameter Modelica.Units.SI.Area dSi=pi*Di*dx1
     "Internal heat exchange area for a node";
   parameter Real Mmol=18.015 "Water molar mass";
-  parameter Modelica.SIunits.AbsolutePressure pcrit=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT
+  parameter Modelica.Units.SI.AbsolutePressure pcrit=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT
     "Critical pressure";
-  parameter Modelica.SIunits.Temperature Tcrit=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TCRIT
+  parameter Modelica.Units.SI.Temperature Tcrit=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TCRIT
     "Critical temperature";
-  parameter Modelica.SIunits.AbsolutePressure ptriple=ThermoSysPro.Properties.WaterSteam.BaseIF97.triple.ptriple
+  parameter Modelica.Units.SI.AbsolutePressure ptriple=ThermoSysPro.Properties.WaterSteam.BaseIF97.triple.ptriple
     "Triple point pressure";
   parameter Real xb1=0.0002 "Min value for vapor mass fraction";
   parameter Real xb2=0.85 "Max value for vapor mass fraction";
 
 public
-  Modelica.SIunits.AbsolutePressure P[N + 1](start=fill(1.e5, N + 1), nominal=fill(1.e5, N + 1))
+  Modelica.Units.SI.AbsolutePressure P[N + 1](start=fill(1.e5, N + 1), nominal=fill(1.e5, N + 1))
     "Fluid pressure in node i";
-  Modelica.SIunits.MassFlowRate Q[N](start=fill(10, N), nominal=fill(10, N))
+  Modelica.Units.SI.MassFlowRate Q[N](start=fill(10, N), nominal=fill(10, N))
     "Mass flow rate in node i";
-  Modelica.SIunits.SpecificEnthalpy h[N + 1](start=fill(1.e5, N + 1), nominal=fill(1.e6, N + 1))
+  Modelica.Units.SI.SpecificEnthalpy h[N + 1](start=fill(1.e5, N + 1), nominal=fill(1.e6, N + 1))
     "Fluid specific enthalpy in node i";
-  Modelica.SIunits.SpecificEnthalpy hb[N]
+  Modelica.Units.SI.SpecificEnthalpy hb[N]
     "Fluid specific enthalpy at the boundary of node i";
-  Modelica.SIunits.AbsolutePressure Pb[N + 1](start=fill(1.e5, N + 1), nominal=fill(1.e5, N + 1))
+  Modelica.Units.SI.AbsolutePressure Pb[N + 1](start=fill(1.e5, N + 1), nominal=fill(1.e5, N + 1))
     "Bounded fluid pressure in node i";
-  Modelica.SIunits.Density rho1[N - 1](start=fill(998, N - 1), nominal=fill(1, N - 1))
+  Modelica.Units.SI.Density rho1[N - 1](start=fill(998, N - 1), nominal=fill(1, N - 1))
     "Fluid density in thermal node i";
-  Modelica.SIunits.Density rho2[N](start=fill(998, N), nominal=fill(1, N))
+  Modelica.Units.SI.Density rho2[N](start=fill(998, N), nominal=fill(1, N))
     "Fluid density in hydraulic node i";
-  Modelica.SIunits.Density rhoc[N + 1](start=fill(998, N + 1), nominal=fill(1, N + 1))
+  Modelica.Units.SI.Density rhoc[N + 1](start=fill(998, N + 1), nominal=fill(1, N + 1))
     "Fluid density at the boudary of node i";
-  Modelica.SIunits.Power dW1[N - 1](start=fill(3.e5, N - 1), nominal=fill(3.e5, N - 1))
+  Modelica.Units.SI.Power dW1[N - 1](start=fill(3.e5, N - 1), nominal=fill(3.e5, N - 1))
     "Thermal power exchanged on the liquid side for node i";
-  Modelica.SIunits.Power dW2[N - 1](start=fill(3.e5, N - 1), nominal=fill(3.e5, N - 1))
+  Modelica.Units.SI.Power dW2[N - 1](start=fill(3.e5, N - 1), nominal=fill(3.e5, N - 1))
     "Thermal power exchanged on the liquid side for node i";
-  Modelica.SIunits.Power W1t "Total power exchanged on the liquid side";
-  Modelica.SIunits.Temperature Tp1[N - 1](each start = 500.0)
+  Modelica.Units.SI.Power W1t "Total power exchanged on the liquid side";
+  Modelica.Units.SI.Temperature Tp1[N - 1](each start = 500.0)
     "Wall temperature in node i";
-  Modelica.SIunits.Temperature Tp2[N - 1](each start = 500.0)
+  Modelica.Units.SI.Temperature Tp2[N - 1](each start = 500.0)
     "Wall temperature in node i";
-  Modelica.SIunits.CoefficientOfHeatTransfer hi[N - 1](start=fill(2000, N - 1), nominal=fill(2.e4, N - 1))
+  Modelica.Units.SI.CoefficientOfHeatTransfer hi[N - 1](start=fill(2000, N - 1), nominal=fill(2.e4, N - 1))
     "Fluid heat exchange coefficient in node i";
-  Modelica.SIunits.CoefficientOfHeatTransfer hcl[N - 1](start=fill(2000, N - 1), nominal=fill(200, N - 1))
+  Modelica.Units.SI.CoefficientOfHeatTransfer hcl[N - 1](start=fill(2000, N - 1), nominal=fill(200, N - 1))
     "Fluid heat exchange coefficient in node i for the liquid fraction";
-  Modelica.SIunits.CoefficientOfHeatTransfer hcv[N - 1](start=fill(0, N - 1), nominal=fill(200, N - 1))
+  Modelica.Units.SI.CoefficientOfHeatTransfer hcv[N - 1](start=fill(0, N - 1), nominal=fill(200, N - 1))
     "Fluid heat exchange coefficient in node i for the vapor fraction";
   Real S[N - 1] "Corrective terme correctif for nucleation removal";
   Real E[N - 1] "Corrective term for hcl";
-  Modelica.SIunits.CoefficientOfHeatTransfer heb[N - 1](start=fill(0, N - 1), nominal=fill(5.e5, N - 1))
+  Modelica.Units.SI.CoefficientOfHeatTransfer heb[N - 1](start=fill(0, N - 1), nominal=fill(5.e5, N - 1))
     "Fluid heat exchange coefficient for vaporization in thermal node i";
-  Modelica.SIunits.ReynoldsNumber Rel1[N - 1](start=fill(6.e4, N - 1), nominal=fill(0.5e4, N - 1))
+  Modelica.Units.SI.ReynoldsNumber Rel1[N - 1](start=fill(6.e4, N - 1), nominal=fill(0.5e4, N - 1))
     "Reynolds number in thermal node i for the liquid";
-  Modelica.SIunits.ReynoldsNumber Rel2[N](start=fill(6.e4, N), nominal=fill(0.5e4, N))
+  Modelica.Units.SI.ReynoldsNumber Rel2[N](start=fill(6.e4, N), nominal=fill(0.5e4, N))
     "Reynolds number in hydraulic node i for the liquid";
-  Modelica.SIunits.ReynoldsNumber Rev1[N - 1](start=fill(0.1e4, N - 1), nominal=fill(5.e5, N - 1))
+  Modelica.Units.SI.ReynoldsNumber Rev1[N - 1](start=fill(0.1e4, N - 1), nominal=fill(5.e5, N - 1))
     "Reynolds number in thermal node i for the vapor";
-  Modelica.SIunits.ReynoldsNumber Rev2[N](start=fill(0.1e4, N), nominal=fill(5.e5, N))
+  Modelica.Units.SI.ReynoldsNumber Rev2[N](start=fill(0.1e4, N), nominal=fill(5.e5, N))
     "Reynolds number in hydraulic node i for the vapor";
   Real Prl[N - 1](start=fill(4, N - 1), nominal=fill(1, N - 1))
     "Fluid Prandtl number in node i for the liquid";
   Real Prv[N - 1](start=fill(1, N - 1), nominal=fill(1, N - 1))
     "Fluid Prandtl number in node i for the vapor";
-  Modelica.SIunits.ThermalConductivity kl[N - 1](start=fill(0.6, N - 1), nominal=fill(0.6, N - 1))
+  Modelica.Units.SI.ThermalConductivity kl[N - 1](start=fill(0.6, N - 1), nominal=fill(0.6, N - 1))
     "Thermal conductivity in node i for the liquid";
-  Modelica.SIunits.ThermalConductivity kv[N - 1](start=fill(0.03, N - 1), nominal=fill(0.03, N - 1))
+  Modelica.Units.SI.ThermalConductivity kv[N - 1](start=fill(0.03, N - 1), nominal=fill(0.03, N - 1))
     "Thermal conductivity in node i for the vapor";
   Real xv1[N - 1] "Vapor mass fraction in thermal node i";
   Real xv2[N] "Vapor mass fraction in hydraulic node i";
   Real xbs[N - 1] "Bounded upper value for the vapor mass fraction";
   Real xbi[N - 1] "Bounded lower value for the vapor mass fraction";
-  Modelica.SIunits.DynamicViscosity mul1[N - 1](start=fill(2.e-4, N - 1), nominal=fill(2.e-4, N - 1))
+  Modelica.Units.SI.DynamicViscosity mul1[N - 1](start=fill(2.e-4, N - 1), nominal=fill(2.e-4, N - 1))
     "Dynamic viscosity in thermal node i for the liquid";
-  Modelica.SIunits.DynamicViscosity mul2[N](start=fill(2.e-4, N), nominal=fill(2.e-4, N))
+  Modelica.Units.SI.DynamicViscosity mul2[N](start=fill(2.e-4, N), nominal=fill(2.e-4, N))
     "Dynamic viscosity in hydraulic node i for the liquid";
-  Modelica.SIunits.DynamicViscosity muv1[N - 1](start=fill(1.e-5, N - 1), nominal=fill(1.e-4, N - 1))
+  Modelica.Units.SI.DynamicViscosity muv1[N - 1](start=fill(1.e-5, N - 1), nominal=fill(1.e-4, N - 1))
     "Dynamic viscosity in thermal node i for the vapor";
-  Modelica.SIunits.DynamicViscosity muv2[N](start=fill(1.e-5, N), nominal=fill(1.e-4, N))
+  Modelica.Units.SI.DynamicViscosity muv2[N](start=fill(1.e-5, N), nominal=fill(1.e-4, N))
     "Dynamic viscosity in hydraulic node i for the vapor";
-  Modelica.SIunits.SpecificHeatCapacity cpl[N - 1](start=fill(4000, N - 1), nominal=fill(4000, N - 1))
+  Modelica.Units.SI.SpecificHeatCapacity cpl[N - 1](start=fill(4000, N - 1), nominal=fill(4000, N - 1))
     "Specific heat capacity for the liquid";
-  Modelica.SIunits.SpecificHeatCapacity cpv[N - 1](start=fill(2000, N - 1), nominal=fill(2000, N - 1))
+  Modelica.Units.SI.SpecificHeatCapacity cpv[N - 1](start=fill(2000, N - 1), nominal=fill(2000, N - 1))
     "Specific heat capacity for the vapor";
   Real Bo[N - 1](start=fill(0, N - 1), nominal=fill(4.e-4, N - 1))
     "Boiling number";
   Real Xtt[N - 1](start=fill(1, N - 1), nominal=fill(1, N - 1))
     "Martinelli number";
-  Modelica.SIunits.SpecificEnthalpy lv[N - 1](start=fill(2.e6, N - 1), nominal=fill(2.e6, N - 1))
+  Modelica.Units.SI.SpecificEnthalpy lv[N - 1](start=fill(2.e6, N - 1), nominal=fill(2.e6, N - 1))
     "Specific enthalpy for vaporisation";
-  Modelica.SIunits.Density rhol1[N - 1](start=fill(998, N - 1), nominal=fill(998, N - 1))
+  Modelica.Units.SI.Density rhol1[N - 1](start=fill(998, N - 1), nominal=fill(998, N - 1))
     "Fluid density in thermal node i for the liquid";
-  Modelica.SIunits.Density rhol2[N](start=fill(998, N), nominal=fill(998, N))
+  Modelica.Units.SI.Density rhol2[N](start=fill(998, N), nominal=fill(998, N))
     "Fluid density in hydraulic node i for the liquid";
-  Modelica.SIunits.Density rhov1[N - 1](start=fill(1, N - 1), nominal=fill(1, N - 1))
+  Modelica.Units.SI.Density rhov1[N - 1](start=fill(1, N - 1), nominal=fill(1, N - 1))
     "Fluid density in thermal node i for the vapor";
-  Modelica.SIunits.Density rhov2[N](start=fill(1, N), nominal=fill(1, N))
+  Modelica.Units.SI.Density rhov2[N](start=fill(1, N), nominal=fill(1, N))
     "Fluid density in hydraulic node i for the vapor";
-  Modelica.SIunits.Temperature T1[N - 1] "Fluid temperature in thermal node i";
-  Modelica.SIunits.Temperature T2[N] "Fluid temperature in hydraulic node i";
+  Modelica.Units.SI.Temperature T1[N - 1] "Fluid temperature in thermal node i";
+  Modelica.Units.SI.Temperature T2[N] "Fluid temperature in hydraulic node i";
   ThermoSysPro.Units.DifferentialPressure dpa[N]
     "Advection term for the mass balance equation in node i";
   ThermoSysPro.Units.DifferentialPressure dpf[N]
@@ -277,12 +277,10 @@
     /* Heat transfer at the wall */
     dW1[i] = hcCorr*hi[i]*dSi*(Tp1[i] - T1[i]);
     dW2[i] = hcCorr*hi[i]*dSi*(Tp2[i] - T1[i]);
-
-    //*** Calcul de la corrélation d'échange thermique
-    // Corrélation de Thom
-    //hi_1[i] =  max(1970*exp(P[i + 1]/43.5e5)*(Tp1[i] - Tsat[i]), 5000);
-    //hi_2[i] =  max(1970*exp(P[i + 1]/43.5e5)*(Tp2[i] - Tsat[i]), 5000);
-
+//*** Calcul de la corrélation d'échange thermique
+// Corrélation de Thom
+//hi_1[i] =  max(1970*exp(P[i + 1]/43.5e5)*(Tp1[i] - Tsat[i]), 5000);
+//hi_2[i] =  max(1970*exp(P[i + 1]/43.5e5)*(Tp2[i] - Tsat[i]), 5000);
     if noEvent(xv1[i] < xb1) then
       hi[i] = if noEvent((P[i+1] > pcrit) or (T1[i] > Tcrit)) then hcl[i] else (1 - xv1[i]/xb1)*hcl[i] + xv1[i]/xb1*(E[i]*hcl[i] + S[i]*heb[i]);
       Xtt[i] = ((1 - xb1)/xb1)^0.9*(rhov1[i]/rhol1[i])^0.5*(mul1[i]/muv1[i])^
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicWaterHeating.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicWaterHeating.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicWaterHeating.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicWaterHeating.mo"	2022-03-10 09:58:22.216149728 +0000
@@ -1,28 +1,28 @@
 within ThermoSysPro.WaterSteam.HeatExchangers;
 model DynamicWaterHeating "Dynamic water heater"
-  //parameter Modelica.SIunits.Volume Vc=4510 "Cavity total volume";
+  //parameter Modelica.SIunits.Volume Vc=4510 "Cavity total volume";
   parameter Real Vf0=0.066
     "Fraction of initial liquid volume in the Cavity (0 < Vf0 < 1)";
-  parameter Modelica.SIunits.Pressure P0c=1e5 "INitial pressure in the Cavity";
+  parameter Modelica.Units.SI.Pressure P0c=1e5 "INitial pressure in the Cavity";
   //parameter Modelica.SIunits.Area Ac=200 "Cavity cross-sectional area";
-  parameter Modelica.SIunits.Radius Rv=1.0
+  parameter Modelica.Units.SI.Radius Rv=1.0
     "Radius of the Cavity cross-sectional area";
-  parameter Modelica.SIunits.Length L1=12.5
+  parameter Modelica.Units.SI.Length L1=12.5
     " Length of drowned pipes in liquid (pipes 1)";
-  parameter Modelica.SIunits.Length L2=12.5 " Length of Pipe 2 (in steam)";
-  parameter Modelica.SIunits.Length L3=25 " Length of Pipe 3 (in steam)";
-  parameter Modelica.SIunits.Length Lc=2.5
+  parameter Modelica.Units.SI.Length L2=12.5 " Length of Pipe 2 (in steam)";
+  parameter Modelica.Units.SI.Length L3=25 " Length of Pipe 3 (in steam)";
+  parameter Modelica.Units.SI.Length Lc=2.5
     "support plate spacing in cooling zone(Chicanes)";
-  parameter Modelica.SIunits.Diameter Dc=0.016
+  parameter Modelica.Units.SI.Diameter Dc=0.016
     "Internal diameter of the cooling pipes";
-  parameter Modelica.SIunits.Thickness ec=2.e-3
+  parameter Modelica.Units.SI.Thickness ec=2.e-3
     " Thickness of the cooling pipes";
-  parameter Modelica.SIunits.Diameter DIc=1.390 "Internal calendre diameter";
-  parameter Modelica.SIunits.Length PasL = 0.03
+  parameter Modelica.Units.SI.Diameter DIc=1.390 "Internal calendre diameter";
+  parameter Modelica.Units.SI.Length PasL = 0.03
     "Longitudinal step or Length bottom pipes triangular step";
-  parameter Modelica.SIunits.Length PasT = 0.03
+  parameter Modelica.Units.SI.Length PasT = 0.03
     " Transverse step or pipes step";
-  //parameter Modelica.SIunits.Angle Angle = 60 "Average bend angle (deg)";
+  //parameter Modelica.SIunits.Angle Angle = 60 "Average bend angle (deg)";
   parameter Integer Ns=10 "Number of segments for one tube pass (half U pipe";
   parameter Integer ntubes1=500
     "Numbers of the pipes drowned in water  for pipes 1 (drowned pipes in liquid)";
@@ -31,14 +31,14 @@
   parameter Integer ntubes3=500
     "Numbers of the pipes immersed in steam for pipes 3";
   parameter Integer ntubesV=15 "Numbers of pipes in a vertical row (tube bank)";
-  parameter Modelica.SIunits.SpecificHeatCapacity cp=460
+  parameter Modelica.Units.SI.SpecificHeatCapacity cp=460
     "Specific heat capacity of the metal of the cooling pipes";
-  parameter Modelica.SIunits.Density rho=7900
+  parameter Modelica.Units.SI.Density rho=7900
     "Density of the metal of the cooling pipes";
-  parameter Modelica.SIunits.ThermalConductivity lambda=26
+  parameter Modelica.Units.SI.ThermalConductivity lambda=26
     "Wall thermal conductivity of the cooling pipes";
-  //parameter Modelica.SIunits.CoefficientOfHeatTransfer hcond=25000
-  //  "Heat transfer coefficient between the vapor and the cooling pipes";
+  //parameter Modelica.SIunits.CoefficientOfHeatTransfer hcond=25000
+  //  "Heat transfer coefficient between the vapor and the cooling pipes";
   parameter Real DpfCorr= 1.00
     "Corrective term for friction pressure loss (dpf) in node i";
   parameter Real COP0v = 1.0
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicWaterHeatingOnePipe.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicWaterHeatingOnePipe.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicWaterHeatingOnePipe.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicWaterHeatingOnePipe.mo"	2022-03-10 09:58:22.140149718 +0000
@@ -1,28 +1,28 @@
 within ThermoSysPro.WaterSteam.HeatExchangers;
 model DynamicWaterHeatingOnePipe "Dynamic WaterHeating"
-  //parameter Modelica.SIunits.Volume Vc=4510 "Cavity total volume";
+  //parameter Modelica.SIunits.Volume Vc=4510 "Cavity total volume";
   parameter Real Vf0=0.066
     "Fraction of initial liquid volume in the Cavity (0 < Vf0 < 1)";
-  parameter Modelica.SIunits.Pressure P0c=1e5 "INitial pressure in the Cavity";
+  parameter Modelica.Units.SI.Pressure P0c=1e5 "INitial pressure in the Cavity";
   //parameter Modelica.SIunits.Area Ac=200 "Cavity cross-sectional area";
-  parameter Modelica.SIunits.Radius Rv=1.0
+  parameter Modelica.Units.SI.Radius Rv=1.0
     "Radius of the Cavity cross-sectional area";
-  parameter Modelica.SIunits.Length L1=12.5
+  parameter Modelica.Units.SI.Length L1=12.5
     " Length of drowned pipes in liquid (pipes 1)";
-  parameter Modelica.SIunits.Length L2=12.5 " Length of Pipe 2 (in steam)";
-  parameter Modelica.SIunits.Length L3=25 " Length of Pipe 3 (in steam)";
-  parameter Modelica.SIunits.Length Lc=2.5
+  parameter Modelica.Units.SI.Length L2=12.5 " Length of Pipe 2 (in steam)";
+  parameter Modelica.Units.SI.Length L3=25 " Length of Pipe 3 (in steam)";
+  parameter Modelica.Units.SI.Length Lc=2.5
     "support plate spacing in cooling zone(Chicanes)";
-  parameter Modelica.SIunits.Diameter Dc=0.016
+  parameter Modelica.Units.SI.Diameter Dc=0.016
     "Internal diameter of the cooling pipes";
-  parameter Modelica.SIunits.Thickness ec=2.e-3
+  parameter Modelica.Units.SI.Thickness ec=2.e-3
     " Thickness of the cooling pipes";
-  parameter Modelica.SIunits.Diameter DIc=1.390 "Internal calendre diameter";
-  parameter Modelica.SIunits.Length PasL = 0.03
+  parameter Modelica.Units.SI.Diameter DIc=1.390 "Internal calendre diameter";
+  parameter Modelica.Units.SI.Length PasL = 0.03
     "Longitudianl step or Length bottom pipes triangular step";
-  parameter Modelica.SIunits.Length PasT = 0.03
+  parameter Modelica.Units.SI.Length PasT = 0.03
     " Transverse step or pipes step";
-  //parameter Modelica.SIunits.Angle Angle = 60 "Average bend angle (deg)";
+  //parameter Modelica.SIunits.Angle Angle = 60 "Average bend angle (deg)";
   parameter Integer Ns=10 "Number of segments for one tube pass (half U pipe";
   parameter Integer ntubes1=500
     "Numbers of drowned pipes in liquid for pipes 1";
@@ -31,14 +31,14 @@
   parameter Integer ntubes3=500
     "Numbers of the pipes immersed in steam, for pipe 3";
   parameter Integer ntubesV=15 "Numbers of pipes in a vertical row (tube bank)";
-  parameter Modelica.SIunits.SpecificHeatCapacity cp=460
+  parameter Modelica.Units.SI.SpecificHeatCapacity cp=460
     "Specific heat capacity of the metal of the cooling pipes";
-  parameter Modelica.SIunits.Density rho=7900
+  parameter Modelica.Units.SI.Density rho=7900
     "Density of the metal of the cooling pipes";
-  parameter Modelica.SIunits.ThermalConductivity lambda=26
+  parameter Modelica.Units.SI.ThermalConductivity lambda=26
     "Wall thermal conductivity of the cooling pipes";
-  //parameter Modelica.SIunits.CoefficientOfHeatTransfer hcond=25000
-  //  "Heat transfer coefficient between the vapor and the cooling pipes";
+  //parameter Modelica.SIunits.CoefficientOfHeatTransfer hcond=25000
+  //  "Heat transfer coefficient between the vapor and the cooling pipes";
   parameter Real DpfCorr= 1.00
     "Corrective terme for friction pressure loss (dpf) in node i";
   parameter Real COP0v = 1.0
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicWaterWaterExchanger.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicWaterWaterExchanger.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicWaterWaterExchanger.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/DynamicWaterWaterExchanger.mo"	2022-03-10 09:58:22.088149713 +0000
@@ -1,26 +1,26 @@
-﻿within ThermoSysPro.WaterSteam.HeatExchangers;
+within ThermoSysPro.WaterSteam.HeatExchangers;
 model DynamicWaterWaterExchanger "Dynamic plate heat exchanger"
-  parameter Modelica.SIunits.ThermalConductivity lambdam=15.0
+  parameter Modelica.Units.SI.ThermalConductivity lambdam=15.0
     "Metal thermal conductivity";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer p_hc=6000
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer p_hc=6000
     "Heat transfer coefficient for the hot side if not computed by the correlations";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer p_hf=3000
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer p_hf=3000
     "Heat transfer coefficient for the cold side if not computed by the correlations";
   parameter Real p_Kc=100
     "Pressure loss coefficient for the hot side if not computed by the correlations";
   parameter Real p_Kf=100
     "Pressure loss coefficient for the cold side if not computed by the correlations";
-  parameter Modelica.SIunits.Volume Vc=1 "Hot side volume";
-  parameter Modelica.SIunits.Volume Vf=1 "Cold side volume";
-  parameter Modelica.SIunits.Thickness emetal=0.0006 "Wall thickness";
-  parameter Modelica.SIunits.Area Sp=2 "Plate area";
+  parameter Modelica.Units.SI.Volume Vc=1 "Hot side volume";
+  parameter Modelica.Units.SI.Volume Vf=1 "Cold side volume";
+  parameter Modelica.Units.SI.Thickness emetal=0.0006 "Wall thickness";
+  parameter Modelica.Units.SI.Area Sp=2 "Plate area";
   parameter Real nbp=499 "Number of plates";
   parameter Real c1=1.12647 "Correction coefficient";
   parameter Integer N=10 "Number of segments";
   parameter Boolean steady_state=true "true: start from steady state";
-  parameter Modelica.SIunits.Density p_rhoc=0
+  parameter Modelica.Units.SI.Density p_rhoc=0
     "If > 0, fixed fluid density for the hot fluid";
-  parameter Modelica.SIunits.Density p_rhof=0
+  parameter Modelica.Units.SI.Density p_rhof=0
     "If > 0, fixed fluid density for the cold fluid";
   parameter Integer modec=0
     "IF97 region for the hot fluid. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
@@ -33,64 +33,64 @@
     "Correlation for the computation of the pressure loss coefficient - 0: no correlation. 1: SRI correlations";
 
 public
-  Modelica.SIunits.Power dW[N] "Thermal power exchanged between the two sides";
+  Modelica.Units.SI.Power dW[N] "Thermal power exchanged between the two sides";
   ThermoSysPro.Units.DifferentialPressure DPc[N]
     "Pressure loss of the hot fluid";
   ThermoSysPro.Units.DifferentialPressure DPf[N]
     "Pressure loss of the cold fluid";
-  Modelica.SIunits.CoefficientOfHeatTransfer hc[N]
+  Modelica.Units.SI.CoefficientOfHeatTransfer hc[N]
     "Heat transfer coefficient of the hot fluid";
-  Modelica.SIunits.CoefficientOfHeatTransfer hf[N]
+  Modelica.Units.SI.CoefficientOfHeatTransfer hf[N]
     "Heat transfer coefficient of the cold fluid";
-  Modelica.SIunits.CoefficientOfHeatTransfer K[N]
+  Modelica.Units.SI.CoefficientOfHeatTransfer K[N]
     "Global heat transfer coefficient";
-  Modelica.SIunits.Area dS "Heat exchange surface";
-  Modelica.SIunits.Temperature Tec "Fluid temperature at the hot inlet";
-  Modelica.SIunits.Temperature Tsc "Fluid temperature at the hot outlet";
-  Modelica.SIunits.Temperature Tef "Fluid temperature at the cold inlet";
-  Modelica.SIunits.Temperature Tsf "Fluid temperature at the cold outlet";
-  Modelica.SIunits.AbsolutePressure Pcc[N + 1]
+  Modelica.Units.SI.Area dS "Heat exchange surface";
+  Modelica.Units.SI.Temperature Tec "Fluid temperature at the hot inlet";
+  Modelica.Units.SI.Temperature Tsc "Fluid temperature at the hot outlet";
+  Modelica.Units.SI.Temperature Tef "Fluid temperature at the cold inlet";
+  Modelica.Units.SI.Temperature Tsf "Fluid temperature at the cold outlet";
+  Modelica.Units.SI.AbsolutePressure Pcc[N + 1]
     "Hot fluid pressure at the boundary of section i";
-  Modelica.SIunits.MassFlowRate Qcc[N + 1]
+  Modelica.Units.SI.MassFlowRate Qcc[N + 1]
     "Hot fluid mass flow rate at the boundary of section i";
-  Modelica.SIunits.SpecificEnthalpy Hcc[N + 1]
+  Modelica.Units.SI.SpecificEnthalpy Hcc[N + 1]
     "Hot fluid specific enthalpy at the boundary of section i";
-  Modelica.SIunits.AbsolutePressure Pcf[N + 1]
+  Modelica.Units.SI.AbsolutePressure Pcf[N + 1]
     "Cold fluid pressure at the boundary of section i";
-  Modelica.SIunits.MassFlowRate Qcf[N + 1]
+  Modelica.Units.SI.MassFlowRate Qcf[N + 1]
     "Cold fluid mass flow rate at the boundary of section i";
-  Modelica.SIunits.SpecificEnthalpy Hcf[N + 1]
+  Modelica.Units.SI.SpecificEnthalpy Hcf[N + 1]
     "Cold fluid specific enthalpy at the boundary of section i";
-  Modelica.SIunits.MassFlowRate Qc[N](start=fill(500, N))
+  Modelica.Units.SI.MassFlowRate Qc[N](start=fill(500, N))
     "Mass flow rate of the hot fluid";
-  Modelica.SIunits.MassFlowRate Qf[N](start=fill(500, N))
+  Modelica.Units.SI.MassFlowRate Qf[N](start=fill(500, N))
     "Mass flow rate of the cold fluid";
   Real qmc[N];
   Real qmf[N];
   Real quc[N];
   Real quf[N];
   Real M;
-  Modelica.SIunits.Density rhoc[N](start=fill(998, N)) "Hot fluid density";
-  Modelica.SIunits.Density rhof[N](start=fill(998, N)) "Cold fluid density";
-  Modelica.SIunits.DynamicViscosity muc[N](start=fill(1.e-3, N))
+  Modelica.Units.SI.Density rhoc[N](start=fill(998, N)) "Hot fluid density";
+  Modelica.Units.SI.Density rhof[N](start=fill(998, N)) "Cold fluid density";
+  Modelica.Units.SI.DynamicViscosity muc[N](start=fill(1.e-3, N))
     "Hot fluid dynamic viscosity";
-  Modelica.SIunits.DynamicViscosity muf[N](start=fill(1.e-3, N))
+  Modelica.Units.SI.DynamicViscosity muf[N](start=fill(1.e-3, N))
     "Cold fluid dynamic viscosity";
-  Modelica.SIunits.ThermalConductivity lambdac[N](start=fill(0.602698, N))
+  Modelica.Units.SI.ThermalConductivity lambdac[N](start=fill(0.602698, N))
     "Hot fluid thermal conductivity";
-  Modelica.SIunits.ThermalConductivity lambdaf[N](start=fill(0.597928, N))
+  Modelica.Units.SI.ThermalConductivity lambdaf[N](start=fill(0.597928, N))
     "Cold fluid thermal conductivity";
-  Modelica.SIunits.Temperature Tmc[N](start=fill(290, N))
+  Modelica.Units.SI.Temperature Tmc[N](start=fill(290, N))
     "Hot fluid average temperature";
-  Modelica.SIunits.Temperature Tmf[N](start=fill(290, N))
+  Modelica.Units.SI.Temperature Tmf[N](start=fill(290, N))
     "Cold fluid average temperature";
-  Modelica.SIunits.AbsolutePressure Pmc[N](start=fill(1.e5, N))
+  Modelica.Units.SI.AbsolutePressure Pmc[N](start=fill(1.e5, N))
     "Hot fluid average pressure";
-  Modelica.SIunits.AbsolutePressure Pmf[N](start=fill(1.e5, N))
+  Modelica.Units.SI.AbsolutePressure Pmf[N](start=fill(1.e5, N))
     "Cold fluid average pressure";
-  Modelica.SIunits.SpecificEnthalpy Hmc[N](start=fill(100000, N))
+  Modelica.Units.SI.SpecificEnthalpy Hmc[N](start=fill(100000, N))
     "Hot fluid average specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy Hmf[N](start=fill(100000, N))
+  Modelica.Units.SI.SpecificEnthalpy Hmf[N](start=fill(100000, N))
     "Cold fluid average specific enthalpy";
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proc[
                                                               N]
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/NTUWaterHeating.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/NTUWaterHeating.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/NTUWaterHeating.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/NTUWaterHeating.mo"	2022-03-10 09:58:22.032149705 +0000
@@ -1,13 +1,13 @@
 within ThermoSysPro.WaterSteam.HeatExchangers;
 model NTUWaterHeating "NTU water heater"
   parameter Real lambdaE=0 "Pressure loss coefficient on the water side";
-  parameter Modelica.SIunits.Area SCondDes=3000
+  parameter Modelica.Units.SI.Area SCondDes=3000
     "Exchange surface for the condensation and deheating";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer KCond=1
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer KCond=1
     "Heat transfer coefficient for the condensation";
-  parameter Modelica.SIunits.Area SPurge=0
+  parameter Modelica.Units.SI.Area SPurge=0
     "Drain surface - if > 0: with drain cooling";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer KPurge=1
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer KPurge=1
     "Heat transfer coefficient for the drain cooling";
   parameter Integer mode_eeF=0
     "IF97 region at the inlet of the water side. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
@@ -28,30 +28,30 @@
   parameter Real eps=1.e-3 "Small number for pressure loss equation";
 
 public
-  Modelica.SIunits.AbsolutePressure P(start=10e5) "Fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy HsateC(start=300e3,min=0)
+  Modelica.Units.SI.AbsolutePressure P(start=10e5) "Fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy";
+  Modelica.Units.SI.SpecificEnthalpy HsateC(start=300e3,min=0)
     "Saturation specific enthalpy of the water at the pressure of the vapor inlet";
-  Modelica.SIunits.SpecificEnthalpy HsatvC(start=2500e3,min=0)
+  Modelica.Units.SI.SpecificEnthalpy HsatvC(start=2500e3,min=0)
     "Saturation specific enthalpy of the vapor at the pressure of the vapor inlet";
-  Modelica.SIunits.Area SDes(start=0) "Heat exchange surface for deheating";
-  Modelica.SIunits.SpecificEnthalpy HeiF(start=200e3)
+  Modelica.Units.SI.Area SDes(start=0) "Heat exchange surface for deheating";
+  Modelica.Units.SI.SpecificEnthalpy HeiF(start=200e3)
     "Fluid specific enthalpy after drain cooling";
-  Modelica.SIunits.SpecificEnthalpy HDesF(start=200e3)
+  Modelica.Units.SI.SpecificEnthalpy HDesF(start=200e3)
     "Fluid specific enthalpy after deheating";
-  Modelica.SIunits.Temperature TeiF(start=400,min=0)
+  Modelica.Units.SI.Temperature TeiF(start=400,min=0)
     "Fluid temperature after drain cooling";
-  Modelica.SIunits.Temperature TsatC(start=400,min=0) "Saturation temperature";
-  Modelica.SIunits.Power W(start=1)
+  Modelica.Units.SI.Temperature TsatC(start=400,min=0) "Saturation temperature";
+  Modelica.Units.SI.Power W(start=1)
     "Total heat power transfered to the cooling water";
-  Modelica.SIunits.Power Wdes(start=1) "Energy transfer during deheating";
-  Modelica.SIunits.Power Wcond(start=1) "Energy transfer during condensation";
-  Modelica.SIunits.Power Wflash(start=1)
+  Modelica.Units.SI.Power Wdes(start=1) "Energy transfer during deheating";
+  Modelica.Units.SI.Power Wcond(start=1) "Energy transfer during condensation";
+  Modelica.Units.SI.Power Wflash(start=1)
     "Energy transfer during partial vaporisation in the drain";
-  Modelica.SIunits.Power Wpurge(start=1) "Energy transfer during drain cooling";
-  Modelica.SIunits.SpecificEnthalpy Hep(start=3e5)
+  Modelica.Units.SI.Power Wpurge(start=1) "Energy transfer during drain cooling";
+  Modelica.Units.SI.SpecificEnthalpy Hep(start=3e5)
     "Mixing specific enthalpy of the drain and the condensate";
-  Modelica.SIunits.Density rho(start=1e3,min=0) "Average water density";
+  Modelica.Units.SI.Density rho(start=1e3,min=0) "Average water density";
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proeeF
     "Water inlet fluid properties (4F)"
     annotation (Placement(transformation(extent={{-100,-100},{-80,-80}},
@@ -134,12 +134,10 @@
     Ep.h = 100e3;
     Ep.P = 1e5;
     Ep.b = true;
-  end if;
-
-  // Cooling pipe
-  //-------------
-
-  /* Flow reversal for the cooling water pipe */
+  end if;
+// Cooling pipe
+//-------------
+/* Flow reversal for the cooling water pipe */
   0 = if noEvent(Ee.Q > 0) then Ee.h - Ee.h_vol else Se.h - Se.h_vol;
 
   /* Mass balance equation for the water pipe */
@@ -149,12 +147,10 @@
   Ee.P - Se.P = lambdaE*ThermoSysPro.Functions.ThermoSquare(Ee.Q, eps)/rho;
 
   /* Heating power released to the cooling pipe */
-  W = Se.Q*(Se.h - Ee.h);
-
-  // Water/steam cavity
-  //-------------------
-
-  /* Fluid pressure */
+  W = Se.Q*(Se.h - Ee.h);
+// Water/steam cavity
+//-------------------
+/* Fluid pressure */
   P = Ev.P;
   P = Sp.P;
 
@@ -164,48 +160,40 @@
   Ep.h_vol = h;
 
   /* Mass balance equation */
-  Sp.Q = Ev.Q + Ep.Q;
-
-  /* Energy balance equations */
-
-  // Deheating zone
-  //---------------
-
-  /* Heat power, fluid specific enthalpy on the cold side and deheating surface */
-  /* If deheating is present */
-  if noEvent(HsatvC < Ev.h) then
-    Wdes = Ev.Q*(Ev.h - HsatvC);
-    Wdes = Ee.Q*(Se.h - HDesF);
-    Wdes = noEvent(min(Ev.Q*prodesmC.cp, Ee.Q*prodesmF.cp)*ThermoSysPro.Correlations.Thermal.WBHeatExchangerEfficiency(Ev.Q, Ee.Q, prodesmC.cp, prodesmF.cp,
-           KCond/2, SDes, 1) *(proevC.T - prodesF.T));
-  /* If deheating is absent */
-  else
-    Wdes = 1e-9;
-    HDesF = Se.h;
-    SDes = 1e-9;
-  end if;
-
-  // Condensation zone
-  //------------------
-
-  /* Heat power, fluid specific enthalpy at the outlet of the condensation zone and vapor mass flow rate at the inlet */
-  if noEvent(Ev.h < HsatvC) then
-    Wcond = Ev.Q*(Ev.h - HsateC) + Wflash;
-  else
-    Wcond = Ev.Q*(HsatvC - HsateC) + Wflash;
+  Sp.Q = Ev.Q + Ep.Q;
+/* Energy balance equations */
+// Deheating zone
+//---------------
+/* Heat power, fluid specific enthalpy on the cold side and deheating surface */
+/* If deheating is present */
+  if noEvent(HsatvC < Ev.h) then
+    Wdes = Ev.Q * (Ev.h - HsatvC);
+    Wdes = Ee.Q * (Se.h - HDesF);
+    Wdes = noEvent(min(Ev.Q * prodesmC.cp, Ee.Q * prodesmF.cp) * ThermoSysPro.Correlations.Thermal.WBHeatExchangerEfficiency(Ev.Q, Ee.Q, prodesmC.cp, prodesmF.cp, KCond / 2, SDes, 1) * (proevC.T - prodesF.T));
+/* If deheating is absent */
+  else
+    Wdes = 1e-9;
+    HDesF = Se.h;
+    SDes = 1e-9;
+  end if;
+// Condensation zone
+//------------------
+/* Heat power, fluid specific enthalpy at the outlet of the condensation zone and vapor mass flow rate at the inlet */
+  if noEvent(Ev.h < HsatvC) then
+    Wcond = Ev.Q * (Ev.h - HsateC) + Wflash;
+  else
+    Wcond = Ev.Q * (HsatvC - HsateC) + Wflash;
   end if;
 
   Wcond = Ee.Q*(HDesF - HeiF);
-  Wcond = Ee.Q*promcF.cp*ThermoSysPro.Correlations.Thermal.WBHeatExchangerEfficiency(Ev.Q, Ee.Q, 1.e20, promcF.cp, KCond, (SCondDes-SDes), 0.5)*(TsatC - TeiF);
-
-  // Flash zone
-  //-----------
-
-  /* Heat power in case of partial vaporization in the drain */
-  if (flashepC.x > 0) then
-    Wflash = Ep.Q*(Ep.h - HsateC);
-  else
-    Wflash = 0;
+  Wcond = Ee.Q*promcF.cp*ThermoSysPro.Correlations.Thermal.WBHeatExchangerEfficiency(Ev.Q, Ee.Q, 1.e20, promcF.cp, KCond, (SCondDes-SDes), 0.5)*(TsatC - TeiF);
+// Flash zone
+//-----------
+/* Heat power in case of partial vaporization in the drain */
+  if flashepC.x > 0 then
+    Wflash = Ep.Q * (Ep.h - HsateC);
+  else
+    Wflash = 0;
   end if;
 
   /* Condition for partial vaporisation in the drain (flash) */
@@ -213,23 +201,20 @@
     Hep = HsateC;
   else
     Sp.Q*Hep = HsateC*Ev.Q + Ep.h*Ep.Q;
-  end if;
-
-  // Drain cooling zone
-  //-------------------
-
-  /* Power, fluid specific enthalpy at the cold outlet and temperature of the drain outlet */
-  if noEvent(SPurge > 0) then
-    Wpurge = Sp.Q*(Hep - Sp.h);
-    Wpurge = Ee.Q*(HeiF - Ee.h);
-    Wpurge = noEvent(min(Sp.Q*prompC.cp, Ee.Q*prompF.cp)*ThermoSysPro.Correlations.Thermal.WBHeatExchangerEfficiency(Sp.Q, Ee.Q, prompC.cp, prompF.cp,
-              KPurge, SPurge, 0)*(prosp.T - proeeF.T));
-    TeiF = proecF.T;
-  else
-    HeiF = Ee.h;
-    Wpurge = 0;
-    Hep = Sp.h;
-    TeiF = proeeF.T;
+  end if;
+// Drain cooling zone
+//-------------------
+/* Power, fluid specific enthalpy at the cold outlet and temperature of the drain outlet */
+  if noEvent(SPurge > 0) then
+    Wpurge = Sp.Q * (Hep - Sp.h);
+    Wpurge = Ee.Q * (HeiF - Ee.h);
+    Wpurge = noEvent(min(Sp.Q * prompC.cp, Ee.Q * prompF.cp) * ThermoSysPro.Correlations.Thermal.WBHeatExchangerEfficiency(Sp.Q, Ee.Q, prompC.cp, prompF.cp, KPurge, SPurge, 0) * (prosp.T - proeeF.T));
+    TeiF = proecF.T;
+  else
+    HeiF = Ee.h;
+    Wpurge = 0;
+    Hep = Sp.h;
+    TeiF = proeeF.T;
   end if;
 
   /* Fluid thermodynamic properties */
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/SimpleDynamicCondenser.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/SimpleDynamicCondenser.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/SimpleDynamicCondenser.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/SimpleDynamicCondenser.mo"	2022-03-10 09:58:21.932149692 +0000
@@ -1,10 +1,10 @@
-﻿within ThermoSysPro.WaterSteam.HeatExchangers;
+within ThermoSysPro.WaterSteam.HeatExchangers;
 model SimpleDynamicCondenser
-  parameter Modelica.SIunits.Volume V=1 "Cavity volume";
-  parameter Modelica.SIunits.Area A=1 "Cavity cross-sectional area";
+  parameter Modelica.Units.SI.Volume V=1 "Cavity volume";
+  parameter Modelica.Units.SI.Area A=1 "Cavity cross-sectional area";
   parameter Real Vf0=0.5
     "Fraction of initial water volume in the drum (active if steady_state=false)";
-  parameter Modelica.SIunits.AbsolutePressure P0=0.1e5
+  parameter Modelica.Units.SI.AbsolutePressure P0=0.1e5
     "Fluid initial pressure (active if steady_state=false)";
   parameter Boolean gravity_pressure=false
     "true: fluid pressure at the bottom of the cavity includes gravity term - false: without gravity term";
@@ -14,20 +14,20 @@
     "Vapor mass fraction in the liquid phase from which the liquid starts to evaporate";
   parameter Real Xvo=0.9975
     "Vapor mass fraction in the gas phase from which the liquid starts to condensate";
-  parameter Modelica.SIunits.Area Avl=A
+  parameter Modelica.Units.SI.Area Avl=A
     "Heat exchange surface between the liquid and gas phases";
   parameter Real Kvl=1000
     "Heat exchange coefficient between the liquid and gas phases";
-  parameter Modelica.SIunits.Length L=10. "Pipe length";
-  parameter Modelica.SIunits.Diameter D=0.02 "Pipe internal diameter";
-  parameter Modelica.SIunits.Length e=2.e-3 "Wall thickness";
-  parameter Modelica.SIunits.Position z1=0 "Inlet altitude";
-  parameter Modelica.SIunits.Position z2=0 "Outlet altitude";
-  parameter Modelica.SIunits.Length rugosrel=0.0007 "Pipe roughness";
+  parameter Modelica.Units.SI.Length L=10. "Pipe length";
+  parameter Modelica.Units.SI.Diameter D=0.02 "Pipe internal diameter";
+  parameter Modelica.Units.SI.Length e=2.e-3 "Wall thickness";
+  parameter Modelica.Units.SI.Position z1=0 "Inlet altitude";
+  parameter Modelica.Units.SI.Position z2=0 "Outlet altitude";
+  parameter Modelica.Units.SI.Length rugosrel=0.0007 "Pipe roughness";
   parameter Real lambda= 0.03
     "Friction pressure loss coefficient (active if lambda_fixed=true)";
   parameter Integer ntubes=1 "Number of pipes in parallel";
-  parameter Modelica.SIunits.Area At=ntubes*pi*D^2/4
+  parameter Modelica.Units.SI.Area At=ntubes*pi*D^2/4
     "Internal pipe cross-section area (cooling fluid)";
   parameter Boolean steady_state=true
     "true: start from steady state - false: start from (P0, Vl0)";
@@ -37,46 +37,46 @@
     "true: continuous flow reversal - false: discontinuous flow reversal";
 
 protected
-  constant Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  constant Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow rate for continuous flow reversal";
   constant Real pi=Modelica.Constants.pi "pi";
   parameter Real eps=1.e-0 "Small number for pressure loss equation";
 
 public
-  Modelica.SIunits.Density rhom(start=998) "Liquid phase density";
+  Modelica.Units.SI.Density rhom(start=998) "Liquid phase density";
   ThermoSysPro.Units.DifferentialPressure dpf "Friction pressure loss";
   ThermoSysPro.Units.DifferentialPressure dpg "Gravity pressure loss";
   Real khi "Hydraulic pressure loss coefficient";
-  Modelica.SIunits.AbsolutePressure P "Fluid average pressure";
-  Modelica.SIunits.AbsolutePressure Pfond
+  Modelica.Units.SI.AbsolutePressure P "Fluid average pressure";
+  Modelica.Units.SI.AbsolutePressure Pfond
     "Fluid pressure at the bottom of the cavity";
-  Modelica.SIunits.SpecificEnthalpy hl "Liquid phase spepcific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy hv "Gas phase spepcific enthalpy";
-  Modelica.SIunits.Temperature Tl "Liquid phase temperature";
-  Modelica.SIunits.Temperature Tv "Gas phase temperature";
-  Modelica.SIunits.Volume Vl "Liquid phase volume";
-  Modelica.SIunits.Volume Vv "Gas phase volume";
+  Modelica.Units.SI.SpecificEnthalpy hl "Liquid phase spepcific enthalpy";
+  Modelica.Units.SI.SpecificEnthalpy hv "Gas phase spepcific enthalpy";
+  Modelica.Units.SI.Temperature Tl "Liquid phase temperature";
+  Modelica.Units.SI.Temperature Tv "Gas phase temperature";
+  Modelica.Units.SI.Volume Vl "Liquid phase volume";
+  Modelica.Units.SI.Volume Vv "Gas phase volume";
   Real xl(start=0.0) "Mass vapor fraction in the liquid phase";
   Real xv(start=1) "Mass vapor fraction in the gas phase";
-  Modelica.SIunits.Density rhol(start=996) "Liquid phase density";
-  Modelica.SIunits.Density rhov(start=1.5) "Gas phase density";
-  Modelica.SIunits.MassFlowRate BQl
+  Modelica.Units.SI.Density rhol(start=996) "Liquid phase density";
+  Modelica.Units.SI.Density rhov(start=1.5) "Gas phase density";
+  Modelica.Units.SI.MassFlowRate BQl
     "Right hand side of the mass balance equation of the liquid phase";
-  Modelica.SIunits.MassFlowRate BQv
+  Modelica.Units.SI.MassFlowRate BQv
     "Right hand side of the mass balance equation of the gas phaser";
-  Modelica.SIunits.Power BHl
+  Modelica.Units.SI.Power BHl
     "Right hand side of the energy balance equation of the liquid phase";
-  Modelica.SIunits.Power BHv
+  Modelica.Units.SI.Power BHv
     "Right hand side of the energy balance equation of the gas phase";
-  Modelica.SIunits.MassFlowRate Qcond
+  Modelica.Units.SI.MassFlowRate Qcond
     "Condensation mass flow rate from the vapor phase";
-  Modelica.SIunits.MassFlowRate Qevap
+  Modelica.Units.SI.MassFlowRate Qevap
     "Evaporation mass flow rate from the liquid phase";
-  Modelica.SIunits.Power Wvl
+  Modelica.Units.SI.Power Wvl
     "Thermal power exchanged from the gas phase to the liquid phase";
-  Modelica.SIunits.Power Wout
+  Modelica.Units.SI.Power Wout
     "Thermal power exchanged from the steam to the pipes";
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prol
     "Propriétés de l'eau dans le ballon" annotation (Placement(transformation(
@@ -201,7 +201,7 @@
 
   /* Pressure losses in the pipes */
   dpf = khi*ThermoSysPro.Functions.ThermoSquare(Cee.Q,eps)/(2*At^2*rhom);
-  //dpg = rhom*g*(z2 - z1)*L;
+//dpg = rhom*g*(z2 - z1)*L;
   dpg = rhom*g*(z2 - z1);
 
   khi = lambda*L/D;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/SimpleStaticCondenser.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/SimpleStaticCondenser.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/SimpleStaticCondenser.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/SimpleStaticCondenser.mo"	2022-03-10 09:58:21.872149685 +0000
@@ -2,15 +2,15 @@
 model SimpleStaticCondenser "Simple static condenser"
   parameter Real Kc=10 "Friction pressure loss coefficient for the hot side";
   parameter Real Kf=10 "Friction pressure loss coefficient for the cold side";
-  parameter Modelica.SIunits.Position z1c=0 "Hot inlet altitude";
-  parameter Modelica.SIunits.Position z2c=0 "Hot outlet altitude";
-  parameter Modelica.SIunits.Position z1f=0 "Cold inlet altitude";
-  parameter Modelica.SIunits.Position z2f=0 "Cold outlet altitude";
+  parameter Modelica.Units.SI.Position z1c=0 "Hot inlet altitude";
+  parameter Modelica.Units.SI.Position z2c=0 "Hot outlet altitude";
+  parameter Modelica.Units.SI.Position z1f=0 "Cold inlet altitude";
+  parameter Modelica.Units.SI.Position z2f=0 "Cold outlet altitude";
   parameter Boolean continuous_flow_reversal=false
     "true: continuous flow reversal - false: discontinuous flow reversal";
-  parameter Modelica.SIunits.Density p_rhoc=0
+  parameter Modelica.Units.SI.Density p_rhoc=0
     "If > 0, fixed fluid density for the hot side";
-  parameter Modelica.SIunits.Density p_rhof=0
+  parameter Modelica.Units.SI.Density p_rhof=0
     "If > 0, fixed fluid density for the cold side";
   parameter Integer modec=0
     "IF97 region of the water for the hot side. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
@@ -20,23 +20,23 @@
     "IF97 region of the water for the cold side. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 protected
-  constant Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  constant Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
   constant Real pi=Modelica.Constants.pi "pi";
   parameter Real eps=1.e-0 "Small number for pressure loss equation";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow rate for continuous flow reversal";
 
 public
-  Modelica.SIunits.Power W(start=1e6)
+  Modelica.Units.SI.Power W(start=1e6)
     "Power exchanged from the hot side to the cold side";
-  Modelica.SIunits.Temperature Tec(start=500)
+  Modelica.Units.SI.Temperature Tec(start=500)
     "Fluid temperature at the inlet of the hot side";
-  Modelica.SIunits.Temperature Tsc(start=400)
+  Modelica.Units.SI.Temperature Tsc(start=400)
     "Fluid temperature at the outlet of the hot side";
-  Modelica.SIunits.Temperature Tef(start=350)
+  Modelica.Units.SI.Temperature Tef(start=350)
     "Fluid temperature at the inlet of the cold side";
-  Modelica.SIunits.Temperature Tsf(start=350)
+  Modelica.Units.SI.Temperature Tsf(start=350)
     "Fluid temperature at the outlet of the cold side";
   ThermoSysPro.Units.DifferentialPressure DPfc(start=1e3)
     "Friction pressure loss in the hot side";
@@ -50,13 +50,13 @@
     "Gravity pressure loss in the cold side";
   ThermoSysPro.Units.DifferentialPressure DPf( start=1e3)
     "Total pressure loss in the cold side";
-  Modelica.SIunits.Density rhoc(start=998)
+
+  Modelica.Units.SI.Density rhoc(start=998)
     "Density of the fluid in the hot side";
-  Modelica.SIunits.Density rhof(start=998)
+  Modelica.Units.SI.Density rhof(start=998)
     "Density of the fluid in the cold side";
-  Modelica.SIunits.MassFlowRate Qc(start=100) "Hot fluid mass flow rate";
-  Modelica.SIunits.MassFlowRate Qf(start=100) "Cold fluid mass flow rate";
-
+  Modelica.Units.SI.MassFlowRate Qc(start=100) "Hot fluid mass flow rate";
+  Modelica.Units.SI.MassFlowRate Qf(start=100) "Cold fluid mass flow rate";
 public
   Connectors.FluidInlet Ec
                           annotation (Placement(transformation(extent={{-70,
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/StaticCondenser.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/StaticCondenser.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/StaticCondenser.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/StaticCondenser.mo"	2022-03-10 09:58:21.844149681 +0000
@@ -1,13 +1,13 @@
-﻿within ThermoSysPro.WaterSteam.HeatExchangers;
+within ThermoSysPro.WaterSteam.HeatExchangers;
 model StaticCondenser "Static condenser"
-  parameter Modelica.SIunits.Area SCO=10000 "Heat exchange surface";
+  parameter Modelica.Units.SI.Area SCO=10000 "Heat exchange surface";
   parameter Real CPCE=0.02
     "Pressure loss coefficient for the water side (Pa.s²/(kg.m**3))";
-  parameter Modelica.SIunits.Height z=0.5 "Water level in the condenser";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer KCO=1
+  parameter Modelica.Units.SI.Height z=0.5 "Water level in the condenser";
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer KCO=1
     "Reference heat exchange coefficient";
-  parameter Modelica.SIunits.MassFlowRate QC0=100 "Reference mass flow rate";
-  parameter Modelica.SIunits.Temperature Tref=293 "Reference temperature";
+  parameter Modelica.Units.SI.MassFlowRate QC0=100 "Reference mass flow rate";
+  parameter Modelica.Units.SI.Temperature Tref=293 "Reference temperature";
   parameter Real COPR=1 "Reference fouling coefficient";
   parameter Real COP=1 "Actual fouling coefficient";
   parameter Boolean continuous_flow_reversal=false
@@ -20,69 +20,69 @@
     "IF97 region at the extraction point. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 protected
-  constant Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  constant Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
   constant Real pi=Modelica.Constants.pi "pi";
   parameter Real eps=1.e-0 "Small number for pressure loss equation";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow rate for continuous flow reversal";
 
 public
-  Modelica.SIunits.MassFlowRate Qee(start=10)
+  Modelica.Units.SI.MassFlowRate Qee(start=10)
     "Cooling water mass flow rate at the inlet";
-  Modelica.SIunits.SpecificEnthalpy Hee(start=250000)
+  Modelica.Units.SI.SpecificEnthalpy Hee(start=250000)
     "Cooling water specific anthalpy at the inlet";
-  Modelica.SIunits.AbsolutePressure Pee(start=1.e5)
+  Modelica.Units.SI.AbsolutePressure Pee(start=1.e5)
     "Cooling water pressure at the inlet";
-  Modelica.SIunits.MassFlowRate Qep(start=10)
+  Modelica.Units.SI.MassFlowRate Qep(start=10)
     "Drain mass flow rate at the inlet";
-  Modelica.SIunits.SpecificEnthalpy Hep(start=1000000)
+  Modelica.Units.SI.SpecificEnthalpy Hep(start=1000000)
     "Drain specific enthalpy at the inlet";
-  Modelica.SIunits.MassFlowRate Qev(start=10)
+  Modelica.Units.SI.MassFlowRate Qev(start=10)
     "Vapor mass flow rate at the inlet";
-  Modelica.SIunits.SpecificEnthalpy Hev(start=2500000)
+  Modelica.Units.SI.SpecificEnthalpy Hev(start=2500000)
     "Vapor specific enthalpy at the inlet";
-  Modelica.SIunits.MassFlowRate Qvt(start=10)
+  Modelica.Units.SI.MassFlowRate Qvt(start=10)
     "Vapor mass flow rate leaving the turbine";
-  Modelica.SIunits.SpecificEnthalpy Hvt(start=2500000)
+  Modelica.Units.SI.SpecificEnthalpy Hvt(start=2500000)
     "Vapor specific enthalpy leaving the turbine";
-  Modelica.SIunits.MassFlowRate Qse(start=10)
+  Modelica.Units.SI.MassFlowRate Qse(start=10)
     "Cooling water mass flow rate at the outlet";
-  Modelica.SIunits.SpecificEnthalpy Hse(start=500000)
+  Modelica.Units.SI.SpecificEnthalpy Hse(start=500000)
     "Cooling water specific enthalpy at the outlet";
-  Modelica.SIunits.AbsolutePressure Pse(start=1.e5)
+  Modelica.Units.SI.AbsolutePressure Pse(start=1.e5)
     "Cooling water pressure at the outlet";
-  Modelica.SIunits.MassFlowRate Qex(start=10)
+  Modelica.Units.SI.MassFlowRate Qex(start=10)
     "Drain mass flow rate at the outlet";
-  Modelica.SIunits.SpecificEnthalpy Hex(start=500000)
+  Modelica.Units.SI.SpecificEnthalpy Hex(start=500000)
     "Drain specific enthalpy at the outlet";
-  Modelica.SIunits.AbsolutePressure Pex(start=1.e5)
+  Modelica.Units.SI.AbsolutePressure Pex(start=1.e5)
     "Drain pressure at the outlet";
-  Modelica.SIunits.SpecificEnthalpy Hsate(start=200000)
+  Modelica.Units.SI.SpecificEnthalpy Hsate(start=200000)
     "Water specific enthalpy at the saturation point";
-  Modelica.SIunits.AbsolutePressure Pcond( start=17000)
+  Modelica.Units.SI.AbsolutePressure Pcond( start=17000)
     "Vapor pressure inside the condenser";
-  Modelica.SIunits.Temperature Tsat(start=500)
+  Modelica.Units.SI.Temperature Tsat(start=500)
     "Water temperature at the saturation point";
-  Modelica.SIunits.Temperature Tee(start=300)
+  Modelica.Units.SI.Temperature Tee(start=300)
     "Cooling water temperature at the inlet";
-  Modelica.SIunits.Temperature Tse(start=400)
+  Modelica.Units.SI.Temperature Tse(start=400)
     "Cooling water temperature at the outlet";
-   Modelica.SIunits.Density rho_ee(start=900)
+   Modelica.Units.SI.Density rho_ee(start=900)
     "Cooling water density at the inlet";
-  Modelica.SIunits.Density rho_ex(start=900)
+  Modelica.Units.SI.Density rho_ex(start=900)
     "Water density at the extraction point";
-  Modelica.SIunits.CoefficientOfHeatTransfer KT1(start=50)
+  Modelica.Units.SI.CoefficientOfHeatTransfer KT1(start=50)
     "First reference value for the exchange coefficient";
-  Modelica.SIunits.CoefficientOfHeatTransfer KT2(start=50)
+  Modelica.Units.SI.CoefficientOfHeatTransfer KT2(start=50)
     "Second reference value for the exchange coefficient";
-  Modelica.SIunits.CoefficientOfHeatTransfer XKCO(start=200)
+  Modelica.Units.SI.CoefficientOfHeatTransfer XKCO(start=200)
     "Heat transfer coefficient";
-  Modelica.SIunits.SpecificEnthalpy Hmv(start=2500000)
+  Modelica.Units.SI.SpecificEnthalpy Hmv(start=2500000)
     "Fluid input average specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy Hml(start=250000)
+  Modelica.Units.SI.SpecificEnthalpy Hml(start=250000)
     "Extraction water average specific enthalpy";
-  Modelica.SIunits.Power W "Heat power released to the cold source";
+  Modelica.Units.SI.Power W "Heat power released to the cold source";
 public
   ThermoSysPro.WaterSteam.Connectors.FluidInlet Cee "Cooling water inlet"
     annotation (Placement(transformation(extent={{-112,-72},{-88,-50}},
@@ -153,18 +153,14 @@
   Pse = Cse.P;
 
   Qex = Cex.Q;
-  Pex = Cex.P;
-
-  // Cooling pipe
-  //-------------
-
-  /* Flow reversal for the cooling water pipe */
-  if continuous_flow_reversal then
-    0 = noEvent(if (Qee > Qeps) then Cee.h - Cee.h_vol else if (Qee < -Qeps) then
-      Cse.h - Cse.h_vol else Cee.h - 0.5*((Cee.h_vol - Cse.h_vol)*Modelica.Math.sin(pi
-      *Qee/2/Qeps) + Cee.h_vol + Cse.h_vol));
-  else
-    0 = if (Qee > 0) then Cee.h - Cee.h_vol else Cse.h - Cse.h_vol;
+  Pex = Cex.P;
+// Cooling pipe
+//-------------
+/* Flow reversal for the cooling water pipe */
+  if continuous_flow_reversal then
+    0 = noEvent(if Qee > Qeps then Cee.h - Cee.h_vol else if Qee < (-Qeps) then Cse.h - Cse.h_vol else Cee.h - 0.5 * ((Cee.h_vol - Cse.h_vol) * Modelica.Math.sin(pi * Qee / 2 / Qeps) + Cee.h_vol + Cse.h_vol));
+  else
+    0 = if Qee > 0 then Cee.h - Cee.h_vol else Cse.h - Cse.h_vol;
   end if;
 
   /* Mass balance equation for the water pipe */
@@ -174,12 +170,10 @@
   Pse = noEvent(if (rho_ee > 0) then Pee - (CPCE * ThermoSysPro.Functions.ThermoSquare(Qee, eps)/ rho_ee) else Pee);
 
   /* Heating power released to the cooling pipe */
-  W = Qee*(Hse - Hee);
-
-  // Water/steam cavity
-  //-------------------
-
-  /* Fluid pressure */
+  W = Qee*(Hse - Hee);
+// Water/steam cavity
+//-------------------
+/* Fluid pressure */
   Pcond = Cep.P;
   Pcond = Cev.P;
   Pcond = Cvt.P;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/StaticCondenserHEI.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/StaticCondenserHEI.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/StaticCondenserHEI.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/StaticCondenserHEI.mo"	2022-03-10 09:58:21.800149675 +0000
@@ -1,18 +1,18 @@
-﻿within ThermoSysPro.WaterSteam.HeatExchangers;
+within ThermoSysPro.WaterSteam.HeatExchangers;
 model StaticCondenserHEI "HEI Static condenser"
 
   parameter Real Kf=0 "Friction pressure loss coefficient for the cold side";
-  parameter Modelica.SIunits.Position z1c=0 "Hot inlet altitude";
-  parameter Modelica.SIunits.Position z2c=0 "Hot outlet altitude";
-  parameter Modelica.SIunits.Position z1f=0 "Cold inlet altitude";
-  parameter Modelica.SIunits.Position z2f=0 "Cold outlet altitude";
+  parameter Modelica.Units.SI.Position z1c=0 "Hot inlet altitude";
+  parameter Modelica.Units.SI.Position z2c=0 "Hot outlet altitude";
+  parameter Modelica.Units.SI.Position z1f=0 "Cold inlet altitude";
+  parameter Modelica.Units.SI.Position z2f=0 "Cold outlet altitude";
   parameter Real Ucorr=1.00
     "Corrective term for the heat transfert coefficient (U) for calibration";
   parameter Boolean continuous_flow_reversal=false
     "true: continuous flow reversal - false: discontinuous flow reversal";
-  parameter Modelica.SIunits.Density p_rhoc=0
+  parameter Modelica.Units.SI.Density p_rhoc=0
     "If > 0, fixed fluid density for the hot side";
-  parameter Modelica.SIunits.Density p_rhof=0
+  parameter Modelica.Units.SI.Density p_rhof=0
     "If > 0, fixed fluid density for the cold side";
   parameter Integer modec=0
     "IF97 region of the water for the hot side. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
@@ -48,56 +48,56 @@
   parameter Real nb_tube4=200 "Number of tubes type 4";
   parameter Real nb_tube5=200 "Number of tubes type 5";
   parameter Real nb_tube6=200 "Number of tubes type 6";
-  parameter Modelica.SIunits.Thickness e_tube1=0.7e-3 "Tubes thickness type 1";
-  parameter Modelica.SIunits.Thickness e_tube2=0.7e-3 "Tubes thickness type 2";
-  parameter Modelica.SIunits.Thickness e_tube3=1e-3 "Tubes thickness type 3";
-  parameter Modelica.SIunits.Thickness e_tube4=1e-3 "Tubes thickness type 4";
-  parameter Modelica.SIunits.Thickness e_tube5=1e-3 "Tubes thickness type 5";
-  parameter Modelica.SIunits.Thickness e_tube6=1e-3 "Tubes thickness type 6";
-  parameter Modelica.SIunits.Diameter D_tube1=25.4e-3
+  parameter Modelica.Units.SI.Thickness e_tube1=0.7e-3 "Tubes thickness type 1";
+  parameter Modelica.Units.SI.Thickness e_tube2=0.7e-3 "Tubes thickness type 2";
+  parameter Modelica.Units.SI.Thickness e_tube3=1e-3 "Tubes thickness type 3";
+  parameter Modelica.Units.SI.Thickness e_tube4=1e-3 "Tubes thickness type 4";
+  parameter Modelica.Units.SI.Thickness e_tube5=1e-3 "Tubes thickness type 5";
+  parameter Modelica.Units.SI.Thickness e_tube6=1e-3 "Tubes thickness type 6";
+  parameter Modelica.Units.SI.Diameter D_tube1=25.4e-3
     "External diameter of tubes type 1";
-  parameter Modelica.SIunits.Diameter D_tube2=25.4e-3
+  parameter Modelica.Units.SI.Diameter D_tube2=25.4e-3
     "External diameter of tubes type 2";
-  parameter Modelica.SIunits.Diameter D_tube3=25.4e-3
+  parameter Modelica.Units.SI.Diameter D_tube3=25.4e-3
     "External diameter of tubes type 3";
-  parameter Modelica.SIunits.Diameter D_tube4=25.4e-3
+  parameter Modelica.Units.SI.Diameter D_tube4=25.4e-3
     "External diameter of tubes type 4";
-  parameter Modelica.SIunits.Diameter D_tube5=25.4e-3
+  parameter Modelica.Units.SI.Diameter D_tube5=25.4e-3
     "External diameter of tubes type 5";
-  parameter Modelica.SIunits.Diameter D_tube6=25.4e-3
+  parameter Modelica.Units.SI.Diameter D_tube6=25.4e-3
     "External diameter of tubes type 6";
-  parameter Modelica.SIunits.Length L_tube1=10 "Tubes length type 1";
-  parameter Modelica.SIunits.Length L_tube2=10 "Tubes length type 2";
-  parameter Modelica.SIunits.Length L_tube3=10 "Tubes length type 3";
-  parameter Modelica.SIunits.Length L_tube4=10 "Tubes length type 4";
-  parameter Modelica.SIunits.Length L_tube5=10 "Tubes length type 5";
-  parameter Modelica.SIunits.Length L_tube6=10 "Tubes length type 6";
+  parameter Modelica.Units.SI.Length L_tube1=10 "Tubes length type 1";
+  parameter Modelica.Units.SI.Length L_tube2=10 "Tubes length type 2";
+  parameter Modelica.Units.SI.Length L_tube3=10 "Tubes length type 3";
+  parameter Modelica.Units.SI.Length L_tube4=10 "Tubes length type 4";
+  parameter Modelica.Units.SI.Length L_tube5=10 "Tubes length type 5";
+  parameter Modelica.Units.SI.Length L_tube6=10 "Tubes length type 6";
   parameter Real FC=0.95 "Correction factor for cleanless";
 
-  parameter Modelica.SIunits.Pressure Poffset=0
+  parameter Modelica.Units.SI.Pressure Poffset=0
     "Offset applied on the pressure provided by HEI";
 
 protected
-  constant Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  constant Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
   constant Real pi=Modelica.Constants.pi "pi";
   parameter Real eps=1.e-0 "Small number for pressure loss equation";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow rate for continuous flow reversal";
-  Modelica.SIunits.Diameter D_tubes "Weight average diameter of tubes";
-  Modelica.SIunits.Thickness e_tubes "Weight average thickness of tubes";
-  Modelica.SIunits.Area S_pass(start=3) "Passage section of cold water";
-  Modelica.SIunits.Area S_ech1(start=10000)
+  Modelica.Units.SI.Diameter D_tubes "Weight average diameter of tubes";
+  Modelica.Units.SI.Thickness e_tubes "Weight average thickness of tubes";
+  Modelica.Units.SI.Area S_pass(start=3) "Passage section of cold water";
+  Modelica.Units.SI.Area S_ech1(start=10000)
     "Heat exchange surface tubes type 1";
-  Modelica.SIunits.Area S_ech2(start=10000)
+  Modelica.Units.SI.Area S_ech2(start=10000)
     "Heat exchange surface tubes type 2";
-  Modelica.SIunits.Area S_ech3(start=10000)
+  Modelica.Units.SI.Area S_ech3(start=10000)
     "Heat exchange surface tubes type 3";
-  Modelica.SIunits.Area S_ech4(start=10000)
+  Modelica.Units.SI.Area S_ech4(start=10000)
     "Heat exchange surface tubes type 4";
-  Modelica.SIunits.Area S_ech5(start=10000)
+  Modelica.Units.SI.Area S_ech5(start=10000)
     "Heat exchange surface tubes type 5";
-  Modelica.SIunits.Area S_ech6(start=10000)
+  Modelica.Units.SI.Area S_ech6(start=10000)
     "Heat exchange surface tubes type 6";
   Real FM1 "Correction factor for material and gauge tubes type 1";
   Real FM2 "Correction factor for material and gauge tubes type 2";
@@ -107,60 +107,60 @@
   Real FM6 "Correction factor for material and gauge tubes type 6";
 
 public
-  Modelica.SIunits.Power W(start=1e6)
+  Modelica.Units.SI.Power W(start=1e6)
     "Power exchanged from the hot side to the cold side";
-  Modelica.SIunits.Temperature Tec(start=500)
+  Modelica.Units.SI.Temperature Tec(start=500)
     "Fluid temperature at the inlet of the hot side";
-  Modelica.SIunits.Temperature Tsc(start=400)
+  Modelica.Units.SI.Temperature Tsc(start=400)
     "Fluid temperature at the outlet of the hot side";
-  Modelica.SIunits.Temperature Tef(start=350)
+  Modelica.Units.SI.Temperature Tef(start=350)
     "Fluid temperature at the inlet of the cold side";
-  Modelica.SIunits.Temperature Tsf(start=350)
+  Modelica.Units.SI.Temperature Tsf(start=350)
     "Fluid temperature at the outlet of the cold side";
-  Modelica.SIunits.Pressure DPgc(start=1e2)
+  Modelica.Units.SI.Pressure DPgc(start=1e2)
     "Gravity pressure loss in the hot side";
-  Modelica.SIunits.Pressure DPff(start=1e3)
+  Modelica.Units.SI.Pressure DPff(start=1e3)
     "Friction pressure loss in the cold side";
-  Modelica.SIunits.Pressure DPgf(start=1e2)
+  Modelica.Units.SI.Pressure DPgf(start=1e2)
     "Gravity pressure loss in the cold side";
-  Modelica.SIunits.Pressure DPf(start=1e3)
+  Modelica.Units.SI.Pressure DPf(start=1e3)
     "Total pressure loss in the cold side";
-  Modelica.SIunits.Density rhof(start=998)
+  Modelica.Units.SI.Density rhof(start=998)
     "Density of the fluid in the cold side";
-  Modelica.SIunits.Density rho_ex(start=950)
+  Modelica.Units.SI.Density rho_ex(start=950)
     "Water density at the extraction point";
 
-  Modelica.SIunits.MassFlowRate Qc(start=100) "Hot fluid mass flow rate";
-  Modelica.SIunits.MassFlowRate Qf(start=100) "Cold fluid mass flow rate";
-  Modelica.SIunits.Area S_ech(start=10000) "Heat exchange surface";
-  Modelica.SIunits.Velocity Vf "Velocity of cold water";
+  Modelica.Units.SI.MassFlowRate Qc(start=100) "Hot fluid mass flow rate";
+  Modelica.Units.SI.MassFlowRate Qf(start=100) "Cold fluid mass flow rate";
+  Modelica.Units.SI.Area S_ech(start=10000) "Heat exchange surface";
+  Modelica.Units.SI.Velocity Vf "Velocity of cold water";
   Real Fw "Correction factor for water";
-  Modelica.SIunits.CoefficientOfHeatTransfer U1
+  Modelica.Units.SI.CoefficientOfHeatTransfer U1
     "Uncorrected heat transfert coefficient";
   Real FM "Overall correction factor for material and gauge";
-  Modelica.SIunits.CoefficientOfHeatTransfer U "Heat transfert coefficient";
-  Modelica.SIunits.Temperature Tcut_off
+  Modelica.Units.SI.CoefficientOfHeatTransfer U "Heat transfert coefficient";
+  Modelica.Units.SI.Temperature Tcut_off
     "Saturation temperature at pressure cut off";
-  Modelica.SIunits.Pressure Psat_att( start= 6000)
+  Modelica.Units.SI.Pressure Psat_att( start= 6000)
                                                   "Expected saturation pressure HEI";
-  Modelica.SIunits.Pressure Pcut_off "Pressure cut off";
-  Modelica.SIunits.Pressure Pzero_load "Pressure zero load";
-  Modelica.SIunits.Pressure Pcond( start= 6000)
+  Modelica.Units.SI.Pressure Pcut_off "Pressure cut off";
+  Modelica.Units.SI.Pressure Pzero_load "Pressure zero load";
+  Modelica.Units.SI.Pressure Pcond( start= 6000)
     "Expected corrected saturation pressure HEI";
-  Modelica.SIunits.Temperature Tsat(start= 310)
+  Modelica.Units.SI.Temperature Tsat(start= 310)
     "Expected corrected saturation temperature HEI";
-  Modelica.SIunits.Power Wcut_off(start=5e5)
+  Modelica.Units.SI.Power Wcut_off(start=5e5)
     "Power exchanged from the hot side to the cold side at Pcut_off";
-  Modelica.SIunits.Temperature TTD "Terminal Temperature Difference";
+  Modelica.Units.SI.Temperature TTD "Terminal Temperature Difference";
   Integer HEI "Applicabiltity of the standards HEI. 0:NO - 1:OK";
-  Modelica.SIunits.Temperature Tsat_att(start= 310) "Expected saturation temperature HEI";
-  Modelica.SIunits.SpecificHeatCapacity Cpmf(start= 950)
+  Modelica.Units.SI.Temperature Tsat_att(start= 310) "Expected saturation temperature HEI";
+  Modelica.Units.SI.SpecificHeatCapacity Cpmf(start= 950)
     "Average of specific heat capacity of cold water";
-  Modelica.SIunits.SpecificEnthalpy Hmv(start=2500000)
+  Modelica.Units.SI.SpecificEnthalpy Hmv(start=2500000)
     "Fluid input average specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy Hml(start=100000)
+  Modelica.Units.SI.SpecificEnthalpy Hml(start=100000)
     "Extraction water average specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy Hex(start=100000)
+  Modelica.Units.SI.SpecificEnthalpy Hex(start=100000)
     "Drain specific enthalpy at the outlet";
 
 public
@@ -208,15 +208,14 @@
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph promf
     "Proprietes eau"
     annotation (Placement(transformation(extent={{80,80},{100,100}}, rotation=0)));
-equation
-  // Water/steam cavity
-  //-------------------
-
-  /* Unconnected connectors */
-  if (cardinality(Cev) == 0) then
-    Cev.Q = 0;
-    Cev.h = 1.e5;
-    Cev.b = true;
+equation
+// Water/steam cavity
+//-------------------
+/* Unconnected connectors */
+  if cardinality(Cev) == 0 then
+    Cev.Q = 0;
+    Cev.h = 1.e5;
+    Cev.b = true;
   end if;
 
   if (cardinality(Cep) == 0) then
@@ -283,9 +282,8 @@
 
   /* Fluid thermodynamic properties in the hot side */
   proce = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(Cvt.P, Hmv, modec);
-  procs = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(Cex.P, Cex.h, modecs);
-  //procs = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(Pcond + Cex.P)/2, (lsat.h + Cex.h)/2, modecs);
-
+  procs = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(Cex.P, Cex.h, modecs);
+//procs = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(Pcond + Cex.P)/2, (lsat.h + Cex.h)/2, modecs);
   Tec = proce.T;
   Tsc = procs.T;
 
@@ -348,10 +346,9 @@
   FM = (FM1*S_ech1 + FM2*S_ech2 + FM3*S_ech3 + FM4*S_ech4 + FM5*S_ech5 + FM6*S_ech6)/S_ech;
 
   /* Calculation of the heat transfert coefficient from the HEI standard 10th édition */
-  U = Ucorr*U1*FM*FC*Fw;
-  //U = U1*FM*FC*Fw + Ucorr;
-
-  /* Calculation of Average of specific heat capacity of cold water */
+  U = Ucorr*U1*FM*FC*Fw;
+//U = U1*FM*FC*Fw + Ucorr;
+/* Calculation of Average of specific heat capacity of cold water */
   Cpmf = promf.cp;
 
   /* Calculation of Expected saturation temperature HEI */
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/StaticWaterWaterExchanger.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/StaticWaterWaterExchanger.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/StaticWaterWaterExchanger.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/StaticWaterWaterExchanger.mo"	2022-03-10 09:58:21.676149661 +0000
@@ -1,22 +1,22 @@
-﻿within ThermoSysPro.WaterSteam.HeatExchangers;
+within ThermoSysPro.WaterSteam.HeatExchangers;
 model StaticWaterWaterExchanger "Static plate heat exchanger"
-  parameter Modelica.SIunits.ThermalConductivity lambdam=15.0
+  parameter Modelica.Units.SI.ThermalConductivity lambdam=15.0
     "Metal thermal conductivity";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer p_hc=6000
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer p_hc=6000
     "Heat transfer coefficient for the hot side if not computed by the correlations";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer p_hf=3000
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer p_hf=3000
     "Heat transfer coefficient for the cold side if not computed by the correlations";
   parameter Real p_Kc=100
     "Pressure loss coefficient for the hot side if not computed by the correlations";
   parameter Real p_Kf=100
     "Pressure loss coefficient for the cold side if not computed by the correlations";
-  parameter Modelica.SIunits.Thickness emetal=0.0006 "Wall thickness";
-  parameter Modelica.SIunits.Area Sp=2 "Plate area";
+  parameter Modelica.Units.SI.Thickness emetal=0.0006 "Wall thickness";
+  parameter Modelica.Units.SI.Area Sp=2 "Plate area";
   parameter Real nbp=499 "Number of plates";
   parameter Real c1=1.12647 "Correction coefficient";
-  parameter Modelica.SIunits.Density p_rhoc=0
+  parameter Modelica.Units.SI.Density p_rhoc=0
     "If > 0, fixed fluid density for the hot fluid";
-  parameter Modelica.SIunits.Density p_rhof=0
+  parameter Modelica.Units.SI.Density p_rhof=0
     "If > 0, fixed fluid density for the cold fluid";
   parameter Integer modec=0
     "IF97 region for the hot fluid. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
@@ -31,20 +31,20 @@
     "Correlation for the computation of the pressure loss coefficient - 0: no correlation. 1: SRI correlations";
 
 public
-  Modelica.SIunits.Power W "Thermal power exchanged between the two sides";
+  Modelica.Units.SI.Power W "Thermal power exchanged between the two sides";
   ThermoSysPro.Units.DifferentialPressure DPc "Pressure loss of the hot fluid";
   ThermoSysPro.Units.DifferentialPressure DPf "Pressure loss of the cold fluid";
-  Modelica.SIunits.CoefficientOfHeatTransfer hc
+  Modelica.Units.SI.CoefficientOfHeatTransfer hc
     "Heat transfer coefficient of the hot fluid";
-  Modelica.SIunits.CoefficientOfHeatTransfer hf
+  Modelica.Units.SI.CoefficientOfHeatTransfer hf
     "Heat transfer coefficient of the cold fluid";
-  Modelica.SIunits.CoefficientOfHeatTransfer K
+  Modelica.Units.SI.CoefficientOfHeatTransfer K
     "Global heat transfer coefficient";
-  Modelica.SIunits.Area S "Heat exchange surface";
-  Modelica.SIunits.Temperature Tec "Fluid temperature at the hot inlet";
-  Modelica.SIunits.Temperature Tsc "Fluid temperature at the hot outlet";
-  Modelica.SIunits.Temperature Tef "Fluid temperature at the cold inlet";
-  Modelica.SIunits.Temperature Tsf "Fluid temperature at the cold outlet";
+  Modelica.Units.SI.Area S "Heat exchange surface";
+  Modelica.Units.SI.Temperature Tec "Fluid temperature at the hot inlet";
+  Modelica.Units.SI.Temperature Tsc "Fluid temperature at the hot outlet";
+  Modelica.Units.SI.Temperature Tef "Fluid temperature at the cold inlet";
+  Modelica.Units.SI.Temperature Tsf "Fluid temperature at the cold outlet";
   ThermoSysPro.Units.DifferentialTemperature DTm
     "Difference in average temperature";
   ThermoSysPro.Units.DifferentialTemperature DT1
@@ -52,35 +52,35 @@
   ThermoSysPro.Units.DifferentialTemperature DT2
     "Temperature difference at the outlet of the exchanger";
   Real DT12 "DT1/DT2 (s.u.)";
-  Modelica.SIunits.MassFlowRate Qc(start=500) "Mass flow rate of the hot fluid";
-  Modelica.SIunits.MassFlowRate Qf(start=500)
+  Modelica.Units.SI.MassFlowRate Qc(start=500) "Mass flow rate of the hot fluid";
+  Modelica.Units.SI.MassFlowRate Qf(start=500)
     "Mass flow rate of the cold fluid";
   Real qmc;
   Real qmf;
   Real quc;
   Real quf;
   Real N;
-  Modelica.SIunits.Density rhoc(start=998) "Hot fluid density";
-  Modelica.SIunits.Density rhof(start=998) "Cold fluid density";
-  Modelica.SIunits.DynamicViscosity muc(start=1.e-3)
+
+  Modelica.Units.SI.Density rhoc(start=998) "Hot fluid density";
+  Modelica.Units.SI.Density rhof(start=998) "Cold fluid density";
+  Modelica.Units.SI.DynamicViscosity muc(start=1.e-3)
     "Hot fluid dynamic viscosity";
-  Modelica.SIunits.DynamicViscosity muf(start=1.e-3)
+  Modelica.Units.SI.DynamicViscosity muf(start=1.e-3)
     "Cold fluid dynamic viscosity";
-  Modelica.SIunits.ThermalConductivity lambdac(start=0.602698)
+  Modelica.Units.SI.ThermalConductivity lambdac(start=0.602698)
     "Hot fluid thermal conductivity";
-  Modelica.SIunits.ThermalConductivity lambdaf(start=0.597928)
+  Modelica.Units.SI.ThermalConductivity lambdaf(start=0.597928)
     "Cold fluid thermal conductivity";
-  Modelica.SIunits.Temperature Tmc(start=290) "Hot fluid average temperature";
-  Modelica.SIunits.Temperature Tmf(start=290) "Cold fluid average temperature";
-  Modelica.SIunits.AbsolutePressure Pmc(start=1.e5)
+  Modelica.Units.SI.Temperature Tmc(start=290) "Hot fluid average temperature";
+  Modelica.Units.SI.Temperature Tmf(start=290) "Cold fluid average temperature";
+  Modelica.Units.SI.AbsolutePressure Pmc(start=1.e5)
     "Hot fluid average pressure";
-  Modelica.SIunits.AbsolutePressure Pmf(start=1.e5)
+  Modelica.Units.SI.AbsolutePressure Pmf(start=1.e5)
     "Cold fluid average pressure";
-  Modelica.SIunits.SpecificEnthalpy Hmc(start=100000)
+  Modelica.Units.SI.SpecificEnthalpy Hmc(start=100000)
     "Hot fluid average specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy Hmf(start=100000)
+  Modelica.Units.SI.SpecificEnthalpy Hmf(start=100000)
     "Cold fluid average specific enthalpy";
-
 public
   Connectors.FluidInlet Ec
                           annotation (Placement(transformation(extent={{-110,
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/StaticWaterWaterExchangerDTorWorEff.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/StaticWaterWaterExchangerDTorWorEff.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/StaticWaterWaterExchangerDTorWorEff.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/HeatExchangers/StaticWaterWaterExchangerDTorWorEff.mo"	2022-03-10 09:58:21.628149654 +0000
@@ -5,21 +5,21 @@
     "Exchanger type - 1: Delta temperature is fixed - 2: delta power is fixed - 3: efficiency is fixed";
   parameter ThermoSysPro.Units.DifferentialTemperature DTfroid=0
     "Temperature difference between the cold inlet and the cold outlet (active if exchanger_type=1)";
-  parameter Modelica.SIunits.Power DW=0
+  parameter Modelica.Units.SI.Power DW=0
     "Power increase on the cold side (active if exchanger_type=2)";
   parameter Real EffEch=0.9
     "Thermal exchange efficiency (=W/Wmax) (active if exchanger_type=3)";
   parameter Real Kc=10 "Pressure loss coefficient for the hot fluid";
   parameter Real Kf=10 "Pressure loss coefficient for the cold fluid";
-  parameter Modelica.SIunits.Position z1c=0 "Hot inlet altitude";
-  parameter Modelica.SIunits.Position z2c=0 "Hot outlet altitude";
-  parameter Modelica.SIunits.Position z1f=0 "Cold inlet altitude";
-  parameter Modelica.SIunits.Position z2f=0 "Cold outlet altitude";
+  parameter Modelica.Units.SI.Position z1c=0 "Hot inlet altitude";
+  parameter Modelica.Units.SI.Position z2c=0 "Hot outlet altitude";
+  parameter Modelica.Units.SI.Position z1f=0 "Cold inlet altitude";
+  parameter Modelica.Units.SI.Position z2f=0 "Cold outlet altitude";
   parameter Boolean continuous_flow_reversal=false
     "true: continuous flow reversal - false: discontinuous flow reversal";
-  parameter Modelica.SIunits.Density p_rhoc=0
+  parameter Modelica.Units.SI.Density p_rhoc=0
     "If > 0, fixed fluid density for the hot fluid";
-  parameter Modelica.SIunits.Density p_rhof=0
+  parameter Modelica.Units.SI.Density p_rhof=0
     "If > 0, fixed fluid density for the cold fluid";
   parameter Integer modec=0
     "IF97 region of the water for the hot fluid. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
@@ -29,25 +29,25 @@
     "IF97 region of the water for the cold fluid. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 protected
-  constant Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  constant Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
   constant Real pi=Modelica.Constants.pi "pi";
   parameter Real eps=1.e-0 "Small number for pressure loss equation";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow rate for continuous flow reversal";
 
 public
-  Modelica.SIunits.Power W(start=1e6)
+  Modelica.Units.SI.Power W(start=1e6)
     "Power exchanged from the hot fluid to the cold fluid";
-  Modelica.SIunits.Temperature Tec(start=500)
+  Modelica.Units.SI.Temperature Tec(start=500)
     "Fluid temperature at the inlet of the hot side";
-  Modelica.SIunits.Temperature Tsc(start=400)
+  Modelica.Units.SI.Temperature Tsc(start=400)
     "Fluid temperature at the outlet of the hot side";
-  Modelica.SIunits.Temperature Tef(start=350)
+  Modelica.Units.SI.Temperature Tef(start=350)
     "Fluid temperature at the inlet of the cold side";
-  Modelica.SIunits.Temperature Tsf(start=450)
+  Modelica.Units.SI.Temperature Tsf(start=450)
     "Fluid temperature at the outlet of the cold side";
-  Modelica.SIunits.Temperature Tsatsf
+  Modelica.Units.SI.Temperature Tsatsf
     "Saturation temperature at the outlet of the cold side";
   ThermoSysPro.Units.DifferentialPressure DPfc(start=1e3)
     "Friction pressure loss for the hot fluid";
@@ -61,11 +61,11 @@
     "Gravity pressure loss for the cold fluid";
   ThermoSysPro.Units.DifferentialPressure DPf( start=1e3)
     "Total pressure loss for the cold fluid";
-  Modelica.SIunits.Density rhoc(start=998) "Hot fluid density";
-  Modelica.SIunits.Density rhof(start=998) "Cold fluid density";
-  Modelica.SIunits.MassFlowRate Qc(start=100) "Hot fluid mass flow rate";
-  Modelica.SIunits.MassFlowRate Qf(start=100) "Cold fluid mass flow rate";
 
+  Modelica.Units.SI.Density rhoc(start=998) "Hot fluid density";
+  Modelica.Units.SI.Density rhof(start=998) "Cold fluid density";
+  Modelica.Units.SI.MassFlowRate Qc(start=100) "Hot fluid mass flow rate";
+  Modelica.Units.SI.MassFlowRate Qf(start=100) "Cold fluid mass flow rate";
 public
   Connectors.FluidInlet Ec "Hot inlet"
                           annotation (Placement(transformation(extent={{-50,31},
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/DeheaterMixer2.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/DeheaterMixer2.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/DeheaterMixer2.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/DeheaterMixer2.mo"	2022-03-10 09:58:21.420149627 +0000
@@ -1,16 +1,16 @@
 within ThermoSysPro.WaterSteam.Junctions;
 model DeheaterMixer2
-  parameter Modelica.SIunits.Temperature Tmax=700 "Maximum fluid temperature";
+  parameter Modelica.Units.SI.Temperature Tmax=700 "Maximum fluid temperature";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 public
-  Modelica.SIunits.AbsolutePressure P(start=50e5) "Fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy";
-  Modelica.SIunits.Temperature T(start=600) "Fluid temperature";
-  Modelica.SIunits.SpecificEnthalpy hmax(start=10e5)
-    "Maximum fluid specific enthalpy";
 
+  Modelica.Units.SI.AbsolutePressure P(start=50e5) "Fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy";
+  Modelica.Units.SI.Temperature T(start=600) "Fluid temperature";
+  Modelica.Units.SI.SpecificEnthalpy hmax(start=10e5)
+    "Maximum fluid specific enthalpy";
 public
   Connectors.FluidInlet Ce_mix
     annotation (Placement(transformation(extent={{-9,-110},{11,-90}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/MassFlowMultiplier.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/MassFlowMultiplier.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/MassFlowMultiplier.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/MassFlowMultiplier.mo"	2022-03-10 09:58:21.404149626 +0000
@@ -2,16 +2,16 @@
 model MassFlowMultiplier "Mass flow multipliier"
   parameter Real alpha=2 "Flow multiplier";
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 public
-  Modelica.SIunits.AbsolutePressure P(start=10e5) "Fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy";
-  Modelica.SIunits.Temperature T "Fluid temperature";
-  Modelica.SIunits.Density rho(start=998) "Fluid density";
 
+  Modelica.Units.SI.AbsolutePressure P(start=10e5) "Fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
+  Modelica.Units.SI.Density rho(start=998) "Fluid density";
 public
   Connectors.FluidInlet Ce
     annotation (Placement(transformation(extent={{-110,-10},{-90,10}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/Mixer2.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/Mixer2.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/Mixer2.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/Mixer2.mo"	2022-03-10 09:58:21.392149625 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.WaterSteam.Junctions;
+within ThermoSysPro.WaterSteam.Junctions;
 model Mixer2 "Mixer with two inlets"
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
   parameter Integer mode=0
@@ -6,10 +6,10 @@
 
 public
   Real alpha1 "Extraction coefficient for inlet 1 (<=1)";
-  Modelica.SIunits.AbsolutePressure P(start=10e5) "Fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy";
-  Modelica.SIunits.Temperature T "Fluid temperature";
 
+  Modelica.Units.SI.AbsolutePressure P(start=10e5) "Fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
 public
   Connectors.FluidInlet Ce2
     annotation (Placement(transformation(extent={{-50,-110},{-30,-90}},
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/Mixer3.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/Mixer3.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/Mixer3.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/Mixer3.mo"	2022-03-10 09:58:21.368149621 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.WaterSteam.Junctions;
+within ThermoSysPro.WaterSteam.Junctions;
 model Mixer3 "Mixer with three inlets"
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
   parameter Integer mode=0
@@ -7,10 +7,10 @@
 public
   Real alpha1 "Extraction coefficient for inlet 1 (<=1)";
   Real alpha2 "Extraction coefficient for inlet 2 (<=1)";
-  Modelica.SIunits.AbsolutePressure P(start=10e5) "Fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy";
-  Modelica.SIunits.Temperature T "Fluid temperature";
 
+  Modelica.Units.SI.AbsolutePressure P(start=10e5) "Fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
 public
   Connectors.FluidInlet Ce2
     annotation (Placement(transformation(extent={{-50,-110},{-30,-90}},
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/Mixer8.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/Mixer8.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/Mixer8.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/Mixer8.mo"	2022-03-10 09:58:21.344149618 +0000
@@ -1,13 +1,13 @@
-﻿within ThermoSysPro.WaterSteam.Junctions;
+within ThermoSysPro.WaterSteam.Junctions;
 model Mixer8 "Mixer with eight inlets"
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 public
-  Modelica.SIunits.AbsolutePressure P(start=10e5) "Fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy";
-  Modelica.SIunits.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P(start=10e5) "Fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
 
   Connectors.FluidInlet Ce5
     annotation (                             layer="icon", Placement(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/Splitter2.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/Splitter2.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/Splitter2.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/Splitter2.mo"	2022-03-10 09:58:21.320149614 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.WaterSteam.Junctions;
+within ThermoSysPro.WaterSteam.Junctions;
 model Splitter2 "Splitter with two outlets"
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
   parameter Integer mode=0
@@ -6,10 +6,10 @@
 
 public
   Real alpha1 "Extraction coefficient for outlet 1 (<=1)";
-  Modelica.SIunits.AbsolutePressure P(start=10e5) "Fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy";
-  Modelica.SIunits.Temperature T "Fluid temperature";
 
+  Modelica.Units.SI.AbsolutePressure P(start=10e5) "Fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
 public
   Connectors.FluidInlet Ce
     annotation (Placement(transformation(extent={{-110,-10},{-90,10}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/Splitter3.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/Splitter3.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/Splitter3.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/Splitter3.mo"	2022-03-10 09:58:21.300149612 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.WaterSteam.Junctions;
+within ThermoSysPro.WaterSteam.Junctions;
 model Splitter3 "Splitter with three outlets"
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
   parameter Integer mode=0
@@ -7,10 +7,10 @@
 public
   Real alpha1 "Extraction coefficient for outlet 1 (<=1)";
   Real alpha2 "Extraction coefficient for outlet 2 (<=1)";
-  Modelica.SIunits.AbsolutePressure P(start=10e5) "Fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy";
-  Modelica.SIunits.Temperature T "Fluid temperature";
 
+  Modelica.Units.SI.AbsolutePressure P(start=10e5) "Fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
 public
   Connectors.FluidInlet Ce
     annotation (Placement(transformation(extent={{-108,-10},{-88,10}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/StaticDrum.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/StaticDrum.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/StaticDrum.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/StaticDrum.mo"	2022-03-10 09:58:21.276149609 +0000
@@ -3,11 +3,11 @@
   parameter Real x=1 "Vapor separation efficiency at the outlet";
 
 public
-  Modelica.SIunits.Temperature T "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure P(start=10.e5) "Fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy hl(start=100000)
+  Modelica.Units.SI.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P(start=10.e5) "Fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy hl(start=100000)
     "Liquid phase specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy hv(start=2800000)
+  Modelica.Units.SI.SpecificEnthalpy hv(start=2800000)
     "Gas phase specific enthalpy";
 public
   Connectors.FluidInlet Ce_eva
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/SteamDryer.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/SteamDryer.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/SteamDryer.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/SteamDryer.mo"	2022-03-10 09:58:21.252149607 +0000
@@ -6,8 +6,8 @@
     "IF97 region at the inlet. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 public
-  Modelica.SIunits.AbsolutePressure P(start=10e5) "Fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy";
+  Modelica.Units.SI.AbsolutePressure P(start=10e5) "Fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy";
   Real xe(start=1.0) "Vapor mass fraction at the inlet";
 
 public
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/SteamExtractionSplitter.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/SteamExtractionSplitter.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/SteamExtractionSplitter.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Junctions/SteamExtractionSplitter.mo"	2022-03-10 09:58:21.212149601 +0000
@@ -7,9 +7,9 @@
 
 public
   Real x_ex(start=0.99) "Vapor mass fraction at the extraction outlet";
-  Modelica.SIunits.AbsolutePressure P(start=10e5) "Fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy";
 
+  Modelica.Units.SI.AbsolutePressure P(start=10e5) "Fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy";
 public
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proe
     annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/LoopBreakers/LoopBreakerH.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/LoopBreakers/LoopBreakerH.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/LoopBreakers/LoopBreakerH.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/LoopBreakers/LoopBreakerH.mo"	2022-03-10 09:58:21.180149597 +0000
@@ -1,9 +1,6 @@
 within ThermoSysPro.WaterSteam.LoopBreakers;
 model LoopBreakerH
   "Specific enthalpy loop breaker for the water/steam connector"
-
-
-public
   Connectors.FluidInlet C1
     annotation (Placement(transformation(extent={{-110,-10},{-90,10}}, rotation=
            0)));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/LoopBreakers/LoopBreakerP.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/LoopBreakers/LoopBreakerP.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/LoopBreakers/LoopBreakerP.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/LoopBreakers/LoopBreakerP.mo"	2022-03-10 09:58:21.164149596 +0000
@@ -1,8 +1,5 @@
 within ThermoSysPro.WaterSteam.LoopBreakers;
 model LoopBreakerP "Pressure loop breaker for the water/steam connector"
-
-
-public
   Connectors.FluidInlet C1
     annotation (Placement(transformation(extent={{-110,-10},{-90,10}}, rotation=
            0)));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/LoopBreakers/LoopBreakerQ.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/LoopBreakers/LoopBreakerQ.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/LoopBreakers/LoopBreakerQ.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/LoopBreakers/LoopBreakerQ.mo"	2022-03-10 09:58:21.152149594 +0000
@@ -1,8 +1,5 @@
 within ThermoSysPro.WaterSteam.LoopBreakers;
 model LoopBreakerQ "Mass flow loop breaker for the water/steam connector"
-
-
-public
   Connectors.FluidInlet C1
     annotation (Placement(transformation(extent={{-110,-10},{-90,10}}, rotation=
            0)));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/LoopBreakers/LoopingPQ.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/LoopBreakers/LoopingPQ.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/LoopBreakers/LoopingPQ.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/LoopBreakers/LoopingPQ.mo"	2022-03-10 09:58:21.144149592 +0000
@@ -1,9 +1,9 @@
-﻿within ThermoSysPro.WaterSteam.LoopBreakers;
+within ThermoSysPro.WaterSteam.LoopBreakers;
 model LoopingPQ
 
-  parameter Modelica.SIunits.AbsolutePressure P=1e5
+  parameter Modelica.Units.SI.AbsolutePressure P=1e5
     "Pression imposée en sortie";
-  parameter Modelica.SIunits.MassFlowRate Q=1.0 "Débit imposé";
+  parameter Modelica.Units.SI.MassFlowRate Q=1.0 "Débit imposé";
 
   ThermoSysPro.WaterSteam.Connectors.FluidInletI C1
     annotation (Placement(transformation(extent={{-110,-10},{-90,10}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/CentrifugalPump.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/CentrifugalPump.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/CentrifugalPump.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/CentrifugalPump.mo"	2022-03-10 09:58:21.124149590 +0000
@@ -4,9 +4,9 @@
     "Pump angular velocity in rpm (active if input M is not connected)";
   parameter ThermoSysPro.Units.AngularVelocity_rpm N_nom=1400
     "Nominal angular velocity in rpm";
-  parameter Modelica.SIunits.MomentOfInertia J=10
+  parameter Modelica.Units.SI.MomentOfInertia J=10
     "Rotating masses moment of inertia (active if dynamic_mech_equation=true)";
-  parameter Modelica.SIunits.Volume V=1
+  parameter Modelica.Units.SI.Volume V=1
     "Pump volume (active if dynamic_energy_balance=true)";
   parameter Boolean dynamic_mech_equation=false
     "true: dynamic mechanical equation - false: static mechanical equation (active if input M is connected)";
@@ -15,7 +15,7 @@
   parameter Boolean continuous_flow_reversal=false
     "true: continuous flow reversal - false: discontinuous flow reversal";
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=1
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
@@ -26,11 +26,11 @@
   parameter Integer mode_car_Cr=2
     "1:complete torque characteristics - 2:analytic formula";
 
-  parameter Modelica.SIunits.VolumeFlowRate Qv_nom_p=0.4781
+  parameter Modelica.Units.SI.VolumeFlowRate Qv_nom_p=0.4781
     "Nominal volumetric flow (active if mode_car=1)";
-  parameter Modelica.SIunits.Height hn_nom_p=22.879
+  parameter Modelica.Units.SI.Height hn_nom_p=22.879
     "Nominal pump head (active if mode_car=1)";
-  parameter Modelica.SIunits.Height rh_nom_p=0.863
+  parameter Modelica.Units.SI.Height rh_nom_p=0.863
     "Nominal pump efficiency (active if mode_car=1)";
 
   parameter Real F_t[:]={ 0.634, 0.643, 0.646, 0.640, 0.629, 0.613, 0.595, 0.575, 0.552, 0.533, 0.516, 0.505,
@@ -64,15 +64,15 @@
     "Coef. of the parabolic pump efficiency characteristics (active if mode_car=2)";
 
 protected
-  constant Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  constant Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
   constant Real pi=Modelica.Constants.pi "pi";
-  parameter Modelica.SIunits.AngularVelocity w_a_min=1.e-4
+  parameter Modelica.Units.SI.AngularVelocity w_a_min=1.e-4
     "Small angular velocity";
-  parameter Modelica.SIunits.VolumeFlowRate Qv_a_min=1.e-4
+  parameter Modelica.Units.SI.VolumeFlowRate Qv_a_min=1.e-4
     "Small volume flow rate";
   parameter Real rh_min=0.05 "Minimum efficiency";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow for continuous flow reversal";
 //  parameter Boolean dyn_mech_equation=((cardinality(M) <> 0) and dynamic_mech_equation);
   parameter Boolean dyn_mech_equation=dynamic_mech_equation;
@@ -83,31 +83,31 @@
   Real hn_a(start=1) "Dimensionless head";
   Real Cr_a(start=1) "Dimensionless resistive torque";
   Real rh_a(start=1) "Dimensionless pump efficiency";
-  Modelica.SIunits.AngularVelocity w_nom "Nominal angular velocity";
-  Modelica.SIunits.VolumeFlowRate Qv_nom "Nominal volumetric flow";
-  Modelica.SIunits.Height hn_nom "Nominal pump head";
-  Modelica.SIunits.Torque Cr_nom "Nominal resistive hydraulic torque";
+  Modelica.Units.SI.AngularVelocity w_nom "Nominal angular velocity";
+  Modelica.Units.SI.VolumeFlowRate Qv_nom "Nominal volumetric flow";
+  Modelica.Units.SI.Height hn_nom "Nominal pump head";
+  Modelica.Units.SI.Torque Cr_nom "Nominal resistive hydraulic torque";
   Real rh_nom "Nominal pump efficiency";
-  Modelica.SIunits.Angle theta "Angle arctan(Qv_a/w_a) (rad)";
+  Modelica.Units.SI.Angle theta "Angle arctan(Qv_a/w_a) (rad)";
   ThermoSysPro.Units.Angle_deg theta_deg "Angle arctan(Qv_a/w_a) (deg)";
-  Modelica.SIunits.AngularVelocity w "Angular velocity in rad";
+  Modelica.Units.SI.AngularVelocity w "Angular velocity in rad";
   ThermoSysPro.Units.AngularVelocity_rpm w_rpm "Angular velocity in rpm";
-  Modelica.SIunits.MassFlowRate Q(start=500) "Mass flow rate";
-  Modelica.SIunits.VolumeFlowRate Qv(start=0.5) "Volumetric flow rate";
-  Modelica.SIunits.Pressure deltaP
+  Modelica.Units.SI.MassFlowRate Q(start=500) "Mass flow rate";
+  Modelica.Units.SI.VolumeFlowRate Qv(start=0.5) "Volumetric flow rate";
+  Modelica.Units.SI.Pressure deltaP
     "Pressure variation between the outlet and the inlet";
-  Modelica.SIunits.Height hn(start=10) "Pump head";
-  Modelica.SIunits.Torque Cm "Motor torque";
-  Modelica.SIunits.Torque Cr "Resistive hydraulic torque";
+  Modelica.Units.SI.Height hn(start=10) "Pump head";
+  Modelica.Units.SI.Torque Cm "Motor torque";
+  Modelica.Units.SI.Torque Cr "Resistive hydraulic torque";
   Real rh "Pump efficiency";
-  Modelica.SIunits.Power Wr "Resistive power";
-  Modelica.SIunits.Power Wm "Motor power";
-  Modelica.SIunits.Energy Ec "Kinetic energy of the rotating masses";
-  Modelica.SIunits.Density rho(start=998) "Fluid density";
-  Modelica.SIunits.SpecificEnthalpy deltaH
+  Modelica.Units.SI.Power Wr "Resistive power";
+  Modelica.Units.SI.Power Wm "Motor power";
+  Modelica.Units.SI.Energy Ec "Kinetic energy of the rotating masses";
+  Modelica.Units.SI.Density rho(start=998) "Fluid density";
+  Modelica.Units.SI.SpecificEnthalpy deltaH
     "Specific enthalpy variation between the outlet and the inlet";
-  Modelica.SIunits.Pressure Pm(start=1.e5) "Fluid average pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=100000)
+  Modelica.Units.SI.Pressure Pm(start=1.e5) "Fluid average pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=100000)
     "Fluid average specific enthalpy";
   Real c "Dimensionless coef. of the semi-parabolic pump head characteristics";
   Real F "Function F";
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/Compressor.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/Compressor.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/Compressor.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/Compressor.mo"	2022-03-10 09:58:21.088149586 +0000
@@ -2,18 +2,18 @@
 model Compressor "Heat pump compressor "
   parameter Real pi=10.0 "Compression factor (Ps/Pe)";
   parameter Real eta=0.85 "Isentropic efficiency";
-  parameter Modelica.SIunits.Power W_fric=0.0
+  parameter Modelica.Units.SI.Power W_fric=0.0
     "Power losses due to hydrodynamic friction (percent)";
 
 public
-  Modelica.SIunits.Power W "Mechanical power delivered to the compressor";
-  Modelica.SIunits.MassFlowRate Q "Mass flow rate";
-  Modelica.SIunits.SpecificEnthalpy His
+  Modelica.Units.SI.Power W "Mechanical power delivered to the compressor";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow rate";
+  Modelica.Units.SI.SpecificEnthalpy His
     "Fluid specific enthalpy after isentropic compression";
-  Modelica.SIunits.AbsolutePressure Pe(start=10e5) "Inlet pressure";
-  Modelica.SIunits.AbsolutePressure Ps(start=10e5) "Outlet pressure";
-  Modelica.SIunits.Temperature Te "Inlet temperature";
-  Modelica.SIunits.Temperature Ts "Outlet temperature";
+  Modelica.Units.SI.AbsolutePressure Pe(start=10e5) "Inlet pressure";
+  Modelica.Units.SI.AbsolutePressure Ps(start=10e5) "Outlet pressure";
+  Modelica.Units.SI.Temperature Te "Inlet temperature";
+  Modelica.Units.SI.Temperature Ts "Outlet temperature";
   Real xm(start=1.0) "Average vapor mass fraction";
 
   Connectors.FluidInlet C1
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/DynamicCentrifugalPump.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/DynamicCentrifugalPump.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/DynamicCentrifugalPump.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/DynamicCentrifugalPump.mo"	2022-03-10 09:58:21.044149581 +0000
@@ -4,9 +4,9 @@
     "Nominal rotational speed";
   parameter ThermoSysPro.Units.AngularVelocity_rpm VRot0=0
     "Initial rotational speed (active if steady_state_mech=false)";
-  parameter Modelica.SIunits.Volume V=1
+  parameter Modelica.Units.SI.Volume V=1
     "Pump volume (only if dynamic_energy_balance = true)";
-  parameter Modelica.SIunits.MomentOfInertia J=10 "Pump moment of inertia";
+  parameter Modelica.Units.SI.MomentOfInertia J=10 "Pump moment of inertia";
   parameter Real Cf0=10 "Mechanical friction coefficient";
   parameter Boolean steady_state_mech=true
     "true: start from steady state - false: start from VRot0";
@@ -15,7 +15,7 @@
   parameter Boolean continuous_flow_reversal=false
     "true: continuous flow reversal - false: discontinuous flow reversal";
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=1
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
@@ -34,36 +34,36 @@
     "Constant coef. of the pump efficiency characteristics rh = f(vol_flow) (s.u.)";
 
 protected
-  constant Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  constant Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
   constant Real pi=Modelica.Constants.pi "pi";
   parameter Real eps=1.e-6 "Small number";
   parameter Real rhmin=0.05 "Minimum efficiency to avoid zero crossings";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow for continuous flow reversal";
 
 public
   Real rh "Hydraulic efficiency";
-  Modelica.SIunits.Height hn(start=10) "Pump head";
+  Modelica.Units.SI.Height hn(start=10) "Pump head";
   ThermoSysPro.Units.AngularVelocity_rpm VRot(start=VRotn) "Rotational speed";
-  Modelica.SIunits.AngularVelocity w "Angular speed";
+  Modelica.Units.SI.AngularVelocity w "Angular speed";
   Real R "Ratio VRot/VRotn (s.u.)";
-  Modelica.SIunits.MassFlowRate Q(start=500) "Mass flow rate";
-  Modelica.SIunits.VolumeFlowRate Qv(start=0.5) "Volume flow rate";
-  Modelica.SIunits.Torque Cm "Motor torque";
-  Modelica.SIunits.Torque Ch "Hydraulic torque";
-  Modelica.SIunits.Torque Cf "Mechanical friction torque";
-  Modelica.SIunits.Power Wm "Motor power";
-  Modelica.SIunits.Power Wh "Hydraulic power";
-  Modelica.SIunits.Power Wf "Mechanical friction power";
-  Modelica.SIunits.Density rho "Fluid density";
+  Modelica.Units.SI.MassFlowRate Q(start=500) "Mass flow rate";
+  Modelica.Units.SI.VolumeFlowRate Qv(start=0.5) "Volume flow rate";
+  Modelica.Units.SI.Torque Cm "Motor torque";
+  Modelica.Units.SI.Torque Ch "Hydraulic torque";
+  Modelica.Units.SI.Torque Cf "Mechanical friction torque";
+  Modelica.Units.SI.Power Wm "Motor power";
+  Modelica.Units.SI.Power Wh "Hydraulic power";
+  Modelica.Units.SI.Power Wf "Mechanical friction power";
+  Modelica.Units.SI.Density rho "Fluid density";
   ThermoSysPro.Units.DifferentialPressure deltaP
     "Pressure variation between the outlet and the inlet";
-  Modelica.SIunits.SpecificEnthalpy deltaH
-    "Specific enthalpy variation between the outlet and the inlet";
-  Modelica.SIunits.AbsolutePressure Pm "Fluid average pressure";
-  Modelica.SIunits.SpecificEnthalpy h "Fluid average specific enthalpy";
 
+  Modelica.Units.SI.SpecificEnthalpy deltaH
+    "Specific enthalpy variation between the outlet and the inlet";
+  Modelica.Units.SI.AbsolutePressure Pm "Fluid average pressure";
+  Modelica.Units.SI.SpecificEnthalpy h "Fluid average specific enthalpy";
 public
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro
     annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/Generator.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/Generator.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/Generator.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/Generator.mo"	2022-03-10 09:58:21.016149576 +0000
@@ -3,7 +3,7 @@
   parameter Real eta = 99.8 "Efficiency (percent)";
 
 public
-  Modelica.SIunits.Power Welec "Electrical power produced by the generator";
+  Modelica.Units.SI.Power Welec "Electrical power produced by the generator";
 
 public
   ThermoSysPro.InstrumentationAndControl.Connectors.InputReal Wmec2
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/Generator8.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/Generator8.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/Generator8.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/Generator8.mo"	2022-03-10 09:58:20.992149573 +0000
@@ -3,7 +3,7 @@
   parameter Real eta = 99.8 "Efficiency (percent)";
 
 public
-  Modelica.SIunits.Power Welec "Electrical power produced by the generator";
+  Modelica.Units.SI.Power Welec "Electrical power produced by the generator";
 
 public
   ThermoSysPro.InstrumentationAndControl.Connectors.InputReal Wmec2
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/StaticCentrifugalPump.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/StaticCentrifugalPump.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/StaticCentrifugalPump.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/StaticCentrifugalPump.mo"	2022-03-10 09:58:20.940149566 +0000
@@ -2,7 +2,7 @@
 model StaticCentrifugalPump "Static centrifugal pump"
   parameter ThermoSysPro.Units.AngularVelocity_rpm VRot=1400
     "Fixed rotational speed (active if fixed_rot_or_power=1 and rpm_or_mpower connector not connected)";
-  parameter Modelica.SIunits.Power MPower=0.1e6
+  parameter Modelica.Units.SI.Power MPower=0.1e6
     "Fixed mechanical power (active if fixed_rot_or_power=2 and rpm_or_mpower connector not connected)";
   parameter ThermoSysPro.Units.AngularVelocity_rpm VRotn=1400
     "Nominal rotational speed";
@@ -15,7 +15,7 @@
   parameter Boolean continuous_flow_reversal=false
     "true: continuous flow reversal - false: discontinuous flow reversal";
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=1
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
@@ -34,30 +34,30 @@
     "Constant coef. of the pump efficiency characteristics rh = f(vol_flow) (s.u.)";
 
 protected
-  constant Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  constant Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
   constant Real pi=Modelica.Constants.pi "pi";
   parameter Real eps=1.e-6 "Small number";
   parameter Real rhmin=0.20 "Minimum efficiency to avoid zero crossings";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow for continuous flow reversal";
 
 public
   Real rh "Hydraulic efficiency";
-  Modelica.SIunits.Height hn(start=10) "Pump head";
+  Modelica.Units.SI.Height hn(start=10) "Pump head";
   Real R(start=VRot/VRotn) "Reduced rotational speed";
-  Modelica.SIunits.MassFlowRate Q(start=500) "Mass flow rate";
-  Modelica.SIunits.VolumeFlowRate Qv(start=0.5) "Volume flow rate";
-  Modelica.SIunits.Power Wh "Hydraulic power";
-  Modelica.SIunits.Power Wm "Mechanical power";
+  Modelica.Units.SI.MassFlowRate Q(start=500) "Mass flow rate";
+  Modelica.Units.SI.VolumeFlowRate Qv(start=0.5) "Volume flow rate";
+  Modelica.Units.SI.Power Wh "Hydraulic power";
+  Modelica.Units.SI.Power Wm "Mechanical power";
   ThermoSysPro.Units.AngularVelocity_rpm Vr "Rotational speed";
-  Modelica.SIunits.Density rho(start=998) "Fluid density";
+  Modelica.Units.SI.Density rho(start=998) "Fluid density";
   ThermoSysPro.Units.DifferentialPressure deltaP
     "Pressure variation between the outlet and the inlet";
-  Modelica.SIunits.SpecificEnthalpy deltaH
+  Modelica.Units.SI.SpecificEnthalpy deltaH
     "Specific enthalpy variation between the outlet and the inlet";
-  Modelica.SIunits.AbsolutePressure Pm(start=1.e5) "Fluid average pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=100000)
+  Modelica.Units.SI.AbsolutePressure Pm(start=1.e5) "Fluid average pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=100000)
     "Fluid average specific enthalpy";
   Connectors.FluidInlet C1
                           annotation (Placement(transformation(extent={{-110,
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/SteamEngine.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/SteamEngine.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/SteamEngine.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/SteamEngine.mo"	2022-03-10 09:58:20.924149565 +0000
@@ -15,15 +15,15 @@
     "Outlet IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 public
-  Modelica.SIunits.Power W "Power produced by the engine";
-  Modelica.SIunits.MassFlowRate Q "Mass flow rate";
-  Modelica.SIunits.SpecificEnthalpy His
+  Modelica.Units.SI.Power W "Power produced by the engine";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow rate";
+  Modelica.Units.SI.SpecificEnthalpy His
     "Fluid specific enthalpy after isentropic expansion";
   ThermoSysPro.Units.DifferentialPressure deltaP "Pressure loss";
-  Modelica.SIunits.AbsolutePressure Pe(start=10e5) "Pressure at the inlet";
-  Modelica.SIunits.AbsolutePressure Ps(start=10e5) "Pressure at the outlet";
-  Modelica.SIunits.Temperature Te "Temperature at the inlet";
-  Modelica.SIunits.Temperature Ts "Temperature at the outlet";
+  Modelica.Units.SI.AbsolutePressure Pe(start=10e5) "Pressure at the inlet";
+  Modelica.Units.SI.AbsolutePressure Ps(start=10e5) "Pressure at the outlet";
+  Modelica.Units.SI.Temperature Te "Temperature at the inlet";
+  Modelica.Units.SI.Temperature Ts "Temperature at the outlet";
   Real xm(start=1.0,min=0) "Average vapor mass fraction (n.u.)";
 
 public
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/StodolaTurbine.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/StodolaTurbine.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/StodolaTurbine.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Machines/StodolaTurbine.mo"	2022-03-10 09:58:20.900149562 +0000
@@ -5,10 +5,10 @@
     "Power losses due to hydrodynamic friction (percent)";
   parameter Real eta_stato=1.0
     "Efficiency to account for cinetic losses (<= 1) (s.u.)";
-  parameter Modelica.SIunits.Area area_nz=1 "Nozzle area";
+  parameter Modelica.Units.SI.Area area_nz=1 "Nozzle area";
   parameter Real eta_nz=1.0
     "Nozzle efficency (eta_nz < 1 - turbine with nozzle - eta_nz = 1 - turbine without nozzle)";
-  parameter Modelica.SIunits.MassFlowRate Qmax=1
+  parameter Modelica.Units.SI.MassFlowRate Qmax=1
     "Maximum mass flow through the turbine";
   parameter Real eta_is_nom=0.8 "Nominal isentropic efficiency";
   parameter Real eta_is_min=0.35 "Minimum isentropic efficiency";
@@ -27,28 +27,28 @@
     "IF97 region after isentropic expansion. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 protected
-  parameter Modelica.SIunits.AbsolutePressure pcrit=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT
+  parameter Modelica.Units.SI.AbsolutePressure pcrit=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT
     "Critical pressure";
-  parameter Modelica.SIunits.Temperature Tcrit=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TCRIT
+  parameter Modelica.Units.SI.Temperature Tcrit=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TCRIT
     "Critical temperature";
 
 public
   Real eta_is(start=0.85) "Isentropic efficiency";
   Real eta_is_wet(start=0.83) "Isentropic efficiency for wet steam";
-  Modelica.SIunits.Power W "Mechanical power produced by the turbine";
-  Modelica.SIunits.MassFlowRate Q "Mass flow rate";
-  Modelica.SIunits.SpecificEnthalpy His
+  Modelica.Units.SI.Power W "Mechanical power produced by the turbine";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow rate";
+  Modelica.Units.SI.SpecificEnthalpy His
     "Fluid specific enthalpy after isentropic expansion";
-  Modelica.SIunits.SpecificEnthalpy Hrs
+  Modelica.Units.SI.SpecificEnthalpy Hrs
     "Fluid specific enthalpy after the real expansion";
-  Modelica.SIunits.AbsolutePressure Pe(start=10e5,min=0)
+  Modelica.Units.SI.AbsolutePressure Pe(start=10e5,min=0)
     "Pressure at the inlet";
-  Modelica.SIunits.AbsolutePressure Ps(start=10e5,min=0)
+  Modelica.Units.SI.AbsolutePressure Ps(start=10e5,min=0)
     "Pressure at the outlet";
-  Modelica.SIunits.Temperature Te(min=0) "Temperature at the inlet";
-  Modelica.SIunits.Temperature Ts(min=0) "Temperature at the outlet";
-  Modelica.SIunits.Velocity Vs "Fluid velocity at the outlet";
-  Modelica.SIunits.Density rhos(start=200) "Fluid density at the outlet";
+  Modelica.Units.SI.Temperature Te(min=0) "Temperature at the inlet";
+  Modelica.Units.SI.Temperature Ts(min=0) "Temperature at the outlet";
+  Modelica.Units.SI.Velocity Vs "Fluid velocity at the outlet";
+  Modelica.Units.SI.Density rhos(start=200) "Fluid density at the outlet";
   Real xm(start=1.0,min=0) "Average vapor mass fraction";
 
 public
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/Bend.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/Bend.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/Bend.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/Bend.mo"	2022-03-10 09:58:20.852149555 +0000
@@ -1,7 +1,7 @@
-﻿within ThermoSysPro.WaterSteam.PressureLosses;
+within ThermoSysPro.WaterSteam.PressureLosses;
 model Bend "Bend"
-  parameter Modelica.SIunits.Diameter D=0.2 "Pipe diameter";
-  parameter Modelica.SIunits.Radius R0=0.2 "Pipe radius";
+  parameter Modelica.Units.SI.Diameter D=0.2 "Pipe diameter";
+  parameter Modelica.Units.SI.Radius R0=0.2 "Pipe radius";
   parameter ThermoSysPro.Units.Angle_deg delta= 90 "Pipe angle";
   parameter Real rugosrel=0 "Pipe roughness";
   parameter Boolean K_A1_Tabule=true
@@ -11,14 +11,14 @@
   parameter Boolean continuous_flow_reversal=false
     "true: continuous flow reversal - false: discontinuous flow reversal";
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 protected
   constant Real pi=Modelica.Constants.pi "pi";
   parameter Real eps=1.e-3 "Small number for pressure loss equation";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow for continuous flow reversal";
 
 public
@@ -27,20 +27,20 @@
   Real khif "Friction pressure loss coefficient";
   Real kdelta "Roughness factor for the singular pressure loss";
   ThermoSysPro.Units.DifferentialPressure deltaP "Presure loss";
-  Modelica.SIunits.MassFlowRate Q "Mass flow rate";
-  Modelica.SIunits.ReynoldsNumber Re "Reynolds number";
-  Modelica.SIunits.ReynoldsNumber Relim "Limit Reynolds number";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow rate";
+  Modelica.Units.SI.ReynoldsNumber Re "Reynolds number";
+  Modelica.Units.SI.ReynoldsNumber Relim "Limit Reynolds number";
   Real yA1 "Output of table A1";
   Real yB1 "Output of table B1";
   Real yC1 "Output of table C1";
   Real lambda "Friction pressure loss coefficient";
-  Modelica.SIunits.Density rho "Fluid density";
-  Modelica.SIunits.DynamicViscosity mu "Fluid dynamic viscosity";
-  Modelica.SIunits.Temperature T "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure Pm "Fluid average pressure";
-  Modelica.SIunits.SpecificEnthalpy h "Fluid specific enthalpy";
 
 
+  Modelica.Units.SI.Density rho "Fluid density";
+  Modelica.Units.SI.DynamicViscosity mu "Fluid dynamic viscosity";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure Pm "Fluid average pressure";
+  Modelica.Units.SI.SpecificEnthalpy h "Fluid specific enthalpy";
 public
   ThermoSysPro.InstrumentationAndControl.Blocks.Tables.Table1D TA1(
                     Table=[0, 0; 20, 0.31; 30, 0.45; 45, 0.60; 60, 0.78;
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/CheckValve.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/CheckValve.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/CheckValve.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/CheckValve.mo"	2022-03-10 09:58:20.808149550 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.WaterSteam.PressureLosses;
+within ThermoSysPro.WaterSteam.PressureLosses;
 model CheckValve "Check valve"
   parameter ThermoSysPro.Units.DifferentialPressure dPOuvert=10
     "Pressure difference when the valve opens";
@@ -7,31 +7,31 @@
   parameter ThermoSysPro.Units.PressureLossCoefficient k=
                                                         1000
     "Pressure loss coefficient";
-  parameter Modelica.SIunits.MassFlowRate Qmin=1.e-6
+  parameter Modelica.Units.SI.MassFlowRate Qmin=1.e-6
     "Mass flow when the valve is closed";
   parameter Boolean continuous_flow_reversal=false
     "true: continuous flow reversal - false: discontinuous flow reversal";
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 protected
   parameter Real eps=1.e-3 "Small number for pressure loss equation";
   constant Real pi=Modelica.Constants.pi "pi";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow for continuous flow reversal";
 
 public
   Boolean ouvert(start=true, fixed=true) "Valve state";
   discrete Boolean touvert(start=false, fixed=true);
   discrete Boolean tferme(start=false, fixed=true);
-  Modelica.SIunits.MassFlowRate Q(start=500) "Mass flow rate";
+  Modelica.Units.SI.MassFlowRate Q(start=500) "Mass flow rate";
   ThermoSysPro.Units.DifferentialPressure deltaP "Singular pressure loss";
-  Modelica.SIunits.Density rho(start=998) "Fluid density";
-  Modelica.SIunits.Temperature T(start=290) "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure Pm(start=1.e5) "Fluid average pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
+  Modelica.Units.SI.Density rho(start=998) "Fluid density";
+  Modelica.Units.SI.Temperature T(start=290) "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure Pm(start=1.e5) "Fluid average pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro
     "Propriétés de l'eau"
     annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/ControlValve.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/ControlValve.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/ControlValve.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/ControlValve.mo"	2022-03-10 09:58:20.780149547 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.WaterSteam.PressureLosses;
+within ThermoSysPro.WaterSteam.PressureLosses;
 model ControlValve "Control valve"
   parameter ThermoSysPro.Units.Cv Cvmax=8005.42
     "Maximum CV (active if mode_caract=0)";
@@ -13,25 +13,25 @@
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
   parameter Integer option_rho_water=1
     "1: using (deltaP*Cv^2=A.Q^2/rho^2) - 2: using (deltaP*Cv^2=A.Q^2/(rho*rho_15)); with rho_15 is the density of the water at 15.5556 °C)";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 protected
   parameter Real eps=1.e-0 "Small number for pressure loss equation";
   constant Real pi=Modelica.Constants.pi "pi";
-  parameter Modelica.SIunits.Density rho_15= 999 "density of the water at 15.5556 °C";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.Density rho_15= 999 "density of the water at 15.5556 °C";
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow for continuous flow reversal";
 
 public
   ThermoSysPro.Units.Cv Cv(start=100) "Cv";
-  Modelica.SIunits.MassFlowRate Q(start=500) "Mass flow rate";
+  Modelica.Units.SI.MassFlowRate Q(start=500) "Mass flow rate";
   ThermoSysPro.Units.DifferentialPressure deltaP "Singular pressure loss";
-  Modelica.SIunits.Density rho(start=998) "Fluid density";
-  Modelica.SIunits.Temperature T(start=290) "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure Pm(start=1.e5) "Fluid average pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
+  Modelica.Units.SI.Density rho(start=998) "Fluid density";
+  Modelica.Units.SI.Temperature T(start=290) "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure Pm(start=1.e5) "Fluid average pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro
     "Propriétés de l'eau"
     annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/Diaphragm.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/Diaphragm.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/Diaphragm.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/Diaphragm.mo"	2022-03-10 09:58:20.752149542 +0000
@@ -1,31 +1,31 @@
-﻿within ThermoSysPro.WaterSteam.PressureLosses;
+within ThermoSysPro.WaterSteam.PressureLosses;
 model Diaphragm "Diaphragm"
   parameter Real Ouv=0.5 "Diaphragm aperture";
-  parameter Modelica.SIunits.Diameter D=0.2 "Diaphragm diameter";
+  parameter Modelica.Units.SI.Diameter D=0.2 "Diaphragm diameter";
   parameter Boolean continuous_flow_reversal=false
     "true: continuous flow reversal - false: discontinuous flow reversal";
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 protected
   constant Real pi=Modelica.Constants.pi "pi";
   parameter Real eps=1.e-3 "Small number for pressure loss equation";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow for continuous flow reversal";
 
 public
   Real khi "Hydraulic pressure loss coefficient";
   ThermoSysPro.Units.DifferentialPressure deltaP "Pressure loss";
-  Modelica.SIunits.MassFlowRate Q "Mass flow rate";
-  Modelica.SIunits.ReynoldsNumber Re "Reynolds number";
-  Modelica.SIunits.ReynoldsNumber Relim "Limit Reynolds number";
-  Modelica.SIunits.Density rho "Fluid density";
-  Modelica.SIunits.DynamicViscosity mu "Fluid dynamic viscosity";
-  Modelica.SIunits.Temperature T "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure Pm "Fluid average pressure";
-  Modelica.SIunits.SpecificEnthalpy h "Fluid specific enthalpy";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow rate";
+  Modelica.Units.SI.ReynoldsNumber Re "Reynolds number";
+  Modelica.Units.SI.ReynoldsNumber Relim "Limit Reynolds number";
+  Modelica.Units.SI.Density rho "Fluid density";
+  Modelica.Units.SI.DynamicViscosity mu "Fluid dynamic viscosity";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure Pm "Fluid average pressure";
+  Modelica.Units.SI.SpecificEnthalpy h "Fluid specific enthalpy";
 public
   Connectors.FluidInlet C1
                           annotation (Placement(transformation(extent={{-110,
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/DynamicCheckValve.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/DynamicCheckValve.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/DynamicCheckValve.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/DynamicCheckValve.mo"	2022-03-10 09:58:20.736149541 +0000
@@ -1,14 +1,14 @@
-﻿within ThermoSysPro.WaterSteam.PressureLosses;
+within ThermoSysPro.WaterSteam.PressureLosses;
 model DynamicCheckValve "Dynamic check valve"
   parameter ThermoSysPro.Units.Cv Cvmax=8005.42 "Maximum CV";
   parameter Real caract[:, 2]=[0, 0; 1, Cvmax]
     "Position vs. Cv characteristics (active if mode_caract=1)";
-  parameter Modelica.SIunits.MomentOfInertia J=1 "Flap moment of inertia";
+  parameter Modelica.Units.SI.MomentOfInertia J=1 "Flap moment of inertia";
   parameter Real Kf1=0 "Flap friction law coefficient #1";
   parameter Real Kf2=100 "Flap friction law coefficient #2";
   parameter Real n=5 "Flap friction law exponent";
-  parameter Modelica.SIunits.Mass m=1 "Flap mass";
-  parameter Modelica.SIunits.Area A=1 "Flap hydraulic area";
+  parameter Modelica.Units.SI.Mass m=1 "Flap mass";
+  parameter Modelica.Units.SI.Area A=1 "Flap hydraulic area";
   parameter Real Ouv0=0 "Initial valve position, between 0 and 1. 0:valve closed - 1: valve open (active if permanent_meca = false)";
   parameter Integer mode_caract=0
     "0:linear characteristics - 1:characteristics is given by caract[]";
@@ -19,40 +19,40 @@
   parameter Boolean continuous_flow_reversal=false
     "true: continuous flow reversal - false: discontinuous flow reversal";
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 protected
   constant Real pi=Modelica.Constants.pi "pi";
-  parameter Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  parameter Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
   parameter Real eps=1.e-3 "Small number for pressure loss equation";
-  parameter Modelica.SIunits.Radius r=sqrt(A/pi) "Flap radius";
-  parameter Modelica.SIunits.Angle theta_min=0 "Minimum flap aperture angle";
-  parameter Modelica.SIunits.Angle theta_max=pi/2 "Maximum flap aperture angle";
-  parameter Modelica.SIunits.Angle theta_m = (theta_min + theta_max)/2;
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.Radius r=sqrt(A/pi) "Flap radius";
+  parameter Modelica.Units.SI.Angle theta_min=0 "Minimum flap aperture angle";
+  parameter Modelica.Units.SI.Angle theta_max=pi/2 "Maximum flap aperture angle";
+  parameter Modelica.Units.SI.Angle theta_m = (theta_min + theta_max)/2;
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow for continuous flow reversal";
 
 public
   Boolean libre(start=true)
     "Indicator whether the flap is free to move in both directions";
-  Modelica.SIunits.Torque Cp "Gravity torque";
-  Modelica.SIunits.Torque Cf "Friction torque";
-  Modelica.SIunits.Torque Ch "Hydraulic torque";
-  Modelica.SIunits.Torque Ct "Total torque";
-  Modelica.SIunits.Angle theta(start=theta_m) "Flap aperture angle";
-  Modelica.SIunits.AngularVelocity omega "Flap angular speed";
-  Modelica.SIunits.AngularAcceleration a "Flap angular acceleration";
+  Modelica.Units.SI.Torque Cp "Gravity torque";
+  Modelica.Units.SI.Torque Cf "Friction torque";
+  Modelica.Units.SI.Torque Ch "Hydraulic torque";
+  Modelica.Units.SI.Torque Ct "Total torque";
+  Modelica.Units.SI.Angle theta(start=theta_m) "Flap aperture angle";
+  Modelica.Units.SI.AngularVelocity omega "Flap angular speed";
+  Modelica.Units.SI.AngularAcceleration a "Flap angular acceleration";
   Real Ouv "Valve position";
   ThermoSysPro.Units.Cv Cv(start=Cvmax) "Cv";
-  Modelica.SIunits.MassFlowRate Q(start=500) "Mass flow rate";
+  Modelica.Units.SI.MassFlowRate Q(start=500) "Mass flow rate";
   ThermoSysPro.Units.DifferentialPressure deltaP "Singular pressure loss";
-  Modelica.SIunits.Density rho(start=998) "Fluid density";
-  Modelica.SIunits.Temperature T(start=290) "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure Pm(start=1.e5) "Fluid average pressrue";
-  Modelica.SIunits.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
+  Modelica.Units.SI.Density rho(start=998) "Fluid density";
+  Modelica.Units.SI.Temperature T(start=290) "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure Pm(start=1.e5) "Fluid average pressrue";
+  Modelica.Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
 protected
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro
     "Propriétés de l'eau"
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/DynamicReliefValve.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/DynamicReliefValve.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/DynamicReliefValve.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/DynamicReliefValve.mo"	2022-03-10 09:58:20.708149537 +0000
@@ -1,16 +1,16 @@
-﻿within ThermoSysPro.WaterSteam.PressureLosses;
+within ThermoSysPro.WaterSteam.PressureLosses;
 model DynamicReliefValve "Dynamic relief valve"
-  parameter Modelica.SIunits.AbsolutePressure Popen=3e5 "Pressure that opens the valve";
-  parameter Modelica.SIunits.AbsolutePressure Pout=1e5 "Pressure at the valve outlet (for sizing)";
+  parameter Modelica.Units.SI.AbsolutePressure Popen=3e5 "Pressure that opens the valve";
+  parameter Modelica.Units.SI.AbsolutePressure Pout=1e5 "Pressure at the valve outlet (for sizing)";
   parameter ThermoSysPro.Units.Cv Cvmax=8005.42 "Maximum Cv";
   parameter Real caract[:, 2]=[0, 0; 1, Cvmax] "Position vs. Cv characteristics (active if mode_caract=1)";
-  parameter Modelica.SIunits.Area A1=0.1 "Hydraulic area upstream the clapper";
-  parameter Modelica.SIunits.Area A2=0.125 "Hydraulic area downstream the clapper";
-  parameter Modelica.SIunits.Area clapper_area[:, 2]=[0, A1; 0.01, A2; 1, A2] "Clapper area as a function of the clapper elevation";
+  parameter Modelica.Units.SI.Area A1=0.1 "Hydraulic area upstream the clapper";
+  parameter Modelica.Units.SI.Area A2=0.125 "Hydraulic area downstream the clapper";
+  parameter Modelica.Units.SI.Area clapper_area[:, 2]=[0, A1; 0.01, A2; 1, A2] "Clapper area as a function of the clapper elevation";
   parameter Real D=1 "Damping";
-  parameter Modelica.SIunits.Mass m=1 "Valve mass";
-  parameter Modelica.SIunits.Length z_max=0.1 "Maximum clapper elevation";
-  parameter Modelica.SIunits.Length z0=0 "Initial clapper elevation, between 0 and z_max. 0:valve closed - z_max: valve fully open (active if permanent_meca = false)";
+  parameter Modelica.Units.SI.Mass m=1 "Valve mass";
+  parameter Modelica.Units.SI.Length z_max=0.1 "Maximum clapper elevation";
+  parameter Modelica.Units.SI.Length z0=0 "Initial clapper elevation, between 0 and z_max. 0:valve closed - z_max: valve fully open (active if permanent_meca = false)";
   parameter Real Ke=62500 "Valve spring stiffness";
   parameter Real Cd=0 "Drag coefficient of the clapper";
   parameter Integer mode_caract=0
@@ -21,45 +21,45 @@
     "true: start from mechanical steady state - false: start from 0";
   parameter Boolean continuous_flow_reversal=false
     "true: continuous flow reversal - false: discontinuous flow reversal";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 protected
-  constant Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  constant Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
   constant Real pi=Modelica.Constants.pi "pi";
-  constant Modelica.SIunits.Density rho60F=998.98 "Water density at 60°F";
+  constant Modelica.Units.SI.Density rho60F=998.98 "Water density at 60°F";
   constant Real K=1.733e12 "Valve constant";
   parameter Real eps=1.e-0 "Small number for pressure loss equation";
-  parameter Modelica.SIunits.Length z_min=0 "Minimum clapper elevation";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.Length z_min=0 "Minimum clapper elevation";
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow for continuous flow reversal";
 
 public
   Boolean clapper_is_free(start=true) "true if clapper is free to move in both directions, false otherwise";
-  Modelica.SIunits.Force Fp "Gravity force";
-  Modelica.SIunits.Force Fr "Spring force";
-  Modelica.SIunits.Force Fd "Damping force";
-  Modelica.SIunits.Force Fh "Hydraulic force";
-  Modelica.SIunits.Force Fdyn "Dynamic pressure force";
-  Modelica.SIunits.Force Ft "Total force";
-  Modelica.SIunits.Length z(start=z_min) "Clapper elevation";
-  Modelica.SIunits.Velocity v=der(z) "Clapper velocity";
-  Modelica.SIunits.Acceleration a=der(v) "Clapper acceleration";
+  Modelica.Units.SI.Force Fp "Gravity force";
+  Modelica.Units.SI.Force Fr "Spring force";
+  Modelica.Units.SI.Force Fd "Damping force";
+  Modelica.Units.SI.Force Fh "Hydraulic force";
+  Modelica.Units.SI.Force Fdyn "Dynamic pressure force";
+  Modelica.Units.SI.Force Ft "Total force";
+  Modelica.Units.SI.Length z(start=z_min) "Clapper elevation";
+  Modelica.Units.SI.Velocity v=der(z) "Clapper velocity";
+  Modelica.Units.SI.Acceleration a=der(v) "Clapper acceleration";
   Real Ouv "Valve position";
-  Modelica.SIunits.Area A "Hydraulic area upstream the clapper";
-  Modelica.SIunits.Force Fr_min "Spring force when valve is closed";
+  Modelica.Units.SI.Area A "Hydraulic area upstream the clapper";
+  Modelica.Units.SI.Force Fr_min "Spring force when valve is closed";
   ThermoSysPro.Units.Cv Cv "Cv";
-  Modelica.SIunits.MassFlowRate Q(start=500) "Mass flow rate";
+  Modelica.Units.SI.MassFlowRate Q(start=500) "Mass flow rate";
   ThermoSysPro.Units.DifferentialPressure deltaP "Singular pressure loss";
-  Modelica.SIunits.Density rho(start=998) "Fluid density";
-  Modelica.SIunits.Temperature T(start=290) "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure Pm(start=1.e5) "Fluid average pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
-  Modelica.SIunits.AbsolutePressure Pdyn "Dynamic pressure on the clapper";
-  Modelica.SIunits.Velocity vh "Fluid velocity through the valve";
-  Modelica.SIunits.Energy Wdyn "Dissipated fluid kinetic energy";
+  Modelica.Units.SI.Density rho(start=998) "Fluid density";
+  Modelica.Units.SI.Temperature T(start=290) "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure Pm(start=1.e5) "Fluid average pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
+  Modelica.Units.SI.AbsolutePressure Pdyn "Dynamic pressure on the clapper";
+  Modelica.Units.SI.Velocity vh "Fluid velocity through the valve";
+  Modelica.Units.SI.Energy Wdyn "Dissipated fluid kinetic energy";
   Real Re=rho*(vh - v)*sqrt(4*A/pi)/ThermoSysPro.Properties.WaterSteam.IF97.DynamicViscosity_rhoT(rho, T) "Clapper Reynolds";
 
 protected
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/IdealCheckValve.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/IdealCheckValve.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/IdealCheckValve.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/IdealCheckValve.mo"	2022-03-10 09:58:20.672149533 +0000
@@ -2,21 +2,21 @@
 model IdealCheckValve "Ideal check valve"
   parameter ThermoSysPro.Units.DifferentialPressure dPOuvert=0.01
     "Pressure difference when the valve opens";
-  parameter Modelica.SIunits.MassFlowRate Qmin=1.e-6
+  parameter Modelica.Units.SI.MassFlowRate Qmin=1.e-6
     "Mass flow trhough the valve when the valve is closed";
   parameter Boolean continuous_flow_reversal=false
     "true: continuous flow reversal - false: discontinuous flow reversal";
 
 protected
   constant Real pi=Modelica.Constants.pi "pi";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow for continuous flow reversal";
 
 public
   Boolean ouvert(start=true, fixed=true) "Valve state";
   discrete Boolean touvert(start=false, fixed=true);
   discrete Boolean tferme(start=false, fixed=true);
-  Modelica.SIunits.MassFlowRate Q "Mass flow rate";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow rate";
   ThermoSysPro.Units.DifferentialPressure deltaP
     "Pressure difference between the inlet and the outlet";
   Connectors.FluidOutlet C2         annotation (Placement(transformation(extent=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/IdealSwitchValve.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/IdealSwitchValve.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/IdealSwitchValve.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/IdealSwitchValve.mo"	2022-03-10 09:58:20.584149522 +0000
@@ -1,17 +1,17 @@
 within ThermoSysPro.WaterSteam.PressureLosses;
 model IdealSwitchValve "Ideal switch valve"
-  parameter Modelica.SIunits.MassFlowRate Qmin=1.e-6
+  parameter Modelica.Units.SI.MassFlowRate Qmin=1.e-6
     "Mass flow when the valve is closed";
   parameter Boolean continuous_flow_reversal=false
     "true: continuous flow reversal - false: discontinuous flow reversal";
 
 protected
   constant Real pi=Modelica.Constants.pi "pi";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow for continuous flow reversal";
 
 public
-  Modelica.SIunits.MassFlowRate Q "Mass flow rate";
+  Modelica.Units.SI.MassFlowRate Q "Mass flow rate";
   ThermoSysPro.Units.DifferentialPressure deltaP
     "Pressure difference between the inlet and the outlet";
 public
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/InvSingularPressureLoss.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/InvSingularPressureLoss.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/InvSingularPressureLoss.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/InvSingularPressureLoss.mo"	2022-03-10 09:58:20.564149520 +0000
@@ -3,25 +3,25 @@
   parameter Boolean continuous_flow_reversal=false
     "true: continuous flow reversal - false: discontinuous flow reversal";
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 protected
   parameter Real eps=1.e-3 "Small number for pressure loss equation";
   constant Real pi=Modelica.Constants.pi "pi";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow for continuous flow reversal";
 
 public
   Real K(start=1.e3) "Pressure loss coefficient";
   ThermoSysPro.Units.DifferentialPressure deltaP "Singular pressure loss";
-  Modelica.SIunits.MassFlowRate Q(start=500) "Mass flow rate";
-  Modelica.SIunits.Density rho(start=998) "Fluid density";
-  Modelica.SIunits.Temperature T(start=290) "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure Pm(start=1.e5) "Average fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
 
+  Modelica.Units.SI.MassFlowRate Q(start=500) "Mass flow rate";
+  Modelica.Units.SI.Density rho(start=998) "Fluid density";
+  Modelica.Units.SI.Temperature T(start=290) "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure Pm(start=1.e5) "Average fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
 public
   Connectors.FluidInlet C1
     annotation (Placement(transformation(extent={{-110,-10},{-90,10}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/LumpedStraightPipe.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/LumpedStraightPipe.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/LumpedStraightPipe.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/LumpedStraightPipe.mo"	2022-03-10 09:58:20.544149516 +0000
@@ -1,14 +1,14 @@
 within ThermoSysPro.WaterSteam.PressureLosses;
 model LumpedStraightPipe "Lumped straight pipe (circular duct)"
- parameter Modelica.SIunits.Length L=10. "Pipe length";
-  parameter Modelica.SIunits.Diameter D=0.2 "Pipe internal diameter";
+ parameter Modelica.Units.SI.Length L=10. "Pipe length";
+  parameter Modelica.Units.SI.Diameter D=0.2 "Pipe internal diameter";
   parameter Integer ntubes=1 "Number of pipes in parallel";
   parameter Real lambda=0.03
     "Friction pressure loss coefficient (active if lambda_fixed=true)";
   parameter Real rugosrel=0.0001
     "Pipe roughness (active if lambda_fixed=false)";
-  parameter Modelica.SIunits.Position z1=0 "Inlet altitude";
-  parameter Modelica.SIunits.Position z2=0 "Outlet altitude";
+  parameter Modelica.Units.SI.Position z1=0 "Inlet altitude";
+  parameter Modelica.Units.SI.Position z2=0 "Outlet altitude";
   parameter Boolean lambda_fixed=true
     "true: lambda given by parameter - false: lambde computed using Idel'Cik correlation";
   parameter Boolean inertia=false
@@ -16,36 +16,36 @@
   parameter Boolean continuous_flow_reversal=false
     "true: continuous flow reversal - false: discontinuous flow reversal";
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 protected
-  constant Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  constant Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
   constant Real pi=Modelica.Constants.pi "pi";
   parameter Real eps=1.e-3 "Small number for pressure loss equation";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow for continuous flow reversal";
-  parameter Modelica.SIunits.Area A=ntubes*pi*D^2/4
+  parameter Modelica.Units.SI.Area A=ntubes*pi*D^2/4
     "Pipes cross-sectional area (circular duct is assumed)";
-  parameter Modelica.SIunits.Area Pw=ntubes*pi*D
+  parameter Modelica.Units.SI.Area Pw=ntubes*pi*D
     "Pipes wetted perimeter (circular duct is assumed)";
 
 public
   Real khi "Hydraulic pressure loss coefficient";
   ThermoSysPro.Units.DifferentialPressure deltaPf "Friction pressure loss";
   ThermoSysPro.Units.DifferentialPressure deltaP "Total pressure loss";
-  Modelica.SIunits.MassFlowRate Q(start=100) "Mass flow rate";
-  Modelica.SIunits.ReynoldsNumber Re "Reynolds number";
-  Modelica.SIunits.ReynoldsNumber Relim "Limit Reynolds number";
+  Modelica.Units.SI.MassFlowRate Q(start=100) "Mass flow rate";
+  Modelica.Units.SI.ReynoldsNumber Re "Reynolds number";
+  Modelica.Units.SI.ReynoldsNumber Relim "Limit Reynolds number";
   Real lam "Friction pressure loss coefficient";
-  Modelica.SIunits.Density rho "Fluid density";
-  Modelica.SIunits.DynamicViscosity mu "Fluid dynamic viscosity";
-  Modelica.SIunits.Temperature T "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure Pm "Fluid average pressure";
-  Modelica.SIunits.SpecificEnthalpy h "Fluid specific enthalpy";
 
+  Modelica.Units.SI.Density rho "Fluid density";
+  Modelica.Units.SI.DynamicViscosity mu "Fluid dynamic viscosity";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure Pm "Fluid average pressure";
+  Modelica.Units.SI.SpecificEnthalpy h "Fluid specific enthalpy";
 public
   Connectors.FluidInlet C1 annotation (Placement(transformation(extent={{-110,
             -10},{-90,10}}, rotation=0)));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/NonBoilingValve.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/NonBoilingValve.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/NonBoilingValve.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/NonBoilingValve.mo"	2022-03-10 09:58:20.504149511 +0000
@@ -2,28 +2,28 @@
 model NonBoilingValve "Non boiling valve"
   parameter ThermoSysPro.Units.DifferentialPressure Psecu=1.e4
     "Security margin to avoid boiling";
-  parameter Modelica.SIunits.SpecificEnthalpy Hmax=5.e6
+  parameter Modelica.Units.SI.SpecificEnthalpy Hmax=5.e6
     "Fluid maximum specific enthalpy";
-  parameter Modelica.SIunits.SpecificEnthalpy Hmin=6.e4
+  parameter Modelica.Units.SI.SpecificEnthalpy Hmin=6.e4
     "Fluid minimum specific enthalpy";
   parameter Boolean continuous_flow_reversal=false
     "true: continuous flow reversal - false: discontinuous flow reversal";
 
 protected
-  constant Modelica.SIunits.AbsolutePressure Pcrit=220.64e5 "Critical pressure";
+  constant Modelica.Units.SI.AbsolutePressure Pcrit=220.64e5 "Critical pressure";
   constant Real pi=Modelica.Constants.pi "pi";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow for continuous flow reversal";
 
 public
-  Modelica.SIunits.MassFlowRate Q(start=500) "Mass flow rate";
-  Modelica.SIunits.AbsolutePressure Pebul(start=1.e5)
+
+  Modelica.Units.SI.MassFlowRate Q(start=500) "Mass flow rate";
+  Modelica.Units.SI.AbsolutePressure Pebul(start=1.e5)
     "Fluid saturation pressure corresponding to Pec";
-  Modelica.SIunits.AbsolutePressure Pec(start=5.e5) "Pressure at the inlet";
-  Modelica.SIunits.AbsolutePressure Psc(start=5.e5) "Pressure at the outlet";
-  Modelica.SIunits.SpecificEnthalpy Hec(start=50.e4)
+  Modelica.Units.SI.AbsolutePressure Pec(start=5.e5) "Pressure at the inlet";
+  Modelica.Units.SI.AbsolutePressure Psc(start=5.e5) "Pressure at the outlet";
+  Modelica.Units.SI.SpecificEnthalpy Hec(start=50.e4)
     "Specific fluid enthalpy at the inlet";
-
 public
   Connectors.FluidInlet C1
     annotation (Placement(transformation(extent={{-110,-12},{-90,8}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/PipePressureLoss.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/PipePressureLoss.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/PipePressureLoss.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/PipePressureLoss.mo"	2022-03-10 09:58:20.480149508 +0000
@@ -1,32 +1,32 @@
-﻿within ThermoSysPro.WaterSteam.PressureLosses;
+within ThermoSysPro.WaterSteam.PressureLosses;
 model PipePressureLoss "Pipe generic pressure loss"
   parameter Real K=10 "Friction pressure loss coefficient";
-  parameter Modelica.SIunits.Position z1=0 "Inlet altitude";
-  parameter Modelica.SIunits.Position z2=0 "Outlet altitude";
+  parameter Modelica.Units.SI.Position z1=0 "Inlet altitude";
+  parameter Modelica.Units.SI.Position z2=0 "Outlet altitude";
   parameter Boolean continuous_flow_reversal=false
     "true: continuous flow reversal - false: discontinuous flow reversal";
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 protected
-  constant Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  constant Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
   constant Real pi=Modelica.Constants.pi "pi";
   parameter Real eps=1.e-3 "Small number for pressure loss equation";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow for continuous flow reversal";
 
 public
   ThermoSysPro.Units.DifferentialPressure deltaPf "Friction pressure loss";
   ThermoSysPro.Units.DifferentialPressure deltaPg "Gravity pressure loss";
   ThermoSysPro.Units.DifferentialPressure deltaP "Total pressure loss";
-  Modelica.SIunits.MassFlowRate Q(start=100) "Mass flow rate";
-  Modelica.SIunits.Density rho(start=998) "Fluid density";
-  Modelica.SIunits.Temperature T(start=290) "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure Pm(start=1.e5) "Average fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
+  Modelica.Units.SI.MassFlowRate Q(start=100) "Mass flow rate";
+  Modelica.Units.SI.Density rho(start=998) "Fluid density";
+  Modelica.Units.SI.Temperature T(start=290) "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure Pm(start=1.e5) "Average fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
 
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro
     "Propriétés de l'eau"
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/SingularPressureLoss.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/SingularPressureLoss.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/SingularPressureLoss.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/SingularPressureLoss.mo"	2022-03-10 09:58:20.452149505 +0000
@@ -4,23 +4,23 @@
   parameter Boolean continuous_flow_reversal=false
     "true: continuous flow reversal - false: discontinuous flow reversal";
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 protected
   constant Real pi=Modelica.Constants.pi "pi";
   parameter Real eps=1.e-3 "Small number for pressure loss equation";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow for continuous flow reversal";
 
 public
   ThermoSysPro.Units.DifferentialPressure deltaP "Singular pressure loss";
-  Modelica.SIunits.MassFlowRate Q(start=100) "Mass flow rate";
-  Modelica.SIunits.Density rho(start=998) "Fluid density";
-  Modelica.SIunits.Temperature T(start=290) "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure Pm(start=1.e5) "Average fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
+  Modelica.Units.SI.MassFlowRate Q(start=100) "Mass flow rate";
+  Modelica.Units.SI.Density rho(start=998) "Fluid density";
+  Modelica.Units.SI.Temperature T(start=290) "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure Pm(start=1.e5) "Average fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
 
   Connectors.FluidInlet C1
     annotation (Placement(transformation(extent={{-110,-10},{-90,10}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/SwitchValve.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/SwitchValve.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/SwitchValve.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/SwitchValve.mo"	2022-03-10 09:58:20.424149501 +0000
@@ -1,29 +1,29 @@
-﻿within ThermoSysPro.WaterSteam.PressureLosses;
+within ThermoSysPro.WaterSteam.PressureLosses;
 model SwitchValve "Switch valve"
   parameter ThermoSysPro.Units.PressureLossCoefficient k=1000
     "Pressure loss coefficient";
-  parameter Modelica.SIunits.MassFlowRate Qmin=1.e-6
+  parameter Modelica.Units.SI.MassFlowRate Qmin=1.e-6
     "Mass flow when the valve is closed";
   parameter Boolean continuous_flow_reversal=false
     "true: continuous flow reversal - false: discontinuous flow reversal";
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 protected
   parameter Real eps=1.e-3 "Small number for pressure loss equation";
   constant Real pi=Modelica.Constants.pi "pi";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Small mass flow for continuous flow reversal";
 
 public
-  Modelica.SIunits.MassFlowRate Q(start=500) "Mass flow rate";
+  Modelica.Units.SI.MassFlowRate Q(start=500) "Mass flow rate";
   ThermoSysPro.Units.DifferentialPressure deltaP "Singular pressure loss";
-  Modelica.SIunits.Density rho(start=998) "Fluid density";
-  Modelica.SIunits.Temperature T(start=290) "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure Pm(start=1.e5) "Fluid average pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
+  Modelica.Units.SI.Density rho(start=998) "Fluid density";
+  Modelica.Units.SI.Temperature T(start=290) "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure Pm(start=1.e5) "Fluid average pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro
     "Propriétés de l'eau"
     annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/ThreeWayValve.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/ThreeWayValve.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/ThreeWayValve.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/PressureLosses/ThreeWayValve.mo"	2022-03-10 09:58:20.404149498 +0000
@@ -10,11 +10,11 @@
     "Valve 1 - 0:linear characteristics - 1:characteristics is given by caract1[]";
   parameter Integer mode_caract2=0
     "Valve 2 - 0:linear characteristics - 1:characteristics is given by caract2[]";
-  parameter Modelica.SIunits.Volume V=1 "Three way valve volume";
+  parameter Modelica.Units.SI.Volume V=1 "Three way valve volume";
   parameter Boolean continuous_flow_reversal=false
     "true: continuous flow reversal - false: discontinuous flow reversal";
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
   ThermoSysPro.InstrumentationAndControl.Connectors.InputReal Ouv
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Sensors/SensorH.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Sensors/SensorH.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Sensors/SensorH.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Sensors/SensorH.mo"	2022-03-10 09:58:20.372149494 +0000
@@ -5,11 +5,11 @@
 
 protected
   constant Real pi=Modelica.Constants.pi "pi";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Minimum mass flow for continuous flow reversal";
 
 public
-  Modelica.SIunits.MassFlowRate Q(start=500) "Mass flow rate";
+  Modelica.Units.SI.MassFlowRate Q(start=500) "Mass flow rate";
 public
   ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal Measure
     annotation (Placement(transformation(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Sensors/SensorP.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Sensors/SensorP.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Sensors/SensorP.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Sensors/SensorP.mo"	2022-03-10 09:58:20.352149492 +0000
@@ -5,11 +5,11 @@
 
 protected
   constant Real pi=Modelica.Constants.pi "pi";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Minimum mass flow for continuous flow reversal";
 
 public
-  Modelica.SIunits.MassFlowRate Q(start=500) "Mass flow rate";
+  Modelica.Units.SI.MassFlowRate Q(start=500) "Mass flow rate";
 public
   ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal Measure
     annotation (Placement(transformation(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Sensors/SensorQ.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Sensors/SensorQ.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Sensors/SensorQ.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Sensors/SensorQ.mo"	2022-03-10 09:58:20.340149490 +0000
@@ -5,11 +5,11 @@
 
 protected
   constant Real pi=Modelica.Constants.pi "pi";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Minimum mass flow for continuous flow reversal";
 
 public
-  Modelica.SIunits.MassFlowRate Q(start=500) "Mass flow rate";
+  Modelica.Units.SI.MassFlowRate Q(start=500) "Mass flow rate";
 public
   ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal Measure
     annotation (Placement(transformation(
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Sensors/SensorQv.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Sensors/SensorQv.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Sensors/SensorQv.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Sensors/SensorQv.mo"	2022-03-10 09:58:20.328149489 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.WaterSteam.Sensors;
+within ThermoSysPro.WaterSteam.Sensors;
 model SensorQv "Volumetric flow sensor"
   parameter Integer output_unit=1 "Sensor outpu unit - 1: m3/h, other: m3/s";
   parameter Boolean continuous_flow_reversal=false
@@ -8,17 +8,17 @@
 
 protected
   constant Real pi=Modelica.Constants.pi "pi";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Minimum mass flow rate for continuous flow reversal";
 
 public
-  Modelica.SIunits.MassFlowRate Q(start=500) "Mass flow rate";
-  Modelica.SIunits.VolumeFlowRate Qv(start=0.5) "Volume flow rate";
-  Modelica.SIunits.AbsolutePressure Pm "Fluid average pressure";
-  Modelica.SIunits.SpecificEnthalpy h "Fluid specific enthalpy";
+  Modelica.Units.SI.MassFlowRate Q(start=500) "Mass flow rate";
+  Modelica.Units.SI.VolumeFlowRate Qv(start=0.5) "Volume flow rate";
+  Modelica.Units.SI.AbsolutePressure Pm "Fluid average pressure";
+  Modelica.Units.SI.SpecificEnthalpy h "Fluid specific enthalpy";
 
 protected
-  Modelica.SIunits.Time facteur=if (output_unit == 1) then 3600 else 1
+  Modelica.Units.SI.Time facteur=if (output_unit == 1) then 3600 else 1
     "Unit factor";
 public
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Sensors/SensorT.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Sensors/SensorT.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Sensors/SensorT.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Sensors/SensorT.mo"	2022-03-10 09:58:20.288149484 +0000
@@ -1,4 +1,4 @@
-﻿within ThermoSysPro.WaterSteam.Sensors;
+within ThermoSysPro.WaterSteam.Sensors;
 model SensorT "Temperature sensor"
   parameter Boolean continuous_flow_reversal=false
     "true : continuous flow reversal - false : discontinuous flow reversal";
@@ -7,14 +7,14 @@
 
 protected
   constant Real pi=Modelica.Constants.pi "pi";
-  parameter Modelica.SIunits.MassFlowRate Qeps=1.e-3
+  parameter Modelica.Units.SI.MassFlowRate Qeps=1.e-3
     "Minimum mass flow rate for continuous flow reversal";
 
 public
-  Modelica.SIunits.MassFlowRate Q(start=500) "Mass flow rate";
-  Modelica.SIunits.Temperature T "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure P "Fluid average pressure";
-  Modelica.SIunits.SpecificEnthalpy h "Fluid specific enthalpy";
+  Modelica.Units.SI.MassFlowRate Q(start=500) "Mass flow rate";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P "Fluid average pressure";
+  Modelica.Units.SI.SpecificEnthalpy h "Fluid specific enthalpy";
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro
     "Propriétés de l'eau"
     annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/DegasifierVolume.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/DegasifierVolume.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/DegasifierVolume.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/DegasifierVolume.mo"	2022-03-10 09:58:20.236149478 +0000
@@ -1,33 +1,33 @@
-﻿within ThermoSysPro.WaterSteam.Volumes;
+within ThermoSysPro.WaterSteam.Volumes;
 model DegasifierVolume "Degasifier volume"
-  parameter Modelica.SIunits.Volume V=160 "Degazifier volume";
-  parameter Modelica.SIunits.Volume Vmax=10
+  parameter Modelica.Units.SI.Volume V=160 "Degazifier volume";
+  parameter Modelica.Units.SI.Volume Vmax=10
     "Maximum volume of the liquid in the basins";
-  parameter Modelica.SIunits.SpecificHeatCapacity Cpmetal=460
+  parameter Modelica.Units.SI.SpecificHeatCapacity Cpmetal=460
     "Metal specific heat";
-  parameter Modelica.SIunits.Mass Mmetal=10869 "Metal mass";
-  parameter Modelica.SIunits.AbsolutePressure P0=1e5
+  parameter Modelica.Units.SI.Mass Mmetal=10869 "Metal mass";
+  parameter Modelica.Units.SI.AbsolutePressure P0=1e5
     "Initial fluid pressure (active if steady_state=false)";
-  parameter Modelica.SIunits.SpecificEnthalpy h0=1e5
+  parameter Modelica.Units.SI.SpecificEnthalpy h0=1e5
     "Initial fluid specific enthalpy (active if steady_state=false)";
   parameter Boolean steady_state=true
     "true: start from steady state - false: start from (P0, h0)";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 public
-  Modelica.SIunits.Power W
+  Modelica.Units.SI.Power W
     "Thermal power exchanged between the liquid and the basins";
-  Modelica.SIunits.Temperature Tl
+  Modelica.Units.SI.Temperature Tl
     "Saturation temperature of the liquid in the basins";
   Real x "Vapor mass fraction";
-  Modelica.SIunits.AbsolutePressure P(start=1.e5) "Average fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
-  Modelica.SIunits.Density rho(start=998) "Fluid density";
-  Modelica.SIunits.MassFlowRate BQ
+  Modelica.Units.SI.AbsolutePressure P(start=1.e5) "Average fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
+  Modelica.Units.SI.Density rho(start=998) "Fluid density";
+  Modelica.Units.SI.MassFlowRate BQ
     "Right hand side of the mass balance equation";
-  Modelica.SIunits.Power BH "Right hand side of the energy balance equation";
+  Modelica.Units.SI.Power BH "Right hand side of the energy balance equation";
   Real rhols;
 
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/DynamicDrum.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/DynamicDrum.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/DynamicDrum.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/DynamicDrum.mo"	2022-03-10 09:58:20.208149474 +0000
@@ -1,13 +1,13 @@
-﻿within ThermoSysPro.WaterSteam.Volumes;
+within ThermoSysPro.WaterSteam.Volumes;
 model DynamicDrum "Dynamic drum"
   parameter Boolean Vertical=true
     "true: vertical cylinder - false: horizontal cylinder";
-  parameter Modelica.SIunits.Radius R=1.05
+  parameter Modelica.Units.SI.Radius R=1.05
     "Radius of the drum cross-sectional area";
-  parameter Modelica.SIunits.Length L=16.27 "Drum length";
+  parameter Modelica.Units.SI.Length L=16.27 "Drum length";
   parameter Real Vf0=0.5
     "Fraction of initial water volume in the drum (active if steady_state=false)";
-  parameter Modelica.SIunits.AbsolutePressure P0=50.e5
+  parameter Modelica.Units.SI.AbsolutePressure P0=50.e5
     "Fluid initial pressure (active if steady_state=false)";
   parameter Real Ccond=0.01 "Condensation coefficient";
   parameter Real Cevap=0.09 "Evaporation coefficient";
@@ -17,70 +17,70 @@
     "Vapor mass fraction in the gas phase from which the liquid starts to condensate";
   parameter Real Kvl=1000
     "Heat exchange coefficient between the liquid and gas phases";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer Klp=400
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer Klp=400
     "Heat exchange coefficient between the liquid phase and the wall";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer Kvp=100
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer Kvp=100
     "Heat exchange coefficient between the gas phase and the wall";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer Kpa=25
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer Kpa=25
     "Heat exchange coefficient between the wall and the outside";
-  parameter Modelica.SIunits.Mass Mp=117e3 "Wall mass";
-  parameter Modelica.SIunits.SpecificHeatCapacity cpp=600 "Wall specific heat";
+  parameter Modelica.Units.SI.Mass Mp=117e3 "Wall mass";
+  parameter Modelica.Units.SI.SpecificHeatCapacity cpp=600 "Wall specific heat";
   parameter Boolean steady_state=true
     "true: start from steady state - false: start from (P0, Vf0)";
 
 protected
   constant Real pi=Modelica.Constants.pi "pi";
-  constant Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  constant Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
-  parameter Modelica.SIunits.Volume V=pi*R^2*L "Drum volume";
-  parameter Modelica.SIunits.Volume Vmin=1.e-6;
+  parameter Modelica.Units.SI.Volume V=pi*R^2*L "Drum volume";
+  parameter Modelica.Units.SI.Volume Vmin=1.e-6;
 
 public
-  Modelica.SIunits.AbsolutePressure P "Fluid average pressure";
-  Modelica.SIunits.AbsolutePressure Pfond
+  Modelica.Units.SI.AbsolutePressure P "Fluid average pressure";
+  Modelica.Units.SI.AbsolutePressure Pfond
     "Fluid pressure at the bottom of the drum";
-  Modelica.SIunits.SpecificEnthalpy hl "Liquid phase specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy hv "Gas phase specific enthalpy";
-  Modelica.SIunits.Temperature Tl "Liquid phase temperature";
-  Modelica.SIunits.Temperature Tv "Gas phase temperature";
-  Modelica.SIunits.Temperature Tp(start=550) "Wall temperature";
-  Modelica.SIunits.Temperature Ta "External temperature";
-  Modelica.SIunits.Volume Vl "Liquid phase volume";
-  Modelica.SIunits.Volume Vv "Gas phase volume";
-  Modelica.SIunits.Area Alp "Liquid phase surface on contact with the wall";
-  Modelica.SIunits.Area Avp "Gas phase surface on contact with the wall";
-  Modelica.SIunits.Area Ape "Wall surface on contact with the outside";
+  Modelica.Units.SI.SpecificEnthalpy hl "Liquid phase specific enthalpy";
+  Modelica.Units.SI.SpecificEnthalpy hv "Gas phase specific enthalpy";
+  Modelica.Units.SI.Temperature Tl "Liquid phase temperature";
+  Modelica.Units.SI.Temperature Tv "Gas phase temperature";
+  Modelica.Units.SI.Temperature Tp(start=550) "Wall temperature";
+  Modelica.Units.SI.Temperature Ta "External temperature";
+  Modelica.Units.SI.Volume Vl "Liquid phase volume";
+  Modelica.Units.SI.Volume Vv "Gas phase volume";
+  Modelica.Units.SI.Area Alp "Liquid phase surface on contact with the wall";
+  Modelica.Units.SI.Area Avp "Gas phase surface on contact with the wall";
+  Modelica.Units.SI.Area Ape "Wall surface on contact with the outside";
   Real xl(start=0.5) "Mass vapor fraction in the liquid phase";
   Real xv(start=0) "Mass vapor fraction in the vapor phase";
   Real xmv(start=0.5) "Mass vapor fraction in the ascending tube";
-  Modelica.SIunits.Density rhol(start=996) "Liquid phase density";
-  Modelica.SIunits.Density rhov(start=1.5) "Gas phase density";
-  Modelica.SIunits.MassFlowRate BQl
+  Modelica.Units.SI.Density rhol(start=996) "Liquid phase density";
+  Modelica.Units.SI.Density rhov(start=1.5) "Gas phase density";
+  Modelica.Units.SI.MassFlowRate BQl
     "Right hand side of the mass balance equation of the liquid phase";
-  Modelica.SIunits.MassFlowRate BQv
+  Modelica.Units.SI.MassFlowRate BQv
     "Right hand side of the mass balance equation of the gas phase";
-  Modelica.SIunits.Power BHl
+  Modelica.Units.SI.Power BHl
     "Right hand side of the energy balance equation of the liquid phase";
-  Modelica.SIunits.Power BHv
+  Modelica.Units.SI.Power BHv
     "Right hand side of the energy balance equation of the gas phase";
-  Modelica.SIunits.MassFlowRate Qcond
+  Modelica.Units.SI.MassFlowRate Qcond
     "Condensation mass flow rate from the vapor phase";
-  Modelica.SIunits.MassFlowRate Qevap
+  Modelica.Units.SI.MassFlowRate Qevap
     "Evaporation mass flow rate from the liquid phase";
-  Modelica.SIunits.MassFlowRate Qv
+  Modelica.Units.SI.MassFlowRate Qv
     "Steam mass flow rate from the riser";
-  Modelica.SIunits.Power Wlv
+  Modelica.Units.SI.Power Wlv
     "Thermal power exchanged from the gas phase to the liquid phase";
-  Modelica.SIunits.Power Wpl
+  Modelica.Units.SI.Power Wpl
     "Thermal power exchanged from the liquid phase to the wall";
-  Modelica.SIunits.Power Wpv
+  Modelica.Units.SI.Power Wpv
     "Thermal power exchanged from the gas phase to the wall";
-  Modelica.SIunits.Power Wpa
+  Modelica.Units.SI.Power Wpa
     "Thermal power exchanged from the outside to the wall";
-  Modelica.SIunits.Position zl(start=1.05) "Liquid level in drum";
-  Modelica.SIunits.Area Al "Cross sectional area of the liquid phase";
-  Modelica.SIunits.Angle theta "Angle";
-  Modelica.SIunits.Area Avl(start=1.0)
+  Modelica.Units.SI.Position zl(start=1.05) "Liquid level in drum";
+  Modelica.Units.SI.Area Al "Cross sectional area of the liquid phase";
+  Modelica.Units.SI.Angle theta "Angle";
+  Modelica.Units.SI.Area Avl(start=1.0)
     "Heat exchange surface between the liquid and gas phases";
 
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prol
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/Pressurizer.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/Pressurizer.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/Pressurizer.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/Pressurizer.mo"	2022-03-10 09:58:20.136149465 +0000
@@ -1,74 +1,74 @@
 within ThermoSysPro.WaterSteam.Volumes;
 model Pressurizer "Pressurizer"
-  parameter Modelica.SIunits.Volume V=61.1 "Pressurizer volume";
-  parameter Modelica.SIunits.Radius Rp=1.265
+  parameter Modelica.Units.SI.Volume V=61.1 "Pressurizer volume";
+  parameter Modelica.Units.SI.Radius Rp=1.265
     "Pressurizer cross-sectional radius";
-  parameter Modelica.SIunits.Area Ae=1 "Wall surface";
-  parameter Modelica.SIunits.Position Zm=10.15
+  parameter Modelica.Units.SI.Area Ae=1 "Wall surface";
+  parameter Modelica.Units.SI.Position Zm=10.15
     "Hauteur de la gamme de mesure niveau";
   parameter Real Yw0=50
     "Initial water level - percent of the measure scale level (active if steady_state=false)";
-  parameter Modelica.SIunits.AbsolutePressure P0=155e5
+  parameter Modelica.Units.SI.AbsolutePressure P0=155e5
     "Initial fluid pressure (active if steady_state=false)";
   parameter Real Ccond=0.1 "Condensation coefficient";
   parameter Real Cevap=0.1 "Evaporation coefficient";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer Klv=0.5e6
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer Klv=0.5e6
     "Heat exchange coefficient between the liquid and gas phases";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer Klp=50000
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer Klp=50000
     "Heat exchange coefficient between the liquid phase and the wall";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer Kvp=25
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer Kvp=25
     "Heat exchange coefficient between the gas phase and the wall";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer Kpa=542
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer Kpa=542
     "Heat exchange coefficient between the wall and the outside";
-  parameter Modelica.SIunits.Mass Mp=117e3 "Wall mass";
-  parameter Modelica.SIunits.SpecificHeatCapacity cpp=600 "Wall specific heat";
+  parameter Modelica.Units.SI.Mass Mp=117e3 "Wall mass";
+  parameter Modelica.Units.SI.SpecificHeatCapacity cpp=600 "Wall specific heat";
   parameter Boolean steady_state=true
     "true: start from steady state - false: start from (P0, Yw0)";
 
 protected
   constant Real pi=Modelica.Constants.pi "Pi";
-  constant Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  constant Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
-  parameter Modelica.SIunits.Area Ap=pi*Rp*Rp
+  parameter Modelica.Units.SI.Area Ap=pi*Rp*Rp
     "Pressurizer cross-sectional area";
 
 public
-  Modelica.SIunits.Area Slpin
+  Modelica.Units.SI.Area Slpin
     "Exchange surface between the liquid and the wall";
-  Modelica.SIunits.Area Svpin "Exchange surface between the vapor and the wall";
+  Modelica.Units.SI.Area Svpin "Exchange surface between the vapor and the wall";
   Real Yw(start=50) "Liquid level as a percent of the measure scale";
   Real y(start=0.5) "Liquid level as a proportion of the measure scale";
-  Modelica.SIunits.Position Zl(start=20) "Liquid level in the pressurizer";
-  Modelica.SIunits.Volume Vl "Liquid phase volume";
-  Modelica.SIunits.Volume Vv "Gas phase volume";
-  Modelica.SIunits.AbsolutePressure P(start=155.0e5) "Average fluid pressure";
-  Modelica.SIunits.AbsolutePressure Pfond
+  Modelica.Units.SI.Position Zl(start=20) "Liquid level in the pressurizer";
+  Modelica.Units.SI.Volume Vl "Liquid phase volume";
+  Modelica.Units.SI.Volume Vv "Gas phase volume";
+  Modelica.Units.SI.AbsolutePressure P(start=155.0e5) "Average fluid pressure";
+  Modelica.Units.SI.AbsolutePressure Pfond
     "Fluid pressure at the bottom of the drum";
-  Modelica.SIunits.SpecificEnthalpy hl "Liquid phase specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy hv "Gas phase specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy hls
+  Modelica.Units.SI.SpecificEnthalpy hl "Liquid phase specific enthalpy";
+  Modelica.Units.SI.SpecificEnthalpy hv "Gas phase specific enthalpy";
+  Modelica.Units.SI.SpecificEnthalpy hls
     "Liquid phase saturation specific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy hvs
+  Modelica.Units.SI.SpecificEnthalpy hvs
     "Gas phase saturation specific enthalpy";
-  Modelica.SIunits.Temperature Tl "Liquid phase temperature";
-  Modelica.SIunits.Temperature Tv "Gas phase temperature";
-  Modelica.SIunits.Temperature Tp(start=617.24) "Wall temperature";
-  Modelica.SIunits.Temperature Ta "External temperature";
-  Modelica.SIunits.Power Wlv
+  Modelica.Units.SI.Temperature Tl "Liquid phase temperature";
+  Modelica.Units.SI.Temperature Tv "Gas phase temperature";
+  Modelica.Units.SI.Temperature Tp(start=617.24) "Wall temperature";
+  Modelica.Units.SI.Temperature Ta "External temperature";
+  Modelica.Units.SI.Power Wlv
     "Thermal power exchanged from the gas phase to the liquid phase";
-  Modelica.SIunits.Power Wpl
+  Modelica.Units.SI.Power Wpl
     "Thermal power exchanged from the liquid phase to the wall";
-  Modelica.SIunits.Power Wpv
+  Modelica.Units.SI.Power Wpv
     "Thermal power exchanged from the gas phase to the wall";
-  Modelica.SIunits.Power Wpa
+  Modelica.Units.SI.Power Wpa
     "Thermal power exchanged from the outside to the wall";
-  Modelica.SIunits.Power Wch "Power released by the electrical heaters";
-  Modelica.SIunits.MassFlowRate Qcond
+  Modelica.Units.SI.Power Wch "Power released by the electrical heaters";
+  Modelica.Units.SI.MassFlowRate Qcond
     "Condensation mass flow rate from the vapor phase";
-  Modelica.SIunits.MassFlowRate Qevap
+  Modelica.Units.SI.MassFlowRate Qevap
     "Evaporation mass flow rate from the liquid phase";
-  Modelica.SIunits.Density rhol(start=996) "Liquid phase density";
-  Modelica.SIunits.Density rhov(start=1.5) "Vapor phase density";
+  Modelica.Units.SI.Density rhol(start=996) "Liquid phase density";
+  Modelica.Units.SI.Density rhov(start=1.5) "Vapor phase density";
 
   Connectors.FluidInlet Cas "Water input"
                                  annotation (Placement(transformation(extent={{
@@ -185,8 +185,8 @@
 
   /* Condensation and evaporation mass flows */
   Qevap = Cevap*rhol*Vl*(hl - hls)/(hvs - hls);
-  //Qcond = noEvent(Ccond*rhov*Vv*(hvs - hv)/(hvs - hls) + (Cas.Q*(hls - Cas.h)
-  //   + 0.5*(Wpv + abs(Wpv)) + Wlv)/(hv - hls));
+//Qcond = noEvent(Ccond*rhov*Vv*(hvs - hv)/(hvs - hls) + (Cas.Q*(hls - Cas.h)
+//   + 0.5*(Wpv + abs(Wpv)) + Wlv)/(hv - hls));
   Qcond = Ccond*rhov*Vv*(hvs - hv)/(hvs - hls);
 
   /* Fluid thermodynamic properties */
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/Tank.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/Tank.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/Tank.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/Tank.mo"	2022-03-10 09:58:20.028149452 +0000
@@ -1,19 +1,19 @@
 within ThermoSysPro.WaterSteam.Volumes;
 model Tank "Open tank"
-  parameter Modelica.SIunits.AbsolutePressure Patm=1.013e5
+  parameter Modelica.Units.SI.AbsolutePressure Patm=1.013e5
     "Pressure above the fluid level";
-  parameter Modelica.SIunits.Area A=1 "Tank cross sectional area";
-  parameter Modelica.SIunits.Position ze1=40 "Altitude of inlet 1";
-  parameter Modelica.SIunits.Position ze2=de2/2 "Altitude of inlet 2";
-  parameter Modelica.SIunits.Position zs1=40 "Altitude of outlet 1";
-  parameter Modelica.SIunits.Position zs2=ds2/2 "Altitude of outlet 2";
-  parameter Modelica.SIunits.Diameter de1=0.20 "Diameter of inlet 1";
-  parameter Modelica.SIunits.Diameter de2=0.20 "Diameter of inlet 2";
-  parameter Modelica.SIunits.Diameter ds1=0.20 "Diameter of outlet 1";
-  parameter Modelica.SIunits.Diameter ds2=0.20 "Diameter of outlet 2";
-  parameter Modelica.SIunits.Position z0=30
+  parameter Modelica.Units.SI.Area A=1 "Tank cross sectional area";
+  parameter Modelica.Units.SI.Position ze1=40 "Altitude of inlet 1";
+  parameter Modelica.Units.SI.Position ze2=de2/2 "Altitude of inlet 2";
+  parameter Modelica.Units.SI.Position zs1=40 "Altitude of outlet 1";
+  parameter Modelica.Units.SI.Position zs2=ds2/2 "Altitude of outlet 2";
+  parameter Modelica.Units.SI.Diameter de1=0.20 "Diameter of inlet 1";
+  parameter Modelica.Units.SI.Diameter de2=0.20 "Diameter of inlet 2";
+  parameter Modelica.Units.SI.Diameter ds1=0.20 "Diameter of outlet 1";
+  parameter Modelica.Units.SI.Diameter ds2=0.20 "Diameter of outlet 2";
+  parameter Modelica.Units.SI.Position z0=30
     "Initial fluid level (active if steady_state=false)";
-  parameter Modelica.SIunits.SpecificEnthalpy h0=1.e5
+  parameter Modelica.Units.SI.SpecificEnthalpy h0=1.e5
     "Initial fluid specific enthalpy (active if steady_state=false)";
   parameter Real ke1=1
     "Pressure loss coefficient for inlet e1";
@@ -30,27 +30,27 @@
   parameter Boolean steady_state_mech=false
     "true: start from steady state - false: start from z0";
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 protected
-  parameter Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  parameter Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
   parameter Real eps=1.e-0 "Small number for ths square function";
-  parameter Modelica.SIunits.Position zmin=1.e-6 "Minimum fluid level";
+  parameter Modelica.Units.SI.Position zmin=1.e-6 "Minimum fluid level";
   parameter Real pi=Modelica.Constants.pi;
 
 public
-  Modelica.SIunits.Position z "Fluid level";
-  Modelica.SIunits.Temperature T "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure P(start=1.e5) "Fluid average pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=100000)
+  Modelica.Units.SI.Position z "Fluid level";
+  Modelica.Units.SI.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P(start=1.e5) "Fluid average pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=100000)
     "Fluid average specific enthalpy";
-  Modelica.SIunits.Density rho(start=998) "Fluid density";
-  Modelica.SIunits.MassFlowRate BQ
+  Modelica.Units.SI.Density rho(start=998) "Fluid density";
+  Modelica.Units.SI.MassFlowRate BQ
     "Right hand side of the mass balance equation";
-  Modelica.SIunits.Power BH "Right hand side of the energy balance equation";
+  Modelica.Units.SI.Power BH "Right hand side of the energy balance equation";
   ThermoSysPro.Units.DifferentialPressure deltaP_e1 "Presure loss for e1";
   ThermoSysPro.Units.DifferentialPressure deltaP_e2 "Presure loss for e2";
   ThermoSysPro.Units.DifferentialPressure deltaP_s1 "Presure loss for s1";
@@ -59,10 +59,10 @@
   Real omega_e2;
   Real omega_s1;
   Real omega_s2;
-  Modelica.SIunits.Angle theta_e1;
-  Modelica.SIunits.Angle theta_e2;
-  Modelica.SIunits.Angle theta_s1;
-  Modelica.SIunits.Angle theta_s2;
+  Modelica.Units.SI.Angle theta_e1;
+  Modelica.Units.SI.Angle theta_e2;
+  Modelica.Units.SI.Angle theta_s1;
+  Modelica.Units.SI.Angle theta_s2;
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro
     "Water properties"
     annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/TwoPhaseCavity.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/TwoPhaseCavity.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/TwoPhaseCavity.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/TwoPhaseCavity.mo"	2022-03-10 09:58:19.992149446 +0000
@@ -1,14 +1,14 @@
-﻿within ThermoSysPro.WaterSteam.Volumes;
+within ThermoSysPro.WaterSteam.Volumes;
 model TwoPhaseCavity "TwoPhaseCavity for one shell pass "
   parameter Boolean Vertical=true
     "true: vertical cylinder - false: horizontal cylinder";
-  parameter Modelica.SIunits.Radius R=1.05
+  parameter Modelica.Units.SI.Radius R=1.05
     "Radius of the Cavity cross-sectional area";
-  parameter Modelica.SIunits.Length Lc=2.5
+  parameter Modelica.Units.SI.Length Lc=2.5
     "support plate spacing in cooling zone(Chicanes)";
-  parameter Modelica.SIunits.Volume V=50
+  parameter Modelica.Units.SI.Volume V=50
     "Cavity volume ( total volume + bleedings volume - pipes volume) ";
-  parameter Modelica.SIunits.Volume Vmin=1.e-6;
+  parameter Modelica.Units.SI.Volume Vmin=1.e-6;
   parameter Real Vf0=0.5
     "Fraction of initial water volume in the Cavity (active if steady_state=false)";
   parameter Integer Ns=10 "Number of segments for one tube pass";
@@ -17,19 +17,19 @@
   parameter Integer NbTub2=500 "Number of total pipes immersed in steam = NbTub2; Pipe 2";
   parameter Integer NbTub3=2000 "Number of total pipes immersed in steam ; Pipe 3";
   parameter Integer NbTubV=15 "Numbers of pipes in a vertical row (tube bank)";
-  parameter Modelica.SIunits.Length L1=10
+  parameter Modelica.Units.SI.Length L1=10
     " Length of drowned pipes in liquid (pipes 1)";
-  parameter Modelica.SIunits.Length L2=10 " Length of Pipe 2 (in steam)";
-  parameter Modelica.SIunits.Length L3=20 " Length of Pipe 3 (in steam)";
-  parameter Modelica.SIunits.Diameter Dext=0.02 "External pipe diameter";
-  parameter Modelica.SIunits.Diameter DIc=1.40 "Internal calendre diameter";
-  parameter Modelica.SIunits.Length PasL = 0.025
+  parameter Modelica.Units.SI.Length L2=10 " Length of Pipe 2 (in steam)";
+  parameter Modelica.Units.SI.Length L3=20 " Length of Pipe 3 (in steam)";
+  parameter Modelica.Units.SI.Diameter Dext=0.02 "External pipe diameter";
+  parameter Modelica.Units.SI.Diameter DIc=1.40 "Internal calendre diameter";
+  parameter Modelica.Units.SI.Length PasL = 0.025
     "Longitudianl step or Length bottom pipes triangular step";
-  parameter Modelica.SIunits.Length PasT = 0.023
+  parameter Modelica.Units.SI.Length PasT = 0.023
     " Transverse step or pipes step";
-  //parameter Modelica.SIunits.Angle Angle = 60 "Average bend angle (deg)";
+  //parameter Modelica.SIunits.Angle Angle = 60 "Average bend angle (deg)";
   parameter ThermoSysPro.Units.Angle_deg Angle = 60 "Average bend angle (deg)";
-  parameter Modelica.SIunits.Pressure P0=1e5
+  parameter Modelica.Units.SI.Pressure P0=1e5
     "Fluid initial pressure (active if steady_state=false)";
   parameter Real Ccond=0.01 "Condensation coefficient";
   parameter Real Cevap=0.09 "Evaporation coefficient";
@@ -37,8 +37,8 @@
     "Vapor mass fraction in the liquid phase from which the liquid starts to evaporate";
   parameter Real Xvo=0.9975
     "Vapor mass fraction in the gas phase from which the liquid starts to condensate";
-  //parameter Real Kvl=1000
-  // "Heat exchange coefficient between the liquid and gas phases";
+  //parameter Real Kvl=1000
+  // "Heat exchange coefficient between the liquid and gas phases";
   parameter Boolean steady_state=true
     "true: start from steady state - false: start from (P0, Vl0)";
   parameter Real COPv( start=1)= 1
@@ -47,125 +47,125 @@
     "Corrective terme for Heat exchange coefficient or Fouling coefficient liquid side";
   parameter Boolean Cal_hconv=true
     "false : heat transfer coefficient liquid and steam = parameter  - true: calculate by Nusselt corelation";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer hliq=1.5e3
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer hliq=1.5e3
     "Heat transfer coefficient between the liquid and the cooling pipes ";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer hcond=8e3
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer hcond=8e3
     "Heat transfer coefficient between the vapor and the cooling pipes ";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer Kvl=1000
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer Kvl=1000
     "Heat exchange coefficient between the liquid and gas phases";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer Klp=850
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer Klp=850
     "Heat exchange coefficient between the liquid phase and the wall";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer Kvp=450
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer Kvp=450
     "Heat exchange coefficient between the gas phase and the wall";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer Kpa=0.5
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer Kpa=0.5
     "Heat exchange coefficient between the wall and the outside ambiant";
-  parameter Modelica.SIunits.Temperature Ta = 310 "External temperature";
-  parameter Modelica.SIunits.Mass Mp=100e3 "Wall mass";
-  parameter Modelica.SIunits.SpecificHeatCapacity cpp=600 "Wall specific heat";
+  parameter Modelica.Units.SI.Temperature Ta = 310 "External temperature";
+  parameter Modelica.Units.SI.Mass Mp=100e3 "Wall mass";
+  parameter Modelica.Units.SI.SpecificHeatCapacity cpp=600 "Wall specific heat";
 
-//***********************************
+//***********************************
   parameter Boolean step_square=true
     "true: Aligned pipes   - false: staggered pipes (Step triangular)";
 
 //protected
-  constant Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  constant Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
   constant Real pi=Modelica.Constants.pi;
   parameter Integer Ns3=2*Ns "Number of segments for half pipes";
   //parameter Modelica.SIunits.PathLength Ls1=L1/Ns "Section length for one pass pipe";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer h4 = 1
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer h4 = 1
     "h4 = 1, Heat exchange coefficient";
-  parameter Modelica.SIunits.Area S4 = 1 " S4 = 1, Heat exchange surface  ";
+  parameter Modelica.Units.SI.Area S4 = 1 " S4 = 1, Heat exchange surface  ";
 
 public
-  Modelica.SIunits.Length L(start=15) "Cavity length";
+  Modelica.Units.SI.Length L(start=15) "Cavity length";
   Integer NbTubT "Number of total pipes in Cavity";
-  Modelica.SIunits.Pressure P "Fluid average pressure";
-  Modelica.SIunits.Pressure Pfond "Fluid pressure at the bottom of the cavity";
-  Modelica.SIunits.SpecificEnthalpy hl "Liquid phase spepcific enthalpy";
+  Modelica.Units.SI.Pressure P "Fluid average pressure";
+  Modelica.Units.SI.Pressure Pfond "Fluid pressure at the bottom of the cavity";
+  Modelica.Units.SI.SpecificEnthalpy hl "Liquid phase spepcific enthalpy";
   //Modelica.SIunits.SpecificEnthalpy hl0 "Liquid phase spepcific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy hv "Gas phase spepcific enthalpy";
-  Modelica.SIunits.Temperature Tl "Liquid phase temperature";
-  Modelica.SIunits.Temperature Tv "Gas phase temperature";
-  Modelica.SIunits.Volume Vl "Liquid phase volume";
-  Modelica.SIunits.Volume Vv "Gas phase volume";
+  Modelica.Units.SI.SpecificEnthalpy hv "Gas phase spepcific enthalpy";
+  Modelica.Units.SI.Temperature Tl "Liquid phase temperature";
+  Modelica.Units.SI.Temperature Tv "Gas phase temperature";
+  Modelica.Units.SI.Volume Vl "Liquid phase volume";
+  Modelica.Units.SI.Volume Vv "Gas phase volume";
 
   Real xl(start=0.5) "Mass vapor fraction in the liquid phase";
   Real xv(start=0) "Mass vapor fraction in the gas phase";
-  Modelica.SIunits.Density rhol(start=996) "Liquid phase density";
-  Modelica.SIunits.Density rhov(start=1.5) "Gas phase density";
-  Modelica.SIunits.MassFlowRate BQl
+  Modelica.Units.SI.Density rhol(start=996) "Liquid phase density";
+  Modelica.Units.SI.Density rhov(start=1.5) "Gas phase density";
+  Modelica.Units.SI.MassFlowRate BQl
     "Right hand side of the mass balance equation of the liquid phase";
-  Modelica.SIunits.MassFlowRate BQv
+  Modelica.Units.SI.MassFlowRate BQv
     "Right hand side of the mass balance equation of the gas phaser";
-  Modelica.SIunits.Power BHl
+  Modelica.Units.SI.Power BHl
     "Right hand side of the energy balance equation of the liquid phase";
-  Modelica.SIunits.Power BHv
+  Modelica.Units.SI.Power BHv
     "Right hand side of the energy balance equation of the gas phase";
-  Modelica.SIunits.MassFlowRate Qcond
+  Modelica.Units.SI.MassFlowRate Qcond
     "Condensation mass flow rate from the vapor phase";
-  Modelica.SIunits.MassFlowRate Qevap
+  Modelica.Units.SI.MassFlowRate Qevap
     "Evaporation mass flow rate from the liquid phase";
   Real QS "Surface mass flow rate of Water (kg/m2s)";
   //Real QSm "Surface mass flow rate maximal of Water (kg/m2s)";
 
-  Modelica.SIunits.Power dW1[Ns](start=fill(10e5, Ns))
+  Modelica.Units.SI.Power dW1[Ns](start=fill(10e5, Ns))
     "Power exchange between the wall and the fluid in each section side 1";
-  Modelica.SIunits.Power dW2[Ns](start=fill(10e5, Ns))
+  Modelica.Units.SI.Power dW2[Ns](start=fill(10e5, Ns))
     "Power exchange between the wall and the fluid in each section side 2";
-  Modelica.SIunits.Power dW3[Ns3](start=fill(10e5, Ns3))
+  Modelica.Units.SI.Power dW3[Ns3](start=fill(10e5, Ns3))
     "Power exchange between the wall and the fluid in each section side 3";
 
-  Modelica.SIunits.Power W1t "Total power exchanged on the steam side 1";
-  Modelica.SIunits.Power W2t "Total power exchanged on the water side 2";
-  Modelica.SIunits.Power W3t "Total power exchanged on the water side 3";
-  Modelica.SIunits.Power W4t "Total power exchanged on the steam side 4";
-  Modelica.SIunits.Power Wvl
+  Modelica.Units.SI.Power W1t "Total power exchanged on the steam side 1";
+  Modelica.Units.SI.Power W2t "Total power exchanged on the water side 2";
+  Modelica.Units.SI.Power W3t "Total power exchanged on the water side 3";
+  Modelica.Units.SI.Power W4t "Total power exchanged on the steam side 4";
+  Modelica.Units.SI.Power Wvl
     "Thermal power exchanged from the gas phase to the liquid phase";
-  Modelica.SIunits.Power Wpl
+  Modelica.Units.SI.Power Wpl
     "Thermal power exchanged from the liquid phase to the wall";
-  Modelica.SIunits.Power Wpv
+  Modelica.Units.SI.Power Wpv
     "Thermal power exchanged from the gas phase to the wall";
-  Modelica.SIunits.Power Wpa "Thermal power losses to ambiant";
-  Modelica.SIunits.Temperature Tp1[Ns](start=fill(400, Ns))
+  Modelica.Units.SI.Power Wpa "Thermal power losses to ambiant";
+  Modelica.Units.SI.Temperature Tp1[Ns](start=fill(400, Ns))
     "Wall temperature in section i of side 1";
-  Modelica.SIunits.Temperature Tp2[Ns](start=fill(400, Ns))
+  Modelica.Units.SI.Temperature Tp2[Ns](start=fill(400, Ns))
     "Wall temperature in section i of side 2";
-  Modelica.SIunits.Temperature Tp3[Ns3](start=fill(400, Ns3))
+  Modelica.Units.SI.Temperature Tp3[Ns3](start=fill(400, Ns3))
     "Wall temperature in section i of side 3";
-  Modelica.SIunits.Temperature Tp( start= 400) "Wall temperature of cavity";
-  Modelica.SIunits.Position zl(start=1.05) "Liquid level in Cavity";
-  Modelica.SIunits.Area Al(start=5) "Cross sectional area of the liquid phase";
-  Modelica.SIunits.Angle theta "Angle";
-  Modelica.SIunits.Area Avl(start=5)
+  Modelica.Units.SI.Temperature Tp( start= 400) "Wall temperature of cavity";
+  Modelica.Units.SI.Position zl(start=1.05) "Liquid level in Cavity";
+  Modelica.Units.SI.Area Al(start=5) "Cross sectional area of the liquid phase";
+  Modelica.Units.SI.Angle theta "Angle";
+  Modelica.Units.SI.Area Avl(start=5)
     "Heat exchange surface between the liquid and gas phases";
-  Modelica.SIunits.Area Alp "Liquid phase surface on contact with the wall";
-  Modelica.SIunits.Area Avp "Gas phase surface on contact with the wall";
-  Modelica.SIunits.Area Ape "Wall surface on contact with the fluid";
-  Modelica.SIunits.Area Surf_tot( start= 1.e4) "Total heat exchange surface";
-  Modelica.SIunits.Area Surf_ext1( start= 1.e2)
+  Modelica.Units.SI.Area Alp "Liquid phase surface on contact with the wall";
+  Modelica.Units.SI.Area Avp "Gas phase surface on contact with the wall";
+  Modelica.Units.SI.Area Ape "Wall surface on contact with the fluid";
+  Modelica.Units.SI.Area Surf_tot( start= 1.e4) "Total heat exchange surface";
+  Modelica.Units.SI.Area Surf_ext1( start= 1.e2)
     "Heat exchange surface for drowned section ; pipe 1";
-  Modelica.SIunits.Area Surf_ext2( start= 1.e2)
+  Modelica.Units.SI.Area Surf_ext2( start= 1.e2)
     "Heat exchange surface for section 2 ; pipe 2 ";
-  Modelica.SIunits.Area Surf_ext3( start= 1.e2)
+  Modelica.Units.SI.Area Surf_ext3( start= 1.e2)
     "Heat exchange surface for section 3 ; pipe 3";
   //Modelica.SIunits.ReynoldsNumber Rel (start= 6.e4)  "liquid Reynolds number";
-  Modelica.SIunits.ReynoldsNumber Rel( start= 6.e4) "liquid Reynolds number";
-  // Modelica.SIunits.ReynoldsNumber Rev( start= 6.e3) "Steam Reynolds number";
+  Modelica.Units.SI.ReynoldsNumber Rel( start= 6.e4) "liquid Reynolds number";
+  // Modelica.SIunits.ReynoldsNumber Rev( start= 6.e3) "Steam Reynolds number";
   Real Prl(start=1) "liquid Prandtl number in node i";
-  Modelica.SIunits.ThermalConductivity kl(start=1)
+  Modelica.Units.SI.ThermalConductivity kl(start=1)
     "liquid thermal conductivity";
-  Modelica.SIunits.DynamicViscosity mul(start=2.e-4)
+  Modelica.Units.SI.DynamicViscosity mul(start=2.e-4)
     "liquid dynamic viscosity ";
-  Modelica.SIunits.DynamicViscosity mult[Ns](start=fill(2.e-4, Ns))
+  Modelica.Units.SI.DynamicViscosity mult[Ns](start=fill(2.e-4, Ns))
     "liquid dynamic viscosity at wall temperature";
-  Modelica.SIunits.CoefficientOfHeatTransfer hcond2[Ns](start=fill(1e4, Ns))
+  Modelica.Units.SI.CoefficientOfHeatTransfer hcond2[Ns](start=fill(1e4, Ns))
     "Heat transfer coefficient between the vapor and the cooling pipes zone 2";
-  Modelica.SIunits.CoefficientOfHeatTransfer hcond3[Ns3](start=fill(1e4, Ns3))
+  Modelica.Units.SI.CoefficientOfHeatTransfer hcond3[Ns3](start=fill(1e4, Ns3))
     "Heat transfer coefficient between the vapor and the cooling pipes zone 3";
-  Modelica.SIunits.CoefficientOfHeatTransfer hliqu[Ns](start=fill(1000, Ns))
+  Modelica.Units.SI.CoefficientOfHeatTransfer hliqu[Ns](start=fill(1000, Ns))
     "Heat transfer coefficient between the liquid and the cooling pipes zone 1";
-  Modelica.SIunits.Diameter DH(start=0.02) "hydraulic diameter";
+  Modelica.Units.SI.Diameter DH(start=0.02) "hydraulic diameter";
   Real EE[Ns](start=fill(1, Ns));
 
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prol
@@ -341,9 +341,9 @@
   Qevap = if (xl > Xlo) then Cevap*rhol*Vl*(xl - Xlo) else 0;
 
   /* Fluid thermodynamic properties */
-  proe = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(P, Ce.h, 0);
-  //prol = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(P, hl, 0);
-  prol = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph((P+Pfond)/2, hl, 0);
+  proe = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(P, Ce.h, 0);
+//prol = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(P, hl, 0);
+  prol = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph((P + Pfond) / 2, hl, 0);
   provIn = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(P, Cv.h, 0);
   prov = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(P, hv, 0);
   prod = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(Pfond, Cl.h, 0);
@@ -358,89 +358,77 @@
   xv = prov.x;
 
   mul = ThermoSysPro.Properties.WaterSteam.IF97.DynamicViscosity_rhoT(rhol, Tl);
-  kl = noEvent(ThermoSysPro.Properties.WaterSteam.IF97.ThermalConductivity_rhoT(rhol, Tl,P, 0));
-
-  /* Heat transfer coefficient of fluid
+  kl = noEvent(ThermoSysPro.Properties.WaterSteam.IF97.ThermalConductivity_rhoT(rhol, Tl,P, 0));
+/* Heat transfer coefficient of fluid
                    And
      Power exchanged for each section
-    ----------------------------------*/
-  /* Heat transfer coefficient of liquid*/
-  //SACADOURA
-  DH= if step_square then 4*PasL^2/(pi*Dext) - Dext else ( (2*PasL*PasT) - (pi*Dext^2*(Angle/120)))/(pi*Dext*(Angle/120));
+    ----------------------------------*/
+/* Heat transfer coefficient of liquid*/
+//SACADOURA
+  DH = if step_square then 4 * PasL ^ 2 / (pi * Dext) - Dext else (2 * PasL * PasT - pi * Dext ^ 2 * (Angle / 120)) / (pi * Dext * (Angle / 120));
 
   QS = Cl.Q /(DIc*Lc*(PasL - Dext)/PasL);
 
   Rel = noEvent( abs(QS*DH/mul));
   Prl = mul*prol.cp/kl;
 
-  assert( (PasL - Dext) > 0,  "Error Data for TwoPhaseCavity model (PasL - Dext)<=0 ");
-
-  for i in 1:Ns loop
-
-    mult[i] = ThermoSysPro.Properties.WaterSteam.IF97.DynamicViscosity_rhoT(rhol, Tp1[i]);
-
-    EE[i]= max( (PasT/Dext-1/2/((((PasL/Dext)^2 + (PasT/Dext/2)^2)^0.5/Dext)-1)),1);
-
-    /* Heat transfer coefficient of liquid*/
-    if Cal_hconv then
-       // Kern corelation (SACADOURA)
-       hliqu[i] = noEvent(if ((Rel > 1.e-6) and (Prl > 1.e-6)) then (COPl * 0.36*kl/Dext *Rel^0.55 *Prl^0.3333 *(mul/mult[i])^0.14) else  10);
-    else
-       hliqu[i] = COPl * hliq;
-    end if;
-
-    if Cal_hconv then
-       /* Heat transfer coefficient of vapeur*/
-       if Vertical then
-         // Frank P. & David P. Fundamentals of Heat Transfer  For (PasL/Dext)= 1.4
-         hcond2[i]  = COPv * noEvent( min( 1.13*( max( (g*lsat.rho*(lsat.rho - vsat.rho)*kl^3*(vsat.h -lsat.h))/(max(L2,1)*mul*abs(lsat.T-Tp2[i]+1e-6)),2.225e15))^0.25, 20000));
-       else
-         // Nusselt corelation
-         //******************
-         hcond2[i]  =  COPv * noEvent( min( 0.728*( max( (g*lsat.rho*(lsat.rho - vsat.rho)*kl^3*(vsat.h -lsat.h))/(NbTubV*mul*Dext*abs(lsat.T-Tp2[i]+1e-6)),2.225e15))^0.25, 20000));
-       end if;
-    else
-       hcond2[i] = COPv * hcond;
-    end if;
-
-    /* Power exchanged for each section zone 1*/
-    if (noEvent( abs(dW1[i]) < 0.1)) then
-       dW1[i] = - h4*S4*(Tv - Tp1[i]);
-    else
-       dW1[i] = - hliqu[i]*Surf_ext1 *((Tv+Tl)/2 - (Tp1[1]+Tp1[Ns])/2);
-    end if;
-
-    /* Power exchanged for each section zone 2*/
-    if (noEvent( abs(dW2[i]) < 0.1)) then
-       dW2[i] = - h4*S4*(Tv - Tp2[i]);
-    else
-       dW2[i] = - hcond2[i]*Surf_ext2*(Tv - Tp2[i]);
-    end if;
-
-  end for;
-
-  for i in 1:Ns3 loop
-    if Cal_hconv then
-       /* Heat transfer coefficient of vapeur*/
-       if Vertical then
-          // Frank P. & David P. Fundamentals of Heat Transfer  For vertical plate
-          hcond3[i]  = COPv * noEvent( min( 1.13*( max( (g*lsat.rho*(lsat.rho - vsat.rho)*kl^3*(vsat.h -lsat.h))/(max(L3,1)*mul*abs(lsat.T-Tp3[i]+1e-6)), 2.225e15))^0.25, 20000));
-       else
-          // Nusselt corelation
-          //******************
-          hcond3[i]  =  COPv * noEvent( min( 0.728*( max( (g*lsat.rho*(lsat.rho - vsat.rho)*kl^3*(vsat.h -lsat.h))/(NbTubV*mul*Dext*abs(lsat.T-Tp3[i]+1e-6)), 2.225e15))^0.25, 20000));
-       end if;
-    else
-       hcond3[i] = COPv * hcond;
-    end if;
-
-    /* Power exchanged for each section  zone 3 + power exchanged for Deheating*/
-    if (noEvent( abs(dW3[i]) < 0.1)) then
-       dW3[i] = - h4*S4*(Tv - Tp3[i]);
-    else
-       dW3[i] = - hcond3[i]*Surf_ext3*(Tv - Tp3[i]) + W4t/Ns3;
-    end if;
-
+  assert( (PasL - Dext) > 0,  "Error Data for TwoPhaseCavity model (PasL - Dext)<=0 ");
+  for i in 1:Ns loop
+    mult[i] = ThermoSysPro.Properties.WaterSteam.IF97.DynamicViscosity_rhoT(rhol, Tp1[i]);
+    EE[i] = max(PasT / Dext - 1 / 2 / (((PasL / Dext) ^ 2 + (PasT / Dext / 2) ^ 2) ^ 0.5 / Dext - 1), 1);
+/* Heat transfer coefficient of liquid*/
+    if Cal_hconv then
+// Kern corelation (SACADOURA)
+      hliqu[i] = noEvent(if Rel > 1.e-6 and Prl > 1.e-6 then COPl * 0.36 * kl / Dext * Rel ^ 0.55 * Prl ^ 0.3333 * (mul / mult[i]) ^ 0.14 else 10);
+    else
+      hliqu[i] = COPl * hliq;
+    end if;
+    if Cal_hconv then
+/* Heat transfer coefficient of vapeur*/
+      if Vertical then
+// Frank P. & David P. Fundamentals of Heat Transfer  For (PasL/Dext)= 1.4
+        hcond2[i] = COPv * noEvent(min(1.13 * max(g * lsat.rho * (lsat.rho - vsat.rho) * kl ^ 3 * (vsat.h - lsat.h) / (max(L2, 1) * mul * abs(lsat.T - Tp2[i] + 1e-6)), 2.225e15) ^ 0.25, 20000));
+      else
+// Nusselt corelation
+//******************
+        hcond2[i] = COPv * noEvent(min(0.728 * max(g * lsat.rho * (lsat.rho - vsat.rho) * kl ^ 3 * (vsat.h - lsat.h) / (NbTubV * mul * Dext * abs(lsat.T - Tp2[i] + 1e-6)), 2.225e15) ^ 0.25, 20000));
+      end if;
+    else
+      hcond2[i] = COPv * hcond;
+    end if;
+/* Power exchanged for each section zone 1*/
+    if noEvent(abs(dW1[i]) < 0.1) then
+      dW1[i] = -h4 * S4 * (Tv - Tp1[i]);
+    else
+      dW1[i] = -hliqu[i] * Surf_ext1 * ((Tv + Tl) / 2 - (Tp1[1] + Tp1[Ns]) / 2);
+    end if;
+/* Power exchanged for each section zone 2*/
+    if noEvent(abs(dW2[i]) < 0.1) then
+      dW2[i] = -h4 * S4 * (Tv - Tp2[i]);
+    else
+      dW2[i] = -hcond2[i] * Surf_ext2 * (Tv - Tp2[i]);
+    end if;
+  end for;
+  for i in 1:Ns3 loop
+    if Cal_hconv then
+/* Heat transfer coefficient of vapeur*/
+      if Vertical then
+// Frank P. & David P. Fundamentals of Heat Transfer  For vertical plate
+        hcond3[i] = COPv * noEvent(min(1.13 * max(g * lsat.rho * (lsat.rho - vsat.rho) * kl ^ 3 * (vsat.h - lsat.h) / (max(L3, 1) * mul * abs(lsat.T - Tp3[i] + 1e-6)), 2.225e15) ^ 0.25, 20000));
+      else
+// Nusselt corelation
+//******************
+        hcond3[i] = COPv * noEvent(min(0.728 * max(g * lsat.rho * (lsat.rho - vsat.rho) * kl ^ 3 * (vsat.h - lsat.h) / (NbTubV * mul * Dext * abs(lsat.T - Tp3[i] + 1e-6)), 2.225e15) ^ 0.25, 20000));
+      end if;
+    else
+      hcond3[i] = COPv * hcond;
+    end if;
+/* Power exchanged for each section  zone 3 + power exchanged for Deheating*/
+    if noEvent(abs(dW3[i]) < 0.1) then
+      dW3[i] = -h4 * S4 * (Tv - Tp3[i]);
+    else
+      dW3[i] = (-hcond3[i] * Surf_ext3 * (Tv - Tp3[i])) + W4t / Ns3;
+    end if;
   end for;
 
   W1t = sum(dW1);
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/TwoPhaseCavityOnePipe.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/TwoPhaseCavityOnePipe.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/TwoPhaseCavityOnePipe.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/TwoPhaseCavityOnePipe.mo"	2022-03-10 09:58:19.508149385 +0000
@@ -1,23 +1,23 @@
-﻿within ThermoSysPro.WaterSteam.Volumes;
+within ThermoSysPro.WaterSteam.Volumes;
 model TwoPhaseCavityOnePipe "TwoPhaseCavity for one shell pass "
 
   parameter Boolean Vertical=true
     "true: vertical cylinder - false: horizontal cylinder";
-  parameter Modelica.SIunits.Radius R=1.05
+  parameter Modelica.Units.SI.Radius R=1.05
     "Radius of the Cavity cross-sectional area";
-  parameter Modelica.SIunits.Length L=16.27 "Cavity length";
-  parameter Modelica.SIunits.Length Lc=2.5
+  parameter Modelica.Units.SI.Length L=16.27 "Cavity length";
+  parameter Modelica.Units.SI.Length Lc=2.5
     "support plate spacing in cooling zone(Chicanes)";
-  parameter Modelica.SIunits.Volume V=pi*R^2*L "Cavity volume";
-  parameter Modelica.SIunits.Volume Vmin=1.e-6;
+  parameter Modelica.Units.SI.Volume V=pi*R^2*L "Cavity volume";
+  parameter Modelica.Units.SI.Volume Vmin=1.e-6;
   parameter Real Vf0=0.5
     "Fraction of initial water volume in the Cavity (active if steady_state=false)";
   parameter Integer Ns=10 "Number of segments";
   parameter Integer NbTubT=10000 "Number of total pipes in Cavity";
   parameter Integer NbTubV=150 "Numbers of pipes in a vertical plan in Cavity";
-  parameter Modelica.SIunits.Length L2=25 "tubes length";
-  parameter Modelica.SIunits.Diameter Dext=0.020 "External pipe diameter";
-  parameter Modelica.SIunits.Pressure P0=1e5
+  parameter Modelica.Units.SI.Length L2=25 "tubes length";
+  parameter Modelica.Units.SI.Diameter Dext=0.020 "External pipe diameter";
+  parameter Modelica.Units.SI.Pressure P0=1e5
     "Fluid initial pressure (active if steady_state=false)";
   parameter Boolean steady_state=true
     "true: start from steady state - false: start from (P0, Vl0)";
@@ -27,95 +27,95 @@
     "Corrective terme for heat exchange coefficient between the vapor and the liquid Kvl (with a stagnation point Kcorr = 0.5)";
   parameter Boolean Cal_hcond=false
     "false : Condensation heat transfer coefficient = hcond (parameter) - true: calculate by Nusselt corelation";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer hcond=8e3
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer hcond=8e3
     "Heat transfer coefficient between the vapor and the cooling pipes ";
-  parameter Modelica.SIunits.CoefficientOfHeatTransfer Kpa=0.02
+  parameter Modelica.Units.SI.CoefficientOfHeatTransfer Kpa=0.02
     "Heat exchange coefficient between the wall and the outside ambiant";
-  parameter Modelica.SIunits.Temperature Ta = 300 "External temperature";
-  parameter Modelica.SIunits.Mass Mp=50e3 "Wall mass";
-  parameter Modelica.SIunits.SpecificHeatCapacity cpp=600 "Wall specific heat";
+  parameter Modelica.Units.SI.Temperature Ta = 300 "External temperature";
+  parameter Modelica.Units.SI.Mass Mp=50e3 "Wall mass";
+  parameter Modelica.Units.SI.SpecificHeatCapacity cpp=600 "Wall specific heat";
   parameter Boolean step_square=true
     "true: Step square  - false: Step triangular";
-  parameter Modelica.SIunits.PathLength Ls=L2/Ns "Section length for pipe";
-  parameter Modelica.SIunits.Area Surf_exe=pi*Dext*Ls*NbTubT
+  parameter Modelica.Units.SI.PathLength Ls=L2/Ns "Section length for pipe";
+  parameter Modelica.Units.SI.Area Surf_exe=pi*Dext*Ls*NbTubT
     "Section heat exchange surface";
-  parameter Modelica.SIunits.Area Surf_tot=Surf_exe*Ns
+  parameter Modelica.Units.SI.Area Surf_tot=Surf_exe*Ns
     "Total heat exchange surface";
 
 protected
-  constant Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  constant Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
   constant Real pi=Modelica.Constants.pi;
 
 public
-  Modelica.SIunits.Pressure P(start=10000) "Fluid average pressure";
-  Modelica.SIunits.Pressure Pfond( start=11000)
+  Modelica.Units.SI.Pressure P(start=10000) "Fluid average pressure";
+  Modelica.Units.SI.Pressure Pfond( start=11000)
     "Fluid pressure at the bottom of the cavity";
-  Modelica.SIunits.SpecificEnthalpy hl(start=200e3)
+  Modelica.Units.SI.SpecificEnthalpy hl(start=200e3)
     "Liquid phase spepcific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy hv(start=250e3)
+  Modelica.Units.SI.SpecificEnthalpy hv(start=250e3)
     "Gas phase spepcific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy hvIn(start=2400000)
+  Modelica.Units.SI.SpecificEnthalpy hvIn(start=2400000)
     "Steam average spepcific enthalpy input cavity";
-  Modelica.SIunits.Temperature Tl(start=310) "Liquid phase temperature";
-  Modelica.SIunits.Temperature Tv(start=320) "Gas phase temperature";
-  Modelica.SIunits.Volume Vl(start=100) "Liquid phase volume";
-  Modelica.SIunits.Volume Vv(start=2000) "Gas phase volume";
+  Modelica.Units.SI.Temperature Tl(start=310) "Liquid phase temperature";
+  Modelica.Units.SI.Temperature Tv(start=320) "Gas phase temperature";
+  Modelica.Units.SI.Volume Vl(start=100) "Liquid phase volume";
+  Modelica.Units.SI.Volume Vv(start=2000) "Gas phase volume";
   Real xl(start=0.5) "Mass vapor fraction in the liquid phase";
   Real xv(start=0) "Mass vapor fraction in the gas phase";
-  Modelica.SIunits.Density rhol(start=996) "Liquid phase density";
-  Modelica.SIunits.Density rhov(start=1.5) "Gas phase density";
-  Modelica.SIunits.MassFlowRate BQl
+  Modelica.Units.SI.Density rhol(start=996) "Liquid phase density";
+  Modelica.Units.SI.Density rhov(start=1.5) "Gas phase density";
+  Modelica.Units.SI.MassFlowRate BQl
     "Right hand side of the mass balance equation of the liquid phase";
-  Modelica.SIunits.MassFlowRate BQv
+  Modelica.Units.SI.MassFlowRate BQv
     "Right hand side of the mass balance equation of the gas phaser";
-  Modelica.SIunits.Power BHl
+  Modelica.Units.SI.Power BHl
     "Right hand side of the energy balance equation of the liquid phase";
-  Modelica.SIunits.Power BHv
+  Modelica.Units.SI.Power BHv
     "Right hand side of the energy balance equation of the gas phase";
-  Modelica.SIunits.MassFlowRate Qcond(start=1000)
+  Modelica.Units.SI.MassFlowRate Qcond(start=1000)
     "Condensation mass flow rate from the vapor phase";
-  Modelica.SIunits.MassFlowRate QcondS(start=100)
+  Modelica.Units.SI.MassFlowRate QcondS(start=100)
     " Splitter mass flow rate of the liquid phase from the input two phases";
-  Modelica.SIunits.Power Wvl
+  Modelica.Units.SI.Power Wvl
     "Thermal power exchanged from the gas phase to the liquid phase";
-  Modelica.SIunits.Power Wlp
+  Modelica.Units.SI.Power Wlp
     "Thermal power exchanged from the liquid phase to the wall";
-  Modelica.SIunits.Power Wvp
+  Modelica.Units.SI.Power Wvp
     "Thermal power exchanged from the gas phase to the wall";
-  Modelica.SIunits.Power Wpa "Thermal power losses to ambiant";
-  Modelica.SIunits.Power dW[Ns](start=fill(10e5, Ns))
+  Modelica.Units.SI.Power Wpa "Thermal power losses to ambiant";
+  Modelica.Units.SI.Power dW[Ns](start=fill(10e5, Ns))
     "Power exchange between the wall and the fluid in each section side 3";
-  Modelica.SIunits.Power Wt "Total power exchanged on the water side 3";
-  Modelica.SIunits.Power Wt2( start= 0) "Total power exchanged Deheating zone";
-  Modelica.SIunits.Temperature Tp1[Ns](start=fill(320, Ns))
+  Modelica.Units.SI.Power Wt "Total power exchanged on the water side 3";
+  Modelica.Units.SI.Power Wt2( start= 0) "Total power exchanged Deheating zone";
+  Modelica.Units.SI.Temperature Tp1[Ns](start=fill(320, Ns))
     "Wall temperature in section i of side 1";
-  Modelica.SIunits.Temperature Tp(start= 320) "Wall temperature of cavity";
-  Modelica.SIunits.Position zl(start=1.05) "Liquid level in Cavity";
-  Modelica.SIunits.Area Al "Cross sectional area of the liquid phase";
-  Modelica.SIunits.Angle theta "Angle";
-  Modelica.SIunits.Area Avl(start=1.0)
+  Modelica.Units.SI.Temperature Tp(start= 320) "Wall temperature of cavity";
+  Modelica.Units.SI.Position zl(start=1.05) "Liquid level in Cavity";
+  Modelica.Units.SI.Area Al "Cross sectional area of the liquid phase";
+  Modelica.Units.SI.Angle theta "Angle";
+  Modelica.Units.SI.Area Avl(start=1.0)
     "Heat exchange surface between the liquid and gas phases";
-  Modelica.SIunits.Area Alp "Liquid phase surface on contact with the wall";
-  Modelica.SIunits.Area Avp "Gas phase surface on contact with the wall";
-  Modelica.SIunits.Area Ape "Wall surface on contact with the outside";
-  Modelica.SIunits.ReynoldsNumber Rel(start= 6.e4) "liquid Reynolds number";
-  Modelica.SIunits.ReynoldsNumber Rev(start= 6.e3) "Steam Reynolds number";
-  Modelica.SIunits.ReynoldsNumber Revl(start= 6.e3)
+  Modelica.Units.SI.Area Alp "Liquid phase surface on contact with the wall";
+  Modelica.Units.SI.Area Avp "Gas phase surface on contact with the wall";
+  Modelica.Units.SI.Area Ape "Wall surface on contact with the outside";
+  Modelica.Units.SI.ReynoldsNumber Rel(start= 6.e4) "liquid Reynolds number";
+  Modelica.Units.SI.ReynoldsNumber Rev(start= 6.e3) "Steam Reynolds number";
+  Modelica.Units.SI.ReynoldsNumber Revl(start= 6.e3)
     "Steam liquid Reynolds number";
-  Modelica.SIunits.ThermalConductivity kl(start=1)
+  Modelica.Units.SI.ThermalConductivity kl(start=1)
     "liquid thermal conductivity";
-  Modelica.SIunits.ThermalConductivity kv(start=1) "steam thermal conductivity";
-  Modelica.SIunits.DynamicViscosity mul(start=2.e-4)
+  Modelica.Units.SI.ThermalConductivity kv(start=1) "steam thermal conductivity";
+  Modelica.Units.SI.DynamicViscosity mul(start=2.e-4)
     "liquid dynamic viscosity ";
-  Modelica.SIunits.DynamicViscosity muv(start=2.e-5) "steam dynamic viscosity ";
-  Modelica.SIunits.CoefficientOfHeatTransfer hcond3[Ns](start=fill(1e4, Ns))
+  Modelica.Units.SI.DynamicViscosity muv(start=2.e-5) "steam dynamic viscosity ";
+  Modelica.Units.SI.CoefficientOfHeatTransfer hcond3[Ns](start=fill(1e4, Ns))
     "Heat transfer coefficient between the vapor and the cooling pipes 2";
-  Modelica.SIunits.CoefficientOfHeatTransfer Kvl(start=10)
+  Modelica.Units.SI.CoefficientOfHeatTransfer Kvl(start=10)
     "Heat exchange coefficient between the liquid and gas phases";
-  Modelica.SIunits.CoefficientOfHeatTransfer Klp(start=10)
+  Modelica.Units.SI.CoefficientOfHeatTransfer Klp(start=10)
     "Heat exchange coefficient between the liquid phase and the wall";
-  Modelica.SIunits.CoefficientOfHeatTransfer Kvp(start=10)
+  Modelica.Units.SI.CoefficientOfHeatTransfer Kvp(start=10)
     "Heat exchange coefficient between the gas phase and the wall";
 
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prol
@@ -162,8 +162,8 @@
   if steady_state then
     der(hl) = 0;
     der(hv) = 0;
-    Vl = Vf0*V;    // Without liquid level control
-    //der(Vl) = 0; // With liquid level control
+    Vl = Vf0*V;    // Without liquid level control
+//der(Vl) = 0; // With liquid level control
     der(P) = 0;
     der(Tp) = 0;
   else
@@ -329,7 +329,7 @@
   for i in 1:Ns loop
     /* Heat transfer coefficient of liquid*/
     if Cal_hcond then
-       // Nusselt corelation
+// Nusselt corelation
        hcond3[i] = ThermoSysPro.Functions.SmoothCond((Tv-Tp1[i]), COP*0.728*((g*rhol*(rhol - rhov)*kl^3*(vsat.h -lsat.h))/(NbTubV*mul*Dext*ThermoSysPro.Functions.SmoothMax((Tv-Tp1[i]),0.1)))^0.25,
                                                     COP*0.728*((g*rhol*(rhol - rhov)*kl^3*(vsat.h -lsat.h))/(NbTubV*mul*Dext*0.1))^0.25);
     else
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/TwoPhaseVolume.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/TwoPhaseVolume.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/TwoPhaseVolume.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/TwoPhaseVolume.mo"	2022-03-10 09:58:19.364149368 +0000
@@ -1,10 +1,10 @@
-﻿within ThermoSysPro.WaterSteam.Volumes;
+within ThermoSysPro.WaterSteam.Volumes;
 model TwoPhaseVolume "TwoPhaseVolume"
-  parameter Modelica.SIunits.Volume V=1 "Cavity volume";
-  parameter Modelica.SIunits.Area A=1 "Cavity cross-sectional area";
+  parameter Modelica.Units.SI.Volume V=1 "Cavity volume";
+  parameter Modelica.Units.SI.Area A=1 "Cavity cross-sectional area";
   parameter Real Vf0=0.5
     "Fraction of initial water volume in the drum (active if steady_state=false)";
-  parameter Modelica.SIunits.AbsolutePressure P0=0.1e5
+  parameter Modelica.Units.SI.AbsolutePressure P0=0.1e5
     "Fluid initial pressure (active if steady_state=false)";
   parameter Real Ccond=0.01 "Condensation coefficient";
   parameter Real Cevap=0.09 "Evaporation coefficient";
@@ -12,7 +12,7 @@
     "Vapor mass fraction in the liquid phase from which the liquid starts to evaporate";
   parameter Real Xvo=0.9975
     "Vapor mass fraction in the gas phase from which the liquid starts to condensate";
-  parameter Modelica.SIunits.Area Avl=A
+  parameter Modelica.Units.SI.Area Avl=A
     "Heat exchange surface between the liquid and gas phases";
   parameter Real Kvl=1000
     "Heat exchange coefficient between the liquid and gas phases";
@@ -20,36 +20,36 @@
     "true: start from steady state - false: start from (P0, Vl0)";
 
 protected
-  constant Modelica.SIunits.Acceleration g=Modelica.Constants.g_n
+  constant Modelica.Units.SI.Acceleration g=Modelica.Constants.g_n
     "Gravity constant";
 
 public
-  Modelica.SIunits.AbsolutePressure P "Fluid average pressure";
-  Modelica.SIunits.AbsolutePressure Pfond
+  Modelica.Units.SI.AbsolutePressure P "Fluid average pressure";
+  Modelica.Units.SI.AbsolutePressure Pfond
     "Fluid pressure at the bottom of the cavity";
-  Modelica.SIunits.SpecificEnthalpy hl "Liquid phase spepcific enthalpy";
-  Modelica.SIunits.SpecificEnthalpy hv "Gas phase spepcific enthalpy";
-  Modelica.SIunits.Temperature Tl "Liquid phase temperature";
-  Modelica.SIunits.Temperature Tv "Gas phase temperature";
-  Modelica.SIunits.Volume Vl "Liquid phase volume";
-  Modelica.SIunits.Volume Vv "Gas phase volume";
+  Modelica.Units.SI.SpecificEnthalpy hl "Liquid phase spepcific enthalpy";
+  Modelica.Units.SI.SpecificEnthalpy hv "Gas phase spepcific enthalpy";
+  Modelica.Units.SI.Temperature Tl "Liquid phase temperature";
+  Modelica.Units.SI.Temperature Tv "Gas phase temperature";
+  Modelica.Units.SI.Volume Vl "Liquid phase volume";
+  Modelica.Units.SI.Volume Vv "Gas phase volume";
   Real xl(start=0.5) "Mass vapor fraction in the liquid phase";
   Real xv(start=0) "Mass vapor fraction in the gas phase";
-  Modelica.SIunits.Density rhol(start=996) "Liquid phase density";
-  Modelica.SIunits.Density rhov(start=1.5) "Gas phase density";
-  Modelica.SIunits.MassFlowRate BQl
+  Modelica.Units.SI.Density rhol(start=996) "Liquid phase density";
+  Modelica.Units.SI.Density rhov(start=1.5) "Gas phase density";
+  Modelica.Units.SI.MassFlowRate BQl
     "Right hand side of the mass balance equation of the liquid phase";
-  Modelica.SIunits.MassFlowRate BQv
+  Modelica.Units.SI.MassFlowRate BQv
     "Right hand side of the mass balance equation of the gas phaser";
-  Modelica.SIunits.Power BHl
+  Modelica.Units.SI.Power BHl
     "Right hand side of the energy balance equation of the liquid phase";
-  Modelica.SIunits.Power BHv
+  Modelica.Units.SI.Power BHv
     "Right hand side of the energy balance equation of the gas phase";
-  Modelica.SIunits.MassFlowRate Qcond
+  Modelica.Units.SI.MassFlowRate Qcond
     "Condensation mass flow rate from the vapor phase";
-  Modelica.SIunits.MassFlowRate Qevap
+  Modelica.Units.SI.MassFlowRate Qevap
     "Evaporation mass flow rate from the liquid phase";
-  Modelica.SIunits.Power Wvl
+  Modelica.Units.SI.Power Wvl
     "Thermal power exchanged from the gas phase to the liquid phase";
 
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prol
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeA.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeA.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeA.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeA.mo"	2022-03-10 09:58:19.332149364 +0000
@@ -1,27 +1,27 @@
-﻿within ThermoSysPro.WaterSteam.Volumes;
+within ThermoSysPro.WaterSteam.Volumes;
 model VolumeA "Mixing volume with 2 inlets and 2 outlets"
-  parameter Modelica.SIunits.Volume V=1 "Volume";
-  parameter Modelica.SIunits.AbsolutePressure P0=1e5
+  parameter Modelica.Units.SI.Volume V=1 "Volume";
+  parameter Modelica.Units.SI.AbsolutePressure P0=1e5
     "Initial fluid pressure (active if dynamic_mass_balance=true and steady_state=false)";
-  parameter Modelica.SIunits.SpecificEnthalpy h0=1e5
+  parameter Modelica.Units.SI.SpecificEnthalpy h0=1e5
     "Initial fluid specific enthalpy (active if steady_state=false)";
   parameter Boolean dynamic_mass_balance=false
     "true: dynamic mass balance equation - false: static mass balance equation";
   parameter Boolean steady_state=true
     "true: start from steady state - false: start from (P0, h0)";
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 public
-  Modelica.SIunits.Temperature T "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure P(start=1.e5) "Fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
-  Modelica.SIunits.Density rho(start=998) "Fluid density";
-  Modelica.SIunits.MassFlowRate BQ
+  Modelica.Units.SI.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P(start=1.e5) "Fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
+  Modelica.Units.SI.Density rho(start=998) "Fluid density";
+  Modelica.Units.SI.MassFlowRate BQ
     "Right hand side of the mass balance equation";
-  Modelica.SIunits.Power BH "Right hand side of the energybalance equation";
+  Modelica.Units.SI.Power BH "Right hand side of the energybalance equation";
 public
   Connectors.FluidInlet Ce1
                            annotation (Placement(transformation(extent={{-110,
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeATh.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeATh.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeATh.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeATh.mo"	2022-03-10 09:58:19.304149359 +0000
@@ -1,27 +1,27 @@
 within ThermoSysPro.WaterSteam.Volumes;
 model VolumeATh "Mixing volume with 2 inlets and 2 outlets and thermal input"
-  parameter Modelica.SIunits.Volume V=1 "Volume";
-  parameter Modelica.SIunits.AbsolutePressure P0=1e5
+  parameter Modelica.Units.SI.Volume V=1 "Volume";
+  parameter Modelica.Units.SI.AbsolutePressure P0=1e5
     "Initial fluid pressure (active if dynamic_mass_balance=true and steady_state=false)";
-  parameter Modelica.SIunits.SpecificEnthalpy h0=1e5
+  parameter Modelica.Units.SI.SpecificEnthalpy h0=1e5
     "Initial fluid specific enthalpy (active if steady_state=false)";
   parameter Boolean dynamic_mass_balance=false
     "true: dynamic mass balance equation - false: static mass balance equation";
   parameter Boolean steady_state=true
     "true: start from steady state - false: start from (P0, h0)";
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 public
-  Modelica.SIunits.Temperature T "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure P(start=1.e5) "Fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
-  Modelica.SIunits.Density rho(start=998) "Fluid density";
-  Modelica.SIunits.MassFlowRate BQ
+  Modelica.Units.SI.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P(start=1.e5) "Fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
+  Modelica.Units.SI.Density rho(start=998) "Fluid density";
+  Modelica.Units.SI.MassFlowRate BQ
     "Right hand side of the mass balance equation";
-  Modelica.SIunits.Power BH "Right hand side of the energybalance equation";
+  Modelica.Units.SI.Power BH "Right hand side of the energybalance equation";
   ThermoSysPro.Thermal.Connectors.ThermalPort Cth
                                      annotation (Placement(transformation(
           extent={{-10,-10},{10,10}}, rotation=0)));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeB.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeB.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeB.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeB.mo"	2022-03-10 09:58:19.284149357 +0000
@@ -1,27 +1,27 @@
-﻿within ThermoSysPro.WaterSteam.Volumes;
+within ThermoSysPro.WaterSteam.Volumes;
 model VolumeB "Mixing volume with 2 inlets and 2 outlets"
-  parameter Modelica.SIunits.Volume V=1 "Volume";
-  parameter Modelica.SIunits.AbsolutePressure P0=1e5
+  parameter Modelica.Units.SI.Volume V=1 "Volume";
+  parameter Modelica.Units.SI.AbsolutePressure P0=1e5
     "Initial fluid pressure (active if dynamic_mass_balance=true and steady_state=false)";
-  parameter Modelica.SIunits.SpecificEnthalpy h0=1e5
+  parameter Modelica.Units.SI.SpecificEnthalpy h0=1e5
     "Initial fluid specific enthalpy (active if steady_state=false)";
   parameter Boolean dynamic_mass_balance=false
     "true: dynamic mass balance equation - false: static mass balance equation";
   parameter Boolean steady_state=true
     "true: start from steady state - false: start from (P0, h0)";
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 public
-  Modelica.SIunits.Temperature T "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure P(start=1.e5) "Fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
-  Modelica.SIunits.Density rho(start=998) "Fluid density";
-  Modelica.SIunits.MassFlowRate BQ
+  Modelica.Units.SI.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P(start=1.e5) "Fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
+  Modelica.Units.SI.Density rho(start=998) "Fluid density";
+  Modelica.Units.SI.MassFlowRate BQ
     "Right hand side of the mass balance equation";
-  Modelica.SIunits.Power BH "Right hand side of the energybalance equation";
+  Modelica.Units.SI.Power BH "Right hand side of the energybalance equation";
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro
     "Propriétés de l'eau"
     annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeBTh.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeBTh.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeBTh.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeBTh.mo"	2022-03-10 09:58:19.264149355 +0000
@@ -1,27 +1,27 @@
 within ThermoSysPro.WaterSteam.Volumes;
 model VolumeBTh "Mixing volume with 2 inlets and 2 outlets and thermal input"
-  parameter Modelica.SIunits.Volume V=1 "Volume";
-  parameter Modelica.SIunits.AbsolutePressure P0=1e5
+  parameter Modelica.Units.SI.Volume V=1 "Volume";
+  parameter Modelica.Units.SI.AbsolutePressure P0=1e5
     "Initial fluid pressure (active if dynamic_mass_balance=true and steady_state=false)";
-  parameter Modelica.SIunits.SpecificEnthalpy h0=1e5
+  parameter Modelica.Units.SI.SpecificEnthalpy h0=1e5
     "Initial fluid specific enthalpy (active if steady_state=false)";
   parameter Boolean dynamic_mass_balance=false
     "true: dynamic mass balance equation - false: static mass balance equation";
   parameter Boolean steady_state=true
     "true: start from steady state - false: start from (P0, h0)";
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 public
-  Modelica.SIunits.Temperature T "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure P(start=1.e5) "Fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
-  Modelica.SIunits.Density rho(start=998) "Fluid density";
-  Modelica.SIunits.MassFlowRate BQ
+  Modelica.Units.SI.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P(start=1.e5) "Fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
+  Modelica.Units.SI.Density rho(start=998) "Fluid density";
+  Modelica.Units.SI.MassFlowRate BQ
     "Right hand side of the mass balance equation";
-  Modelica.SIunits.Power BH "Right hand side of the energybalance equation";
+  Modelica.Units.SI.Power BH "Right hand side of the energybalance equation";
   ThermoSysPro.Thermal.Connectors.ThermalPort Cth
                                      annotation (Placement(transformation(
           extent={{-10,-10},{10,10}}, rotation=0)));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeC.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeC.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeC.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeC.mo"	2022-03-10 09:58:19.240149351 +0000
@@ -1,27 +1,27 @@
-﻿within ThermoSysPro.WaterSteam.Volumes;
+within ThermoSysPro.WaterSteam.Volumes;
 model VolumeC "Mixing volume with 3 inlets and 1 outlet"
-  parameter Modelica.SIunits.Volume V=1 "Volume";
-  parameter Modelica.SIunits.AbsolutePressure P0=1e5
+  parameter Modelica.Units.SI.Volume V=1 "Volume";
+  parameter Modelica.Units.SI.AbsolutePressure P0=1e5
     "Initial fluid pressure (active if dynamic_mass_balance=true and steady_state=false)";
-  parameter Modelica.SIunits.SpecificEnthalpy h0=1e5
+  parameter Modelica.Units.SI.SpecificEnthalpy h0=1e5
     "Initial fluid specific enthalpy (active if steady_state=false)";
   parameter Boolean dynamic_mass_balance=false
     "true: dynamic mass balance equation - false: static mass balance equation";
   parameter Boolean steady_state=true
     "true: start from steady state - false: start from (P0, h0)";
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 public
-  Modelica.SIunits.Temperature T "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure P(start=1.e5) "Fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
-  Modelica.SIunits.Density rho(start=998) "Fluid density";
-  Modelica.SIunits.MassFlowRate BQ
+  Modelica.Units.SI.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P(start=1.e5) "Fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
+  Modelica.Units.SI.Density rho(start=998) "Fluid density";
+  Modelica.Units.SI.MassFlowRate BQ
     "Right hand side of the mass balance equation";
-  Modelica.SIunits.Power BH "Right hand side of the energybalance equation";
+  Modelica.Units.SI.Power BH "Right hand side of the energybalance equation";
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro
     "Propriétés de l'eau"
     annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeCTh.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeCTh.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeCTh.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeCTh.mo"	2022-03-10 09:58:19.212149349 +0000
@@ -1,27 +1,27 @@
 within ThermoSysPro.WaterSteam.Volumes;
 model VolumeCTh "Mixing volume with 3 inlets and 1 outlet and thermal input"
-  parameter Modelica.SIunits.Volume V=1 "Volume";
-  parameter Modelica.SIunits.AbsolutePressure P0=1e5
+  parameter Modelica.Units.SI.Volume V=1 "Volume";
+  parameter Modelica.Units.SI.AbsolutePressure P0=1e5
     "Initial fluid pressure (active if dynamic_mass_balance=true and steady_state=false)";
-  parameter Modelica.SIunits.SpecificEnthalpy h0=1e5
+  parameter Modelica.Units.SI.SpecificEnthalpy h0=1e5
     "Initial fluid specific enthalpy (active if steady_state=false)";
   parameter Boolean dynamic_mass_balance=false
     "true: dynamic mass balance equation - false: static mass balance equation";
   parameter Boolean steady_state=true
     "true: start from steady state - false: start from (P0, h0)";
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 public
-  Modelica.SIunits.Temperature T "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure P(start=1.e5) "Fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
-  Modelica.SIunits.Density rho(start=998) "Fluid density";
-  Modelica.SIunits.MassFlowRate BQ
+  Modelica.Units.SI.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P(start=1.e5) "Fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
+  Modelica.Units.SI.Density rho(start=998) "Fluid density";
+  Modelica.Units.SI.MassFlowRate BQ
     "Right hand side of the mass balance equation";
-  Modelica.SIunits.Power BH "Right hand side of the energybalance equation";
+  Modelica.Units.SI.Power BH "Right hand side of the energybalance equation";
   ThermoSysPro.Thermal.Connectors.ThermalPort Cth
                                      annotation (Placement(transformation(
           extent={{-10,-10},{10,10}}, rotation=0)));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeD.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeD.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeD.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeD.mo"	2022-03-10 09:58:19.188149345 +0000
@@ -1,27 +1,27 @@
-﻿within ThermoSysPro.WaterSteam.Volumes;
+within ThermoSysPro.WaterSteam.Volumes;
 model VolumeD "Mixing volume with 1 inlet and 3 outlets"
-  parameter Modelica.SIunits.Volume V=1 "Volume";
-  parameter Modelica.SIunits.AbsolutePressure P0=1e5
+  parameter Modelica.Units.SI.Volume V=1 "Volume";
+  parameter Modelica.Units.SI.AbsolutePressure P0=1e5
     "Initial fluid pressure (active if dynamic_mass_balance=true and steady_state=false)";
-  parameter Modelica.SIunits.SpecificEnthalpy h0=1e5
+  parameter Modelica.Units.SI.SpecificEnthalpy h0=1e5
     "Initial fluid specific enthalpy (active if steady_state=false)";
   parameter Boolean dynamic_mass_balance=false
     "true: dynamic mass balance equation - false: static mass balance equation";
   parameter Boolean steady_state=true
     "true: start from steady state - false: start from (P0, h0)";
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 public
-  Modelica.SIunits.Temperature T "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure P(start=1.e5) "Fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
-  Modelica.SIunits.Density rho(start=998) "Fluid density";
-  Modelica.SIunits.MassFlowRate BQ
+  Modelica.Units.SI.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P(start=1.e5) "Fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
+  Modelica.Units.SI.Density rho(start=998) "Fluid density";
+  Modelica.Units.SI.MassFlowRate BQ
     "Right hand side of the mass balance equation";
-  Modelica.SIunits.Power BH "Right hand side of the energybalance equation";
+  Modelica.Units.SI.Power BH "Right hand side of the energybalance equation";
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro
     "Propriétés de l'eau"
     annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeDTh.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeDTh.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeDTh.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeDTh.mo"	2022-03-10 09:58:19.140149338 +0000
@@ -1,27 +1,27 @@
 within ThermoSysPro.WaterSteam.Volumes;
 model VolumeDTh "Mixing volume with 1 inlet and 3 outlets and thermal input"
-  parameter Modelica.SIunits.Volume V=1 "Volume";
-  parameter Modelica.SIunits.AbsolutePressure P0=1e5
+  parameter Modelica.Units.SI.Volume V=1 "Volume";
+  parameter Modelica.Units.SI.AbsolutePressure P0=1e5
     "Initial fluid pressure (active if dynamic_mass_balance=true and steady_state=false)";
-  parameter Modelica.SIunits.SpecificEnthalpy h0=1e5
+  parameter Modelica.Units.SI.SpecificEnthalpy h0=1e5
     "Initial fluid specific enthalpy (active if steady_state=false)";
   parameter Boolean dynamic_mass_balance=false
     "true: dynamic mass balance equation - false: static mass balance equation";
   parameter Boolean steady_state=true
     "true: start from steady state - false: start from (P0, h0)";
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 public
-  Modelica.SIunits.Temperature T "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure P(start=1.e5) "Fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
-  Modelica.SIunits.Density rho(start=998) "Fluid density";
-  Modelica.SIunits.MassFlowRate BQ
+  Modelica.Units.SI.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P(start=1.e5) "Fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
+  Modelica.Units.SI.Density rho(start=998) "Fluid density";
+  Modelica.Units.SI.MassFlowRate BQ
     "Right hand side of the mass balance equation";
-  Modelica.SIunits.Power BH "Right hand side of the energybalance equation";
+  Modelica.Units.SI.Power BH "Right hand side of the energybalance equation";
 public
   Connectors.FluidInlet Ce          annotation (Placement(transformation(extent=
            {{-110,-10},{-90,10}}, rotation=0)));
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeI.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeI.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeI.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeI.mo"	2022-03-10 09:58:19.116149335 +0000
@@ -1,27 +1,27 @@
-﻿within ThermoSysPro.WaterSteam.Volumes;
+within ThermoSysPro.WaterSteam.Volumes;
 model VolumeI "Mixing volume with 4 inlets and 4 outlets"
-  parameter Modelica.SIunits.Volume V=1 "Volume";
-  parameter Modelica.SIunits.AbsolutePressure P0=1e5
+  parameter Modelica.Units.SI.Volume V=1 "Volume";
+  parameter Modelica.Units.SI.AbsolutePressure P0=1e5
     "Initial fluid pressure (active if dynamic_mass_balance=true and steady_state=false)";
-  parameter Modelica.SIunits.SpecificEnthalpy h0=1e5
+  parameter Modelica.Units.SI.SpecificEnthalpy h0=1e5
     "Initial fluid specific enthalpy (active if steady_state=false)";
   parameter Boolean dynamic_mass_balance=false
     "true: dynamic mass balance equation - false: static mass balance equation";
   parameter Boolean steady_state=true
     "true: start from steady state - false: start from (P0, h0)";
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 public
-  Modelica.SIunits.Temperature T "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure P(start=1.e5) "Fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
-  Modelica.SIunits.Density rho(start=998) "Fluid density";
-  Modelica.SIunits.MassFlowRate BQ
+  Modelica.Units.SI.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P(start=1.e5) "Fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
+  Modelica.Units.SI.Density rho(start=998) "Fluid density";
+  Modelica.Units.SI.MassFlowRate BQ
     "Right hand side of the mass balance equation";
-  Modelica.SIunits.Power BH "Right hand side of the energybalance equation";
+  Modelica.Units.SI.Power BH "Right hand side of the energybalance equation";
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro
     "Propriétés de l'eau"
     annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeITh.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeITh.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeITh.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/WaterSteam/Volumes/VolumeITh.mo"	2022-03-10 09:58:19.092149333 +0000
@@ -1,27 +1,27 @@
-﻿within ThermoSysPro.WaterSteam.Volumes;
+within ThermoSysPro.WaterSteam.Volumes;
 model VolumeITh "Mixing volume with 4 inlets and 4 outlets and thermal input"
-  parameter Modelica.SIunits.Volume V=1 "Volume";
-  parameter Modelica.SIunits.AbsolutePressure P0=1e5
+  parameter Modelica.Units.SI.Volume V=1 "Volume";
+  parameter Modelica.Units.SI.AbsolutePressure P0=1e5
     "Initial fluid pressure (active if dynamic_mass_balance=true and steady_state=false)";
-  parameter Modelica.SIunits.SpecificEnthalpy h0=1e5
+  parameter Modelica.Units.SI.SpecificEnthalpy h0=1e5
     "Initial fluid specific enthalpy (active if steady_state=false)";
   parameter Boolean dynamic_mass_balance=false
     "true: dynamic mass balance equation - false: static mass balance equation";
   parameter Boolean steady_state=true
     "true: start from steady state - false: start from (P0, h0)";
   parameter Integer fluid=1 "1: water/steam - 2: C3H3F5";
-  parameter Modelica.SIunits.Density p_rho=0 "If > 0, fixed fluid density";
+  parameter Modelica.Units.SI.Density p_rho=0 "If > 0, fixed fluid density";
   parameter Integer mode=0
     "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic";
 
 public
-  Modelica.SIunits.Temperature T "Fluid temperature";
-  Modelica.SIunits.AbsolutePressure P(start=1.e5) "Fluid pressure";
-  Modelica.SIunits.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
-  Modelica.SIunits.Density rho(start=998) "Fluid density";
-  Modelica.SIunits.MassFlowRate BQ
+  Modelica.Units.SI.Temperature T "Fluid temperature";
+  Modelica.Units.SI.AbsolutePressure P(start=1.e5) "Fluid pressure";
+  Modelica.Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy";
+  Modelica.Units.SI.Density rho(start=998) "Fluid density";
+  Modelica.Units.SI.MassFlowRate BQ
     "Right hand side of the mass balance equation";
-  Modelica.SIunits.Power BH "Right hand side of the energybalance equation";
+  Modelica.Units.SI.Power BH "Right hand side of the energybalance equation";
   ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro
     "Propriétés de l'eau"
     annotation (Placement(transformation(extent={{-80,80},{-60,100}}, rotation=
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/openmodelica.metadata.json" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/openmodelica.metadata.json"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/openmodelica.metadata.json"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/openmodelica.metadata.json"	2022-03-10 09:58:53.612153703 +0000
@@ -1 +1 @@
-{"path":"ThermoSysPro", "provides":["0.0.0", "4.0.0"], "sha":"3ced3485f8da7b0baa3c8bf598d714951947c6d1", "support":"noSupport", "uses":{"Modelica":"3.2.2"}, "version":"3.2.0-master", "zipfile":"https://github.com/ThermoSysPro/ThermoSysPro/archive/3ced3485f8da7b0baa3c8bf598d714951947c6d1.zip"}
+{"path": "ThermoSysPro", "provides": ["0.0.0", "4.0.0"], "sha": "3ced3485f8da7b0baa3c8bf598d714951947c6d1", "support": "noSupport", "uses": {"Modelica": "4.0.0"}, "version": "3.2.0-master", "zipfile": "https://github.com/ThermoSysPro/ThermoSysPro/archive/3ced3485f8da7b0baa3c8bf598d714951947c6d1.zip", "extraInfo": "Conversion script /home/hudson/saved_omc/libraries/.openmodelica/libraries/Modelica 4.0.0+maint.om//Resources/Scripts/Conversion/ConvertModelica_from_3.2.3_to_4.0.0.mos was applied"}
\ No newline at end of file
diff -ur "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/package.mo" "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/package.mo"
--- "/home/hudson/saved_omc/libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/package.mo"	2022-03-10 09:57:37.996144126 +0000
+++ "converted-libraries/.openmodelica/libraries/ThermoSysPro 3.2.0-master/package.mo"	2022-03-10 09:58:53.608153704 +0000
@@ -126,7 +126,7 @@
 <p><b>Copyright &copy; EDF 2002 - 2019</b> </p>
 <p><b>ThermoSysPro version 3.2</h4>
 </html>"),
-  uses(Modelica(version="3.2.2")),
+  uses(Modelica(version= "4.0.0")),
   version="3.2",
   conversion(noneFromVersion="", noneFromVersion="4.0"));
 end ThermoSysPro;
