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:
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.
Actuators: All modules which should be actuators must be implemented by a function block that in turn implements the
IActuatorinterface. This interface has no methods or properties and is used only for module compatibility (see theIActuatordocumentation 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).Sequence steps
It is strongly recommended that you execute the implementation of flow steps as derived classes of the
StepBasefunction block. This provides all necessary basic implementations of theIProgramSequenceStepinterface. See theIActuatordocumentation in the library. When using the base classStepBase, it is then only necessary to implement theExecutemethod. The latter is then called cyclically by the program flow until the variablexDoneof the base class is set toTRUE. Moreover, for proper functionality, the flagxActiveshould be set toTRUEas 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.).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
Figure 67. Module:MovableBarrier
The module
MovableBarrieris implemented in the following way: The corresponding function blockMovableBarrierimplements the created interfaceIMovableBarrier. The latter interface defines methods for moving a barrier, whereasIMovableBarrieritself implements the interfaceIActuator, so that the moduleMovableBarrieris insertable as actuator in the module tree below a mechatronics unit:Figure 68. Implementation of moduleMovableBarrier
However, this actuator "MovableBarrier" is moved by the sequence step module
MoveBarrierForTime, which itself is implemented in the following way:Figure 69. Implementation of moduleMoveBarrierForTime
The module implementing function block
MoveBarrierForTimesimply derives from the library-contained base function blockAC_MEC.StepBase. By that the function blockMoveBarrierForTimealready implements the interfaceIProgramSequenceStep. Consequently the moduleMoveBarrierForTimeis insertable as sequence step under a program sequence. The functional implementation of the function blockMoveBarrierForTimeis as follows: by defining a reference slot for the moduleMoveBarrierForTime, which can hold an actuator implementing the interfaceIMovableBarrier, one gets a connection to an existing "MovableBarrier" actuator. The movement of this actuator is finally done in theExecutefunction of theMoveBarrierForTimefunction block, which simply calls the method for (pictorially) moving the protective hood. This method is provided by the referenced actuator, which implementsIMovableBarrier. Moreover the propertyDoneand the variablexActiveare coupled to a TON, so that repeatedly calls to the move functions ofIMovableBarrierare done until a certain time (TON) is elapsed after whichDoneis set to TRUE andxActiveto FALSE. The propertyDoneis part of the interfaceIProgramSequenceStepand 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.libraryalso provides some pre-implemented steps, which can be used for general, logical operations. For example this means a stepBranchOnBoolis 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 libraryAC_Mechatronics.librarycontains flow steps for parallel flows, conditional jumps or simple wait steps and many more tasks.