diff --git a/ts/simulation/wayside/memory/wayside_memory_signal.go b/ts/simulation/wayside/memory/wayside_memory_signal.go index 54a6ca2..899f9e8 100644 --- a/ts/simulation/wayside/memory/wayside_memory_signal.go +++ b/ts/simulation/wayside/memory/wayside_memory_signal.go @@ -231,10 +231,36 @@ func setSignalForceU(w ecs.World, e *ecs.Entry) error { return nil } -// 设置信号机强制黄红灯(引导信号) +// 设置信号机强制红黄灯(引导信号) func setSignalForceHU(w ecs.World, e *ecs.Entry) error { if e.HasComponent(component.Signal2XH1ElectronicType) { // 2XH1信号机 - return fmt.Errorf("信号机不支持点黄红灯") + return fmt.Errorf("信号机不支持点红黄灯") + } else if e.HasComponent(component.Signal3XH1ElectronicType) { // 3XH1信号机 + signal3XH1 := component.Signal3XH1ElectronicType.Get(e) + setRelayForce(signal3XH1.Z3XH1_DDJ, false) + setRelayForce(signal3XH1.Z3XH1_LXJ, false) + setRelayForce(signal3XH1.Z3XH1_ZXJ, false) + setRelayForce(signal3XH1.Z3XH1_DJ, true) + setRelayForce(signal3XH1.Z3XH1_2DJ, true) + setRelayForce(signal3XH1.Z3XH1_YXJ, true) + } else if e.HasComponent(component.Signal3XH2ElectronicType) { // 3XH2信号机 + signal3XH2 := component.Signal3XH2ElectronicType.Get(e) + setRelayForce(signal3XH2.Z3XH2_DDJ, false) + setRelayForce(signal3XH2.Z3XH2_LXJ, false) + setRelayForce(signal3XH2.Z3XH2_DJ, true) + setRelayForce(signal3XH2.Z3XH2_2DJ, true) + setRelayForce(signal3XH2.Z3XH2_YXJ, true) + } else if e.HasComponent(component.Signal3XH3ElectronicType) { // 3XH3信号机 + signal3XH3 := component.Signal3XH3ElectronicType.Get(e) + setRelayForce(signal3XH3.Z3XH3_DDJ, false) + setRelayForce(signal3XH3.Z3XH3_LXJ, false) + setRelayForce(signal3XH3.Z3XH3_YXJ, true) + setRelayForce(signal3XH3.Z3XH3_DJ, true) + setRelayForce(signal3XH3.Z3XH3_2DJ, true) + } else if e.HasComponent(component.Signal3XH4ElectronicType) { // 3XH4信号机 + return fmt.Errorf("信号机不支持点红黄灯") + } else { + return fmt.Errorf("未知的信号机型号") } return nil }