|
@@ -49,6 +49,38 @@ class MySimulation(Simulation):
|
49
|
49
|
behaviours_classes = [MySimulationBehaviour]
|
50
|
50
|
|
51
|
51
|
|
|
52
|
+class MyCycledSubjectBehaviour(MySubjectBehaviour):
|
|
53
|
+ @property
|
|
54
|
+ def cycle_frequency(self):
|
|
55
|
+ return 2
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+class MyCycledSimulationBehaviour(MySimulationBehaviour):
|
|
59
|
+ @property
|
|
60
|
+ def cycle_frequency(self):
|
|
61
|
+ return 2
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+class MyTimedSubjectBehaviour(MySubjectBehaviour):
|
|
65
|
+ @property
|
|
66
|
+ def seconds_frequency(self):
|
|
67
|
+ return 1.0
|
|
68
|
+
|
|
69
|
+ def run(self, data):
|
|
70
|
+ self.last_execution_time = time.time()
|
|
71
|
+ return super().run(data)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+class MyTimedSimulationBehaviour(MySimulationBehaviour):
|
|
75
|
+ @property
|
|
76
|
+ def seconds_frequency(self):
|
|
77
|
+ return 1.0
|
|
78
|
+
|
|
79
|
+ def run(self, data):
|
|
80
|
+ self.last_execution_time = time.time()
|
|
81
|
+ return super().run(data)
|
|
82
|
+
|
|
83
|
+
|
52
|
84
|
class TestBehaviours(BaseTest):
|
53
|
85
|
def test_subject_behaviour_produce_data(
|
54
|
86
|
self,
|
|
@@ -105,11 +137,6 @@ class TestBehaviours(BaseTest):
|
105
|
137
|
):
|
106
|
138
|
shared.reset()
|
107
|
139
|
|
108
|
|
- class MyCycledSubjectBehaviour(MySubjectBehaviour):
|
109
|
|
- @property
|
110
|
|
- def cycle_frequency(self):
|
111
|
|
- return 2
|
112
|
|
-
|
113
|
140
|
class MySubject(Subject):
|
114
|
141
|
behaviours_classes = [MyCycledSubjectBehaviour]
|
115
|
142
|
|
|
@@ -146,15 +173,6 @@ class TestBehaviours(BaseTest):
|
146
|
173
|
):
|
147
|
174
|
shared.reset()
|
148
|
175
|
|
149
|
|
- class MyTimedSubjectBehaviour(MySubjectBehaviour):
|
150
|
|
- @property
|
151
|
|
- def seconds_frequency(self):
|
152
|
|
- return 1.0
|
153
|
|
-
|
154
|
|
- def run(self, data):
|
155
|
|
- self.last_execution_time = time.time()
|
156
|
|
- return super().run(data)
|
157
|
|
-
|
158
|
176
|
class MySubject(Subject):
|
159
|
177
|
behaviours_classes = [MyTimedSubjectBehaviour]
|
160
|
178
|
|
|
@@ -205,11 +223,6 @@ class TestBehaviours(BaseTest):
|
205
|
223
|
):
|
206
|
224
|
shared.reset()
|
207
|
225
|
|
208
|
|
- class MyCycledSimulationBehaviour(MySimulationBehaviour):
|
209
|
|
- @property
|
210
|
|
- def cycle_frequency(self):
|
211
|
|
- return 2
|
212
|
|
-
|
213
|
226
|
class MyCycledSimulation(Simulation):
|
214
|
227
|
behaviours_classes = [MyCycledSimulationBehaviour]
|
215
|
228
|
|
|
@@ -240,15 +253,6 @@ class TestBehaviours(BaseTest):
|
240
|
253
|
):
|
241
|
254
|
shared.reset()
|
242
|
255
|
|
243
|
|
- class MyTimedSimulationBehaviour(MySimulationBehaviour):
|
244
|
|
- @property
|
245
|
|
- def seconds_frequency(self):
|
246
|
|
- return 1.0
|
247
|
|
-
|
248
|
|
- def run(self, data):
|
249
|
|
- self.last_execution_time = time.time()
|
250
|
|
- return super().run(data)
|
251
|
|
-
|
252
|
256
|
class MyTimedSimulation(Simulation):
|
253
|
257
|
behaviours_classes = [MyTimedSimulationBehaviour]
|
254
|
258
|
|