主要内容

refrigerantChargeProperties

Calculate two-phase fluid states based on charge density and temperature

Since R2026a

    Description

    [pressure,specificEnthalpy,specificInternalEnergy,normalizedInternalEnergy,exitflag] = refrigerantChargeProperties(propertySource,chargeDensity,temperature) calculates the two-phase fluid states for the fluid properties source, propertySource, from the charge density, chargeDensity, and the temperature of the refrigerant charge, temperature. If you want to initialize a model based on refrigerant charge density, use this function to calculate the fluid states.

    The refrigerantChargeProperties function solves a system of two equations for pressure, p, and normalized specific internal energy, u¯,

    vTLU(p,u¯)=1ρchargeTTLU(p,u¯)=Tcharge

    where:

    • vTLU is the fluid specific volume property table.

    • TTLU is the fluid temperature property table.

    • ρcharge is the value of the chargeDensity argument, which is the total refrigerant mass in the system divided by the total system volume.

    • Tcharge is the value of the temperature argument.

    example

    Examples

    collapse all

    This example shows how to calculate initial conditions, apply those conditions to a model, and compare the model results with the specified conditions.

    Specify the model and block names. This model contains a Two-Phase Fluid Properties (2P) and a Constant Volume Chamber (2P) block.

    model = "RefrigerantChargeProperties";
    load_system(model);
    block = model + "/Constant Volume Chamber (2P)";
    propBlock = model + "/Two-Phase Fluid Properties (2P)";

    Specify the mass and the temperature of the refrigerant charge. Determine the total volume in the system and calculate the charge density. In this model, the only block with volume is the Constant Volume Chamber (2P) block.

    m = 0.0020; % [kg]
    T_charge = 320; % [K]
    V = str2double(get_param(block,"volume")); % [m^3] 
    rho_charge = m/V; % [kg/m^3]

    Use the refrigerantChargeProperties function to calculate the initial conditions.

    [pressure, specificEnthalpy, specificInternalEnergy, normalizedInternalEnergy, validity] ... 
        = refrigerantChargeProperties(propBlock, rho_charge, T_charge);

    Specify the initial conditions in the Constant Volume Chamber (2P) block to match the calculated values. Set the values for the initial pressure, p_init, and the initial specific internal energy, u_init, to pressure and specificInternalEnergy, respectively.

    set_param(block, "p_init", num2str(pressure));
    set_param(block, "u_init", num2str(specificInternalEnergy));

    Simulate the model and retrieve the simulation temperature and specific volume output.

    [~, ~, ~] = sim(model);
    
    v_I = simlog_RefrigerantChargeProperties.Constant_Volume_Chamber_2P.v_I.series.values("m^3/kg"); 
    T_I = simlog_RefrigerantChargeProperties.Constant_Volume_Chamber_2P.T_I.series.values("K");      

    Calculate the simulation charge density from the specific volume and confirm that the model results match the refrigerant mass and temperature that you specified.

    rho_I = 1./v_I;
    m_I = rho_I .* V; 
    disp("Specified refrigerant mass = "+num2str(m)+" kg, "+"Model refrigerant mass = "+num2str(m_I(1))+" kg")
    Specified refrigerant mass = 0.002 kg, Model refrigerant mass = 0.002 kg
    
    disp("Specified refrigerant temperature = "+num2str(T_charge)+" K, Model refrigerant temperature  = "+ ...
        num2str(T_I(1))+" K at saturation pressure = "+num2str(pressure)+" MPa")
    Specified refrigerant temperature = 320 K, Model refrigerant temperature  = 320.0002 K at saturation pressure = 0.01056 MPa
    

    Input Arguments

    collapse all

    Fluid properties source, specified as a block handle, character vector, or string. This argument can be:

    • A block handle or path to a Two-Phase Fluid Properties (2P) or Two-Phase Fluid Predefined Properties (2P) (Simscape Fluids) block.

    • The name of a predefined fluid in the Two-Phase Fluid Predefined Properties (2P) block, if Simscape™ Fluids™ is installed. The available predefined fluids are:

      • Water (R-718)

      • R-134a

      • R-1234yf

      • R-1233zd(E)

      • R-404A

      • R-410A

      • R-407C

      • R-22

      • R-32

      • R-454B

      • Ammonia (R-717)

      • Carbon dioxide (R-744)

      • Isobutane (R-600a)

      • Propane (R-290)

    Example: "myModel/Two-Phase Fluid Properties (2P)"

    Data Types: double | char | string | struct

    System charge density, which is the total refrigerant mass in the system divided by the total system volume, specified as a scalar or a simscape.Value object. If you specify this argument as a double, the function assumes it is in units of kg/m3.

    Example: 140

    Data Types: double | simscape.Value

    Temperature of refrigerant charge, specified as a scalar or a simscape.Value object. If you specify this argument as a double, the function assumes it is in units of K.

    Example: 295

    Data Types: double | simscape.Value

    Output Arguments

    collapse all

    Pressure of the calculated fluid state, returned as a scalar or a simscape.Value object. The type of output returned depends on whether you input doubles or simscape.Value objects. The value of pressure is in the units of MPa.

    Specific enthalpy of the calculated fluid state, returned as a scalar or a simscape.Value object. The type of output returned depends on whether you input doubles or simscape.Value objects. The value of specificEnthalpy is in the units of kJ/kg.

    Specific internal energy of the calculated fluid state, returned as a scalar or a simscape.Value object. The type of output returned depends on whether you input doubles or simscape.Value objects. The value of specificInternalEnergy is in the units of kJ/kg.

    Normalized internal energy of the calculated fluid state, returned as a scalar or a simscape.Value object. The type of output returned depends on whether you input doubles or simscape.Value objects. The value of normalizedInternalEnergy is unitless.

    Validity of the returned properties, returned as a 1, 0, or -1. The function returns:

    • 1 when the function finds a solution and the solution is in the valid range of the fluid property tables.

    • 0 when the function finds a solution, but the solution is outside of the valid range of the fluid property tables.

    • -1 when the function fails to find a solution.

    Version History

    Introduced in R2026a