Bladeren bron

add benton tags

Johannes Müller 2 jaren geleden
bovenliggende
commit
11e153c8f0

+ 4 - 1
.gitignore

@@ -23,4 +23,7 @@ __pycache__/
 /box-pc/python*/*
 !/box-pc/python*/get-pip.py
 !/box-pc/python*/python*._pth
-!/box-pc/python*/sitecustomize.py
+!/box-pc/python*/sitecustomize.py
+
+/hengli/
+/benton/

BIN
AI-energy-meter-Project.backup/2022-04-19.022954.262/2022-04-19.022954.262.zip


+ 69 - 13
box-pc/application/inputs/allen_bradley_connect.py

@@ -3,6 +3,7 @@ from threading import Thread
 import time
 from datetime import datetime
 
+from structures.plant import *
 from inputs.common import Input
 
 localtz = datetime.now().astimezone().tzinfo
@@ -13,19 +14,74 @@ class AllenBradleyCPU(Input):
     super().__init__(self.read_handler)
     self.comm = PLC()
     self.comm.IPAddress = host
-    self.tag = "STL"
-    self.port = 0
-    self.E_offset = 12 + self.port * 48
-    self.E_connected_offset = self.E_offset + 32
-    self.E_error_offset = self.E_offset + 33
-
-    self.A_offset = 6 + self.port * 32
-
     self.interval = 0.02
-
+    self.tags = [
+      "B14[31]", # ejector_move_down
+      "B14[32]", # ejector_move_up
+      "B14[34]", # carriage_move_out
+      "B14[35]", # carriage_move_in
+      "B14[37]", # side_clamps_open
+      "B14[38]", # side_clamps_close
+      "B14[42]", # table_move_down
+      "B14[43]", # table_move_up
+      "B14[45]", # gassing_platemove_out
+      "B14[46]", # gassing_plate_move_in
+      "B14[48]", # cope_eject_plate_move_out
+      "B14[49]", # cope_eject_plate_move_in
+      "B14[51]", # top_part_move_up
+      "B14[52]", # top_part_move_down
+      "B14[54]", # front_door_open
+      "B14[55]", # front_door_close
+      "B14[57]", # pneumatic_loose_part_1_move_out
+      "B14[58]", # pneumatic_loose_part_1_move_in
+      "B14[60]", # hydraulic_loose_part_2_move_out
+      "B14[61]", # hydraulic_loose_part_2_move_in
+      "B14[63]", # hydraulic_loose_part_3_move_out
+      "B14[64]", # hydraulic_loose_part_3_move_in
+      "B14[69]", # clamping_device_side_clamp_left_clamp
+      "B14[70]", # clamping_device_side_clamp_left_loose
+      "B14[72]", # clamping_device_side_clamp_right_clamp
+      "B14[73]", # clamping_device_side_clamp_right_loose
+      "B14[81]", # clamping_device_shoot_plate_clamp
+      "B14[82]", # clamping_device_shoot_plate_loose
+      "B14[83]", # sand_refill
+      "B14[84]", # sand_gate_close
+      "B14[85]", # sand_gate_open
+      "B14[93]", # shoot
+      "B14[103]", # clamping_device_gassing_plate_clamp
+      "B16[12]", # central_amine_supply_refill
+      "B16[13]", # gassing
+      "B16[15]", # gas_generator_process_coldbox_betaset
+      "B18[31]", # mixer_lid_move_up
+      "B18[32]", # mixer_lid_move_down
+      "B18[35]", # mixer_wing_motor_on
+      "B18[37]", # mixer_move_up
+      "B18[38]", # mixer_move_down
+      "B18[40]", # sand_dosing_unit_inlet
+      "B18[42]", # sand_dosing_unit_outlet
+      "B18[44]", # binder_1_sucking
+      "B18[45]", # binder_1_blowing
+      "B18[47]", # binder_2_suction
+      "B18[48]", # binder_2_blowing
+      "B18[50]", # binder_3_sucking
+      "B18[51]", # binder_3_blowing
+      "B18[53]", # binder_4_sucking
+      "B18[54]", # binder_4_blowing
+      "B18[59]", # additive_1_dosing
+      "B18[60]", # additive_2_dosing
+      "B18[62]", # mixer_bowl_direction_eject_1_machine
+      "B18[63]", # mixer_bowl_direction_eject_2_scrap
+      "B18[65]", # cleaning_cylinder_move_up
+      "B18[66]", # cleaning_cylinder_move_down
+      "B18[68]", # mixer_sand_slide_move_to_machine
+      "B18[69]", # mixer_sand_slide_move_to_scrap
+      "B18[71]", # vertical_mixersand_slide_gateclose
+      "B18[72]", # vertical_mixer_sand_slide_gate_open
+      "B18[73]", # sand_sender
+    ]
   def read_handler(self):
     timestamp = datetime.now(localtz)
-    ret = self.comm.Read(F"{self.tag}:I")
-    if ret.Status == "Success":
-      raw = ret.Value
-      self.queue_ifm_from_bytes("AB", timestamp, raw[self.E_offset:self.E_offset+30])
+    ret = self.comm.Read(self.tags)
+    if ret[0].Status == "Success":
+      values = [r.Value for r in ret]
+      self._q.put(PlantState(timestamp, "AB", *values))

