Passing a large INOUT to FC in S7-300

.. and here is the STL generated by the compiler:

The boxed code is what is executed for every UDT variable reference in the orignal STL case. The SCL compiler is smarter and only needs to perform the dereferencing once in this example.

sz3.jpg
 
Here are the size of the blocks - a dramatic difference in size can be seen with just 10 load/transfer pairs. FC's can get very large very quickly when referencing UDT variables.

sz4.JPG
 
Changing the FC to an FB using the above method of referencing data only take a couple of minutes if you edit the FC source code and re-compile it as an FB

sz5.jpg
 
Hi Guys,

Really appreciate the input on this. So it appears in memory terms its a lot more efficient to using an FB and instance DBs to an FC and a shared DB.

Is there anything wrong with using the method I am currently using? Does this mean for 100 instruments I need to have 100 DBs. Seem like that can make a rather large project.

What I like about my method( although it appears its the wrong one) is that once the FC is tested you can forget about and have all assiocated data in one place.

I am a bit concerned about the size of the structure though (250 Bytes)
 
o
Hi Guys,

Really appreciate the input on this. So it appears in memory terms its a lot more efficient to using an FB and instance DBs to an FC and a shared DB.

Is there anything wrong with using the method I am currently using? Does this mean for 100 instruments I need to have 100 DBs. Seem like that can make a rather large project.

I have no S7 on this PC, but if I remember the S7Guy example correctly, it consisted of one motor-DB with an array of UTDs. Prior to calling the motor-FB, he calculated the address pointer to the acutal motor UTD, and passed it to the motor FB via AR2.
If anyone has the example at hand, please correct me.


And look at Bara_Hence's suggestion in post 10. With that method you could keep the data for each type in one DB.


And if you post the structure, you could get some advices from the wise guys here
icon12.gif
.

Kalle
 
Last edited:
Is there anything wrong with using the method I am currently using?
It will work, only the programming will be slightly inefficient as LD has visualised so perfectly.

Does this mean for 100 instruments I need to have 100 DBs. Seem like that can make a rather large project.
I have a project right now where I have around 300 "object", and each is defined by an FB (reused for many objects) and an IDB. So I have around 300 IDBs. I also have a few shared DBs for data exchange with the HMI as I described earlier.

An alternative to your method of a shared DB, is to go FB plus multiple instance DB. It gets you the same effect of having just one DB, but the programming is as efficient as regular FB+IDB.

One advantage of NOT storing everything into one DB (shared DB or multiple instance IDB) is that you can add or modify one DB while the rest of the plant is unaffected.
 
Block won't download into an s7-314.

Error message is the block/ op.sys update is too large

We are stll none the wiser about this - is the DB too big, the FC with the INOUT parameter too big, the block that calls the FC too big (because it is calling it 100 times?).
 
Yes, if the download problem has been solved would be interesting to know.

Besides, I notice that it original program is a ControlLogix, and the new CPU is an S7 314. The 314 has got a significant performance boost in the latest generation, but it is still going from a potent to a less potent CPU (and far less expensive too !).
And the worry about 250 bytes being a lot or not, I mean 250 bytes is nothing !
And, with 100 sensors in the plant, it is not such a small project. At least you could have chosen a PN CPU, like the 315-2PN/DP.
 
Hi all,

Never figured out why it would not accept a download when passing the UDT in as an INOUT.

I have cut the block back to 100 Bytes now and have posted my code for the block.

Please comment!!! If its bad please tell me, I havent done much S7.
 

Similar Topics

I'm using FactoryTalk ME version 13. I'm aware how to pass a parameter file once, but I was wondering if it is possible to do it twice...
Replies
4
Views
164
I inherited a project in which a ME application displays process measurements (temp, pressure, flow, etc) on a PanelView Plus display. The data...
Replies
4
Views
505
My first real attempt at utilising the AOI function in Compactlogix. The issue I'm having is, I have an array of INT[400], but in my AOI I'm only...
Replies
1
Views
470
Hi guys. Sorry for the dumb question but I am still new. I have learned to pass Parameters using an HMI tag so far. Can I write directly to the...
Replies
1
Views
929
Hi guys, A dumb question, but is it possible to pass values to tags using parameter files in Ftview SE ver 11? TIA
Replies
2
Views
1,472
Back
Top Bottom