y_petri 2.1.44 → 2.1.45

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0e7e84620c9fabe978f5052540808f8533dc6263
4
- data.tar.gz: 8bbd7f73ee8d5bd53f3e4c4ff160f11615752109
3
+ metadata.gz: fa9d7c1831b2aa0a9131a8ca20291215753ba748
4
+ data.tar.gz: 76818d0b32a6023975fca7f430944dc8c60896e8
5
5
  SHA512:
6
- metadata.gz: 9ed28df4ab7414b9a9aa165eff7861789a881caebfadba84c2e73d41a989f609a04117dddb2df78180861986a2b4bc957945ba446cfa1a0a369f5a4d15f49307
7
- data.tar.gz: e591a344d139ae9ff39ee4459879341038154cd1509ea5f62a315755fb0764a9f7f2e2a505e891613fa88d177da5b15c54f6747e7560eb1fd65abe9983521832
6
+ metadata.gz: 4890b6da29a0367938da297fdfa60a50ad07d287784c26ed25a179a70d1c18f96abb9ccc2baabae54a4e88580838f465c9201e6712c4a1a46f9d94399a31b6ef
7
+ data.tar.gz: 7aca2c9a08198e1e2c82fb32d766f523fdbcbab1c3b0117cfdc31f6a85633ee634d069f17ec1f668b4dbefb508910e30b4247ae77a333ebfd32b6aab926d4cf1
@@ -74,6 +74,7 @@ class YPetri::Simulation
74
74
  delegate :simulation_method,
75
75
  :guarded?,
76
76
  :step!,
77
+ :firing_vector_tS,
77
78
  to: :core
78
79
 
79
80
  delegate :recording,
@@ -85,6 +86,33 @@ class YPetri::Simulation
85
86
  :print,
86
87
  to: :recording
87
88
 
89
+ # Returns the firing of the indicated tS transitions (all tS transitions,
90
+ # if no argument is given).
91
+ #
92
+ def firing ids_of_tS_transitions=nil
93
+ tt = tS_transitions()
94
+ return firing tt if ids_of_tS_transitions.nil?
95
+ tS_transitions( ids_of_tS_transitions ).map { |t|
96
+ firing_vector_tS.column_to_a.fetch tt.index( t )
97
+ }
98
+ end
99
+
100
+ # Firing of the indicated tS transitions (as hash with transition names as
101
+ # keys).
102
+ #
103
+ def t_firing ids=nil
104
+ tS_transitions( ids ).names( true ) >> firing( ids )
105
+ end
106
+
107
+ # Pretty prints firing of the indicated tS transitions as hash with transition
108
+ # names as keys. Takes optional list of tS transition ids (first ordered arg.),
109
+ # and optional 2 named arguments (+:gap+ and +:precision+), as in
110
+ # +#pretty_print_numeric_values+.
111
+ #
112
+ def pfiring
113
+ t_firing( ids ).pretty_print_numeric_values( gap: gap, precision: precision )
114
+ end
115
+
88
116
  # The basic simulation parameter is :net – +YPetri::Net+ instance which to
89
117
  # simulate. Net implies the collection of places and transitions. Other
90
118
  # required attributes are +:marking_clamps+ and +:initial_marking+
@@ -26,19 +26,19 @@ class YPetri::Simulation::MarkingVector
26
26
  m_vector( ids ).to_hash
27
27
  end
28
28
 
29
- # Marking of all places (as hash with place names as keys).
29
+ # Marking of the indicated places (as hash with place names as keys).
30
30
  #
31
31
  def p_m ids=nil
32
32
  places( ids ).names( true ) >> m( ids )
33
33
  end
34
34
  alias pn_m p_m
35
35
 
36
- # Pretty prints marking of all places as hash with place names as keys.
37
- # Takes optional list of place ids (ordered argument no. 1), and optional
38
- # 2 named arguments (+:gap+ and +:precision+) as in
36
+ # Pretty prints marking of the indicated places as hash with place names as
37
+ # keys. Takes optional list of place ids (ordered argument no. 1), and
38
+ # optional 2 named arguments (+:gap+ and +:precision+), as in
39
39
  # +#pretty_print_numeric_values+.
40
40
  #
41
- def pm ids=nil, gap: 0, precision: 2
41
+ def pm ids=nil, gap: 0, precision: 3
42
42
  p_m( ids ).pretty_print_numeric_values gap: gap, precision: precision
43
43
  end
44
44
 
@@ -32,7 +32,8 @@ module YPetri::Simulation::Timed
32
32
 
33
33
  delegate :sampling, to: :recorder
34
34
 
35
- # Reads the time range.
35
+ # Returns the flux of the indicated TS transitions (all TS transitions,
36
+ # if no argument is given).
36
37
  #
37
38
  def flux ids_of_TS_transitions=nil
38
39
  tt = TS_transitions()
@@ -42,6 +43,21 @@ module YPetri::Simulation::Timed
42
43
  }
43
44
  end
44
45
 
46
+ # Flux of the indicated TS transitions (as hash with transition names as keys).
47
+ #
48
+ def t_flux ids=nil
49
+ TS_transitions( ids ).names( true ) >> flux( ids )
50
+ end
51
+
52
+ # Pretty prints flux of the indicated TS transitions as hash with transition
53
+ # names as keys. Takes optional list of transition ids (first ordered arg.),
54
+ # and optional 2 named arguments (+:gap+ and +:precision), as in
55
+ # +#pretty_print_numeric_values+.
56
+ #
57
+ def pflux ids=nil, gap: 0, precision: 3
58
+ t_flux( ids ).pretty_print_numeric_values( gap: gap, precision: precision )
59
+ end
60
+
45
61
  # Reads the time range (initial_time .. target_time) of the simulation.
46
62
  #
47
63
  def time_range
@@ -1,4 +1,4 @@
1
1
  module YPetri
2
- VERSION = "2.1.44"
2
+ VERSION = "2.1.45"
3
3
  DEBUG = false
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: y_petri
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.44
4
+ version: 2.1.45
5
5
  platform: ruby
6
6
  authors:
7
7
  - boris