AB guy with a S7 project needs help

Join Date
Aug 2007
Location
Saint Augustine, FL
Posts
178
I have a Siemens project to do in Step 7. I've never used or been trained in it, but i've been pouring over various manuals, pdfs, websites, and threads on this site. But, I need a bit of a push a this point:

Basically, I have (at least) 10 breakers to control, so I thought I'd roll all the analog and digital points up into a UDT and pass that into an add-on instruction (which, I guess, becomes a FB in S7). In a nutshell, I want a single set of ladder logic to control at least 10 different real-world components.


I'm getting no where, so I have just a few questions to help push me in the proper direction:

- Once you create a a UDT, it appears you can't make changes after you have created a data block out of it. Is this really true? I have to have every single point defined in advance?

- So, I create a UDT, then I create a data block derived from the UDT. Then I make a FB where an In-Out is of type UDT1. Then, I guess, I attempt to drop that new FB into OB1 and pass it the data block? It doesn't seem to show up that way.

- Should I make another OB that hooks up the physical I/O to the Data Blocks derived from the UDT, one for each real-world breaker?

Thanks, as always.
 
If you want a single set of ladder logic to control 10 components in the same way, you want to create an FB. You will call this FB in OB1. Each FB has a Data Block associated with it. That Data Block is analagous to Local Tags for a program, in that it is the memory associated with that FB.

You will want to put your control logic for the breakers in the FB, then call it 10 times, once for each breaker. For each time you call, your inputs to that FB will be the inputs for whatever breaker you are interested in.


Each time you use your FB, Step 7 will create a new version of your data block for that FB, called an Instance Data Block. That memory area will be used by the FB to operate on your parameters for the corresponding breaker, and will output the results to that instance of the data block. You will have to pass out that information from the FB to operate on your real world data points.

The physical I/O are passed into your call of the FB. All you have to do is line them up. The FB then does its logic, and gives you whever outputs you have defined. You map those to your physical outputs. You can do all of this in OB1.

A Data Block is just like a list of Tags. What's different is that you have a different data block for each time you call a single FB. That might be what is confusing you.

$
 
Ok, so the Manager will basically have a UDT1 (which is my breaker) and then 10 DBx's, one for each breaker, and finally a FB which happens to contain all my breaker logic, as well as a IN-OUT paramter. The FB is dropped into OB1 ten times, with each instance being handed a different DB?

What's this about an Instance Block then? On the first pass, it may run the FB with, for example, DB1 which happens to be Breaker #1. Being an "Instance", it isn't changing values inside DB1 then? Your third paragraph confused me a bit.
 
$ suggests dropping the UDT. Declare in/out parameters for the FB to define your breaker operation.
 
With the UDTs, If you've already created the datablock, then change something in the UDT, you will get errors when you open the datablock.

WHen this happens, open the datablock and select "Check and Update Accesses" from the File menu. It should update the datablock.
 
Ok, so the Manager will basically have a UDT1 (which is my breaker) and then 10 DBx's, one for each breaker, and finally a FB which happens to contain all my breaker logic, as well as a IN-OUT paramter. The FB is dropped into OB1 ten times, with each instance being handed a different DB?

What's this about an Instance Block then? On the first pass, it may run the FB with, for example, DB1 which happens to be Breaker #1. Being an "Instance", it isn't changing values inside DB1 then? Your third paragraph confused me a bit.

Sorry for the confusion. An Instance Data Block is used to view the online performance within a FB's call. Say you look at a the values inside a function block. You don't know which version of that function block you are looking, since it's used 10 times. You need the Data Block that is associated with the version of that FB call that you are interested in to populate the values inside all of the FB's parameters.

So yes, you will make DB50-59, for example, and each time you drop your FB into the logic, you will assign a DB to that instruction to handle all the values for that version of the FB.

I don't think you really need a UDT. Just pass in all your real-world data points as inputs and outputs to your FB every time you call it.

I hope this is more clear.


$
 
Ah, that example was excellent. It appears the bit I missed so far was "change to multiple instance call" (or something close to that).

And, it looks like a UDT may just complicate things.

Let me chug away on this for a few hours and see where I land.
 
Do you have access to a plc or plcsim ? - the sooner you start running code and monitoring what is going on, the better your understanding will be for further coding. You can even develop a simulation of your components to eliminate coding errors early on.
 
So, using the JUX app as a sample, I was trying to recreate my own version.

So, I now know that the "stat" area holds all the local data, and in this example, there's a timer sitting in there (#sfbFailedtoEngage). That's excellent, however, I can't seem to create anything with the datatype "TON", as the example shows.

I may be confused yet about providing a local data block, I guess. I've started with a (mostly) clean project and have only a fixed set of data types available to me when creating a STAT property.

The online help doesn't seem to be very useful on this topic.

update: I guess I have to add a system function block to the manager.
update2: I copy&pasted the SFB4. What's the proper way?
 
Last edited:
Is the problem that you can add TON to the declaration part, but you dont know how to add the declared TON in the code part ?

In LAD or FBD, the secret is to place the cursor on an empty line and then use "insert box" or ALT-F7.
An empty box will appear, and you specify the instruction as #name_of_the_TON_from_the_declaration_part.
 
When I created the JUx project, I typed in SFB4 in the data type. When you do this, simatic manager "knows" you are using a sfb and automatically drags the SFB4 block from the library into your project folder, also adding the "TON" symbol into your symbol table. When you tried to do it in a new project using the symbol name "TON" - the symbol did not exist in your project symbol table and hence failed.

Here's a screen shot showing a new fb in a new project:

sfb009001.jpg
 

Similar Topics

Hi Everyone, I have a question for the Siemens programmers here. I have been trying to recreate some of my ControlLogix boiler-plate in Step 7...
Replies
15
Views
10,561
I'm not sure if you guys still remember this project template, I'm reading it. If you can't remember, it's here (Thanks RMA). Q1: I noticed in...
Replies
14
Views
4,254
I am just beginning my journey into plc programming and troubleshooting. I’ve downloaded the Logixpro simulator and I’m already stuck on the...
Replies
12
Views
2,262
Hey all! I recently purchased myself a Panelview Plus off of ebay and i was hoping that i could upgrade the firmware on it to Version 9 or so and...
Replies
7
Views
2,744
The website , www.theplcguy.com will soon be relinquished. It is available for purchase if you wish. I have not continued my interest in a day to...
Replies
18
Views
7,127
Back
Top Bottom