ats 测试 仿真
This commit is contained in:
parent
86bca2c7dc
commit
ed7afff3ce
@ -1,12 +1,35 @@
|
||||
package memory
|
||||
|
||||
//根据地图数据来初始VerifyMemoryModel,包括对地图数据的校验,构建设备间固定关系,
|
||||
//初始化设备状态。
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"joylink.club/bj-rtsts-server/ats/verify/protos/graphicData"
|
||||
"joylink.club/bj-rtsts-server/ats/verify/protos/state"
|
||||
)
|
||||
|
||||
// 根据地图数据来初始VerifyMemoryModel,包括对地图数据的校验,构建设备间固定关系,
|
||||
// 初始化设备状态。
|
||||
type WaysideMemoryInitializer struct {
|
||||
memory *WaysideMemory
|
||||
}
|
||||
|
||||
func (initializer *WaysideMemoryInitializer) Create(memory *WaysideMemory) *WaysideMemoryInitializer {
|
||||
initializer.memory = memory
|
||||
return initializer
|
||||
func (me *WaysideMemoryInitializer) Create(memory *WaysideMemory) *WaysideMemoryInitializer {
|
||||
me.memory = memory
|
||||
return me
|
||||
}
|
||||
|
||||
// 从地图数据构建仿真内存模型
|
||||
func (me *WaysideMemoryInitializer) InitFromMap(proto *graphicData.RtssGraphicStorage) {
|
||||
me.initFromMapForTest(proto)
|
||||
}
|
||||
|
||||
// 暂时测试用
|
||||
func (me *WaysideMemoryInitializer) initFromMapForTest(proto *graphicData.RtssGraphicStorage) {
|
||||
for _, turnout := range proto.Turnouts {
|
||||
var swtichState *state.SwitchState = new(state.SwitchState)
|
||||
swtichState.Id = fmt.Sprintf("%d", turnout.Index)
|
||||
swtichState.Normal = true
|
||||
swtichState.Reverse = false
|
||||
me.memory.Status.SwitchStateMap[swtichState.Id] = swtichState
|
||||
}
|
||||
}
|
||||
|
34
ats/verify/simulation/wayside/runtime/wayside_runtime.go
Normal file
34
ats/verify/simulation/wayside/runtime/wayside_runtime.go
Normal file
@ -0,0 +1,34 @@
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"joylink.club/bj-rtsts-server/ats/verify/protos/graphicData"
|
||||
"joylink.club/bj-rtsts-server/ats/verify/simulation/wayside/memory"
|
||||
)
|
||||
|
||||
// 轨旁仿真定义
|
||||
type VerifySimulation struct {
|
||||
//地图id
|
||||
MapId int32
|
||||
//仿真id
|
||||
SimulationId string
|
||||
//仿真内存数据
|
||||
Memory *memory.WaysideMemory
|
||||
}
|
||||
|
||||
// 创建仿真
|
||||
func CreateSimulation(mapId int32, simulationId string) *VerifySimulation {
|
||||
sim := new(VerifySimulation)
|
||||
sim.MapId = mapId
|
||||
sim.SimulationId = simulationId
|
||||
return sim
|
||||
}
|
||||
|
||||
// 启动仿真
|
||||
func (me *VerifySimulation) Start(proto *graphicData.RtssGraphicStorage) {
|
||||
me.Memory.Initializer.InitFromMap(proto)
|
||||
}
|
||||
|
||||
// 关闭仿真
|
||||
func (me *VerifySimulation) Shutdown() {
|
||||
|
||||
}
|
@ -1 +0,0 @@
|
||||
package wayside
|
Loading…
Reference in New Issue
Block a user