Data type unit (dut), L-force | plc designer – Lenze PLC Designer PLC Designer (R3-1) User Manual

Page 81

Advertising
background image

L-force | PLC Designer

Concepts and Base Components

DMS 4.1 EN 03/2011 TD29

79

Now assume that fubbase of the upper example contains two methods method1 and
method2. fub1 overrides method2 but not method1.
method1 is called like shown in the upper example:

pInst^.method1(); (*If b is true fubbase.method1 is called, else fub1.method1 is
called*)


Call via THIS-pointers:
Let's have a look at the body of method1:

METHOD method1 : BOOL
VAR_INPUT
END_VAR
method1 := method2();

For calling fubbase.method1 via THIS pointers the following is true:
If THIS is of type fubbase, fubbase.method2 will be called. If THIS is of type fub1,
fub1.method2 will be called

3.7.4

Data Type Unit (DUT)
Along with the standard data types the user can define own data types. Structures,
enumeration types and references can be created as Data Type Units (DUTs) in a DUT
editor.
For a description of the particular standard and the user defined data types see 'Data
Types'.

A -DUT object can be added to the project via the Add Object command. To assign it
to an existing application, first select the application entry in the Devices view.
Otherwise it will be added to the POUs view. In the 'Add DUT' dialog enter a name for
the new data type unit and choose the desired type Structure, Enumeration, Alias or
Union.
In case of type "structure" you might utilize the principle of inheritance, thus
supporting object oriented programming. Optionally you can specify that the DUT
should extend another DUT, which is already defined within the project. This means
that the definitions of the extended DUT will be automatically valid within the current
one. For this purpose activate option Extends: and enter the name of the other DUT.
After confirming the settings with button Open the editor window for the new DUT
will open and you can start editing.

Advertising