Hallo Martin,
sehr interessantes Bauwerk deine Bewässerung. Ich kenne in der Bekanntschaft einige die auch sowas umsetzen wollen. Welche Komponeten sind bei dir in der Anlage so verbaut?
Hallo Martin,
Hi Stefan,
Genau - bisher sind es 12 Ventile, 3 Abgänge zu UVs, 2 Einspeisungen. Insgesamt wären 20 Schellen möglich (einfach oder doppelt).
Also gedacht ist so, dass durch das Finish Signal der Sequenzer weiterschaltet (Rising Edge Logik als Eingangsgatter). Dabei hört der "alte" Kreis auf eine System Anforderung zu stellen und der "Neue" stellt sie. Prinzipiell funktioniert das ja alles in einem "Takt". Allerdings (ich glaube darauf willst du raus) wird es einen kurzen "Glitch" geben, in der die Anforderung verschwindet und somit dann das System anfängt "runterzufahren". Ich hab es aber eigentlich so geplant, dass spätestens während der Nachlaufzeit dieser Glitch sich stabilisiert und damit dann vom "Nachlauf Pumpe" wieder in "Run" übergangen wird. Da hab ich aber noch nicht den Übergang eingebaut in dem Automaten, da ich erst den Glitch sehen wollte. Wie gesagt ist noch WIPRobert_Mini hat geschrieben: ↑Di Apr 21, 2020 10:57 pm Was ich nicht ganz verstehe: Bei dir sendet die Kreissteuerung die Anforderung an das System, ich vermute, weil du auch einzeln schalten willst - macht Sinn. Wie funktioniert dann das Weiterschalten in der Automatik: passiert das während der Nachlaufzeit, so dass der nächste Kreis eine Anforderung schickt, bevor die Nachlaufzeit zu Ende ist?
Hi Michael,
Code: Alles auswählen
/**
* File: Irrigation_Sequencer.twl V1.0 ALPHA 1
* Logic for Garden irrigation. This module is the sequencer which controls an automatic run of all circuits
* Author: Hans Martin
*
*/
{
"Input": [
["Start", "(RISING) Trigger to start an automatic irrigation cycle", "$TriggerInpStart", "c"],
["Stop", "(RISING) Trigger to stop an automatic irrigation cycle", "$TriggerInpStop", "c"],
["Next", "(RISING) Trigger to step to next circuit", "$TriggerInpNext", "c"],
["Inhibit", "", "$VAR<Inhibit?>", "c"]
],
"Output": [
["Sequencer Active", "(0/1) State of sequencer", "$SequencerActive", "c"],
["Sequencer Number", "(R+) Current active output number", "$SequencerNumber", "c"],
["Stop", "(RISING) Signal to stop all irrigation circuits", "$SequencerStop", "c"],
// repeat as many time as desired irrigation circuits
["Channel 1", "(0/1) Trigger for irrigation circuit", "$Circuit_1", "c"],
["Channel 2", "(0/1) Trigger for irrigation circuit", "$Circuit_2", "c"]
],
"Level": [
// Inputs
["$VAR<Inhibit?>","bool",false],
["$TriggerInpStart","bool",false],
["$TriggerInpStop","bool",false],
["$TriggerInpNext","bool",false],
// Outputs
["$SequencerActive","bool",false], // also used as internal state
["$SequencerNumber","int",0],
["$SequencerStop","bool",false],
// Channels
// Configure number of circuits
["$NumberOfSteps","int",2],
// channel outs - repeat as many irrigation circuits are configured above
["$Circuit_1","bool",false],
["$Circuit_2","bool",false],
// Constants
["$Konst1", "int", 1],
// Internals
["$CurrentStep","int",0],
["$NextStep","int",0],
["$StepOverflow", "bool", false],
["$TriggerInpStartRising","bool",false],
["$TriggerInpStopRising","bool",false],
["$TriggerInpNextRising","bool",false],
["$TriggerInpStartLast","bool",false],
["$TriggerInpStopLast","bool",false],
["$TriggerInpNextLast","bool",false]
],
"Module": [
// calculate rising edges
["And", ["$TriggerInpStart","-$TriggerInpStartLast", "-$SequencerActive"], "$TriggerInpStartRising"],
["And", ["$TriggerInpStop","-$TriggerInpStopLast", "$SequencerActive"], "$TriggerInpStopRising"],
["And", ["$TriggerInpNext","-$TriggerInpNextLast", "$SequencerActive"], "$TriggerInpNextRising"],
// set last trigger variables
["And", ["$TriggerInpStart"], "$TriggerInpStartLast"],
["And", ["$TriggerInpStop"], "$TriggerInpStopLast"],
["And", ["$TriggerInpNext"], "$TriggerInpNextLast"],
// calculate start of system
["Multiplexer", ["$SequencerActive", "$Konst1"], "$SequencerActive", "$TriggerInpStartRising"],
// calculate next step
["Polynomial", "$Konst1", "$NextStep", ["$CurrentStep", "$Konst1"] ], // ++$CurrentStep
["Comparator", "$NextStep", "$StepOverflow", "$NumberOfSteps"],
["Multiplexer", ["$NextStep", 0], "$NextStep", "$StepOverflow"],
// set next step when next was triggered or system was started
["Multiplexer", ["$CurrentStep","$NextStep"], "$CurrentStep", "$TriggerInpNextRising"],
["Multiplexer", ["$CurrentStep","$NextStep"], "$CurrentStep", "$TriggerInpStartRising"],
// reset current step when stop was issued
["Multiplexer", ["$CurrentStep",0], "$CurrentStep", "$TriggerInpStopRising"],
["Monoflop","$TriggerInpStopRising", 0, 0,"$Konst1",2],
// write common outputs
["Polynomial", 0, "$SequencerNumber", ["$CurrentStep"]],
["Multiplexer", [0, "$Konst1"], "$SequencerStop", "$TriggerInpStopRising"],
["Multiplexer", [0, "$SequencerActive"], "$SequencerActive", "$CurrentStep"],
// write circuit outputs
// copy as many circuit exists. Put a zero in front of $Konst1 for each new step.
["Multiplexer", [0, "$Konst1", 0], "$Circuit_1", "$CurrentStep"],
["Multiplexer", [0, 0, "$Konst1", 0], "$Circuit_2", "$CurrentStep"]
]
}
Code: Alles auswählen
/**
* File: Irrigation_SystemControl.twl V1.0 ALPHA 2
* Logic for Garden irrigation. This module is the SystemControl which controls the pump and other related systems (like power supplies).
* Author: Hans Martin
*
*/
{
"Input": [
["System Request", "(0/1) Indicates whether the system should be activated", "$SystemRequest", "c"],
["System Forerun", "(T_s) Time how long the system should run before the pump is activated", "$SystemForerun", "u"],
["Pump Forerun", "(T_s) Time how long the pump should run before system goes into the OK state", "$PumpForerun", "u"],
["System FollowUp", "(T_s) Time how long the system should run after the pump is shut down", "$SystemFollowUp", "u"],
["Pump FollowUp", "(T_s) Time how long the pump should run after the request gone", "$PumpFollowUp", "u"],
["Inhibit", "", "$VAR<Inhibit?>", "c"]
],
"Output": [
["System State","(0/1) Indicates whether the system has a request","$SystemState","c"],
["System OK", "(0/1) Indicates that the system is in fully operational state", "$SystemOk", "c"],
["System Warning", "(0/1) Indicates that the system is partially operating", "$SystemWarn", "c"],
["System Error", "(0/1) Indicates that the system is in faulted state", "$SystemError", "c"],
["System", "(0/1) Output to activate the system devices (e.g. power supply)", "$SystemOut", "c"],
["Pump", "(0/1) Output to activate the pump", "$PumpOut", "c"]
],
"Level": [
// Inputs
["$VAR<Inhibit?>","bool",false],
["$SystemRequest", "bool", false],
["$SystemForerun", "float", 0],
["$PumpForerun", "float", 0],
["$SystemFollowUp", "float", 0],
["$PumpFollowUp", "float", 0],
// Outputs
["$SystemState", "bool", false],
["$SystemOk", "bool", false],
["$SystemWarn", "bool", false],
["$SystemError", "bool", false],
["$SystemOut", "bool", false],
["$PumpOut", "bool", false],
// Consts
["$Konst1", "int", 1],
["$Konst5", "int", 5],
//Internals
["$State","integer",0],
["$InternalSystemWarn", "bool", false]
],
"Module": [
["Break", ["$VAR<Inhibit?>"]], // this is a problem! Fix it! (If system is running and inhibit is set, there is no way to reset the system!)
// build state
["Statemachine",
// 0: System Off
// 1: System Forerun
// 2: Pump Forerun
// 3: Running
// 4: Pump FollowUp
// 5: System FollowUp
[
// [condition , current state, next state, timeout]
["$SystemRequest", 0, 1, "$SystemForerun"], // new request
["-$SystemRequest", 1, 0, 0], // request canceled during system forerun
[0, 1, 2, "$PumpForerun"], // system forerun done
["-$SystemRequest", 2, 0, 0], // request canceled during pump forerun
[0, 2, 3, 0], // pump forerun done, system fully operating
["$SystemRequest", 3, 3, 0], // request still true
["-$SystemRequest", 3, 4, "$PumpFollowUp"], // pump follow up
["$SystemRequest", 4, 3, 0], // request within pump follow up
[0, 4, 5, "$SystemFollowUp"], //system follow up
[0, 5, 0, 0] // system off
],
"$State"
],
// map state to output
["Comparator", "$State", "$SystemOut", 0], // System Out (only 1 when state > 0)
["Multiplexer", [0, 0, "$Konst1", "$Konst1", "$Konst1", 0], "$PumpOut", "$State"], // Pump Out (1 when 5 > state > 1)
// map state to state outputs
["Comparator", "$State", "$SystemState", 0], // SystemState (only 1 when state > 0)
["Multiplexer", [0, "$Konst1", "$Konst1", 0, "$Konst1", "$Konst1"], "$InternalSystemWarn", "$State"], // system has warning if not in state 3 and has request
["And", ["-$SystemError", "$InternalSystemWarn"], "$SystemWarn"], // system has only warning exposed if no error is active
["And", ["-$SystemError", "-$SystemWarn", "$SystemRequest"], "$SystemOk" ] // system is ok if no error and no warning is active and request was made
]
}