Skip to content

Commit

Permalink
have a variable track what the dc _should_ be, and now duty_cycle is …
Browse files Browse the repository at this point in the history
…just the present valiue
  • Loading branch information
CamDavidsonPilon committed Nov 12, 2024
1 parent a45efea commit 904494b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 0 additions & 1 deletion pioreactor/background_jobs/stirring.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ def __init__(
# initialize DC with initial_duty_cycle, however we can update it with a lookup (if it exists)
self.rpm_to_dc_lookup = self.initialize_rpm_to_dc_lookup()
self._estimate_duty_cycle = self.rpm_to_dc_lookup(self.target_rpm)
self.set_duty_cycle(self._estimate_duty_cycle)

# set up PID
self.pid = PID(
Expand Down
4 changes: 4 additions & 0 deletions pioreactor/tests/test_stirring.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def test_change_target_rpm_mid_cycle() -> None:
rpm_calculator.setup()

with Stirrer(original_rpm, unit, exp, rpm_calculator=rpm_calculator) as st:
st.start_stirring()
assert st.target_rpm == original_rpm
pause()

Expand All @@ -55,6 +56,8 @@ def test_change_target_rpm_mid_cycle() -> None:
def test_pause_stirring_mid_cycle() -> None:
exp = "test_pause_stirring_mid_cycle"
with Stirrer(500, unit, exp, rpm_calculator=None) as st:
assert st.duty_cycle == 0
st.start_stirring()
original_dc = st.duty_cycle
assert original_dc > 0
pause()
Expand Down Expand Up @@ -82,6 +85,7 @@ def test_publish_target_rpm() -> None:
rpm_calculator = RpmCalculator()
rpm_calculator.setup()
with Stirrer(target_rpm, unit, exp, rpm_calculator=rpm_calculator) as st:
st.start_stirring()
assert st.target_rpm == target_rpm

pause()
Expand Down

0 comments on commit 904494b

Please sign in to comment.