Hotfixes during testing
authorBenjamin Braatz <benjamin.braatz@graph-it.com>
Wed, 3 Feb 2021 14:42:04 +0000 (15:42 +0100)
committerBenjamin Braatz <benjamin.braatz@graph-it.com>
Wed, 3 Feb 2021 14:51:05 +0000 (15:51 +0100)
conf.json
gmodbus/hitachi.py
schaltschrank/config.py
schaltschrank/websocket.py
web/index.html

index a65a0fd3112509ea640c36636744a5a5a35959e4..ed75b0dfc2180672766820f676d6ad4b721fe698 100644 (file)
--- a/conf.json
+++ b/conf.json
       "address": 32,
       "interrupt pin": 4,
       "pins":
-      [ [ "E1-1", "T1-18", "Schwungrad" ], [ "E1-2", "T1-19", "Takt" ],
-        [ "E1-3", "T1-20", "Öldruck" ], [ "E1-4", "T1-21", "Bruchplatte" ],
-        [ "E1-5", "T1-22", "Bruchplatte Einzug" ], [ "E1-6", "T1-23" ],
-        [ "E1-7", "T1-24" ], [ "E1-8", "T1-25" ] ] },
+      [ [ "E1-1", "T1-18" ], [ "E1-2", "T1-19" ],
+        [ "E1-3", "T1-20" ], [ "E1-4", "T1-21" ],
+        [ "E1-5", "T1-22" ], [ "E1-6", "T1-23" ],
+        [ "E1-7", "T1-24" ], [ "E1-8", "T1-25", "Schwungrad" ] ] },
     { "name": "E2",
       "type": "input",
       "address": 33,
       "pins":
       [ [ "E2-1", "T1-26" ], [ "E2-2", "T1-27" ],
         [ "E2-3", "T1-28" ], [ "E2-4", "T1-29" ],
-        [ "E2-5", "T1-30" ], [ "E2-6", "T1-31" ],
-        [ "E2-7", "T1-32" ], [ "E2-8", "T1-33" ] ] },
+        [ "E2-5", "T1-30", "Takt" ], [ "E2-6", "T1-31", "Öldruck" ],
+        [ "E2-7", "T1-32", "Bruchplatte" ], [ "E2-8", "T1-33", "Bruchplatte Einzug" ] ] },
     { "name": "E3",
       "type": "input",
       "address": 34,
       "interrupt pin": 27,
       "pins":
       [ [ "E3-1", "T2-1" ], [ "E3-2", "T2-2", "Notaus" ],
-        [ "E3-3", "T2-3", "Stop" ], [ "E3-4", "T2-4", "Dauerlauf" ],
+        [ "E3-3", "T2-3", "Stop" ], [ "E3-4", "T2-4", "Tippen" ],
         [ "E3-5", "T2-5", "Schmierung" ], [ "E3-6", "T2-6", "Vorlauf" ],
         [ "E3-7", "T2-7", "Rücklauf" ], [ "E3-8", "T2-8" ] ] },
     { "name": "E4",
index ef9374e438ca8121d6355323e4ec7e02dc613457..5b02f89d5868054ba93624d4166ac9741cee3865 100644 (file)
@@ -15,11 +15,11 @@ class SJP1Fu():
     # AA115 = 01, 14-43
     await self.__protocol.write_register(12015, 1)
     # AC120 = 0.5 s, 14-44
-    await self.__protocol.write_register(12220, 0.5)
+    await self.__protocol.write_register(12220, 1)
     # bA122 = 02, 14-53
     await self.__protocol.write_register(13022, 2)
-    # bA123 = 35 A, 14-53
-    await self.__protocol.write_register(13023, 35)
+    # bA123 = 50 A, 14-53
+    await self.__protocol.write_register(13023, 50)
     # bA124 = 5 s, 14-53
     await self.__protocol.write_register(13024, 5)
     # Cb40 = 01, 14-58
@@ -28,7 +28,7 @@ class SJP1Fu():
     await self.__protocol.write_register(15102, 11)
     # Hb103 = 4, 14-64
     await self.__protocol.write_register(15103, 4)
-    # bA124 = 22.5A Motorschutz ???
+    # bC110 = 22.5A Motorschutz ???
 
   async def set_frequency(self, frequency: int) -> None:
     # Page 532 / 14-41
@@ -167,6 +167,7 @@ SJP1FU_REGISTERS = {
     'conf': {
       'min': 0,
       'max': 23,
+      'unit': '',
       'scale': 1,
     },
   },
index b042fe96227ec17cd27cf24183e13e79b1ddf7cf..388a7c2e2fab5b5d27e20fa598416b641a26aa3b 100644 (file)
@@ -32,6 +32,7 @@ async def process_configuration(conf, queues):
                     for pin_name in pin_names:
                         pins[pin_name] = pin
                         pin.on('change', callback_factory(pin_name))
+    pins['T1-1'].value = True
     fu = None
     if 'modbus' in conf:
         modbus_conf = conf['modbus']
index a118dca8657725484ebb75400ab7a344391cab4d..f2a3632692c01bb09fd63e466e0f78954f80cd61 100644 (file)
@@ -24,7 +24,8 @@ async def process_command(command, pins, fu, queue):
                              'settable': pin.settable, 'value': pin.value,
                              'changed': False})
     elif command['command'] == 'setparameters':
