This commit is contained in:
walker 2023-10-09 11:19:40 +08:00
commit 6592c42a0c
25 changed files with 1059 additions and 46 deletions

40
component/signal_3xh1.go Normal file
View File

@ -0,0 +1,40 @@
package component
import "joylink.club/ecs"
// Signal3XH1Electronic 电路状态信号机3XH-1(红-绿-黄) 道岔防护信号机(三显示不封灯,有单黄显示、带引导)
type Signal3XH1Electronic struct {
// 点灯继电器true-吸合,常态落下表示逻辑点灯
Z3XH1_DDJ *ecs.Entry
//2DJ灯丝继电器true-吸合
Z3XH1_2DJ *ecs.Entry
//灯丝继电器true-吸合
Z3XH1_DJ *ecs.Entry
//列车信号继电器true-吸合
Z3XH1_LXJ *ecs.Entry
//引导信号继电器true-吸合
Z3XH1_YXJ *ecs.Entry
//开通正线信号继电器true-吸合
Z3XH1_ZXJ *ecs.Entry
}
// Signal3XH1Filament 信号机3XH-1 灯丝状态
type Signal3XH1Filament struct {
// 物理黄灯true-灯丝正常
Uf bool
// 物理绿灯true-灯丝正常
Lf bool
// 物理红灯true-灯丝正常
Hf bool
// 物理黄灯true-亮
U bool
// 物理绿灯true-亮
L bool
// 物理红灯true-亮
H bool
}
var (
Signal3XH1ElectronicType = ecs.NewComponentType[Signal3XH1Electronic]()
Signal3XH1FilamentType = ecs.NewComponentType[Signal3XH1Filament]()
)

39
component/signal_3xh2.go Normal file
View File

@ -0,0 +1,39 @@
package component
import "joylink.club/ecs"
// Signal3XH2Electronic 电路状态信号机3XH-2(红-绿-黄) 道岔防护信号机(三显示不封灯、无单黄显示、带引导)
// 引导信号:红黄
type Signal3XH2Electronic struct {
// 点灯继电器true-吸合,常态落下表示逻辑点灯
Z3XH2_DDJ *ecs.Entry
//2DJ灯丝继电器true-吸合
Z3XH2_2DJ *ecs.Entry
//灯丝继电器true-吸合
Z3XH2_DJ *ecs.Entry
//列车信号继电器true-吸合
Z3XH2_LXJ *ecs.Entry
//引导信号继电器true-吸合
Z3XH2_YXJ *ecs.Entry
}
// Signal3XH2Filament 信号机3XH-2 灯丝状态
type Signal3XH2Filament struct {
// 物理黄灯true-灯丝正常
Uf bool
// 物理绿灯true-灯丝正常
Lf bool
// 物理红灯true-灯丝正常
Hf bool
// 物理黄灯true-亮
U bool
// 物理绿灯true-亮
L bool
// 物理红灯true-亮
H bool
}
var (
Signal3XH2ElectronicType = ecs.NewComponentType[Signal3XH2Electronic]()
Signal3XH2FilamentType = ecs.NewComponentType[Signal3XH2Filament]()
)

35
component/signal_3xh3.go Normal file
View File

@ -0,0 +1,35 @@
package component
import "joylink.club/ecs"
// Signal3XH3Electronic 电路状态信号机3XH-3(红-绿-黄) 道岔防护信号机(三显示封绿灯、有单黄显示、带引导)
// 引导信号:红黄
type Signal3XH3Electronic struct {
// 点灯继电器true-吸合,常态落下表示逻辑点灯
Z3XH3_DDJ *ecs.Entry
//2DJ灯丝继电器true-吸合
Z3XH3_2DJ *ecs.Entry
//灯丝继电器true-吸合
Z3XH3_DJ *ecs.Entry
//列车信号继电器true-吸合
Z3XH3_LXJ *ecs.Entry
//引导信号继电器true-吸合
Z3XH3_YXJ *ecs.Entry
}
// Signal3XH3Filament 信号机3XH-3 灯丝状态
type Signal3XH3Filament struct {
// 物理黄灯true-灯丝正常
Uf bool
// 物理红灯true-灯丝正常
Hf bool
// 物理黄灯true-亮
U bool
// 物理红灯true-亮
H bool
}
var (
Signal3XH3ElectronicType = ecs.NewComponentType[Signal3XH3Electronic]()
Signal3XH3FilamentType = ecs.NewComponentType[Signal3XH3Filament]()
)

36
component/signal_3xh4.go Normal file
View File

@ -0,0 +1,36 @@
package component
import "joylink.club/ecs"
// Signal3XH4Electronic 电路状态信号机3XH-4(红-绿-黄) 出站兼道岔防护信号机(三显示不封灯、有单黄显示、无引导)
type Signal3XH4Electronic struct {
// 点灯继电器true-吸合,常态落下表示逻辑点灯
Z3XH4_DDJ *ecs.Entry
//灯丝继电器true-吸合
Z3XH4_DJ *ecs.Entry
//列车信号继电器true-吸合
Z3XH4_LXJ *ecs.Entry
//开通正线信号继电器true-吸合
Z3XH4_ZXJ *ecs.Entry
}
// Signal3XH4Filament 信号机3XH-4 灯丝状态
type Signal3XH4Filament struct {
// 物理黄灯true-灯丝正常
Uf bool
// 物理绿灯true-灯丝正常
Lf bool
// 物理红灯true-灯丝正常
Hf bool
// 物理黄灯true-亮
U bool
// 物理绿灯true-亮
L bool
// 物理红灯true-亮
H bool
}
var (
Signal3XH4ElectronicType = ecs.NewComponentType[Signal3XH4Electronic]()
Signal3XH4FilamentType = ecs.NewComponentType[Signal3XH4Filament]()
)

28
component/signal_dcxh.go Normal file
View File

