Loading ...
Sorry, an error occurred while loading the content.

B137, Davis clock sync option.

Expand Messages
  • wuhu_software
    Out of curiosity related to the question of the Davis Vue clock drift, I have created a new feature to synchronize the Davis console clock with the PC. At this
    Message 1 of 12 , Nov 1, 2010
    • 0 Attachment

      Out of curiosity related to the question of the Davis Vue clock drift, I have created a new feature to synchronize the Davis console clock with the PC. At this time, I have decided to only do this with the Davis units as the La Crosse protocol is very shaky and not to be trusted in my personal opinion. The potential of console damage and angry users is just not worth the effort / grief that could be potentially created by using this feature on those consoles.

      Important Note: In order for this feature to work, you must have the retrieval of the consoles history enabled. Otherwise the clock check is bypassed completely. See the user manual if your history retrieval is currently disabled for instructions on how to enable it.

      Clock Sync Details:

      The Davis API GetStationTime_V() returns the clock time in a structure called DateTimeStamp given here:

      struct  DateTimeStamp 

      {

          int minute;

          int hour;

          int day;

          int month;

          int year;

      };

      You will notice that this time stamp structure does not contain a seconds field. This raises the complexity of synchronizing the console clock and the PC clock within a 60 second accuracy but fear not. Since I am a stickler for details, I have found a away to achieve much better than a 60 second accuracy between the PC clock and the Davis consoles.

      In order to achieve a higher accuracy, the software polls the consoles clock and looks for the minute field to change. This "edge" gives us a very good idea what the seconds field is without having direct access to the clock on the console. When the software starts up, and prior to the history retrieval, the clock is polled until this edge is seen.

      Once we accurately determine the clock of the console, we have another issue, if we measure the difference between the console clock and the PC clock, and we determine that they are out of the tolerance range, we next need to set the clock on the console accurately. To do this, we must then pause the software until a minute edge is detected on the PC side. When the edge is detected, the consoles clock it set immediately. This allows for synchronizing the clocks as closely as possible.

      To test whether or not your clock is being set accurately, run the software to allow the clocks to synchronize and normal data to be polled from the console then exit the software and re-start WUHU. If the clocks match well, you will get a message in the log showing you the measured drift between them. 

      The allowed tolerance is 10 seconds. If the clocks differ by more than 10 seconds, the console clock will be set at WUHU start up time.

      Give it a shot and let me know if you see any appreciable drift over days and weeks.

      ---

      90) Added option to synchronize the Davis consoles with the PC clock time. This feature is enabled via the INI file setting:

      [General Settings]

      …

      DAVISVP2 Sync Console Clock=1

      Note: Exit WUHU and edit the INI with Notepad.

      ---

      Software Download:

      WUHU216_32.zip 


    • utahweatherbear
      great job heath...will give it a shot! thanx, dan
      Message 2 of 12 , Nov 1, 2010
      • 0 Attachment
        great job heath...will give it a shot!

        thanx, dan


        --- In wuhu_software_group@yahoogroups.com, "wuhu_software" <wuhu_software@...> wrote:
        >
        >
        > Out of curiosity related to the question of the Davis Vue clock drift, I
        > have created a new feature to synchronize the Davis console clock with
        > the PC. At this time, I have decided to only do this with the Davis
        > units as the La Crosse protocol is very shaky and not to be trusted in
        > my personal opinion. The potential of console damage and angry users is
        > just not worth the effort / grief that could be potentially created by
        > using this feature on those consoles.
        >
        > Important Note: In order for this feature to work, you must have the
        > retrieval of the consoles history enabled. Otherwise the clock check is
        > bypassed completely. See the user manual if your history retrieval is
        > currently disabled for instructions on how to enable it.
        >
        > Clock Sync Details:
        >
        > The Davis API GetStationTime_V() returns the clock time in a structure
        > called DateTimeStamp given here:
        >
        > struct DateTimeStamp
        >
        >
        > {
        >
        > int minute;
        >
        > int hour;
        >
        > int day;
        >
        > int month;
        >
        > int year;
        >
        > };
        > You will notice that this time stamp structure does not contain a
        > seconds field. This raises the complexity of synchronizing the console
        > clock and the PC clock within a 60 second accuracy but fear not. Since I
        > am a stickler for details, I have found a away to achieve much better
        > than a 60 second accuracy between the PC clock and the Davis consoles.
        > In order to achieve a higher accuracy, the software polls the consoles
        > clock and looks for the minute field to change. This "edge" gives us a
        > very good idea what the seconds field is without having direct access to
        > the clock on the console. When the software starts up, and prior to the
        > history retrieval, the clock is polled until this edge is seen.
        > Once we accurately determine the clock of the console, we have another
        > issue, if we measure the difference between the console clock and the PC
        > clock, and we determine that they are out of the tolerance range, we
        > next need to set the clock on the console accurately. To do this, we
        > must then pause the software until a minute edge is detected on the PC
        > side. When the edge is detected, the consoles clock it set immediately.
        > This allows for synchronizing the clocks as closely as possible.
        > To test whether or not your clock is being set accurately, run the
        > software to allow the clocks to synchronize and normal data to be polled
        > from the console then exit the software and re-start WUHU. If the clocks
        > match well, you will get a message in the log showing you the measured
        > drift between them.
        > The allowed tolerance is 10 seconds. If the clocks differ by more than
        > 10 seconds, the console clock will be set at WUHU start up time.
        > Give it a shot and let me know if you see any appreciable drift over
        > days and weeks.
        > ---
        >
        > 90) Added option to synchronize the Davis consoles with the PC clock
        > time. This feature is enabled via the INI file setting:
        >
        > [General Settings]
        >
        > …
        >
        > DAVISVP2 Sync Console Clock=1
        >
        > Note: Exit WUHU and edit the INI with Notepad.
        >
        > ---
        >
        > Software Download:
        >
        > WUHU216_32.zip
        > <http://home.comcast.net/~wuhu_software/files/WUHU216_32.zip>
        >
      • mikedw5071
        Not that I ve noticed any drift... it worked for me, according to the log. Mon Nov 01 20:14:42 2010 The console s clock and the PC s clock time are off by 42
        Message 3 of 12 , Nov 2, 2010
        • 0 Attachment
          Not that I've noticed any drift... it worked for me, according to the log.

          Mon Nov 01 20:14:42 2010 > The console's clock and the PC's clock time are off by 42 seconds. Adjusting console clock to match the PC clock. Waiting until the next minute to set clock. Please wait.
          Mon Nov 01 20:15:00 2010 > The console's clock was set succesfully. Continuing.
        • wuhu_software
          Mike, If you exit and re-launch WUHU again, it will measure the difference rather than adjust the clock. It will show Measured Drift in the log.
          Message 4 of 12 , Nov 2, 2010
          • 0 Attachment
            Mike,

            If you exit and re-launch WUHU again, it will measure the difference rather than adjust the clock. It will show "Measured Drift" in the log.

            --- In wuhu_software_group@yahoogroups.com, "mikedw5071" <mike.christianson@...> wrote:
            >
            > Not that I've noticed any drift... it worked for me, according to the log.
            >
            > Mon Nov 01 20:14:42 2010 > The console's clock and the PC's clock time are off by 42 seconds. Adjusting console clock to match the PC clock. Waiting until the next minute to set clock. Please wait.
            > Mon Nov 01 20:15:00 2010 > The console's clock was set succesfully. Continuing.
            >
          • mikedw5071
            I restarted once and got this. Tue Nov 02 11:17:37 2010 The console s clock and the PC s clock time are off by 37 seconds. Then a third and finally got this.
            Message 5 of 12 , Nov 2, 2010
            • 0 Attachment
              I restarted once and got this.
              Tue Nov 02 11:17:37 2010 > The console's clock and the PC's clock time are off by 37 seconds.

              Then a third and finally got this.
              Tue Nov 02 13:54:09 2010 > The PC clock and console clock are set to within 10 seconds of one another (Measured Drift <= 9 seconds).

              Well, it's a nice feature at any rate. :)
            • wuhu_software
              That is interesting. Is this a Vue? Is there anything unusual about the machine that is running WUHU? Fast? Slow? I am seeing
              Message 6 of 12 , Nov 2, 2010
              • 0 Attachment
                That is interesting. Is this a Vue? Is there anything unusual about the machine that is running WUHU? Fast? Slow?

                I am seeing <= 2 to 3 seconds at most with a VP2.


                --- In wuhu_software_group@yahoogroups.com, "mikedw5071" <mike.christianson@...> wrote:
                >
                > I restarted once and got this.
                > Tue Nov 02 11:17:37 2010 > The console's clock and the PC's clock time are off by 37 seconds.
                >
                > Then a third and finally got this.
                > Tue Nov 02 13:54:09 2010 > The PC clock and console clock are set to within 10 seconds of one another (Measured Drift <= 9 seconds).
                >
                > Well, it's a nice feature at any rate. :)
                >
              • mikedw5071
                Yes, it is a Vue. The machine is a Dell Inspiron 1012 (Intel N450 (1.66GHz), 2GB RAM) running Windows 7 Starter. Here s another log entry: Tue Nov 02 16:19:10
                Message 7 of 12 , Nov 2, 2010
                • 0 Attachment
                  Yes, it is a Vue. The machine is a Dell Inspiron 1012 (Intel N450 (1.66GHz), 2GB RAM) running Windows 7 Starter.

                  Here's another log entry:
                  Tue Nov 02 16:19:10 2010 > The PC clock and console clock are set to within 10 seconds of one another (Measured Drift <= 10 seconds).
                • wuhu_software
                  Are you seeing these after a reboot of the machine or are you starting and stopping WUHU? If the machine is busy at startup and WUHU attempts history reads
                  Message 8 of 12 , Nov 3, 2010
                  • 0 Attachment
                    Are you seeing these after a reboot of the machine or are you starting and stopping WUHU?

                    If the machine is busy at startup and WUHU attempts history reads immediately, this could throw things off. That was the intent for creating the retrieval delay in the INI file so that Windows is not busy when you start the read.

                    --- In wuhu_software_group@yahoogroups.com, "mikedw5071" <mike.christianson@...> wrote:
                    >
                    > Yes, it is a Vue. The machine is a Dell Inspiron 1012 (Intel N450 (1.66GHz), 2GB RAM) running Windows 7 Starter.
                    >
                    > Here's another log entry:
                    > Tue Nov 02 16:19:10 2010 > The PC clock and console clock are set to within 10 seconds of one another (Measured Drift <= 10 seconds).
                    >
                  • mikedw5071
                    The first one was after a reboot (Windows Update) but I don t recall if I allowed the pause for Computer Startup or not. The subsequent restarts were just WUHU
                    Message 9 of 12 , Nov 3, 2010
                    • 0 Attachment
                      The first one was after a reboot (Windows Update) but I don't recall if I allowed the pause for Computer Startup or not.

                      The subsequent restarts were just WUHU restarts. Here's another WUHU restart:
                      Wed Nov 03 09:34:39 2010 > The console's clock and the PC's clock time are off by 39 seconds. Adjusting console clock to match the PC clock. Waiting until the next minute to set clock. Please wait.
                      Wed Nov 03 09:35:00 2010 > The console's clock was set succesfully. Continuing.

                      By the way, it takes just over a minute for the WUHU process to terminate when I close the window. Any idea if that's normal?
                    • wuhu_software
                      Are you talking about a normal termination after the program is up and running or are you talking about aborting the history read? On normal exit, it takes
                      Message 10 of 12 , Nov 3, 2010
                      • 0 Attachment
                        Are you talking about a normal termination after the program is up and running or are you talking about aborting the history read? On normal exit, it takes about 5-10 seconds depending on the speed of the machine as weather records and the log are written to the hard drive on shut down.

                        I have recently allowed WUHU to run on multiple processors. I tried this a few weeks ago and received a report of a lock up. If you think this may be related to multiple cores, please set the processor affinity by right clicking WUHU in the task manager process list and set it to a single processor.

                        Please let me know what you observe.

                        Thanks.

                        --- In wuhu_software_group@yahoogroups.com, "mikedw5071" <mike.christianson@...> wrote:
                        >
                        > The first one was after a reboot (Windows Update) but I don't recall if I allowed the pause for Computer Startup or not.
                        >
                        > The subsequent restarts were just WUHU restarts. Here's another WUHU restart:
                        > Wed Nov 03 09:34:39 2010 > The console's clock and the PC's clock time are off by 39 seconds. Adjusting console clock to match the PC clock. Waiting until the next minute to set clock. Please wait.
                        > Wed Nov 03 09:35:00 2010 > The console's clock was set succesfully. Continuing.
                        >
                        > By the way, it takes just over a minute for the WUHU process to terminate when I close the window. Any idea if that's normal?
                        >
                      • mikedw5071
                        Yes, I was referring to normal termination of WUHU.exe. Sorry to mix that issue in with the other stuff without being clear. Using Process Explorer, I think I
                        Message 11 of 12 , Nov 3, 2010
                        • 0 Attachment
                          Yes, I was referring to normal termination of WUHU.exe. Sorry to mix that issue in with the other stuff without being clear.

                          Using Process Explorer, I think I was able to rule out a multiprocessor issue and determine the actual issue. Surprisingly, it showed CPU usage by WUHU.exe was very low during shutdown but that I/O activity was high and prolonged. It must be due to my running WUHU on an SD card rather than the system's hard drive. (The netbook has a mechanical hard drive; I'm using the SD card as poor man's SSD.)

                          I may still experiment with the processor affinity, but I'm satisfied with my finding.

                          So, as to the clock drift/correction, here's some interesting stuff for you. Both of these startups were preceded by a shutdown of WUHU.exe but not the machine. I did not allow WUHU to wait for the computer to start up since it was already on and I was impatient. :)


                          Wed Nov 03 09:34:39 2010 > The console's clock and the PC's clock time are off by 39 seconds. Adjusting console clock to match the PC clock. Waiting until the next minute to set clock. Please wait.
                          Wed Nov 03 12:02:53 2010 > The console's clock and the PC's clock time are off by 53 seconds. Adjusting console clock to match the PC clock. Waiting until the next minute to set clock. Please wait.
                          Wed Nov 03 12:09:10 2010 > The PC clock and console clock are set to within 10 seconds of one another (Measured Drift <= 10 seconds).
                        • wuhu_software
                          That is very interesting. I am not sure why the measured drift is so high. One thing you might observe that may be of interest. When you first start WUHU, the
                          Message 12 of 12 , Nov 3, 2010
                          • 0 Attachment
                            That is very interesting. I am not sure why the measured drift is so high.

                            One thing you might observe that may be of interest. When you first start WUHU, the progress bar is advancing each time the consoles clock is polled. I my system it is polling about once per second until the initial console minute tick is detected. The set operation takes place immediately, but the progress bar ticks quickly (every 100ms) until the PC minute timer rolls over. Then the set clock is issued which should be pretty darn quick. You might observe the log while all the above is going on.



                            --- In wuhu_software_group@yahoogroups.com, "mikedw5071" <mike.christianson@...> wrote:
                            >
                            > Yes, I was referring to normal termination of WUHU.exe. Sorry to mix that issue in with the other stuff without being clear.
                            >
                            > Using Process Explorer, I think I was able to rule out a multiprocessor issue and determine the actual issue. Surprisingly, it showed CPU usage by WUHU.exe was very low during shutdown but that I/O activity was high and prolonged. It must be due to my running WUHU on an SD card rather than the system's hard drive. (The netbook has a mechanical hard drive; I'm using the SD card as poor man's SSD.)
                            >
                            > I may still experiment with the processor affinity, but I'm satisfied with my finding.
                            >
                            > So, as to the clock drift/correction, here's some interesting stuff for you. Both of these startups were preceded by a shutdown of WUHU.exe but not the machine. I did not allow WUHU to wait for the computer to start up since it was already on and I was impatient. :)
                            >
                            >
                            > Wed Nov 03 09:34:39 2010 > The console's clock and the PC's clock time are off by 39 seconds. Adjusting console clock to match the PC clock. Waiting until the next minute to set clock. Please wait.
                            > Wed Nov 03 12:02:53 2010 > The console's clock and the PC's clock time are off by 53 seconds. Adjusting console clock to match the PC clock. Waiting until the next minute to set clock. Please wait.
                            > Wed Nov 03 12:09:10 2010 > The PC clock and console clock are set to within 10 seconds of one another (Measured Drift <= 10 seconds).
                            >
                          Your message has been successfully submitted and would be delivered to recipients shortly.