Skip to content

Thermodynamic property models for use with Modia and other Julia packages

License

Notifications You must be signed in to change notification settings

ModiaSim/ModiaMedia.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ModiaMedia

Latest

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.

Installation

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.

Use

  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:

standardPlot

Main Developers

License: MIT (expat)

About

Thermodynamic property models for use with Modia and other Julia packages

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages