Hi,
Should I just use the motors step or direction pin in my signal library and log how long it is active for?
That won't work, the Step/Dir outputs are outputs of your motion controller....not Mach. Mach does not pulse, it passes numeric movement commands to the
controller and the controller generates the pulse streams to enact the movement. You could presumably monitor the output of the controller but is would a factor of a 100,000
or more too fast for Mach.
May I suggest use these:
still, rc = mc.mcAxisIsStill(
number mInst,
number axisId)
Description:
Report if the axis is still.
velocity, rc = mc.mcAxisGetVel(
number mInst,
number axisId)
Description:
Get the velocity of an axis in user units per min.
Either could be used to determine whether an axis is moving.
Because I'm so comfortable with the concept...I would use the PLC script. At each pass of the script determine if an axis is moving and if so increment a register (of your devising)
pertaining to the accumulated time and axis has moved.
The PLC script runs every 10ms or so, you could consider it a live update. The only fly in the ointment is that your code would want to be fairly slick otherwise the computing overhead
would count against the overall performance of the machine. What I would suggest is somehow time the repeat rate of the PLC, and just increment a register by one unit, that unit being
equivalent to 10.5ms say. Every 22857 units, ie 240 secs 'Do Some Lube Process" and reset the register.
Craig