[?]: Initialization DB by default values

SIMATIC S7-200/300/400, Step7, PCS7, CFC, SFC, PDM, PLCSIM,
SCL, Graph, SPS-VISU S5/S7, IBHsoftec, LOGO ...
Post Reply
WH_Mike
Posts: 59
Joined: Sun Feb 17, 2008 10:14 pm
Location: Russian Federation

[?]: Initialization DB by default values

Post by WH_Mike » Thu Jun 21, 2012 12:34 pm

Hi!
Is it possible to reinitialize data of DB by its default values in programm - is there such FC / FB / SFC / SFB?
Or there is only one way - to make another DB with actual values identical default values and at the needed moment to copy them to needed DB?

Thanks before,
best regards.

In Russian:
Привет!
Подскажите пожалуйста, есть ли функции (FC / FB / SFC / SFB) для программной инициализации текущих значений блоков данных их исходными значениями? Или выход один - создать копию DB с исходными значениями и в нужный момент тупо копировать их в нужный DB?
Программатор (Step7) позволяет реинициализировать DB, но хотелось бы делать это программно, скажем, в ходе горячего / холодного рестарта или по определенному условию.

Заранее спасибо,
удачи!

relay
Posts: 33
Joined: Tue Jun 28, 2011 9:46 am
Location: Padova (IT)

Re: [?]: Initialization DB by default values

Post by relay » Tue Jul 03, 2012 3:04 pm

I don't think exit any SFC for this..

Guille
Posts: 32
Joined: Fri Oct 03, 2008 2:17 am
Location: America

Re: [?]: Initialization DB by default values

Post by Guille » Tue Jul 03, 2012 8:21 pm

Hi,

there is not such FC / FB / SFC / SFB.

Can i ask you why do you need do that?

I once had a discussion with a coworker about this. I knew it was not useful (except to save the final values ​​of a DB after starting the machine and can be used as reference values​​). So I searched a bit online and found this:

"The initial value is only configured once for a data block or for a newly declared variable data block. If the variable already exists, the actual value is unaffected by any change in the initial value. The only value of significance to the CPU is the value in the column headed "Actual value". Even if the initial value is also loaded onto the CPU and can be monitored there in online mode, this value is not used by the CPU."

source (What is the significance of the initial and actual values of a data block?):

http://support.automation.siemens.com/W ... reecontent

One way to save the initial value in the actual value is creating a source from DB and write manually the data (as explained in the link).
Another way is to automate the procedure using the command interface of S7 and write a program (in excel for instance) that read the offline DB in excel (reading the s7 project file), then read all the actual values (online) of this DB via OPC and write them in excel and finally save the created DB from excel to the S7 project (you can do all this with the S7 command interface even compile automatically the DB). Finally you must download the new DB to PLC (check before that the DB to download is correct and of course ALWAYS MAKE AN UPLOAD BEFORE TO DO ANY CHANGES IN PLC!!!)
I did this once and it works :D but the problem was that i cannot handle all the data types (strings, arrays and UDT were not supported by my program :( ). Anyway I only did this to learn the s7 command interface because if you read the link above you can realize that saving the actual values as initial values is useless.

Make this program is not easy task because you need to create the OPC syntax for all the data you need to read from online PLC (using your OPC server syntax and for all the data types you need to handle). Of course is not impossible do this, I only say that is a bit difficult because you have to understand how to program the OPC client (in excel for instance) very well and the s7 command interface too.

Search in google for s7 command interface or in CD2 step7 you can find help on S7 Command Interface. Also you can find useful to find on internet this file Create_S7DB_V11.xls (you can use it as starting point and also to see the use of the S7 command interface)

I hope this will be useful.

good luck!! and sorry by my bad english

WH_Mike
Posts: 59
Joined: Sun Feb 17, 2008 10:14 pm
Location: Russian Federation

Re: [?]: Initialization DB by default values

Post by WH_Mike » Tue Jul 10, 2012 10:10 pm

Thanks Guille!

"Why do I need that?"
There are couple of reason to do that, fo example:
1) at cold restart to restore settings to eleminates the changes maded at last work period
(start mashine always in one start condition, independent from previouse workman manipulation results)
2) to have the ability to restore some settings of comissioning device to default values in case of mistake / fault / error
3) may be some other reasons...

To do it by S7 command interface with using OPC and so on - it is may be very interesting, but too difficult solve.
The game don't cost a kandles. (no)
I think more esealy to have especial (source) DBs with actual data = initial data (default settings) and at needed moment to use SFC 83 "READ_DBL" (read data block in load memory) to copy a DB or an area from a DB in load memory (Micro Memory Card) to the data area of a target DB.
In this case source DB may be created with attribute UNLINKED to have the place only on MMC but not in RAM (as I understood, or may be I'm wrong? :oops: )

I hope it will be useful for someone else too.
Thanks for your attention.
Good luck!!

Post Reply