Skip to content

Commit

Permalink
Renamed RTCoord simulate_rt method and refractor
Browse files Browse the repository at this point in the history
  • Loading branch information
OscarFdezS committed Jun 26, 2024
1 parent b9055be commit eeeb767
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion xdevs/examples/store/2_rt_simulation_csv_output_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def get_sec(time_str):
c = RealTimeCoordinator(store, rt_manager)
middle = time.time()
print(f'Coordinator, Manager and Handlers Created. Elapsed time: {middle - start} sec')
c.simulate_iters(time_interv=sim_time)
c.simulate_rt(time_interv=sim_time)
end = time.time()
print(f'Simulation time (s) = {sim_time}')
print(f'Simulation took: {end - start} sec')
Expand Down
2 changes: 1 addition & 1 deletion xdevs/examples/store/3_rt_simulation_tcp_input_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def new_client_parser(msg: str):
c = RealTimeCoordinator(store, rt_manager)
middle = time.time()
print(f'Coordinator, Manager and Handlers Created. Elapsed time: {middle - start} sec')
c.simulate_iters(time_interv=sim_time)
c.simulate_rt(time_interv=sim_time)
end = time.time()
print(f'Simulation time (s) = {sim_time}')
print(f'Simulation took: {end - start} sec')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def mqtt_parser(msg: str):
middle = time.time()
print(f"Coordinator and Manager Created. Elapsed time: {middle - start} sec")
t_ini = time.time()
c.simulate_iters(time_interv=sim_time)
c.simulate_rt(time_interv=sim_time)
end = time.time()
print(f' Simulation time (s) = {sim_time}')
print(f"Simulation took: {end - start} sec")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def get_sec(time_str):
c = RealTimeCoordinator(gensys, rt_manager)
middle = time.time()
print("Coordinator and Manager Created. Elapsed time: {} sec".format(middle - start))
c.simulate_iters(time_interv=sim_time)
c.simulate_rt(time_interv=sim_time)
end = time.time()
print(f' Simulation time (s) = {sim_time}')
print("Simulation took: {} sec".format(end - start))
Expand Down
2 changes: 1 addition & 1 deletion xdevs/examples/store/system_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self, mean_clients: float = 1, stddev_clients: float =0, name=None

t_ini = time.time()
print(f' >>> COMENZAMOS : {t_ini}')
gen_coord.simulate_iters(time_interv=sim_time)
gen_coord.simulate_rt(time_interv=sim_time)
print(f' >>> FIN : {time.time()}')
print(f' Tiempo a ejecutar (s) = {sim_time }')
print(f' Tiempo ejecutado (s) = {(time.time() - t_ini)}')
Expand Down
2 changes: 1 addition & 1 deletion xdevs/examples/store/system_employees.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def input_client_parser(msg: str):

t_ini = time.time()
print(f' >>> COMENZAMOS : {t_ini} : {datetime.datetime.now()}')
e_coord.simulate_iters(time_interv=sim_time)
e_coord.simulate_rt(time_interv=sim_time)
print(f' >>> FIN : {time.time()}')
print(f' Tiempo a ejecutar (s) = {sim_time}')
print(f' Tiempo ejecutado (s) = {(time.time() - t_ini)}')
Expand Down
2 changes: 1 addition & 1 deletion xdevs/examples/store/system_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def parser_new_client(msg: str):

t_ini = time.time()
print(f' >>> COMENZAMOS : {t_ini}')
q_coord.simulate_iters(time_interv=sim_time)
q_coord.simulate_rt(time_interv=sim_time)
print(f' >>> FIN : {time.time()}')
print(f' Tiempo a ejecutar (s) = {sim_time}')
print(f' Tiempo ejecutado (s) = {(time.time() - t_ini)}')
Expand Down
2 changes: 1 addition & 1 deletion xdevs/rt.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def exit(self):
self.manager.exit(self.clock.time)
super().exit()

def simulate_iters(self, time_interv: float = float("inf")):
def simulate_rt(self, time_interv: float = float("inf")):
self.initialize()
while self.clock.time < time_interv:
if self.time_next == float("inf") and not self.manager.input_handlers:
Expand Down
2 changes: 1 addition & 1 deletion xdevs/tests/test_csv_transducer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from xdevs.examples.devstone.devstone import LI, DelayedAtomic, HI
from xdevs.factory import Transducers
from xdevs.examples.gpt.gpt import Job, Processor, Gpt
from xdevs.examples.gpt.models import Job, Processor, Gpt


class TestCsvTransducer(TestCase):
Expand Down

0 comments on commit eeeb767

Please sign in to comment.