Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset the stepsize to initial value at the beginning of each pulse #76

Open
RemDelaporteMathurin opened this issue Jan 3, 2025 · 0 comments
Assignees

Comments

@RemDelaporteMathurin
Copy link
Collaborator

For stability purposes, it would be preferable to reset the value of the stepsize to its initial value at the beginning of each pulse.

We can do this in here by adding a new milestone just after the beginning of the pulse. Say the pulse starts at t=200s and we want the stepsize to be 1 second, then we set another milestone at t=201s

hisp/src/hisp/model.py

Lines 165 to 189 in d785b7d

def make_milestones(self) -> List[float]:
"""
Returns the milestones for the stepsize.
For each pulse, the milestones are the start
of the pulse, the start of the waiting period,
and the end of the pulse.
Returns:
The milestones in seconds
"""
milestones = []
current_time = 0
for pulse in self.scenario.pulses:
start_of_pulse = self.scenario.get_time_start_current_pulse(current_time)
for i in range(pulse.nb_pulses):
milestones.append(start_of_pulse + pulse.total_duration * (i + 1))
milestones.append(
start_of_pulse
+ pulse.total_duration * i
+ pulse.duration_no_waiting
)
current_time = start_of_pulse + pulse.total_duration * pulse.nb_pulses
return sorted(np.unique(milestones))

We may need an optional argument to this method.

@RemDelaporteMathurin RemDelaporteMathurin self-assigned this Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant