lib/y_petri/simulation/timed.rb in y_petri-2.1.44 vs lib/y_petri/simulation/timed.rb in y_petri-2.1.45
- old
+ new
@@ -30,17 +30,33 @@
:flux_vector,
to: :core
delegate :sampling, to: :recorder
- # Reads the time range.
+ # Returns the flux of the indicated TS transitions (all TS transitions,
+ # if no argument is given).
#
def flux ids_of_TS_transitions=nil
tt = TS_transitions()
return flux tt if ids_of_TS_transitions.nil?
TS_transitions( ids_of_TS_transitions ).map { |t|
flux_vector.column_to_a.fetch tt.index( t )
}
+ end
+
+ # Flux of the indicated TS transitions (as hash with transition names as keys).
+ #
+ def t_flux ids=nil
+ TS_transitions( ids ).names( true ) >> flux( ids )
+ end
+
+ # Pretty prints flux of the indicated TS transitions as hash with transition
+ # names as keys. Takes optional list of transition ids (first ordered arg.),
+ # and optional 2 named arguments (+:gap+ and +:precision), as in
+ # +#pretty_print_numeric_values+.
+ #
+ def pflux ids=nil, gap: 0, precision: 3
+ t_flux( ids ).pretty_print_numeric_values( gap: gap, precision: precision )
end
# Reads the time range (initial_time .. target_time) of the simulation.
#
def time_range