Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - g.mccormick

Pages: [1] 2
1
I know this is an old post, but I am not having any luck getting the inifile to work.  The control just does not seem to use what is put in the inifile.

2
Additional Components / Re: Charting App for BasicDataLogger
« on: January 19, 2022, 03:09:23 PM »
How would I pull this into a full ADVHMI project?  I would like to incorporate this data viewer  into a project that I am starting.

3
Support Questions / Re: BasicDataLogger2G not printing header on new file
« on: September 22, 2021, 11:11:21 AM »
I was able to do a work around. 
Code: [Select]
   Private Sub FileManipTmr_Tick(sender As Object, e As EventArgs) Handles FileManipTmr.Tick

        ManipTickCntr += 1

        lblManipTickCntr.Text = ManipTickCntr


        hour = DateAndTime.Now.Hour
        mins = DateAndTime.Now.Minute

        lblHour.Text = hour
        lblMins.Text = mins


        'Following runs every 30sec

        'We have an issue that when new files are created on a new day, the header information
        'is not getting added.

        Dim monStr, DayStr, YrStr, LogFileName, HeaderFileName As String


        'The log file from the data log includes the day, month, and year in the filename.
        'We know the root of the filename but need to construct the rest with day, month, yr.

        'Get the day, month, and year as strings.
        DayStr = DateAndTime.Now.ToString("dd")
        monStr = MonthName(DateAndTime.Now.Month, True)
        YrStr = DateAndTime.Now.Year

        'Construct the full .log file name.
        LogFileName = PowerMtrEvntLog.FileFolder + "\" + PowerMtrEvntLog.FileName + "-" + DayStr + "-" + monStr + "-" + YrStr + ".log"
        HeaderFileName = PowerMtrEvntLog.FileFolder & "\Header.txt"

        txtFilename.Text = LogFileName


       [color=red] 'We will check the file for a header only once a day. If the hour before hour 22(10pm) and min >= 5 and we haven't checked it yet.

          If (hour < 23) And (mins >= 5) And Not TestHeader Then
       

            TestHeader = True  'Set to true so that we don't go though here again until we reset the bit


            'First make sure that the file exists and if it does read the first line.
            If My.Computer.FileSystem.FileExists(LogFileName) Then

                'Read all of the lines from the file.  Each line will take one array element of line() array
                Dim line() As String = IO.File.ReadAllLines(LogFileName)

                'Get the first 9 characters of the first line which is held in line(0) as long as line(0) is greater than 9 chars long
                If line(0).Length > 9 Then
                    Dim lineChars As String = line(0).Substring(0, 9)
                    Dim testchar As String = "Date-Time"

                    'Evaluate against the expected value.
                    'If the first 9 chars Of the first line In the file Is Not "Data-Time" Then we need To add the header In
                    If Not lineChars = testchar Then

                        'Read in log file
                        Dim LogFileReader As String
                        LogFileReader = My.Computer.FileSystem.ReadAllText(LogFileName)

                        'Read in Headerfile
                        Dim HeaderFileReader As String
                        HeaderFileReader = My.Computer.FileSystem.ReadAllText(HeaderFileName)

                        'Combine and write back to logfile
                        IO.File.WriteAllText(LogFileName, HeaderFileReader & vbNewLine & LogFileReader)

                    End If
                End If
            End If 'End  If My.Computer.FileSystem.FileExists(LogFileName) Then

        End If

        'Reset the TestHeader bool. 
        If (hour > 22) And TestHeader Then
            TestHeader = False
        End If[/color]

        'We want to copy the .log file to .csv.  We will do this only once a day at 12:05.
        'Since a new file is generated daily, we need to remember the previous days file name.

        If (hour > 17) Then
            YesterdayFile = LogFileName
        End If

        'At roughly 1:05AM copy yesterdays file to .csv file

        If (hour > 0) And (hour < 2) And (mins >= 5) And Not MakeCsv Then
            MakeCsv = True

            CsvFile = YesterdayFile.Replace(".log", ".csv")

            If System.IO.File.Exists(YesterdayFile) Then
                My.Computer.FileSystem.CopyFile(YesterdayFile, CsvFile, overwrite:=True)
                txtcsvfilename.Text = CsvFile

            End If

        End If

        'reset the MakeCsv so that we will do the previous steps again tomorrow
        If (hour > 3) And MakeCsv Then
            MakeCsv = False
        End If


        'Email. At 12:10AM if the csv file exists, then we want to email it.
        If System.IO.File.Exists(CsvFile) And (hour = 1) And (mins >= 10) And Not AutoEmailLock Then
            AutoEmailLock = True
            SendEmail = True

        End If
        If (hour > 2) And AutoEmailLock Then
            AutoEmailLock = False
        End If


    End Sub



4
Support Questions / BasicDataLogger2G not printing header on new file
« on: September 15, 2021, 12:34:24 PM »
I am using BasicDataLogger2G and I have selected to create new file daily as well as include a header.  The log file that is created when I first launch the application has the header in it, however, all subsequent files (made new daily) do not have the header.  Am I missing something?

5
Support Questions / Re: Email issue. Windows issue probably
« on: September 10, 2021, 03:43:36 PM »
Update. I found that it is being blocked by antivirus.  Now to get the person with password to fix it.


