Module: Cherrypick::VolumeByNanoGrams

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

Instance Method Summary collapse

Instance Method Details

#volume_to_cherrypick_by_nano_grams(minimum_volume, maximum_volume, target_ng, source_well, robot_minimum_picking_volume = 0.0) ⇒ Object


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/models/cherrypick/volume_by_nano_grams.rb', line 18

def volume_to_cherrypick_by_nano_grams(minimum_volume, maximum_volume, target_ng, source_well, robot_minimum_picking_volume = 0.0)
  robot_minimum_picking_volume ||= 0.0
  check_inputs_to_volume_to_cherrypick_by_nano_grams!(minimum_volume, maximum_volume, target_ng, source_well)

  source_concentration = source_well.well_attribute.concentration.to_f
  source_volume        = source_well.well_attribute.estimated_volume # Current volume, fall back to measured if current not set
  desired_volume = source_volume
  unless source_concentration.zero?
    desired_volume = [(target_ng.to_f / source_concentration), robot_minimum_picking_volume].max
  end
  requested_volume = [source_volume, desired_volume].min
  buffer_volume = buffer_volume_required(minimum_volume, requested_volume, robot_minimum_picking_volume)
  requested_volume = maximum_volume if requested_volume > maximum_volume

  well_attribute.current_volume   = minimum_volume
  well_attribute.requested_volume = minimum_volume
  well_attribute.picked_volume    = requested_volume
  well_attribute.buffer_volume    = buffer_volume
  well_attribute.robot_minimum_picking_volume = robot_minimum_picking_volume

  requested_volume
end