Climate Library and Web Service

Requests for new functions or software apps
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Climate Library and Web Service

Post by lnevo »

Roberto, check out page 8 and 9 and specifically the advanced programming section...

http://www.aquariumspecialty.com/media/ ... Manual.pdf

Seems they are using the sync / anti-sync (non ecosmart) profiles, but able to address each pump individually...

What do you think?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Climate Library and Web Service

Post by rimai »

I created a custom mode that allows you to control them individually too.
I just never found a good use for it.
Roberto.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Climate Library and Web Service

Post by lnevo »

You think this would qualify?
thekameleon
Posts: 137
Joined: Sat Feb 16, 2013 7:44 am

Re: Climate Library and Web Service

Post by thekameleon »

lnevo wrote:I wouldn't mind having tidal information and adjust my vortech speed and potentially other settings based on that...
You mean tidal information from a web service? I think the tides can be simulated based on lat, long, and time. The mass of the earth, sun and moon are static. We can calculate the position of the earth, sun and moon to figure out the rest.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Climate Library and Web Service

Post by lnevo »

I'd be fine with it calculated...
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Climate Library and Web Service

Post by lnevo »

I looked up how this can be calculated....and no, it would be best to use an online source :) so yeah, that'd be cool info to have :D
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Climate Library and Web Service

Post by binder »

Just a quick comment pertaining to the code on github, i would discourage against using references and passing variables by reference simply because of the memory constraints of the system. you can get a lot of unknown errors encountered. i had a terrible time using new and delete for creating variables and code. so you may want to rework your classes to incorporate the variables in them. i can explain and look more later but i wanted to make this comment now when i had a free second from work. and no, i have not looked at all of the code, i just saw a quick spot with an example ino file.
thekameleon
Posts: 137
Joined: Sat Feb 16, 2013 7:44 am

Re: Climate Library and Web Service

Post by thekameleon »

I thought passing in variables by value was a bad practice as it forces a copy of object for that scope it is passed into. My problem was I had issues with passing by value... Since I saw your post, I just figured out what I did wrong and fixed it. However when I compile now my sketch size has gotten larger. So I think when you refer to memory, you are referring to the running process, correct?

By the way, in case you are wondering. I am using VisualMicro with Visual Studio 2012 for is debugging ability, like stepping through code.
Last edited by thekameleon on Fri Feb 22, 2013 2:31 pm, edited 1 time in total.
thekameleon
Posts: 137
Joined: Sat Feb 16, 2013 7:44 am

Re: Climate Library and Web Service

Post by thekameleon »

lnevo wrote:I looked up how this can be calculated....and no, it would be best to use an online source :) so yeah, that'd be cool info to have :D
Do you think it is the complexity or is there some other reason?
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Climate Library and Web Service

Post by lnevo »

Way too complex and not simply calculation. A lot of local current factors are taken into account. Everyone who asks gets told to look up off online sources :)
thekameleon
Posts: 137
Joined: Sat Feb 16, 2013 7:44 am

Re: Climate Library and Web Service

Post by thekameleon »

So would you be willing to pay for it? My problem is two fold... First hosting a web service, costs money. Second, I have yet to find a weather service that includes tide info for free. It would be kept low as possible, like say 10 bucks a year.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Climate Library and Web Service

Post by lnevo »

Honest answer... nope. It's just not that important to have another bill. I doubt there'd be enough to pay for any web hosting service. I'd rather come up with a function to simulate it and have it be fake then to start paying money for my fish tank to have legitimate tides :)
thekameleon
Posts: 137
Joined: Sat Feb 16, 2013 7:44 am

Re: Climate Library and Web Service

Post by thekameleon »

Fair enough... back to the calculation then :)
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Climate Library and Web Service

Post by lnevo »

I did find some open source software (XTide) that does the calculations...unfortunately it requires harmonic files that are only available for the US. Apparently other countries have pulled this data from the public domain so the author does not maintain international data...
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Climate Library and Web Service

Post by binder »

thekameleon wrote:I thought passing in variables by value was a bad practice as it forces a copy of object for that scope it is passed into. My problem was I had issues with passing by value... Since I saw your post, I just figured out what I did wrong and fixed it. However when I compile now my sketch size has gotten larger. So I think when you refer to memory, you are referring to the running process, correct?

By the way, in case you are wondering. I am using VisualMicro with Visual Studio 2012 for is debugging ability, like stepping through code.
Yes, passing variables in by value does copy the entire variable for the function to use. So it is bad practice to copy large variables (memory locations) around. It is better to pass a reference / pointer to them. However, I have noticed in the past that by doing that, arduino and the libraries get "messed up" at times (yes, I know, very technical wording). It would lose it's pointer and start referencing null memory.