@ -0,0 +1,28 @@
package component
import "joylink.club/ecs"
// SignalDCXHElectronic 电路状态信号机DCXH(蓝-白) 调车信号机
type SignalDCXHElectronic struct {
//灯丝继电器true-吸合
DCXH_DJ *ecs.Entry
//调车信号继电器true-吸合
DCXH_DXJ *ecs.Entry
}
// SignalDCXHFilament 信号机DCXH 灯丝状态
type SignalDCXHFilament struct {
// 物理白灯true-灯丝正常
Bf bool
// 物理蓝灯true-灯丝正常
Af bool
// 物理白灯true-亮
B bool
// 物理蓝灯true-亮
A bool
}
var (
SignalDCXHElectronicType = ecs.NewComponentType[SignalDCXHElectronic]()
SignalDCXHFilamentType = ecs.NewComponentType[SignalDCXHFilament]()
)

34
component/signal_jckxh.go Normal file
View File

@ -0,0 +1,34 @@
package component
import "joylink.club/ecs"
// SignalJCKXHElectronic 电路状态信号机JCKXH(红-白-黄) 进/出库列车兼调车信号机(三显示不封灯、有单黄显示、无引导)
type SignalJCKXHElectronic struct {
//灯丝继电器true-吸合
JCKXH_DJ *ecs.Entry
//调车信号继电器true-吸合
JCKXH_DXJ *ecs.Entry
//列车信号继电器true-吸合
JCKXH_LXJ *ecs.Entry
}
// SignalJCKXHFilament 信号机JCKXH 灯丝状态
type SignalJCKXHFilament struct {
// 物理黄灯true-灯丝正常
Uf bool
// 物理白灯true-灯丝正常
Bf bool
// 物理红灯true-灯丝正常
Hf bool
// 物理黄灯true-亮
U bool
// 物理白灯true-亮
B bool
// 物理红灯true-亮
H bool
}
var (
SignalJCKXHElectronicType = ecs.NewComponentType[SignalJCKXHElectronic]()
SignalJCKXHFilamentType = ecs.NewComponentType[SignalJCKXHFilament]()
)

36
component/signal_jdxh.go Normal file
View File

@ -0,0 +1,36 @@
package component
import "joylink.club/ecs"
// SignalJDXHElectronic 电路状态信号机JDXH(红-绿-黄) 进段信号机(三显示不封灯、无单黄显示、带引导)
type SignalJDXHElectronic struct {
// 2DJ灯丝继电器true-吸合
JDXH_2DJ *ecs.Entry
//灯丝继电器true-吸合
JDXH_DJ *ecs.Entry
//列车信号继电器true-吸合
JDXH_LXJ *ecs.Entry
//引导信号继电器true-吸合
JDXH_YXJ *ecs.Entry
}
// SignalJDXHFilament 信号机JDXH 灯丝状态
type SignalJDXHFilament struct {
// 物理黄灯true-灯丝正常
Uf bool
// 物理绿灯true-灯丝正常
Lf bool
// 物理红灯true-灯丝正常
Hf bool
// 物理黄灯true-亮
U bool
// 物理绿灯true-亮
L bool
// 物理红灯true-亮
H bool
}
var (
SignalJDXHElectronicType = ecs.NewComponentType[SignalJDXHElectronic]()
SignalJDXHFilamentType = ecs.NewComponentType[SignalJDXHFilament]()
)

View File

@ -20,14 +20,37 @@ func LoadSignals(w ecs.World) error {
//
switch group.Code() {
case consts.SIGNAL_2XH1:
loadSignal2xh1(w, signal, signalEntry, elecs, data.EntityMap)
if le := loadSignal2xh1(w, signal, signalEntry, elecs, data.EntityMap); le != nil {
return le
}
case consts.SIGNAL_3XH1:
if le := loadSignal3xh1(w, signal, signalEntry, elecs, data.EntityMap); le != nil {
return le
}
case consts.SIGNAL_3XH2:
if le := loadSignal3xh2(w, signal, signalEntry, elecs, data.EntityMap); le != nil {
return le
}
case consts.SIGNAL_3XH3:
if le := loadSignal3xh3(w, signal, signalEntry, elecs, data.EntityMap); le != nil {
return le
}
case consts.SIGNAL_3XH4:
if le := loadSignal3xh4(w, signal, signalEntry, elecs, data.EntityMap); le != nil {
return le
}
case consts.SIGNAL_JDXH:
if le := loadSignalJdxh(w, signal, signalEntry, elecs, data.EntityMap); le != nil {
return le
}
case consts.SIGNAL_DCXH:
if le := loadSignalDcxh(w, signal, signalEntry, elecs, data.EntityMap); le != nil {
return le
}
case consts.SIGNAL_JCKXH:
if le := loadSignalJckxh(w, signal, signalEntry, elecs, data.EntityMap); le != nil {
return le
}
default:
return fmt.Errorf("id=[%s]的信号机,无效组合类型[%s]", signal.Id(), group.Code())
}

View File

@ -35,43 +35,3 @@ func loadSignal2xh1(w ecs.World, signal *repository.Signal, signalEntry *ecs.Ent
}
return nil
}
// InitSignal2XH1CdcState 出段(场)信号机初始化
func InitSignal2XH1CdcState(signalEntry *ecs.Entry) {
filament := component.Signal2XH1FilamentType.Get(signalEntry)
filament.Lf = true
filament.Hf = true
filament.L = false
filament.H = true
//
state := component.Signal2XH1ElectronicType.Get(signalEntry)
ddj := component.RelayDriveType.Get(state.Z2XH1_DDJ)
ddj.Td = false
ddj.Xq = false
dj := component.RelayDriveType.Get(state.Z2XH1_DJ)
dj.Td = true
dj.Xq = true
lxj := component.RelayDriveType.Get(state.Z2XH1_LXJ)
lxj.Td = true
lxj.Xq = true
}
// InitSignal2XH1CzqzState 出站区间阻挡信号机初始化
func InitSignal2XH1CzqzState(signalEntry *ecs.Entry) {
filament := component.Signal2XH1FilamentType.Get(signalEntry)
filament.Lf = true
filament.Hf = true
filament.L = false
filament.H = false
//
state := component.Signal2XH1ElectronicType.Get(signalEntry)
ddj := component.RelayDriveType.Get(state.Z2XH1_DDJ)
ddj.Td = true
ddj.Xq = true
dj := component.RelayDriveType.Get(state.Z2XH1_DJ)
dj.Td = false
dj.Xq = false
lxj := component.RelayDriveType.Get(state.Z2XH1_LXJ)
lxj.Td = false
lxj.Xq = false
}

43
entity/signal_3xh1.go Normal file
View File

