UPGRADE IP 9 verfügbar!
Timberwolf VISU jetzt mit NEUEM Layout Editor
Freie Anordnung, Reihenfolge und Größe der Widgets - viele weitere Verbesserungen
Infos im Wiki: https://elabnet.atlassian.net/l/cp/06SeuHRJ

NEU! Insider & Leistungsmerkmale FÜR ALLE freigeschaltet
Damit kann nun jeder das Upgrade vornehmen und VISU & IFTTT testen. Alle Info hier: viewtopic.php?f=8&t=5074

[NEUHEIT] Baustein zur automatischen Wind abhängigen Markisensteuerung V1.1

Hier stellen Foristen und Kunden Ihre EIGENEN Logikbausteine vor. Diese Logikbausteine stehen jedem im Rahmen der vom Autor eingeräumten / genannten Lizenz zur Verfügung.
Forumsregeln
  • Denke bitte an aussagekräftige Titel und gebe dort auch die [Firmware] an. Wenn ETS oder CometVisu beteiligt sind, dann auch deren Version
  • Bitte mache vollständige Angaben zu Deinem Server, dessen ID und dem Online-Status in Deiner Signatur. Hilfreich ist oft auch die Beschreibung der angeschlossener Hardware sowie die verwendeten Protokolle
  • Beschreibe Dein Projekt und Dein Problem bitte vollständig. Achte bitte darauf, dass auf Screenshots die Statusleiste sichtbar ist
  • Bitte sei stets freundlich und wohlwollend, bleibe beim Thema und unterschreibe mit deinem Vornamen. Bitte lese alle Regeln, die Du hier findest: https://wiki.timberwolf.io/Forenregeln
Antworten

Ersteller
Dragonos2000
Reactions:
Beiträge: 2181
Registriert: So Aug 12, 2018 1:38 pm
Wohnort: Karlsruher Raum
Hat sich bedankt: 481 Mal
Danksagung erhalten: 889 Mal

Baustein zur automatischen Wind abhängigen Markisensteuerung V1.1

#1

Beitrag von Dragonos2000 »

Neueste Version: V1.1 - Siehe unten im Thread

Baustein V1.0
Sommerzeit - Markisenzeit. Mit etwas Verspätung kann ich nun meinen Markisenbaustein endlich bereitstellen. Diskussionen, Wünsche und Anregungen zum Baustein bitte in folgendem Thread bündeln: viewtopic.php?p=33391#p33391

Vorwort:
Der Baustein ist so konzipiert, dass für die Grundfunktionalität lediglich die Eingänge "Wind speed", "Enable automatic" sowie "Start/Standby" benutzt werden müssen (der Rest ist optional), sowie natürlich die individuellen Parameter entsprechend der eigenen Umgebung.
Darüber hinaus stehen zahlreiche Statusausgänge zur Verfügung, um konsistente Informationen in Visus, Tastern, usw. anzuzeigen.
Aus Sicherheitsgründen werden der kritische Wind-Grenzwert und die Alarm-Eingänge IMMER ausgewertet. D.h. selbst bei abgeschalteter Automatik wird die Markise eingefahren. (Hintergrund: Vergessen einer ausgefahrenen Markise kann blöd enden) Möchte man das nicht, muss der Baustein mit "Inhibit" komplett deaktiviert werden.

Allgemeine Hinweise:
  • Ein vorangestelltes "In:" kennzeichnet einen Eingang
  • Ein vorangestelltes "Par:" kennzeichnet einen Parameter, der für die korrekte Funktion nötig ist
  • Die Mouse-Over Texte sollten hinreichend Hilfestellung geben
  • Es ist sicherzustellen, dass die Windwerte sowohl bei Änderung ALS AUCH zyklisch gesendet werden, damit der Baustein zuverlässig getriggert wird. Ich habe bei mir 10 Minuten Zykluszeit.

Funktionsweise:
  • "Enable automatic" schaltet die Automatiksteuerung ein oder aus. Wird eingeschaltet und "Start/Standby" steht auf <true>, wird die Markise auch direkt auf eine dem Wind entsprechende Position ausgefahren.
  • "Start/Standby" fährt die Markise auf eine Wind gerechte Position oder fährt diese wieder ein. Außerdem kann hierüber der "Temporäre manuelle Modus" beendet werden (siehe unten).
  • Wird ein parametrierter Grenzwert überschritten, wird die Markise sofort auf die hierzu eingestellte Position zurückgefahren.
  • Nach Ablauf des "Delay Timer" wird die Markise wieder weiter ausgefahren, sofern für die Dauer des Timers die Windgeschwindigkeit unterhalb der Hystereseschwelle blieb.
  • Wird ein Telegram auf einem "Sense"-Eingang empfangen, wechselt der Baustein in einen temporären manuellen Modus. Die "Sense"-Eingänge können mit Gruppenadressen verbunden werden, über die der Aktor Fahrbefehle von einem Taster zur manuellen Steuerung erhält. Nach Ablauf einer einstellbaren Zeit wird wieder zurück auf Automatik gewechselt und die (zwischenzeitlich ggf. neue) ermittelte Automatikposition gesendet. Durch ein <true> auf dem Eingang "Start/Standby" kann ein sofortiges Zurückwechseln auf Automatik herbeigeführt werden.
  • Wird der Grenzwert für kritischen Wind überschritten, wird der Behang eingefahren und die Automatik auf "Standby" gesetzt. Ein selbstätiges Wiederausfahren erfolgt damit nicht mehr und die Steuerung muss mittels "Start/Standby" wieder angestoßen werden.
  • Wird ein Alarm empfangen, wird der Behang eingefahren, die Automatik auf "Standby" gesetzt ("Start/Standby"=<false>) und deaktiviert ("Enable automatic"=<false>). Solange ein Alarm ansteht, lässt sich keine Automatiksteuerung reaktivieren.
  • "Skip full extension" verhindert ein vollständiges Ausfahren der Markise; diese fährt dann nur bis zur vorletzten Stellung aus. (Nutzbar bspw. in Kombination mit Wetterdiensten und wenn es stark böig ist)
  • Die Positionsermittlung inkl. Delay-Timer arbeitet permanent im Hintergrund, auch wenn die Automatik deaktiviert ist. Damit ist sichergestellt, daß bei Aktivierung stets den Windbedingungen enstpechende valide Werte gesendet werden. Ausnahme ist "Inhibit"- damit wird der Baustein komplett stillgelegt.

