Explorar o código

20221019, dispatch test

huli %!s(int64=2) %!d(string=hai) anos
pai
achega
859602af5b

+ 11 - 13
message.proto

@@ -10,7 +10,8 @@ message measure_info {
   float height=6;
   float wheelbase=7;
   float front_theta=8;
-  int32 border_stuta=9;
+  int32 border_statu=9;
+  int32 ground_status=10;                   //0  ok 1,nothing 2,noise  3,border
 }
 
 /*分配的车位信息*/
@@ -75,6 +76,7 @@ message pick_table{
   measure_info actually_measure_info=8; //存车时的实际测量信息(轴距)
 
   int32 export_id=9;            //分配出口
+  bool  is_leaved=10;         //是否离开
 
 
 }
@@ -88,18 +90,16 @@ message pick_table{
 /*
 单片机节点状态
  */
-message out_mcpu_statu{
-  int32 door_statu=1;     // 0开,1关,2,正在开关中
-  bool outside_safety=2; //0空闲,1有障碍
+message out_mcpu_statu{     //数值+1后
+  int32 door_statu=1;       //外门状态       0无效, 1无效, 2开到位, 3 关到位, 4开关中, 5 故障
+  int32 outside_safety=2;    //是否有车      0无效, 1无车, 2有车
 }
 
-message in_mcpu_statu{
-  int32 door_statu=1;     // 0开,1关,2,正在开关中
-  int32 back_io=2;
-  int32 is_occupy=3;
-  int32 height1_io=4;
-  int32 height2_io=5;
-  int32 height3_io=6;
+message in_mcpu_statu{      //数值+1后
+  int32 door_statu=1;       //外门状态       0无效, 1无效, 2开到位, 3 关到位, 4开关中, 5 故障
+  int32 back_io=2;          //后超界
+  int32 is_occupy=3;        //是否有车      0无效, 1无车, 2有车
+  int32 heighth=4;          //车高状态      0无效, 1无效, 2小车, 3中车, 4大车, 5故障, 6故障
 }
 /*
 测量节点状态
@@ -126,5 +126,3 @@ message dispatch_node_statu{
 
 }
 
-
-

+ 17 - 16
plc调度节点/dispatch/dispatch_manager.cpp

@@ -129,13 +129,13 @@ Error_manager Dispatch_manager::execute_rabbitmq_message_new(Rabbitmq_message* p
 	{
 		m_count_flag = true;
 		m_count_command_signal_msg = *p_msg;
-		std::cout << " huli test :::: " << " m_count_command_signal_msg = " << m_count_command_signal_msg.m_message_buf << std::endl;
+//		std::cout << " huli test :::: " << " m_count_command_signal_msg = " << m_count_command_signal_msg.m_message_buf << std::endl;
 	}
 	else if ( p_msg->m_routing_key.find("post_command") != p_msg->m_routing_key.npos )
 	{
 		m_post_flag = true;
 		m_post_command_msg = *p_msg;
-		std::cout << " huli test :::: " << " m_post_command_msg = " << m_post_command_msg.m_message_buf << std::endl;
+//		std::cout << " huli test :::: " << " m_post_command_msg = " << m_post_command_msg.m_message_buf << std::endl;
 	}
 	else if ( p_msg->m_routing_key == "measure_1_statu_port" ||
 			  p_msg->m_routing_key == "measure_3_statu_port" ||
@@ -170,7 +170,7 @@ Error_manager Dispatch_manager::execute_rabbitmq_message_new(Rabbitmq_message* p
 
 //		if ( p_msg->m_routing_key == "in_mcpu_1_statu_port" )
 //		{
-//		    std::cout << " huli test :::: " << " bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbffffffffffffffffff = " << p_msg->m_message_buf  << std::endl;
+//		    std::cout << " huli test :::: " << " bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbffffffffffffffffff in_mcpu_1_statu_port= " << p_msg->m_message_buf  << std::endl;
 //		}
 
 		m_in_mcpu_statu_msg_1 = *p_msg;
@@ -187,7 +187,7 @@ Error_manager Dispatch_manager::execute_rabbitmq_message_new(Rabbitmq_message* p
 
 //		if ( p_msg->m_routing_key == "in_mcpu_2_statu_port" )
 //		{
-//		    std::cout << " huli test :::: " << " bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbffffffffffffffffff = " << p_msg->m_message_buf  << std::endl;
+//		    std::cout << " huli test :::: " << " bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbffffffffffffffffff in_mcpu_2_statu_port= " << p_msg->m_message_buf  << std::endl;
 //		}
 
 		m_in_mcpu_statu_msg_2 = *p_msg;
@@ -200,10 +200,10 @@ Error_manager Dispatch_manager::execute_rabbitmq_message_new(Rabbitmq_message* p
 			  p_msg->m_routing_key == "out_mcpu_3_statu_port" ||
 			  p_msg->m_routing_key == "out_mcpu_5_statu_port" )
 	{
-		if ( p_msg->m_routing_key == "out_mcpu_1_statu_port" )
-		{
-			std::cout << " huli test :::: " << " vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv out_mcpu_1_statu_port= " << p_msg->m_message_buf << std::endl;
-		}
+//		if ( p_msg->m_routing_key == "out_mcpu_1_statu_port" )
+//		{
+//			std::cout << " huli test :::: " << " vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv out_mcpu_1_statu_port= " << p_msg->m_message_buf << std::endl;
+//		}
 //		std::cout << " huli test :::: " << " vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv = " << p_msg->m_message_buf << std::endl;
 
 		m_out_mcpu_statu_msg_1 = *p_msg;
@@ -216,10 +216,10 @@ Error_manager Dispatch_manager::execute_rabbitmq_message_new(Rabbitmq_message* p
 			  p_msg->m_routing_key == "out_mcpu_4_statu_port" ||
 			  p_msg->m_routing_key == "out_mcpu_6_statu_port" )
 	{
-		if ( p_msg->m_routing_key == "out_mcpu_2_statu_port" )
-		{
-			std::cout << " huli test :::: " << " bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb out_mcpu_2_statu_port= " << p_msg->m_message_buf << std::endl;
-		}
+//		if ( p_msg->m_routing_key == "out_mcpu_2_statu_port" )
+//		{
+//			std::cout << " huli test :::: " << " bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb out_mcpu_2_statu_port= " << p_msg->m_message_buf << std::endl;
+//		}
 //		std::cout << " huli test :::: " << " bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb = " << p_msg->m_message_buf << std::endl;
 		m_out_mcpu_statu_msg_2 = *p_msg;
 		if(google::protobuf::TextFormat::ParseFromString(m_out_mcpu_statu_msg_2.m_message_buf, &m_out_mcpu_statu_2))
@@ -592,14 +592,15 @@ Error_manager Dispatch_manager::encapsulate_send_dispatch_manager_status_new()
 		t_dispatch_node_statu_msg.set_statu(eIdle);
 //		t_dispatch_node_statu_msg.set_statu(eBusy);
 	}
-	else if ( m_dispatch_manager_status >= E_DISPATCH_MANAGER_COUNT_NEW &&
-	m_dispatch_manager_status >= E_DISPATCH_MANAGER_COMPLETED_NEW)
+	else if ( m_dispatch_manager_status == E_DISPATCH_MANAGER_UNKNOW ||
+	m_dispatch_manager_status == E_DISPATCH_MANAGER_DISCONNECT ||
+	m_dispatch_manager_status == E_DISPATCH_MANAGER_FAULT	)
 	{
-		t_dispatch_node_statu_msg.set_statu(eBusy);
+		t_dispatch_node_statu_msg.set_statu(eFault);
 	}
 	else
 	{
-		t_dispatch_node_statu_msg.set_statu(eFault);
+		t_dispatch_node_statu_msg.set_statu(eBusy);
 	}
 
 	t_dispatch_node_statu_msg.set_idle_stop_floor(m_device_floor);

+ 4 - 1
plc调度节点/dispatch/dispatch_singlechip.cpp

@@ -104,9 +104,10 @@ Dispatch_singlechip::Dispatch_singlechip_status Dispatch_singlechip::get_dispatc
 //判断出口是否空闲
 bool Dispatch_singlechip::is_outlet_ready()
 {
+	//   outside_safety 0无效, 1无车, 2有车
 	if ( m_dispatch_singlechip_status == DISPATCH_SINGLECHIP_READY &&
 //		 m_singlechip_data_msg.insideexistenceflag() == 0)
-m_out_mcpu_statu.outside_safety()-1 == 1)
+m_out_mcpu_statu.outside_safety() == 1)
 	{
 		return true;
 	}
@@ -151,6 +152,8 @@ void Dispatch_singlechip::execute_thread_fun()
 				if (p_request->m_request_communication_mode != 2)
 				{
 					p_response->m_response_heartbeat = 1+p_response->m_response_heartbeat;
+//					int heartbeat = p_response->m_response_heartbeat;
+//					std::cout << " huli test :::: " << " mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmp_response->m_response_heartbeat = " << heartbeat << std::endl;
 					p_response->m_response_communication_mode = p_request->m_request_communication_mode;
 					p_response->m_response_refresh_command = p_request->m_request_refresh_command;
 					p_response->m_response_data_validity = m_validity;

+ 2 - 2
plc调度节点/main.cpp

@@ -174,7 +174,7 @@ int main(int argc,char* argv[])
 
 
 
-	int t_dispatch_id = 0;
+	int t_dispatch_id = 2;
 //	std::cin >> t_dispatch_id ;
 	if ( argc == 2 )
 	{
@@ -196,7 +196,7 @@ int main(int argc,char* argv[])
 	System_executor::get_instance_references().system_executor_init(8);
 	std::cout << "++++++++++++++++System_executor = " << System_executor::get_instance_references().get_system_executor_status() << std::endl;
 
-	t_error = System_communication::get_instance_references().communication_init();
+	t_error = System_communication::get_instance_references().communication_init(t_dispatch_id);
 	std::cout << "++++++++++++++++++huli test System_communication:::: " << " t_error = " << t_error << std::endl;
 
 

+ 11 - 9
plc调度节点/message/message.pb.cc

@@ -431,7 +431,7 @@ void AddDescriptorsImpl() {
       "_measure_info\030\010 \001(\0132\r.measure_info\022\021\n\tex"
       "port_id\030\t \001(\005\022\021\n\tis_leaved\030\n \001(\010\"<\n\016out_"
       "mcpu_statu\022\022\n\ndoor_statu\030\001 \001(\005\022\026\n\016outsid"
-      "e_safety\030\002 \001(\010\"X\n\rin_mcpu_statu\022\022\n\ndoor_"
+      "e_safety\030\002 \001(\005\"X\n\rin_mcpu_statu\022\022\n\ndoor_"
       "statu\030\001 \001(\005\022\017\n\007back_io\030\002 \001(\005\022\021\n\tis_occup"
       "y\030\003 \001(\005\022\017\n\007heighth\030\004 \001(\005\",\n\rmeasure_stat"
       "u\022\033\n\004info\030\001 \001(\0132\r.measure_info\"\234\001\n\023dispa"
@@ -3115,13 +3115,13 @@ bool out_mcpu_statu::MergePartialFromCodedStream(
         break;
       }
 
-      // bool outside_safety = 2;
+      // int32 outside_safety = 2;
       case 2: {
         if (static_cast< ::google::protobuf::uint8>(tag) ==
             static_cast< ::google::protobuf::uint8>(16u /* 16 & 0xFF */)) {
 
           DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
-                   bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
                  input, &outside_safety_)));
         } else {
           goto handle_unusual;
@@ -3160,9 +3160,9 @@ void out_mcpu_statu::SerializeWithCachedSizes(
     ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->door_statu(), output);
   }
 
-  // bool outside_safety = 2;
+  // int32 outside_safety = 2;
   if (this->outside_safety() != 0) {
-    ::google::protobuf::internal::WireFormatLite::WriteBool(2, this->outside_safety(), output);
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->outside_safety(), output);
   }
 
   if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
@@ -3184,9 +3184,9 @@ void out_mcpu_statu::SerializeWithCachedSizes(
     target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->door_statu(), target);
   }
 
-  // bool outside_safety = 2;
+  // int32 outside_safety = 2;
   if (this->outside_safety() != 0) {
-    target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(2, this->outside_safety(), target);
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->outside_safety(), target);
   }
 
   if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
@@ -3213,9 +3213,11 @@ size_t out_mcpu_statu::ByteSizeLong() const {
         this->door_statu());
   }
 
-  // bool outside_safety = 2;
+  // int32 outside_safety = 2;
   if (this->outside_safety() != 0) {
-    total_size += 1 + 1;
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::Int32Size(
+        this->outside_safety());
   }
 
   int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);

+ 8 - 8
plc调度节点/message/message.pb.h

@@ -1010,18 +1010,18 @@ class out_mcpu_statu : public ::google::protobuf::Message /* @@protoc_insertion_
   ::google::protobuf::int32 door_statu() const;
   void set_door_statu(::google::protobuf::int32 value);
 
-  // bool outside_safety = 2;
+  // int32 outside_safety = 2;
   void clear_outside_safety();
   static const int kOutsideSafetyFieldNumber = 2;
-  bool outside_safety() const;
-  void set_outside_safety(bool value);
+  ::google::protobuf::int32 outside_safety() const;
+  void set_outside_safety(::google::protobuf::int32 value);
 
   // @@protoc_insertion_point(class_scope:out_mcpu_statu)
  private:
 
   ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
   ::google::protobuf::int32 door_statu_;
-  bool outside_safety_;
+  ::google::protobuf::int32 outside_safety_;
   mutable int _cached_size_;
   friend struct ::protobuf_message_2eproto::TableStruct;
   friend void ::protobuf_message_2eproto::InitDefaultsout_mcpu_statuImpl();
@@ -2406,15 +2406,15 @@ inline void out_mcpu_statu::set_door_statu(::google::protobuf::int32 value) {
   // @@protoc_insertion_point(field_set:out_mcpu_statu.door_statu)
 }
 
-// bool outside_safety = 2;
+// int32 outside_safety = 2;
 inline void out_mcpu_statu::clear_outside_safety() {
-  outside_safety_ = false;
+  outside_safety_ = 0;
 }
-inline bool out_mcpu_statu::outside_safety() const {
+inline ::google::protobuf::int32 out_mcpu_statu::outside_safety() const {
   // @@protoc_insertion_point(field_get:out_mcpu_statu.outside_safety)
   return outside_safety_;
 }
-inline void out_mcpu_statu::set_outside_safety(bool value) {
+inline void out_mcpu_statu::set_outside_safety(::google::protobuf::int32 value) {
   
   outside_safety_ = value;
   // @@protoc_insertion_point(field_set:out_mcpu_statu.outside_safety)

+ 1 - 1
plc调度节点/message/message.proto

@@ -97,7 +97,7 @@ message out_mcpu_statu{     //数值+1后
 
 message in_mcpu_statu{      //数值+1后
   int32 door_statu=1;       //外门状态       0无效, 1无效, 2开到位, 3 关到位, 4开关中, 5 故障
-  int32 back_io=2;          //后超界
+  int32 back_io=2;          //后超界       0无效, 1后超界, 2正常
   int32 is_occupy=3;        //是否有车      0无效, 1无车, 2有车
   int32 heighth=4;          //车高状态      0无效, 1无效, 2小车, 3中车, 4大车, 5故障, 6故障
 }