Jump to content

NLCbanner2024.jpg.2478be509670e60c2d6efd04834b8b47.jpg

Gina

Beyond the Event Horizon
  • Posts

    45,326
  • Joined

  • Last visited

  • Days Won

    120

Posts posted by Gina

  1. After several months use and working well, the ASC finally succumbed to ingress of wet following many days of torrential rain and gales so it's come indoors for a service.  There was mist in the lens which has now dried out and the camera is working and giving a reasonable image.  Except that the focus has changed! 

    The reason for the weatherproofing failure was the silicone sealant.  We have had very large changes in temperature which could have been detrimental to the sealant.  Then a very high wind with heavy rain must have forced wet up the 20mm dome overlap and into the insides.  We are accustomed to horizontal rain but in this case the wet was forced upwards!!  Whether there's any way of preventing wind blown rain going up into the dome if the sealant fails, I don't know but I guess more thought is required.

    Another problem is that over the months, the focus has changed slightly but enough to make me try refocussing.  Been trying to refocus the ASC but had forgotten how extremely coarse the focussing was.  Unlocked the focussing ring on the lens and moved it a "midgets whisker" and the focus was 10 times worse!!  I was hoping that the focus would remain pretty good once set up but it does seem to have changed.  Drat!!  Looks like it may need remote focussing after all.  I'll have to think about it.

    I wonder if I'll ever get an ASC that continues to work as I want!!

  2. The anemometer is very sensitive and turns smoothly at well under 1 mph so the mean speed could be displayed in tenths but I guess there's really no point (no pun intended).

    The Beaufort scale for wind force is a good indicator but really I would like more points.

  3. The wind is very light and variable with anemometer rotating at around 1rps or less so not every 3s period getting a pulse.  This could be the reason, I guess, though how the instantaneous direction could be over 15 when there's a modulo 16, I don't know!

    Sometimes the display seems right.

    655545608_Screenshotfrom2020-08-3018-45-00.png.ae0f268f514877f48ac80403248f7970.png

  4. Next I need to adjust the direction to suit the orientation of the wind instruments.  This could be done when reading the encoder or when displaying the results.  I guess the former is easiest.

    Think this should do it.

        dirn = (dirn - 1) %16; // correct encoder for North

    688800911_Screenshotfrom2020-08-3010-42-51.png.8d56b2e535f0207b9348d29a2c35a126.png

  5. Seems as if the mean direction is bearing no relationship to the actual wind vane direction.  The instantaneous direction is correct so the encoder is working fine - it's the Consensus Averaging calculations that are wrong.  Somewhere in all that code!!

    1793581683_Screenshotfrom2020-08-2921-54-54.png.c2088c8019ae9ef814e35cd261928122.png

  6. I'll just confirm that all compass points for the wind vane give sensible results then look to installing the wind sensors and mast.

    Later...  Should have guessed it was too good to be true.  OK yes the speed processing seems fine but the direction isn't!  I had posted the sketch but now removed it as it isn't right.

    Switched the fan off and let the anemometer slow down and stop then moved the vane to the 0 position.  I have given the Consensus Averaging time to work and for the wind speed to decay from the ring arrays.  This is the result.

    819904904_Screenshotfrom2020-08-2921-32-24.png.70bae79fde267f5935fe5a7eefcd4ae4.png

    Yes!!  It's a long way off right!!  So now I have more debugging to do!  Though not tonight I don't think.

  7. Corrected that error and the gust speed is reading correctly but the mean speed is still increasing.  So still an error!!  Somewhere in this section of code.

    void do1mJobs(){
      // wind speed mean and gust ring arrays and report
      meanArray[ringIndex] = windSpeed; // put windSpeed into new array index
      gustArray[ringIndex] = windGust;  // put windGust into new array index
    //  windSpeed /=13;  // /20 and *1.5 -- leave this for later
      meanSpeed = 0; gustSpeed = 0;
      for (int i = 0; i < 10; i++) {
        meanSpeed += meanArray[i];  // add all windSpeeds 
        if (gustArray[i] > gustSpeed){gustSpeed = gustArray[i];}; // find maximum gust speed
      }
      meanSpeed /=133;  // the first sum was over 20 values and then the second over 10 values
      gustSpeed *= 1.5;  // Speed count over 3s rather than 4.5s
      sendSpeedMessages();  // HOLD temporarily for debugging
      windGust = 0;
      sendNumberMessage(ringIndex);  //  send ringIndex for debugging
      ringIndex = (ringIndex+1)%10; // move ringIndex on to next location in the ring array
    }

     

  8. For debugging I have added a number display in the Wind tab.  Currently showing the ringIndex and that is correct - starting at 0, increasing up to 9 and then back to 0.  The mean and gust displays are increasing with every change in index though so I have another error (or two).  Clearly not zeroing the values before forming sum and maximum.

  9. I think the wind direction may be correct.  The instantaneous direction is varying between WSW and W - 11 & 12 points or 247.5° and 270°.  The mean direction is reading 261° which agrees (it is between 247.5 and 270).

    The wind mean speed is a different matter!!  It isn't working!   This is the averaging in the ring array.  OTOH the Gust speed does seem to be working.

    1147838686_Screenshotfrom2020-08-2917-18-15.png.dd8b2097c5f72d11d2d43a77e4ca6174.png

  10. About to run this code

    void do3sJobs (){
    //  sendDirectionMessage(readDirection()); // send instantaneous direction
      windSpeed += PulseCount;  //  Accumulate mean speed
      if (PulseCount > windGust) {windGust = PulseCount;};  // Get max speed for gust
      PulseCount = 0;
      ++bin[readDirection()]; // increment appropriate bin
    }
    void do1mJobs(){
      // debugging - send current mean and gust speeds
      meanSpeed = windSpeed/20;  gustSpeed = windGust;
      windSpeed = 0;
      sendSpeedMessages();

     

  11. Checking mean and gust speeds at the 1m point.

    void do3sJobs (){
      windSpeed = ++PulseCount;  //  Accumulate mean speed
      if (PulseCount > windGust) {windGust = PulseCount;};  // Get max speed for gust
      PulseCount = 0;
      ++bin[readDirection()]; // increment appropriate bin
    }
    void do1mJobs(){
      // debugging - send current mean and gust speeds
      meanSpeed = windSpeed;  gustSpeed = windGust;
      sendSpeedMessages();

    The results are wrong.  All speeds are showing 1 rather than 0 with no fan running.  Gust speed looks reasonable looking at the anemometer revs though 1 higher than it should be.  The Mean speed should show around 20 times the real value as the value is the sum of 20 counts and hasn't been divided.

    It points to this line

      windSpeed = ++PulseCount;  //  Accumulate mean speed

    From Arduino reference

    Example Code
    
    x = 2;
    y = ++x;  // x now contains 3, y contains 3
    y = x++;  // x contains 4, but y still contains 3

    I can see what's wrong.

    Got the wrong operator, should be

    x += y; // equivalent to the expression x = x + y;

    Corrected

      windSpeed += PulseCount;  //  Accumulate mean speed

     

  12. Actually, none of it is working correctly!!  I've turned the fan off so the speed is zero.  The direction is now something like 180° different and this hasn't shown up.  I can see this is going to take a lot of debugging.  And it's not as if I can put breakpoints in the code and debug it in the normal way.  I shall have send messages to the MQTT network at strategic points in the calculations.

  13. Wrong

    void loop() {
      if (!client.connected()) {
        reconnect();
      }
      client.loop();
    
      long now = millis();
      if(now - last3s > P3s) {do3sJobs; last3s = now;}
      if(now - last1m > P1m) {do1mJobs; last1m = now;}
      if(now - last3m > P3m) {do3mJobs; last3m = now;}
    }

    Right - missed out the () in the doxxJobs calls.  Doh!!

    void loop() {
      if (!client.connected()) {
        reconnect();
      }
      client.loop();
    
      long now = millis();
      if(now - last3s > P3s) {do3sJobs(); last3s = now;}
      if(now - last1m > P1m) {do1mJobs(); last1m = now;}
      if(now - last3m > P3m) {do3mJobs(); last3m = now;}
    }

     

  14. First test - sending the instantaneous wind direct every 3 seconds.

    void do3sJobs (){
      sendDirectionMessage(readDirection()); // send instantaneous direction

    Later...  NOT working - nothing!!!

    Have to try something simpler!

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.