Siemens S7/TIA v18: Logging of Data...

Looks like you're trying to log the whole data structure in your DB. The help file says there's no nesting of structures, which means the DTL values may not be permitted.

The helpfile doesn't specify, but I wonder if the header string is subject to the same restrictions as the name string.

The name (on a 1200) is restricted to ASCII 0x20 to 0x7E. I've been using a counter and VAL_STRG converter to provide the name for my logs and I had an issue early on with the string placing a space at the end and it wouldn't run due to not having a valid name.

Also didn't realise it automatically opens the log on creation.
 
Looks like you're trying to log the whole data structure in your DB. The help file says there's no nesting of structures, which means the DTL values may not be permitted.

The helpfile doesn't specify, but I wonder if the header string is subject to the same restrictions as the name string.

The name (on a 1200) is restricted to ASCII 0x20 to 0x7E. I've been using a counter and VAL_STRG converter to provide the name for my logs and I had an issue early on with the string placing a space at the end and it wouldn't run due to not having a valid name.

Also didn't realise it automatically opens the log on creation.
Just read this, thanks.

So if I understand you correctly, a data type STRUCT is not allowed here (see pic)?
EDIT: My mistake, you're talking about the DTL (date) types...I could temporarily remove them to see what happens.

Maybe if I change it so that each item in the struct is like a separate entry in the DB it might work. (?)

data structure.png
 
Last edited:
If it does take a few scans to log the data perhaps instead of using the button pulse, set a bit with the button then use that bit, reset the bit when the done bit is on (to be on the safe side perhaps a timeout timer to reset it should it fail.

This is very frustrating.

I did a SET of a bit (DB_Create_Flag) when 'first scan' is true (network 3 attached).

But the .Done bit from DataLogCreate_DB is never set, so the Reset is never performed (network 37 attached).

I really don't know why that is.

Network 3.png Network 37.png
 
Tried this out on an S7-1510S CPU, using the Siemens example as a basis and it does what is says on the tin. bCreate and bWrite are on for one scan.

Maybe I'm misunderstanding, but don't you mean the DONE outputs are only set for one scan?

For bCreate and bWrite , you need to set them TRUE in order to Create and Open the data Log.
 
I manually set those bits (using modify operand) and then reset them programatically at the end of the FB, the screen shot trimmed off that bit of code.
 
I'm now getting realistic values being populated in the CSV file, but there's only 3 columns and no headers. (see first pic)

There should be 23 columns in the CSV file.

The 3 columns that are there are for the first 3 elements of Data, as defined in the DB (see 2nd pic). p.s. I've "trimmed" the struct to remove potentially problematic types like DTL/Date.

Can Anyone help? Thanks

csv - good values but only 3 columns.png Data struct.png
 
Last edited:
How are you deleting the log file to test your changes?
I get all headers + columns of data, including Date and DTL
 
How are you deleting the log file to test your changes?
I get all headers + columns of data, including Date and DTL

I haven't been deleting the log file (maybe that's part of the problem).

I was assuming that each new Write to the CSV file would also add any missing headers and columns.

To see the new CSV file, I go to 192.168.0.1 and log in with the username/password. Then I open up the CSV to look for any changes/updates.
 
Delete the log file and try again, the headers get written when you create the log.
 
Last edited:
Delete the log file and try again, the headers get written when you create the log.

Okay @LD, good call - I deleted the log file from the 192.168.0.1 web page where there's an option to delete the file (1st pic).

In the new file, the number of columns is correct, the values therein are correct and the number of headers is correct...as you can see, I still need to add a lot more headers (2nd pic).

Still work needs doing on this...need to add a few DTL/Date tags (I removed them from the struct in case they were problematic, so I was only logging Reals).

Nonetheless, a big step forward!

p.s. If anyone knows how to change language setting from Spanish to English in Excel, please let me know.

Delete option.png Correct number of columns and values.png
 
Last edited:
I don’t think it allows you to delete open data logs.

I said it was a pain to get this going! I assembled it all into an FB and there’s around 5 tags to assign.
 
I said it was a pain to get this going! I assembled it all into an FB and there’s around 5 tags to assign.

True! You did say that, I remember.

I just need to add a few more MOVE commands (if it's a MOVE I should be using) to move a few more things into the data log:

  1. Dates (types Date and DTL)
  2. Serial number (type String)
  3. Operator ID (type WString)

Can these be moved with MOVE commands or do they have their own special commands?
 

Similar Topics

Context: PLC= S7-1212C, HMI=KTP1200 Basic. Hi again, When the "REPORT" button is pressed (on a different screen), it takes the operator to the...
Replies
7
Views
448
Context: PLC= S7-1212C, HMI=KTP1200 Basic. Hi, The operator has reported that, from time-to-time, when he presses the "Generate Report" button...
Replies
5
Views
296
General Question: The PLC and HMI that I've been working on (a laser measurement system) is soon to be transported to the site where it will be...
Replies
2
Views
584
Hi, I'm not sure how to do this... Basically, I want to restrict the user input values for this tag to be in the range 20.001 to 25.0. I...
Replies
17
Views
1,178
Can someone help me with this? I'm no good at SCL - virtually everything I've done so far has been ladder logic. The return value from the...
Replies
13
Views
854
Back
Top Bottom