package memory import ( "joylink.club/bj-rtsts-server/ats/verify/protos/state" ) // 轨旁仿真定义 type VerifySimulation struct { //地图id MapId int32 // 项目ID ProjectId int32 //仿真id SimulationId string //仿真内存数据 Memory *WaysideMemory } // 创建仿真对象 func CreateSimulation(mapId, projectId int32, simulationId string) *VerifySimulation { m := &WaysideMemory{} verifySimulation := &VerifySimulation{ MapId: mapId, ProjectId: projectId, 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), }, } }