Please will somebody help me to view azimuth and elevation in Flowcodes
into the program Flowcode V5.4 for PICmicro PIC18F4680
Info:
After Danish normal hours (12.00) the reading should be:
Elevation = 13.9 ° Azimuth = 179.0 º
PIC18F4680
EB056 GPS board
Can you see where the problem is?
Will you correct codes as azimuth and elevation kan be seen in the display?
Please look in the Flowcode file:
Here is attached see: SOLAR_POS_4680_GPS_OK.fcf
Bedst Regards
Monie
Azimuth and Elevation Calculates
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
Azimuth and Elevation Calculates
- Attachments
-
- SOLAR_POS_4680_GPS_OK.fcf
- (75.31 KiB) Downloaded 352 times
Best Regard
Monie
Monie
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: Azimuth and Elevation Calculates
Hi Monie,
I have checked your config first..But that is not right as watchdog timer is enabled there. That could cause problem..
I have checked your config first..But that is not right as watchdog timer is enabled there. That could cause problem..
- Attachments
-
- solar.png
- (115.05 KiB) Downloaded 4850 times
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: Azimuth and Elevation Calculates
Using RTC module I have tried to check the code..it seems something went wrong only for December..It works fine even in November but not in December
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: Azimuth and Elevation Calculates
Hello Monie,
I have finally manged to sort out the problem in the code. It's actually not the problem in code rather it's the issue of arctangent formula issue which is valid for -1<=x<=1. But in December or may be at end of November, x becomes more than 1 which causes the failure of the arctangent expansion series..which is valid for |x|<=1
So for x>1 the above series wasn't working. I have modified the code likewise..
if x>1, we can use the following formula..
I have segmented x value greater than one in two part like x and y and calculate them individually and get the sum of the them which sorts the issue.
I am posting here the two line LCD version which I have tested with GPS module with the pictures of my test. I am also posting 4L version for you so that you can get both time and co-ordinate at the same time. Note: I have made one little change in code. As it takes some time to initialize the GPS module LCD remains blank for that time, I have modified the code so that it will show Init GPS with increment dots until it initialize then move to normal program flow.
I have finally manged to sort out the problem in the code. It's actually not the problem in code rather it's the issue of arctangent formula issue which is valid for -1<=x<=1. But in December or may be at end of November, x becomes more than 1 which causes the failure of the arctangent expansion series..
Code: Select all
arctanx=x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11+.....
So for x>1 the above series wasn't working. I have modified the code likewise..
if x>1, we can use the following formula..
Code: Select all
arctanx + arctany = arctan((x+y)/(1-xy))
I am posting here the two line LCD version which I have tested with GPS module with the pictures of my test. I am also posting 4L version for you so that you can get both time and co-ordinate at the same time. Note: I have made one little change in code. As it takes some time to initialize the GPS module LCD remains blank for that time, I have modified the code so that it will show Init GPS with increment dots until it initialize then move to normal program flow.
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
Re: Azimuth and Elevation Calculates
Thank Enamul
It is very good that you have found the problem!
I'll get back with comments after days of testing!
Best Regard
Monie
It is very good that you have found the problem!
I'll get back with comments after days of testing!
Best Regard
Monie
Best Regard
Monie
Monie
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
Re: Azimuth and Elevation Calculates
Thank you very much, Enamul, for you help....
I am very happy for you help.
The program azimuth and elevation is working now.
I would be very pleased if somebody use the program for own purpose example for Weather Forecast
and the send me a copy of the results - Private messages (PM). So i can learn and get experience through this.
Bedst Regards
Monie
I am very happy for you help.
The program azimuth and elevation is working now.
I would be very pleased if somebody use the program for own purpose example for Weather Forecast
and the send me a copy of the results - Private messages (PM). So i can learn and get experience through this.
Bedst Regards
Monie
Best Regard
Monie
Monie
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
Re: Azimuth and Elevation Calculates
Hello all
My sun position calculation program is again stopped with writing for display!
Is there anyone here who see where it goes wrong in calculating program?
My sun position calculation program is again stopped with writing for display!
Is there anyone here who see where it goes wrong in calculating program?
Best Regard
Monie
Monie
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: Azimuth and Elevation Calculates
Hi
I have checked the code again. I think it is happened because of arctan again as now arctan become -1.6 which produces wrong result. I have modified the code to work properly. You can test that and let me know.
I have checked the code again. I think it is happened because of arctan again as now arctan become -1.6 which produces wrong result. I have modified the code to work properly. You can test that and let me know.
- Attachments
-
- SOLAR_POS_4680_GPS_OK_4L.fcf
- (80.5 KiB) Downloaded 363 times