Lesson 21 Derived Data Types

Download Report

Transcript Lesson 21 Derived Data Types

Concept V2.5
 Lesson 21 Objectives:
 After completing this lesson, the learner will be
able to:
•
•
•
•
Recognize IEC Derived Data Types
Identify the types of Derived Data Types
Recognize the elements of the Data Type Editor
Distinguish between Global and Local Derived Data
Types
• Use Derived Data Types in your project.
Concept V2.5
 Example:
 DFB “M_Logic” needs to send three signals of the
data type BOOL to DFB “M_Alarm”
Concept V2.5
 Array Example
 Declaration
 Logic
• 3 Values,
1 Link
Concept V2.5
 Array Example Cont’d
Concept V2.5
 STRUCT Example
 DFB “M_logic1`” needs to send two signals of
different data types to DFB “M_alarm1”
Concept V2.5
 STRUCT Example
 Declaration
 Logic
• 2 Values,
1 Link
Concept V2.5
 STRUCT Example
Concept V2.5
 Example of Complex DDT
 Declaration
 Logic
Concept V2.5
 Example of Complex DDT
Concept V2.5
 Files use the .dty extension
 CONCEPT software supports only one
local data type file for each project folder
(project\dfb\*.dty) and only one global data
type file (concept\dfb\*.dty) for all projects.
 In order to assure consistency between
programming unit and the Quantum PLC,
the project that contains one of the
derived data types must be reloaded into
the Quantum whenever one of these files
has been edited.
Concept V2.5
 Keywords
 TYPE END_TYPE Start / End of Data type
definition
 STRUCT END_STRUCT
Elements
Start / End of DDT-
 ARRAY Several elements of same data type
 Data types Names of defined Data types,
conclusion with " ; "
Concept V2.5
 Syntax
 Names of derived data types and elements, max.
24 characters, conclusion with separator " : "
 Separator
• : End of name
• ; End of instruction
• [ ] Embraces the range entry of the keyword
ARRAY.
• . . Separates beginning and end of range of the
keyword ARRAY
 Comment: (* at the beginning, comments, at the
end *)
Concept V2.5
 Creating the Derived Data Type File
Local
Global
Concept V2.5
 Creating the Derived Data Type File
Concept V2.5
 Declaring variables with a DDT
 The new DDTs are automatically included in the
Variable Editor under data type.
 Assignment of an element of a Multi Element
Variable:
• in FBD with FFB connection pins
• in SFC with Step properties
 Array Data Type displayed as:
Variable_name[Index_number]
 Structured Data Type displayed as:
Variable_name.element_name
Concept V2.5
 Declaring variables with a DDT
Concept V2.5
 Assigning DDT variables
Concept V2.5
 Assigning DDT variables (subcomponents)
Concept V2.5