@ -0,0 +1,43 @@
package entity
import (
"fmt"
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/consts"
"joylink.club/rtsssimulation/repository"
)
func loadSignal3xh1(w ecs.World, signal *repository.Signal, signalEntry *ecs.Entry, elecs []repository.IGroupedElectronicComponent, entityMap map[string]*ecs.Entry) error {
if len(elecs) == 6 { //3xh1组合类型包含6个继电器
signalEntry.AddComponent(component.Signal3XH1ElectronicType)
signalEntry.AddComponent(component.Signal3XH1FilamentType)
//
elecState := &component.Signal3XH1Electronic{}
for _, elec := range elecs {
switch elec.Code() {
case consts.SIGNAL_DDJ:
elecState.Z3XH1_DDJ = NewRelayEntity(w, elec.(*repository.Relay), entityMap)
case consts.SIGNAL_2DJ:
elecState.Z3XH1_2DJ = NewRelayEntity(w, elec.(*repository.Relay), entityMap)
case consts.SIGNAL_DJ:
elecState.Z3XH1_DJ = NewRelayEntity(w, elec.(*repository.Relay), entityMap)
case consts.SIGNAL_LXJ:
elecState.Z3XH1_LXJ = NewRelayEntity(w, elec.(*repository.Relay), entityMap)
case consts.SIGNAL_YXJ:
elecState.Z3XH1_YXJ = NewRelayEntity(w, elec.(*repository.Relay), entityMap)
case consts.SIGNAL_ZXJ:
elecState.Z3XH1_ZXJ = NewRelayEntity(w, elec.(*repository.Relay), entityMap)
default:
return fmt.Errorf("id=[%s]的信号机3xh1无效电子元器件名称[%s]", signal.Id(), elec.Code())
}
}
//
component.Signal3XH1ElectronicType.Set(signalEntry, elecState)
component.Signal3XH1FilamentType.Set(signalEntry, &component.Signal3XH1Filament{Uf: true, Lf: true, Hf: true, U: false, L: false, H: false})
} else {
return fmt.Errorf("id=[%s]的信号机3xh1电子元器件数量须为6", signal.Id())
}
return nil
}

41
entity/signal_3xh2.go Normal file
View File

@ -0,0 +1,41 @@
package entity
import (
"fmt"
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/consts"
"joylink.club/rtsssimulation/repository"
)
func loadSignal3xh2(w ecs.World, signal *repository.Signal, signalEntry *ecs.Entry, elecs []repository.IGroupedElectronicComponent, entityMap map[string]*ecs.Entry) error {
if len(elecs) == 5 { //3xh2组合类型包含5个继电器
signalEntry.AddComponent(component.Signal3XH2ElectronicType)
signalEntry.AddComponent(component.Signal3XH2FilamentType)
//
elecState := &component.Signal3XH2Electronic{}
for _, elec := range elecs {
switch elec.Code() {
case consts.SIGNAL_DDJ:
elecState.Z3XH2_DDJ = NewRelayEntity(w, elec.(*repository.Relay), entityMap)
case consts.SIGNAL_2DJ:
elecState.Z3XH2_2DJ = NewRelayEntity(w, elec.(*repository.Relay), entityMap)
case consts.SIGNAL_DJ:
elecState.Z3XH2_DJ = NewRelayEntity(w, elec.(*repository.Relay), entityMap)
case consts.SIGNAL_LXJ:
elecState.Z3XH2_LXJ = NewRelayEntity(w, elec.(*repository.Relay), entityMap)
case consts.SIGNAL_YXJ:
elecState.Z3XH2_YXJ = NewRelayEntity(w, elec.(*repository.Relay), entityMap)
default:
return fmt.Errorf("id=[%s]的信号机3xh2无效电子元器件名称[%s]", signal.Id(), elec.Code())
}
}
//
component.Signal3XH2ElectronicType.Set(signalEntry, elecState)
component.Signal3XH2FilamentType.Set(signalEntry, &component.Signal3XH2Filament{Uf: true, Lf: true, Hf: true, U: false, L: false, H: false})
} else {
return fmt.Errorf("id=[%s]的信号机3xh2电子元器件数量须为5", signal.Id())
}
return nil
}

41
entity/signal_3xh3.go Normal file
View File

@ -0,0 +1,41 @@
package entity
import (
"fmt"
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/consts"
"joylink.club/rtsssimulation/repository"
)
func loadSignal3xh3(w ecs.World, signal *repository.Signal, signalEntry *ecs.Entry, elecs []repository.IGroupedElectronicComponent, entityMap map[string]*ecs.Entry) error {
if len(elecs) == 5 { //3xh3组合类型包含5个继电器
signalEntry.AddComponent(component.Signal3XH3ElectronicType)
signalEntry.AddComponent(component.Signal3XH3FilamentType)
//
elecState := &component.Signal3XH3Electronic{}
for _, elec := range elecs {
switch elec.Code() {
case consts.SIGNAL_DDJ:
elecState.Z3XH3_DDJ = NewRelayEntity(w, elec.(*repository.Relay), entityMap)
case consts.SIGNAL_2DJ:
elecState.Z3XH3_2DJ = NewRelayEntity(w, elec.(*repository.Relay), entityMap)
case consts.SIGNAL_DJ:
elecState.Z3XH3_DJ = NewRelayEntity(w, elec.(*repository.Relay), entityMap)
case consts.SIGNAL_LXJ:
elecState.Z3XH3_LXJ = NewRelayEntity(w, elec.(*repository.Relay), entityMap)
case consts.SIGNAL_YXJ:
elecState.Z3XH3_YXJ = NewRelayEntity(w, elec.(*repository.Relay), entityMap)
default:
return fmt.Errorf("id=[%s]的信号机3xh3无效电子元器件名称[%s]", signal.Id(), elec.Code())
}
}
//
component.Signal3XH3ElectronicType.Set(signalEntry, elecState)
component.Signal3XH3FilamentType.Set(signalEntry, &component.Signal3XH3Filament{Uf: true, Hf: true, U: false, H: false})
} else {
return fmt.Errorf("id=[%s]的信号机3xh3电子元器件数量须为5", signal.Id())
}
return nil
}

39
entity/signal_3xh4.go Normal file
View File

