845a8b2f33
【消息增加发送区段状态】
53 lines
1.3 KiB
Go
53 lines
1.3 KiB
Go
package memory
|
|
|
|
import (
|
|
"joylink.club/bj-rtsts-server/ats/verify/protos/state"
|
|
)
|
|
|
|
// 轨旁仿真定义
|
|
type VerifySimulation struct {
|
|
//地图id
|
|
MapId int32
|
|
//仿真id
|
|
SimulationId string
|
|
//仿真内存数据
|
|
Memory *WaysideMemory
|
|
}
|
|
|
|
// 创建仿真对象
|
|
func CreateSimulation(mapId int32, simulationId string) *VerifySimulation {
|
|
m := &WaysideMemory{}
|
|
verifySimulation := &VerifySimulation{
|
|
MapId: mapId,
|
|
SimulationId: simulationId,
|
|
Memory: m.Create(),
|
|
}
|
|
// 初始化构地图设备状态
|
|
InitFromMap(verifySimulation.Memory.Status, QueryMapVerifyStructure(mapId))
|
|
return verifySimulation
|
|
}
|
|
|
|
// 获取全量状态
|
|
func (s *VerifySimulation) GetAllState() *state.PushedDevicesStatus {
|
|
return &state.PushedDevicesStatus{
|
|
All: true,
|
|
AllStatus: &state.AllDevicesStatus{
|
|
SwitchState: GetAllTurnoutState(s),
|
|
TrainState: GetAllTrainState(s),
|
|
SectionState: append(GetAllAxleSectionState(s), GetAllPhysicalSectionState(s)...),
|
|
},
|
|
}
|
|
}
|
|
|
|
// 获取变量状态
|
|
func (s *VerifySimulation) GetChangeState() *state.PushedDevicesStatus {
|
|
return &state.PushedDevicesStatus{
|
|
All: false,
|
|
VarStatus: &state.VariationStatus{
|
|
UpdatedSwitch: GetChangeTurnoutState(s),
|
|
RemovedTrainId: GetRemovedTrainId(s),
|
|
UpdatedTrain: GetUpdatedTrainState(s),
|
|
},
|
|
}
|
|
}
|