A thought to determine date and time in a DC?
-
It dawned on me today that there might be a way to determine the date and time for use in Dynamic Component formulas... for instance if you wanted foliage color to change or completely disappear based on the season.
There are a handful of online calculators, such as http://aa.usno.navy.mil/data/docs/AltAz.php, that will determine azimuth and altitude based of date, time, latitude and longitude. Could not that formula be rearranged to determine a model's date and time based of the LAT(), LNG(), SUNELEVATION(), and SUNANGLE() functions?
Correct me if I am wrong, but are not the functions SUNELEVATION() and SUNANGLE() equal to altitude and azimuth?
-Matt
-
That is an interesting thought. It sounds possible. Do any azimuth/altitude pairs ever repeat throughout the year?
It might be a fun challenge to get that to work. It might be more fruitful to just request that time and date be integrated into the next round of DC's though
Chris
-
Hey Chris, I had a feeling that you would reply.
As for the Alt/Azm pairs... I think they would repeat at different places, but I also think that a pair at a specific location would be unique to an exact date/time.
-
Here's a start:
http://www.itacanet.org/eng/elec/solar/sun3.pdf
I would guess that if you can get your head around that math, you should be set
Chris
-
I wrote a ruby function to get the date in a DC. I'll look it up... OK.
To use, drop the attachment into your Plugins folder.
to get the current time, use
=now()
and the date:=today()
I would guess the values get updated whenever the DC is redrawn.
class DCFunctionsV1 protected def now(a=nil) return Time.now.strftime("%H;%M;%S") end def today(a=nil) return Time.now.strftime("%m-%d-%Y") end end
-
@jim said:
I wrote a ruby function to get the date in a DC.
For that to work on DC, does it need to be installed on each machine that uses the DC, or does it somehow embed the information in a distributable DC?
-
Unfortunately it would have to be installed on each machine. That's why I think you should tackle the math in that pdf I linked to Matt. Your method would be do-able inside a DC, without loading any scripts.
Chris
Advertisement