MaxK
Member
I have 5 second scan
2 questions:
1. Are you using an adding machine (abacus maybe?) as a PLC?
2. What is the period of the sinusoid if you see it with a 5-second scan?
I have 5 second scan
I don't, that is a concern of mine also. Other team members aren't as concerned with this and say that clinicians can tell patients to "go along for the ride" for a while, and indicate when to start working. But that is placing a lot of trust in the users. ...
2 questions:
1. Are you using an adding machine (abacus maybe?) as a PLC?
2. What is the period of the sinusoid if you see it with a 5-second scan?
2 questions:
1. Are you using an adding machine (abacus maybe?) as a PLC?
2. What is the period of the sinusoid if you see it with a 5-second scan?
Trying to get valid, useful measurements from a device that cannot be calibrated is going to be ... well ... trying. See item (iii) below.
Good luck.
Let me step back a bit.
Are any or all of the following correct?
This is not even close to answering the thread's question; I am only trying to understand the system at this point.
- The is an HMI speed control setting, a speed setpoint.
Yes there is a speed setpoint ranging from 0.1 mph -1.8 mph. This can be adjusted before and while the machine is running.
- The units of that speed setpoint are the footplates' RPM, or strides per minute, which is half of steps per minute (a stride is a left-step and right-step pair - I expect you know that, I am only writing it here to ensure the terms are defined).
Yes, 1 revolution = 1 stride = 2 steps
- The motor control attempts to keep the footplates moving at the setpoint footplates' RPM by varying the current to the motor
Yes, that is correct. And if you try to "beat" the machine by putting in work, it will force you back down to that setpoint RPM.
- Even without a user's feet on the footplates, the system's resistance to movement varies throughout the footplates' cycle due to something (linkages? who knows; the details are not important)
Yes, when the system is unloaded and running empty, there is still system resistance in the footplates cycle and current fluctuation observed due to mechanical design.
- That resistance is more or less sinusoidal varying at the footplates' step cycle i.e. twice the stride frequency.
Yes, the resistance throughout the footplate's step cycle results in a relatively sinusoidal outputs. One stride (one step from each foot) is one complete "sin" wave.
- That sinusoidal resistance induces a sinusoidal variation in the instantaneous speed (as measured by liveRpm?) of the system.
Yes, that is correct.
- If the are no user's feet on the footplate, the current provided by the motor control at a given RPM setpoint will vary throughout each cycle to compensate for the variation in instantaneous speed induced by the variation in resistance.
Yes, that is correct.
- That variation in current will be sinusoidal because it is in effect driven by the sinusoidal variation in resistance.
Yes.
One method is to time how long it takes for a counter (counting the pulses) to reach 8 which will tell us when one rev has occurred, then it will reset; the time measured would be livePeriod. However this approach will only spit out a livePeriod value once per revolution. I want the program to be more responsive, at least once per step would be ideal.
With an eight- or sixteen- element FIFO array, containing the last eight or sixteen times of transition, the PLC would be able to calculate how long it was for the past 8 or 16 transitions, and update that value at each transition, so there would be a one-cycle period updated every quarter or eighth of a second. Since the transitions being compared are one complete cycle apart, any irregularities between blocker lengths would not affect the calculation.
I haven't worked with FIFOs much before, and haven't seen it being called that in Automation Studio in ladder function blocks, I've tried looking into these a lot but haven't found one. Is there equivalent FB that is used in AS? Does anyone have experience with using FIFOs in AS or input on how to approach this?
There are at least two ways to implement a FIFO. But first, to define a FIFO:
In the current case,
- A FIFO is an array that contains a series of measurements, usually from a series of events.
- Each element in the array has two properties:
- Its value, i.e. the measurement, at the time of the event represented by the element.
- Its position, i.e. the element's index, within the array
- This is the property of the element that is unique to the FIFO and that makes it useful
- The sequence of positions in the array represent the sequence of events that placed their values into the array
With those definitions in place, here are two common implementations:
- the value of each element in the array is a time measurement of a encoder wheel sensor input transition event; it could be
- the relative time since the previous event, or
- the absolute time of the event
- the index of each element represents which of the most recent 16 transitions generated that value, relative to the most recent transition.
- An linear array that shifts the values through the array and maintains a constant relationship between event ordinal and array index.
- The oldest (first stored) event's value is always in array element 0
- The newest (last stored) event value is always in array element N-1.
- The arrival of a new event's value triggers two operations, which are often implemented by two FIFO instructions, unload and load
- A FIFO unload operation will
- "Pop" the oldest (FO "First Out") event's value from of the array at index (position) 0.
- Shift the array element's values at indices (positions) 1 through L-1 by one position "down," i.e. into indices 0 through L-2
- L is the number of elements (events) currently stored in the FIFO array
- N.B. this overwrites the oldest (first stored) value in the array, which is why it was "popped" in the previous step.
- Decrease the length, L, of the array by 1
- A FIFO load operation will
- "Push" a new event's value onto the array at index L
- Increment the length, L, of the array by 1
- How those two operations, load and unload, are implemented, e.g. as two separate instructions or as one instruction, is up to the vendor. Usually they are separate instructions as that allows a variable FIFO array length.
- Note that, because popping the oldest value (FO; First Out) from, and pushing a new value (FI; First in) the FIFO array will not occur on every scan cycle, vendor-supplied FIFO instructions have a one-shot built in, so the FIFO shift is triggered on the single scan cycle only when an event signal becomes 1, and further shifts are prevented by the one-shot mechanism on subsequent scan cycles while that event signal is still 1.
- A circular array that leaves each event's value at the index in the array into which it is first written, and has a variable relationship between event ordinal and array index.
- The oldest (first stored) event's value is in array element at index , where I is a variable tag, with the value of I maintained by the program that varies from 0 to L-1.
[*]The newest (last stored) event value is always in array element I-1 (or I+L-1, if I is 0).
[*]The arrival of a new event's value triggers a few operations:
- The oldest event's value is "popped" from array element at index
[*]The newest event's value is written to array element at index , which overwrites the oldest events' value.
[*]I is incremented by 1, and if that resulting incremented value is L, then I is assigned a value of 0
- or apply a MODULO instruction if available, using L as the divisor
- This is the origin of the phrase "circular" array: the index "increments" from the end of the array (index L-1) back to the beginning (index 0), as if the array elements were laid out in a circle.
[*]N.B. this description does not include the case where the FIFO array length (L in the other implementation) changes; that can be covered but is not relevant to the current case of footplate encoder sensor transition timings.
[*]I have not seen any vendor-supplied FIFO instructions using this implementation. So you would have to do it yourself, which would be the case anyway if Automation Direct does not have built-in FIFO instruction(s).
[*]However, it is straightforward and applicable to the current case:
- Move array value to a tag e.g. to "OLD"
[*]Move the new event value to array
[*]Add 1 to value of I, assign that result value to I
[*]If incremented value of I is 16 (L), then assign a value of 0 to I
[*]You would also need explicit one-shot logic.
Either of those implementations provides the oldest and newest values from the event transitions at the same phase point of a footplate cycle, i.e. from two events exactly one revolution apart. If those values are some form of absolute times or free-running time, then subtracting* oldest from newest yields the period of the most recent full revolution starting and ending at that phase.
* Depending on the meaning of those time values and where they come from, there could be rollover issues in the subtraction, but that is not difficult to deal with, and you were dealing with them anyway when calculating the time differences in your current system.