Adding a Constant tag to an existing DB Simatic Step 7

Tomo453

Lifetime Supporting Member
Join Date
Mar 2018
Location
Mt. Juliet, TN
Posts
83
Hello,
I have posed a similar question before, but the DB then provided me with pre-allocated "spares". In this instance I need to declare a constant that is initialized in another function. The constant is a speed value that is chosen by a separate "speed selector" function. The speed constants are in a standard data block and I want to add a constant "tag" "Idle_Creep", and have the value written to the address from another function "initialize_material_constants". Can I add this constant by adding it to the declaration view of the DB? Will I then need to download the edited DB or will I copy and paste from Offline to Online? I would like to not have to download the entire project. I am using Siemens Simatic S7 v 5.5 and 300 series controllers.
 
Last edited:
When are the material constants initialised - when the plc powers on or what? Where does the function get its data from to perform the initialisation?
 
When are the material constants initialised - when the plc powers on or what? Where does the function get its data from to perform the initialisation?

The constants are initialized at power up or from an "initialize PLC" button on a configuration page of a WinCC HMI. There is an FC that writes the other constants' values of that DB via load and transfer commands to the tag name(s).
 
Just a comment, what you describe is not a constant but a variable.

As to how to add the variable to an existing DB on a running machine:

1. Change the variable in the existing DB (important, only change an existing variable of the same size).
Do not download the DB.
Initialize the variable by setting it in a VAT table.
Disadvantage: You cannot go online with the DB.

2. Open an unmodified backup of the project.
Save the project to a new name.
Upload the DB by dragging and dropping from the online blocks folder to the offline blocks folder.
Check that the DB has not lost its symbols.
Change the variable.
Save the project again.
Download the DB.
Disadvantage: The DB content may have changed between the upload and the download.
 
Just a comment, what you describe is not a constant but a variable.

2. Open an unmodified backup of the project.
Save the project to a new name.
Upload the DB by dragging and dropping from the online blocks folder to the offline blocks folder.
Check that the DB has not lost its symbols.
Change the variable.
Save the project again.
Download the DB.
Disadvantage: The DB content may have changed between the upload and the download.



Sidenote.
Download is only needed back to PLC if you changed initial value. If you only change run value, download is not needed.
 
Last edited:
Just a comment, what you describe is not a constant but a variable.

As to how to add the variable to an existing DB on a running machine:

1. Change the variable in the existing DB (important, only change an existing variable of the same size).
Do not download the DB.
Initialize the variable by setting it in a VAT table.
Disadvantage: You cannot go online with the DB.

2. Open an unmodified backup of the project.
Save the project to a new name.
Upload the DB by dragging and dropping from the online blocks folder to the offline blocks folder.
Check that the DB has not lost its symbols.
Change the variable.
Save the project again.
Download the DB.
Disadvantage: The DB content may have changed between the upload and the download.

Yes, it is a variable to which a constant value is assigned at power up or initialization. I would like to add another entry to the DB in question not modify an existing variable.
 
JesperMP's method #2 is still the method to follow, just add a new row (at the END!!!) instead of modifying an existing variable.

One advantage to this method is that copying the online DB will also copy the variable values so you won't lose any data when downloading.

Lare notes that a download is not necessary. This is true if 1. the DB is the same size (you have modified and not added) and 2. you do not mind the FB having an online/offline difference during compare.
 
JesperMP's method #2 is still the method to follow, just add a new row (at the END!!!) instead of modifying an existing variable.

One advantage to this method is that copying the online DB will also copy the variable values so you won't lose any data when downloading.

Lare notes that a download is not necessary. This is true if 1. the DB is the same size (you have modified and not added) and 2. you do not mind the FB having an online/offline difference during compare.

Thanks, I think I have got it now.
 
Lare notes that a download is not necessary. This is true if 1. the DB is the same size (you have modified and not added) and 2. you do not mind the FB having an online/offline difference during compare.


No. Symbols are saved only to offline project on Classic. Changing symbols inside of DB makes DB timestamp to differ from online.
Now if only symbols are changed and DB lenght is still keeped same than before and DB block(s) is copied from offline to online, it makes timestamps to equal as before symbol change.
Then this changed DB can be online viewed without download to PLC and symbols are changed to new ones on offline project.

The key is to keep DB lenght same as before and you need to copy from online to offline. (opposite as normal download)
(And check that symbol information is not lost after online to offline copy as Jesper allready mentioned.)
After copying from online to offline also comparing should say equal timestamps to DB-blocks even that symbols are changed inside them.
 
Last edited:
The op should experiment with a new DB that is not used by the process to gain familiarity before trying it with the real DB.
 
The op should experiment with a new DB that is not used by the process to gain familiarity before trying it with the real DB.[/QUOTE

I am inexperienced at this process with Siemens software and hardware, so this could be a first step. I will create a new DB.
 
Last edited:
I don't mean to use a new DB for your new constant, but create a new DB for experimenting with downloading/uploading/extending - you can delete the experimental DB when you've finished.
 
No. Symbols are saved only to offline project on Classic. Changing symbols inside of DB makes DB timestamp to differ from online.
Now if only symbols are changed and DB lenght is still keeped same than before and DB block(s) is copied from offline to online, it makes timestamps to equal as before symbol change.
...
After copying from online to offline also comparing should say equal timestamps to DB-blocks even that symbols are changed inside them.

I agree with you, now that I understand your order of operations.
This is a useful method.
 

Similar Topics

Hi, There is a compare block being used 1100 times to compare variables to a constant value -999. The problem is that the GE is changing the -999...
Replies
2
Views
1,859
Hi Everyone, Currently we have three plants running with Controllogix PLCs (L72, L73, L74). In each of these plants we have 2 FTView SE...
Replies
0
Views
56
Hello, Im building project with 1756-L82ES controller and 1756-IB16S card but i cant find it when trying to add the card to IO configuration...
Replies
3
Views
136
Hello, I have a pair of redundant 1756-L71 controllers rev 24. These controllers currently have produced and consumed tag interfaces to 3 other...
Replies
2
Views
171
I'm adding an IAI Gateway with 2 axes connected to it. To an ethernet network on my PLC. So, I think the math is correct on the Input and Output...
Replies
0
Views
147
Back
Top Bottom