修改构建设备实体状态
This commit is contained in:
parent
bd2f928a94
commit
4e435e6398
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,4 +1,6 @@
|
|||||||
.idea/
|
.idea/
|
||||||
|
.vscode
|
||||||
|
.air.toml
|
||||||
.DS_Store
|
.DS_Store
|
||||||
output/
|
output/
|
||||||
|
|
||||||
|
@ -91,13 +91,13 @@ func CreateSimulation(projectId int32, mapIds []int32) string {
|
|||||||
}
|
}
|
||||||
verifySimulation.SimulationId = simulationId
|
verifySimulation.SimulationId = simulationId
|
||||||
//通知动力学
|
//通知动力学
|
||||||
lineBaseInfo := buildLineBaseInfo(verifySimulation)
|
// lineBaseInfo := buildLineBaseInfo(verifySimulation)
|
||||||
httpCode, _, err := dynamics.SendSimulationStartReq(lineBaseInfo)
|
// httpCode, _, err := dynamics.SendSimulationStartReq(lineBaseInfo)
|
||||||
if httpCode != http.StatusOK || err != nil {
|
// if httpCode != http.StatusOK || err != nil {
|
||||||
panic(dto.ErrorDto{Code: dto.DynamicsError, Message: fmt.Sprintf("动力学接口调用失败:[%d][%s]", httpCode, err)})
|
// panic(dto.ErrorDto{Code: dto.DynamicsError, Message: fmt.Sprintf("动力学接口调用失败:[%d][%s]", httpCode, err)})
|
||||||
}
|
// }
|
||||||
simulationMap.Store(simulationId, verifySimulation)
|
simulationMap.Store(simulationId, verifySimulation)
|
||||||
dynamicsRun(verifySimulation)
|
// dynamicsRun(verifySimulation)
|
||||||
}
|
}
|
||||||
return simulationId
|
return simulationId
|
||||||
}
|
}
|
||||||
|
@ -13,13 +13,18 @@ func GetMapAllRelayState(sim *VerifySimulation, mapId int32) []*state.ReplyState
|
|||||||
uidMap := QueryMapUidMapByType(mapId, &graphicData.Relay{})
|
uidMap := QueryMapUidMapByType(mapId, &graphicData.Relay{})
|
||||||
var replyStateArr []*state.ReplyState
|
var replyStateArr []*state.ReplyState
|
||||||
for _, u := range uidMap {
|
for _, u := range uidMap {
|
||||||
entry, _ := entity.GetEntityByUid(sim.World, u.Uid)
|
entry, ok := entity.GetEntityByUid(sim.World, u.Uid)
|
||||||
bit := component.BitStateType.Get(entry)
|
if !ok {
|
||||||
// p := entities.GetRelayState(sim.WorldId, u.Uid)
|
continue
|
||||||
// if p == nil {
|
}
|
||||||
// continue
|
if entry.HasComponent(component.RelayTag) {
|
||||||
// }
|
bit := component.BitStateType.Get(entry)
|
||||||
replyStateArr = append(replyStateArr, &state.ReplyState{Id: u.CommonId, Xh: bit.Val})
|
// p := entities.GetRelayState(sim.WorldId, u.Uid)
|
||||||
|
// if p == nil {
|
||||||
|
// continue
|
||||||
|
// }
|
||||||
|
replyStateArr = append(replyStateArr, &state.ReplyState{Id: u.CommonId, Xh: bit.Val})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return replyStateArr
|
return replyStateArr
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package memory
|
package memory
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"joylink.club/rtsssimulation/component"
|
"joylink.club/rtsssimulation/component"
|
||||||
"joylink.club/rtsssimulation/entity"
|
"joylink.club/rtsssimulation/entity"
|
||||||
"joylink.club/rtsssimulation/fi"
|
"joylink.club/rtsssimulation/fi"
|
||||||
@ -50,7 +52,10 @@ func GetMapAllTurnoutState(sim *VerifySimulation, mapId int32) []*state.SwitchSt
|
|||||||
uidMap := QueryMapUidMapByType(mapId, &graphicData.Turnout{})
|
uidMap := QueryMapUidMapByType(mapId, &graphicData.Turnout{})
|
||||||
var switchArr []*state.SwitchState
|
var switchArr []*state.SwitchState
|
||||||
for _, u := range uidMap {
|
for _, u := range uidMap {
|
||||||
entry, _ := entity.GetEntityByUid(sim.World, u.Uid)
|
entry, ok := entity.GetEntityByUid(sim.World, u.Uid)
|
||||||
|
if !ok {
|
||||||
|
fmt.Printf("id=%s的道岔不存在", u.Uid)
|
||||||
|
}
|
||||||
tp := component.TurnoutPositionType.Get(entry)
|
tp := component.TurnoutPositionType.Get(entry)
|
||||||
// p := entities.GetTurnoutState(sim.WorldId, o.Id())
|
// p := entities.GetTurnoutState(sim.WorldId, o.Id())
|
||||||
// if p == nil {
|
// if p == nil {
|
||||||
|
@ -113,6 +113,7 @@ func CreateSimulation(projectId int32, mapIds []int32) (*VerifySimulation, error
|
|||||||
//创建仿真
|
//创建仿真
|
||||||
// worldId := world.CreateSimulation(repo)
|
// worldId := world.CreateSimulation(repo)
|
||||||
w := rtss_simulation.NewSimulation(repo)
|
w := rtss_simulation.NewSimulation(repo)
|
||||||
|
w.StartUp()
|
||||||
verifySimulation := &VerifySimulation{
|
verifySimulation := &VerifySimulation{
|
||||||
MapIds: mapIds,
|
MapIds: mapIds,
|
||||||
ProjectId: projectId,
|
ProjectId: projectId,
|
||||||
|
Loading…
Reference in New Issue
Block a user