signal 3xh2 驱采

This commit is contained in:
xzb 2023-10-12 14:30:25 +08:00
parent 9bdb1a5fdc
commit ae3495ce62

View File

@ -10,7 +10,6 @@ import (
"joylink.club/rtsssimulation/fi" "joylink.club/rtsssimulation/fi"
"joylink.club/rtsssimulation/repository" "joylink.club/rtsssimulation/repository"
"joylink.club/rtsssimulation/repository/model/proto" "joylink.club/rtsssimulation/repository/model/proto"
"log"
"log/slog" "log/slog"
"os" "os"
"time" "time"
@ -32,34 +31,28 @@ func main() {
repo := repository.BuildRepositoryForSignalTest(proto) repo := repository.BuildRepositoryForSignalTest(proto)
sim := rtss_simulation.NewSimulation(repo) sim := rtss_simulation.NewSimulation(repo)
loadEntities(sim, repo) loadEntities(sim, repo)
sim.SetSpeed(0.1) sim.SetSpeed(1)
sim.AddSystem(sigSys.NewSignalDebugSystem()) sim.AddSystem(sigSys.NewSignalDebugSystem())
sim.StartUp() sim.StartUp()
// //
time.Sleep(1 * time.Second) time.Sleep(1 * time.Second)
worldLog(sim, "===>>灭灯 .....") slog.Debug("灭灯 .....")
fi.DriveSignal3XH1Dd(sim, IdSignal3XH1, false) fi.DriveSignal3XH1Dd(sim, IdSignal3XH1, false)
// //
time.Sleep(1 * time.Second) time.Sleep(1 * time.Second)
worldLog(sim, "===>>亮灯 .....") slog.Debug("亮灯 .....")
fi.DriveSignal3XH1Dd(sim, IdSignal3XH1, true) fi.DriveSignal3XH1Dd(sim, IdSignal3XH1, true)
// //
time.Sleep(2 * time.Second) time.Sleep(2 * time.Second)
worldLog(sim, "===>>开通引导信号 .....") slog.Debug("开通引导信号 .....")
fi.DriveSignal3XH1Yx(sim, IdSignal3XH1) fi.DriveSignal3XH1Yx(sim, IdSignal3XH1)
time.Sleep(2 * time.Second) time.Sleep(2 * time.Second)
worldLog(sim, "===>>开通列车信号 .....") slog.Debug("开通列车信号 .....")
fi.DriveSignal3XH1Lx(sim, IdSignal3XH1, false) fi.DriveSignal3XH1Lx(sim, IdSignal3XH1, false)
// //
time.Sleep(5 * time.Second) time.Sleep(5 * time.Second)
sim.Close() sim.Close()
} }
func worldLog(w ecs.World, logInfo string) {
ecs.Request(w, func() any {
log.Println(logInfo)
return nil
})
}
func addProtoSignal3XH1(r *proto.Repository) { func addProtoSignal3XH1(r *proto.Repository) {
//相关继电器 //相关继电器
r.Relays = append(r.Relays, &proto.Relay{Id: "3xh1-ddj", Code: consts.SIGNAL_DDJ, Model: proto.Relay_JWXC_1700}) r.Relays = append(r.Relays, &proto.Relay{Id: "3xh1-ddj", Code: consts.SIGNAL_DDJ, Model: proto.Relay_JWXC_1700})