Page 4 of 34

Re: Cumulus RealTime Data Grabber - Tool

Posted: Tue 06 Mar 2012 1:39 pm
by Solorize
Terry,

Thats does seem odd. I have checked my code and under the 60second radio button is:

Code: Select all

        If RadioButton4.Checked = True Then
            Form1.Timer1.Interval = 60000
        End If

FYI. 1000ms = 1 sec therefore 60,000 = 60 seconds

I have tested this at home and here at work on Win XP and Win 7 and
both update for me at ~60 seconds.

Also in my code I have put in an "Error Handler" so that if the grabber fails to get the realtime.txt file
then it tries again untill it can access it. Which may be what you are experiencing? i.e. it cant get it
1st try and then manages to get it on a subsequent try.


Nitrx,
I still cant understand why it display's x10 for you. I have been trying to look on the inet for any posts
on VB.Net forums that might give me a clue, but have as yet found nothing. I will keep looking and will
post to a couple of forum's to see if anyone can shed any light on why this may be happening.
Fingerscrossed I find out soon :)

As you know I have only just started self teaching myself VB.NET and this is the first time I have used "charts"
in VB so it may take a while to try and find a fix., Especially as all the code seems correct and nothing has
any multiplier added to it. If there was a problem within the code I would have expected it to show the x10
on other peoples machines that are running it, which makes this more intriguing.

Re: Cumulus RealTime Data Grabber - Tool

Posted: Tue 06 Mar 2012 2:20 pm
by mcrossley
Solorize wrote: Nitrx,
I still cant understand why it display's x10 for you. I have been trying to look on the inet for any posts
on VB.Net forums that might give me a clue, but have as yet found nothing. I will keep looking and will
post to a couple of forum's to see if anyone can shed any light on why this may be happening.
Fingerscrossed I find out soon :)
Not sure if this is the cause but if you are handling the numbers as strings at any point then you will probably need to make sure you are forcing the "Culture" to one that uses point decimals - the InvariantCulture: "" is normally used for this, and switch to the users default culture for display.

Re: Cumulus RealTime Data Grabber - Tool

Posted: Tue 06 Mar 2012 3:00 pm
by nitrx
I did some investigetions with realtime.txt from the cumulus user map I did notice that the older versions from cumulus before build 1000 don't give a graph for temperature at all (also for UK sites), a French site with build 1029 didn't make graphs for temperature at all.

BTW Solorize I had read you just concentraded on programming in VB , looks very interesting althoug I tried it but don't understand a word of it by now

10 rem
20 for x=1 to 1000/0
30 print x
40 next x

Division by zero near line 20 :lol:

Re: Cumulus RealTime Data Grabber - Tool

Posted: Tue 06 Mar 2012 9:34 pm
by Solorize
Mark,
Thanks for the info, I will have to do a bit of reading up as have never used "cultures" before!

One thing I would like to try is changing the "Data Types" to see if that sorts the problem out.
Start with the easy bit first just to rule them out and just so I know it not something simple LOL ;)

So I have created 3 test versions which change the "Data Type" as follow to see if this corrects the problem:


Test version "string": http://www.wokinghamweather.co.uk/downl ... string.zip


Test version "single": http://www.wokinghamweather.co.uk/downl ... single.zip


Test version "double": http://www.wokinghamweather.co.uk/downl ... double.zip


nitrx,

That is interesting, I wonder if it was due to the same problem I am currently facing :roll:

Could I ask you to download the three test versions above and let me know if any of them fix the problem
with the Temperature Graph display. If one of them works correctly can you let me know which one :)

If not then I will have to have a look into how to use and add in "InvariantCulture" into my code as Mark suggested
to see if that fixes it.

Re: Cumulus RealTime Data Grabber - Tool

Posted: Tue 06 Mar 2012 9:57 pm
by Solorize
Mark,

This is the code I am currently using to read the values into an array from the RealTime.txt file (which is loaded into TextBox2),
and then assigned to various Labels, please see VB.NET code snippet below.

Could this be causing the problem as they are "Strings"?


FYI. I have not wrapped the code in code tags, as I wanted to be able to BOLD and use Colours to
highlight parts of the code to heopfully make it easier for me to explain.


/// CODE SNIPPET START ///

