Motion Library - Adder
-
-
For a description of the this pipe block and its parameters, see Pipe Blocks Description
Name |
Description |
Return type |
Initializes an Adder Pipe Block with user-defined settings |
BOOL |
|
Returns the offset value of the first entry of an Adder block |
None |
|
Returns the offset value of the second entry of an Adder block |
None |
|
Returns the ratio value of the first entry of an Adder block |
None |
|
Returns the ratio value of the second entry of an Adder block |
None |
|
Sets the source of an input of an adder Pipe Block |
BOOL |
|
Sets the offset value of the first entry of the Adder block |
BOOL |
|
Sets the offset value of the second entry of the Adder block |
BOOL |
|
Sets the ratio value of the first entry of the Adder block |
BOOL |
|
Sets the ratio value of the second entry of the Adder block |
BOOL |
MLAddInit
Description
Initializes an Adder 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 an Adder Block is added to the Pipe Network, with user-defined settings entered in the Pipe Blocks Properties screen.
The Pipe Block is assigned ratios and offsets for both inputs. After an Adder block is initialized, the inputs still need to be selected using the MLAddWriteInput function block or graphically using the Pipe Network.
Adder Block Output = Ratio1*Input1 + Offset1 + Ratio2*Input2 + Offset2
-
-
Adder objects are normally created in the Pipe Network using the graphical engine. Then you do not have to add MLAddInit function blocks to their programs. Parameters are entered directly in pop-up windows, and the code is then automatically added to the current project.
Arguments
Input
BlockID |
Description |
ID number of a created Pipe Block |
Data type |
DINT |
|
Range |
[-2147483648, 2147483648] |
|
Unit |
N/A |
|
Default |
— |
|
Ratio1 |
Description |
Sets the Ratio value of the first entry of an Adder object |
Data type |
LREAL |
|
Range |
— |
|
Unit |
N/A |
|
Default |
— |
|
Offset1 |
Description |
Sets the Offset value of the first entry of an Adder object |
Data type |
LREAL |
|
Range |
— |
|
Unit |
N/A |
|
Default |
— |
|
Ratio2 |
Description |
Sets the Ratio value of the second entry of an Adder object |
Data type |
LREAL |
|
Range |
— |
|
Unit |
N/A |
|
Default |
— |
|
Offset2 |
Description |
Sets the Offset value of the second entry of an Adder object |
Data type |
LREAL |
|
Range |
— |
|
Unit |
N/A |
|
Default |
— |
Output
Default (.Q) |
Description |
Returns TRUE if the Adder Pipe Block is initialized. See more details here. |
Data type |
BOOL |
|
Unit |
N/A |
Return Type
BOOL
Related Functions
Example
Structured Text
//Create and Initiate a Trigger object MyAdder := MLBlkCreate( 'MyAdder', 'ADDER' ); MLAddInit( MyAdder, 1.0, 0.0, 1.0, 0.0 );
|
Ladder Diagram
Function Block Diagram
MLAddReadOff1
Description
Adder Block Output = Ratio1*Input1 + Offset1 + Ratio2*Input2 + Offset2
Arguments
Input
BlockID |
Description |
ID number of an initiated Adder object |
Data type |
DINT |
|
Range |
[-2147483648, 2147483648] |
|
Unit |
N/A |
|
Default |
— |
Output
Offset |
Description |
Returns the offset value of the first entry of an Adder object |
Data type |
LREAL |
|
Unit |
N/A |
Related Functions
Example
Structured Text
//Save the offset value of first entry to the Adder block AdderOffset := MLAddReadOff1( PipeNetwork.MyAdder );
|
Ladder Diagram
Function Block Diagram
MLAddReadOff2
Description
Returns the offset value of the second entry of an Adder block. Can change the offset value with MLAddWriteOff2 function block. Offset2 shifts the value of the second input to the block before its added to the first input.
Adder Block Output = Ratio1*Input1 + Offset1 + Ratio2*Input2 + Offset2
Arguments
Input
BlockID |
Description |
ID number of an initiated Adder object |
Data type |
DINT |
|
Range |
[-2147483648, 2147483648] |
|
Unit |
N/A |
|
Default |
— |
Output
Offset |
Description |
Returns the offset value of the second entry of an Adder object |
Data type |
LREAL |
|
Unit |
N/A |
Related Functions
Example
Structured Text
//Save the offset value of second entry to the Adder block AdderOffset := MLAddReadOff2( PipeNetwork.MyAdder );
|
Ladder Diagram
Function Block Diagram
MLAddReadRatio1
Description
Returns the ratio value of the first entry of an Adder block. Can change the ratio value with MLAddWriteRat1 function block. Ratio1 amplifies the value of the first input to the block before its added to the second input.
Adder Block Output = Ratio1*Input1 + Offset1 + Ratio2*Input2 + Offset2
Arguments
Input
BlockID |
Description |
ID number of an initiated Adder object |
Data type |
DINT |
|
Range |
[-2147483648, 2147483648] |
|
Unit |
N/A |
|
Default |
— |
Output
Ratio |
Description |
Returns the Ratio value of the first entry of an Adder object |
Data type |
LREAL |
|
Unit |
N/A |
Related Functions
Example
Structured Text
//Save the ratio value of first entry to the Adder block AdderRatio := MLAddReadRatio1( PipeNetwork.MyAdder );
|
Ladder Diagram
Function Block Diagram
MLAddReadRatio2
Description
Returns the ratio value of the second entry of an Adder block. Can change the ratio value with MLAddWriteRat2 function block. Ratio2 amplifies the value of the second input to the block before its added to the first input.
Adder Block Output = Ratio1*Input1 + Offset1 + Ratio2*Input2 + Offset2
Arguments
Input
BlockID |
Description |
ID number of an initiated Adder object |
Data type |
DINT |
|
Range |
[-2147483648, 2147483648] |
|
Unit |
N/A |
|
Default |
— |
Output
Ratio |
Description |
Returns the Ratio value of the second entry of an Adder object |
Data type |
LREAL |
|
Unit |
N/A |
Related Functions
Example
Structured Text
//Save the ratio value of second entry to the Adder block AdderRatio := MLAddReadRatio2( PipeNetwork.MyAdder );
|
Ladder Diagram
Function Block Diagram
MLAddWriteInput
Description
Sets the source of an input of an adder Pipe Block. Function block is automatically called if an Adder Block is connected to other blocks in the Pipe Network.
Adder Block Output = Ratio1*Input1 + Offset1 + Ratio2*Input2 + Offset2
-
-
Adder objects are normally created in the Pipe Network using the graphical engine. Then you do not have to add MLAddWriteInput function blocks to their programs. Blocks are connected with lines in the Pipe Network, and the code is then automatically added to the current project.
Arguments
Input
BlockID |
Description |
ID number of an initiated Adder object |
Data type |
DINT |
|
Range |
[-2147483648, 2147483648] |
|
Unit |
N/A |
|
Default |
— |
|
InputID |
Description |
Select first or second input to the Adder object |
Data type |
DINT |
|
Range |
[1, 2] |
|
Unit |
N/A |
|
Default |
— |
|
InputBlockID |
Description |
ID number of an initiated Pipe Block which is an input to the Adder object |
Data type |
DINT |
|
Range |
[-2147483648, 2147483648] |
|
Unit |
N/A |
|
Default |
— |
Output
Default (.Q) |
Description |
Returns TRUE if the input to the Adder object is set See more details here. |
Data type |
BOOL |
|
Unit |
N/A |
Return Type
BOOL
Related Functions
Example
Structured Text
//Set the first input of an Adder pipeblock to be connected to the output of GEAR1 pipeblock
MLAddWriteInput( PipeNetwork.ADDER, 1, PipeNetwork.GEAR1 );
Ladder Diagram
Function Block Diagram
MLAddWriteOff1
Description
Set the offset value of the first entry of the Adder block. Offset1 shifts the value of the first input to the block before its added to the second input.
Adder Block Output = Ratio1*Input1 + Offset1 + Ratio2*Input2 + Offset2
-
-
Changes made to the Offset of an Adder block are executed immediately and can cause an axis position to jump.
Arguments
Input
BlockID |
Description |
ID number of an initiated Adder object |
Data type |
DINT |
|
Range |
[-2147483648, 2147483648] |
|
Unit |
N/A |
|
Default |
— |
|
Offset |
Description |
Desired new value for the Adder Object's Offset1 |
Data type |
LREAL |
|
Range |
— |
|
Unit |
N/A |
|
Default |
— |
Output
Default (.Q) |
Description |
Returns TRUE if the Offset value for input one is set See more details here. |
Data type |
BOOL |
|
Unit |
N/A |
Return Type
BOOL
Related Functions
Example
Structured Text
//Change the offset value of first entry to the Adder block to 10 MLAddWriteOff1( PipeNetwork.MyAdder, 10 );
|
Ladder Diagram
Function Block Diagram
MLAddWriteOff2
Description
Set the offset value of the second entry of the Adder block. Offset2 shifts the value of the second input to the block before its added to the first input.
Adder Block Output = Ratio1*Input1 + Offset1 + Ratio2*Input2 + Offset2
-
-
Changes made to the Offset of an Adder block are executed immediately and can cause an axis position to jump.
Arguments
Input
BlockID |
Description |
ID number of an initiated Adder object |
Data type |
DINT |
|
Range |
[-2147483648, 2147483648] |
|
Unit |
N/A |
|
Default |
— |
|
Offset |
Description |
Desired new value for the Adder Object's Offset2 |
Data type |
LREAL |
|
Range |
— |
|
Unit |
N/A |
|
Default |
— |
Output
Default (.Q) |
Description |
Returns TRUE if the Offset value for input two is set See more details here. |
Data type |
BOOL |
|
Unit |
N/A |
Return Type
BOOL
Related Functions
Example
Structured Text
//Change the offset value of second entry to the Adder block to 10 MLAddWriteOff2( PipeNetwork.MyAdder, 10 );
|
Ladder Diagram
Function Block Diagram
MLAddWriteRat1
Description
Set the ratio value of the first entry of the Adder block. Ratio1 amplifies the value of the first input to the block before its added to the second input.
Adder Block Output = Ratio1*Input1 + Offset1 + Ratio2*Input2 + Offset2
-
-
Changes made to the Ratio of an Adder block are executed immediately and can cause an axis position to jump.
Arguments
Input
BlockID |
Description |
ID number of an initiated Adder object |
Data type |
DINT |
|
Range |
[-2147483648, 2147483648] |
|
Unit |
N/A |
|
Default |
— |
|
Ratio |
Description |
Desired new value for the Adder Object's Ratio1 |
Data type |
LREAL |
|
Range |
— |
|
Unit |
N/A |
|
Default |
— |
Output
Default (.Q) |
Description |
Returns TRUE if the Ratio value for input one is set See more details here. |
Data type |
BOOL |
|
Unit |
N/A |
Return Type
BOOL
Related Functions
Example
Structured Text
//Change the ratio value of first entry to the Adder block to 2 MLAddWriteRat1( PipeNetwork.MyAdder, 2 );
|
Ladder Diagram
Function Block Diagram
MLAddWriteRat2
Description
Set the ratio value of the second entry of the Adder block. Ratio2 amplifies the value of the second input to the block before its added to the first input.
Adder Block Output = Ratio1*Input1 + Offset1 + Ratio2*Input2 + Offset2
-
-
Changes made to the Ratio of an Adder block are executed immediately and can cause an axis position to jump.
Arguments
Input
BlockID |
Description |
ID number of an initiated Adder object |
Data type |
DINT |
|
Range |
[-2147483648, 2147483648] |
|
Unit |
N/A |
|
Default |
— |
|
Ratio |
Description |
Desired new value for the Adder Object's Ratio2 |
Data type |
LREAL |
|
Range |
— |
|
Unit |
N/A |
|
Default |
— |
Output
Default (.Q) |
Description |
Returns TRUE if the Ratio value for input two is set See more details here. |
Data type |
BOOL |
|
Unit |
N/A |
Return Type
BOOL
Related Functions
Example
Structured Text
//Change the ratio value of second entry to the Adder block to 2 MLAddWriteRat2 ( PipeNetwork.MyAdder, 2 );
|
Ladder Diagram
Function Block Diagram