Hinweise zu den Eingängen:
  • Mit ein Wenig eigener vorgeschalteter Logik kann der Eingang "Start/Standby" auch für Wetterwarnungen, Regensensor, usw. verwendet werden
  • Die 3 "Sense"-Eingänge sind optional und brauchen nur verknüpft zu werden, wenn man die manuelle Steuerung mit Rückfall auf Automatik nutzen möchte
  • Alarm-Eingänge können beliebig viele über das "+" unten hinzugefügt werden. Mehrere Eingänge sind dann "ODER" verknüpft
  • Inhibit-Eingänge können beliebig viele über das "+" unten hinzugefügt werden (legt den Baustein komplett still)
  • "Skip full extension" Eingänge können beliebig viele über das "+" unten hinzugefügt werden. Mehrere Eingänge sind dann "ODER" verknüpft
  • Mit dem optionalen Eingang "In:Reset" kann der Delay Timer zurückgesetzt werden, so dass direkt in eine für die zuletzt empfangene Windgeschwindkeit passende Position gewechselt wird
Hinweise zu den Ausgängen:
  • Bei Bedarf kann man über das "+" unten noch zusätzliche Ausänge aktvieren, die einige Stati und Zustände sowohl als Text, als auch binär ausgeben (für Debug, Visu, Taster Rückmeldungen,...)
  • Eine Schnittstelle zur Kaskadierung mit einem weiteren Baustein zur Steuerung eines Volants ist vorbereitet, der Baustein ist noch nicht entwickelt
Viel Spass damit :)

Disclaimer:
Die Verwendung erfolgt auf eigene Gefahr. Ich hafte nicht für etwaige entstandene Schäden, die durch die Nutzung entstanden sind, noch garantiere ich eine Fehler freie Funktion.

Nutzungsrechte:
Der Schöpfer dieser Custom Logik überträgt die Nutzungsrechte gemäß der TOLL ("Timberwolf Open Logikblock License") die unter https://wrgt.news/TOLL zum Download zur Verfügung steht.

Code: Alles auswählen

/**===========================================================
Windabhängige automatische Steuerung von Markisen
============================================================*/

