Quartz - A PDEVS Modeling & Simulation framework (WIP)

Quartz - A DEVS-based Modeling & Simulation Environment (WIP)

Build Status

Quartz is a Crystal library for defining models and constructing discrete event simulations based on the PDEVS (Parallel Discrete EVent System Specification) and some of its extensions (DSDE, multiPDEVS).

This project is developed by a research group at University of Corsica, which also maintains another M&S environment : DEVSimPy.


This project is a work in progress and is in alpha stage.




Crystal applications and libraries are expected to have a shard.yml file at their root. Create a shard.yml file in your project's folder (or add to it) with the following contents:

    github: RomainFranceschini/quartz
    version: 0.1.0

Replace the version 0.1.0 with the actual version of Quartz you wish to use.

Then, resolve dependencies with shards (Crystal dependency manager) to install Quartz and its requirements as a dependency of your project:

$ shards install



require "quartz"

class LotkaVolterra < Quartz::AtomicModel
  state_var x : Float64 = 1.0
  state_var y : Float64 = 1.0
  state_var alpha : Float64 = 5.2     # prey reproduction rate
  state_var beta : Float64 = 3.4      # predator per prey mortality rate
  state_var gamma : Float64 = 2.1     # predator mortality rate
  state_var delta : Float64 = 1.4     # predator per prey reproduction rate

  @sigma = Duration.new(10, Scale::MICRO) # euler integration

  def internal_transition
    dxdt = ((@x * @alpha) - (@beta * @x * @y))
    dydt = (-(@gamma * @y) + (@delta * @x * @y))

    @x += @sigma * dxdt
    @y += @sigma * dydt

model = LotkaVolterra.new(:lotka)
sim = Quartz::Simulation.new(model, duration: Quartz.duration(20))
$ crystal build lotka.cr
$ ./lotka

More examples

See the examples folder.

Getting the code

  • Install Crystal compiler (http://crystal-lang.org/docs/installation)
  • Clone the git repository (git clone git://github.com/RomainFranceschini/quartz.git).
  • Resolves dependencies (cd quartz; crystal deps).
  • Run specs (crystal spec).
  • Build examples (crystal build examples/*.cr)/


Many other tools allow modeling and simulation based on the DEVS theory. Here is a non-exhaustive list:

Suggested Reading

  • Bernard P. Zeigler, Herbert Praehofer, Tag Gon Kim. Theory of Modeling and Simulation. Academic Press; 2 edition, 2000. ISBN-13: 978-0127784557


  • [RomainFranceschini] Romain Franceschini - creator, maintainer (Université de Corse Pasquale Paoli)


  1. Fork it (https://github.com/RomainFranceschini/quartz/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new pull request.


This software is governed by the CeCILL-C license under French law and abiding by the rules of distribution of free software. You can use, modify and/ or redistribute the software under the terms of the CeCILL-C license as circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info".

The fact that you are presently reading this means that you have had knowledge of the CeCILL-C license and that you accept its terms.

Github statistic:
  • 4
  • 0
  • 0
  • 2
  • 9
  • 2 months ago