+ 2 - 2
box-pc/application/main.py

@@ -11,10 +11,10 @@ logging.basicConfig(level=logging.WARNING)
 logging.info("starting")
 
 sources = [
-  SiemensCPU("192.168.0.10"),
+  #SiemensCPU("192.168.0.10"),
   SiemensServer(),
   #Balluff(),
-  #AllenBradleyCPU("192.168.10.5"),
+  AllenBradleyCPU("192.168.1.15"),
 ]
 
 sinks = [

+ 62 - 43
box-pc/application/structures/plant.py

@@ -6,49 +6,68 @@ class PlantState:
   timestamp: datetime
   source: str
 
-  cpu_running: bool
-  
-  unterteil_faehrt_aus: bool
-  unterteil_faehrt_ein: bool
-  auswerfer_1_heben: bool
-  auswerfer_1_senken: bool
-  auswerfer_2_heben: bool
-  auswerfer_2_senken: bool
-  abdruecker_seitenteil_links_einfahren: bool
-  abdruecker_seitenteil_links_ausfahren: bool
+  ejector_move_down: int
+  ejector_move_up: int
+  carriage_move_out: int
+  carriage_move_in: int
+  side_clamps_open: int
+  side_clamps_close: int
+  table_move_down: int
+  table_move_up: int
+  gassing_platemove_out: int
+  gassing_plate_move_in: int
+  cope_eject_plate_move_out: int
+  cope_eject_plate_move_in: int
+  top_part_move_up: int
+  top_part_move_down: int
+  front_door_open: int
+  front_door_close: int
+  pneumatic_loose_part_1_move_out: int
+  pneumatic_loose_part_1_move_in: int
+  hydraulic_loose_part_2_move_out: int
+  hydraulic_loose_part_2_move_in: int
+  hydraulic_loose_part_3_move_out: int
+  hydraulic_loose_part_3_move_in: int
+  clamping_device_side_clamp_left_clamp: int
+  clamping_device_side_clamp_left_loose: int
+  clamping_device_side_clamp_right_clamp: int
+  clamping_device_side_clamp_right_loose: int
+  clamping_device_shoot_plate_clamp: int
+  clamping_device_shoot_plate_loose: int
+  sand_refill: int
+  sand_gate_close: int
+  sand_gate_open: int
+  shoot: int
+  clamping_device_gassing_plate_clamp: int
+  central_amine_supply_refill: int
+  gassing: int
+  gas_generator_process_coldbox_betaset: int
+  mixer_lid_move_up: int
+  mixer_lid_move_down: int
+  mixer_wing_motor_on: int
+  mixer_move_up: int
+  mixer_move_down: int
+  sand_dosing_unit_inlet: int
+  sand_dosing_unit_outlet: int
+  binder_1_sucking: int
+  binder_1_blowing: int
+  binder_2_suction: int
+  binder_2_blowing: int
+  binder_3_sucking: int
+  binder_3_blowing: int
+  binder_4_sucking: int
+  binder_4_blowing: int
+  additive_1_dosing: int
+  additive_2_dosing: int
+  mixer_bowl_direction_eject_1_machine: int
+  mixer_bowl_direction_eject_2_scrap: int
+  cleaning_cylinder_move_up: int
+  cleaning_cylinder_move_down: int
+  mixer_sand_slide_move_to_machine: int
+  mixer_sand_slide_move_to_scrap: int
+  vertical_mixersand_slide_gateclose: int
+  vertical_mixer_sand_slide_gate_open: int
+  sand_sender: int
 
-  abdruecker_seitenteil_rechts_einfahren: bool
-  abdruecker_seitenteil_rechts_ausfahren: bool
-  rolltor_schliessen: bool
-  rolltor_oeffnen: bool
-  gaswagen_ausfahren: bool
-  gaswagen_einfahren: bool
-  schwenkplatte_abklappen: bool
-  schwenkplatte_einklappen: bool
-
-  losteil_1_unterteil_einfahren: bool
-  losteil_1_unterteil_ausfahren: bool
-  losteil_2_einfahren: bool
-  losteil_2_ausfahren: bool
-  losteil_3_einfahren: bool
-  losteil_3_ausfahren: bool
-  losteil_4_einfahren: bool
-  losteil_4_ausfahren: bool
-
-  losteil_5_einfahren: bool
-  losteil_5_ausfahren: bool
-  seitenteil_links_schliessen: bool
-  seitenteil_rechts_schliessen: bool
-  seitenteil_links_und_rechts_oeffnen: bool
-  sandschleuse_schliessen: bool
-  sandschleuse_oeffnen: bool
-  sandmessung_3_wege_ventil_schliessen: bool
-  
-  sandmessung_3_wege_ventil_oeffnen: bool
-  schuss: bool
-  hubtisch_senken: bool
-  hubtisch_heben: bool
-  oberteil_heben: bool
-  oberteil_senken: bool
 
   series = "plant"