The compare block with the
type manages thresholds, reflex outputs and events in the following modes:Comparison is configured in the Configuration screen by activating at least one threshold.
Comparison can be used to trigger:
an event on a threshold associated with an external task
The
type can manage up to four thresholds.A threshold is a configured value that is compared to the counting value. Thresholds are used to define up to five zones or to react to a value crossing the threshold value.
Threshold values are defined in the configuration window and can also be adjusted in the application program by using the HSCSetParam_TM3
function block.
If Thresholdx (x= 0, 1, 2, 3) is configured and comparison is enabled (EN_Compare
= 1), output pin THx of the HSCMain_TM3
function block is:
set when counter value >= Thresholdx
reset when counter value < Thresholdx
EN_Compare
is set to 0 on HSCMain_TM3
function block, comparison functions are disabled, including external tasks triggered by a threshold event and Reflex outputs.
The following example for Modulo loop with two thresholds shows comparison in the HSCMain_TM3
function block:
Stage |
Action |
---|---|
1 |
When |
2 |
When |
3 |
The counter is reset, due to a synchronization condition for example. |
Configuring an event on threshold crossing allows to trigger an external task. You can choose to trigger an event when a configured threshold is crossed as follows:
. The event is triggered when the measured value goes above the threshold value.
. The event is triggered when the measured value goes below the threshold value.
. The event is triggered when the measured value goes above the threshold value and when the measured value goes below the threshold value.
Configuring an event allows to trigger an external task. You can choose to trigger an event as follows:
. The event is triggered when the measured value is lower than the threshold value.
. The event is triggered when the measured value is higher than the threshold value.
. The event is triggered when the measured value is between two threshold values.
Using thresholds comparison status available in the task context (TH0
to TH3
output pins of the function block) is suitable for an application tolerant of the inherent lag of cycle times and asynchronism of communications, especially when using the modules over a field bus in distributed architectures.
Follow this procedure to configure reflex outputs:
Step |
Action |
---|---|
1 |
In select a number of thresholds.Result: and are displayed. |
2 |
Enter the value in the field of each threshold value.
NOTE: EcoStruxure Machine Expert follow this rule to configure the threshold values and adapt them if necessary: < < < < .
NOTE: For functions, you can set a higher value for thresholds than defined in field.
|
3 |
Configure the . |
Configuring reflex outputs allows to trigger physical reflex outputs.
These outputs are not controlled in the task context, reducing the reaction time to a minimum. This is convenient for operations that need fast execution.
Outputs used by the High Speed Counter can only be accessed through the function block. They cannot be read or written directly within the application.
Example of the reflex outputs triggered by threshold:
Care must be exercised when threshold compares are active to avoid unintended or unexpected results from the outputs or from sudden Event task execution. If the compare function is disabled, threshold values can be modified freely. However, if the compare function is enabled, suspend at least the threshold compare function while modifying the threshold values.
WARNING | |
---|---|
While EN_Compare
= 1, the comparison is active, and it is necessary to follow this procedure to apply changes to threshold values:
Step |
Action |
---|---|
1 |
Set The comparison is frozen at the counter value:
NOTE:
EN_Compare , EN_Out , and F_Out remain operational while SuspendCompare is set.
|
2 |
Modify the threshold values as needed using the |
3 |
Set The new threshold values are applied and the comparison is resumed. |