@ -0,0 +1,39 @@
package entity
import (
"fmt"
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/consts"
"joylink.club/rtsssimulation/repository"
)
func loadSignal3xh4(w ecs.World, signal *repository.Signal, signalEntry *ecs.Entry, elecs []repository.IGroupedElectronicComponent, entityMap map[string]*ecs.Entry) error {
if len(elecs) == 4 { //3xh4组合类型包含4个继电器
signalEntry.AddComponent(component.Signal3XH4ElectronicType)
signalEntry.AddComponent(component.Signal3XH4FilamentType)
//
elecState := &component.Signal3XH4Electronic{}
for _, elec := range elecs {
switch elec.Code() {
case consts.SIGNAL_DDJ:
elecState.Z3XH4_DDJ = NewRelayEntity(w, elec.(*repository.Relay), entityMap)
case consts.SIGNAL_DJ:
elecState.Z3XH4_DJ = NewRelayEntity(w, elec.(*repository.Relay), entityMap)
case consts.SIGNAL_LXJ:
elecState.Z3XH4_LXJ = NewRelayEntity(w, elec.(*repository.Relay), entityMap)
case consts.SIGNAL_ZXJ:
elecState.Z3XH4_ZXJ = NewRelayEntity(w, elec.(*repository.Relay), entityMap)
default:
return fmt.Errorf("id=[%s]的信号机3xh4无效电子元器件名称[%s]", signal.Id(), elec.Code())
}
}
//
component.Signal3XH4ElectronicType.Set(signalEntry, elecState)
component.Signal3XH4FilamentType.Set(signalEntry, &component.Signal3XH4Filament{Uf: true, Lf: true, Hf: true, U: false, L: false, H: false})
} else {
return fmt.Errorf("id=[%s]的信号机3xh4电子元器件数量须为4", signal.Id())
}
return nil
}

35
entity/signal_dcxh.go Normal file
View File

@ -0,0 +1,35 @@
package entity
import (
"fmt"
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/consts"
"joylink.club/rtsssimulation/repository"
)
func loadSignalDcxh(w ecs.World, signal *repository.Signal, signalEntry *ecs.Entry, elecs []repository.IGroupedElectronicComponent, entityMap map[string]*ecs.Entry) error {
if len(elecs) == 2 { //dcxh组合类型包含2个继电器
signalEntry.AddComponent(component.SignalDCXHElectronicType)
signalEntry.AddComponent(component.SignalDCXHFilamentType)
//
elecState := &component.SignalDCXHElectronic{}
for _, elec := range elecs {
switch elec.Code() {
case consts.SIGNAL_DJ:
elecState.DCXH_DJ = NewRelayEntity(w, elec.(*repository.Relay), entityMap)
case consts.SIGNAL_DXJ:
elecState.DCXH_DXJ = NewRelayEntity(w, elec.(*repository.Relay), entityMap)
default:
return fmt.Errorf("id=[%s]的信号机dcxh无效电子元器件名称[%s]", signal.Id(), elec.Code())
}
}
//
component.SignalDCXHElectronicType.Set(signalEntry, elecState)
component.SignalDCXHFilamentType.Set(signalEntry, &component.SignalDCXHFilament{Bf: true, Af: true, B: false, A: false})
} else {
return fmt.Errorf("id=[%s]的信号机dcxh电子元器件数量须为2", signal.Id())
}
return nil
}

37
entity/signal_jckxh.go Normal file
View File

@ -0,0 +1,37 @@
package entity
import (
"fmt"
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/consts"
"joylink.club/rtsssimulation/repository"
)
func loadSignalJckxh(w ecs.World, signal *repository.Signal, signalEntry *ecs.Entry, elecs []repository.IGroupedElectronicComponent, entityMap map[string]*ecs.Entry) error {
if len(elecs) == 3 { //jckxh组合类型包含3个继电器
signalEntry.AddComponent(component.SignalJCKXHElectronicType)
signalEntry.AddComponent(component.SignalJCKXHFilamentType)
//
elecState := &component.SignalJCKXHElectronic{}
for _, elec := range elecs {
switch elec.Code() {
case consts.SIGNAL_DJ:
elecState.JCKXH_DJ = NewRelayEntity(w, elec.(*repository.Relay), entityMap)
case consts.SIGNAL_DXJ:
elecState.JCKXH_DXJ = NewRelayEntity(w, elec.(*repository.Relay), entityMap)
case consts.SIGNAL_LXJ:
elecState.JCKXH_LXJ = NewRelayEntity(w, elec.(*repository.Relay), entityMap)
default:
return fmt.Errorf("id=[%s]的信号机jckxh无效电子元器件名称[%s]", signal.Id(), elec.Code())
}
}
//
component.SignalJCKXHElectronicType.Set(signalEntry, elecState)
component.SignalJCKXHFilamentType.Set(signalEntry, &component.SignalJCKXHFilament{Uf: true, Bf: true, Hf: true, U: false, B: false, H: false})
} else {
return fmt.Errorf("id=[%s]的信号机jckxh电子元器件数量须为3", signal.Id())
}
return nil
}

39
entity/signal_jdxh.go Normal file
View File

@ -0,0 +1,39 @@
package entity
import (
"fmt"
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/consts"
"joylink.club/rtsssimulation/repository"
)
func loadSignalJdxh(w ecs.World, signal *repository.Signal, signalEntry *ecs.Entry, elecs []repository.IGroupedElectronicComponent, entityMap map[string]*ecs.Entry) error {
if len(elecs) == 4 { //jdxh组合类型包含3个继电器
signalEntry.AddComponent(component.SignalJDXHElectronicType)
signalEntry.AddComponent(component.SignalJDXHFilamentType)
//
elecState := &component.SignalJDXHElectronic{}
for _, elec := range elecs {
switch elec.Code() {
case consts.SIGNAL_DJ:
elecState.JDXH_DJ = NewRelayEntity(w, elec.(*repository.Relay), entityMap)
case consts.SIGNAL_2DJ:
elecState.JDXH_2DJ = NewRelayEntity(w, elec.(*repository.Relay), entityMap)
case consts.SIGNAL_LXJ:
elecState.JDXH_LXJ = NewRelayEntity(w, elec.(*repository.Relay), entityMap)
case consts.SIGNAL_YXJ:
elecState.JDXH_YXJ = NewRelayEntity(w, elec.(*repository.Relay), entityMap)
default:
return fmt.Errorf("id=[%s]的信号机jdxh无效电子元器件名称[%s]", signal.Id(), elec.Code())
}
}
//
component.SignalJDXHElectronicType.Set(signalEntry, elecState)
component.SignalJDXHFilamentType.Set(signalEntry, &component.SignalJDXHFilament{Uf: true, Lf: true, Hf: true, U: false, L: false, H: false})
} else {
return fmt.Errorf("id=[%s]的信号机jdxh电子元器件数量须为4", signal.Id())
}
return nil
}

