model ExtendedCapacity
import HydraulicsByFluidon.Media;
import HydraulicsByFluidon.Media.Base.FluidInterface;
Integer fluidId = fluidPort.fluidId;
HydraulicsByFluidon.Interfaces.FluidPort fluidPort "Hydraulic port";
parameter Modelica.SIunits.Volume capacity;
parameter Modelica.SIunits.BulkModulus bulkModulus = 2.1e+11;
Modelica.SIunits.AbsolutePressure p(start = environment.pAmbient, nominal = 100000);
protected
outer HydraulicsByFluidon.Media.Environment environment;
Real K;
Real Kcorr;
Real rho;
equation
K = FluidInterface.calcKt(fluidId, p, fluidPort.fluidTemperature);
Kcorr = FluidInterface.calcKtCorrection(K, fluidPort.proportionUndissolvedAir, fluidPort.polytropicExponent, p);
rho = FluidInterface.calcRho(fluidId, p, fluidPort.fluidTemperature);
fluidPort.p = p;
der(p) = Kcorr * bulkModulus / (capacity * (K + bulkModulus)) * (fluidPort.mFlow / rho);
end ExtendedCapacity;