Please read the posts in the Announcements section about the current status of Cumulus development now that I have retired

Please read this post before posting

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3043 Jan 20 2017. See this post for download

Solar Gauge "Wedge" Issue

Discussion of Mark Crossley's HTML5/Javascript gauges

Moderator: mcrossley

Herbaldew
Posts: 65
Joined: Sun Mar 12, 2017 8:33 pm
Weather Station: VP2+
Operating System: Raspbian Stretch
Location: US Mid-Atlantic

Solar Gauge "Wedge" Issue

Postby Herbaldew » Fri Jun 23, 2017 10:15 pm

I originally posted this in the Cumulus MX forum as I wasn't sure if it was a program bug or something to do with the gauges. I didn't get any replies and after some experimenting I discovered it is to do with the gauges so I will post here.

The shaded background "wedge" for the current theoretical maximum reading usually begins at the current maximum and extends upward by 100 W/m2.

I have noticed that it will not extend beyond 1000 W/m2. The wedge shrinks when the max is between 900 and 1000 and disappears when it exceeds 1000 and returns once again when it falls back below 1000. This happens in the GUI and on uploaded web pages.

My experiment: I changed "solarGaugeScaleMax : 1000, " in gauges.js to "solarGaugeScaleMax : 1400, "

The "wedge" works properly this way, but the range starts out at 1400 instead of 1000 and increasing when needed.

Is there a setting to make the "wedge" work without having the range set so high?

Thanks

User avatar
mcrossley
Posts: 4979
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Jessie Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Solar Gauge "Wedge" Issue

Postby mcrossley » Fri Jun 23, 2017 11:07 pm

Missed this one!

I took a look at my web page and wasn't able to reproduce this - then I looked at the released code! My personal copy is quite a bit different in this area as it show multiple 'segments' for the sunshine threshold etc. I must get these changes released some day!

Anyway, the quick fix is (version 2.6.1 of the script):
Change the code starting at line 2493 from...

Code: Select all

// Set a section (100 units wide) to show current theoretical max value
if (data.CurrentSolarMax !== 'N/A') {
    ssGauge.setArea([steelseries.Section(cache.currMaxValue, Math.min(cache.currMaxValue + 100,
                    gaugeGlobals.solarGaugeScaleMax), 'rgba(220,0,0,0.5)')]);
}

// Need to rescale the gauge?
cache.maxValue = Math.max(cache.value, cache.currMaxValue, cache.maxToday, gaugeGlobals.solarGaugeScaleMax);
cache.maxValue = nextHighest(cache.maxValue, 100);
if (cache.maxValue !== ssGauge.getMaxValue()) {
    ssGauge.setMaxValue(cache.maxValue);
}


to...

Code: Select all

// Need to rescale the gauge?
cache.maxValue = Math.max(cache.value, cache.currMaxValue, cache.maxToday, gaugeGlobals.solarGaugeScaleMax);
cache.maxValue = nextHighest(cache.maxValue, 100);
if (cache.maxValue !== ssGauge.getMaxValue()) {
    ssGauge.setMaxValue(cache.maxValue);
    cache.maxValue = ssGauge.getMaxValue();
}

// Set a section (100 units wide) to show current theoretical max value
if (data.CurrentSolarMax !== 'N/A') {
    ssGauge.setArea([steelseries.Section(cache.currMaxValue, Math.min(cache.currMaxValue + 100,
                    cache.maxValue), 'rgba(220,0,0,0.5)')]);
}

Herbaldew
Posts: 65
Joined: Sun Mar 12, 2017 8:33 pm
Weather Station: VP2+
Operating System: Raspbian Stretch
Location: US Mid-Atlantic

Re: Solar Gauge "Wedge" Issue

Postby Herbaldew » Sat Jun 24, 2017 3:46 pm

Thanks - working well now.

I had never upgraded from the 2.5.5 script that is included in the CMX download and this doesn't work with that version.

This forced me to finally get around to figuring out how to upgrade the gauges and deciphering my notes on the modifications I had made to gauges.js :D

Herbaldew
Posts: 65
Joined: Sun Mar 12, 2017 8:33 pm
Weather Station: VP2+
Operating System: Raspbian Stretch
Location: US Mid-Atlantic

Re: Solar Gauge "Wedge" Issue

Postby Herbaldew » Sun Jun 25, 2017 4:15 pm

Jumped the gun a bit on my report - I had already had a W/m2 reading above 1000 when I got things sorted yesterday.