-        await fu.set_parameters()
+        pass
+        #await fu.set_parameters()
     elif command['command'] == 'setfrequency':
         await fu.set_frequency(command['value'])
     elif command['command'] == 'getfrequency':
@@ -50,7 +51,7 @@ async def event_handler(websocket, path, pins, fu, queue):
         event = await queue.get()
         message = json.dumps(event)
         await websocket.send(message)
-        if event['event'] == 'pinstate' and event['changed']:
+        if event['event'] == 'pinstate':
             okay = ( pins['Zentralschmierung'].value and
                      pins['Ölpumpe'].value and
                      pins['Schwungrad'].value and
@@ -61,36 +62,36 @@ async def event_handler(websocket, path, pins, fu, queue):
                 active = await fu.inverter_active
                 if active:
                     await fu.stop_inverter()
-            if event['value']:
+            if event['changed'] and event['value']:
                 if event['pin'] == 'Notaus':
                     await fu.stop_inverter()
                     pins['Zentralschmierung'].value = False
                     pins['Ölpumpe'].value = False
                 elif event['pin'] == 'Stop':
                     await fu.stop_inverter()
-                    pins['Zentralschmierung'].value = False
-                    pins['Ölpumpe'].value = False
                 elif event['pin'] == 'Schmierung':
                     pins['Zentralschmierung'].value = True
                     pins['Ölpumpe'].value = True
                 elif event['pin'] == 'Vorlauf':
-                    if not pins['Dauerlauf'].value:
-                        await fu.set_parameters()
-                        await fu.set_frequency(5)
-                        await fu.start_inverter()
-                        await asyncio.sleep(1)
-                        await fu.stop_inverter()
-                    else:
-                        await fu.set_parameters()
-                        await fu.set_frequency(20)
-                        await fu.start_inverter()
+                    if pins['Öllampe'].value:
+                        if pins['Tippen'].value:
+                            #await fu.set_parameters()
+                            await fu.set_frequency(25)
+                            await fu.start_inverter()
+                            await asyncio.sleep(1)
+                            await fu.stop_inverter()
+                        else:
+                            #await fu.set_parameters()
+                            await fu.set_frequency(50)
+                            await fu.start_inverter()
                 elif event['pin'] == 'Rücklauf':
-                    if not pins['Dauerlauf'].value:
-                        await fu.set_parameters()
-                        await fu.set_frequency(-5)
-                        await fu.start_inverter()
-                        await asyncio.sleep(1)
-                        await fu.stop_inverter()
+                    if pins['Öllampe'].value:
+                        if pins['Tippen'].value:
+                            #await fu.set_parameters()
+                            await fu.set_frequency(-25)
+                            await fu.start_inverter()
+                            await asyncio.sleep(1)
+                            await fu.stop_inverter()
         queue.task_done()
 
 
index 1b8e1cf655f2e48176721abbd14fcc74253b4fff..9b4b5bb1cd07211965d386824fa2fc7a178c1c4c 100644 (file)
@@ -36,7 +36,7 @@
             ws.addEventListener('open', function (event) {
                 ws.send(JSON.stringify({command: 'getpin', pin: 'Notaus'}))
                 ws.send(JSON.stringify({command: 'getpin', pin: 'Stop'}))
-                ws.send(JSON.stringify({command: 'getpin', pin: 'Dauerlauf'}))
+                ws.send(JSON.stringify({command: 'getpin', pin: 'Tippen'}))
                 ws.send(JSON.stringify({command: 'getpin', pin: 'Schmierung'}))
                 ws.send(JSON.stringify({command: 'getpin', pin: 'Vorlauf'}))
                 ws.send(JSON.stringify({command: 'getpin', pin: 'Rücklauf'}))
                 ws.send(JSON.stringify({command: 'getpin', pin: 'Bruchplatte'}))
                 ws.send(JSON.stringify({command: 'getpin', pin: 'Bruchplatte Einzug'}))
             })
-            var parameter_button = document.getElementById('setparameters')
-            parameter_button.addEventListener('click', function (event) {
-                ws.send(JSON.stringify({command: 'setparameters'}))
-            })
         </script>
         <h1>ControlPi</h1>
         <section>
             <h2>Kontrollfeld</h2>
             <div id="Notaus">Notaus</div>
             <div id="Stop">Stop</div>
-            <div id="Dauerlauf">Dauerlauf</div>
+            <div id="Tippen">Tippen</div>
             <div id="Schmierung">Schmierung</div>
             <div id="Vorlauf">Vorlauf</div>
             <div id="Rücklauf">Rücklauf</div>
@@ -78,9 +74,5 @@
             <div id="Bruchplatte">Bruchplatte</div>
             <div id="Bruchplatte Einzug">Bruchplatte Einzug</div>
         </section>
-        <section>
-            <h2>FU</h2>
-            <button id="setparameters">Set Parameters</button>
-        </section>
     </body>
 </html>