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
at their root. Create a
shard.yml file in your project's folder (or add to it) with the following contents:
dependencies: quartz: github: rumenzu/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.
git clone git://github.com/rumenzu/quartz.git).
cd quartz; crystal deps).
crystal build examples/*.cr)/
Many other tools allow modeling and simulation based on the DEVS theory. Here is a non-exhaustive list:
git checkout -b my-new-feature)
git commit -am 'Add some feature')
git push origin my-new-feature)
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.