STIME - isn't there a more simple way

Begonnen von AkosMurin, 27. März 2009, 07:58:04

Vorheriges Thema - Nächstes Thema

0 Mitglieder und 2 Gäste betrachten dieses Thema.

AkosMurin

Hi,

I'm new to OSCAT and have seen the porting to Step7.
The STIME function seems to be too complicated to me.
Don't You think that following would be more simple?

Important: I write my personal opinion here, please correct me if I'm worng.

1) At warm or cold start the tx:=0 -> this is possible from OB100 directly.
2) In OB1 read the OB1_PREV_CYCLE and add it to tx
3) If tx (as DWORD) is bigger than (2^^32-1) then substract that from tx.

Add 1) I think that within a single PLC cycle time is frozen, therefore there is no reason to read system time more than once.
         Therefore tx shoul be stored at a central location (DB or M) and normal functions should only read this.
         Cyclic initialization of tx should occur at the beginning of each cycle only once.
         This is especially stands for STIME, since in a normal control program it might be called many many times.

Add 2) Add 1) Stands for other PLC-s also.

Add 3) It might be necessary to update tx within a PLC cycle in some cases - although I do not see a reason now.



Skotti

Zitat von: AkosMurin in 27. März 2009, 07:58:04
Add 1) I think that within a single PLC cycle time is frozen, therefore there is no reason to read system time more than once.
         Therefore tx shoul be stored at a central location (DB or M) and normal functions should only read this.
         Cyclic initialization of tx should occur at the beginning of each cycle only once.
         This is especially stands for STIME, since in a normal control program it might be called many many times.
Add 3) It might be necessary to update tx within a PLC cycle in some cases - although I do not see a reason now.

It is necessary, because some functions could be started in different OBs (for example OB35 etc.). Or the OB1 cycle is interrupted by another OB and therefore the OB1 cycle time is increased.

Skotti

dalbi