Skip to content

Commit

Permalink
Add minimum turnaround time for pmac
Browse files Browse the repository at this point in the history
  • Loading branch information
coretl committed Dec 14, 2016
1 parent 53359e4 commit d38ec3e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions malcolm/blocks/demo/I18PMACManager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@
- includes.pmac.trajectory_collection:
mri: $(mriPrefix)-TRAJ
prefix: BL18I-MO-STEP-06:GB
minTurnaround: 1.4
5 changes: 5 additions & 0 deletions malcolm/includes/pmac/trajectory_collection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@
name: prefix
description: the root PV for the pmac motor (hardware) controller

- parameters.float64:
name: minTurnaround
description: Minimum turnaround time

- blocks.pmac.PMACTrajectory:
mri: $(mri)
prefix: $(prefix)

- parts.pmac.PMACTrajectoryPart:
name: $(mri)
mri: $(mri)
minTurnaround: $(minTurnaround)
15 changes: 13 additions & 2 deletions malcolm/parts/pmac/pmactrajectorypart.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

from malcolm.controllers.runnablecontroller import RunnableController, \
ParameterTweakInfo
from malcolm.core import method_takes, REQUIRED, Info
from malcolm.core.vmetas import StringArrayMeta, PointGeneratorMeta
from malcolm.core import method_takes, REQUIRED, Info, method_also_takes
from malcolm.core.vmetas import StringArrayMeta, PointGeneratorMeta, NumberMeta
from malcolm.parts.builtin.childpart import ChildPart

# Number of seconds that a trajectory tick is
Expand Down Expand Up @@ -56,6 +56,7 @@ def __init__(self, cs_axis, cs_port, acceleration_time, resolution, offset,
self.scannable = scannable


@method_also_takes("minTurnaround", NumberMeta("float64", "Min time for any gaps between frames"), 0.0)
class PMACTrajectoryPart(ChildPart):
# Axis information stored from validate
# {scannable_name: MotorInfo}
Expand All @@ -70,6 +71,14 @@ class PMACTrajectoryPart(ChildPart):
steps_up_to = 0
# Stored generator for positions
generator = None
# Min turnaround time
min_turnaround = None

def create_attributes(self):
for data in super(PMACTrajectoryPart, self).create_attributes():
yield data
self.min_turnaround = NumberMeta("float64", "Min time for any gaps between frames").make_attribute(self.params.minTurnaround)
yield "minTurnaround", self.min_turnaround, self.min_turnaround.set_value

@RunnableController.Reset
def reset(self, task):
Expand Down Expand Up @@ -481,4 +490,6 @@ def need_lower_move_time(self, last_point, point):
lower_move_time = max(
lower_move_time, motor_info.acceleration_time)

lower_move_time = max(self.min_turnaround.value * 0.5, lower_move_time)

return lower_move_time, turnaround_midpoint

0 comments on commit d38ec3e

Please sign in to comment.