Skip to content

Use of Clapeyron and robust reverse flow modelling #3228

Open
@branch171

Description

@branch171

Using Clapeyron for properties(enthalpy, density etc) and robust modelling with allowance for reverse flow has been challenging

However, I have a working solution attached for those interested.

To circumvent the complication of instream, actualstream and other Modelica functionality, I have explicity modeled both the forward and reverse flow connectors. See attached

The only annoying issue is the warning associated with vector symbolic variables. These have been noted previously but they come up always with Clapeyron as the composition is a vector and all Clapeyron function calls need to be @register_symbolic functions. Hence:

function rho_pTz(model,p,T,z)
return 1/volume(model,p,T,z)
end
@register_symbolic rho_pTz(model::EoSModel,p::Float64,T::Float64,z::Array{Float64, 1})

this results in a warning as follows:

Warning: Internal error: Variable (vol₊zᵢ(t))[2] was marked as being in 0 ~ Main.rho_pTz(PR{AlyLeeIdeal, PRAlpha, NoTranslation, vdW1fRule}("nitrogen", "oxygen", "argon", "carbon dioxide"), vol₊p(t), vol₊T(t), vol₊zᵢ(t)) - vol₊rho(t), but was actually zero
└ @ ModelingToolkit.StructuralTransformations ~/.julia/packages/ModelingToolkit/zfOUk/src/structural_transformation/utils.jl:237

one for each variable in the vector so 4 molefractions zᵢ(t)[ 1..4] and this for eery Clapeyron function called.

It would be nice if we coud suppress this warning as it is fine to note it but it provides no value or issues to the model.

ReverseFlow_FWD_REV_Connectors_Clapeyron_Rev1.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions