Skip to content

Commit 9ef3682

Browse files
committed
fixes for a working consolidate
1 parent 7e011b0 commit 9ef3682

File tree

2 files changed

+33
-14
lines changed

2 files changed

+33
-14
lines changed

api/src/opentrons/protocol_api/core/engine/instrument.py

+25-12
Original file line numberDiff line numberDiff line change
@@ -1254,16 +1254,20 @@ def consolidate_liquid( # noqa: C901
12541254
)
12551255
# TODO BOILER PLATE ABOVE
12561256

1257+
max_volume = min(
1258+
self.get_max_volume(),
1259+
self._engine_client.state.geometry.get_nominal_tip_geometry(
1260+
pipette_id=self.pipette_id,
1261+
labware_id=tip_racks[0][1].labware_id,
1262+
well_name=None,
1263+
).volume,
1264+
)
1265+
12571266
# TODO: add multi-channel pipette handling here
12581267
source_per_volume_step = tx_commons.expand_for_volume_constraints(
12591268
volumes=[volume for _ in range(len(source))],
12601269
targets=source,
1261-
max_volume=min(
1262-
self.get_max_volume(),
1263-
tip_racks[0][1]
1264-
.get_well_core("A1")
1265-
.get_max_volume(), # Assuming all tips in tiprack are of same volume
1266-
),
1270+
max_volume=max_volume,
12671271
)
12681272

12691273
# TODO BOILERPLATE BELOW
@@ -1320,23 +1324,32 @@ def _pick_up_tip() -> None:
13201324
air_gap=0,
13211325
)
13221326
]
1323-
air_gap_volume = (
1324-
transfer_props.aspirate.retract.air_gap_by_volume.get_for_volume(volume)
1325-
)
13261327
next_step_volume, next_source = next(source_per_volume_step)
13271328
is_last_step = False
13281329
while not is_last_step:
13291330
total_dispense_volume = 0.0
1331+
air_gap_volume = (
1332+
transfer_props.aspirate.retract.air_gap_by_volume.get_for_volume(
1333+
next_step_volume
1334+
)
1335+
)
13301336
vol_aspirate_combo = []
13311337
# Take air gap into account because there will be a final air gap before the dispense
1332-
while total_dispense_volume + air_gap_volume < self.get_max_volume():
1338+
while (
1339+
total_dispense_volume + next_step_volume + air_gap_volume <= max_volume
1340+
):
13331341
total_dispense_volume += next_step_volume
13341342
vol_aspirate_combo.append((next_step_volume, next_source))
13351343
try:
13361344
next_step_volume, next_source = next(source_per_volume_step)
13371345
except StopIteration:
13381346
is_last_step = True
13391347
break
1348+
air_gap_volume = (
1349+
transfer_props.aspirate.retract.air_gap_by_volume.get_for_volume(
1350+
total_dispense_volume + next_step_volume
1351+
)
1352+
)
13401353

13411354
if new_tip == TransferTipPolicyV2.ALWAYS:
13421355
if prev_src is not None:
@@ -1369,8 +1382,8 @@ def _pick_up_tip() -> None:
13691382
trash_location=trash_location,
13701383
)
13711384
prev_src = next_source
1372-
if new_tip != TransferTipPolicyV2.NEVER:
1373-
_drop_tip()
1385+
if new_tip != TransferTipPolicyV2.NEVER:
1386+
_drop_tip()
13741387

13751388
def _get_location_and_well_core_from_next_tip_info(
13761389
self,

api/src/opentrons/protocol_api/core/engine/transfer_components_executor.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def submerge(
144144
minimum_z_height=None,
145145
speed=None,
146146
)
147-
if self._transfer_type == TransferType.ONE_TO_ONE:
147+
if self._transfer_type != TransferType.ONE_TO_MANY:
148148
self._remove_air_gap(location=submerge_start_location)
149149
self._instrument.move_to(
150150
location=self._target_location,
@@ -319,9 +319,15 @@ def retract_after_aspiration(self, volume: float) -> None:
319319
# Full speed because the tip will already be out of the liquid
320320
speed=None,
321321
)
322+
# For consolidate, we need to know the total amount that is in the pipette since this
323+
# may not be the first aspirate
324+
if self._transfer_type == TransferType.MANY_TO_ONE:
325+
volume_for_air_gap = self._instrument.get_current_volume()
326+
else:
327+
volume_for_air_gap = volume
322328
self._add_air_gap(
323329
air_gap_volume=self._transfer_properties.aspirate.retract.air_gap_by_volume.get_for_volume(
324-
volume
330+
volume_for_air_gap
325331
)
326332
)
327333

0 commit comments

Comments
 (0)