Der Baustein werkelt im Wetterbaustein für Weatherbit.io. Siehe Link im ersten Post.
Dieser Abschnitt erlaubt es Ihnen, alle Beiträge anzusehen, die von diesem Mitglied geschrieben wurden. Beachten Sie, dass Sie nur Beiträge sehen können, die in Teilen des Forums geschrieben wurden, auf die Sie aktuell Zugriff haben.
Beiträge anzeigen-Menü
FUNCTION_BLOCK BLIND_NIGHT
VAR_INPUT
UP, DN : BOOL;
S_IN : BYTE;
PI, AI : BYTE;
E_NIGHT : BOOL := TRUE;
E_DAY : BOOL := TRUE;
END_VAR
VAR_INPUT CONSTANT
SUNRISE_OFFSET : TIME;
SUNSET_OFFSET : TIME;
NIGHT_POSITION : BYTE;
NIGHT_ANGLE : BYTE;
END_VAR
VAR_IN_OUT
CX : CALENDAR;
END_VAR
VAR_OUTPUT
QU, QD : BOOL;
STATUS : BYTE;
PO, AO : BYTE;
END_VAR
VAR
night : BOOL;
last_night, last_day : DATE;
END_VAR
(*
version 1.2 6 oct 2007
programmer hugo
tested by tobias
*)
IF NOT (up AND dn) AND night THEN
(* manual operation at night will cancel operation for one night *)
night := FALSE;
ELSIF (cx.LTOD > cx.SUN_SET + sunset_offset) AND (last_night < cx.LDATE) AND NOT night AND e_night AND UP AND DN THEN
(* enable night *)
night := TRUE;
last_night := DT_TO_DATE(cx.LDT);
ELSIF (cx.LTOD > cx.SUN_RISE + sunrise_offset) AND (last_day < cx.LDATE) AND night AND e_day AND (last_night < cx.LDATE) AND UP AND DN THEN
(* disable night *)
night := FALSE;
last_day := DT_TO_DATE(cx.LDT);
END_IF;
(* shade at night only in auto mode and enable = true *)
IF UP AND DN AND night THEN
status := 141;
po := night_position;
ao := night_angle;
ELSE
po := pi;
ao := ai;
status := s_in;
END_IF;
QU := UP;
QD := DN;
(* revision history
hm 29. sep 2007 rev 1.0
original version
hm 5. oct 2007 rev 1.1
added enable input
hm 6. oct 2007 rev 1.2
added pos and angle inputs and outputs
night position and angle can now be configured
any manual operation at night will cancel night operation
md 29 dec 2013 rev 1.3
added CX variable for sunrise, sunset and date and time information;
activated night program only if automatic mode is detected (i.e.
don't skip auto closing when in manual mode);
corrected missing QU/QD assignment when in night mode
md 12 jan 2015 rev 1.4
removed type conversion for TOD and DATE variables by directly
accessing cx.LTOD and cx.LDATE members
*)
UTC : DATE; (* world time *)
DAY : DATE; (* date of day to calculate times for *)
sun(latitude := XCAL.LATITUDE, longitude := xcal.LONGITUDE, utc := DT_TO_DATE(xcal.UTC), H := H);
sun(latitude := XCAL.LATITUDE, longitude := xcal.LONGITUDE, day := xcal.LDATE, H := H);
Seite erstellt in 0.032 Sekunden mit 17 Abfragen.