-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In sim.py the simulate_rt has been modified. In order to take into account, the internal time it takes to execute lambdas and deltas.
- Loading branch information
1 parent
56ca6c3
commit 31be89b
Showing
1 changed file
with
8 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -340,15 +340,21 @@ def simulate_rt(self, time_interv: float = 10000): | |
tf = self.clock.time + time_interv | ||
|
||
while self.clock.time < tf: | ||
t_b = self.clock.time # time before executing lambdas and deltas | ||
self.lambdaf() | ||
self.deltfcn() | ||
self._execute_transducers() | ||
self.clear() | ||
if self.time_next < float("inf"): | ||
t_a = self.clock.time # time after executing lambdas and deltas | ||
if self.time_next < float("inf") and (self.time_next - self.clock.time - t_a + t_b > 0): | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
romancardenas
Collaborator
|
||
# Infinite time is not allowed. | ||
# Negative time is not allowed. If lambdas and deltas' time is large. | ||
|
||
# sleep_time = self.time_next-self.clock.time | ||
# print(">>> {}".format(sleep_time)) | ||
# time.sleep(sleep_time) | ||
time.sleep(self.time_next - self.clock.time) | ||
time.sleep(self.time_next - self.clock.time - t_a + t_b) | ||
This comment has been minimized.
Sorry, something went wrong. |
||
# - (t_a-t_b) = - t_a + t_b .In order to subtract the time it took to execute lambdas and deltas | ||
self.clock.time = self.time_next | ||
|
||
def simulate_inf(self): | ||
|
Te sugiero: