Browse Source

Fix readerstation bug (state was not reset, so after order new wp's would no longer be scanned => blocked)

anfeny 8 months ago
parent
commit
64214c4ffc
2 changed files with 50 additions and 50 deletions
  1. 1 1
      simulator/devs_models/reader_station.py
  2. 49 49
      simulator/flowchart.md

+ 1 - 1
simulator/devs_models/reader_station.py

@@ -116,7 +116,7 @@ class ReaderStation(AtomicDEVS):
                 self.change_phase(OutputRoutine.NFC_WRITING)
                 self.state.color_read = wp.color
                 wp.state = "PROCESSED" # TODO: check if this logic is correct
-            if self.state.phase == InputRoutine.IDLE:
+            elif self.state.phase in [InputRoutine.IDLE, OutputRoutine.IDLE]:
                 self.change_phase(InputRoutine.NFC_READING) # new, read
             elif self.state.phase == InputRoutine.IDLE_WAIT_2:
                 self.change_phase(InputRoutine.NFC_WRITING) # seen, write nfc

+ 49 - 49
simulator/flowchart.md

@@ -10,22 +10,22 @@ flowchart LR
 	end
 	Generator_out --> DSI_inp
 	subgraph DSI
-		DSI_inp("inp")
+		DSI_mqtt_in("mqtt_in")
+		DSI_vgr_in("vgr_in")
 		DSI_out("out")
+		DSI_inp("inp")
 		DSI_mqtt_out("mqtt_out")
-		DSI_vgr_in("vgr_in")
-		DSI_mqtt_in("mqtt_in")
 		DSI_inp ~~~ DSI_out
 		DSI_mqtt_in ~~~ DSI_mqtt_out
 	end
 	DSI_out --> VacuumGripper_dsi_in
 	DSI_mqtt_out --> MQTTControlUnit_mqtt_in
 	subgraph ReaderStation
+		ReaderStation_color_out("color_out")
+		ReaderStation_color_in("color_in")
 		ReaderStation_nfc_out("nfc_out")
 		ReaderStation_nfc_in("nfc_in")
-		ReaderStation_color_out("color_out")
 		ReaderStation_mqtt_out("mqtt_out")
-		ReaderStation_color_in("color_in")
 		ReaderStation_mqtt_in("mqtt_in")
 		ReaderStation_nfc_in ~~~ ReaderStation_nfc_out
 		ReaderStation_color_in ~~~ ReaderStation_color_out
@@ -35,24 +35,24 @@ flowchart LR
 	ReaderStation_color_out --> VacuumGripper_color_sensor_in
 	ReaderStation_mqtt_out --> MQTTControlUnit_mqtt_in
 	subgraph VacuumGripper
-		VacuumGripper_sld_red_out("sld_red_out")
 		VacuumGripper_nfc_in("nfc_in")
-		VacuumGripper_sld_blue_out("sld_blue_out")
-		VacuumGripper_mpo_out("mpo_out")
+		VacuumGripper_mqtt_out("mqtt_out")
+		VacuumGripper_ct_out("ct_out")
 		VacuumGripper_ct_in("ct_in")
-		VacuumGripper_color_sensor_out("color_sensor_out")
-		VacuumGripper_dsi_in("dsi_in")
+		VacuumGripper_dso_out("dso_out")
 		VacuumGripper_nfc_out("nfc_out")
-		VacuumGripper_ct_out("ct_out")
-		VacuumGripper_dsi_out("dsi_out")
-		VacuumGripper_mqtt_in("mqtt_in")
+		VacuumGripper_dsi_in("dsi_in")
 		VacuumGripper_sld_white_in("sld_white_in")
 		VacuumGripper_sld_blue_in("sld_blue_in")
-		VacuumGripper_dso_out("dso_out")
-		VacuumGripper_sld_red_in("sld_red_in")
 		VacuumGripper_sld_white_out("sld_white_out")
-		VacuumGripper_mqtt_out("mqtt_out")
+		VacuumGripper_color_sensor_out("color_sensor_out")
 		VacuumGripper_color_sensor_in("color_sensor_in")
+		VacuumGripper_sld_blue_out("sld_blue_out")
+		VacuumGripper_mqtt_in("mqtt_in")
+		VacuumGripper_sld_red_in("sld_red_in")
+		VacuumGripper_dsi_out("dsi_out")
+		VacuumGripper_sld_red_out("sld_red_out")
+		VacuumGripper_mpo_out("mpo_out")
 		VacuumGripper_dsi_in ~~~ VacuumGripper_dsi_out
 		VacuumGripper_ct_in ~~~ VacuumGripper_ct_out
 		VacuumGripper_nfc_in ~~~ VacuumGripper_nfc_out
@@ -73,12 +73,12 @@ flowchart LR
 	VacuumGripper_dso_out --> DSO_inp
 	VacuumGripper_mqtt_out --> MQTTControlUnit_mqtt_in
 	subgraph Transporter
-		Transporter_left_in("left_in")
 		Transporter_left_out("left_out")
-		Transporter_right_out("right_out")
-		Transporter_mqtt_in("mqtt_in")
-		Transporter_right_in("right_in")
+		Transporter_left_in("left_in")
 		Transporter_mqtt_out("mqtt_out")
+		Transporter_right_in("right_in")
+		Transporter_mqtt_in("mqtt_in")
+		Transporter_right_out("right_out")
 		Transporter_left_in ~~~ Transporter_right_out
 		Transporter_right_in ~~~ Transporter_left_out
 		Transporter_mqtt_in ~~~ Transporter_mqtt_out
@@ -87,10 +87,10 @@ flowchart LR
 	Transporter_left_out --> HighBayWarehouse_inp
 	Transporter_mqtt_out --> MQTTControlUnit_mqtt_in
 	subgraph HighBayWarehouse
-		HighBayWarehouse_inventory_out("inventory_out")
-		HighBayWarehouse_mqtt_out("mqtt_out")
-		HighBayWarehouse_mqtt_in("mqtt_in")
 		HighBayWarehouse_out("out")
+		HighBayWarehouse_mqtt_in("mqtt_in")
+		HighBayWarehouse_mqtt_out("mqtt_out")
+		HighBayWarehouse_inventory_out("inventory_out")
 		HighBayWarehouse_inp("inp")
 		HighBayWarehouse_inp ~~~ HighBayWarehouse_out
 		HighBayWarehouse_mqtt_in ~~~ HighBayWarehouse_mqtt_out
@@ -99,23 +99,23 @@ flowchart LR
 	HighBayWarehouse_mqtt_out --> MQTTControlUnit_mqtt_in
 	HighBayWarehouse_inventory_out --> InventoryPublisher_inp
 	subgraph InventoryPublisher
-		InventoryPublisher_mqtt_out("mqtt_out")
 		InventoryPublisher_inp("inp")
+		InventoryPublisher_mqtt_out("mqtt_out")
 		InventoryPublisher_inp ~~~ InventoryPublisher_mqtt_out
 	end
 	InventoryPublisher_mqtt_out --> MQTTControlUnit_mqtt_in
 	subgraph MPO
-		MPO_mqtt_in("mqtt_in")
+		MPO_mqtt_out("mqtt_out")
 		MPO_conveyor_out("conveyor_out")
+		MPO_mqtt_in("mqtt_in")
 		MPO_vgr_in("vgr_in")
-		MPO_mqtt_out("mqtt_out")
 		MPO_vgr_in ~~~ MPO_mqtt_out
 		MPO_mqtt_in ~~~ MPO_conveyor_out
 		subgraph MPO_oven
 			MPO_oven_mqtt_out("mqtt_out")
-			MPO_oven_gripper_in("gripper_in")
-			MPO_oven_gripper_out("gripper_out")
 			MPO_oven_mqtt_in("mqtt_in")
+			MPO_oven_gripper_out("gripper_out")
+			MPO_oven_gripper_in("gripper_in")
 			MPO_oven_vgr_in("vgr_in")
 			MPO_oven_vgr_in ~~~ MPO_oven_gripper_out
 			MPO_oven_gripper_in ~~~ MPO_oven_mqtt_out
@@ -137,10 +137,10 @@ flowchart LR
 		MPO_gripper_table_out --> MPO_saw_gripper_in
 		MPO_gripper_mqtt_out --> MPO_mqtt_out
 		subgraph MPO_saw
-			MPO_saw_mqtt_in("mqtt_in")
-			MPO_saw_conveyor_out("conveyor_out")
-			MPO_saw_gripper_out("gripper_out")
 			MPO_saw_gripper_in("gripper_in")
+			MPO_saw_gripper_out("gripper_out")
+			MPO_saw_conveyor_out("conveyor_out")
+			MPO_saw_mqtt_in("mqtt_in")
 			MPO_saw_mqtt_out("mqtt_out")
 			MPO_saw_gripper_in ~~~ MPO_saw_gripper_out
 			MPO_saw_mqtt_in ~~~ MPO_saw_conveyor_out
@@ -156,36 +156,36 @@ flowchart LR
 	MPO_mqtt_in --> MPO_gripper_mqtt_in
 	MPO_mqtt_in --> MPO_saw_mqtt_in
 	subgraph Conveyor
+		Conveyor_inp("inp")
 		Conveyor_mqtt_in("mqtt_in")
-		Conveyor_mqtt_out("mqtt_out")
 		Conveyor_out("out")
-		Conveyor_inp("inp")
+		Conveyor_mqtt_out("mqtt_out")
 		Conveyor_inp ~~~ Conveyor_out
 		Conveyor_mqtt_in ~~~ Conveyor_mqtt_out
 	end
 	Conveyor_out --> SLD_inp
 	Conveyor_mqtt_out --> MQTTControlUnit_mqtt_in
 	subgraph SLD
-		SLD_mqtt_out("mqtt_out")
-		SLD_inp("inp")
-		SLD_mqtt_in("mqtt_in")
 		SLD_white_in("white_in")
 		SLD_red_in("red_in")
 		SLD_blue_in("blue_in")
 		SLD_white_out("white_out")
 		SLD_red_out("red_out")
 		SLD_blue_out("blue_out")
+		SLD_mqtt_out("mqtt_out")
+		SLD_inp("inp")
+		SLD_mqtt_in("mqtt_in")
 		SLD_inp ~~~ SLD_white_out
 		SLD_mqtt_in ~~~ SLD_red_out
 		SLD_white_in ~~~ SLD_blue_out
 		SLD_red_in ~~~ SLD_mqtt_out
 		subgraph SLD_conveyor
+			SLD_conveyor_mqtt_in("mqtt_in")
 			SLD_conveyor_inp("inp")
-			SLD_conveyor_mqtt_out("mqtt_out")
 			SLD_conveyor_out_blue("out_blue")
-			SLD_conveyor_mqtt_in("mqtt_in")
-			SLD_conveyor_out_white("out_white")
 			SLD_conveyor_out_red("out_red")
+			SLD_conveyor_mqtt_out("mqtt_out")
+			SLD_conveyor_out_white("out_white")
 			SLD_conveyor_inp ~~~ SLD_conveyor_out_white
 			SLD_conveyor_mqtt_in ~~~ SLD_conveyor_out_red
 		end
@@ -194,33 +194,33 @@ flowchart LR
 		SLD_conveyor_out_blue --> SLD_blue_bay_sld_in
 		SLD_conveyor_mqtt_out --> SLD_mqtt_out
 		subgraph SLD_white_bay
-			SLD_white_bay_mqtt_in("mqtt_in")
-			SLD_white_bay_vgr_out("vgr_out")
 			SLD_white_bay_mqtt_out("mqtt_out")
 			SLD_white_bay_sld_in("sld_in")
 			SLD_white_bay_vgr_in("vgr_in")
+			SLD_white_bay_mqtt_in("mqtt_in")
+			SLD_white_bay_vgr_out("vgr_out")
 			SLD_white_bay_sld_in ~~~ SLD_white_bay_vgr_out
 			SLD_white_bay_vgr_in ~~~ SLD_white_bay_mqtt_out
 		end
 		SLD_white_bay_vgr_out --> SLD_white_out
 		SLD_white_bay_mqtt_out --> SLD_mqtt_out
 		subgraph SLD_red_bay
-			SLD_red_bay_vgr_out("vgr_out")
-			SLD_red_bay_sld_in("sld_in")
-			SLD_red_bay_mqtt_out("mqtt_out")
 			SLD_red_bay_mqtt_in("mqtt_in")
 			SLD_red_bay_vgr_in("vgr_in")
+			SLD_red_bay_sld_in("sld_in")
+			SLD_red_bay_vgr_out("vgr_out")
+			SLD_red_bay_mqtt_out("mqtt_out")
 			SLD_red_bay_sld_in ~~~ SLD_red_bay_vgr_out
 			SLD_red_bay_vgr_in ~~~ SLD_red_bay_mqtt_out
 		end
 		SLD_red_bay_vgr_out --> SLD_red_out
 		SLD_red_bay_mqtt_out --> SLD_mqtt_out
 		subgraph SLD_blue_bay
-			SLD_blue_bay_vgr_out("vgr_out")
-			SLD_blue_bay_mqtt_out("mqtt_out")
-			SLD_blue_bay_mqtt_in("mqtt_in")
 			SLD_blue_bay_vgr_in("vgr_in")
 			SLD_blue_bay_sld_in("sld_in")
+			SLD_blue_bay_mqtt_in("mqtt_in")
+			SLD_blue_bay_mqtt_out("mqtt_out")
+			SLD_blue_bay_vgr_out("vgr_out")
 			SLD_blue_bay_sld_in ~~~ SLD_blue_bay_vgr_out
 			SLD_blue_bay_vgr_in ~~~ SLD_blue_bay_mqtt_out
 		end
@@ -240,19 +240,19 @@ flowchart LR
 	SLD_red_in --> SLD_red_bay_vgr_in
 	SLD_blue_in --> SLD_blue_bay_vgr_in
 	subgraph DSO
+		DSO_inp("inp")
 		DSO_mqtt_out("mqtt_out")
 		DSO_out("out")
 		DSO_mqtt_in("mqtt_in")
-		DSO_inp("inp")
 		DSO_inp ~~~ DSO_out
 		DSO_mqtt_in ~~~ DSO_mqtt_out
 	end
 	DSO_mqtt_out --> MQTTControlUnit_mqtt_in
 	subgraph MQTTControlUnit
+		MQTTControlUnit_mqtt_out("mqtt_out")
 		MQTTControlUnit_REALTIME_INTERRUPT("REALTIME_INTERRUPT")
 		MQTTControlUnit_mqtt_in("mqtt_in")
 		MQTTControlUnit_REALTIME_OBSERVED("REALTIME_OBSERVED")
-		MQTTControlUnit_mqtt_out("mqtt_out")
 		MQTTControlUnit_mqtt_in ~~~ MQTTControlUnit_mqtt_out
 		MQTTControlUnit_REALTIME_INTERRUPT ~~~ MQTTControlUnit_REALTIME_OBSERVED
 	end