Azimuth and Elevation Calculates

For E-blocks user to discuss using E-blocks and programming for them.

Moderators: Benj, Mods

Post Reply
Monie Jacobsen
Posts: 484
Joined: Mon Jul 30, 2012 3:39 pm
Has thanked: 17 times
Been thanked: 46 times

Azimuth and Elevation Calculates

Post by Monie Jacobsen »

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
Attachments
SOLAR_POS_4680_GPS_OK.fcf
(75.31 KiB) Downloaded 352 times
Best Regard
Monie

User avatar
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

Post by Enamul »

Hi Monie,

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
University of Nottingham
enamul4mm@gmail.com

User avatar
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

Post by Enamul »

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
University of Nottingham
enamul4mm@gmail.com

User avatar
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

Post by Enamul »

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..

Code: Select all

arctanx=x-x^3/3+x^5/5-x^7/7+x^9/9-x^11/11+.....
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..

Code: Select all

arctanx + arctany = arctan((x+y)/(1-xy))
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.
SOLAR_POS_4680_GPS_OK_2L.fcf
Tested in hardware
(80.76 KiB) Downloaded 350 times
test_result.zip
(150.38 KiB) Downloaded 360 times
I am also posting 4L version for you so that you can get both time and co-ordinate at the same time.
SOLAR_POS_4680_GPS_OK_4L.fcf
Not tested..please test and let me know
(78.54 KiB) Downloaded 364 times
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.
Enamul
University of Nottingham
enamul4mm@gmail.com

Monie Jacobsen
Posts: 484
Joined: Mon Jul 30, 2012 3:39 pm
Has thanked: 17 times
Been thanked: 46 times

Re: Azimuth and Elevation Calculates

Post by Monie Jacobsen »

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
Best Regard
Monie

Monie Jacobsen
Posts: 484
Joined: Mon Jul 30, 2012 3:39 pm
Has thanked: 17 times
Been thanked: 46 times

Re: Azimuth and Elevation Calculates

Post by Monie Jacobsen »

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
Best Regard
Monie

Monie Jacobsen
Posts: 484
Joined: Mon Jul 30, 2012 3:39 pm
Has thanked: 17 times
Been thanked: 46 times

Re: Azimuth and Elevation Calculates

Post by Monie Jacobsen »

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?
Best Regard
Monie

User avatar
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

Post by Enamul »

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.
Attachments
SOLAR_POS_4680_GPS_OK_4L.fcf
(80.5 KiB) Downloaded 363 times
Enamul
University of Nottingham
enamul4mm@gmail.com

Post Reply