Yes, with memory I'm referring to the RAM and the actual code compile size.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Climate Library and Web Service

Post by lnevo »

So, there are definitely free sites out there that have tidal information... I'm going to look at some data here for some info to build a faux schedule..

http://www.toptides.com/HI/2013/march/H ... awaii.html

I'll probably start a new thread to focus on a tidal program for setting wavemakers for those that are interested, but once that's set it could easily hook to realitime data if we had that functionality..

Random question, does anyone know why our MoonPhase() function peaks at 78%? I'm considering multiplying the value *1.28 to get full 0-100 dimming for my moonlights and for this option.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Climate Library and Web Service

Post by rimai »

lnevo wrote:Random question, does anyone know why our MoonPhase() function peaks at 78%? I'm considering multiplying the value *1.28 to get full 0-100 dimming for my moonlights and for this option.
Bug :(
This is from the MoonPhase function:

Code: Select all

	PWMvalue = 4*abs(50-V);  // 5.12=100%    4=~80%
As you can see, multiplying by 4 gives a range of 0-80%....
Anyway, revisiting the function, I noticed some calculations that don't really need to be there.
The function should be this:

Code: Select all

byte MoonPhase()
{
	int m,d,y;
	int yy,mm;
	long K1,K2,K3,J,V;
	m = month();
	d = day();
	y = year();
	yy = y-((12-m)/10);
	mm = m+9;
	if (mm>=12) mm -= 12;
	K1 = 365.25*(yy+4712);
	K2 = 30.6*mm+.5;
	K3 = int(int((yy/100)+49)*.75)-38;
	J = K1+K2+d+58-K3;
	V = (J-2451550.1)/0.29530588853;
	V -= int(V/100)*100;
	V = abs(V-50);
	return (byte)(2*abs(50-V));
}
I'll update it in the next libraries patch... Thanks for finding it out :)

https://github.com/reefangel/Libraries/issues/63
Roberto.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Climate Library and Web Service

Post by lnevo »

So now that'll be 0-100%

How about MoonphaseLabel()? Will that match?

Thanks!!
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Climate Library and Web Service

Post by rimai »

The label has always been right all along. It uses different math at the end.
Roberto.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Climate Library and Web Service

Post by lnevo »

Cool.
thekameleon
Posts: 137
Joined: Sat Feb 16, 2013 7:44 am

Re: Climate Library and Web Service

Post by thekameleon »

I have been continuing work on this library and in a few weeks should have it ready for the first guinea pigs... errr beta testers. This first iteration of the library will be focused on clouds and storms. Yes I know, its been done before but they will be in libraries and you can customize it without having to change code. instead, you just set a few parameters in your loop function and get the PWM value. I doubt this thing is going to fit on the regular Reef Angel Controller without removing a lot of other functionality, Reef Controller Plus is the way to go.

One of the key things is I am developing this library so it can be ran in either the Reef Controller or ran in a PWM Expansion module. This modified PWM Expansion module, lets call it the Weather PWM module can be configured via the Reef Controller. So you can set up your climate in the same way, but it will all be execute on the altered PWM Expansion module. It will also offload all lighting functions from the reef controller to this module... Including moon phase, sunrise and sunset. Settings from the Reef Controller that are made via the menu's, in your code or whatever are then sent to the altered PWM Expansion module via the USB cables (Serial TTL). It can event control the Actinic and Daylight pins on the main relay box over the Serial TTL. The goal here is to offload climate processing from the Reef Controller and fully utilize the potential of the programmable expansion modules.

In case anyone is curious, I am keeping the source on github... Just search for RAClimate.

Here is my ask. I am not a device programmer by profession. I do more development work around productivity software such as Office and SharePoint. So if you have a suggestion with my code by all means speak up. I'd like this to be a collaborate effort and take all of the great climate/weather code out there and put it into a set of libraries, so that the non-coders out there can have an easier time with it.
User avatar
Rodasphoto
Posts: 187
Joined: Wed Apr 10, 2013 2:48 pm
Location: Athens, Ga
Contact:

Re: Climate Library and Web Service

Post by Rodasphoto »

This is an awesome concept. I can't wait to see the finished product. :)
Image
Sonicboom
Posts: 1
Joined: Fri Dec 27, 2013 5:25 pm

Re: Climate Library and Web Service

Post by Sonicboom »

Hello, I have been lurking for a bit trying to decide on a controller for my reef tank. I am now pretty set on the RA and just want to comment on this thread since this is a big thing for me with the weather. I would like to suggest polling weather for a region but also include a formula or an "if" statement to not allow more than 1 or 2 rainy days a week.
Post Reply