Skip to main content

Posts

Data Logging Script

Option Explicit Dim g As SWXRuntimeLib.Global ------------------------------------------------------------- Public Sub NewScript(td As TriggerData)     On Error GoTo ErrHandler     ' TODO: Add your code here         g.ConsoleMsg MSG_INFO_VERBOSE, "Script", "Script Triggered"     Dim TimeStamp1 As Date     TimeStamp1 = Now() 'use raw date-time format for inserting into SQL Table DateTime column         ' Motor Data variable declarations     Dim WindingNo As String, WindingNoTrim As String, MachineSrNo As String, MachineSrNoTrim As String     Dim ModelNo As String, FGCode As String, OperatorName As String, DateTimeInfo As String     Dim RatedSpd As Integer, EncoderPPR As Integer, InvSwFreq As Integer     Dim RatedI As Double, RatedT As Double, RatedF As Double, StallI As Double     ' No Load Test variable declarations     Dim RY_L...
Recent posts

ReadScopeCsv

Option Explicit Dim g As SWXRuntimeLib.Global Dim objFSO As Scripting.FileSystemObject Dim objLogFile As Scripting.TextStream Dim client As GENCLIENTWRAPPERLib.client Public Sub ReadScopeCsv(td As TriggerData)     On Error GoTo ErrHandler     ' TODO: Add your code here     ' final code          'create the logging file     Dim TimeStamp1 As String     TimeStamp1 = Format(Now(), "_ddmmyyyyhhnnss")          Dim outputString As String     Dim outputFile As Scripting.TextStream     Dim inputFile As Scripting.TextStream     Const ForWriting = 2     Const ForReading = 1     Set objFSO = CreateObject("Scripting.FileSystemObject")     Set outputFile = objFSO.CreateTextFile("E:\csv\LogBEMF" + TimeStamp1 + ".csv", ForWriting, True)          ' PLC Register to stor...

LogScript19April2018

Option Explicit Dim g As SWXRuntimeLib.Global Dim objFSO As Scripting.FileSystemObject Dim objLogFile As Scripting.TextStream Dim client As GENCLIENTWRAPPERLib.client Public Sub LogResultsScript(td As TriggerData)     On Error GoTo ErrHandler     ' TODO: Add your code here     'update log status     Dim LogCompleteTag As String     Dim dp1 As GENCLIENTWRAPPERLib.datapoint     Set client = CreateObject("GenClientWrapper.Client")     LogCompleteTag = "Mitsubishi.MXOPC.6\fx5u.Log.LOGRESSTAT"     Set dp1 = client.RequestDataPoint(LogCompleteTag, 1000, 0)     dp1.SyncWrite 1                 Dim TimeStamp1 As String, TimeStamp2 As String     TimeStamp1 = Format(Now(), "dd/mm/yyyy hh:nn:ss AM/PM")     TimeStamp2 = Format(Now(), "_ddmmyyyyhhnnss")         Const ForWriting = 2     Set objFS...