package component import ( "joylink.club/ecs" "joylink.club/rtsssimulation/component/component_proto" ) var SignalTag = ecs.NewTag() //标记一个实体为信号机 ////////////////////////////////////////////////////////////////// // SignalLights 信号机灯位列表 type SignalLights struct { Lights []*ecs.Entry } var SignalLightsType = ecs.NewComponentType[SignalLights]() // GetLightByTag 根据标签获取灯位列表中的某个灯 func (sl *SignalLights) GetLightByTag(dTag DsTag) *ecs.Entry { for _, light := range sl.Lights { if light.HasComponent(dTag) { return light } } return nil } // GetLightByColor 根据灯色取灯位列表中的某个灯 func (sl *SignalLights) GetLightByColor(light component_proto.Light_Color) *ecs.Entry { switch light { case component_proto.Light_L: return sl.GetLightByTag(LdTag) case component_proto.Light_H: return sl.GetLightByTag(HdTag) case component_proto.Light_U: return sl.GetLightByTag(UdTag) case component_proto.Light_B: return sl.GetLightByTag(BdTag) case component_proto.Light_A: return sl.GetLightByTag(AdTag) } return nil } // HaveLightsByColor 判断信号机是否有这几个色灯 func (sl *SignalLights) HaveLightsByColor(lights ...component_proto.Light_Color) bool { for _, light := range lights { if sl.GetLightByColor(light) == nil { return false } } return true } ////////////////////////////////////////////////////////////////// var ( LightFaultDsType = ecs.NewTag() //灯断丝故障 ) /////////////////////////////////////////////////// // Signal2XH1Electronic 电路状态:**信号机2XH-1(红-绿) 出段(场)信号机 或 **出站区间阻挡信号机 type Signal2XH1Electronic struct { // 点灯继电器,true-吸合,常态落下表示逻辑点灯 Z2XH1_DDJ *ecs.Entry //灯丝继电器,true-吸合 Z2XH1_DJ *ecs.Entry //列车信号继电器,true-吸合 Z2XH1_LXJ *ecs.Entry } // Signal2XH1Lsq 联锁驱 type Signal2XH1Lsq struct { //true-联锁施加励磁电流驱动继电器DDJ Z2XH1_DDJ_Q bool ////true-联锁施加励磁电流驱动继电器LXJ Z2XH1_LXJ_Q bool } // Signal2XH1Lsc 联锁采 type Signal2XH1Lsc struct { //true-继电器DJ吸起 Z2XH1_DJ_Xq bool //true-继电器DDJ落下 Z2XH1_DDJ_Lx bool //true-继电器LXJ吸起 Z2XH1_LXJ_Xq bool } var ( //Signal2XH1ElectronicType 2XH1信号机电路组件 Signal2XH1ElectronicType = ecs.NewComponentType[Signal2XH1Electronic]() Signal2XH1LsqType = ecs.NewComponentType[Signal2XH1Lsq]() Signal2XH1LscType = ecs.NewComponentType[Signal2XH1Lsc]() ) ///////////////////////////////////////////////////////////////////////// // Signal3XH1Electronic 电路状态:信号机3XH-1(红-绿-黄) 道岔防护信号机(三显示不封灯,有单黄显示、带引导) type Signal3XH1Electronic struct { // 点灯继电器,true-吸合,常态落下表示逻辑点灯 Z3XH1_DDJ *ecs.Entry //2DJ灯丝继电器,true-吸合 Z3XH1_2DJ *ecs.Entry //灯丝继电器,true-吸合 Z3XH1_DJ *ecs.Entry //列车信号继电器,true-吸合 Z3XH1_LXJ *ecs.Entry //引导信号继电器,true-吸合 Z3XH1_YXJ *ecs.Entry //开通正线信号继电器,true-吸合 Z3XH1_ZXJ *ecs.Entry } // Signal3XH1Lsq 联锁驱 type Signal3XH1Lsq struct { //true-联锁施加励磁电流驱动继电器DDJ Z3XH1_DDJ_Q bool ////true-联锁施加励磁电流驱动继电器LXJ Z3XH1_LXJ_Q bool ////true-联锁施加励磁电流驱动继电器LXJ Z3XH1_ZXJ_Q bool ////true-联锁施加励磁电流驱动继电器LXJ Z3XH1_YXJ_Q bool } // Signal3XH1Lsc 联锁采 type Signal3XH1Lsc struct { //true-继电器DJ吸起 Z3XH1_DJ_Xq bool //true-继电器2DJ吸起 Z3XH1_2DJ_Xq bool //true-继电器DDJ落下 Z3XH1_DDJ_Lx bool //true-继电器LXJ吸起 Z3XH1_LXJ_Xq bool //true-继电器ZXJ吸起 Z3XH1_ZXJ_Xq bool //true-继电器YXJ吸起 Z3XH1_YXJ_Xq bool } var ( Signal3XH1ElectronicType = ecs.NewComponentType[Signal3XH1Electronic]() Signal3XH1LsqType = ecs.NewComponentType[Signal3XH1Lsq]() Signal3XH1LscType = ecs.NewComponentType[Signal3XH1Lsc]() ) ///////////////////////////////////////////////////////////////////////// // Signal3XH2Electronic 电路状态:信号机3XH-2(红-绿-黄) 道岔防护信号机(三显示不封灯、无单黄显示、带引导) // 引导信号:红黄 type Signal3XH2Electronic struct { // 点灯继电器,true-吸合,常态落下表示逻辑点灯 Z3XH2_DDJ *ecs.Entry //2DJ灯丝继电器,true-吸合 Z3XH2_2DJ *ecs.Entry //灯丝继电器,true-吸合 Z3XH2_DJ *ecs.Entry //列车信号继电器,true-吸合 Z3XH2_LXJ *ecs.Entry //引导信号继电器,true-吸合 Z3XH2_YXJ *ecs.Entry } // Signal3XH2Lsq 联锁驱 type Signal3XH2Lsq struct { //true-联锁施加励磁电流驱动继电器DDJ Z3XH2_DDJ_Q bool ////true-联锁施加励磁电流驱动继电器LXJ Z3XH2_LXJ_Q bool ////true-联锁施加励磁电流驱动继电器LXJ Z3XH2_YXJ_Q bool } // Signal3XH2Lsc 联锁采 type Signal3XH2Lsc struct { //true-继电器DJ吸起 Z3XH2_DJ_Xq bool //true-继电器2DJ吸起 Z3XH2_2DJ_Xq bool //true-继电器DDJ落下 Z3XH2_DDJ_Lx bool //true-继电器LXJ吸起 Z3XH2_LXJ_Xq bool //true-继电器YXJ吸起 Z3XH2_YXJ_Xq bool } var ( Signal3XH2ElectronicType = ecs.NewComponentType[Signal3XH2Electronic]() Signal3XH2LsqType = ecs.NewComponentType[Signal3XH2Lsq]() Signal3XH2LscType = ecs.NewComponentType[Signal3XH2Lsc]() ) ////////////////////////////////////////////////////////////////////////////// // Signal3XH3Electronic 电路状态:信号机3XH-3(红-绿-黄) 道岔防护信号机(三显示封绿灯、有单黄显示、带引导) // 引导信号:红黄 type Signal3XH3Electronic struct { // 点灯继电器,true-吸合,常态落下表示逻辑点灯 Z3XH3_DDJ *ecs.Entry //2DJ灯丝继电器,true-吸合 Z3XH3_2DJ *ecs.Entry //灯丝继电器,true-吸合 Z3XH3_DJ *ecs.Entry //列车信号继电器,true-吸合 Z3XH3_LXJ *ecs.Entry //引导信号继电器,true-吸合 Z3XH3_YXJ *ecs.Entry } // Signal3XH3Lsq 联锁驱 type Signal3XH3Lsq struct { //true-联锁施加励磁电流驱动继电器DDJ Z3XH3_DDJ_Q bool ////true-联锁施加励磁电流驱动继电器LXJ Z3XH3_LXJ_Q bool ////true-联锁施加励磁电流驱动继电器LXJ Z3XH3_YXJ_Q bool } // Signal3XH3Lsc 联锁采 type Signal3XH3Lsc struct { //true-继电器DJ吸起 Z3XH3_DJ_Xq bool //true-继电器2DJ吸起 Z3XH3_2DJ_Xq bool //true-继电器DDJ落下 Z3XH3_DDJ_Lx bool //true-继电器LXJ吸起 Z3XH3_LXJ_Xq bool //true-继电器YXJ吸起 Z3XH3_YXJ_Xq bool } var ( Signal3XH3ElectronicType = ecs.NewComponentType[Signal3XH3Electronic]() Signal3XH3LsqType = ecs.NewComponentType[Signal3XH3Lsq]() Signal3XH3LscType = ecs.NewComponentType[Signal3XH3Lsc]() ) /////////////////////////////////////////////////////////////////////////////// // Signal3XH4Electronic 电路状态:信号机3XH-4(红-绿-黄) 出站兼道岔防护信号机(三显示不封灯、有单黄显示、无引导) type Signal3XH4Electronic struct { // 点灯继电器,true-吸合,常态落下表示逻辑点灯 Z3XH4_DDJ *ecs.Entry //灯丝继电器,true-吸合 Z3XH4_DJ *ecs.Entry //列车信号继电器,true-吸合 Z3XH4_LXJ *ecs.Entry //开通正线信号继电器,true-吸合 Z3XH4_ZXJ *ecs.Entry } // Signal3XH4Lsq 联锁驱 type Signal3XH4Lsq struct { //true-联锁施加励磁电流驱动继电器DDJ Z3XH4_DDJ_Q bool ////true-联锁施加励磁电流驱动继电器LXJ Z3XH4_LXJ_Q bool ////true-联锁施加励磁电流驱动继电器ZXJ Z3XH4_ZXJ_Q bool } // Signal3XH4Lsc 联锁采 type Signal3XH4Lsc struct { //true-继电器DJ吸起 Z3XH4_DJ_Xq bool //true-继电器DDJ落下 Z3XH4_DDJ_Lx bool //true-继电器LXJ吸起 Z3XH4_LXJ_Xq bool //true-继电器ZXJ吸起 Z3XH4_ZXJ_Xq bool } var ( Signal3XH4ElectronicType = ecs.NewComponentType[Signal3XH4Electronic]() Signal3XH4LsqType = ecs.NewComponentType[Signal3XH4Lsq]() Signal3XH4LscType = ecs.NewComponentType[Signal3XH4Lsc]() ) ///////////////////////////////////////////////////////////////////////// // SignalDCXHElectronic 电路状态:信号机DCXH(蓝-白) 调车信号机 type SignalDCXHElectronic struct { //灯丝继电器,true-吸合 DCXH_DJ *ecs.Entry //调车信号继电器,true-吸合 DCXH_DXJ *ecs.Entry } // SignalDCXHLsq 联锁驱 type SignalDCXHLsq struct { ////true-联锁施加励磁电流驱动继电器DXJ DCXH_DXJ_Q bool } // SignalDCXHLsc 联锁采 type SignalDCXHLsc struct { //true-继电器DJ吸起 DCXH_DJ_Xq bool //true-继电器DXJ吸起 DCXH_DXJ_Xq bool } var ( SignalDCXHElectronicType = ecs.NewComponentType[SignalDCXHElectronic]() SignalDCXHLsqType = ecs.NewComponentType[SignalDCXHLsq]() SignalDCXHLscType = ecs.NewComponentType[SignalDCXHLsc]() ) ////////////////////////////////////////////////////////////////////////////////////// // SignalJCKXHElectronic 电路状态:信号机JCKXH(红-白-黄) 进/出库列车兼调车信号机(三显示不封灯、有单黄显示、无引导) type SignalJCKXHElectronic struct { //灯丝继电器,true-吸合 JCKXH_DJ *ecs.Entry //调车信号继电器,true-吸合 JCKXH_DXJ *ecs.Entry //列车信号继电器,true-吸合 JCKXH_LXJ *ecs.Entry } // SignalJCKXHLsq 联锁驱 type SignalJCKXHLsq struct { //true-联锁施加励磁电流驱动继电器DXJ JCKXH_DXJ_Q bool ////true-联锁施加励磁电流驱动继电器LXJ JCKXH_LXJ_Q bool } // SignalJCKXHLsc 联锁采 type SignalJCKXHLsc struct { //true-继电器DJ吸起 JCKXH_DJ_Xq bool //true-继电器DXJ吸起 JCKXH_DXJ_Xq bool //true-继电器LXJ吸起 JCKXH_LXJ_Xq bool } var ( SignalJCKXHElectronicType = ecs.NewComponentType[SignalJCKXHElectronic]() SignalJCKXHLsqType = ecs.NewComponentType[SignalJCKXHLsq]() SignalJCKXHLscType = ecs.NewComponentType[SignalJCKXHLsc]() ) /////////////////////////////////////////////////////////////////////// // SignalJDXHElectronic 电路状态:信号机JDXH(红-绿-黄) 进段信号机(三显示不封灯、无单黄显示、带引导) type SignalJDXHElectronic struct { // 2DJ灯丝继电器,true-吸合 JDXH_2DJ *ecs.Entry //灯丝继电器,true-吸合 JDXH_DJ *ecs.Entry //列车信号继电器,true-吸合 JDXH_LXJ *ecs.Entry //引导信号继电器,true-吸合 JDXH_YXJ *ecs.Entry //引导转换继电器,true-吸合 JDXH_YZHJ *ecs.Entry } // SignalJDXHLsq 联锁驱 type SignalJDXHLsq struct { //true-联锁施加励磁电流驱动继电器YZHJ-引导转换继电器 JDXH_YZHJ_Q bool ////true-联锁施加励磁电流驱动继电器LXJ JDXH_LXJ_Q bool } // SignalJDXHLsc 联锁采 type SignalJDXHLsc struct { //true-继电器DJ吸起 JDXH_DJ_Xq bool //true-继电器2DJ吸起 JDXH_2DJ_Xq bool //true-继电器LXJ吸起 JDXH_LXJ_Xq bool //true-继电器YZHJ和YXJ吸起 JDXH_YZHJ_YXJ_Xq bool } var ( SignalJDXHElectronicType = ecs.NewComponentType[SignalJDXHElectronic]() SignalJDXHLsqType = ecs.NewComponentType[SignalJDXHLsq]() SignalJDXHLscType = ecs.NewComponentType[SignalJDXHLsc]() )