Skip to content

Commit

Permalink
fix(step-generation): liquidState tracking for 96-channel column pick…
Browse files Browse the repository at this point in the history
…up (#15076)

closes RESC-246 AUTH-373
  • Loading branch information
jerader authored and koji committed May 3, 2024
1 parent 9eaab47 commit ad3d72d
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 7 deletions.
15 changes: 14 additions & 1 deletion step-generation/src/__tests__/dispenseUpdateLiquidState.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ import merge from 'lodash/merge'
import omit from 'lodash/omit'
import produce from 'immer'
import { createEmptyLiquidState, createTipLiquidState } from '../utils'
import { makeContext, DEFAULT_PIPETTE, SOURCE_LABWARE } from '../fixtures'
import {
makeContext,
DEFAULT_PIPETTE,
SOURCE_LABWARE,
getInitialRobotStateStandard,
} from '../fixtures'

import {
dispenseUpdateLiquidState,
Expand All @@ -33,6 +38,10 @@ beforeEach(() => {
useFullVolume: false,
labwareId: SOURCE_LABWARE,
wellName: 'A1',
robotStateAndWarnings: {
robotState: getInitialRobotStateStandard(invariantContext),
warnings: [],
},
}
})

Expand Down Expand Up @@ -396,6 +405,10 @@ describe('...8-channel pipette', () => {
useFullVolume: false,
volume: 150,
wellName: 'A1',
robotStateAndWarnings: {
robotState: getInitialRobotStateStandard(invariantContext),
warnings: [],
},
},
initialLiquidState
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import assert from 'assert'
import mapValues from 'lodash/mapValues'
import reduce from 'lodash/reduce'
import { COLUMN } from '@opentrons/shared-data'
import {
splitLiquid,
mergeLiquid,
Expand All @@ -12,14 +12,17 @@ import type {
InvariantContext,
LocationLiquidState,
SourceAndDest,
RobotStateAndWarnings,
} from '../types'

type LiquidState = RobotState['liquidState']
export interface DispenseUpdateLiquidStateArgs {
invariantContext: InvariantContext
prevLiquidState: LiquidState
pipetteId: string
// volume value is required when useFullVolume is false
useFullVolume: boolean
robotStateAndWarnings: RobotStateAndWarnings
wellName?: string
labwareId?: string
volume?: number
Expand All @@ -30,6 +33,7 @@ export function dispenseUpdateLiquidState(
args: DispenseUpdateLiquidStateArgs
): void {
const {
robotStateAndWarnings,
invariantContext,
labwareId,
pipetteId,
Expand All @@ -39,6 +43,8 @@ export function dispenseUpdateLiquidState(
wellName,
} = args
const pipetteSpec = invariantContext.pipetteEntities[pipetteId].spec
const nozzles = robotStateAndWarnings.robotState.pipettes[pipetteId].nozzles
const channels = nozzles === COLUMN ? 8 : pipetteSpec.channels
const trashId = Object.values(
invariantContext.additionalEquipmentEntities
).find(aE => aE.name === 'wasteChute' || aE.name === 'trashBin')?.id
Expand All @@ -59,17 +65,17 @@ export function dispenseUpdateLiquidState(
const labwareDef =
labwareId != null ? invariantContext.labwareEntities[labwareId].def : null

assert(
console.assert(
!(useFullVolume && typeof volume === 'number'),
'dispenseUpdateLiquidState takes either `volume` or `useFullVolume`, but got both'
)
assert(
console.assert(
typeof volume === 'number' || useFullVolume,
'in dispenseUpdateLiquidState, either volume or useFullVolume are required'
)
const { wellsForTips, allWellsShared } =
labwareDef != null && wellName != null
? getWellsForTips(pipetteSpec.channels, labwareDef, wellName)
? getWellsForTips(channels, labwareDef, wellName)
: { wellsForTips: null, allWellsShared: true }

const liquidLabware =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import assert from 'assert'
import range from 'lodash/range'
import isEmpty from 'lodash/isEmpty'
import uniq from 'lodash/uniq'
Expand Down Expand Up @@ -32,7 +31,7 @@ export function forAspirate(
params.wellName
)

assert(
console.assert(
// @ts-expect-error (sa, 2021-05-03): this assert is unnecessary
uniq(wellsForTips).length === allWellsShared ? 1 : wellsForTips.length,
`expected all wells to be shared, or no wells to be shared. Got: ${JSON.stringify(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ export function forBlowout(
wellName,
prevLiquidState: robotState.liquidState,
invariantContext,
robotStateAndWarnings,
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ export function forDispense(
useFullVolume: false,
volume,
wellName,
robotStateAndWarnings,
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export function forDropTip(
labwareId,
useFullVolume: true,
wellName,
robotStateAndWarnings,
})
robotState.tipState.pipettes[pipetteId] = false
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const forDispenseInPlace = (
prevLiquidState: robotState.liquidState,
useFullVolume: false,
volume,
robotStateAndWarnings,
})
}

Expand All @@ -42,6 +43,7 @@ export const forBlowOutInPlace = (
pipetteId,
prevLiquidState: robotState.liquidState,
useFullVolume: true,
robotStateAndWarnings,
})
}

Expand All @@ -59,5 +61,6 @@ export const forDropTipInPlace = (
prevLiquidState: robotState.liquidState,
pipetteId,
useFullVolume: true,
robotStateAndWarnings,
})
}

0 comments on commit ad3d72d

Please sign in to comment.