Today, the wedge still slowly disappeared as the theoretical approached 1000. When the clouds cleared and the actual reading exceeded 1000 redrawing the range, the wedge reappeared correctly.

I guess that means that only the actual reading can cause the range to redraw and things would have to be changed so that the upper end of the wedge would cause a redraw for it to work completely correct.

I have no idea if that is even possible but did want to update my comments.

Thanks again for your work on this!

BCJKiwi
Posts: 845
Joined: Mon Jul 09, 2012 8:40 pm
Weather Station: Davis VP2 Cabled with Solar
Operating System: Windows 10 Pro
Location: Auckland, New Zealand
Contact:

Re: Solar Gauge "Wedge" Issue

Postby BCJKiwi » Sun Jun 25, 2017 9:06 pm

Seem to have the same/similar issue with the pressure gauge.
The "fix" has not change the solar gauge behavior (yet).

Have also had occasional errors showing in the server logs with reference to a 404 document not found for the file .../lib/steelseries/scripts/language.min.js.map
As this file seems not to exist anywhere and I can find no direct reference to it in any of the scripts I have checked, am at a loss to determine where this may come from.

User avatar
mcrossley
Posts: 4979
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Jessie Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Solar Gauge "Wedge" Issue

Postby mcrossley » Tue Jun 27, 2017 2:11 pm

Herbaldew wrote:Jumped the gun a bit on my report - I had already had a W/m2 reading above 1000 when I got things sorted yesterday.

Today, the wedge still slowly disappeared as the theoretical approached 1000. When the clouds cleared and the actual reading exceeded 1000 redrawing the range, the wedge reappeared correctly.

I guess that means that only the actual reading can cause the range to redraw and things would have to be changed so that the upper end of the wedge would cause a redraw for it to work completely correct.

I have no idea if that is even possible but did want to update my comments.

Thanks again for your work on this!

Dah! Knew I should have tested it but didn't have time. I'm on holiday at the moment, I'll take another look when I can...

User avatar
mcrossley
Posts: 4979
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Jessie Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Solar Gauge "Wedge" Issue

Postby mcrossley » Tue Jun 27, 2017 2:14 pm

BCJKiwi wrote:Seem to have the same/similar issue with the pressure gauge.
The "fix" has not change the solar gauge behavior (yet).

Have also had occasional errors showing in the server logs with reference to a 404 document not found for the file .../lib/steelseries/scripts/language.min.js.map
As this file seems not to exist anywhere and I can find no direct reference to it in any of the scripts I have checked, am at a loss to determine where this may come from.

The map files are loaded (or should I looked for and loaded if present) by your browser when it is in "developer" mode - they translate minimised files back to the original source file variable names to ease debugging. The browser will not attempt to load them when loading the page outside "dev mode".

User avatar
mcrossley
Posts: 4979
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Jessie Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Solar Gauge "Wedge" Issue

Postby mcrossley » Tue Jun 27, 2017 2:58 pm

Herbaldew wrote:Jumped the gun a bit on my report - I had already had a W/m2 reading above 1000 when I got things sorted yesterday.

Today, the wedge still slowly disappeared as the theoretical approached 1000. When the clouds cleared and the actual reading exceeded 1000 redrawing the range, the wedge reappeared correctly.

I guess that means that only the actual reading can cause the range to redraw and things would have to be changed so that the upper end of the wedge would cause a redraw for it to work completely correct.

I have no idea if that is even possible but did want to update my comments.

Thanks again for your work on this!

OK, I've re-read this more carefully and played with the supplied code. The code is behaving as I expected, and as you describe. You are mainly correct, the actual reading going above 1000 will cause a rescale (as will todays max reading and/or the theoretical value exceeding 1000), the upper end of the wedge going above 1000 will not.
If your readings are regularly pushing up to the magic 1000 (without any spikes to cause a rescale), then I suggest you change the max gauge scale to 1100 to give a bit more headroom? Set via gaugeGlobals.solarGaugeScaleMax...

Code: Select all

            solarGaugeScaleMax    : 1000,           // Max value to be shown on the solar gauge - theoretical max without atmosphere ~ 1374 W/m²
                                                    // - but Davis stations can read up to 1800, use 1000 for Northern Europe?

As the comment says, I just chose 1000 as a reasonable setting for northern Europe where I live.

If you want to go off-piste, and rescale to show the full "over theoretical" segment regardless of values chosen for scales etc, then change:

Code: Select all

cache.maxValue = Math.max(cache.value, cache.currMaxValue, cache.maxToday, gaugeGlobals.solarGaugeScaleMax);