{
  "Level": [
	["$ConstFalse","bool",false],
	["$ConstTrue","bool",true],
	["$Formula","string","X2-X1*X2/100"],	
	["$Text_PosA","string","S0: critical condition; holddown active"],
	["$Text_PosB","string","S1: high threshold; holddown active"],
	["$Text_PosC","string","S2: medium threshold; holddown active"],
	["$Text_PosD","string","S3: low threshold; holddown active"],
	["$Text_PosE","string","S4: limitless"],
	["$Text_Auto","string","Automatic mode"],
	["$Text_CmdRcvd","string","standby command"],
	["$Text_ManFinite","string","Temporary manual control"],
	["$Text_ManInfinite","string","Manual mode"],
	["$Text_None","string","---"],
	["$Text_AlarmRcvd","string","alarm"],
	["$Text_CritThreshExcd","string","critical wind"],	
	["$ActivateTriggered","bool",false],
	["$bit0","bool",false],
	["$bit1","bool",false],
	["$bit2","bool",false],
	["$bit3","bool",false],
	["$bit4","bool",false],
	["$Change2AutoTriggered","bool",false],	
	["$Change2Man","bool",false],
	["$FullRetract","bool",false],	
	["$LastPosition","integer",0],
	["$ManInactivation","bool",false],
	["$MoveManTriggered","bool",false],
	["$OpState","integer",0],
	["$OpState2Bin","bool",false],	
	["$PosManTriggered","bool",false],	
	["$PosState","integer",0],
	["$PosState2Bin","bool",false],	
	["$SameVal","bool",false],
	["$SendCond","bool",false],	
	["$StopManTriggered","bool",false],	
	["$SumAlarm","bool",false],
	["$ResetTriggered","bool",false],
	["$SumSkipS4","bool",false],
	["$WindLowDet","bool",false],
	["$WindMedDet","bool",false],
	["$WindHighDet","bool",false],
	["$WindCriticalDet","bool",false],
	["$WindLow","float",0.0],
	["$WindMed","float",0.0],
	["$WindHigh","float",0.0],
	["$WindCritical","float",0.0],	
	["$WindLowHystL","float",0.0],
	["$WindMedHystL","float",0.0],
	["$WindHighHystL","float",0.0],
	["$WindCriticalHystL","float",0.0],	
	["$WindLowTmr","bool",false],
	["$WindMedTmr","bool",false],
	["$WindHighTmr","bool",false],
	["$WindCriticalTmr","bool",false],
	["$I_Activate","bool",false],
	["$I_Automatic","bool",false],
	["$I_MoveMan","bool",false],
	["$I_StopMan","bool",false],
	["$I_PosMan","integer",0],
	["$I_Reset","bool",false],
	["$I_WindSpeed","float",0.0],
	["$O_AutoStandbyBin","bool",false],
	["$O_AutoStateBin","bool",false],
	["$O_InactivationInfo","string","Init-Value"],
	["$O_Position","integer",0],
	["$O_SMOpState","string","Init-Value"],
	["$O_SMPosState","string","Init-Value"],
	["$O_TempManBin","bool",false],
	["$O_Valance","integer",0],
	["$P_Holddown","integer",1200],
	["$P_Hysteresis","integer",60],
	["$P_ManTimeout","integer",3600],
	["$P_PosNoWind","integer",100],
	["$P_PosWindLow","integer",75],
	["$P_PosWindMed","integer",50],
	["$P_PosWindHigh","integer",25],
	["$P_PosRetracted","integer",0],
	["$P_WindLow","float",2.0],
	["$P_WindMed","float",3.0],
	["$P_WindHigh","float",4.0],
	["$P_WindCritical","float",6.0],
	["$VAR<I_Alarm?>","bool",false],
	["$VAR<I_SkipS4?>","bool",false],
 	["$VAR<Inhibit?>","bool",false]
  ],
  "Input": [
	["In:Wind speed","Wind speed from sensor.", "$I_WindSpeed","a"],
	["In:Enable automatic","True enables automatic control. False switches to permanent manual control (no timer based fallback to automatic-mode). For safety reasons, alert inputs and critical wind threshold stays active and retracts awning, if triggered.", "$I_Automatic","a"],	
	["In:Start/Standby","Start (=extend) or standby (=retract) automatic awning control. True changes immediately to automatic mode, when in temporary manual operation.", "$I_Activate","a"],
	["In:Sense manual position","Triggering this input changes into temporary manual operation with fallback to automatic-mode by timer (Man control timeout). Accepts numeric value, e.g. absolute position.", "$I_PosMan","a"],
	["In:Sense manual move","Triggering this input changes into temporary manual operation with fallback to automatic-mode by timer (Man control timeout). Accepts binary value, e.g. move telegram.", "$I_MoveMan","a"],
	["In:Sense manual stop","Triggering this input changes into temporary manual operation with fallback to automatic-mode by timer (Man control timeout). Accepts binary value, e.g. stop telegram.", "$I_StopMan","a"],
	["In:Reset","Reset delay timer","$I_Reset","a"],
	["In:Skip full extension","True skips the maximum extension of awning (WindLow threshold always triggered) for safety purposes, e.g. when forecast reports strong wind.", "$VAR<I_SkipS4?>","a"],
	["In:Alarm","True on any input disables and prevents automatic mode and fully retracts awning, e.g. when wind sensor failure is reported.", "$VAR<I_Alarm?>","a"],
	["In:Inhibit","Stops logic/disables all functions.","$VAR<Inhibit?>","u"],
	["Par:Man control timeout","Time in s, to return from temporary manual control to automatic control again. Automatic needs to be enabled.", "$P_ManTimeout","u"],
	["Par:Delay timer","Wait time in s, until automatic can extend awning after partial retraction. (Retracts are not delayed)", "$P_Holddown","u"],
	["Par:Threshold low wind","Threshold to enter low windspeed position.", "$P_WindLow","u"],
	["Par:Threshold medium wind","Threshold to enter medium windspeed position.", "$P_WindMed","u"],
	["Par:Threshold high wind","Threshold in to enter high windspeed position.", "$P_WindHigh","u"],
	["Par:Threshold critical wind","Threshold to enter critical windspeed condition. Fully retracts awning and enters passive state.", "$P_WindCritical","u"],
	["Par:Hysteresis","Hysteresis of thresholds in %: Threshold - Hysteresis to leave position after delay timer exceeded.", "$P_Hysteresis","u"],	
	["Par:Position low wind","Low windspeed position.", "$P_PosWindLow","u"],
	["Par:Position medium wind","Medium windspeed position.", "$P_PosWindMed","u"],
	["Par:Position high wind","High windspeed position.", "$P_PosWindHigh","u"]
  ],
  "_Meta": {
    "Icon": "",
    "Version": "1.0",
    "_description": "Awning control"
  },
  "Output": [
	["Set Position","Output to set position of awning","$O_Position","x"],
	["Status automatic","Binary status if automatic enabled/disabled","$O_AutoStateBin?","c"],
	["Status standby","Binary status if automatic started or on standby","$O_AutoStandbyBin?","c"],
	["Status automatic interrupted","Binary status if temporary manual control is active","$O_TempManBin?","c"],
	["Info: Internal position states","Text output of internal position states.","$O_SMPosState?","c"],
	["Info: Operation mode","Text output of active operation mode.","$O_SMOpState?","c"],
	["Info: Inactivation cause","Textual information about last reason of inactivation.","$O_InactivationInfo?","c"],
	["Valance","Interface to logic module for control of a valance.","$O_Valance?","c"]
  ],
  "Module": [
	["Break",["$VAR<Inhibit?>"]],															//completely disable logic
	["Or",["$VAR<I_Alarm?>"], "$SumAlarm"],													//Allow multiple alarm inputs
	["Or",["$VAR<I_SkipS4?>"], "$SumSkipS4"],												//Allow multiple SkipS4 inputs
	["Triggered", "$I_Activate", "$ActivateTriggered" ],									//Check if input was triggered
	["And",["$ActivateTriggered","$I_Activate"], "$Change2AutoTriggered"],					//Determine, whether <true> was received
	["And",["$ActivateTriggered","-$I_Activate"], "$ManInactivation"],						//Determine, whether <false> was received
	["Triggered", "$I_MoveMan", "$MoveManTriggered" ],										//Check if input was triggered
	["Triggered", "$I_StopMan", "$StopManTriggered" ],										//Check if input was triggered
	["Triggered", "$I_PosMan", "$PosManTriggered" ],										//Check if input was triggered
	["Or",["$MoveManTriggered", "$StopManTriggered", "$PosManTriggered"], "$Change2Man"], 	//Check if any one of the sense inputs was triggered
	["Triggered", "$I_Reset", "$ResetTriggered" ],											//Check if input was triggered
	
	["CalcFormula",["$P_Hysteresis","$P_WindLow"], "$WindLowHystL", "$Formula"],			//Calculate lower threshold for comparator based on configured hysteresis and upper threshold
	["CalcFormula",["$P_Hysteresis","$P_WindMed"], "$WindMedHystL", "$Formula"],			//Calculate lower threshold for comparator based on configured hysteresis and upper threshold
	["CalcFormula",["$P_Hysteresis","$P_WindHigh"], "$WindHighHystL", "$Formula"],			//Calculate lower threshold for comparator based on configured hysteresis and upper threshold
	["CalcFormula",["$P_Hysteresis","$P_WindCritical"], "$WindCriticalHystL", "$Formula"],	//Calculate lower threshold for comparator based on configured hysteresis and upper threshold
	
	["Multiplexer",["$P_WindLow","$WindLowHystL"],"$WindLow","$WindLowTmr"],						//Switch between high and low threshold dependent on timer
	["Multiplexer",["$P_WindMed","$WindMedHystL"],"$WindMed","$WindMedTmr"],						//Switch between high and low threshold dependent on timer
	["Multiplexer",["$P_WindHigh","$WindHighHystL"],"$WindHigh","$WindHighTmr"],					//Switch between high and low threshold dependent on timer
	["Multiplexer",["$P_WindCritical","$WindCriticalHystL"],"$WindCritical","$WindCriticalTmr"],	//Switch between high and low threshold dependent on timer
	
	["Comparator" , "$I_WindSpeed" , "$WindLowDet" , "$WindLow"],						//Check if threshold exceeded
	["Comparator" , "$I_WindSpeed" , "$WindMedDet" , "$WindMed"],						//Check if threshold exceeded
	["Comparator" , "$I_WindSpeed" , "$WindHighDet" , "$WindHigh"],						//Check if threshold exceeded
	["Comparator" , "$I_WindSpeed" , "$WindCriticalDet" , "$WindCritical"],				//Check if threshold exceeded

	["Or",["$WindLowDet", "$SumSkipS4"], "$WindLowDet"],								//Overlay low wind detection, if "skip S4" enabled
	
	["Monoflop","$WindLowDet","$ResetTriggered","$WindLowTmr","$P_Holddown",1],				//Delay timer to stay in current state (will be retriggered, when threshold exceeded again by next measure)
	["Monoflop","$WindMedDet","$ResetTriggered","$WindMedTmr","$P_Holddown",1],				//Delay timer to stay in current state (will be retriggered, when threshold exceeded again by next measure)
	["Monoflop","$WindHighDet","$ResetTriggered","$WindHighTmr","$P_Holddown",1],			//Delay timer to stay in current state (will be retriggered, when threshold exceeded again by next measure)
	["Monoflop","$WindCriticalDet","$ResetTriggered","$WindCriticalTmr","$P_Holddown",1],	//Delay timer to stay in current state (will be retriggered, when threshold exceeded again by next measure)
	
	["Latch","$SumAlarm", "-$I_Activate", "$SumAlarm", 0],								//enter automatic passive mode and retract when alarm received
	["Latch","$SumAlarm", "-$I_Automatic", "$SumAlarm", 0],								//change to permanent manual mode when alarm received
	["Latch","$WindCriticalTmr", "-$I_Activate", "$WindCriticalTmr", 0],				//enter automatic passive mode and retract, once critical threshold reached

	["Statemachine",																	//Statemachine for determining positions and transitions
	// 4: Extend max		kein Wind mit Timer vor erneutem Ausfahren
	// 3: Extend high		wenig Wind mit Timer vor erneutem Ausfahren
	// 2: Extend med		mittel Wind mit Timer vor erneutem Ausfahren
	// 1: Extend low		stark Wind mit Timer vor erneutem Ausfahren
	// 0: Retract 			kritischer Wind
	// [condition , actual state, next state, timeout] 
      [
		["$WindCriticalTmr" , 4, 0, 0],
		["$WindCriticalTmr" , 3, 0, 0],
		["$WindCriticalTmr" , 2, 0, 0],
		["$WindCriticalTmr" , 1, 0, 0],
		["$WindHighTmr" , 4, 1, 0],
		["$WindHighTmr" , 3, 1, 0],  
		["$WindHighTmr" , 2, 1, 0],
		["$WindMedTmr" , 4, 2, 0],
		["$WindMedTmr" , 3, 2, 0],
		["$WindLowTmr" , 4, 3, 0],
		["-$WindLowTmr" , 3, 4, 0],
		["-$WindLowTmr" , 2, 4, 0],
		["-$WindLowTmr" , 1, 4, 0],
		["-$WindLowTmr" , 0, 4, 0],
		["-$WindMedTmr" , 2, 3, 0],
		["-$WindMedTmr" , 1, 3, 0],
		["-$WindMedTmr" , 0, 3, 0]
	],
      "$PosState"
	],

	["Statemachine",													//Satemachine for handling operation modes and transitions
	// 2: Manual infinite mode
	// 1: Manual timeout mode
	// 0: Automode
	// [condition , actual state, next state, timeout] 
      [
		["$I_Automatic" , 2, 0, 0],					//Switch from infinite manual-mode to automatic
		["-$I_Automatic" , 0, 2, 0],				//Switch to infinite manual mode
		["-$I_Automatic" , 1, 2, 0],				//Switch to infinite manual mode
		["$Change2Man" , 0, 1, "$P_ManTimeout"],	//Change into manual-mode with fallback to automatic, when one of the manual inputs was used
		["$Change2Man" , 1, 1, "$P_ManTimeout"],	//Change into manual-mode with fallback to automatic, when one of the manual inputs was used
		[0 , 1, 0, 0],								//Fallback to automatic, after timeout
		["$Change2AutoTriggered" , 1, 0, 0]			//Switch on demand from manual-mode with fallback to automatic, without waiting for timeout
      ],
      "$OpState"
	],
	["And",["$OpState"], "$OpState2Bin"],			//Convert $OpState into bool value for later use
	["And",["$PosState"], "$PosState2Bin"],			//Convert $PosState into bool value for later use
	
	["Multiplexer",["$P_PosRetracted","$P_PosWindHigh","$P_PosWindMed","$P_PosWindLow","$P_PosNoWind","$O_Position"],"$O_Position","$PosState"],	//Select position values based on state
	["Or",["$WindCriticalDet","-$I_Activate","$SumAlarm", "-$I_Automatic"], "$FullRetract"],														//Determine if full retract condition
	["Multiplexer",["$O_Position","$P_PosRetracted"],"$O_Position","$FullRetract"],																	//Overwrite position, when full retract condition
	
	["Multiplexer",["$Text_PosA","$Text_PosB","$Text_PosC","$Text_PosD","$Text_PosE"],"$O_SMPosState","$PosState"],		//Text output of internal states
	["Multiplexer",["$Text_Auto","$Text_ManFinite","$Text_ManInfinite"],"$O_SMOpState","$OpState"], 					//Text output of operation mode
	["Multiplexer",["$ConstTrue","$ConstTrue","$ConstFalse"],"$O_AutoStateBin","$OpState"], 							//Binary status of operation mode
	["Multiplexer",["$ConstFalse","$ConstTrue","$ConstFalse"],"$O_TempManBin","$OpState"], 								//Binary status of temporary manual control
	["Multiplexer",["$ConstFalse","$ConstTrue"],"$O_AutoStandbyBin","$I_Activate"], 									//Binary status if automatic started or standby

	["Latch","$Text_None","$O_InactivationInfo","$I_Activate",1],										//Textual information about inactivation reason will reset, when activated again
	["Latch","$Text_CmdRcvd","$O_InactivationInfo","$ManInactivation",1],								//Textual information about inactivation reason
	["Latch","$Text_CritThreshExcd","$O_InactivationInfo","$WindCriticalTmr",0],						//Textual information about inactivation reason
	["Latch","$Text_AlarmRcvd","$O_InactivationInfo","$SumAlarm",0],									//Textual information about inactivation reason
	
	["BinaryDemultiplexer","$OpState",["$bit0","$bit1"]],														//Bit decode of OpState for valance control output
	["BinaryDemultiplexer","$PosState",["$bit2","$bit3","$bit4"]],												//Bit decode of PosState for valance control output
	["BinaryMultiplexer",["$bit0","$bit1","$bit2","$bit3","$bit4","$FullRetract","$I_Activate"],"$O_Valance"],	//Calculation of valance control output value
	
	["Limiter","$O_Position",0,"$SameVal",["$LastPosition", "$LastPosition"]],       	//Check, if $O_Position has new value
	["Latch","$O_Position","$LastPosition","$ConstTrue",0],								//Save $O_Position for next cycle
	["Latch","$ConstFalse","$SameVal","$OpState2Bin",2],								//Ensure sending, when changed back to automatic
	["And",["-$SameVal","-$OpState2Bin"], "$SendCond"],									//Send when automatic and new vale
	
	["Latch","$ConstTrue","$SendCond","$PosState2Bin",2],								//Always send, when entering critical wind state
	["Latch","$ConstTrue","$SendCond","$SumAlarm",1],									//Always send, when alert received

	["SendExplicit","$SendCond","$O_Position",0]										//Selective sending of awning positions
  ]
}
/** Der Schöpfer dieser Custom Logik überträgt die Nutzungsrechte gemäß der TOLL ("Timberwolf Open Logikblock License") die unter https://wrgt.news/TOLL zum Download zur Verfügung steht. */
Zuletzt geändert von Dragonos2000 am Fr Jul 29, 2022 6:48 pm, insgesamt 5-mal geändert.
Lg
Jochen
____________________________________________________________
TW 2600 #188
VPN offen, Zugriff jederzeit, Experimente jederzeit, Reboot jederzeit

