Merge branch 'master' of https://git.code.tencent.com/jl-framework/rtss_simulation
This commit is contained in:
commit
caed8fcf76
@ -17,6 +17,7 @@ var (
|
||||
|
||||
// 联锁驱采数据表
|
||||
type CiQcTable struct {
|
||||
EcsUid string
|
||||
// 驱动码表
|
||||
QdBits []*proto.QdData
|
||||
// 采集码表
|
||||
@ -25,6 +26,14 @@ type CiQcTable struct {
|
||||
QdIndex map[string]int
|
||||
}
|
||||
|
||||
func NewCiQcTable(ecsUid string, qdbits []*proto.QdData, cjbits []*proto.CjData) *CiQcTable {
|
||||
return &CiQcTable{
|
||||
EcsUid: ecsUid,
|
||||
QdBits: qdbits,
|
||||
CjBits: cjbits,
|
||||
}
|
||||
}
|
||||
|
||||
func (qc *CiQcTable) BuildQcIndex() error {
|
||||
qc.QdIndex = make(map[string]int)
|
||||
for i, qd := range qc.QdBits {
|
||||
@ -50,10 +59,18 @@ type CiQcState struct {
|
||||
}
|
||||
|
||||
func NewCiQcState(qlen int, clen int) *CiQcState {
|
||||
qbl := qlen / 8
|
||||
if qlen%8 != 0 {
|
||||
qbl++
|
||||
}
|
||||
cbl := clen / 8
|
||||
if clen%8 != 0 {
|
||||
cbl++
|
||||
}
|
||||
return &CiQcState{
|
||||
component_proto.CiQcState{
|
||||
Qbs: make([]byte, qlen),
|
||||
Cbs: make([]byte, clen),
|
||||
Qbs: make([]byte, qbl),
|
||||
Cbs: make([]byte, cbl),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -83,6 +83,17 @@ func (wd *WorldData) SetQdBit(uid string, v bool) error {
|
||||
return fmt.Errorf("没有定义id=%s的继电器的驱动码表", uid)
|
||||
}
|
||||
|
||||
// 获取集中站id对应的联锁驱采实体
|
||||
func (wd *WorldData) FindQcEntityByEcsId(ecsId string) *ecs.Entry {
|
||||
for _, entry := range wd.CiQcEntities {
|
||||
qc := CiQcTableType.Get(entry)
|
||||
if qc.EcsUid == ecsId {
|
||||
return entry
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type QdBitParam struct {
|
||||
Uid string
|
||||
Val bool
|
||||
|
@ -29,10 +29,7 @@ func LoadCiQC(w ecs.World) error {
|
||||
continue
|
||||
}
|
||||
entry := newCiQC(w, data)
|
||||
qctable := &component.CiQcTable{
|
||||
QdBits: csr.QdList,
|
||||
CjBits: csr.CjList,
|
||||
}
|
||||
qctable := component.NewCiQcTable(csr.StationId, csr.QdList, csr.CjList)
|
||||
err := qctable.BuildQcIndex()
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -256,6 +256,15 @@ func (repo *Repository) FindPhysicalSection(id string) *PhysicalSection {
|
||||
return repo.physicalSectionMap[id]
|
||||
}
|
||||
|
||||
func (repo *Repository) FindStationByStationName(name string) *Station {
|
||||
for _, s := range repo.StationList() {
|
||||
if s.code == name {
|
||||
return s
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (repo *Repository) FindPsd(id string) *Psd {
|
||||
return repo.psdMap[id]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user