This package provides thermodynamic property models for use with Modia and other Julia packages. The initial goal is to achieve a similar functionality as Modelica.Media, the standard media library for Modelica models, but with improvements based on Julia features such as multiple dispatch.
This package is under development and it is planned to provide all thermodynamic property models from Modelica.Media in this package.
This package is currently under development and is not yet registered. Julia 1.7 is required. Installation is performed via:
julia> ]add https://github.com/ModiaSim/ModiaMedia.jl
ModiaMedia performs plotting via SignalTables.jl.
Version 0.1.0 of the package is described in Otter et al. (2019). Current version 0.2.0-dev has been (partially) adapted to SignalTables.jl.
using ModiaMedia
# Define thermodynamic property model to be used
Medium = getMedium("N2");
# Define the operating point where the medium shall be evaluated.
p = 1e5 # in [Pa]
T = 300.0 # in [K]
# Set the medium-specific thermodynamic state from p and T
# (could be also set from p,h, or p,s, or d,T, or
# p,T,X, or p,h,X, or p,s,X, or d,T,X)
state = setState_pT(Medium, p, T)
# Update a state object with new values
setState_pT!(state, p, T)
# Call media functions (here to compute density and specific enthalpy)
d = density(state)
h = specificEnthalpy(state)
# Print computed values
println("data for p=$p, T=$T:")
println("density = ", d)
println("specificEnthalpy = ", h)
# List the available media
listMedia()
# Plot the most important characteristics of the medium
using SignalTables
usePlotPackage("PyPlot") # for details see SignalTables
@usingPlotPackage # using SignalTablesInterface_PyPlot
standardPlot(Medium, plot)
The last command results in the following plot:
- Martin Otter (DLR - Institute of System Dynamics and Control)
- Hilding Elmqvist (Mogram),
- Chris Laughman (MERL).
- All the content of ModiaMedia is based on Modelica.Media which was and is developed from many people.
License: MIT (expat)