MLCompInit

Pipe Network motion icon

 FunctionClosed A 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. - Initializes a comparator Pipe Block for use in a PLCClosed "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.

Inputs

Input

Data Type

Range

Unit

Default

Description

BlockID

DINT

-2147483648 to 2147483648

N/A

No default

ID number of a created Comparator Pipe Block.

ModuloPosition

LREAL

No range

User units

No default

Value of the period of a cyclic system.

ThroughZero

BOOL

0, 1

N/A

No default

  • When TRUE, the system must cross zero and then the reference position before the Transition Flag is set.
  • When FALSE, the Transition Flag is set immediately if the input pipe position is greater then or equal to the Reference value.

Reference

LREAL

No range

User units

No default

Set the reference position in the new Comparator object.

Outputs

Output

Data Type

Range

Unit

Default

Description

Default (.Q)

BOOL

No range

N/A

No default

Returns TRUE when function starts to execute.

See Function - General Rules for more information.

Remarks

  • Function 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, the system must cross zero and then the reference position before the Transition Flag is set.
  • If ThroughZero is FALSE, the 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.

FBD Language

MLCompInit: FBD example

FFLD Language

MLCompInit: LD example

ST Language

      //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 );

See Also