Wincc Flex Runtime logging problem

Micon

Member
Join Date
Mar 2011
Location
SC
Posts
10
Hello everyone,

Info: I am using WinCC Flexible Runtime to log data to a SQL server. It is set up to log production values every minute from multiple machines. I have an mpi network connecting the machines then an mpi to ethernet converter. I am then pulling the data from SQL to EXCEL to manipulate it.

Problem: The runtime stops logging new data to the SQL database randomly. It seems like the program goes inactive or hibernates but I have all the correct settings on my server to prevent that. Runtime keeps logging the same value after a certain point of running but then will go back to logging the current data randomly as well. If i close the runtime and restart it, new data will be logged again but then the same problem happens again at random intervals.

Is this a communication problem with the network or something with runtime?

Any help will be greatly appreciated.

Regards,
Michael
 
Hi

I have also a project where I used WinCC Flexible and SQL.
But I did it in scripting:

Code:
Dim conn, rst, SQL_Table, Stapn, Progn
Delay(2)
On Error Resume Next
Set conn = CreateObject("ADODB.Connection")
Set rst = CreateObject("ADODB.Recordset")
conn.Open "Provider=MSDASQL;Initial Catalog=" & "SQLDB_CIP" & _
          ";DSN=WinCCFlexible"
If Err.Number <> 0 Then
 ShowSystemAlarm "Error #" & Err.Number & " " & Err.Description
 Err.Clear 
 Exit Sub
End If
SQL_Table = "SELECT * FROM "& "Log_L1" & " WHERE Recnr = "& SmartTags("SQL LOGGER.REC_NR_L1") 
Set rst = conn.Execute(SQL_Table)
If Err.Number <> 0 Then
 ShowSystemAlarm "Error #" & Err.Number & " " & Err.Description
 Err.Clear 
 Exit Sub
End If
If Not (rst.EOF And rst.BOF) Then 
  ShowSystemAlarm "Recnr bestaat reeds!"
  rst.close 
Else
 Select Case SmartTags("FIFO_STAP_L1.script")
  Case 0
   Stapn = "0: INITIËLE STAP"
  Case 1
   Stapn = "1: BUFFER"
  Case 2
   Stapn = "2: VOORSPO"
  Case 3
   Stapn = "3: CHECK"
  Case 4
   Stapn = "4: STEKEN"    
  Case 5
   Stapn = "5: BUFFER"
  Case 6
   Stapn = "6: CONTROLE"
  Case 7
   Stapn = "7: REI"
  Case 8
   Stapn = "8: STEKEN"
  Case 9
   Stapn = "9: CHECK"
  Case 10
   Stapn = "10: BUFFER"
  Case 11
   Stapn = "11: CONTROLE"
  Case 12
   Stapn = "12: NA"
  Case 13
   Stapn = "13: CHECK"
  Case 14
   Stapn = "14: DESINF"
  Case 15
   Stapn = "15: BUFFER"
  Case 16
   Stapn = "16: DESINF"
  Case 17
   Stapn = "17: STEKEN"
  Case 18
   Stapn = "18: CHECK"
  Case 19
   Stapn = "19: BUFFER"
  Case 20
   Stapn = "20: CONTROLE"
  Case 21
   Stapn = "21: NA"
  Case 22
   Stapn = "22: AFZ"
  Case 23
   Stapn = "23: EINDE"   
 End Select 
 Select Case SmartTags("FIFO_PROG_L1.script")
  Case 0
   Progn = "NO INPUT"
  Case 1
   Progn = "RM1"
  Case 2
   Progn = "RM2"
  Case 3
   Progn = "RM3"
  Case 4
   Progn = "RM4"    
  Case 5
   Progn = "RM5"
  Case 6
   Progn = "RM6"
  Case 7
   Progn = "RM7"
  Case 8
   Progn = "RM8"
  Case 9
   Progn = "RM9"
  Case 10
   Progn = "RM10"
  Case 11
   Progn = "RM11"
  Case 12
   Progn = "RM12"
  Case 13
   Progn = "T13"
  Case 14
   Progn = "T14" 
  Case 21
   Progn = "T21"
  Case 22
   Progn = "RM22" 
  Case 23
   Progn = "RM23"
  Case 24 
   Progn = "RM24"
  Case 30
   Progn = "RM0"
  Case 31 
   Progn = "LEI"
  Case 49
   Progn = "WE"
  Case 50
   Progn = "KA"
  Case 51
   Progn = "KAA"
  Case 52
   Progn = "K"
  Case 53
   Progn = "KM"
  Case 54
   Progn = "KP"
  Case 55
   Progn = "BUFFER"
  Case 56     
   Progn = "BUFTANK"
  Case 65
   Progn = "ROO" 
  Case 66
   Progn = "RO"    
  Case 67
   Progn = "R"    
  Case 68
   Progn = "T18" 
  Case 69
   Progn = "T19"    
  Case 70
   Progn = "T20"
  Case 80
   Progn = "PA"    
  Case 81
   Progn = "VAT"   
  Case 90
   Progn = "OUUR"
  Case 91
   Progn = "RESERVE"
  Case 92
   Progn = "RESERVE"
  Case 93
   Progn = "AK"
  Case 94
   Progn = "LANG"
  Case 95
   Progn = "DESINF"
  Case 96
   Progn = "DESINFECT"                    
 End Select    
 SQL_Table = "INSERT IGNORE INTO "& "Log_L1" & " VALUES ('" & SmartTags("SQL LOGGER.REC_NR_L1") & _
             "' , '" & SmartTags("FIFO_DATE_L1.script") & "' , '" & SmartTags("FIFO_TIME_L1.script") & _
             "' , '" & SmartTags("FIFO_PROG_L1.script") & "', '" & Progn & _
             "' , '" & Stapn & "', '" & SmartTags("FIFO_TEMP_L1.script") & _ 
             "' , '" & SmartTags("FIFO_CONC_L1.script") & "', '" & SmartTags("FIFO_TIMER_L1.script") & _ 
             "' , '" & SmartTags("FIFO_NORM_L1.script") & "')" 
 ShowSystemAlarm "Record Lijn 1 stap" & SmartTags("FIFO_STAP_L1.script") & " in SQL Database geschreven"             
 Set rst = conn.Execute(SQL_Table)
