WinCC Flexible scripting

Hihi

I tried this, CloseAllLogs, and I added an alarmpage to show system alarms, warnings...

When I stop the logging, I get a message that logging is stopped. When started, same thing.

Works good and no lost data now...

Looks good now.

Thanks




JesperMP said:
Yes, that is why you have to use the StopLogging and StartLogging functions. There is also CloseAllLogs and OpenAllLogs.
Again, I am not sure that the consequences are so grave if you remove the card without stopping the datalogs, if the registry values have already been set.
Anyway, try to program CloseAllLogs and OpenAllLogs. It should reestablish all logging.

If this is not acceptable to you, try to see if you can use the network logging that Jeebs mentioned.
 
Hmm

I do still have a little problem...

When I take out the MMC after closing and stopping the logging, then I get no more errors, that's okay now..

but, after re-inserted and starting the logging, the appending in CSV file did work anymore ?

All these troubles, hmmzz, I hoped that logging on an MMC was no problem, but, hmmmm....

Is logging to a network location better ?
 
JesperMP said:
Reading the online help, it may look like you have to use both StopLogging and CloseAllLogs as well as both OpenAllLogs and StartLogging.

That does kinda make sense.

StopLogging
CloseAllLogs
Remove MMC
Replace MMC
OpenAllLogs
StartLogging

Think it should be done in that order.

And yes, I find that logging to a network drive is sooooo much better. 'Unlimited' space, accessable from your desk ,......
 
:)

A great advantage is that we don't need OPC, the CSV files are usable ...


I'll try this order...
Jeebs said:
That does kinda make sense.


StopLogging
CloseAllLogs
Remove MMC
Replace MMC
OpenAllLogs
StartLogging

Think it should be done in that order.

And yes, I find that logging to a network drive is sooooo much better. 'Unlimited' space, accessable from your desk ,......
 
okay

okay, weird, but okay

JesperMP said:
Reading the online help, it may look like you have to use both StopLogging and CloseAllLogs as well as both OpenAllLogs and StartLogging.
 
Okay, this is what I do now

Hi, in the coming weeks I will check if it's okay now. I did a small test and then stopped the logs, pulled out the card and I have this data:


The script is archiving the positions data. Every time a position screen is lef (on cleared), this script is called to update the saved data on the MMC:

posities.JPG



My counts, every time a new product is finished, the count value changes, on change => log. The zero comes from the 'reset to zero' button:

aantal.JPG



When is the machine actually running:

gestart.JPG



Messages, 1 stands for an Alarm, 64 stand for an operator action:

alarms.JPG




I now have a lot of usefull data to check what happens on the machine. A good thing is that OPC is not needed to get data on a server. I think I will copy these active logs every minute to a server location. I hope the IT people can write something in access or something...
 
Last edited:
Combo said:
I now have a lot of usefull data to check what happens on the machine. A good thing is that OPC is not needed to get data on a server. I think I will copy these active logs every minute to a server location. I hope the IT people can write something in access or something...

Create new logs. Identical to the ones you are using now, except they should be logging to a serverlocation. IT needs to make sure that location is shared etc....

Left tree-structure > Device settings > Scheduler > Create new Job.

Set Event to 1 min

In the function list search for 'CopyLog'

Create one of these functions for each log you want to transfer every minute.

-Configure if its a data or alarm log
-Destination should be the log that logs to servers (new ones)
-Source should be the logs you currently use
-Mode.......not sure here, but think it should be append, need to test this.....
-Delete source log => No

This will copy the configured logs to a server location every minute.
 
just what I need

just what I need

Thanks Jeebs !!

We will use this...

No need for OPC... :)



Jeebs said:
Create new logs. Identical to the ones you are using now, except they should be logging to a serverlocation. IT needs to make sure that location is shared etc....

Left tree-structure > Device settings > Scheduler > Create new Job.

Set Event to 1 min

In the function list search for 'CopyLog'

Create one of these functions for each log you want to transfer every minute.

-Configure if its a data or alarm log
-Destination should be the log that logs to servers (new ones)
-Source should be the logs you currently use
-Mode.......not sure here, but think it should be append, need to test this.....
-Delete source log => No

This will copy the configured logs to a server location every minute.
 
hmm

Weird thing happened this morning,

I pulled out the card (after stopping the logs),

checked the CSV's,

replaced the MMC,

WRONG FILESIZE, PRESS YES TO CORRECT THIS ERROR AUTOMATICALLY,

I did that, all current data erased and started with a new log...

What can be the cause of this ?


And I have another question, when shutting down the machine, the panel goes of too, is this no problem for the MMC ?
 
Did you edit the file with Excel for example, and save the edited version back to the memory card?
Try to copy the CSV file to a hard drive folder and edit the hard drive filenot the MMC file
 
Ip

SmartTags("File") = \\192.168.0.5\C:\HISTORIAN\ & CStr(SmartTags("HISTTAG")) & ".csv"

I'll test this line Monday. Hope it 'ill work.

Greetz



As long as you use: \\servername(or IP)\shared folder(or drive)\
As long as the server exists and the folder/drive is shared, then it should be no problem.
The logs will be .csv format and will be 'in use' as long as the runtime is running. 'In use' means should you open it, with excel for example, while the runtime is still active, it will stop logging.
We use OP270.......even those, without built in ethernet, can log to servers.
I suppose it should be possible to make the script save the .txt file on a server also.
 
Charles, your script is OK on a PC, but Jeebs wants to log the data on a CE panel, so the script code is quite different.

Here is a sample project where data is store to a flash card on a Windows CE panel:
http://support.automation.siemens.com/WW/view/en/26107212

Please provide me instructions on how to define "DB1" in tags so that everything will work (in CopyDB1FromPLCToFile.txt)?

For i = 0 To 24
'HARDCODE DB NUMBER HERE !!
ts.WriteLine (CStr (SmartTags ("DB1") (i)) & "; DBW" & CStr (i * 2))
Next

The same question for variable: strStatusMessage

🍻
 
Hi Guys
I use simenes comfort hmi at my project. now i have a big problem. i want start logging if one bit of plc is 1 and stop is 0. i can't solve this problem. and i want log in usb and when usb 2 is connect send logging to usb 2. pls help me. is emergency.
thanks
 

Similar Topics

I currently have a script that load on startup that reads maybe 16 values off a DB on my PLC. I take those values and then store them on another...
Replies
15
Views
4,448
Hello everyone I Have an Issue with the usage of recipes in Wincc Flexible 2008, I create the recipe to change the values in a fast way The...
Replies
0
Views
69
Hi colleagues.We do data logging system.We want to record three temperatures under a certain condition. We prepared the project as follows. We do...
Replies
1
Views
735
Hello to everyone. I change the value of a "PQW" with a button in Wincc flexible. The code of the button is defined as M102.0. Value reset...
Replies
10
Views
4,523
Hello Friends I have installed WinCC Flexible 2008 SP5 Update 2. I have open the software, but the Transfer option does not appear. Is It...
Replies
2
Views
1,410
Back
Top Bottom