Ersteller
Dragonos2000
Reactions:
Beiträge: 2181
Registriert: So Aug 12, 2018 1:38 pm
Wohnort: Karlsruher Raum
Hat sich bedankt: 481 Mal
Danksagung erhalten: 889 Mal

#2

Beitrag von Dragonos2000 »

Noch ein Hinweis: Aus Safety-Gründen bietet es sich an, den Windeingang auf "I" (Inhibit) zu setzen, damit der Baustein erst startet, nachdem die Windgeschwindigkeit übertragen wurde.
Lg
Jochen
____________________________________________________________
TW 2600 #188
VPN offen, Zugriff jederzeit, Experimente jederzeit, Reboot jederzeit

Ersteller
Dragonos2000
Reactions:
Beiträge: 2181
Registriert: So Aug 12, 2018 1:38 pm
Wohnort: Karlsruher Raum
Hat sich bedankt: 481 Mal
Danksagung erhalten: 889 Mal

#3

Beitrag von Dragonos2000 »

Baustein V1.1

Changelog:
  • Code Optimierungen
  • Startwerte so angepasst, dass nach dem Speichern/Aufsetzen der Logik der aktuelle Status Ausgangswert gesendet wird (damit Visu oder Schalter in "Umschalt"-Konfiguration direkt am Anfang konsistent sind)
  • Die Markisenposition kann nun per Eingang "In/Par:Position setpoint" vorgegeben werden, der Baustein begrenzt dann lediglich die maximale Ausladung in Abhängigkeit vom Wind und führt einige Sicherheitsfunktionen aus (siehe Beschreibung zu V1.0). Dies ermöglicht über einen zusätzlichen Baustein bspw. eine Sonnenstandabhängige Positionierung. Ansonsten den Eingang fest auf 100% einstellen und der Baustein funktioniert identisch zu V1.0 - es wird dann stets die maximal mögliche Ausladung angesteuert