End If
If Err.Number <> 0 Then
 ShowSystemAlarm "Error #" & Err.Number & " " & Err.Description
 Err.Clear 
 Exit Sub
End If
conn.close
Set rst = Nothing
Set conn = Nothing

This works perfectly and is running more then 6 months without any problems. Donno about datalogs directly in SQL, never done it that way.
Hello everyone,

Info: I am using WinCC Flexible Runtime to log data to a SQL server. It is set up to log production values every minute from multiple machines. I have an mpi network connecting the machines then an mpi to ethernet converter. I am then pulling the data from SQL to EXCEL to manipulate it.

Problem: The runtime stops logging new data to the SQL database randomly. It seems like the program goes inactive or hibernates but I have all the correct settings on my server to prevent that. Runtime keeps logging the same value after a certain point of running but then will go back to logging the current data randomly as well. If i close the runtime and restart it, new data will be logged again but then the same problem happens again at random intervals.

Is this a communication problem with the network or something with runtime?

Any help will be greatly appreciated.

Regards,
Michael
 
Last edited:
Thanks. I am not very good at scripting/programming though, so I'd probably be biting off more than I can chew if I go that route.
 
How often are you logging the data and how much data ?

You probably have setup an ODBC connection on the PC.
You can test this connection by query ODBC data from within Excel for example (Excel must be installed on the same PC).
Here is a guide:
http://www.clickconsulting.com/nl/200904/excel-video-external-data-odbc
That will tell you if the problem is with WinCC Flex or outside WinCC Flex.

Apart from that, I dont like ODBC connections from WinCC Flexible. In particularly not via VBS.
The problem is that it does not handle errors robust enough. If the connection is lost, it may not recover again automatically.

I had a really bad experience which cost me an extra visit to a customer in japan, and had me strip out the ODBC VBS script from Flexible. In stead I installed a dedicated SQL to OPC link from Inductive Automation.
 
A relatively small amount of data, just taking the numbers off a few machines. 300 bytes of data from a DB (not sure what it translates to in SQL). I am logging on 10s intervals. I set up an ODBC (not through a script) and I am pulling the data into an excel spreadsheet, like that video.

I've noticed that on my runtime output boxes, only the numbers (internal tags) using a script to be calculated are not updating. The numbers that are directly from the plc (my external tags) seem to keep updated.
 
So, when the HMI has stopped logging the data, can you still access the SQL database via Excel ?
What do your scripts really do ?
How often are they triggered ?
You write "300 bytes from a DB" and "a few machines". Does that mean 300 bytes in total, or x times 300 bytes ?

You may have some problems with data consistency.
The biggest consistent chunk of data that Flexible can read is approximately 244 bytes.

The MPI link may also be a problem. At 187.5 kbps it is not really super performant.
 
