将零散组合的继电器加载进仿真
This commit is contained in:
parent
4bcc1c0b16
commit
46507159c5
@ -23,6 +23,7 @@ func LoadCiQC(w ecs.World) error {
|
|||||||
// if len(csr.QdList) == 0 {
|
// if len(csr.QdList) == 0 {
|
||||||
// return fmt.Errorf("加载联锁驱采卡实体失败,车站'%s'无驱动码表数据", csr.StationId)
|
// return fmt.Errorf("加载联锁驱采卡实体失败,车站'%s'无驱动码表数据", csr.StationId)
|
||||||
// }
|
// }
|
||||||
|
// 加载联锁驱采卡实体
|
||||||
if len(csr.CjList) == 0 || len(csr.QdList) == 0 {
|
if len(csr.CjList) == 0 || len(csr.QdList) == 0 {
|
||||||
slog.Warn("加载联锁驱采卡实体失败,无驱动/采集码表数据", "车站", csr.StationId)
|
slog.Warn("加载联锁驱采卡实体失败,无驱动/采集码表数据", "车站", csr.StationId)
|
||||||
continue
|
continue
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
func Load(w ecs.World, repo *repository.Repository) error {
|
func Load(w ecs.World, repo *repository.Repository) error {
|
||||||
// 初始化世界数据单例组件
|
// 初始化世界数据单例组件
|
||||||
LoadWorldData(w, repo)
|
LoadWorldData(w, repo)
|
||||||
|
// 加载联锁驱采卡相关实体
|
||||||
err := LoadCiQC(w)
|
err := LoadCiQC(w)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -3,12 +3,21 @@ package entity
|
|||||||
import (
|
import (
|
||||||
"joylink.club/ecs"
|
"joylink.club/ecs"
|
||||||
"joylink.club/rtsssimulation/component"
|
"joylink.club/rtsssimulation/component"
|
||||||
|
"joylink.club/rtsssimulation/repository"
|
||||||
)
|
)
|
||||||
|
|
||||||
func LoadStations(w ecs.World) error {
|
func LoadStations(w ecs.World) error {
|
||||||
data := GetWorldData(w)
|
data := GetWorldData(w)
|
||||||
stations := data.Repo.StationList()
|
stations := data.Repo.StationList()
|
||||||
|
// 加载零散组合继电器
|
||||||
for _, station := range stations {
|
for _, station := range stations {
|
||||||
|
for _, ecg := range station.ComponentGroups() {
|
||||||
|
if ecg.Code() == "LS" {
|
||||||
|
for _, ele := range ecg.Components() {
|
||||||
|
NewRelayEntity(w, ele.(*repository.Relay), data.EntityMap)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
entry := NewStationEntity(w, station.Id(), data)
|
entry := NewStationEntity(w, station.Id(), data)
|
||||||
if station.GetIbpSpk() != nil { // 人员防护
|
if station.GetIbpSpk() != nil { // 人员防护
|
||||||
LoadSPKEntity(w, entry, station.GetIbpSpk(), data)
|
LoadSPKEntity(w, entry, station.GetIbpSpk(), data)
|
||||||
|
5
fi/ci_qc.go
Normal file
5
fi/ci_qc.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package fi
|
||||||
|
|
||||||
|
func GetCiQcState() {
|
||||||
|
|
||||||
|
}
|
@ -862,8 +862,24 @@ func buildStationRelationShip(source *proto.Repository, repo *Repository) error
|
|||||||
bindIbpDevice(repo, ref.Components, station.GetIbpEmp())
|
bindIbpDevice(repo, ref.Components, station.GetIbpEmp())
|
||||||
case "SPKS":
|
case "SPKS":
|
||||||
bindIbpDevice(repo, ref.Components, station.GetIbpSpk())
|
bindIbpDevice(repo, ref.Components, station.GetIbpSpk())
|
||||||
|
case "LS":
|
||||||
|
{
|
||||||
|
var components []IGroupedElectronicComponent
|
||||||
|
for _, cmp := range ref.Components {
|
||||||
|
switch cmp.DeviceType {
|
||||||
|
case proto.DeviceType_DeviceType_Relay:
|
||||||
|
components = append(components, repo.relayMap[cmp.Id])
|
||||||
default:
|
default:
|
||||||
slog.Warn("车站实体未实现【%s】绑定逻辑", ref.Code)
|
return fmt.Errorf("集中站'%s'的LS组合数据异常,包含非继电器设备: type=%s, id=%s", station.Id(), cmp.DeviceType, cmp.Id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
station.componentGroups = append(station.componentGroups, &ElectronicComponentGroup{
|
||||||
|
code: ref.Code,
|
||||||
|
components: components,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
slog.Warn("未知的车站组合", "组合code", ref.Code)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ type Station struct {
|
|||||||
Identity
|
Identity
|
||||||
code string
|
code string
|
||||||
ibp *IBP
|
ibp *IBP
|
||||||
|
componentGroups []*ElectronicComponentGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewStation(id, code string) *Station {
|
func NewStation(id, code string) *Station {
|
||||||
@ -27,3 +28,7 @@ func (s *Station) GetIbpEmp() *IBPRefMap {
|
|||||||
func (s *Station) GetIbpSpk() *IBPRefMap {
|
func (s *Station) GetIbpSpk() *IBPRefMap {
|
||||||
return s.ibp.Spk
|
return s.ibp.Spk
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Station) ComponentGroups() []*ElectronicComponentGroup {
|
||||||
|
return s.componentGroups
|
||||||
|
}
|
||||||
|
@ -17,6 +17,7 @@ func BindSystem(w ecs.World) {
|
|||||||
device_sys.NewDBQSys(),
|
device_sys.NewDBQSys(),
|
||||||
device_sys.NewZzjSys(),
|
device_sys.NewZzjSys(),
|
||||||
device_sys.NewTurnoutSys(),
|
device_sys.NewTurnoutSys(),
|
||||||
|
device_sys.NewCiQcSys(),
|
||||||
circuit_sys.NewZdj9TwoDragSys(),
|
circuit_sys.NewZdj9TwoDragSys(),
|
||||||
circuit_sys.NewSignal2XH1System(),
|
circuit_sys.NewSignal2XH1System(),
|
||||||
circuit_sys.NewSignal3XH1System(),
|
circuit_sys.NewSignal3XH1System(),
|
||||||
|
Loading…
Reference in New Issue
Block a user