Module: YPetri::Core::Timed::Basic
- Defined in:
- lib/y_petri/core/timed/basic.rb
Overview
Basic Petri net execution method for timed and hybrid nets. Works also for timeless nets, but for those, Core::Timeless::Basic is slightly more efficient.
Instance Method Summary collapse
-
#delta(Δt) ⇒ Object
(also: #Δ)
Computes Δ for the period of Δt.
-
#step!(Δt = simulation.step) ⇒ Object
Makes a single step by Δt.
Instance Method Details
#delta(Δt) ⇒ Object Also known as: Δ
Computes Δ for the period of Δt. Its result is a sum of the contribution of timed transitions over the period Δt and the contribution of timeless transitions as if each fired once.
11 12 13 |
# File 'lib/y_petri/core/timed/basic.rb', line 11 def delta Δt gradient * Δt + delta_timeless end |
#step!(Δt = simulation.step) ⇒ Object
Makes a single step by Δt. Computes system delta, increments marking vector by it. On top of that, fires all A transitions, increments the simulation time and alerts the sampler that the system has changed.
20 21 22 23 24 25 |
# File 'lib/y_petri/core/timed/basic.rb', line 20 def step! Δt=simulation.step increment_marking_vector Δ( Δt ) assignment_transitions_all_fire! simulation.increment_time! Δt alert! # alerts the sampler that the system has changed end |