S7 cyclus time

Thim

Member
Join Date
Mar 2008
Location
Belgium
Posts
392
Hi folks do some of you poeple know how to decrease cyclus time.
I made some program put it in some plc, when i was checking the cyclus time i noticed i had 370ms does some of you know some tricks how to decrease this.

I do this for fun so it isn't a real problem but i'm wondering why it is so big, when i simulated this on my pc it is only like 27ms.


Thanks alot
 
I'm using 314C-2-DP
I do this programming for fun but like to really know this.
I can tell you that there is alot calculation in the program an few loops i know they take time but i didn't know it was so much.
If you remember my previous post i allready took your advice to change
*8 to sld 3
Would it be much beter with a 317??
The plc i have i took from my job to play at home we have a few plc as spare but this was the highest one at the moment.
 
I use the 317-2DP 99% of the time and the only comparison I have is with a 315-2DP which I tried a few years ago - suffice to say the 315 ended up in the bin :)

If you have PLCSIM why bother with the 314 ?

If you want your program analysed then post it as a zipped archived project (if it is small enough)
 
Last edited:
A 317 would be about 10x faster. I would suggest you are probably running a bunch of code over and over again that probably should not be.


Nick
 
Why bother the 314 i was also play with the profibus :)
I took some et200S from my job just for fun and setup a profibus with 314 et200S and MP370.
I never did it before so like i told you i do this for fun in weekends :)

LD[AR2,p#0.0]

Zipped it is 156kb but how do i add a attachment in this forum.

Nick
Euhm i don't think the code is so big but the DB's i'm read and write are very big 25 kb i allready had to down size them because the 314 only can handle db of 16 kb
 
Last edited:
When you reply, scroll down to the additonal options pane and click on the Attach Files button, select your file and upload it. I don't know the file size limit, but I just did a 300k zip for test and it appeared to upload.
 
The comments in the program are not in english but dutch if you would like any explaination let me know.
I'm looking forward for your comments on it

It is only the program no hardware config in it

Thx
 
Here's my partially re-coded (but not tested) version of FB150.

Where possible use temp/stat variables inside the loops instead of global DB accesses, then you don't have to keep opening the DB every time. Where possible, use AR1 for indirect addressing instead of a temp variable containing the pointer.
 
Ok if i understand it well you opn the db before the loop and than your are like working in the db where i opn it every time during the loop is that the big difference ?? or do i misjudge it?
You also took the DB100.DBW214 and loaded it to a temp of FB150.
Does this things give you a faster cyclus?
I could be because you are working only in FB150 where i work in FB150 and DB100 during the loop and you only once before the loop

I also understand your [AR1,P#4.0]etc
but is there a way to make the P#4.0 variable.
Now i also wrote that network with fixed values like P#4.0 etc but in the end i would like to make the whole program variable and configurable from db100(udt110). Then the P#4.0 would be DB100.DBW408 - DB100.DB412
The meaning of that if i would change the udt100 and would add an extra value in it I can change the values in UDT100 and the program would work with new values just like that no reprogramming has to be done. Just some configuration and the software is calculation everything it self.


Just one more question

L "Data DB UDT110".DATA_DB.Aantal_recepten;
OPN DB [#DB_nr_recepten];
nex2: T #Loopteller1;

If you write this isn't there a possibility that you load the value of the db into the loopcounter instead of the value of db100.dbw214

I will test it in a few moment myself

thx alot allready
 
Last edited:
The difference will depend on how many times the loops are executing.

Here's FB153 re-coded using AR1/2 to copy between two DB's


To make the program automatically work if you change the UDT layout means removing all the hardcoded P# and a re-assessment of the design....
 
Thim said:
L "Data DB UDT110".DATA_DB.Aantal_recepten;
OPN DB [#DB_nr_recepten];
nex2: T #Loopteller1;

If you write this isn't there a possibility that you load the value of the db into the loopcounter instead of the value of db100.dbw214

NO.

Note your code below relies on this:

Code:
	  OPN   DB [#DB_recept_gegevens]
	  L	 DBD [#Adreswijzer1]
	  OPN   DB [#DB_lijn1]
	  T	 DBD [#Adreswijzer4]
 
You are fast man.
I'm still studing the fb 150 :)

this i don't understand at all from fb153 everything i learned is from selfstudy but never saw something like this


CDB ; //don't know this command
L DBNO; //don't know where you get this from or what it is if i look well i didn't find it back in the declaration table sorry
T #iInstanceDBNo; // ok you transfer a value from DBNO to here
TAR2 #dwAr2Store; // i think you transfer the ar2 to here but why you call it further 3 times but never write in it don't understand this either

// Ok you transfer Adreswijzer 1 and 4 to AR1 and AR2
LAR1 #Adreswijzer1;
LAR2 #Adreswijzer4;
L "Data DB UDT110".DATA_DB.Aantal_recept_gegevens;
OPN DB [#DB_recept_gegevens];
OPN DI [#DB_lijn1];
nex1: T #Loopteller1;
L DBD [AR1,P#0.0];
T DID [AR2,P#0.0];
+AR1 P#4.0;
+AR2 P#4.0;
L #Loopteller1;
LOOP nex1;

// ok because i use adreswijzer 4 again later in the program you send the new value from AR2 back in to Adreswijzer4 so the rest keeps on working with the correct adress
TAR2 #Adreswijzer4;

// why do you send dwar2store in to ar2 and why do you opn DI once again don't understand this
// like i see it nework later i overwrite it again with adreswijzer4
LAR2 #dwAr2Store;
OPN DI [#iInstanceDBNo];
 
Last edited:
CDB ;
L DBNO;
T #iInstanceDBNo;
TAR2 #dwAr2Store;

ok i allready know what the commands are but not why you do it

CDB // swap data block register
// but what is in the data block register and why swap them it probably would get clear if i would know what is in there

L dbno // load global data block number
// but what is the global data block number and where does the program get it from probably out of the register

pff I think i still have to read and learn alot
 
I should have used
Code:
L DINO
T iInstanceDBNo

The instance DB and AR2 are used to access the FB interface area (IN, OUT, IN_OUT, STAT) so if you want to use them you must save them first, perform your processing and then restore them. Note that whilst you have modified AR2 or the instance DB number, you must not refer to any variables in the interface area.

As an example to show what is going on, enter the following line of code in FB153 and then save the block.

Code:
L DIW[AR2,p#0.0]

The editor will automatically replace the code with the correct variable name from the STAT area.
 
Last edited:
Back
Top Bottom