y_petri 2.1.44 → 2.1.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/y_petri/simulation.rb +28 -0
- data/lib/y_petri/simulation/marking_vector/access.rb +5 -5
- data/lib/y_petri/simulation/timed.rb +17 -1
- data/lib/y_petri/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fa9d7c1831b2aa0a9131a8ca20291215753ba748
|
|
4
|
+
data.tar.gz: 76818d0b32a6023975fca7f430944dc8c60896e8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4890b6da29a0367938da297fdfa60a50ad07d287784c26ed25a179a70d1c18f96abb9ccc2baabae54a4e88580838f465c9201e6712c4a1a46f9d94399a31b6ef
|
|
7
|
+
data.tar.gz: 7aca2c9a08198e1e2c82fb32d766f523fdbcbab1c3b0117cfdc31f6a85633ee634d069f17ec1f668b4dbefb508910e30b4247ae77a333ebfd32b6aab926d4cf1
|
data/lib/y_petri/simulation.rb
CHANGED
|
@@ -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
|
|
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
|
|
37
|
-
# Takes optional list of place ids (ordered argument no. 1), and
|
|
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:
|
|
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
|
-
#
|
|
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
|
data/lib/y_petri/version.rb
CHANGED