(time_step, mech_step) -> (timestep, substep)

This commit is contained in:
Markus 2019-02-12 14:17:51 -02:00
parent ccdf7ba80d
commit 36512142fb
2 changed files with 6 additions and 6 deletions

View File

@ -41,7 +41,7 @@ def time_step(dt_str, dt_format='%Y-%m-%d %H:%M:%S', _timedelta = t_delta):
t_delta = timedelta(days=0, minutes=0, seconds=1)
def ep_time_step(s, dt_str, fromat_str='%Y-%m-%d %H:%M:%S', _timedelta = t_delta):
if s['mech_step'] == 0:
if s['substep'] == 0:
return time_step(dt_str, fromat_str, _timedelta)
else:
return dt_str
@ -50,7 +50,7 @@ def ep_time_step(s, dt_str, fromat_str='%Y-%m-%d %H:%M:%S', _timedelta = t_delta
def exo_update_per_ts(ep):
@curried
def ep_decorator(f, y, step, sL, s, _input):
if s['mech_step'] + 1 == 1:
if s['substep'] + 1 == 1:
return f(step, sL, s, _input)
else:
return (y, s[y])

View File

@ -43,7 +43,7 @@ class Executor:
self.apply_env_proc(env_processes, last_in_copy, last_in_copy['timestamp'])
last_in_copy["mech_step"], last_in_copy["time_step"], last_in_copy['run'] = m_step, t_step, run
last_in_copy["substep"], last_in_copy["timestep"], last_in_copy['run'] = m_step, t_step, run
sL.append(last_in_copy)
del last_in_copy
@ -53,7 +53,7 @@ class Executor:
m_step = 0
states_list_copy = deepcopy(states_list)
genesis_states = states_list_copy[-1]
genesis_states['mech_step'], genesis_states['time_step'] = m_step, t_step
genesis_states['substep'], genesis_states['timestep'] = m_step, t_step
states_list = [genesis_states]
m_step += 1
@ -83,9 +83,9 @@ class Executor:
states_list_copy = deepcopy(states_list)
head, *tail = self.block_pipeline(states_list_copy, configs, env_processes, time_seq, run)
genesis = head.pop()
genesis['mech_step'], genesis['time_step'], genesis['run'] = 0, 0, run
genesis['substep'], genesis['timestep'], genesis['run'] = 0, 0, run
first_timestep_per_run = [genesis] + tail.pop(0)
pipe_run += [first_timestep_per_run] + tail
del states_list_copy
return pipe_run
return pipe_run