'Puts values from RealTime.txt (being displayed in TextBox), into and Array and shows them on Labels.
Dim strMRD As String
Dim strArr() As String
Dim count As Integer
strMRD = TextBox2.Text
strArr = strMRD.Split(" ")

For count = 0 To strArr.Length - 1

Label1.Text = strArr(0) 'date (always dd/mm/yy)
Label2.Text = strArr(1) 'time(always hh:mm:ss)
Label3.Text = strArr(2) 'outside temperature
Label4.Text = strArr(3) 'relative humidity
Label5.Text = strArr(4) 'dewpoint
Label6.Text = strArr(5) 'wind speed (average)
Label7.Text = strArr(6) 'latest wind speed reading
Label8.Text = strArr(7) 'wind bearing (degrees)
Label9.Text = strArr(8) 'current rain rate (per hour)
Label10.Text = strArr(9) 'rain today
Label11.Text = strArr(10) 'barometer
Label12.Text = strArr(11) 'current wind direction (compass point)
Label13.Text = "F" + strArr(12) 'wind speed (beaufort)
Label14.Text = strArr(13) 'wind units - m/s, mph, km/h, kts
Label15.Text = "°" + strArr(14) 'temperature units - degree C, degree F
Label16.Text = strArr(15) 'pressure units - MB, hPa, in
Label17.Text = strArr(16) 'rain units - mm, in
Label18.Text = strArr(17) 'wind run (today)
Label19.Text = strArr(18) 'pressure trend value
Label20.Text = strArr(19) 'monthly rainfall
Label21.Text = strArr(20) 'yearly rainfall
Label22.Text = strArr(21) 'yesterday's rainfall
Label23.Text = strArr(22) 'inside temperature
Label24.Text = strArr(23) 'inside humidity
Label25.Text = strArr(24) 'wind chill
Label26.Text = strArr(25) 'temperature trend value
Label27.Text = strArr(26) 'today's high temp
Label28.Text = "@ " + strArr(27) 'time of today's high temp (hh:mm)
Label29.Text = strArr(28) 'today's low temp
Label30.Text = "@ " + strArr(29) 'time of today's low temp (hh:mm)
Label31.Text = strArr(30) 'today's high wind speed (average)
Label32.Text = "@ " + strArr(31) 'time of today's high wind speed (average) (hh:mm)
Label33.Text = strArr(32) 'today's high wind gust
Label34.Text = "@ " + strArr(33) 'time of today's high wind gust (hh:mm)
Label35.Text = strArr(34) 'today's high pressure
Label36.Text = "@ " + strArr(35) 'time of today's high pressure (hh:mm)
Label37.Text = strArr(36) 'today's low pressure
Label38.Text = "@ " + strArr(37) 'time of today's low pressure (hh:mm)
Label39.Text = strArr(38) 'Cumulus version
Label40.Text = strArr(39) 'Cumulus build number
Label41.Text = strArr(40) '10-minute high gust
Label42.Text = strArr(41) 'heat index
Label43.Text = strArr(42) 'humidex
Label44.Text = strArr(43) 'UV Index
Label45.Text = strArr(44) 'evapotranspiration today
Label46.Text = strArr(45) 'solar radiation W/m2
Label47.Text = strArr(46) '10-minute average wind bearing (degrees)
Label48.Text = strArr(47) 'rainfall last hour
Label49.Text = strArr(48) 'The number of the current forecasts
Label50.Text = strArr(49) 'Flag to indicate that the location of the station is currently in daylight (1 = yes, 0 = No)
Label51.Text = strArr(50) 'If the station has lost contact with its remote sensors "Fine Offset only", a Flag number is given (1 = Yes, 0 = No)
Label52.Text = strArr(51) 'Average wind direction
Label53.Text = strArr(52) 'Cloud base
Label54.Text = strArr(53) 'Cloud base units
Label55.Text = strArr(54) 'Apparent Temperature
Label56.Text = strArr(55) 'Sunshine hours so far today
Label57.Text = strArr(56) 'Current theoretical max solar radiation
Label58.Text = strArr(57) 'Is it sunny? 1 if the sun is shining, otherwise 0

/// CODE SNIPPET END ///

