<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to OSCAT_BASIC.SUN_TIME</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/552c1f968c/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/552c1f968c/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/552c1f968c/</id><updated>2020-02-27T14:30:02.691000Z</updated><subtitle>Recent posts to OSCAT_BASIC.SUN_TIME</subtitle><entry><title>OSCAT_BASIC.SUN_TIME</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/552c1f968c/?limit=25#bef2" rel="alternate"/><published>2020-02-27T14:30:02.691000Z</published><updated>2020-02-27T14:30:02.691000Z</updated><author><name>S1ack</name><uri>https://forge.codesys.com/u/s1ack/</uri></author><id>https://forge.codesys.com15bd01ad6d3577114718183e0ddabbd068e3b49c</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Nevermind - The function block locale coordinates are REAL. My locale is West (negative real) of prime meridian - I was testing with a value that is East (positive real).&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>OSCAT_BASIC.SUN_TIME</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/552c1f968c/?limit=25#5914" rel="alternate"/><published>2020-02-27T14:30:02.197000Z</published><updated>2020-02-27T14:30:02.197000Z</updated><author><name>S1ack</name><uri>https://forge.codesys.com/u/s1ack/</uri></author><id>https://forge.codesys.coma3b8688448d305f436661d25445d23e39dbfab80</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;S1ack hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
When I enter my locale, and today's date. The outputs make no sense to me.&lt;br/&gt;
Midday = 06:32&lt;br/&gt;
Rise = 16:12&lt;br/&gt;
Set = 13:56&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I'll add that when I add my tie zone -utc offset to these times it still makes no sense to me. I'm thinking I need to read up more on UTC.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>OSCAT_BASIC.SUN_TIME</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/552c1f968c/?limit=25#d6e5" rel="alternate"/><published>2020-02-27T14:30:01.587000Z</published><updated>2020-02-27T14:30:01.587000Z</updated><author><name>S1ack</name><uri>https://forge.codesys.com/u/s1ack/</uri></author><id>https://forge.codesys.com8c79d9232692527351176236b2f73e98d3be78d2</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I am having trouble with understanding the OSCAT_BASIC.SUN_TIME outputs: &lt;br/&gt;
2 Issues&lt;br/&gt;
1) Sunrise and Sunset outputs are TOD in UTC, I wish to convert them to TOD in local time: It escapes me. &lt;br/&gt;
2) When I change the locale and date the output UTC TOD for sunrise and sunset make no sense to me.&lt;/p&gt;
&lt;p&gt;1) If I can combine TOD with a date format, and get UTC (UDINT) out, I can use SysTimeRtcConvertUtcToLocal to get local time.&lt;/p&gt;
&lt;p&gt;2) For testing I have this simple setup...&lt;br/&gt;
When I enter the locale and date as in the OSCAT Basic documentation - the output data matches, and makes some sense - i.e. sunrise is before sunset.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nv"&gt;osrCalcSunTime&lt;/span&gt; : &lt;span class="nv"&gt;Standard&lt;/span&gt;.&lt;span class="nv"&gt;R_TRIG&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;fbSunTime&lt;/span&gt; : &lt;span class="nv"&gt;OSCAT_BASIC&lt;/span&gt;.&lt;span class="nv"&gt;SUN_TIME&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;//&lt;/span&gt;   &lt;span class="nv"&gt;Calculate&lt;/span&gt; &lt;span class="nv"&gt;sunrise&lt;/span&gt; &lt;span class="nv"&gt;and&lt;/span&gt; &lt;span class="nv"&gt;sunset&lt;/span&gt; &lt;span class="nv"&gt;times&lt;/span&gt;
&lt;span class="nv"&gt;osrCalcSunTime&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt; &lt;span class="nv"&gt;CLK&lt;/span&gt; :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;xPLCqCalcSunTime&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;IF&lt;/span&gt; &lt;span class="nv"&gt;osrCalcSunTime&lt;/span&gt;.&lt;span class="nv"&gt;Q&lt;/span&gt;   &lt;span class="k"&gt;THEN&lt;/span&gt;
   &lt;span class="nv"&gt;fbSunTime&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;   &lt;span class="nv"&gt;LATITUDE&lt;/span&gt;   :&lt;span class="o"&gt;=&lt;/span&gt;    &lt;span class="mi"&gt;47&lt;/span&gt;,                  &lt;span class="o"&gt;//&lt;/span&gt;   &lt;span class="nv"&gt;Charlotte&lt;/span&gt; &lt;span class="nv"&gt;NC&lt;/span&gt; &lt;span class="mi"&gt;35&lt;/span&gt;.&lt;span class="mi"&gt;2271&lt;/span&gt;
               &lt;span class="nv"&gt;LONGITUDE&lt;/span&gt;   :&lt;span class="o"&gt;=&lt;/span&gt;   &lt;span class="mi"&gt;122&lt;/span&gt;,               &lt;span class="o"&gt;//&lt;/span&gt;   &lt;span class="nv"&gt;Charlotte&lt;/span&gt; &lt;span class="nv"&gt;NC&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;.&lt;span class="mi"&gt;8431&lt;/span&gt;
               &lt;span class="nv"&gt;UTC&lt;/span&gt;         :&lt;span class="o"&gt;=&lt;/span&gt;   &lt;span class="nv"&gt;D&lt;/span&gt;&lt;span class="sc"&gt;#1970&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;01&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;01&lt;/span&gt; &lt;span class="ss"&gt;)&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;END_IF&lt;/span&gt;
