When performing tests that entail a large number of cycles of a curve or a sine wave, it becomes important to be able to resume the test at the correct cycle count if the test is aborted for some reason.
Attached is an example user program that keeps track of the number of cycles of a curve (the same procedure applies to a sine wave), and continues at the current count, even if the motion is interrupted.
Here is a description of the programming:
Before running the user program, all you need to do is to set the TotalRequestedCycles variable. The program updates the CompletedCycles variable with the total number of cycles completed (even if interruptions occurred). The TestComplete variable becomes 1 when all the requested cycles have been completed.
Send the Curve Start Advanced command, but first some calcs to determine how many cycles to command. If this is a fresh start of a test that means TestComplete is 1 or Completed Cycles is 0. In that case, the number of cycles to command (CyclesToDo) is set to the value of the TotalRequestedCycles variable. Then, the CompletedCycles variable is reset to zero.
If this is not a fresh start, that means we need to figure out the number of remaining cycles so we can command the proper number of cycles.
This calculation is: CyclesToDo := TotalRequestedCycles - CompletedCycles;
We also need to clear the TestComplete variable.
Notice that the Curve Start Advanced command uses the Status Block parameter. The only item in the Status block (variables 10-15 in this example) that the program is doing anything with is the StatusCurrentCycles variable. The variables 3-7 are for helping keep track of the number of total cycles and when the cycles are complete.
Wait for the first cycle to complete. This is because the next step will increment the Completed Cycles count, but we don’t want to do that until after the first cycle is done. To tell when the cycle is complete, we set the LastStatusCycle variable to the StatusCurrentCycles. When the first cycle is complete, the RMC will increment StatusCurrentCycles and the condition LastStatusCycle <> StatusCurrentCycles will indicate this to us, so we can go to the next step.
Each time the RMC increments StatusCurrentCycles, this step increments the CompletedCycles variable. However, if the CompledCycles reaches the TotalRequestedCycles, it means the cycles are complete, and we go to the next step.
Sets the TestComplete variable to 1, indicating that all the cycles have been completed.
It may be necessary to add a step at the beginning that moves the axis to the first point of the curve. This is in case the axis is not there already.
CurveCyclesWithInterruption.rmcproj (20.9 KB)