Capacity

model Capacity
    import HydraulicsByFluidon.Media;
    import HydraulicsByFluidon.Media.Base.FluidInterface;

    Integer fluidId = fluidPort.fluidId;
    HydraulicsByFluidon.Interfaces.FluidPort fluidPort "Hydraulic port";
    SI.Volume capacity(displayUnit = "l");
    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 / capacity * (fluidPort.mFlow / rho);
end Capacity;