Thermodynamic property models for use with Modia and other Julia packages
Author ModiaSim
8 Stars
Updated Last
2 Years Ago
Started In
November 2018


ModiaMedia is outdated and should not be used. The package is currently redesigned. For more details, see ModiaSim.


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 in METADATA. Julia 1.0 is required. Installation is performed via:

julia> ]add

ModiaMedia uses PyPlot for plotting (via ModiaMath.plot). If PyPlot is not available in your current Julia environment an information message is printed and all plot(..) calls are ignored.

In order that plot windows are displayed, you need to add PyPlot to your current environment via ]add PyPlot. Often this automatic installation fails and it is recommended to follow the instructions Installing PyPlot in a robust way.


  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

  # Plot the most important characteristics of the medium

The last command results in the following plot:



The ModiaMedia package development has just started and a lot has to be improved.

Main Developers

License: MIT (expat)