0% found this document useful (0 votes)
17 views18 pages

Module 3.D DFB&Diagnostic DFBs

Uploaded by

marcelodias99
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views18 pages

Module 3.D DFB&Diagnostic DFBs

Uploaded by

marcelodias99
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 18

Module 3.

DFB & Diagnostic DFB

Unity traininc course V2.0 - Module 3.D : DFB & Diagnostic DFB 1
Derived Function Block

 DFB : user logic encapsulated in a reusable block


(written to meet the specific requirement of an
application)
 Using
 the designer programs the DFB function
block model called ‘DFB type’
 The end user creates an image of this block
called "Instance", entering the parameters for
each use in the application
 DFB Export / Import utilities between
designers and users
 The DFB code is loaded only once in the
CPU
 DFBs can be protected
 DFBs are local to an application or global in
library

Unity traininc course V2.0 - Module 3.D : DFB & Diagnostic DFB 2
Principles

 DFBs include :
 input/output parameters
 public or private internal variables (declared)
 one or more sections written in LD, IL, ST, FBD

Note : one DFB can have nested-DFBs in its sections.

 DFBs are used to


 structure an application
 simplify program design and entry
 improve the readability of the program
 make debugging easier
 protect the know-how

Unity traininc course V2.0 - Module 3.D : DFB & Diagnostic DFB 3
Structure
 Creation of a DFB type under Unity Pro M L & XL

DFB Type Name


 Name : 32 characters max.
 Parameters : inputs, outputs, inputs/outputs
 Internal variables :
Copy of Outputs
Inputs Variables – public : accessible by the application
– private : not accessible by the application
 Code sections : written in LD, IL, ST or FBD
– IEC compliant, one single section
– Not IEC compliant, several sections (Not
I/O recommended)
 Comment : 1024 characters maximum without
Public Variables formatting characters
Private Variables
 Descriptive file and protection level

DFB Code

Unity traininc course V2.0 - Module 3.D : DFB & Diagnostic DFB 4
Creating - principles

Project Browser  Open a Unity Pro application


 Create a new DFB Type
Create DFB Type
 Edit the properties of the new DFB type which has been
Edit DFB Type created
 Enter the parameters of the DFB
Edit DFB Parameters
 Enter the code of the DFB in one or more sections
Edit DFB Code  Analyze the DFB type to validate it
 Debug the DFB type
Analyze DBF Type
 Export the DFB (if needed) for another application
Debug DFB Type  Use the DFB

Unity traininc course V2.0 - Module 3.D : DFB & Diagnostic DFB 5
Properties

 “DFB Types" tab in the data editor, select the DFB


and right-click => properties

 Give information about the DFB type

 Some attributes available in writing mode :


 Name
 Comment
 Protection : to choose the protection level and
the password (automatically asked after the
selection)
Note : independent of application protection
 Diag : to define if the DFB will be used in user
diagnostic DFB

Unity traininc course V2.0 - Module 3.D : DFB & Diagnostic DFB 6
I/O interface

 Inputs : 32 max
DFB Type Name  in read-only by the DFB
 to transfer the value from application to
DFB
Inputs Outputs  type and name (32 characters max)
 Outputs : 32 max
 in write-only by the DFB
 to transfer the value from DBF to
application
I/O  type and name (32 characters max)
 Inputs/Ouputs : 32 max
Public Variables  in read/write by the DFB
Private Variables  transfer the value to DFB, modify it and
return it to application
DFB Code  type and name (32 characters max)

Unity traininc course V2.0 - Module 3.D : DFB & Diagnostic DFB 7
Variables

 Private : unlimited
DFB Type Name
 internal variable of DFB
 only used for programming the DFB (eg :
Copy of intermediate calculation)
Inputs Variables Outputs
 name (8 characters max)
 Public : unlimited
 internal variable of DFB
 can be accessed by application or user in
adjust mode outside the block (read or
I/O
write rights)
Public Variables  name (8 characters max)
Private Variables
 The values of public variables, modified by
program or by adjustment, can be saved in
DFB Code place of the initial values, by setting %S94(to 1)

Unity traininc course V2.0 - Module 3.D : DFB & Diagnostic DFB 8
Code

 Structured in sections :
DFB Type Name
 IEC compliant, one single section
 Not IEC compliant, several sections
Copy of
Inputs Outputs
Variables
 Section
 written in instruction list,structured text,