6
Support Questions / Email issue. Windows issue probably
« on: September 10, 2021, 11:06:23 AM »
I am having an issue with email working.  Emailing from this PC worked before, but something has changed.  I have even created a simple project that just has email from a push button.  The project works on my laptop, but does not work on the target machine.  I thought that the issue could be network related so I used my phone as a hotspot and connected the target PC wifi to it with no luck.  The attached image shows the error that pops up.  I have tried with gmail and an outlook email address to no avail.  Has anyone had this before? Any suggestions?


7
Support Questions / Re: Read ML1400 PID.CVH
« on: January 06, 2021, 05:01:34 PM »
V3.99y Beta 37 supports all the elements of the PD data type.

https://www.advancedhmi.com/forum/index.php?topic=2838.0

Awesome!.

Just a few hours too late.  I ended up installing rslogix500 for the 7day grace period over teamviewer to set the value.  I have modified the program from home and now just waiting for a time to download (hope wihting the next 6days) I added some logic to mov N register values to the .CVL and .CVH.

Thank you to Archie for the fix though.

Side question, what is the easiest way to upgrade a previous project to the latest?

8
Support Questions / Re: Read ML1400 PID.CVH
« on: January 05, 2021, 09:10:37 PM »
Dang.  Unfortunately I can't do that in this case.  I'm trying to solve a problem where I need to change the CVH value but cannot connect to the PLC.  I was hoping to through together a quick HMI to get around my issue.

9
Support Questions / Re: Read ML1400 PID.CVH
« on: January 05, 2021, 08:41:30 PM »
Yes, that would be the correct syntax. I am looking at adding these sub elements to the next beta version which may be available by the end of this week.

Hmm. I am getting invalid address for PD10:1.8
PD10:1\8 gives me true so seems to be bit addressing..

10
Support Questions / Re: Read ML1400 PID.CVH
« on: January 05, 2021, 08:27:24 PM »
Ok I'm thinking it may be word 8.  Would the syntax then be PD10:1.8?

11
Support Questions / Read ML1400 PID.CVH
« on: January 05, 2021, 08:08:22 PM »
I am needing to read/write the CV high value for a PID loop in ML1400.  I set the read address to PD10:1.CVH and get the error of invalid address.  Is this something that can not be done?

12
Support Questions / Re: VB copy file issue. Not ahmi specific
« on: October 01, 2020, 05:16:12 PM »

   My.Computer.FileSystem.CopyFile(foundFile, My.Computer.FileSystem.SpecialDirectories.Desktop & foundFile.Substring(foundFile.LastIndexOf("\")))

Thank you Godra.  That worked perfectly. Can you explain the what/why? 

13
Support Questions / VB copy file issue. Not ahmi specific
« on: October 01, 2020, 11:40:00 AM »
This is not a ahmi specific question, but I am attempting to copy a log file to a destination.  I get an error for the path, but I cannot figure out what the issue is.  Any help would be appreciated.
See pic

14
Support Questions / Re: Read values from plc, do calculation, log
« on: July 24, 2020, 12:24:03 PM »
I am now trying to change to the put the code in the main form.  Since the main form is where exiting of the appliction is and that seems to make more sense for logging. I want to view the current values on the form2, but I cannot figure out how to get the values there.  I have specified the variables on the main form to be PUBLIC.  ?

15
Support Questions / Re: Read values from plc, do calculation, log
« on: July 23, 2020, 02:31:28 PM »
So I have the data subscriber working and calculations running.  I am viewing it all on the screen.  I am trying to log to a file at a timer interval.  I kinda sorta got it, but I can't figure out how to:
1. Create a new file everytime the application is started. Just enw filename.
2. On the first pass on this new file, log the header.
3. Log data until the form is closed.
4. Gracefully close the file.

This is all on a Page2 , not on the main.  THat maybe an issue I guess.  I created a timer and am trying to write the data at the timer interval.

 Dim FILE_NAME As String = "C:\Users\MYPERSON\Desktop\IMP\Data\CH1Data.txt"
    Dim LineOfData As String
    Dim CondRTstr As String
    Dim TimeStamp As String
    Dim Firstpass As Boolean = True
    Dim HeaderData As String
    'Opens the file I think
    Dim objWriter As New System.IO.StreamWriter(FILE_NAME)

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick




        If Firstpass Then
            'If this is the first time through, then write the header
            HeaderData = "Time,Cond Rtn T [F], Cond Sup T [F], Cond Delta T [DT_F], Cond Flow [GPM], Cond Meter Flow [GPM], Cond Mass Flow [LB/HR], Cond Heat [BTU/HR], Cond Tons [RT], _
                            Evap Rtn T [F], Evap Sup T [F], Evap Delta T [DT_F], Evap Flow [GPM], Evap Mass Flow [LB/HR], Evap Heat Rej [BTU/HR], Evap Tons [RT]"
            Firstpass = False
            objWriter.WriteLine(HeaderData)

        End If
        TimeStamp = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")
        CondRTstr = CondRtnT
        LineOfData = TimeStamp _
            & "," _
            & CondRtnT _
            & "," _
            & CondSupT _
            & "," _
            & CondDT _
            & "," _
            & CondFlo _
            & "," _
            & CondFloComms _
            & "," _
            & WaterMF _
            & "," _
            & CondBTU_HR _
            & "," _
            & Cond_TONS _
            & "," _
            & EvapRtnT _
            & "," _
            & EvapSupT _
            & "," _
            & EvapDT _
            & "," _
            & EvapFlo _
            & "," _
            & GlycolMF _
            & "," _
            & EvapBTU_HR _
            & "," _
            & Evap_TONS

        objWriter.WriteLine(LineOfData)



    End Sub



Pages: [1] 2