model ExtendedCapacity
import HydraulicsByFluidon.Media;
import HydraulicsByFluidon.Media.Base.FluidInterface;
Integer fluidId = fluidPort.fluidId;
HydraulicsByFluidon.Interfaces.FluidPort fluidPort "Hydraulic port";
parameter SI.Volume capacity(displayUnit = "l");
parameter SI.BulkModulus bulkModulus(displayUnit = "bar") = 2.1e+11;
SI.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;