Y_YA_RateCalculator
This function block determines the frequency and number of occurrences of an event, such as determining the part output rate of a machine. RateCalculator counts the number of times an input 'Sensor' signal produces a rising edge and determines the frequency of that signal with respect to a chosen time period. It can account for real-time changes to the time period.
Parameters:
| * | Parameter | Data Type | Description | Default |
|---|---|---|---|---|
| VAR_INPUT | ||||
| B | Enable | BOOL | The function will continue to execute every scan while Enable is held high and there are no errors. | FALSE |
| V | Sensor | BOOL | Periodic signal to be measured. Commonly a "part-complete" sensor. |
|
| V | TimePeriod_ms | DINT | Sensor is measured with respect to this time window (milliseconds) to determine the current real-time rate. |
|
| VAR_OUTPUT | ||||
| B | Valid | BOOL | Indicates that the function is operating normally and the outputs of the function are valid. | |
| B | Busy | BOOL | Set high upon the rising edge of the Execute input, and reset when Done, CommandAborted, or Error is true. In the case of a function block with an Enable input, a Busy output indicates the function is operating, but not ready to provide Valid information. (No Error) | |
| B | Error | BOOL | Set high if an error has occurred during the execution of the function block. This output is cleared when 'Execute' or 'Enable' goes low. | |
| B | ErrorID | UINT | If Error is true, this output provides the Error ID. This output is reset when 'Execute' or 'Enable' goes low. | |
| V | CounterValue | LREAL | Number of times 'Sensor' has measured a rising edge since the function block has been enabled. | |
| V | CurrentRate | LREAL | The current frequency of the 'Sensor' input with respect to the chosen time period. | |
Note:
Upon enabling or a change of the time period, the 'Busy' signal remains active until the specified time period elapses, whereupon 'Busy' will go low and 'Valid' will go high. This is to receive a complete initial measurement of the rate 'Sensor' / 'TimePeriod_ms'.