FunctionMLGearInitPipe Network motion icon

Description

Initializes a Gear Pipe Block for use in a PLC Program. This function block is automatically called if a Gear Block is added to the Pipe Network, with user-defined settings entered in the Pipe Blocks Properties screen.

The Pipe Block is assigned a Name, Ratio, Offset, and Slopes for changes in Ratio and Offset values. You can also choose between Modulo or Not modulo mode. Slopes set the limit at which step changes in Ratio and Offset are implemented.

The output of a Gear Block = Input value * Ratio + Offset


  • Be sure to set RatioSlope < (Ratio * EtherCAT Update Rate). The Gear block will make a jump (without a ramp) from one gear to the next when the RatioSlope is greater than the Ratio change factor multiplied by the update rate scale factor.


  • If the Gear block's input is a modulo value, and the position delta is greater than ½ the modulo value within one sample period in the opposite direction, then the Gear block cannot detect the change in the direction of motion. As an example, suppose the sample period is 1 msec and the Master is configured for a 360 degree modulo and the Master position is changed by >180 degrees within 1 msec. In this case the Gear block cannot determine whether the direction is in the same or opposite direction.

    To avoid modulo calculation problems, either deactivate and reactivate the PipeNetwork when forcing the Master position with MLMstForcePos, or use a MLMstAbs or MLMstRel move to force the Master’s position value. For example, to force the Master position to zero you could do the following:

    PipeNetwork(MLPN_DEACTIVATE);
    MLMstForcePos(PipeNetwork.MASTER, 0);
    PipeNetwork(MLPN_ACTIVATE);


  • Gear objects are normally created in the Pipe Network using the graphical engine. Then you do not have to add MLGearInit 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

GEAR

Ratio

Description

Ratio of new Gear Pipe Block. Values lower then 1.0 can be entered, but require a leading zero (for example 0.8 instead of .8)

 

Data type

LREAL

 

Range

 

Unit

n/a

 

Default

1.0

Offset

Description

Offset of new Gear Pipe Block. Values lower then 1.0 can be entered, but require a leading zero (for example 0.8 instead of .8)

 

Data type

LREAL

 

Range

 

Unit

n/a

 

Default

0.0

UseUserRatioSlope

Description

FALSE to use the maximum Slope, causing an instantaneous gear change within one cycle. TRUE to use user-defined RatioSlope

 

Data type

BOOL

 

Range

0, 1

 

Unit

n/a

 

Default

FALSE

RatioSlope

Description

User-defined limit at which step changes in Ratio are implemented. Values lower then 1.0 can be entered, but require a leading zero (for example 0.8 instead of .8)

 

Data type

LREAL

 

Range

 

Unit

1/sec

 

Default

0.0

UseUserOffsetSlope

Description

FALSE to use the maximum Slope, causing an instantaneous gear change within one cycle. TRUE to use user-defined OffsetSlope

 

Data type

BOOL

 

Range

0, 1

 

Unit

n/a

 

Default

FALSE

OffsetSlope

Description

User-defined limit at which step changes in Offset are implemented. Values lower then 1.0 can be entered, but require a leading zero (for example 0.8 instead of .8)

 

Data type

LREAL

 

Range

 

Unit

User unit/sec

 

Default

0.0

Modulo

Description

TRUE when mode is modulo. Modulo mode adapts the output values according to the ModuloPosition (modulo)

 

Data type

BOOL

 

Range

0, 1

 

Unit

n/a

 

Default

FALSE

Output

Default (.Q)

Description

Returns TRUE if the Gear Pipe Block is initialized

See more details here

 

Data type

BOOL

 

Unit

n/a

Return Type

BOOL

Related Functions

MLBlkCreate

MLGearWriteRatio

Example

Structured Text

//Initialize a Gear Pipe Block named GEAR1 with:
// Ratio = 1,Offset = 0, User Ratio Slope OFF, User Ratio
// Slope = 0, Offset Slope = 0, and no Modulo
GEAR1 := MLBlkCreate( 'GEAR1', 'GEAR' );
MLGearInit( GEAR1, 1.0, 0.0, false, 0.0, false, 0.0, false);

Ladder Diagram

MLGearInit: LD example

 

Function Block Diagram

MLGearInit: FBD example

Go back to the top of the page [Top]