&lt;span class="nv"&gt;dsDPS_Sun&lt;/span&gt;[&lt;span class="mi"&gt;1&lt;/span&gt;].&lt;span class="nv"&gt;todMidday&lt;/span&gt;      :&lt;span class="o"&gt;=&lt;/span&gt;   &lt;span class="nv"&gt;fbSunTime&lt;/span&gt;.&lt;span class="nv"&gt;MIDDAY&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;dsDPS_Sun&lt;/span&gt;[&lt;span class="mi"&gt;1&lt;/span&gt;].&lt;span class="nv"&gt;todSunRise&lt;/span&gt;    :&lt;span class="o"&gt;=&lt;/span&gt;    &lt;span class="nv"&gt;fbSunTime&lt;/span&gt;.&lt;span class="nv"&gt;SUN_RISE&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;dsDPS_Sun&lt;/span&gt;[&lt;span class="mi"&gt;1&lt;/span&gt;].&lt;span class="nv"&gt;todSunSet&lt;/span&gt;      :&lt;span class="o"&gt;=&lt;/span&gt;   &lt;span class="nv"&gt;fbSunTime&lt;/span&gt;.&lt;span class="nv"&gt;SUN_SET&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;This makes sense&lt;br/&gt;
Midday = 11:16 (noon-ish)&lt;br/&gt;
Rise = 6:22 (morning)&lt;br/&gt;
Sun = 16:09 (afternoon&lt;/p&gt;
&lt;p&gt;When I enter my locale, and today's date. The outputs make no sense to me.&lt;br/&gt;
Midday = 06:32&lt;br/&gt;
Rise = 16:12&lt;br/&gt;
Set = 13:56&lt;/p&gt;
&lt;p&gt;I also tried using the CALENDER_CALC function as the rise and set times are listed as being in local time.&lt;br/&gt;
However when I compared outputs with alamanc data from my locale at 3 dates in this year (2 in standard time 1 in daylight time) I saw ~45 minute offset. When I checked that this offset held after adjusting locale and time zone to Seatlle, WA - the offsets were completely different, and not consistent.&lt;/p&gt;
&lt;p&gt;I have done sunrise sunset calcs in Siemens S7 portal, and in LabVIEW and while getting standard/daylight correct can be an issue to fight with, I was always able to correlate the computed times within a few minutes of almanac times available online.&lt;/p&gt;
&lt;p&gt;The target is a Parker PAC controller. It has a RTC and from what I see by way of SysTimeRtcGetTimeZone function it is modern in it's handling of daylight time.&lt;/p&gt;
&lt;p&gt;Any insight / help is greatly appreciated.&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: Bild" rel="nofollow" src="https://i.imgur.com/66KySEY.png"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: Bild" rel="nofollow" src="https://i.imgur.com/y9Lrv4g.png"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: Bild" rel="nofollow" src="https://i.imgur.com/2y4v1Lj.png"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>