Code: Alles auswählen

/**===========================================================
Windabhängige automatische Steuerung von Markisen
============================================================*/

{
  "Level": [
	["$ConstFalse","bool",false],
	["$ConstTrue","bool",true],
	["$Formula","string","X2-X1*X2/100"],	
	["$Text_PosA","string","S0: critical wind; holddown active"],
	["$Text_PosB","string","S1: high wind; holddown active"],
	["$Text_PosC","string","S2: medium wind; holddown active"],
	["$Text_PosD","string","S3: low wind; holddown active"],
	["$Text_PosE","string","S4: limitless"],
	["$Text_Auto","string","Automatic mode"],
	["$Text_CmdRcvd","string","standby command"],
	["$Text_ManFinite","string","Temporary manual control"],
	["$Text_ManInfinite","string","Manual mode"],
	["$Text_None","string","---"],
	["$Text_AlarmRcvd","string","alarm"],
	["$Text_CritThreshExcd","string","critical wind"],	
	["$ActivateTriggered","bool",false],
	["$bit0","bool",false],
	["$bit1","bool",false],
	["$bit2","bool",false],
	["$bit3","bool",false],
	["$bit4","bool",false],
	["$Change2AutoTriggered","bool",false],	
	["$Change2Man","bool",false],
	["$FullRetract","bool",false],	
	["$LastPosition","integer",0],
	["$ManInactivation","bool",false],
	["$MoveManTriggered","bool",false],
	["$OpState","integer",0],
	["$OpState2Bin","bool",false],	
	["$PosManTriggered","bool",false],	
	["$PosState","integer",0],
	["$PosState2Bin","bool",false],	
	["$SameVal","bool",false],
	["$SendCond","bool",false],	
	["$StopManTriggered","bool",false],	
	["$SumAlarm","bool",false],
	["$ResetTriggered","bool",false],
	["$SumSkipS4","bool",false],
	["$WindLowDet","bool",false],
	["$WindMedDet","bool",false],
	["$WindHighDet","bool",false],
	["$WindCriticalDet","bool",false],
	["$WindLow","float",0.0],
	["$WindMed","float",0.0],
	["$WindHigh","float",0.0],
	["$WindCritical","float",0.0],	
	["$WindLowHystL","float",0.0],
	["$WindMedHystL","float",0.0],
	["$WindHighHystL","float",0.0],
	["$WindCriticalHystL","float",0.0],	
	["$WindLowTmr","bool",false],
	["$WindMedTmr","bool",false],
	["$WindHighTmr","bool",false],
	["$WindCriticalTmr","bool",false],
	["$WindLimit","integer",0],
	["$I_Activate","bool",false],
	["$I_Automatic","bool",false],
	["$I_MoveMan","bool",false],
	["$I_StopMan","bool",false],
	["$I_PosMan","integer",0],
	["$I_PosSetpoint","integer",100],
	["$I_Reset","bool",false],
	["$I_WindSpeed","float",0.0],
	["$O_AutoStandbyBin","bool",true],
	["$O_AutoStateBin","bool",true],
	["$O_InactivationInfo","string","Init-Value"],
	["$O_Position","integer",0],
	["$O_SMOpState","string","Init-Value"],
	["$O_SMPosState","string","Init-Value"],
	["$O_TempManBin","bool",true],
	["$O_Valance","integer",0],
	["$P_Holddown","integer",1200],
	["$P_Hysteresis","integer",60],
	["$P_ManTimeout","integer",3600],
	["$P_PosNoWind","integer",100],
	["$P_PosWindLow","integer",75],
	["$P_PosWindMed","integer",50],
	["$P_PosWindHigh","integer",25],
	["$P_PosRetracted","integer",0],
	["$P_WindLow","float",2.0],
	["$P_WindMed","float",3.0],
	["$P_WindHigh","float",4.0],
	["$P_WindCritical","float",6.0],
	["$VAR<I_Alarm?>","bool",false],
	["$VAR<I_SkipS4?>","bool",false],
	["$VAR<Inhibit?>","bool",false]
  ],
  "Input": [
	["In:Wind speed","Wind speed from sensor.", "$I_WindSpeed","a"],
	["In:Enable automatic","True enables automatic control. False switches to permanent manual control (no timer based fallback to automatic-mode). For safety reasons, alert inputs and critical wind threshold stays active and retracts awning, if triggered.", "$I_Automatic","a"],	
	["In:Start/Standby","Start (=extend) or standby (=retract) automatic awning control. True changes immediately to automatic mode, when in temporary manual operation.", "$I_Activate","a"],
	["In:Sense manual position","Triggering this input changes into temporary manual operation with fallback to automatic-mode by timer (Man control timeout). Accepts numeric value, e.g. absolute position.", "$I_PosMan","a"],
	["In:Sense manual move","Triggering this input changes into temporary manual operation with fallback to automatic-mode by timer (Man control timeout). Accepts binary value, e.g. move telegram.", "$I_MoveMan","a"],
	["In:Sense manual stop","Triggering this input changes into temporary manual operation with fallback to automatic-mode by timer (Man control timeout). Accepts binary value, e.g. stop telegram.", "$I_StopMan","a"],
	["In:Reset","Reset delay timer","$I_Reset","a"],
	["In:Skip full extension","True skips the maximum extension of awning (WindLow threshold always triggered) for safety purposes, e.g. when forecast reports strong wind.", "$VAR<I_SkipS4?>","a"],
	["In:Alarm","True on any input disables and prevents automatic mode and fully retracts awning, e.g. when wind sensor failure is reported.", "$VAR<I_Alarm?>","a"],
	["In:Inhibit","Stops logic/disables all functions.","$VAR<Inhibit?>","u"],
	["In/Par:Position setpoint","Position for awning. Set to 100 to always use maximum possible extension. Alternatively calculate values with external logic and the maximum extension will be limited according to wind (including safety functions).", "$I_PosSetpoint","u"],
	["Par:Man control timeout","Time in s, to return from temporary manual control to automatic control again. Automatic needs to be enabled.", "$P_ManTimeout","u"],
	["Par:Delay timer","Wait time in s, until automatic can extend awning after partial retraction. (Retracts are not delayed)", "$P_Holddown","u"],
	["Par:Threshold low wind","Threshold to enter low windspeed position.", "$P_WindLow","u"],
	["Par:Threshold medium wind","Threshold to enter medium windspeed position.", "$P_WindMed","u"],
	["Par:Threshold high wind","Threshold in to enter high windspeed position.", "$P_WindHigh","u"],
	["Par:Threshold critical wind","Threshold to enter critical windspeed condition. Fully retracts awning and enters passive state.", "$P_WindCritical","u"],
	["Par:Hysteresis","Hysteresis of thresholds in %: Threshold - Hysteresis to leave position after delay timer exceeded.", "$P_Hysteresis","u"],	
	["Par:Position low wind","Low windspeed position.", "$P_PosWindLow","u"],
	["Par:Position medium wind","Medium windspeed position.", "$P_PosWindMed","u"],
	["Par:Position high wind","High windspeed position.", "$P_PosWindHigh","u"]
  ],
  "_Meta": {
    "Icon": "",
    "Version": "1.1",
    "_description": "Awning control"
  },
  "Output": [
	["Set Position","Output to set position of awning","$O_Position","x"],
	["Status automatic","Binary status if automatic enabled/disabled","$O_AutoStateBin?","c"],
	["Status standby","Binary status if automatic started or on standby","$O_AutoStandbyBin?","c"],
	["Status automatic interrupted","Binary status if temporary manual control is active","$O_TempManBin?","c"],
	["Info: Internal position states","Text output of internal position states.","$O_SMPosState?","c"],
	["Info: Operation mode","Text output of active operation mode.","$O_SMOpState?","c"],
	["Info: Inactivation cause","Textual information about last reason of inactivation.","$O_InactivationInfo?","c"],
	["Valance","Interface to logic module for control of a valance.","$O_Valance?","c"]

  ],
  "Module": [
	["Break",["$VAR<Inhibit?>"]],															//completely disable logic
	["Or",["$VAR<I_Alarm?>"], "$SumAlarm"],													//Allow multiple alarm inputs
	["Or",["$VAR<I_SkipS4?>"], "$SumSkipS4"],												//Allow multiple SkipS4 inputs
	["Triggered", "$I_Activate", "$ActivateTriggered" ],									//Check if input was triggered
	["And",["$ActivateTriggered","$I_Activate"], "$Change2AutoTriggered"],					//Determine, whether <true> was received
	["And",["$ActivateTriggered","-$I_Activate"], "$ManInactivation"],						//Determine, whether <false> was received
	["Triggered", "$I_MoveMan", "$MoveManTriggered" ],										//Check if input was triggered
	["Triggered", "$I_StopMan", "$StopManTriggered" ],										//Check if input was triggered
	["Triggered", "$I_PosMan", "$PosManTriggered" ],										//Check if input was triggered
	["Or",["$MoveManTriggered", "$StopManTriggered", "$PosManTriggered"], "$Change2Man"], 	//Check if any one of the sense inputs was triggered
	["Triggered", "$I_Reset", "$ResetTriggered" ],											//Check if input was triggered
	
	["CalcFormula",["$P_Hysteresis","$P_WindLow"], "$WindLowHystL", "$Formula"],			//Calculate lower threshold for comparator based on configured hysteresis and upper threshold
	["CalcFormula",["$P_Hysteresis","$P_WindMed"], "$WindMedHystL", "$Formula"],			//Calculate lower threshold for comparator based on configured hysteresis and upper threshold
	["CalcFormula",["$P_Hysteresis","$P_WindHigh"], "$WindHighHystL", "$Formula"],			//Calculate lower threshold for comparator based on configured hysteresis and upper threshold
	["CalcFormula",["$P_Hysteresis","$P_WindCritical"], "$WindCriticalHystL", "$Formula"],	//Calculate lower threshold for comparator based on configured hysteresis and upper threshold
	
	["Multiplexer",["$P_WindLow","$WindLowHystL"],"$WindLow","$WindLowTmr"],						//Switch between high and low threshold dependent on timer
	["Multiplexer",["$P_WindMed","$WindMedHystL"],"$WindMed","$WindMedTmr"],						//Switch between high and low threshold dependent on timer
	["Multiplexer",["$P_WindHigh","$WindHighHystL"],"$WindHigh","$WindHighTmr"],					//Switch between high and low threshold dependent on timer
	["Multiplexer",["$P_WindCritical","$WindCriticalHystL"],"$WindCritical","$WindCriticalTmr"],	//Switch between high and low threshold dependent on timer
	
	["Comparator" , "$I_WindSpeed" , "$WindLowDet" , "$WindLow"],						//Check if threshold exceeded
	["Comparator" , "$I_WindSpeed" , "$WindMedDet" , "$WindMed"],						//Check if threshold exceeded
	["Comparator" , "$I_WindSpeed" , "$WindHighDet" , "$WindHigh"],						//Check if threshold exceeded
	["Comparator" , "$I_WindSpeed" , "$WindCriticalDet" , "$WindCritical"],				//Check if threshold exceeded

	["Or",["$WindLowDet", "$SumSkipS4"], "$WindLowDet"],								//Overlay low wind detection, if "skip S4" enabled
	
	["Monoflop","$WindLowDet","$ResetTriggered","$WindLowTmr","$P_Holddown",1],				//Delay timer to stay in current state (will be retriggered, when threshold exceeded again by next measure)
	["Monoflop","$WindMedDet","$ResetTriggered","$WindMedTmr","$P_Holddown",1],				//Delay timer to stay in current state (will be retriggered, when threshold exceeded again by next measure)
	["Monoflop","$WindHighDet","$ResetTriggered","$WindHighTmr","$P_Holddown",1],			//Delay timer to stay in current state (will be retriggered, when threshold exceeded again by next measure)
	["Monoflop","$WindCriticalDet","$ResetTriggered","$WindCriticalTmr","$P_Holddown",1],	//Delay timer to stay in current state (will be retriggered, when threshold exceeded again by next measure)
	
	["Latch","$ConstFalse", "$I_Activate", "$SumAlarm", 0],								//enter automatic passive mode and retract when alarm received
	["Latch","$ConstFalse", "$I_Automatic", "$SumAlarm", 0],								//change to permanent manual mode when alarm received
	["Latch","$ConstFalse", "$I_Activate", "$WindCriticalTmr", 0],				//enter automatic passive mode and retract, once critical threshold reached

	["Statemachine",																	//Statemachine for determining positions and transitions
	// 4: Extend max		kein Wind
	// 3: Extend high		wenig Wind
	// 2: Extend med		mittel Wind
	// 1: Extend low		stark Wind
	// 0: Retract 			kritischer Wind
	// [condition , actual state, next state, timeout] 
      [
		["$WindCriticalTmr" , 4, 0, 0],
		["$WindCriticalTmr" , 3, 0, 0],
		["$WindCriticalTmr" , 2, 0, 0],
		["$WindCriticalTmr" , 1, 0, 0],
		["$WindHighTmr" , 4, 1, 0],
		["$WindHighTmr" , 3, 1, 0],  
		["$WindHighTmr" , 2, 1, 0],
		["$WindMedTmr" , 4, 2, 0],
		["$WindMedTmr" , 3, 2, 0],
		["$WindLowTmr" , 4, 3, 0],
		["-$WindLowTmr" , 3, 4, 0],
		["-$WindLowTmr" , 2, 4, 0],
		["-$WindLowTmr" , 1, 4, 0],
		["-$WindLowTmr" , 0, 4, 0],
		["-$WindMedTmr" , 2, 3, 0],
		["-$WindMedTmr" , 1, 3, 0],
		["-$WindMedTmr" , 0, 3, 0]
      ],
      "$PosState"
	],

	["Statemachine",													//Satemachine for handling operation modes and transitions
	// 2: Manual infinite mode
	// 1: Manual timeout mode
	// 0: Automode
	// [condition , actual state, next state, timeout] 
      [
		["$I_Automatic" , 2, 0, 0],					//Switch from infinite manual-mode to automatic
		["-$I_Automatic" , 0, 2, 0],				//Switch to infinite manual mode
		["-$I_Automatic" , 1, 2, 0],				//Switch to infinite manual mode
		["$Change2Man" , 0, 1, "$P_ManTimeout"],	//Change into manual-mode with fallback to automatic, when one of the manual inputs was used
		["$Change2Man" , 1, 1, "$P_ManTimeout"],	//Change into manual-mode with fallback to automatic, when one of the manual inputs was used
		[0 , 1, 0, 0],								//Fallback to automatic, after timeout
		["$Change2AutoTriggered" , 1, 0, 0]			//Switch on demand from manual-mode with fallback to automatic, without waiting for timeout
      ],
      "$OpState"
	],
	["And",["$OpState"], "$OpState2Bin"],			//Convert $OpState into bool value for later use
	["And",["$PosState"], "$PosState2Bin"],			//Convert $PosState into bool value for later use
	
	["Multiplexer",["$P_PosRetracted","$P_PosWindHigh","$P_PosWindMed","$P_PosWindLow","$P_PosNoWind"],"$WindLimit","$PosState"],					//Select position limits based on state	
	
	["Limiter","$I_PosSetpoint","$O_Position",0,["$P_PosRetracted", "$WindLimit"]],																	//Limit setpoint/extension to value according to wind

	["Or",["$WindCriticalDet","-$I_Activate","$SumAlarm", "-$I_Automatic"], "$FullRetract"],														//Determine if full retract condition
	["Multiplexer",["$O_Position","$P_PosRetracted"],"$O_Position","$FullRetract"],																	//Overwrite position, when full retract condition

	
	
	["Multiplexer",["$Text_PosA","$Text_PosB","$Text_PosC","$Text_PosD","$Text_PosE"],"$O_SMPosState","$PosState"],		//Text output of internal states
	["Multiplexer",["$Text_Auto","$Text_ManFinite","$Text_ManInfinite"],"$O_SMOpState","$OpState"], 					//Text output of operation mode
	["Multiplexer",["$ConstTrue","$ConstTrue","$ConstFalse"],"$O_AutoStateBin","$OpState"], 							//Binary status of operation mode
	["Multiplexer",["$ConstFalse","$ConstTrue","$ConstFalse"],"$O_TempManBin","$OpState"], 								//Binary status of temporary manual control
	["Multiplexer",["$ConstFalse","$ConstTrue"],"$O_AutoStandbyBin","$I_Activate"], 									//Binary status if automatic started or standby

	["Latch","$Text_None","$O_InactivationInfo","$I_Activate",1],										//Textual information about inactivation reason will reset, when activated again
	["Latch","$Text_CmdRcvd","$O_InactivationInfo","$ManInactivation",1],								//Textual information about inactivation reason
	["Latch","$Text_CritThreshExcd","$O_InactivationInfo","$WindCriticalTmr",0],						//Textual information about inactivation reason
	["Latch","$Text_AlarmRcvd","$O_InactivationInfo","$SumAlarm",0],									//Textual information about inactivation reason
	
	["BinaryDemultiplexer","$OpState",["$bit0","$bit1"]],														//Bit decode of OpState for valance control output
	["BinaryDemultiplexer","$PosState",["$bit2","$bit3","$bit4"]],												//Bit decode of PosState for valance control output
	["BinaryMultiplexer",["$bit0","$bit1","$bit2","$bit3","$bit4","$FullRetract","$I_Activate"],"$O_Valance"],	//Calculation of valance control output value
	
	["Limiter","$O_Position",0,"$SameVal",["$LastPosition", "$LastPosition"]],       	//Check, if $O_Position has new value
	["Latch","$O_Position","$LastPosition","$ConstTrue",0],								//Save $O_Position for next cycle
	["Latch","$ConstFalse","$SameVal","$OpState2Bin",2],								//Ensure sending, when changed back to automatic
	["And",["-$SameVal","-$OpState2Bin"], "$SendCond"],									//Send when automatic and new vale
	
	["Latch","$ConstTrue","$SendCond","$PosState2Bin",2],								//Always send, when entering critical wind state
	["Latch","$ConstTrue","$SendCond","$SumAlarm",1],									//Always send, when alert received

	["SendExplicit","$SendCond","$O_Position",0]										//Selective sending of awning positions
  ]
}
/** Der Schöpfer dieser Custom Logik überträgt die Nutzungsrechte gemäß der TOLL ("Timberwolf Open Logikblock License") die unter https://wrgt.news/TOLL zum Download zur Verfügung steht. */
Disclaimer:
Die Verwendung erfolgt auf eigene Gefahr. Ich hafte nicht für etwaige entstandene Schäden, die durch die Nutzung entstanden sind, noch garantiere ich eine Fehler freie Funktion.

Nutzungsrechte:
Der Schöpfer dieser Custom Logik überträgt die Nutzungsrechte gemäß der TOLL ("Timberwolf Open Logikblock License") die unter https://wrgt.news/TOLL zum Download zur Verfügung steht.
Zuletzt geändert von Dragonos2000 am Sa Jul 30, 2022 12:04 pm, insgesamt 5-mal geändert.
Lg
Jochen
____________________________________________________________
TW 2600 #188
VPN offen, Zugriff jederzeit, Experimente jederzeit, Reboot jederzeit
Antworten

Zurück zu „Zusätzliche Logikbausteine“