ladder language, functional block diagram
 a symbolic name (32 characters max)
 a validation condition
I/O
 protection attribute (no protection, write-
protected, read/write-protected)
Public Variables
 comment (maximum of 256 characters)
Private Variables

DFB Code
 Use only the parameters defined for the
function block or the system words and bits

Unity traininc course V2.0 - Module 3.D : DFB & Diagnostic DFB 9
Example : create

 Name : Parts_counter
 Inputs :
 Rst : reset the counter
 Preset : counter preset value
 Count : counter input
 Output :
 Done : preset value reached output
 Public variable :
 Cur_val : current value increment by the
count input
 Code
 Descriptive form

Unity traininc course V2.0 - Module 3.D : DFB & Diagnostic DFB 10
Use - principles
Project browser

 Open a Unity Pro application


Instantiate DFB type
 Import DFB type (if needed with control of the
version)
Open a section

 Instantiate the DFB type


Edit the program
 Open a program section

 Edit the program with DFB instantiation


Modify the Parameters
 Modify the parameters (initial values)

Transfer & test the  Transfer and Test the program


Program

Unity traininc course V2.0 - Module 3.D : DFB & Diagnostic DFB 11
Use - example

 DFB instantiation :
 DFB instances used under Unity Pro, L or XL
 in all application tasks except event tasks and
SFC transitions

 DFB instance used as :


 a standard block in LD or FDB language
 an elementary function in ST or IL language

Unity traininc course V2.0 - Module 3.D : DFB & Diagnostic DFB 12
Overview

 Right tool for application diagnostics


 Application controlled in the PLC program

 Embedded diagnostic
 to make a diagnostic at source (directly at the PLC level)

 Possible to create its own diagnostic DFBs (Quantum & Premium)

 List of predefined Schneider diag DFBs


 ALRM_DIA : simplified event monitoring (Quantum & Premium)
 EV_DIA : event monitoring (Quantum & Premium)
 MV_DIA : movement monitoring (Quantum & Premium)
 ASI_DIA & A2SI_DIA : monitoring of devices on the AS-i bus
(only for Premium)

Unity traininc course V2.0 - Module 3.D : DFB & Diagnostic DFB 13
Principle

Detecting Memorizing
Viewing VIEWER
Diag DFB Diag BUFFER

PLC Viewer 1
Application Message
Diag Acknowledge
Buffer

Registration
Acknowledge
Viewer 2
Message
Date

Unity traininc course V2.0 - Module 3.D : DFB & Diagnostic DFB 14
Registration

 Alarm Registration
 The error registration instruction REGDFB ( ) write a time
stamped record inside the Diag buffer when an error occurs.
 Many registrations can be managed inside a same DFB (up to 4
registrations)
 Use only inside Diagnostic DFBs

 Syntax
 REGDFB (AREA, 16#0062, SLEN, CTRL, PIN, VALPIN,
ESTS, ERID, STAT

Unity traininc course V2.0 - Module 3.D : DFB & Diagnostic DFB 15
De-registration

 Alarm De-registration
 The ‘de-registration’ instruction DEREG ( ) updates inside the
buffer the date and time attached to the error disappearance
 The Message will be deleted inside the buffer only when ALL the
Viewers have got the acknowledgment information
 Use only inside Diagnostic DFBs

 Syntax
 OUT := DEREG(ERID);
Note: the alarm remains saved in the diagnostics buffer until the
error is acknowledged (for errors that require acknowledgement)
and read by all Viewers.

Unity traininc course V2.0 - Module 3.D : DFB & Diagnostic DFB 16
Creation

 Activate the Diagnostic options inside the application


(Tool => Project settings)

 Create a new DFB type in the variable editor


or
Import the source code of the ‘ Model ’ Diag DFB if
necessary

 In the properties of this DFB type, activate the Diag


option

 Declare the DFB Input/Output and internal variables


Note : All inputs monitored must have its own Diag
property selected

Unity traininc course V2.0 - Module 3.D : DFB & Diagnostic DFB 17
Creation (cont)

 Type the descriptive form

 Type the code


 use of REGDFB( ) and DEREG ( )
instructions
Note : The PIN parameter is the order number of
monitored inputs

 Instantiate the DFB


 Customize the default messages
 Debug the DFB

 Export the DFB

Unity traininc course V2.0 - Module 3.D : DFB & Diagnostic DFB 18

You might also like