SIEMENS TIA PORTAL Datalogging - How to read and write data in CSV?

Поділитися
Вставка
  • Опубліковано 27 лис 2024

КОМЕНТАРІ • 18

  • @wabetosilva2481
    @wabetosilva2481 10 місяців тому

    Terrific!!!! Very good explanation works very well 😃😃😃

  • @afreetunesian
    @afreetunesian Рік тому +2

    Thanks for the The Tuto ! verry helpful.
    a question: it is possible to add a VB fuction to the project without adding the wincc like in your Exemple.
    is that possible to make a short tuto for it ?
    thanks!

  • @umbertosala3232
    @umbertosala3232 2 роки тому +2

    Very usefull! Bravo!
    Is it possible to create a new file when you change batch?

  • @mai80z2
    @mai80z2 Місяць тому

    How can i Read row by row and save in the list of variables for use in the main?

  • @dienau6313
    @dienau6313 Місяць тому

    at 9:38, the thing I dont understand why is you set your file name is data3.csv, but it clearly is excel file. How can be?

  • @Rivuzza
    @Rivuzza Рік тому

    with this script I can directly create a csv file on the pc without the hmi panel, right?
    where to insert the vb file
    since the script folder is not present

  • @rafo21pe
    @rafo21pe 8 місяців тому

    how many variables can be set in the trend ?

  • @ramazancan507
    @ramazancan507 Рік тому +1

    Hello, thank you for your sharing. How can I save data in different file month by month?

  • @slavaleb378
    @slavaleb378 6 місяців тому

    Cool! Thanks a lot!

  • @Shahab-e9n
    @Shahab-e9n 3 місяці тому

    Thanks alot

  • @remigelin4076
    @remigelin4076 2 роки тому +4

    can you give the program ?
    (a copy paste in the comments is enough)

    • @automationonline
      @automationonline  2 роки тому +16

      '***************** Write data to CSV File*************************
      Sub VBFunction_1()
      ' Write_data_to_file
      Dim fso, f, ts
      'Catch errors
      On Error Resume Next
      Datetime = Now()
      'Create object
      Set fso = CreateObject("Scripting.FileSystemObject")
      If Err.Number 0 Then
      ShowSystemAlarm "Error #" & CStr(Err.Number) & " " & Err.Description
      Err.Clear
      Exit Sub
      End If
      ' If no file exists, create a new one
      If Not fso.FileExists(FileName) Then
      fso.CreateTextFile FileName
      End If
      Set f = fso.GetFile(FileName)
      If Err.Number 0 Then
      ShowSystemAlarm "Error #" & CStr(Err.Number) & " " & Err.Description
      Err.Clear
      Exit Sub
      End If
      Set ts = f.OpenAsTextStream(8, -2)
      ' mode "8" to append to file
      If Err.Number 0 Then
      ShowSystemAlarm "Error #" & CStr(Err.Number) & " " & Err.Description
      Err.Clear
      Exit Sub
      End If
      ' Write new set of values into file
      ts.WriteLine(Material & ";" & Pressure & ";" & Temperature & ";" & Datetime)
      'Tidy up
      ts.Close
      Set f = Nothing
      ShowSystemAlarm "Storage of the data was successful!"
      End Sub
      ' ********Read data from CSV File******************************
      Sub VBFunction_4()
      ' Read_data_from_file()
      Dim fso, f, field, MyZf
      ' Catch errors
      On Error Resume Next
      ' Create file object
      Set fso = CreateObject("Scripting.FileSystemObject")
      If Err.Number 0 Then
      ShowSystemAlarm "Error #" & CStr(Err.Number) & " " & Err.Description
      Err.Clear
      Exit Sub
      End If
      Set f = fso.OpenTextFile(FileName, 1, 0, -2)
      If Err.Number 0 Then
      ShowSystemAlarm "Error #" & CStr(Err.Number) & " " & Err.Description
      Err.Clear
      Exit Sub
      End If
      ' Read values till end of file
      Do While Not f.AtEndOfStream
      MyZf = f.ReadLine
      Loop
      field = Split(MyZf, ";")
      MaterialFromFile = field(0)
      PressureFromFile = field(1)
      TemperatureFromFile = field(2)
      ' Tidy up
      fso.Close
      Set f = Nothing
      Set fso = Nothing
      ShowSystemAlarm "Readout of the data was successful!"
      End Sub
      '**********************************************************

    • @alexandremarinho2582
      @alexandremarinho2582 2 роки тому +1

      @@automationonline It's possible search 25/10/2022 value in column ex :"A"(date), and show values B and C in tags. same like this vlookup.
      A | B | C |
      10/10/2022 | 102.0 | 99.5 |
      25/10/2022 | 102.0 | 99.5 |***
      28/10/2022 | 102.0 | 99.5 |

  • @ParthibanParthi-c4w
    @ParthibanParthi-c4w Рік тому

    sir how to read in between line data's

  • @Dell-g8w
    @Dell-g8w 4 місяці тому

    it does't work with real HMI (tp 900 comfort)

  • @kiyo191
    @kiyo191 2 роки тому

    hello . Can I have the source code please?