VB script csv file in winccflexible

Dear Sir
As i explain the diameter guage is loging the data in the csv file on every second on PC hard drive can i read that csv file values of dia guage and show it on winccflex by internal tags? suggest some good idea
Warm regards
Nehe
 
There is a .readline method silimar to the .writeline method.
I guess you could read a line an parse it, maybe with the Split function.
You would have to execute the script cyclically (on change with a PLC tag). I wouldnt try to do it more often than evey 5 second or so. I dont particularly like it, but could be doable.
One thing is that the diameter guage program mustn't hold the csv file open. Like the script it must open the csv file, write to it, and close it. I dont know what will happen if both try to access the file at the same time - crash ?
 
Dear Sir,
The file that created by dia guage is continously updating i mean dia guage is appending the reading to every second.If i decide to read the line from that csv file .How can i read last line data only that is appended recently?.please suggest.if you give me the script code that will help me better
Thanks
Warm Regards
nehe
 
You could continue to use .readline until file.AtEndOfStream=TRUE.
But somehow I think you are heading down the wrong path.
It does not sound right to me to cyclically scan a textfile that is simultanously written to by another application. The VB Script in WinCC Flex was never meant to do anything like this.

There are 3 other options:

Get the value as a 4-20mA signal and collect it in the PLC. If needed, exchange the other device if it cannot do this.

Or, examine if the device has an OPC server that you can link with WinCC Flexible.

Or, examine if the device can save the data in an SQL database, then retrieve the data from the database into WinCC Flexible.
 
0 to -10V output from 224xp inbuilt analog

Dear Sir
I have S7 200 224XP cpu it has one Analog output and two analog input.According to tech specs the analog output is +/- 10v and 0- 20mA.I have requirement of output +10V to -10V.As i force 32000 from microwin 4.0 it gives 10V but as i force -32000 it gives only 0V can you suugest where i am wrong?
Warm Regards
Nehe
 
Hii JesperMP Sir,
I have two RS232 port on PC on which winccflex 2005 is runing
On one prot the SLC/500 Ab plc is connected that i have confugered using DF1 port and it is working smoothly.But on another serial port (COM2)i have two connect Ab micrologics PLC using DF1 port but i am unable to insert second DF1 connection in winccflex 2005.It gives message "maximum number of connections exceeded".What will be the correct way for connecting two such AB PLC (SLC/500 & mocrologix )using DF1 port only.
Warm Regards
Nehe
 
Script does not work in some situation

Dear Sir
The code that Jesper sir given is working fine ,but i have some problems with this as below

If winccflexible is communication with CPU having profibus network and there are three or more CPU in network
I create a cyclic tag in one CPU and trigger the script from that tag but it found not work always!!!
From last one year i am using it with single CPU and it is working fine

Is there any special care should take to trigger the script while CPU is in profibus network?
Pls help
Warm Regards
Nehe
 
If there are several similar scripts and/or the arrays are big, it may have to do with what was discussed in this thread:
http://www.plctalk.net/qanda/showthread.php?p=326970

Also, if the online connection is via Profibus to several CPUs, then consider that Profibus at 1.5M for example is a factor 100 less performant than ethernet. Maybe you are trying to poll to much data.
 
Dear Sir
I have tried to trigger the script by manual button from the screen and seems to work fine but as i trigger it from cylic tag of PLC it don,t seems to work
My connection to CPU is ON MPI and it is just 1.0 mtr
Pls suggest
Warm Regards
Nehe
🤾
 
WinCE panel doesn't run Runtime VB function

Gentlemen,

I am a new hand try to program Siemens HMI to log data on my own format. I try the following code and find it is just work on PC runtime. In WinCE HMI panel, it doesn't support fso object even it is compiled. The VB script is different between Windows and WinCE. Anyone have a sample code to do the same thing in WINCE HMI?

Dim fso, f, ts, DataSet
Set fso = CreateObject("Scripting.FileSystemObject")
'build the string with filename.
'example: "LOG_2007-10-02.csv"
'you may have to modify the path and filename to your needs.
SmartTags("LOG_WriteFileName") = "\Storage Card USB\Logs"& CStr(DatePart("yyyy",Date)) & "_" & CStr(DatePart("m",Date)) & "_" & CStr(DatePart("d",Date)) & ".csv"
'build the string with the data.
'there is an array tag MXLV with the data.
'the data are REALs as you then have the decimal point in the right place.
'modify MXLV to suit your needs.
DataSet = CStr(Now) & "," & CStr(SmartTags("MXLV")(0)) & "," & CStr(SmartTags("MXLV")(1)) & "," & CStr(SmartTags("MXLV")(2)) & "," & CStr(SmartTags("MXLV")(3))& "," & CStr(SmartTags("MXLV")(4))& "," & CStr(SmartTags("MXLV")(5))& "," & CStr(SmartTags("MXLV")(6))& "," & CStr(SmartTags("MXLV")(7))& "," & CStr(SmartTags("MXLV")(8)) & "," & CStr(SmartTags("MXLV")(9))

'check if the file already exists
'if it does not, create it, write the header line and then the first data line
'if it does, then just write the data line
'update the header line t suit your needs
If Not fso.FileExists(SmartTags("LOG_WriteFileName")) Then
fso.CreateTextFile SmartTags("LOG_WriteFileName")
Set f = fso.GetFile(SmartTags("LOG_WriteFileName"))
Set ts = f.OpenAsTextStream(8, -2)
ts.WriteLine "Timestamp , headertext 1 , headertext 2 , headertext 3 , headertext 4 , headertext 5 , headertext 6 , headertext 7 , headertext 8 , headertext 9 , headertext 10 "
ts.WriteLine DataSet
ts.Close
Else
Set f = fso.GetFile(SmartTags("LOG_WriteFileName"))
Set ts = f.OpenAsTextStream(8, -2)
ts.WriteLine DataSet
ts.Close
End If

'if you need to display the same data from within the HMI, you can write the path+filename to another string.
If SmartTags("LOG_DisplayFileName") = "" Then SmartTags("LOG_DisplayFileName") = SmartTags("LOG_WriteFileName")

Set ts = Nothing
Set f = Nothing
Set fso = Nothing
 

Similar Topics

Hello everyone, because I'm not familiar with Archestra-Scripts, I have a question. I want to create a file in which a time stamp, and behind...
Replies
0
Views
1,362
Hello guys. I need some help. Is there anyone who can provide sample script for importing csv file to the user archive of wincc. Thank you very much.
Replies
0
Views
3,523
Hi I'm trying to import and export datasets of a project in CSV files, using a USB key. The OP is Siemens MP277. The user must be able to export...
Replies
0
Views
5,885
Hello. I have a db which is 1000 INT, and this db is represented in WinCC as a raw data type set of 5x 400 Bytes. This set is read with a script...
Replies
1
Views
78
Hello Experts I am working on a project with WinCC Unified v16 PC system and want to create an option on the screen to export logs to the...
Replies
0
Views
68
Back
Top Bottom