2023-12-29 17:48:57 +08:00
|
|
|
package relation
|
|
|
|
|
|
|
|
import (
|
|
|
|
"joylink.club/ecs"
|
|
|
|
"joylink.club/rtsssimulation/modelrepo/model"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
// 道岔模型数据引用组件类型
|
|
|
|
PointsModelRelaType = ecs.NewComponentType[PointsModelRela]()
|
|
|
|
// 道岔转辙机关系组件类型
|
|
|
|
PointsZzjRelaType = ecs.NewComponentType[PointsZzjRela]()
|
|
|
|
// ZDJ9双机电路元器件组件类型
|
|
|
|
Zdj9TwoElectronicType = ecs.NewComponentType[Zdj9TwoElectronic]()
|
|
|
|
)
|
|
|
|
|
|
|
|
// 道岔模型数据引用
|
|
|
|
type PointsModelRela struct {
|
2024-01-02 18:22:28 +08:00
|
|
|
M model.Points
|
2023-12-29 17:48:57 +08:00
|
|
|
}
|
|
|
|
|
2024-01-02 18:22:28 +08:00
|
|
|
func NewPointsModelRela(m model.Points) *PointsModelRela {
|
2023-12-29 17:48:57 +08:00
|
|
|
return &PointsModelRela{
|
|
|
|
M: m,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 道岔转辙机关系组件
|
|
|
|
type PointsZzjRela struct {
|
2024-01-02 18:22:28 +08:00
|
|
|
Points *ecs.Entry
|
|
|
|
Zzjs []*ecs.Entry
|
2023-12-29 17:48:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func NewPointsZzjRela(t *ecs.Entry, zzjs ...*ecs.Entry) *PointsZzjRela {
|
|
|
|
return &PointsZzjRela{
|
2024-01-02 18:22:28 +08:00
|
|
|
Points: t,
|
|
|
|
Zzjs: zzjs,
|
2023-12-29 17:48:57 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 获取转辙机一,若没有则panic
|
|
|
|
func (tz *PointsZzjRela) GetZzj1() *ecs.Entry {
|
|
|
|
len := len(tz.Zzjs)
|
|
|
|
if len > 0 {
|
|
|
|
return tz.Zzjs[0]
|
|
|
|
}
|
|
|
|
panic("道岔没有转辙机一")
|
|
|
|
}
|
|
|
|
|
|
|
|
// 获取转辙机二,若没有则panic
|
|
|
|
func (tz *PointsZzjRela) GetZzj2() *ecs.Entry {
|
|
|
|
len := len(tz.Zzjs)
|
|
|
|
if len > 1 {
|
|
|
|
return tz.Zzjs[1]
|
|
|
|
}
|
|
|
|
panic("道岔没有转辙机二")
|
|
|
|
}
|
|
|
|
|
|
|
|
// ZDJ9双机电路元器件
|
|
|
|
type Zdj9TwoElectronic struct {
|
|
|
|
TDC_DCJ *ecs.Entry // 定操继电器
|
|
|
|
TDC_FCJ *ecs.Entry // 反操继电器
|
|
|
|
TDC_YCJ *ecs.Entry // 允许操作继电器
|
|
|
|
TDC_ZDBJ *ecs.Entry // 总定表继电器
|
|
|
|
TDC_ZFBJ *ecs.Entry // 总反表继电器
|
|
|
|
|
|
|
|
// 一机
|
|
|
|
TDFJ1_1DQJ *ecs.Entry // 一启动继电器
|
|
|
|
TDFJ1_BHJ *ecs.Entry // 保护继电器
|
|
|
|
TDFJ1_2DQJ *ecs.Entry // 二启动继电器
|
|
|
|
TDFJ1_1DQJF *ecs.Entry // 一启动复示继电器
|
|
|
|
TDFJ1_DBQ *ecs.Entry // 断相保护器
|
|
|
|
TDFJ1_DBJ *ecs.Entry // 定位表示继电器
|
|
|
|
TDFJ1_FBJ *ecs.Entry // 反位表示继电器
|
|
|
|
TDFJ1_QDJ *ecs.Entry // 切断继电器
|
|
|
|
TDFJ1_ZBHJ *ecs.Entry // 总保护继电器
|
|
|
|
|
|
|
|
TDFJ1_QDJ_Remain int // 切断继电器保持电路保持剩余时间
|
|
|
|
|
|
|
|
// 二机
|
|
|
|
TDFJ2_1DQJ *ecs.Entry // 一启动继电器
|
|
|
|
TDFJ2_BHJ *ecs.Entry // 保护继电器
|
|
|
|
TDFJ2_2DQJ *ecs.Entry // 二启动继电器
|
|
|
|
TDFJ2_1DQJF *ecs.Entry // 一启动复示继电器
|
|
|
|
TDFJ2_DBQ *ecs.Entry // 断相保护器
|
|
|
|
TDFJ2_DBJ *ecs.Entry // 定位表示继电器
|
|
|
|
TDFJ2_FBJ *ecs.Entry // 反位表示继电器
|
|
|
|
}
|
|
|
|
|
|
|
|
// 检查空引用,返回空引用字段名称
|
|
|
|
func (te *Zdj9TwoElectronic) CheckNilReference() []string {
|
|
|
|
var nils []string = make([]string, 0)
|
|
|
|
if te.TDC_DCJ == nil {
|
|
|
|
nils = append(nils, "TDC_DCJ")
|
|
|
|
}
|
|
|
|
if te.TDC_FCJ == nil {
|
|
|
|
nils = append(nils, "TDC_FCJ")
|
|
|
|
}
|
|
|
|
if te.TDC_YCJ == nil {
|
|
|
|
nils = append(nils, "TDC_YCJ")
|
|
|
|
}
|
|
|
|
if te.TDC_ZDBJ == nil {
|
|
|
|
nils = append(nils, "TDC_ZDBJ")
|
|
|
|
}
|
|
|
|
if te.TDC_ZFBJ == nil {
|
|
|
|
nils = append(nils, "TDC_ZFBJ")
|
|
|
|
}
|
|
|
|
// 一机
|
|
|
|
if te.TDFJ1_1DQJ == nil {
|
|
|
|
nils = append(nils, "TDFJ1_1DQJ")
|
|
|
|
}
|
|
|
|
if te.TDFJ1_BHJ == nil {
|
|
|
|
nils = append(nils, "TDFJ1_BHJ")
|
|
|
|
}
|
|
|
|
if te.TDFJ1_2DQJ == nil {
|
|
|
|
nils = append(nils, "TDFJ1_2DQJ")
|
|
|
|
}
|
|
|
|
if te.TDFJ1_1DQJF == nil {
|
|
|
|
nils = append(nils, "TDFJ1_1DQJF")
|
|
|
|
}
|
|
|
|
if te.TDFJ1_DBQ == nil {
|
|
|
|
nils = append(nils, "TDFJ1_DBQ")
|
|
|
|
}
|
|
|
|
if te.TDFJ1_DBJ == nil {
|
|
|
|
nils = append(nils, "TDFJ1_DBJ")
|
|
|
|
}
|
|
|
|
if te.TDFJ1_FBJ == nil {
|
|
|
|
nils = append(nils, "TDFJ1_FBJ")
|
|
|
|
}
|
|
|
|
if te.TDFJ1_QDJ == nil {
|
|
|
|
nils = append(nils, "TDFJ1_QDJ")
|
|
|
|
}
|
|
|
|
if te.TDFJ1_ZBHJ == nil {
|
|
|
|
nils = append(nils, "TDFJ1_ZBHJ")
|
|
|
|
}
|
|
|
|
|
|
|
|
// 二机
|
|
|
|
if te.TDFJ2_1DQJ == nil {
|
|
|
|
nils = append(nils, "TDFJ2_1DQJ")
|
|
|
|
}
|
|
|
|
if te.TDFJ2_BHJ == nil {
|
|
|
|
nils = append(nils, "TDFJ2_BHJ")
|
|
|
|
}
|
|
|
|
if te.TDFJ2_2DQJ == nil {
|
|
|
|
nils = append(nils, "TDFJ2_2DQJ")
|
|
|
|
}
|
|
|
|
if te.TDFJ2_1DQJF == nil {
|
|
|
|
nils = append(nils, "TDFJ2_1DQJF")
|
|
|
|
}
|
|
|
|
if te.TDFJ2_DBQ == nil {
|
|
|
|
nils = append(nils, "TDFJ2_DBQ")
|
|
|
|
}
|
|
|
|
if te.TDFJ2_DBJ == nil {
|
|
|
|
nils = append(nils, "TDFJ2_DBJ")
|
|
|
|
}
|
|
|
|
if te.TDFJ2_FBJ == nil {
|
|
|
|
nils = append(nils, "TDFJ2_FBJ")
|
|
|
|
}
|
|
|
|
return nils
|
|
|
|
}
|
|
|
|
|
|
|
|
// 是否有空引用
|
|
|
|
func (te *Zdj9TwoElectronic) HasNilReference() bool {
|
|
|
|
nils := te.CheckNilReference()
|
|
|
|
return len(nils) > 0
|
|
|
|
}
|