diff --git a/examples/signal_3xh1/main.go b/examples/signal_3xh1/main.go index 252b120..1cb25e5 100644 --- a/examples/signal_3xh1/main.go +++ b/examples/signal_3xh1/main.go @@ -2,16 +2,9 @@ package main import ( "fmt" - "log/slog" - "os" - "time" - "joylink.club/ecs" - rtss_simulation "joylink.club/rtsssimulation" "joylink.club/rtsssimulation/consts" "joylink.club/rtsssimulation/entity" - "joylink.club/rtsssimulation/examples/signal_3xh1/sigSys" - "joylink.club/rtsssimulation/fi" "joylink.club/rtsssimulation/repository" "joylink.club/rtsssimulation/repository/model/proto" ) @@ -22,37 +15,37 @@ const ( // 信号机测试 func main() { - logConfig := &slog.HandlerOptions{AddSource: false, Level: slog.LevelDebug} - slog.SetDefault(slog.New(slog.NewTextHandler(os.Stderr, logConfig))) - // - proto := &proto.Repository{} - proto.Id = "test-for-signal" - proto.Version = "v1.0" - addProtoSignal3XH1(proto) - repo := repository.BuildRepositoryForSignalTest(proto) - sim, _ := rtss_simulation.NewSimulation(repo) - loadEntities(sim, repo) - sim.SetSpeed(1) - sim.AddSystem(sigSys.NewSignalDebugSystem()) - sim.StartUp() - // - time.Sleep(1 * time.Second) - slog.Debug("灭灯 .....") - fi.DriveSignal3XH1Dd(sim, IdSignal3XH1, false) - // - time.Sleep(1 * time.Second) - slog.Debug("亮灯 .....") - fi.DriveSignal3XH1Dd(sim, IdSignal3XH1, true) - // - time.Sleep(2 * time.Second) - slog.Debug("开通引导信号 .....") - fi.DriveSignal3XH1Yx(sim, IdSignal3XH1) - time.Sleep(2 * time.Second) - slog.Debug("开通列车信号 .....") - fi.DriveSignal3XH1Lx(sim, IdSignal3XH1, false) - // - time.Sleep(5 * time.Second) - sim.Close() + /* logConfig := &slog.HandlerOptions{AddSource: false, Level: slog.LevelDebug} + slog.SetDefault(slog.New(slog.NewTextHandler(os.Stderr, logConfig))) + // + proto := &proto.Repository{} + proto.Id = "test-for-signal" + proto.Version = "v1.0" + addProtoSignal3XH1(proto) + repo := repository.BuildRepositoryForSignalTest(proto) + sim, _ := rtss_simulation.NewSimulation(repo) + loadEntities(sim, repo) + sim.SetSpeed(1) + sim.AddSystem(sigSys.NewSignalDebugSystem()) + sim.StartUp() + // + time.Sleep(1 * time.Second) + slog.Debug("灭灯 .....") + fi.DriveSignal3XH1Dd(sim, IdSignal3XH1, false) + // + time.Sleep(1 * time.Second) + slog.Debug("亮灯 .....") + fi.DriveSignal3XH1Dd(sim, IdSignal3XH1, true) + // + time.Sleep(2 * time.Second) + slog.Debug("开通引导信号 .....") + fi.DriveSignal3XH1Yx(sim, IdSignal3XH1) + time.Sleep(2 * time.Second) + slog.Debug("开通列车信号 .....") + fi.DriveSignal3XH1Lx(sim, IdSignal3XH1, false) + // + time.Sleep(5 * time.Second) + sim.Close()*/ } func addProtoSignal3XH1(r *proto.Repository) { //相关继电器