S7 - Problem after modifying multiple instance FB.

RMA

Member
Join Date
Sep 2004
Location
North of Hamburg, Germany
Posts
2,052
I had to modify a multiple instance FB to add another Parameter and that meant of course that all the calls in the calling FB had to be re-entered. This is a bit of a pain, because there are 63 calls each with 9 (about to become 10) parameters. Fortunately, because of the way I've organised things, I can just redo the first three and then copy them 20 times and use Search and replaced to modify the parameters.

Fortunately, after doing the first one, I decided to save the FB before going on to do the rest (you can tell I've been bitten by Windows before, can't you). Up came a little window saying "the Block cannot be saved because the declaration table contains invalid entries". Now this surprised me more than a little because I'd just spent about ten minutes going down the Data Type column and modifying all my red FB14s by deleting and retyping the "4" and sure enough, the change was accepted and the Symbolic name in black replaced the red FB14.

Now according to the helpfile, when I click OK, the cursor should spring to the faulty entry in the declaration table, and this should turn red - but as you can see, it doesn't!

FB15_Fault.JPG


I've openened up the STAT parameters and they are correct.

Has anybody any idea what's going on here, and whether there is any way I can solve the problem without abandoning the save and going back to the old version of the FB and starting from scratch?

BTW, I've checked the whole of the declaration table, and there are no ready entries hiding down below the visible part of the window.
 
I had the same problem calling a system timer (SFB4) in a multi instance block , it was a straight forward open of an old version project , there shouldn't have been a problem . I got a similar message , an invalid entry in the declaration table . It was all ok , and ran before I opened it .
It is some time ago so I can't remember the exact detail of how everything was nested , but I recall in desperation deleting SFB4 , and calling it again - bingo , everything compiled up OK .
I was in the same boat - but had done loads of mods without a save .
 
Check and Update Access?

Perhaps I don't fully understand your situation, but it sounds similar to something I experienced. Maybe this will help.

I changed an FB's declared 'output’ to an 'input_output'. This caused a time stamp conflict with its instance DB. When I looked at the DB, it no longer contained my symbolic names but had some default names. The help files instructed to reconstruct the DB. I deleted the DB and recreated it and the project worked, but realized that was a ridiculous procedure.

One of the guys at the help line told me there are two ways (besides deleting the DB). After changing the FB, open the calling instance and click the save button. You then get a time stamp error message and the FB call turns red. Then go to 'File' > 'Check and Update Accesses' and the structure will be updated. You could also go to 'Edit' > 'Block Call' > 'Update' to change the instance DB.
 
My method for this type of update is to use "Alt-F,K", (check and update access) within the block editor. This automatically sorts out the declaration area and normally the block calls, they all update with the new parameter blank. At this point I save and then continue and add the new parameters to the block calls. I think you are stuck having saved already...
 
I changed an FB's declared 'output’ to an 'input_output'. This caused a time stamp conflict with its instance DB. When I looked at the DB, it no longer contained my symbolic names but had some default names. The help files instructed to reconstruct the DB. I deleted the DB and recreated it and the project worked, but realized that was a ridiculous procedure.


Sorry, forgot to include the fact that I had deleted and replaced the Instance DB, so that wasn't the problem.
 
My method for this type of update is to use "Alt-F,K", (check and update access) within the block editor. This automatically sorts out the declaration area and normally the block calls, they all update with the new parameter blank. At this point I save and then continue and add the new parameters to the block calls. I think you are stuck having saved already...

Mmm, should have thought about that - I have come across the command and used it a couple of times, just not enough to have it foremost in my mind. If the worst comes to the worst, I can go back to square one and then it's only the ten minutes to redo the declarations, which isn't too bad.
 
As an alternative to inserting lots if calls to a multiple instance function block you could use the following method (shown in FB3) which uses the UC (unconditonal call) instruction. You can use CC (conditional call) if you want to selectively call the FB. Essentially you:-

Assign all the inputs before the call,
Call the function block in a loop using the UC instruction,
Assign all the output results.
Adding parameters to the function block is straightforward, you just update the instance data, then cut/paste/edit the closest set of parameters to form the new parameters. Calling the block with UC means there is no interface check done so the UC in the loop will never go "red"!

