Quartz - A DEVS-based Modeling & Simulation Environment (WIP)
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. Please refer to http://crystal-lang.org/docs/installation for instructions for your operating system.
Crystal applications and libraries are expected to have a
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
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
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 (
- Build examples (
crystal build examples/*.cr)/
Many other tools allow modeling and simulation based on the DEVS theory. Here is a non-exhaustive list:
- 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)
- Fork it (https://github.com/RomainFranceschini/quartz/fork)
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- 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.