View File

@ -10,8 +10,19 @@ import (
// 添加系统到World
func BindSystem(w ecs.World) {
w.AddSystem(NewWorldTimeSys(),
common_sys.NewCounterDownSys(), common_sys.NewTwoPositionMovementSys(),
device_sys.NewRelaySys(), device_sys.NewDBQSys(), device_sys.NewZzjSys(),
common_sys.NewCounterDownSys(),
common_sys.NewTwoPositionMovementSys(),
device_sys.NewRelaySys(),
device_sys.NewDBQSys(),
device_sys.NewZzjSys(),
device_sys.NewTurnoutSys(),
circuit_sys.NewZdj9TwoDragSys())
circuit_sys.NewZdj9TwoDragSys(),
circuit_sys.NewSignal2XH1System(),
circuit_sys.NewSignal3XH1System(),
circuit_sys.NewSignal3XH2System(),
circuit_sys.NewSignal3XH3System(),
circuit_sys.NewSignal3XH4System(),
circuit_sys.NewSignalDCXHSystem(),
circuit_sys.NewSignalJCKXHSystem(),
circuit_sys.NewSignalJDXHSystem())
}

View File

@ -21,7 +21,7 @@ func (s *Signal2XH1System) Update(w ecs.World) {
filament := component.Signal2XH1FilamentType.Get(entry)
s.calculateL(state, filament)
s.calculateH(state, filament)
s.calculateDJ(w, entry, state, filament)
s.calculateDJ(state, filament)
})
}
@ -37,7 +37,7 @@ func (s *Signal2XH1System) calculateH(state *component.Signal2XH1Electronic, fil
isH := !ddj.Val && !lxj.Val && filament.Hf
filament.H = isH
}
func (s *Signal2XH1System) calculateDJ(w ecs.World, e *ecs.Entry, state *component.Signal2XH1Electronic, filament *component.Signal2XH1Filament) {
func (s *Signal2XH1System) calculateDJ(state *component.Signal2XH1Electronic, filament *component.Signal2XH1Filament) {
ddj := component.BitStateType.Get(state.Z2XH1_DDJ)
lxj := component.BitStateType.Get(state.Z2XH1_LXJ)
dj := component.BitStateType.Get(state.Z2XH1_DJ)

View File

@ -0,0 +1,100 @@
package circuit_sys
import (
"github.com/yohamta/donburi/filter"
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
)
type Signal3XH1System struct {
query *ecs.Query
}
func NewSignal3XH1System() *Signal3XH1System {
return &Signal3XH1System{query: ecs.NewQuery(filter.Contains(component.Signal3XH1ElectronicType, component.Signal3XH1FilamentType))}
}
// Update world 执行
func (s *Signal3XH1System) Update(w ecs.World) {
s.query.Each(w, func(e *ecs.Entry) {
signal3XH1State := component.Signal3XH1ElectronicType.Get(e)
filament := component.Signal3XH1FilamentType.Get(e)
//
s.calculateU(signal3XH1State, filament)
s.calculateL(signal3XH1State, filament)
s.calculateH(signal3XH1State, filament)
s.calculateDJ(signal3XH1State, filament)
s.calculate2DJ(signal3XH1State, filament)
})
}
// 黄灯点灯电路
// 开放引导信号,黄灯亮且红灯亮
// 开放列车信号且开通侧向,只黄灯亮
func (s *Signal3XH1System) calculateU(state *component.Signal3XH1Electronic, filament *component.Signal3XH1Filament) {
ddj := component.BitStateType.Get(state.Z3XH1_DDJ)
lxj := component.BitStateType.Get(state.Z3XH1_LXJ)
dj := component.BitStateType.Get(state.Z3XH1_DJ)
yxj := component.BitStateType.Get(state.Z3XH1_YXJ)
zxj := component.BitStateType.Get(state.Z3XH1_ZXJ)
//引导信号
isY := !ddj.Val && !lxj.Val && dj.Val && yxj.Val
//侧向行车信号
isLC := !ddj.Val && lxj.Val && !zxj.Val
filament.U = filament.Uf && (isY || isLC)
}
// 绿灯点灯电路
// 开放正线行车信号,只亮绿灯
func (s *Signal3XH1System) calculateL(state *component.Signal3XH1Electronic, filament *component.Signal3XH1Filament) {
ddj := component.BitStateType.Get(state.Z3XH1_DDJ)
lxj := component.BitStateType.Get(state.Z3XH1_LXJ)
zxj := component.BitStateType.Get(state.Z3XH1_ZXJ)
isL := !ddj.Val && lxj.Val && zxj.Val
filament.L = filament.Lf && isL
}
// 红灯点灯电路
// 列车信号禁止时,亮红灯
func (s *Signal3XH1System) calculateH(state *component.Signal3XH1Electronic, filament *component.Signal3XH1Filament) {
ddj := component.BitStateType.Get(state.Z3XH1_DDJ)
lxj := component.BitStateType.Get(state.Z3XH1_LXJ)
isH := !ddj.Val && !lxj.Val
filament.H = filament.Hf && isH
}
// DJ 灯丝继电器电路
func (s *Signal3XH1System) calculateDJ(state *component.Signal3XH1Electronic, filament *component.Signal3XH1Filament) {
ddj := component.BitStateType.Get(state.Z3XH1_DDJ)
lxj := component.BitStateType.Get(state.Z3XH1_LXJ)
dj := component.BitStateType.Get(state.Z3XH1_DJ)
zxj := component.BitStateType.Get(state.Z3XH1_ZXJ)
_DJ := dj.Val
isDj := filament.Lf && !ddj.Val && lxj.Val && zxj.Val ||
filament.Uf && !ddj.Val && lxj.Val && !zxj.Val ||
filament.Hf && !ddj.Val && !lxj.Val
//通知继电器进行动作
if _DJ != isDj {
drive := component.RelayDriveType.Get(state.Z3XH1_DJ)
drive.Td = isDj
drive.Xq = isDj
}
}
// 2DJ 灯丝继电器电路
func (s *Signal3XH1System) calculate2DJ(state *component.Signal3XH1Electronic, filament *component.Signal3XH1Filament) {
ddj := component.BitStateType.Get(state.Z3XH1_DDJ)
lxj := component.BitStateType.Get(state.Z3XH1_LXJ)
dj := component.BitStateType.Get(state.Z3XH1_DJ)
yxj := component.BitStateType.Get(state.Z3XH1_YXJ)
edj := component.BitStateType.Get(state.Z3XH1_2DJ)
_2DJ := edj.Val
//
is2DJ := filament.Uf && !ddj.Val && !lxj.Val && dj.Val && yxj.Val
//通知继电器进行动作
if _2DJ != is2DJ {
drive := component.RelayDriveType.Get(state.Z3XH1_2DJ)
drive.Td = is2DJ
drive.Xq = is2DJ
}
}

View File

@ -0,0 +1,79 @@
package circuit_sys
import (
"github.com/yohamta/donburi/filter"
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
)
type Signal3XH2System struct {
query *ecs.Query
}
func NewSignal3XH2System() *Signal3XH2System {
return &Signal3XH2System{query: ecs.NewQuery(filter.Contains(component.Signal3XH2ElectronicType, component.Signal3XH2FilamentType))}
}
// Update world 执行
func (s *Signal3XH2System) Update(w ecs.World) {
s.query.Each(w, func(e *ecs.Entry) {
state := component.Signal3XH2ElectronicType.Get(e)
filament := component.Signal3XH2FilamentType.Get(e)
s.calculateU(state, filament)
s.calculateL(state, filament)
s.calculateH(state, filament)
s.calculateDJ(state, filament)
s.calculate2DJ(state, filament)
})
}
func (s *Signal3XH2System) calculateU(state *component.Signal3XH2Electronic, filament *component.Signal3XH2Filament) {
ddj := component.BitStateType.Get(state.Z3XH2_DDJ)
lxj := component.BitStateType.Get(state.Z3XH2_LXJ)
dj := component.BitStateType.Get(state.Z3XH2_DJ)
yxj := component.BitStateType.Get(state.Z3XH2_YXJ)
isU := filament.Uf && !ddj.Val && !lxj.Val && dj.Val && yxj.Val
filament.U = isU
}
func (s *Signal3XH2System) calculateL(state *component.Signal3XH2Electronic, filament *component.Signal3XH2Filament) {
ddj := component.BitStateType.Get(state.Z3XH2_DDJ)
lxj := component.BitStateType.Get(state.Z3XH2_LXJ)
isL := filament.Lf && !ddj.Val && lxj.Val
filament.L = isL
}
func (s *Signal3XH2System) calculateH(state *component.Signal3XH2Electronic, filament *component.Signal3XH2Filament) {
ddj := component.BitStateType.Get(state.Z3XH2_DDJ)
lxj := component.BitStateType.Get(state.Z3XH2_LXJ)
isH := filament.Hf && !ddj.Val && !lxj.Val
filament.H = isH
}
func (s *Signal3XH2System) calculateDJ(state *component.Signal3XH2Electronic, filament *component.Signal3XH2Filament) {
ddj := component.BitStateType.Get(state.Z3XH2_DDJ)
lxj := component.BitStateType.Get(state.Z3XH2_LXJ)
dj := component.BitStateType.Get(state.Z3XH2_DJ)
isDJ := filament.Lf && !ddj.Val && lxj.Val || filament.Hf && !ddj.Val && !lxj.Val
//通知继电器进行动作
if isDJ != dj.Val {
drive := component.RelayDriveType.Get(state.Z3XH2_DJ)
drive.Td = isDJ
drive.Xq = isDJ
}
}
func (s *Signal3XH2System) calculate2DJ(state *component.Signal3XH2Electronic, filament *component.Signal3XH2Filament) {
ddj := component.BitStateType.Get(state.Z3XH2_DDJ)
lxj := component.BitStateType.Get(state.Z3XH2_LXJ)
dj := component.BitStateType.Get(state.Z3XH2_DJ)
yxj := component.BitStateType.Get(state.Z3XH2_YXJ)
edj := component.BitStateType.Get(state.Z3XH2_2DJ)
is2DJ := filament.Uf && !ddj.Val && !lxj.Val && dj.Val && yxj.Val
//通知继电器进行动作
if is2DJ != edj.Val {
drive := component.RelayDriveType.Get(state.Z3XH2_2DJ)
drive.Td = is2DJ
drive.Xq = is2DJ
}
}

View File

@ -0,0 +1,68 @@
package circuit_sys
import (
"github.com/yohamta/donburi/filter"
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
)
type Signal3XH3System struct {
query *ecs.Query
}
func NewSignal3XH3System() *Signal3XH3System {
return &Signal3XH3System{query: ecs.NewQuery(filter.Contains(component.Signal3XH3ElectronicType, component.Signal3XH3FilamentType))}
}
// Update world 执行
func (s *Signal3XH3System) Update(w ecs.World) {
s.query.Each(w, func(e *ecs.Entry) {
state := component.Signal3XH3ElectronicType.Get(e)
filament := component.Signal3XH3FilamentType.Get(e)
//
s.calculateU(w, state, filament)
s.calculateH(w, state, filament)
s.calculateDJ(w, e, state, filament)
s.calculate2DJ(w, e, state, filament)
})
}
func (s *Signal3XH3System) calculateU(w ecs.World, state *component.Signal3XH3Electronic, filament *component.Signal3XH3Filament) {
ddj := component.BitStateType.Get(state.Z3XH3_DDJ)
lxj := component.BitStateType.Get(state.Z3XH3_LXJ)
dj := component.BitStateType.Get(state.Z3XH3_DJ)
yxj := component.BitStateType.Get(state.Z3XH3_YXJ)
isU := filament.Uf && (!ddj.Val && !lxj.Val && dj.Val && yxj.Val || !ddj.Val && lxj.Val)
filament.U = isU
}
func (s *Signal3XH3System) calculateH(w ecs.World, state *component.Signal3XH3Electronic, filament *component.Signal3XH3Filament) {
ddj := component.BitStateType.Get(state.Z3XH3_DDJ)
lxj := component.BitStateType.Get(state.Z3XH3_LXJ)
isH := filament.Hf && !ddj.Val && !lxj.Val
filament.H = isH
}
func (s *Signal3XH3System) calculateDJ(w ecs.World, e *ecs.Entry, state *component.Signal3XH3Electronic, filament *component.Signal3XH3Filament) {
ddj := component.BitStateType.Get(state.Z3XH3_DDJ)
lxj := component.BitStateType.Get(state.Z3XH3_LXJ)
dj := component.BitStateType.Get(state.Z3XH3_DJ)
isDJ := filament.Uf && !ddj.Val && lxj.Val || filament.Hf && !ddj.Val && !lxj.Val
if isDJ != dj.Val {
drive := component.RelayDriveType.Get(state.Z3XH3_DJ)
drive.Td = isDJ
drive.Xq = isDJ
}
}
func (s *Signal3XH3System) calculate2DJ(w ecs.World, e *ecs.Entry, state *component.Signal3XH3Electronic, filament *component.Signal3XH3Filament) {
ddj := component.BitStateType.Get(state.Z3XH3_DDJ)
lxj := component.BitStateType.Get(state.Z3XH3_LXJ)
dj := component.BitStateType.Get(state.Z3XH3_DJ)
edj := component.BitStateType.Get(state.Z3XH3_2DJ)
yxj := component.BitStateType.Get(state.Z3XH3_YXJ)
is2DJ := filament.Uf && !ddj.Val && !lxj.Val && dj.Val && yxj.Val
if is2DJ != edj.Val {
drive := component.RelayDriveType.Get(state.Z3XH3_2DJ)
drive.Td = is2DJ
drive.Xq = is2DJ
}
}

View File

@ -0,0 +1,66 @@
package circuit_sys
import (
"github.com/yohamta/donburi/filter"
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
)
type Signal3XH4System struct {
query *ecs.Query
}
func NewSignal3XH4System() *Signal3XH4System {
return &Signal3XH4System{query: ecs.NewQuery(filter.Contains(component.Signal3XH4ElectronicType, component.Signal3XH4FilamentType))}
}
// Update world 执行
func (s *Signal3XH4System) Update(w ecs.World) {
s.query.Each(w, func(e *ecs.Entry) {
state := component.Signal3XH4ElectronicType.Get(e)
filament := component.Signal3XH4FilamentType.Get(e)
//
s.calculateU(state, filament)
s.calculateL(state, filament)
s.calculateH(w, state, filament)
s.calculateDJ(w, e, state, filament)
})
}
func (s *Signal3XH4System) calculateU(state *component.Signal3XH4Electronic, filament *component.Signal3XH4Filament) {
ddj := component.BitStateType.Get(state.Z3XH4_DDJ)
lxj := component.BitStateType.Get(state.Z3XH4_LXJ)
zxj := component.BitStateType.Get(state.Z3XH4_ZXJ)
isU := filament.Uf && !ddj.Val && lxj.Val && !zxj.Val
filament.U = isU
}
func (s *Signal3XH4System) calculateL(state *component.Signal3XH4Electronic, filament *component.Signal3XH4Filament) {
ddj := component.BitStateType.Get(state.Z3XH4_DDJ)
lxj := component.BitStateType.Get(state.Z3XH4_LXJ)
zxj := component.BitStateType.Get(state.Z3XH4_ZXJ)
isL := filament.Lf && !ddj.Val && lxj.Val && zxj.Val
filament.L = isL
}
func (s *Signal3XH4System) calculateH(w ecs.World, state *component.Signal3XH4Electronic, filament *component.Signal3XH4Filament) {
ddj := component.BitStateType.Get(state.Z3XH4_DDJ)
lxj := component.BitStateType.Get(state.Z3XH4_LXJ)
isH := filament.Hf && !ddj.Val && !lxj.Val
filament.H = isH
}
func (s *Signal3XH4System) calculateDJ(w ecs.World, e *ecs.Entry, state *component.Signal3XH4Electronic, filament *component.Signal3XH4Filament) {
ddj := component.BitStateType.Get(state.Z3XH4_DDJ)
dj := component.BitStateType.Get(state.Z3XH4_DJ)
lxj := component.BitStateType.Get(state.Z3XH4_LXJ)
zxj := component.BitStateType.Get(state.Z3XH4_ZXJ)
isDJ := filament.Uf && !ddj.Val && lxj.Val && !zxj.Val ||
filament.Lf && !ddj.Val && lxj.Val && zxj.Val ||
filament.Hf && !ddj.Val && !lxj.Val
if isDJ != dj.Val {
drive := component.RelayDriveType.Get(state.Z3XH4_DJ)
drive.Td = isDJ
drive.Xq = isDJ
}
}

View File

@ -0,0 +1,51 @@
package circuit_sys
import (
"github.com/yohamta/donburi/filter"
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
)
type SignalDCXHSystem struct {
query *ecs.Query
}
func NewSignalDCXHSystem() *SignalDCXHSystem {
return &SignalDCXHSystem{query: ecs.NewQuery(filter.Contains(component.SignalDCXHElectronicType, component.SignalDCXHFilamentType))}
}
// Update world 执行
func (s *SignalDCXHSystem) Update(w ecs.World) {
s.query.Each(w, func(e *ecs.Entry) {
state := component.SignalDCXHElectronicType.Get(e)
filament := component.SignalDCXHFilamentType.Get(e)
//
s.calculateA(state, filament)
s.calculateB(state, filament)
s.calculateDJ(state, filament)
})
}
func (s *SignalDCXHSystem) calculateB(state *component.SignalDCXHElectronic, filament *component.SignalDCXHFilament) {
dxj := component.BitStateType.Get(state.DCXH_DXJ)
isB := filament.Bf && dxj.Val
filament.B = isB
}
func (s *SignalDCXHSystem) calculateA(state *component.SignalDCXHElectronic, filament *component.SignalDCXHFilament) {
dxj := component.BitStateType.Get(state.DCXH_DXJ)
isA := filament.Af && !dxj.Val
filament.A = isA
}
func (s *SignalDCXHSystem) calculateDJ(state *component.SignalDCXHElectronic, filament *component.SignalDCXHFilament) {
dxj := component.BitStateType.Get(state.DCXH_DXJ)
dj := component.BitStateType.Get(state.DCXH_DJ)
isDJ := filament.Bf && dxj.Val || filament.Af && !dxj.Val
if isDJ != dj.Val {
drive := component.RelayDriveType.Get(state.DCXH_DJ)
drive.Td = isDJ
drive.Xq = isDJ
}
}

View File

@ -0,0 +1,60 @@
package circuit_sys
import (
"github.com/yohamta/donburi/filter"
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
)
type SignalJCKXHSystem struct {
query *ecs.Query
}
func NewSignalJCKXHSystem() *SignalJCKXHSystem {
return &SignalJCKXHSystem{query: ecs.NewQuery(filter.Contains(component.SignalJCKXHElectronicType, component.SignalJCKXHFilamentType))}
}
// Update world 执行
func (s *SignalJCKXHSystem) Update(w ecs.World) {
s.query.Each(w, func(e *ecs.Entry) {
state := component.SignalJCKXHElectronicType.Get(e)
filament := component.SignalJCKXHFilamentType.Get(e)
//
s.calculateU(state, filament)
s.calculateB(state, filament)
s.calculateH(state, filament)
s.calculateDJ(state, filament)
})
}
func (s *SignalJCKXHSystem) calculateU(state *component.SignalJCKXHElectronic, filament *component.SignalJCKXHFilament) {
lxj := component.BitStateType.Get(state.JCKXH_LXJ)
isU := filament.Uf && lxj.Val
filament.U = isU
}
func (s *SignalJCKXHSystem) calculateB(state *component.SignalJCKXHElectronic, filament *component.SignalJCKXHFilament) {
lxj := component.BitStateType.Get(state.JCKXH_LXJ)
dxj := component.BitStateType.Get(state.JCKXH_DXJ)
isB := filament.Bf && !lxj.Val && dxj.Val
filament.B = isB
}
func (s *SignalJCKXHSystem) calculateH(state *component.SignalJCKXHElectronic, filament *component.SignalJCKXHFilament) {
lxj := component.BitStateType.Get(state.JCKXH_LXJ)
dxj := component.BitStateType.Get(state.JCKXH_DXJ)
isH := filament.Bf && !lxj.Val && dxj.Val
filament.H = isH
}
func (s *SignalJCKXHSystem) calculateDJ(state *component.SignalJCKXHElectronic, filament *component.SignalJCKXHFilament) {
lxj := component.BitStateType.Get(state.JCKXH_LXJ)
dxj := component.BitStateType.Get(state.JCKXH_DXJ)
dj := component.BitStateType.Get(state.JCKXH_DJ)
isDJ := filament.Uf && lxj.Val || filament.Bf && !lxj.Val && dxj.Val || filament.Bf && !lxj.Val && dxj.Val
if isDJ != dj.Val {
drive := component.RelayDriveType.Get(state.JCKXH_DJ)
drive.Td = isDJ
drive.Xq = isDJ
}
}

View File

@ -0,0 +1,72 @@
package circuit_sys
import (
"github.com/yohamta/donburi/filter"
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
)
type SignalJDXHSystem struct {
query *ecs.Query
}
func NewSignalJDXHSystem() *SignalJDXHSystem {
return &SignalJDXHSystem{query: ecs.NewQuery(filter.Contains(component.SignalJDXHElectronicType, component.SignalJDXHFilamentType))}
}
// Update world 执行
func (s *SignalJDXHSystem) Update(w ecs.World) {
s.query.Each(w, func(e *ecs.Entry) {
state := component.SignalJDXHElectronicType.Get(e)
filament := component.SignalJDXHFilamentType.Get(e)
//
s.calculateL(state, filament)
s.calculateU(state, filament)
s.calculateH(state, filament)
s.calculateDJ(state, filament)
s.calculate2DJ(state, filament)
})
}
func (s *SignalJDXHSystem) calculateU(state *component.SignalJDXHElectronic, filament *component.SignalJDXHFilament) {
lxj := component.BitStateType.Get(state.JDXH_LXJ)
dj := component.BitStateType.Get(state.JDXH_DJ)
yxj := component.BitStateType.Get(state.JDXH_YXJ)
isU := filament.Uf && !lxj.Val && dj.Val && yxj.Val
filament.U = isU
}
func (s *SignalJDXHSystem) calculateL(state *component.SignalJDXHElectronic, filament *component.SignalJDXHFilament) {
lxj := component.BitStateType.Get(state.JDXH_LXJ)
isL := filament.Lf && lxj.Val
filament.L = isL
}
func (s *SignalJDXHSystem) calculateH(state *component.SignalJDXHElectronic, filament *component.SignalJDXHFilament) {
lxj := component.BitStateType.Get(state.JDXH_LXJ)
isH := filament.Hf && !lxj.Val
filament.H = isH
}
func (s *SignalJDXHSystem) calculateDJ(state *component.SignalJDXHElectronic, filament *component.SignalJDXHFilament) {
lxj := component.BitStateType.Get(state.JDXH_LXJ)
dj := component.BitStateType.Get(state.JDXH_DJ)
isDJ := filament.Lf && lxj.Val || filament.Hf && !lxj.Val
if isDJ != dj.Val {
drive := component.RelayDriveType.Get(state.JDXH_DJ)
drive.Td = isDJ
drive.Xq = isDJ
}
}
func (s *SignalJDXHSystem) calculate2DJ(state *component.SignalJDXHElectronic, filament *component.SignalJDXHFilament) {
lxj := component.BitStateType.Get(state.JDXH_LXJ)
dj := component.BitStateType.Get(state.JDXH_DJ)
edj := component.BitStateType.Get(state.JDXH_2DJ)
yxj := component.BitStateType.Get(state.JDXH_YXJ)
is2DJ := filament.Uf && !lxj.Val && dj.Val && yxj.Val
if is2DJ != edj.Val {
drive := component.RelayDriveType.Get(state.JDXH_2DJ)
drive.Td = is2DJ
drive.Xq = is2DJ
}
}