|
Name |
Description |
Return type |
|
Checks if the reference of a comparator Pipe Block has been crossed. Returns TRUE if the reference has been crossed |
BOOL |
|
|
Initializes a comparator Pipe Block with user-defined settings |
BOOL |
|
|
None |
||
|
Clears the Transition Flag of a comparator Pipe Block |
BOOL |
|
|
Sets the reference position of a comparator block |
BOOL |
MLCompCheckCheck if the reference of a comparator Pipe Block has been crossed. Returns the Transition Flag of a comparator object, which turns TRUE if the input position to the comparator is greater or equal to the reference. The Comparator Transition Flag stays TRUE until it is reset.
|
BlockID |
Description |
ID number of an initiated Comparator object |
|
Data type |
DINT |
|
|
Range |
[-2147483648, 2147483648] |
|
|
Unit |
n/a |
|
|
Default |
— |
|
Default (.Q) |
Description |
Returns TRUE if reference position of the Comparator object has been crossed See more details here |
|
Data type |
BOOL |
|
|
Unit |
n/a |
BOOL
|
//Check if Comparator Reference has been reached bCrossed := MLCompCheck( PipeNetwork.MyComp );
|
MLCompInitInitializes a comparator Pipe Block for use in a PLC"Programmable Logic Controller" A Programmable Logic Controller, PLC, or Programmable Controller is a digital computer used for automation of industrial processes, such as control of machinery on factory assembly lines. Used to synchronize the flow of inputs from (physical) sensors and events with the flow of outputs to actuators and events Program. FunctionA function calculates a result according to the current value of its inputs. A function has no internal data and is not linked to declared instances. block is automatically called if a Comparator Block is added to the Pipe Network, with user-defined settings entered in the Pipe Blocks Properties screen.
The Transition Flag of a comparator object turns TRUE if the input position to the comparator is greater or equal to the reference. The Comparator Transition Flag stays TRUE until it is reset.
If the input ThroughZero is set to TRUE, system must cross zero and then the reference position before the Transition Flag is set. If ThroughZero is FALSE, Transition Flag is set immediately if the input pipe position is greater or equal to the Reference value.
Comparator objects are normally created in the Pipe Network using the graphical engine. Then you do not have to add MLCompInit function blocks to their programs. Parameters are entered directly in pop-up windows, and the code is then automatically added to the current project.
|
BlockID |
Description |
ID number of a created Comparator Pipe Block |
|
Data type |
DINT |
|
|
Range |
[-2147483648, 2147483648] |
|
|
Unit |
n/a |
|
|
Default |
— |
|
|
ModuloPosition |
Description |
Value of the period of a cyclic system |
|
Data type |
LREAL |
|
|
Range |
— |
|
|
Unit |
User unit |
|
|
Default |
— |
|
|
ThroughZero |
Description |
When TRUE, system must cross zero and then the reference position before the Transition Flag is set. If FALSE, Transition Flag is set immediately if the input pipe position is greater then or equal to the Reference value. |
|
Data type |
BOOL |
|
|
Range |
0, 1 |
|
|
Unit |
n/a |
|
|
Default |
— |
|
|
Reference |
Description |
Set the reference position in the new Comparator object |
|
Data type |
LREAL |
|
|
Range |
— |
|
|
Unit |
User unit |
|
|
Default |
— |
|
Default (.Q) |
Description |
Returns TRUE when function starts to execute See more details here |
|
Data type |
BOOL |
|
|
Unit |
n/a |
BOOL
//Initiate a created Comparator Block named “MyComp” to:
// Modulo of 360
// Require the input position to first cross 0 before the
// MLCompCheck output is triggered
// Input compared position to 45
MyComp := MLBlkCreate( 'MyComp', 'COMPARATOR' );
MLCompInit( MyComp, 360.0, TRUE, 45.0 );
MLCompReadRefReturns the reference position of a comparator block. The Transition Flag of a comparator object turns TRUE if the input position to the comparator is greater or equal to the reference. The Comparator Transition Flag stays TRUE until it is reset.
|
BlockID |
Description |
ID number of an initiated Comparator object |
|
Data type |
DINT |
|
|
Range |
[-2147483648, 2147483648] |
|
|
Unit |
n/a |
|
|
Default |
— |
|
Reference |
Description |
Returns the current reference position of the Comparator object |
|
Data type |
LREAL |
|
|
Unit |
User unit |
//Return the Comparator Reference value
CompRef := MLCompReadRef( PipeNetwork.MyComp );
MLCompResetClear the Transition Flag of a comparator Pipe Block. The Transition Flag of a comparator object turns TRUE if the input position to the comparator is greater or equal to the reference. The Comparator Transition Flag stays TRUE until it is reset.
|
BlockID |
Description |
ID number of an initiated Comparator object |
|
Data type |
DINT |
|
|
Range |
[-2147483648, 2147483648] |
|
|
Unit |
n/a |
|
|
Default |
— |
|
Default (.Q) |
Description |
Returns TRUE when function starts to execute See more details here |
|
Data type |
BOOL |
|
|
Unit |
n/a |
BOOL
//Clear the Transition Flag of a Comparator object
MLCompReset( PipeNetwork.MyComp );
MLCompWriteRefSet the reference position of a comparator block. The Transition Flag of a comparator object turns TRUE if the input position to the comparator is greater or equal to the reference. The Comparator Transition Flag stays TRUE until it is reset.
If the input ThroughZero is set to TRUE, system must cross zero and then the reference position before the Transition Flag is set. If ThroughZero is FALSE, Transition Flag is set immediately if the input pipe position is greater then or equal to the Reference value.
|
BlockID |
Description |
ID number of an initiated Comparator object |
|
Data type |
DINT |
|
|
Range |
[-2147483648, 2147483648] |
|
|
Unit |
n/a |
|
|
Default |
— |
|
|
ThroughZero |
Description |
When TRUE, system must cross zero and then the reference position before the Transition Flag is set. If FALSE, Transition Flag is set immediately if the input pipe position is greater then or equal to the Reference value. |
|
Data type |
BOOL |
|
|
Range |
0, 1 |
|
|
Unit |
n/a |
|
|
Default |
— |
|
|
Reference |
Description |
New reference position to set in the selected Comparator object |
|
Data type |
LREAL |
|
|
Range |
— |
|
|
Unit |
User unit |
|
|
Default |
— |
|
Default (.Q) |
Description |
Returns TRUE when function starts to execute See more details here |
|
Data type |
BOOL |
|
|
Unit |
n/a |
BOOL
|
//Set the Comparator Reference value MLCompWriteRef( PipeNetwork.MyComp , TRUE , 45 );
|
When you call the MLCompWriteRef function, the output for MLCompCheck becomes True as soon as the input value reaches the reference.
The same function can also be called for a cyclic input value.
When the THROUGH_ZERO parameter is set to YES, the output for MLCompCheck becomes True as soon as the input value reaches the reference, but not before it has passed through zero.
Figure 11-87: Comparator Functions Usage
|
Copyright © 2015 Kollmorgen™ |
|