STRUCT

Top 

 

In a structure you save several values which have got a different meaning but which still belong together. If you got the instruction to program the luggage system of the new Denver Airport (what we do not whish you) you would have constructed a STRUCT of the following structure for each incoming piece of luggage:

 

       Suitcase      STRUCT      Description of a piece of luggage

       Owner         DWORD       Identification of the owner

       Length        INT         Length in mm

       Heigth        INT         Height in mm

       Thickness     INT         Thickness in mm

       Weigth        INT         Weigth in kg

       Destination   DWORD       International identification of the destination

                                 airport

                     ENDSTRUCT

 

As long as you treat the piece of luggage as a whole thing just use the name #suitcase, but if you want to know whether it can pass a special passage because of its height you will have to access a single element of the structure by using the structure name followed by a ‘.’and the name of the element:

 

        L  #Suitcase.Height

 

In TrySim the strict type check is valid with structures exceptionally. Calling a FB(FC) that expects a STRUCT as parameter you can only transfer a STRUCT with exactly the same construction. The names of the elements are not important but the data types have to tally.

 

See also:

Data Types