(EDGE Driver-Mc): Aplicaciones Virtuales Mc (virtual Switch Mirror, Virtual Calendar and virtual Switch Board...)

(NEW RELEASE) New Version of Mc Virtual Applications: Virtual Calendar

Hi @Daijoubu

I have managed to get the Azimuth calculation function to work correctly.

It seems that there are users who use it to lower or raise blinds, awnings or curtains depending on the orientation, azimuth, and elevation of the Sun.

The displayed Azimuth value corresponds to the navigation, orientation or compass standard, with a angular movement of 15.05º/h in an East to West direction, with values from 0º to 360º:

  • The Solar Azimuth will indicate the South (180º) at solar noon in the Northern Hemisphere
  • The Solar Azimuth will indicate North (0º) at solar noon in the Southern Hemisphere
  • At Sunrise the azimuth will always show East (90º +/15º), 90º at the solar equinox
  • The Sunset always the azimuth will show the West (270º +/15º), 270º in the solar equinox.

I have modified the code published on this page, by Edi Budimilic, and from the link posted by @GSzabados.
The necessary modifications for it to work correctly are in this link, In case someone needs it

The original calculation needs a different correction for E and W longitudes and N and S latitudes.

The calculation function makes 2 direction changes in the calculated azimuth, one at solar noon and another 12 hours later at night. Instead of calculating from 0º to 360º, it calculates from 0º to 180º and returns from 180º to 0º.

The function code, which only needs receive the latitude, longitude, and UTC time, with os.time().

The azimuth value is calculated 2 times:

  • The first with the current UTC time and the values returned altitude and azimuth are saved
  • The second is calculated by the function with UTC time - 60 sec
  • The returned values confirm the direction of the azimuth increase (increasing, UP or decreasing DOWN).
  • Depending on whether the trend is UP or DOWN, the azimuth of the LOCAL time is corrected by subtracting it from 360º depending on whether the location is in the NE, NW, SE or SW quadrant.

I have tested and checked it with 4 locations in the four quadrants, Beijing (NE), Melbourne (SE), New York (NW) and Rio de Janeiro (SW)

It works with a precision of +/- 0.5º with respect to an online calculator Calculadora en línea: Acimut y ángulo de elevación solar

This is the new driver version
It will be updated automatically and could need delete cache in android app

 Name         Aplicaciones Virtuales Mc
 Version      2023-02-16T12:28:03.382506938