to

Code: Select all

cache.maxValue = Math.max(cache.value, cache.currMaxValue + 100, cache.maxToday, gaugeGlobals.solarGaugeScaleMax);

But as I may not put this in the base code, remember to patch any future releases you download to same way.

User avatar
mcrossley
Posts: 4979
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Jessie Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Solar Gauge "Wedge" Issue

Postby mcrossley » Tue Jun 27, 2017 4:09 pm

BCJKiwi wrote:Seem to have the same/similar issue with the pressure gauge.

The pressure gauge works differently from the solar in that the sectors are no fixed size. They just display from your all-time min/max pressures to the start/end of the gauge scale. So the sector widths will vary according to how close those records are to the scale limits. There is a minimum 'buffer' value between the records and the scale limits of 2 hPa (0.1 inHg), which forces a gauge rescale if the sector size would be smaller than those values.

Herbaldew
Posts: 65
Joined: Sun Mar 12, 2017 8:33 pm
Weather Station: VP2+
Operating System: Raspbian Stretch
Location: US Mid-Atlantic

Re: Solar Gauge "Wedge" Issue

Postby Herbaldew » Wed Jun 28, 2017 3:20 pm

Working perfectly as far as I can see now. The little voice in the back of my mind was telling that a "+ 100" somewhere would make it do what I wanted :)

Thanks again.

Herbaldew
Posts: 65
Joined: Sun Mar 12, 2017 8:33 pm
Weather Station: VP2+
Operating System: Raspbian Stretch
Location: US Mid-Atlantic

Re: Solar Gauge "Wedge" Issue

Postby Herbaldew » Wed Aug 09, 2017 4:22 pm

Playing with this gauge again and am stuck as usual :D

I am trying to get the "wedge" to not display when the current theoretical max = zero.

I have been trying to manipulate this section of code:

Code: Select all

if (data.CurrentSolarMax !== 'N/A')

Everything I try breaks the display. Am I even barking up the right tree?




Here is the code from the theoretical solar section of my current gauges.js (altered to show wedge -50 to + 50 instead of the default +100):

Code: Select all

                   // Set a section (100 units wide) to show current theoretical max value
                   if (data.CurrentSolarMax !== 'N/A') {
                   ssGauge.setArea([steelseries.Section(cache.currMaxValue - 50, Math.min(cache.currMaxValue + 50,
                   cache.maxValue), 'rgba(255,0,0,0.5)')]);
                   }



Thanks - Herb

User avatar
mcrossley
Posts: 4979
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Jessie Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Solar Gauge "Wedge" Issue

Postby mcrossley » Wed Aug 09, 2017 7:39 pm

You could change

Code: Select all

if (data.CurrentSolarMax !== 'N/A')

to

Code: Select all

if (cache.currMaxValue > 0)

Since that is intended for software that does not provide the data.

But you will also need an 'else' to remove the section once it reaches zero, otherwise the last section will always be displayed.

Code: Select all

} else {
    ssGauge.setArea([]);
}

Herbaldew
Posts: 65
Joined: Sun Mar 12, 2017 8:33 pm
Weather Station: VP2+
Operating System: Raspbian Stretch
Location: US Mid-Atlantic

Re: Solar Gauge "Wedge" Issue

Postby Herbaldew » Wed Aug 09, 2017 8:11 pm

When I do this the page breaks like it does with everything I have tried. That is...no gauges show up, just the radio buttons below the ones that have them.

mcrossley wrote:You could change

Code: Select all

if (data.CurrentSolarMax !== 'N/A')

to

Code: Select all

if (cache.currMaxValue > 0')


User avatar
mcrossley
Posts: 4979
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Jessie Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Solar Gauge "Wedge" Issue

Postby mcrossley » Wed Aug 09, 2017 8:14 pm

Just to check, you are changing the "data." to "cache." ?
Opps! - and you didn't copy the extraneous single quote! :roll:

Herbaldew
Posts: 65
Joined: Sun Mar 12, 2017 8:33 pm
Weather Station: VP2+
Operating System: Raspbian Stretch
Location: US Mid-Atlantic

Re: Solar Gauge "Wedge" Issue

Postby Herbaldew » Wed Aug 09, 2017 8:31 pm

mcrossley wrote:Opps! - and you didn't copy the extraneous single quote! :roll:


Of course I did lol

That unbroke the page - now I can move on to figuring out where to add the "else" statement :)


Return to “SteelSeries Gauges”

Who is online

Users browsing this forum: No registered users and 7 guests