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

SO, right click on the PLC in the project tree and:

  1. compile HW (rebuild all)
  2. compile SW (rebuild all)
  3. download to device (HW & SW)

This worked!!!

In the (admittedly short) time I've been working on TIA Portal, I've NEVER done a compilation of the HW...in fact, when I selected PLC > Compile, the only options I saw were for SW download.
Then I realised, I had to be OFFLINE to be able to compile the HW!

So, I went OFFLINE and did your 3 steps above.
And "Bingo!" I can now reach 192.168.0.1. (see pics)

Then, On the web page, I logged in with my Admin01 account (having bumped up the privilege from Minimum to Administrative) and clicked on "Data Log".

Unfortunately, the file was empty :cry: - The filename is correct ('Report_Summary.csv'), but it didn't even contain the column Headers I was expecting to see - see pic - so I need to look into this. Why's the file empty?

Anyway, this is a huge step forward for me.

Lesson learnt: If in doubt, do a full HW and SW compilation!

Cheers!

192.168.0.1 reachable at last.jpg DataLog Empty.png
 
Last edited:
The log isn't open yet.

1. DataLogCreate
2. DataLogOpen
3. DataLogWrite
4. DataLogClose
5. DataLogDelete (optional)

Set up the DataLogOpen block with the same name and ID as the create block and then it will allow the DataLogWrite block to function.
 
The log isn't open yet.

1. DataLogCreate
2. DataLogOpen
3. DataLogWrite
4. DataLogClose
5. DataLogDelete (optional)

Set up the DataLogOpen block with the same name and ID as the create block and then it will allow the DataLogWrite block to function.

Do I need to do this?

The F1-help says "Data log opens automatically when you execute the instructions "DataLogCreate" and "DataLogNewFile".

DataLogOpen message.png
 
Last edited:
Although I can't see it in the help, I would expect this function to operate asynchronously over several plc cycles - as you are using the first scan bit you may not be giving the function enough time to process your request.
 
Do I need to do this?

The F1-help says "Data log opens automatically when you execute the instructions "DataLogCreate" and "DataLogNewFile".


My guess is that it might Open automatically when the Create succeeds, but it probably doesn't do anything when the Create fails, such as when the log is already created
 
Hmm, one good bit of news...Every time the REPORT button is pressed on the HMI, a new row is added to the CSV file...I've counted the button presses and the number of rows in the CSV is the same, and increments accordingly.

Am I writing to the datalog correctly? Hope you can see code in 2nd picture.
Thanks

csv filled with zeroes and no headers.jpg Create Open Write commands.png
 
Last edited:
Looks like you’re writing the values to your data area in the DB after you’ve triggered the datalog blocks? Although that should mean that the second time you hit the button, you should get the results from the previous try logged unless you have it zero’d somewhere.

I think you have more trust in that button pressed bit than I would, I prefer to have things sequenced through multiple bits to ensure it executes in the correct order.
 
Looks like you’re writing the values to your data area in the DB after you’ve triggered the datalog blocks? Although that should mean that the second time you hit the button, you should get the results from the previous try logged unless you have it zero’d somewhere.

I think you have more trust in that button pressed bit than I would, I prefer to have things sequenced through multiple bits to ensure it executes in the correct order.

Although that's a single button press on the HMI, there's some logic behind it such that the button will only appear when certain other conditions are satisfied. So there is some "control" behind it.

My main problem right now is why I'm seeing zeros in the CSV.

Question: Does it look to you that I'm writing to the datalog correctly with those MOVE commands? Thanks
 
Last edited:
I'm getting frustrated again - in the report_db which defines each "row" of the CSV, should these be 'Retain' or not? Just wondering if it's got anything to do with why I'm only seeing zeros, when I want the values as they appear in the pictures (monitor mode values).

Thanks

should these be RETAIN.jpg
 
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.
 
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.

Good shout.
I'll look into that first thing tomorrow, cheers.
 
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.

log.jpg
 
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.

In this example, does your CSV file have the headers in? i.e. value1, value2, etc.
Is the data being logged correctly?
Thanks
 

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