From 88b5ea8c77c150800681a384df96ba6ae81a23f5 Mon Sep 17 00:00:00 2001 From: tiger_zhou Date: Fri, 15 Mar 2024 16:03:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=97=E8=BD=A6=E5=89=8D=E7=AB=AF=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E6=8E=A5=E5=8F=A3=EF=BC=8C=E5=88=97=E8=BD=A6=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E4=B8=89=E6=96=B9=E6=98=A0=E5=B0=84=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=8F=8Aws=E8=BF=94=E5=9B=9E=E5=88=97=E8=BD=A6=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/signal_3xh1/main.go | 69 ++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 38 deletions(-) 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) { //相关继电器