Skip to main content

Library: Mechatronics

Tip

The Mechatronics library is meant to be an example for a simple (and not complete) implementation of a mechatronic unit with sequential execution. It does not meet all the requirements that a complete mechatronic application might have. Rather, it is intended to be an entry point or basis for an application of this type.

The essential core of the proposed mechatronics model bases on the following module structure:

Figure 65. Application Composer example Mechatronics
Application Composer example Mechatronics


So any machine is assumed to possibly have several mechatronic subunits (example: each representing a gripper). Such a subunit again splits up into its actuators (equaling the mechanical unit itself, also its functional implementation or I/O management) and a program manager. The program manager is intended to manage the different states of a mechatronic subunit, for example its Idle or Execute state. Eventually those states are represented by program sequences controlling the actuators or anything else needed for a proper execution.

At this point, the various parts will be briefly described in detail. When using the library, in many cases it will be necessary to implement your own actuators, flow steps, or program sequences, which will also be explained here.

  1. Actuators: All modules which should be actuators must be implemented by a function block that in turn implements the IActuator interface. This interface has no methods or properties and is used only for module compatibility (see the IActuator documentation in the library). There are no restrictions or rules given for actuator implementations, so that the movement or activation of such an actuator has to be done separately. Normally this is done, by implementing a sequence step module, which can hold the proper actuators in a reference slot and thereby move the latter in the desired way (e.g. using additional interfaces).

  2. Sequence steps

    It is strongly recommended that you execute the implementation of flow steps as derived classes of the StepBase function block. This provides all necessary basic implementations of the IProgramSequenceStep interface. See the IActuator documentation in the library. When using the base class StepBase, it is then only necessary to implement the Execute method. The latter is then called cyclically by the program flow until the variable xDone of the base class is set to TRUE. Moreover, for proper functionality, the flag xActive should be set to TRUE as long as the step is active. However, the connection to actuators can be done in any which way, e.g. by the proposed reference slots (see 1.).

  3. Program sequence and program manager A program sequence is a submodule of a program manager, which represents a state. These states are managed in the form of an OMAC state machine. Its implementations again bases on a method "Execute" (for details see implementation in the library). However, the implementation of such a program flow by the user is not necessary in most cases. However, the way in which the behavior of the status machine is implemented in the program manager and thereby executes the program sequences shall be briefly described here:

    There are two types of states: acting states (ending with "ing") and waiting/dual states (the rest). The waiting states are ended by external commands, whereas the acting states are automatically executed and ended. Available commands depend on the state in which the program manager is at the moment. A short overview is given in the OMAC state diagram:

    Figure 66. OMAC diagram
    OMAC diagram


    Figure 67. Module: MovableBarrier
    Module: MovableBarrier


    The module MovableBarrier is implemented in the following way: The corresponding function block MovableBarrier implements the created interface IMovableBarrier. The latter interface defines methods for moving a barrier, whereas IMovableBarrier itself implements the interface IActuator, so that the module MovableBarrier is insertable as actuator in the module tree below a mechatronics unit:

    Figure 68. Implementation of module MovableBarrier
    Implementation of module MovableBarrier


    However, this actuator "MovableBarrier" is moved by the sequence step module MoveBarrierForTime, which itself is implemented in the following way:

    Figure 69. Implementation of module MoveBarrierForTime
    Implementation of module MoveBarrierForTime


    The module implementing function block MoveBarrierForTime simply derives from the library-contained base function block AC_MEC.StepBase. By that the function block MoveBarrierForTime already implements the interface IProgramSequenceStep. Consequently the module MoveBarrierForTime is insertable as sequence step under a program sequence. The functional implementation of the function block MoveBarrierForTime is as follows: by defining a reference slot for the module MoveBarrierForTime, which can hold an actuator implementing the interface IMovableBarrier, one gets a connection to an existing "MovableBarrier" actuator. The movement of this actuator is finally done in the Execute function of the MoveBarrierForTimefunction block, which simply calls the method for (pictorially) moving the protective hood. This method is provided by the referenced actuator, which implements IMovableBarrier . Moreover the property Done and the variable xActive are coupled to a TON, so that repeatedly calls to the move functions of IMovableBarrier are done until a certain time (TON) is elapsed after which Done is set to TRUE and xActive to FALSE. The property Done is part of the interface IProgramSequenceStep and thereby tells the superordinate program sequence, that the next sequence step shall be executed.

    Apart from your own implementation of sequence steps, the AC_Mechatronics.library also provides some pre-implemented steps, which can be used for general, logical operations. For example this means a step BranchOnBool is provided, which has two sub sequences / branches of steps, which are executed based on the value of a BOOL variable. These substeps are executed depending on the value of a Boolean variable. Furthermore, the library AC_Mechatronics.library contains flow steps for parallel flows, conditional jumps or simple wait steps and many more tasks.