diff --git a/api/src/opentrons/protocol_engine/commands/aspirate.py b/api/src/opentrons/protocol_engine/commands/aspirate.py index eeb762407d4..bbeb089182d 100644 --- a/api/src/opentrons/protocol_engine/commands/aspirate.py +++ b/api/src/opentrons/protocol_engine/commands/aspirate.py @@ -139,7 +139,7 @@ async def execute(self, params: AspirateParams) -> _ExecuteReturn: state_update.set_liquid_operated( labware_id=labware_id, well_name=well_name, - volume=CLEAR, + volume_added=CLEAR, ) return DefinedErrorData( public=OverpressureError( @@ -160,7 +160,7 @@ async def execute(self, params: AspirateParams) -> _ExecuteReturn: state_update.set_liquid_operated( labware_id=labware_id, well_name=well_name, - volume=-volume_aspirated, + volume_added=-volume_aspirated, ) return SuccessData( public=AspirateResult( diff --git a/api/src/opentrons/protocol_engine/commands/aspirate_in_place.py b/api/src/opentrons/protocol_engine/commands/aspirate_in_place.py index 8ac4e3ffd5d..23d331cd19b 100644 --- a/api/src/opentrons/protocol_engine/commands/aspirate_in_place.py +++ b/api/src/opentrons/protocol_engine/commands/aspirate_in_place.py @@ -113,7 +113,7 @@ async def execute(self, params: AspirateInPlaceParams) -> _ExecuteReturn: state_update.set_liquid_operated( labware_id=current_location.labware_id, well_name=current_location.well_name, - volume=CLEAR, + volume_added=CLEAR, ) return DefinedErrorData( public=OverpressureError( @@ -146,7 +146,7 @@ async def execute(self, params: AspirateInPlaceParams) -> _ExecuteReturn: state_update.set_liquid_operated( labware_id=current_location.labware_id, well_name=current_location.well_name, - volume=-volume, + volume_added=-volume, ) return SuccessData( public=AspirateInPlaceResult(volume=volume), diff --git a/api/src/opentrons/protocol_engine/commands/dispense.py b/api/src/opentrons/protocol_engine/commands/dispense.py index 3dbd195920e..ad57cb1882f 100644 --- a/api/src/opentrons/protocol_engine/commands/dispense.py +++ b/api/src/opentrons/protocol_engine/commands/dispense.py @@ -110,7 +110,7 @@ async def execute(self, params: DispenseParams) -> _ExecuteReturn: state_update.set_liquid_operated( labware_id=labware_id, well_name=well_name, - volume=CLEAR, + volume_added=CLEAR, ) return DefinedErrorData( public=OverpressureError( @@ -131,7 +131,7 @@ async def execute(self, params: DispenseParams) -> _ExecuteReturn: state_update.set_liquid_operated( labware_id=labware_id, well_name=well_name, - volume=volume, + volume_added=volume, ) return SuccessData( public=DispenseResult(volume=volume, position=deck_point), diff --git a/api/src/opentrons/protocol_engine/commands/dispense_in_place.py b/api/src/opentrons/protocol_engine/commands/dispense_in_place.py index 68741eaa50c..b6eac561559 100644 --- a/api/src/opentrons/protocol_engine/commands/dispense_in_place.py +++ b/api/src/opentrons/protocol_engine/commands/dispense_in_place.py @@ -92,7 +92,7 @@ async def execute(self, params: DispenseInPlaceParams) -> _ExecuteReturn: state_update.set_liquid_operated( labware_id=current_location.labware_id, well_name=current_location.well_name, - volume=CLEAR, + volume_added=CLEAR, ) return DefinedErrorData( public=OverpressureError( @@ -125,7 +125,7 @@ async def execute(self, params: DispenseInPlaceParams) -> _ExecuteReturn: state_update.set_liquid_operated( labware_id=current_location.labware_id, well_name=current_location.well_name, - volume=volume, + volume_added=volume, ) return SuccessData( public=DispenseInPlaceResult(volume=volume), diff --git a/api/src/opentrons/protocol_engine/state/update_types.py b/api/src/opentrons/protocol_engine/state/update_types.py index 06f68768657..181d8820723 100644 --- a/api/src/opentrons/protocol_engine/state/update_types.py +++ b/api/src/opentrons/protocol_engine/state/update_types.py @@ -202,7 +202,7 @@ class LiquidOperatedUpdate: labware_id: str well_name: str - volume: float | ClearType + volume_added: float | ClearType @dataclasses.dataclass @@ -398,11 +398,11 @@ def set_liquid_probed( ) def set_liquid_operated( - self, labware_id: str, well_name: str, volume: float | ClearType + self, labware_id: str, well_name: str, volume_added: float | ClearType ) -> None: """Update liquid volumes in well state. See `OperateLiquidUpdate`.""" self.liquid_operated = LiquidOperatedUpdate( labware_id=labware_id, well_name=well_name, - volume=volume, + volume_added=volume_added, ) diff --git a/api/src/opentrons/protocol_engine/state/wells.py b/api/src/opentrons/protocol_engine/state/wells.py index 23ac6907fff..5b4d3bb8d77 100644 --- a/api/src/opentrons/protocol_engine/state/wells.py +++ b/api/src/opentrons/protocol_engine/state/wells.py @@ -89,13 +89,13 @@ def _handle_liquid_operated_update( labware_id in self._state.loaded_volumes and well_name in self._state.loaded_volumes[labware_id] ): - if state_update.volume is update_types.CLEAR: + if state_update.volume_added is update_types.CLEAR: del self._state.loaded_volumes[labware_id][well_name] else: prev_loaded_vol_info = self._state.loaded_volumes[labware_id][well_name] assert prev_loaded_vol_info.volume is not None self._state.loaded_volumes[labware_id][well_name] = LoadedVolumeInfo( - volume=prev_loaded_vol_info.volume + state_update.volume, + volume=prev_loaded_vol_info.volume + state_update.volume_added, last_loaded=prev_loaded_vol_info.last_loaded, operations_since_load=prev_loaded_vol_info.operations_since_load + 1, @@ -109,14 +109,16 @@ def _handle_liquid_operated_update( labware_id in self._state.probed_volumes and well_name in self._state.probed_volumes[labware_id] ): - if state_update.volume is update_types.CLEAR: + if state_update.volume_added is update_types.CLEAR: del self._state.probed_volumes[labware_id][well_name] else: prev_probed_vol_info = self._state.probed_volumes[labware_id][well_name] if prev_probed_vol_info.volume is None: new_vol_info: float | None = None else: - new_vol_info = prev_probed_vol_info.volume + state_update.volume + new_vol_info = ( + prev_probed_vol_info.volume + state_update.volume_added + ) self._state.probed_volumes[labware_id][well_name] = ProbedVolumeInfo( volume=new_vol_info, last_probed=prev_probed_vol_info.last_probed, diff --git a/api/tests/opentrons/protocol_engine/commands/test_aspirate.py b/api/tests/opentrons/protocol_engine/commands/test_aspirate.py index e67a0bc2622..ccaac0b6748 100644 --- a/api/tests/opentrons/protocol_engine/commands/test_aspirate.py +++ b/api/tests/opentrons/protocol_engine/commands/test_aspirate.py @@ -113,7 +113,7 @@ async def test_aspirate_implementation_no_prep( liquid_operated=update_types.LiquidOperatedUpdate( labware_id="123", well_name="A3", - volume=-50, + volume_added=-50, ), ), ) @@ -187,7 +187,7 @@ async def test_aspirate_implementation_with_prep( liquid_operated=update_types.LiquidOperatedUpdate( labware_id="123", well_name="A3", - volume=-50, + volume_added=-50, ), ), ) @@ -327,7 +327,7 @@ async def test_overpressure_error( liquid_operated=update_types.LiquidOperatedUpdate( labware_id=labware_id, well_name=well_name, - volume=update_types.CLEAR, + volume_added=update_types.CLEAR, ), ), ) @@ -393,7 +393,7 @@ async def test_aspirate_implementation_meniscus( liquid_operated=update_types.LiquidOperatedUpdate( labware_id="123", well_name="A3", - volume=-50, + volume_added=-50, ), ), ) diff --git a/api/tests/opentrons/protocol_engine/commands/test_aspirate_in_place.py b/api/tests/opentrons/protocol_engine/commands/test_aspirate_in_place.py index 16ad011dc8f..f639033d157 100644 --- a/api/tests/opentrons/protocol_engine/commands/test_aspirate_in_place.py +++ b/api/tests/opentrons/protocol_engine/commands/test_aspirate_in_place.py @@ -128,7 +128,7 @@ async def test_aspirate_in_place_implementation( liquid_operated=update_types.LiquidOperatedUpdate( labware_id=stateupdateLabware, well_name=stateupdateWell, - volume=-123, + volume_added=-123, ) ), ) @@ -270,7 +270,7 @@ async def test_overpressure_error( liquid_operated=update_types.LiquidOperatedUpdate( labware_id=stateupdateLabware, well_name=stateupdateWell, - volume=update_types.CLEAR, + volume_added=update_types.CLEAR, ) ), ) diff --git a/api/tests/opentrons/protocol_engine/commands/test_dispense.py b/api/tests/opentrons/protocol_engine/commands/test_dispense.py index dc455dc3d46..106bf197e11 100644 --- a/api/tests/opentrons/protocol_engine/commands/test_dispense.py +++ b/api/tests/opentrons/protocol_engine/commands/test_dispense.py @@ -95,7 +95,7 @@ async def test_dispense_implementation( liquid_operated=update_types.LiquidOperatedUpdate( labware_id="labware-id-abc123", well_name="A3", - volume=42, + volume_added=42, ), ), ) @@ -169,7 +169,7 @@ async def test_overpressure_error( liquid_operated=update_types.LiquidOperatedUpdate( labware_id="labware-id", well_name="well-name", - volume=update_types.CLEAR, + volume_added=update_types.CLEAR, ), ), ) diff --git a/api/tests/opentrons/protocol_engine/commands/test_dispense_in_place.py b/api/tests/opentrons/protocol_engine/commands/test_dispense_in_place.py index 274a41b8a21..56090ec63a7 100644 --- a/api/tests/opentrons/protocol_engine/commands/test_dispense_in_place.py +++ b/api/tests/opentrons/protocol_engine/commands/test_dispense_in_place.py @@ -88,7 +88,9 @@ async def test_dispense_in_place_implementation( private=None, state_update=update_types.StateUpdate( liquid_operated=update_types.LiquidOperatedUpdate( - labware_id=stateupdateLabware, well_name=stateupdateWell, volume=42 + labware_id=stateupdateLabware, + well_name=stateupdateWell, + volume_added=42, ) ), ) @@ -175,7 +177,7 @@ async def test_overpressure_error( liquid_operated=update_types.LiquidOperatedUpdate( labware_id=stateupdateLabware, well_name=stateupdateWell, - volume=update_types.CLEAR, + volume_added=update_types.CLEAR, ) ), ) diff --git a/api/tests/opentrons/protocol_engine/state/test_well_store.py b/api/tests/opentrons/protocol_engine/state/test_well_store.py index 823578f0eb4..822329aa874 100644 --- a/api/tests/opentrons/protocol_engine/state/test_well_store.py +++ b/api/tests/opentrons/protocol_engine/state/test_well_store.py @@ -143,7 +143,7 @@ def test_handles_load_liquid_and_aspirate(subject: WellStore) -> None: liquid_operated=update_types.LiquidOperatedUpdate( labware_id=labware_id, well_name=well_name_1, - volume=-aspirated_volume, + volume_added=-aspirated_volume, ) ), ) @@ -156,7 +156,7 @@ def test_handles_load_liquid_and_aspirate(subject: WellStore) -> None: liquid_operated=update_types.LiquidOperatedUpdate( labware_id=labware_id, well_name=well_name_2, - volume=-aspirated_volume, + volume_added=-aspirated_volume, ) ), ) @@ -220,7 +220,7 @@ def test_handles_liquid_probe_and_aspirate(subject: WellStore) -> None: liquid_operated=update_types.LiquidOperatedUpdate( labware_id="labware-id", well_name="well-name", - volume=-aspirated_volume, + volume_added=-aspirated_volume, ) ), )