The Sub below is how I assign the values held by the labels, Label: 3, 5 & 25 to the graphical chart
shown in Bold in both the above and below code snippets. As you can see in red
below I have given the Variables OutsideTemp, DewPoint and WindChill a data type of "Single", which I previously
had as an "Integer" which may have been causing problems.

But my main thought is that if I have already pulled the values into the array (in the above code) as strings
when I then try to change them to "Single" in the below code, the damage is already done to the value
and they won't be accepted as true "Single" if you know what I mean ;) hopefully that makes sence LOL

/// CODE SNIPPET START ///

Private Sub PlotChart()
Dim s As New Series
Dim OutsideTemp As Single
Dim DewPoint As Single
Dim WindChill As Single


Chart1.Series.Dispose()
Chart1.Series.Clear()

'Makes Chart visible on [Outside Conditions] tab screen
Chart1.Visible = True


On Error Resume Next

'Create a new series and add data points to it.
'Dim s As New Series
s.Name = "Temp °C"

'Clears Chart
Chart1.Series.Clear()

'Sets Y Axis Title, to Temperature and the Temperature unit from Label15
Chart1.ChartAreas(0).AxisY.Title = "Temperature " + Label15.Text
'Chart1.ChartAreas(0).AxisY.Interval = 1

OutsideTemp = Label3.Text
DewPoint = Label5.Text
WindChill = Label25.Text

'Change to a line graph.
's.ChartType = SeriesChartType.Line
s.ChartType = SeriesChartType.Column
s.Points.AddXY("Temp", OutsideTemp)
s.Points.AddXY("Dew Point", DewPoint)
s.Points.AddXY("Wind Chill", WindChill)

'resets AutoValues and resizes chart to the largest value.
Chart1.ResetAutoValues()

'Add the series to the Chart1 control.
Chart1.Series.Add(s)
End Sub

/// CODE SNIPPET END ///

Re: Cumulus RealTime Data Grabber - Tool

Posted: Tue 06 Mar 2012 10:04 pm
by nitrx
[quote="Solorize"]

This does the job I get teh graph for temperature as it supposed to be :clap:
Test version "string": http://www.wokinghamweather.co.uk/downl ... string.zip

The windrose diplays only for the W to N section because the letters are the same in English and Dutch, anyway welldone :!:

Re: Cumulus RealTime Data Grabber - Tool

Posted: Tue 06 Mar 2012 10:34 pm
by Super-T
My realtime.txt
http://www.janter.co.nz/weather/realtime.txt

If the gadget is working OK then I wouldn't think that the realtime access was the problem.

I'll run a bit longer and see if I can tie it down a bit.

Attached a pic.

Re: Cumulus RealTime Data Grabber - Tool

Posted: Wed 07 Mar 2012 8:02 am
by Solorize
nitrx wrote:This does the job I get the graph for temperature as it supposed to be :clap:
Test version "string": http://www.wokinghamweather.co.uk/downl ... string.zip

That's great news :D I am glad it was just a simple mistake that I had made by choosing the wrong data type ;)

I have a few ideas on how to sort out the Compass points so I will get onto doing that over the next couple
of days.

Terry,

I have run the program with your realtime.txt url and selected the 1minute update interval and as you can
see in the graph below, the times displayed are at ~60 second intervals.

Image

Which is how I would expect it to look.

Can I confirm that when you select the 1minute option that you are saying it only updates
every 5 minutes? instead of the 1 minute? If so could you run it again and then post up a
screen capture of the graph screen, just so I can see for myself please.

Just a thought, I wonder if the Widget and Grabber running at the same time are interfering
with each other? as both are trying to grab the realtime.txt file at the same time and only
one manages to retrieve it so the other keeps trying until it eventually manages to get it
before the other one?

Re: Cumulus RealTime Data Grabber - Tool

Posted: Wed 07 Mar 2012 10:26 pm
by Solorize
nitrx

I have some more good news for you, I have now managed to sort out the Wind Compass co-ordinates
to work with your Dutch abbreviations :D It has taken me a good couple of hours work since I got home
from work to get it sorted but it should all work correctly.

I have also added support for UK, NL, FR-ES & DE

Options available are:

