MLGearInit

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 Gear Pipe Block with user-defined settings and 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 2147483647

N/A

GEAR

ID number of a created Pipe Block.

Ratio

LREAL

No range

N/A

1.0

Ratio of new Gear Pipe Block.

  • Values lower then 1.0 can be entered, but require a leading 0 (zero).
  • Example: 0.8 instead of .8.

Offset

LREAL

No range

N/A

0.0

Offset of new Gear Pipe Block.

  • Values lower then 1.0 can be entered, but require a leading 0 (zero).
  • Example: 0.8 instead of .8.

UseUserRatioSlope

BOOL

0, 1

N/A

FALSE

FALSE to use the maximum Slope.

  • FALSE causes an instantaneous gear change within one cycle.
  • Use TRUE to use user-defined RatioSlope.

RatioSlope

LREAL

No range

1/sec

0.0

User-defined limit at which step changes in Ratio are implemented.

  • Values lower then 1.0 can be entered, but require a leading 0 (zero).
  • Example: 0.8 instead of .8.

UseUserOffsetSlope

BOOL

0, 1

N/A

FALSE

FALSE to use the maximum Slope.

  • FALSE causes an instantaneous gear change within one cycle.
  • Use TRUE to use user-defined OffsetSlope.

OffsetSlope

LREAL

No range

User unit/sec

0.0

User-defined limit at which step changes in Offset are implemented.

  • Values lower then 1.0 can be entered, but require a leading 0 (zero).
  • Example: 0.8 instead of .8.

Modulo

BOOL

0, 1

N/A

FALSE

TRUE when the mode is modulo.

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

Outputs

Output

Data Type

Range

Unit

Description

Default (.Q)

BOOL

 

 

Returns TRUE if the Gear Pipe Block is initialized.

Remarks

  • 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.
    • Choose between Modulo or Not modulo mode.
    • Slopes set the limit at which step changes in Ratio and Offset are implemented.

Modulo Value

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, the Gear block cannot detect the change in the direction of motion.

Example

  • The sample period is: 1 msec.
  • The Master is configured for a 360 degree modulo.
  • 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.

Avoid Modulo Calculation Problems

  • Either deactivate and reactivate the PipeNetwork when forcing the Master position with MLMstForcePos.
  • Use a MLMstAbs or MLMstRel move to force the Master’s position value.

Example

To force the Master position to 0 (zero), use this code:

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

  • Gear objects are normally created in the Pipe Network using the graphical engine.
    You do not have to add MLGearInit function blocks to their programs.
    Parameters are entered directly in pop-up windows and the code is automatically added to the current project.

FBD Language Example

MLGearInit: FBD example

FFLD Language Example

MLGearInit: LD example

IL Language Example

Not available.

ST Language Example

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

See Also