On the downside, if you change the name of a parameter in the instance FB you will have to manually replace the names in the parameter assignment. As the block is called in a loop, monitoring particular instances would be a bind.

FUNCTION_BLOCK FB 1
TITLE =simple function
VERSION : 0.1



VAR_INPUT
iInputParam1 : INT ;
iInputParam2 : INT ;
END_VAR
VAR_OUTPUT
iOutputResult1 : INT ;
iOutPutResult2 : INT ;
END_VAR
BEGIN
NETWORK
TITLE =OutputResult1=InputParam1 + 1


L #iInputParam1;
L 1;
+I ;
T #iOutputResult1;
NETWORK
TITLE =OutputResult2=InputParam2 * InputParam2


L #iInputParam2;
L #iInputParam2;
*I ;
T #iOutPutResult2;
NETWORK
TITLE =end of block


SET ;
SAVE ;
END_FUNCTION_BLOCK


FUNCTION_BLOCK FB 3
TITLE =multiple instance call within a loop
VERSION : 0.1



VAR
fbQ1 : FB 1;
fbQ2 : FB 1;
fbQ3 : FB 1;
fbQ4 : FB 1;
fbQ5 : FB 1;
fbQResult1 : ARRAY [1 .. 5 ] OF INT ;
fbQResult2 : ARRAY [1 .. 5 ] OF INT ;
END_VAR
VAR_TEMP
dwar2Store : DWORD ;
iLoopCount : INT ;
dwfbQInstanceSize : DWORD ;
END_VAR
BEGIN
NETWORK
TITLE =set up Inputs 1


L 1;
T #fbQ1.iInputParam1;
L 2;
T #fbQ2.iInputParam1;
L 3;
T #fbQ3.iInputParam1;
L 4;
T #fbQ4.iInputParam1;
L 5;
T #fbQ5.iInputParam1;
NETWORK
TITLE =set up inputs 2


L 6;
T #fbQ1.iInputParam2;
L 7;
T #fbQ2.iInputParam2;
L 8;
T #fbQ3.iInputParam2;
L 9;
T #fbQ4.iInputParam2;
L 10;
T #fbQ5.iInputParam2;
NETWORK
TITLE =Call FB in a loop, FBs must be contiguous in static data !


TAR2 #dwar2Store; //save AR2 as it points to this FBs instance data, don't refer to static data in this network !
L P##fbQ1; //point to start of data
+AR2 ; //for first instance
L P##fbQ2; //point to next instance
TAK ;
-D ; //and then find the difference for size of instance data
T #dwfbQInstanceSize;
L 5; //set loop count
Loop: T #iLoopCount;
UC FB 1; //call instance FB
L #dwfbQInstanceSize; //offset to next instance data
+AR2 ; //point to it
L #iLoopCount; //check loop counter
LOOP Loop;
LAR2 #dwar2Store; //restore ar2 for this FB's instance data
NETWORK
TITLE =now get results 1


L #fbQ1.iOutputResult1;
T #fbQResult1[1];
L #fbQ2.iOutputResult1;
T #fbQResult1[2];
L #fbQ3.iOutputResult1;
T #fbQResult1[3];
L #fbQ4.iOutputResult1;
T #fbQResult1[4];
L #fbQ5.iOutputResult1;
T #fbQResult1[5];
NETWORK
TITLE =now get results 2


L #fbQ1.iOutPutResult2;
T #fbQResult2[1];
L #fbQ2.iOutPutResult2;
T #fbQResult2[2];
L #fbQ3.iOutPutResult2;
T #fbQResult2[3];
L #fbQ4.iOutPutResult2;
T #fbQResult2[4];
L #fbQ5.iOutPutResult2;
T #fbQResult2[5];
NETWORK
TITLE =end of block


SET ;
SAVE ;
END_FUNCTION_BLOCK
 
Thanks Simon, that was interesting, although I had to print it out before I could follow it, trying to follow it on screen proved to be impossible!

One question, I've never fully understood the use of the "SAVE" instruction. I notice that you use a SET, SAVE pair at the end of each block. What does this do?

