列车前端操作接口,列车连接三方映射接口及ws返回列车连接状态

This commit is contained in:
tiger_zhou 2024-03-15 16:03:47 +08:00
parent ab72ff8e00
commit 88b5ea8c77
1 changed files with 31 additions and 38 deletions

View File

@ -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) {
//相关继电器