So, when the HMI has stopped logging the data, can you still access the SQL database via Excel ?

-Yes. excel keeps pulling the same value in with an updated time stamp.

What do your scripts really do ?
-The scripts take the defective part count and divide it by the total part count. This gives me a scrap percentage.

SmartTags("EC1_scrap_1")=(SmartTags("EC1_ch_1")/SmartTags("EC1_total"))*100


How often are they triggered ?

-The scripts are triggered when the value of the total count changes. About every second.

You write "300 bytes from a DB" and "a few machines". Does that mean 300 bytes in total, or x times 300 bytes ?

-276 bytes total. I am pulling all the data to one plc then pulling from that machine.
 
The ODBC datalogging problem is in Flexible RT then.
When the problem is active, does restarting the RT help ?

Not sure what is wrong with your script. It is another problem not related to the ODBC data logging. Since only internal tags are affected. It should be insensitive to problems with external connections.
Try to do a rebuild all. It sometimes cures odd problems.

Apart from all that, I would guess that you have a consistency problem.
Depending on which S7 CPU is in use, there is a limitation on how much data can be transferred in one go. Typically 240 bytes for an S7-300 CPU.
 
Restarting Runtime fixes the problem. It will run correctly for an inconsistent amount of time then lock/freeze up like it has been doing. It is a 317-2 cpu.
 
For a 317-2DP the manual says the max 160 bytes can be transferred consistently. Odd, since that CPU is quite well-specced otherwise, but that is how it is.
Is the log data in an array tag ?
If this is related to the problems with the RT crashing I dont know.
Maybe try to pack the data into several array tags, each less than 160 bytes. And then log each independently.

What about the other machines. What CPUs do they have ?
Maybe you can increase the MPI speed from 187.5k to 1.5M.
Not sure if it is related to your problems though.
 
I have not set up an array. I have 8-10 tags for each machine. Each machine has its own data log. I imagine it tries to move all the data at once though.

The other cpus are 314s and 315s.

Could memory on the pc/server be a problem? it is an old machine with 512MB but is dedicated to this Runtime.
 
How is the log trigger setup ?
One for all, or many different ?

Since the other CPUs only support the 187.5k, you can do nothing about that.
MPI is really not performant enough for a large complicated network. Again, not sure if it has any relation to your problem.
Is the DP port (X2) used on the 317-2DP ?
If not, it would be obvious to move the Flex RT connection to that port.
 
By the way.
Do you have a message view screen in your RT that display the system messages ?
That is handy for checking these messages, which disappear automatically otherwise.
Then you can check if there are messages pertaining to the logging to the SQL database.
 
Many different. I individually set the log time as 1 minute on the tags I want to log. I am using Cyclic continuous logging method. For each machine I have the data logs ec1_scrap, ec2_scrap .... ec6_scrap.

I dont have a message window in the RT but that is a good idea and I will add one.

Everytime my machine count increases it runs the corresponding script for that machine. It is odd that the external tags keep updating but the internal tags used in the scripts do not update.
 
In the script you should add the ON ERROR RESUME NEXT functionality and associated ERR handling. See the VBScript reference for samples.
A good tip is to show a system alarm like this:
Code:
If Err.Number <> 0 Then
 ShowSystemAlarm "SQL Log Script error." & Err.Number & " " & Err.Description
    Err.Clear 
    Exit Sub
End If
In that way you have both a message on the screen and an entry in the message log.

The way you descibe your logging, you should not have problems with consistency. The problem may be that the various logs are not syncronised with each other. How to know what data in the logs are from the same instance ? The log timestamp will be different for all the various logs. Maybe this is not a problem for you, if you are handling this in some other way.
 

Similar Topics

Hello! Another weird request from the swede with customers that doesn´t like to pay for quality in first place... Is there any way to have a...
Replies
8
Views
2,678
Hi! Writing this in a hurry. Today we made a break at a factory and I should download new s7-1200 program and a new WinCC Flex 2008 RT program...
Replies
0
Views
2,242
Hello Experts, I have a problem in WinCC Flex 2008 Sp3, when I start runtime system , after 2 to 5 sec when it started to communicate with the...
Replies
0
Views
1,709
I have a Siemens project with 2 HMI screens, one is a KTP600 Basic and the other is a MP 277 10inch touch. When I fire up the runtime from within...
Replies
6
Views
4,450
Hello Folks, to my problem: I have a installation of WinCC flexible 2008 (with save as version wincc 2007 option) on my local PC. My project is...
Replies
2
Views
7,719
Back
Top Bottom