Module: Cherrypick::VolumeByNanoGramsPerMicroLitre

Included in:
Well
Defined in:
app/models/cherrypick/volume_by_nano_grams_per_micro_litre.rb

Instance Method Summary collapse

Instance Method Details

#volume_to_cherrypick_by_nano_grams_per_micro_litre(volume_required, concentration_required, source_concentration, source_volume, robot_minimum_picking_volume = 0.0) ⇒ Object


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/models/cherrypick/volume_by_nano_grams_per_micro_litre.rb', line 2

def volume_to_cherrypick_by_nano_grams_per_micro_litre(volume_required, concentration_required, source_concentration, source_volume, robot_minimum_picking_volume = 0.0)
  robot_minimum_picking_volume ||= 0

  check_inputs_to_volume_to_cherrypick_by_nano_grams_per_micro_litre!(volume_required, concentration_required, source_concentration)

  well_attribute.concentration    = concentration_required
  well_attribute.requested_volume = volume_required
  well_attribute.current_volume   = volume_required

  volume_to_pick = [[volume_required, robot_minimum_picking_volume].max, source_volume].compact.min
  buffer_volume  = 0.0
  unless source_concentration.zero?
    volume_to_pick = [[volume_required, ((volume_required * concentration_required) / source_concentration)].min, robot_minimum_picking_volume].max
    volume_to_pick = [source_volume, volume_to_pick].compact.min
    buffer_volume  = buffer_volume_required(volume_required, volume_to_pick, robot_minimum_picking_volume)
  end

  well_attribute.picked_volume  = volume_to_pick
  well_attribute.buffer_volume  = buffer_volume
  well_attribute.robot_minimum_picking_volume = robot_minimum_picking_volume

  volume_to_pick
end