NEWS
Hilfe bei Stromverbrauchs script
-
@root_ sagte:
Die Takte kommen ja je nach Stromverbrauch unterschiedlich schnell. Ich will erkennen wenn gerade viel Strom verbraucht wird
Genau das macht das Skript: Wenn der Abstand zwischen 2 Impulsen < 30 s ist (entspricht 10 Impulsen in 5 Minuten), ist die Leistung zu hoch.
-
@paul53
Danke, funktioniert prima.
Nur die letzte Zeile im script ist vertauscht oder?thx
-
@root_ sagte:
Nur die letzte Zeile im script ist vertauscht oder?
Nein. Es wird sich der Zeitstempel für die Differenzbildung beim nächsten Impuls gemerkt.
-
@paul53
Irgendwie stell ich mich zu blöd an.
Hier mal mein Blockly:
Wenn ich jetzt den Wert von S0_counter innerhalb von 30s um 2 erhöhe, sollte doch der Wert von laedt true werden oder? Das funktioniert aber irgendwie nicht.
Mit dem Timeout setze ich den laedt wieder auf false falls 60s keine Werterhöhung 30s/2 erfolgt. -
@root_ sagte:
S0_counter innerhalb von 30s um 2 erhöhe, sollte doch der wert von laedt auf true werden oder?
Ja.
Ist der Trigger nicht der S0-Impuls, sondern ein Zählwert? -
@paul53
Ich habe es aber gerade mal mit einem anderen Trigger probiert und das funktioniert auch nicht.
Der Trigger ist der S0-Wert welcher ein Zähler ist. -
@root_ sagte in Hilfe bei Stromverbrauchs script:
Der Trigger ist der S0-Wert welcher ein Zähler ist.
Bei einem Zählwert wird die Variable letzter_Impuls nicht benötigt. Stattdessen kann "vorherige letzte Änderung" für die Differenzbildung verwendet werden.
-
@paul53
Ich hoffe ich nerv nicht langsam aber ich komme nicht weiter.
Ich hab jetzt einen Example State (Logikwert) benutzt zum triggern.
Es funktioniert aber nicht. Der zu schaltende Datenpunkt bleibt immer false.
Könntest du dir das bitte noch mal anschauen?
Was ich auch noch nicht verstehe, wie wird
getriggert?Danke dir!!
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="~=hw)O*}Z$q85KTM{Iiz">letzter_Impuls</variable> <variable type="timeout" id="timeout">timeout</variable> <variable id="{ntQ$h}nsUTjnCi3$YST">letzte_Änderung</variable> </variables> <block type="variables_set" id="C;u0:uyCs,@G22k*|ktC" x="113" y="88"> <field name="VAR" id="~=hw)O*}Z$q85KTM{Iiz">letzter_Impuls</field> <value name="VALUE"> <block type="get_value" id="ouQ,~BK)f`L);Q[YhBJU"> <field name="ATTR">lc</field> <field name="OID">0_userdata.0.example_state</field> </block> </value> <next> <block type="comment" id="5~p?.PVPll([Omdnl+,["> <field name="COMMENT">2 S0 Impulse in 30sek</field> <next> <block type="on_ext" id="RsKK`dP9zA7*m0(1nRlD"> <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation> <field name="CONDITION">gt</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id=".QKGE}a}]wk2,jrmOYdu"> <field name="oid">0_userdata.0.example_state</field> </shadow> </value> <statement name="STATEMENT"> <block type="update" id="|EW.5~g2GwkDY;~6Nh1b"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Auto.laedt</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_compare" id="JR0[L~dWg+dES{KSnHfx"> <field name="OP">LT</field> <value name="A"> <block type="math_arithmetic" id="8@aDpD`@[!@7+iD{f/AK"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="nbBZ7J6I6zACS1L9$8b."> <field name="NUM">1</field> </shadow> <block type="variables_get" id="Pd)s6c@g|4:eTo)B$3fh"> <field name="VAR" id="{ntQ$h}nsUTjnCi3$YST">letzte_Änderung</field> </block> </value> <value name="B"> <shadow type="math_number" id="}TRTr6Jqvdcm]~h_gMil"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="g7$0dNClc)j}J~WW.I4B"> <field name="VAR" id="~=hw)O*}Z$q85KTM{Iiz">letzter_Impuls</field> </block> </value> </block> </value> <value name="B"> <block type="math_number" id="P|e*9qL))DKL#LH!W9`/"> <field name="NUM">30000</field> </block> </value> </block> </value> <next> <block type="variables_set" id="*9NVtJFSTi)4Ui1FwLgS"> <field name="VAR" id="~=hw)O*}Z$q85KTM{Iiz">letzter_Impuls</field> <value name="VALUE"> <block type="variables_get" id="Z0d/Jh,mecOGU,jN3c^Y"> <field name="VAR" id="{ntQ$h}nsUTjnCi3$YST">letzte_Änderung</field> </block> </value> <next> <block type="timeouts_cleartimeout" id="y;o(hkS#;,)Y2a9a!oTF"> <field name="NAME">timeout</field> </block> </next> </block> </next> </block> </statement> </block> </next> </block> </next> </block> <block type="on" id="iq:~Y//(UT5G;O/tFEAE" x="113" y="413"> <field name="OID">0_userdata.0.Auto.laedt</field> <field name="CONDITION">true</field> <field name="ACK_CONDITION"></field> <statement name="STATEMENT"> <block type="timeouts_settimeout" id="|mi+g}:NFA1g:~Aei8%~"> <field name="NAME">timeout</field> <field name="DELAY">30</field> <field name="UNIT">sec</field> <statement name="STATEMENT"> <block type="update" id="`YE-9rjUnFQo7z4IGQ/x"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Auto.laedt</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="1:^xEM/1?D+-k.W-/m$="> <field name="BOOL">FALSE</field> </block> </value> </block> </statement> </block> </statement> </block> </xml>
-
@root_
Du verwendest eine selbst erstellte Variable "letzte_Änderung". Es muss die "letzte Änderung" aus dem Trigger-Datenpunkt verwendet werden: -
@paul53
Funktioniert jetzt perfekt. Danke dir für deine Gedult.