Since I hit this problem yesterday, I've been thinking over how to proceed. Since I joined this project in June 2003 it has been in a constant state of flux. Now that we're at the point of delivering the first modules and they are likely to go live in the next few weeks I suspect the request for more bells and whistles is going to increase exponentially once our bunch of Prof. Dr. Dr.s start playing with their new toy. As a result I'm toying with the idea of adapting large chunks of the program to use S7Guys UDT-based system. In the six months or so since he posted it, I've learned so much from this forum, that I think I've got to the point where I can just about handle it.

If you haven't fallen over it by chance yet, you can see the original Thread here. The significant part about it is that he recalculates his offsets etc. in a Block called by OB100, so that he can modify the parameters in his UDTs without having to rebuild any of the other blocks (apart from the program mods, of course).
 
Set save ensures the ENO bit will be true when exiting the block. If I have multiple lamps for example, I drive the second lamp from the first lamp using the ENO output and a n/o contact driving a coil. You can use ENO to perform different logic depending on the results within the block (overflow etc.) I havn't seen the UDT thread - I'll have a look.
(following the program, I invisaged cutting and pasteing the bold text into a source file and then compiling it, you can then view in the more familiar Step7 editor)
 
Last edited:
(following the program, I invisaged cutting and pasteing the bold text into a source file and then compiling it, you can then view in the more familiar Step7 editor)




I very nearly did that, but my internet PC is ancient and has to S7 authorisations on it, so it was quicker just to print it out. I agree, I would have found it more comfortable to read in the STL editor
 
Hey Roy. I'm in Germany as we speak. I plan on being here three weeks, going back for a couple of weeks, and returning again for a few weeks. It would be great to get together if possible, and I'd even be able to explain the udt stuff a little better.
 
Hi S7Guy,

wondered where you'd been for the last couple of days. You haven't got Jesper in your case have you - he hasn't been in since the 5th either!

Where abouts are you staying, in two lots of three weeks it should definitely be possible to organise a visit. Unfortunately the two holiday weekends probably fall in your two weeks away - Himmelfahrt on the 5th of May and Pfingsten on the 16th. If you are going to be here on one of those days, that would probably be best, but if not, don't worry, we'll get something sorted out. We ought to see if can get Jesper and some of the others in on the act too - the chance probably won't come up that often, I guess. Might be a bit far for the UK crowd though!

By the way, if you're wondering how come I'm in the forum on a weekend, my wife's at a women only car boot sale, so I've got a special dispensation this evening!
 
Last edited:
By the way, if you're wondering how come I'm in the forum on a weekend, my wife's at a women only car boot sale, so I've got a special dispensation this evening!
OT but I have to ask. What is a car boot sale?
 
rsdoran said:
OT but I have to ask. What is a car boot sale?

Well if its the same in germany as in the UK, you take all your unwanted stuff from the loft or garage and chuck it in the boot of your car and go to a massive field where you pay for a space

People then walk round and buy stuff from you or others!

Its a bit of a craze here on a sunday

There are also some real bargains to be had if you have time to trawl through all the lots

Hence the Term "CAR BOOT" Sale
 
We call it a flea market...where the term came from I dont know, kind of expected it to be something along those lines. I knew "boot" in the UK is the same as "trunk" here in reference to a car.

I had to ask.
 

Similar Topics

I had to make some changes to the "active" FB of a multi-instance FB pair. It must have been too early in the morning, or too late at night but...
Replies
7
Views
6,092
Hi, I have had problem with upgrading some projects from v16 to v18. I tried it on 3 diffrent computers. I want to post this so that anyone that...
Replies
3
Views
116
Hi, I am having a challenge installing a new drive ACS355-03E-44A0-4 as it keeps on displaying Fault code F00018 even when the load is not...
Replies
3
Views
129
I have an issue on my vessel, we have water tight door system created in China, company is no longer operating. We have 7 doors each with their...
Replies
3
Views
113
Hi all. Simple as simple can be, I don't understand what's happening. I'm toggling he OSR on, GX_LUB_PUMP1_LEAD should switch. It doesn't. The...
Replies
27
Views
645
Back
Top Bottom