Skip to content
Quartz - A PDEVS Modeling & Simulation framework (WIP)
Crystal Other
  1. Crystal 99.4%
  2. Other 0.6%
Branch: master
Clone or download

README.md

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.

Status

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

Installation

Requirements

Setup

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:

dependencies:
  quartz:
    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

Documentation

Usage

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
  end
end

model = LotkaVolterra.new(:lotka)
sim = Quartz::Simulation.new(model, duration: Quartz.duration(20))
sim.simulate
$ 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)/

Alternatives

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

Contributors

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

Contributing

  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.

License

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.

You can’t perform that action at this time.