UK = ( N, NNE, NE, ENE, E, ESE, SE, SSE, S, SSW, SW, WSW, W, WNW, NW, NNW )
NL = ( N, NNO, NO, ONO, O, OZO, ZO, ZZO, Z, ZZW, ZW, WZW, W, WNW, NW, NNW )
FR/ES = ( N, NNE, NE, ENE, E, ESE, SE, SSE, S, SSO, SO, OSO, O, ONO, NO, NNO )
DE = ( N, NNO, NO, ONO, O, OSO, SO, SSO, S, SSW, SW, WSW, W, WNW, NW, NNW )

The co-ordinates on the Compass screen will also change to show the correct names
next to the compass points too. I have also put a label in the bottom left hand corner
of the screen which will indicate the language chosen for the compass points.

To change these settings you will need to click on the [CONFIG] button and then click the
RadioButton, next to the language you would like to use, then click the [SAVE] button, which
will save the language code to a local file called "CompassLang.txt" which has to reside
in the same folder as the .exe program.

Note:
On 1st startup of the .exe file the value is set to default of: UK

Settings will be saved to new values once the [SAVE] button is pressed
and then the program will use these new values on subsequent runs. So you
should not need to change them again :D

If you have changed the language and pressed the [SAVE] button before you
initially pressed the [START] button on the main page, then you will need to
press the [START] button to run the program.

If you already pressed the [START] button and have the program running, then changed
the language and pressed the [SAVE] button, you may want to press the [FORCE UPDATE]
button afterwards just to get it to update the Compass display straight away, without
having to wait for the timer interval to elapse and update automatically.
Hopefully the above makes sence.

Anyway hopefully everything should all work correctly, if you find any problems please can you
let me know. *fingerscrossed* it will all be ok now ;)


Download version 1.1.3 : http://www.wokinghamweather.co.uk/downl ... DGv113.zip

New in this version:

1.1.3 - (07-03-12)

1. Corrected incorrect temperature value on "Temperature Graph" for Dutch users.
2. Added [Config] button to allow users to select Compass Point language & display,
on [Wind Compass] screen.


Time for bed now, before my eyes turn a brighter shade of red LOL

Re: Cumulus RealTime Data Grabber - Tool

Posted: Thu 08 Mar 2012 8:14 am
by nitrx
Anyway hopefully everything should all work correctly, if you find any problems please can you
let me know. *fingerscrossed* it will all be ok now
Solorize I can let you know it works fine for me well done :clap:

Re: Cumulus RealTime Data Grabber - Tool

Posted: Thu 08 Mar 2012 12:08 pm
by laulau
Hi,

Is it possible to use Cumulus Realtime Data Grabber via a proxy ?

Re: Cumulus RealTime Data Grabber - Tool

Posted: Thu 08 Mar 2012 1:16 pm
by Solorize
nitrx

Thanks for letting me know it all works *phew* :)

laulau

At the moment I do not have any plans to implement via proxy
support, this is due to the fact that I am still very new to programming in
VB.NET and have never implemented this feature in anything I've
written before.

I may look into how to do it at "somepoint" in the future, if I do I will
let you know :)

If not, once I am happy with a full and final release version of
this program I will release to Source Code, and if anyone else wants
to take up the challenge to support via proxy they can :)

Re: Cumulus RealTime Data Grabber - Tool

Posted: Thu 08 Mar 2012 3:30 pm
by laulau
It's not a big problem, I just wanted to have an eye on it at my office! ;)

Re: Cumulus RealTime Data Grabber - Tool

Posted: Thu 08 Mar 2012 10:47 pm
by Super-T
It looks like the Realtime.txt Data is not being refreshed as the wind graph is every minute.
It looks like the the refresh of the realtime.txt data is about every 5 minutes.

Re: Cumulus RealTime Data Grabber - Tool

Posted: Fri 09 Mar 2012 8:23 am
by Solorize
Hi Terry,

Thanks for the additonal info.

I know I was having problems sometimes that the program would sometimes struggle to download the
RealTime.txt file on its 1st attempt, so I had to write an error handler so it would re-try to grab it,
otherwise it would just try once and then stop.

I am not sure why it would take 5minutes to grab it unless there is a problem somewhere between
the program and the location of the realtime.txt file.

Does it still take 5 minutes even on a interval of 15 seconds? or does it then take less, or is the 5minutes
constant through all intervals less than 5 minutes?

What is also weird is that if I run the program here using your realtime.txt URL it works fine :roll: