Pipes

class Pipes
    extends Modelica.Icons.Package;

    function calcDpFric
        input Real roughness;
        input Real mFlow;
        input Real rho;
        input Real eta;
        input Real fricConstant;
        input Real diameter;
        output Real dpFric;
    protected
        Real reynoldsNo = abs(4 * mFlow / (eta * Modelica.Constants.pi * diameter));
    algorithm
        dpFric := calcLambda(roughness, reynoldsNo) * fricConstant * abs(mFlow) * mFlow / rho;
    end calcDpFric;

    function calcLambda
        input Real roughness;
        input Real reynoldsNo;
        output Real lambda;
    external "C"
        lambda = pipesCalcLambda(roughness, reynoldsNo)
            annotation (
                Library = "hbffluids",
                LibraryDirectory = "modelica://HydraulicsByFluidon/Resources/Library");
    end calcLambda;
end Pipes;