Schneider Unity Pro - DFB / DDT / Arrays

majorv

Member
Join Date
Jul 2006
Location
gondomar
Posts
4
Sorry for the bad English...


I'm used to Rockwell RSLogix 5000 (version 16.0)

Now I have to develop a program for a Modicon M340. It seems to have some advantages: much better"animation table" management, built-in simulation mode. The Red/Green background on Structured Text is also a plus.
On the negative side: I can't "see" a subroutine ("user function block") instance, like I can on RSLOGIX 5000.

My main issue is this: RSLogix 5000 allows me to create UDT's (User Defined Data Types), that can include Timers. Unity Pro DFB's can't include this. (timers are functions, not variables).

I'm used to create "multilevel" UDT's, nesting several UDT's. I allways call the subroutines using only InOut parameters, which is very practical.

My application for Modicon is as follows:

I have 10 machines, with 8 pneumatic valves, each one.
Each valve has an error bit, SET if the Closed/Open limit switches do not match the desired position, after a preset maximum allowed time.

I would like to define my DDT as Machine1.Valve3.Error, and so on.

On RSlogix I can call a subroutine using "Machine1" as an InOut argument and then (inside this subroutine) call the error subroutine using "Machine1.Valve3" has an InOut argument. This will use the TON I've included on "Valve" definition.

On unity Pro, I'm having dificulty to achieve the same results. I can store the "Preset time" and "internal time" values on the Machine1.Valve1 structure (as TIME data type), but I can't manage to make things work.

I would like to build a DFB "Machine" that would include several nested "Valve error" DFB's.

On "unity Pro - Program Languages and structure reference manual" I read that "Nested DFBs are declared as private variables of the parent DFB". This prevents me from using only "Public" variables.

How shall I organize my DFB an DDT to achieve my purpose ?
 
UnityPro lets you define both user defined data types (DDTs) and user defined functions (DFBs). DDTs can contain other DDTs. These DDTs can be passed into user defined functions as inputs, outputs and inouts. DDTs and user functions (logic not the interface) can be modified on line. User functions can contain other user functions.
To create a DDT (defined data type) Tools - Data Editor and select the DDT tab.
To create a DFB (defined function block) Tools - Data Editor and select the DFB tab. In each case go to the end of the table and enter the name of the new DDT/DFB, select the plus symbol to expand and add elements to your definition.
Note when the DFB is used in the program it will automatically create the data instance. This is also the case with standard function blocks. These data instances may be referenced within the program if the variables within the function are of type in, out, inout, or public.
The function block may be monitored on-line by right clicking on it and selecting refine.

Hope all this helps
Geoff
 
As to how to achieve your goal of a machine with eight valves I would do the following.
Build a valve dfb which would control the valve and monitor timeout (using a ton instruction). The interface to each of these would be a valve ddt passed as inout to the valve dfb. The eight valve ddt structures would be defined as public variables within the machine dfb. From outside the dfb you would then refer to machine1.valve1.error

I think this is what you are after

Geoff
 
To GeoffC:

thank you for your quick reply !
I'll try to implement you recommendation. I'll give some feedback later.
 
To GeoffC:

It works perfectly. Thank you.

The "Valve DFBs" included on the "Machine DFBs" are not shown on the "Derived FB Instances" Data Editor list.
This was confusing: I allways had tryed to create (first) each DFB instance on the Data Editor list, before using them on the program sections. Now I realize that this procedure is wrong.


Thanks a lot !!!
 
DDTs mapped to DFBs

Is there anyway to get these DDT and DFBs to work nicely with each other. In RSLogix5000, when you make an "DFB" it automatically makes a "DDT" to go with it. That way when I drop a function block on the page, I just need to name it and I am done. I see that you can call parts of a DFB within the program, but it does not look like you can assign an address to a DFB. So do people usually still map everything from the DFB over to the DDT? Or is there a way to automatically make that reference?
 
You can name an instance of a DFB and then use that instance name within the program to reference all the out and public variable within that dfb. Each DFB instance contains both the program and its own data. The example below shows an instance of a DFB and using that dfb instance variables within a program

Capture.JPG
 
Yes, I know that functionality, but now I want to address that PV so the HMI can read it too. I don't see anyway to address the function block instance. I see from your screenshot that you did not use a DDT with this block, rather created standalone tags for its inputs. I'm trying to avoid the numerous copy/paste find/replace that I have to do when adding new pumps or when I add a new output to the existing DFB.

Is there any talk of Schneider going away from addressing in any aspect to a tagname format that Allen-Bradley has? Function codes seem rather "old school" in comparison to the tagname ease of use.
 
I did use a DDT with the block shown, it is on the in/out variable called hmi. this ddt contains all the data that the hmi reads and writes
 
Schneider have been using a tag based system since Concept (late 90s). they are moving further away from using any addressing for io
 

Similar Topics

Hi, I've exported a PL7 application to the .FEF file succesfully. Imported the .FEF file in my Unity Pro project, but two of the five sections in...
Replies
0
Views
752
I want transfer my I/O data from schneider (Unity Pro) as a write data and RS Logix 5000 as a read data. I use Ethernet as an communication...
Replies
0
Views
682
Is there a tool to convert a ControlExpert project (.sta, .ztx or .zef in v14.1 or v15) to be opened using Unity Pro (v11 or V10) ? Thanks,
Replies
6
Views
2,155
Hi all, I'm sure this is a stupidly simple question, but I'm really struggling to find any EFB or similar to do this. I want to map a block of...
Replies
10
Views
3,330
Hi All, Can anyone explain to me: 1) What are 'PLC initialisation values", 2) What are 'Local initialisation values', and 3) Why I am getting a...
Replies
5
Views
7,616
Back
Top Bottom