修改屏蔽门ecs逻辑
This commit is contained in:
parent
3ce9306624
commit
9554930705
@ -13,9 +13,10 @@ var PsdCircuitType = ecs.NewComponentType[PsdCircuit]()
|
|||||||
|
|
||||||
type PsdCircuit struct {
|
type PsdCircuit struct {
|
||||||
//屏蔽门驱动继电器
|
//屏蔽门驱动继电器
|
||||||
GMJ *ecs.Entry
|
GMJ *ecs.Entry
|
||||||
KMJ4 *ecs.Entry
|
//KMJ4 *ecs.Entry
|
||||||
KMJ8 *ecs.Entry
|
//KMJ8 *ecs.Entry
|
||||||
|
KMJMap map[int32]*ecs.Entry //开门继电器,k-编组
|
||||||
//屏蔽门表示继电器
|
//屏蔽门表示继电器
|
||||||
MGJ *ecs.Entry
|
MGJ *ecs.Entry
|
||||||
MPLJ *ecs.Entry
|
MPLJ *ecs.Entry
|
||||||
@ -86,10 +87,11 @@ type Mkx struct {
|
|||||||
var PscType = ecs.NewComponentType[Psc]()
|
var PscType = ecs.NewComponentType[Psc]()
|
||||||
|
|
||||||
type Psc struct {
|
type Psc struct {
|
||||||
InterlockKM4 bool
|
//InterlockKM4 bool
|
||||||
InterlockKM8 bool
|
//InterlockKM8 bool
|
||||||
InterlockGM bool
|
InterlockKmGroup map[int32]bool //开门编组。k-编组 v-设置开门
|
||||||
InterlockMPL bool
|
InterlockGM bool
|
||||||
|
InterlockMPL bool
|
||||||
|
|
||||||
MkxKM bool
|
MkxKM bool
|
||||||
MkxGM bool
|
MkxGM bool
|
||||||
|
@ -44,7 +44,7 @@ func loadPsdCircuit(world ecs.World, entry *ecs.Entry, psd *repository.Psd, entr
|
|||||||
if len(psd.ComponentGroups()) == 0 {
|
if len(psd.ComponentGroups()) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
circuit := &component.PsdCircuit{}
|
circuit := &component.PsdCircuit{KMJMap: make(map[int32]*ecs.Entry)}
|
||||||
for _, group := range psd.ComponentGroups() {
|
for _, group := range psd.ComponentGroups() {
|
||||||
for _, ec := range group.Components() {
|
for _, ec := range group.Components() {
|
||||||
relay := ec.(*repository.Relay)
|
relay := ec.(*repository.Relay)
|
||||||
@ -52,9 +52,9 @@ func loadPsdCircuit(world ecs.World, entry *ecs.Entry, psd *repository.Psd, entr
|
|||||||
case "XGMJ", "SGMJ":
|
case "XGMJ", "SGMJ":
|
||||||
circuit.GMJ = NewRelayEntity(world, relay, entryMap)
|
circuit.GMJ = NewRelayEntity(world, relay, entryMap)
|
||||||
case "4XKMJ", "4SKMJ":
|
case "4XKMJ", "4SKMJ":
|
||||||
circuit.KMJ4 = NewRelayEntity(world, relay, entryMap)
|
circuit.KMJMap[4] = NewRelayEntity(world, relay, entryMap)
|
||||||
case "8XKMJ", "8SKMJ":
|
case "8XKMJ", "8SKMJ":
|
||||||
circuit.KMJ8 = NewRelayEntity(world, relay, entryMap)
|
circuit.KMJMap[8] = NewRelayEntity(world, relay, entryMap)
|
||||||
case "XMGJ", "SMGJ":
|
case "XMGJ", "SMGJ":
|
||||||
circuit.MGJ = NewRelayEntity(world, relay, entryMap)
|
circuit.MGJ = NewRelayEntity(world, relay, entryMap)
|
||||||
case "XMPLJ", "SMPLJ":
|
case "XMPLJ", "SMPLJ":
|
||||||
|
170
fi/psd.go
170
fi/psd.go
@ -1,6 +1,7 @@
|
|||||||
package fi
|
package fi
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"joylink.club/ecs"
|
"joylink.club/ecs"
|
||||||
"joylink.club/rtsssimulation/component"
|
"joylink.club/rtsssimulation/component"
|
||||||
@ -8,63 +9,29 @@ import (
|
|||||||
"joylink.club/rtsssimulation/entity"
|
"joylink.club/rtsssimulation/entity"
|
||||||
)
|
)
|
||||||
|
|
||||||
func SetInterlockKm4(world ecs.World, id string) error {
|
func SetInterlockKm(world ecs.World, psdId string, group int32) error {
|
||||||
result := <-ecs.Request[ecs.EmptyType](world, func() ecs.Result[ecs.EmptyType] {
|
result := <-ecs.Request[ecs.EmptyType](world, func() ecs.Result[ecs.EmptyType] {
|
||||||
wd := entity.GetWorldData(world)
|
wd := entity.GetWorldData(world)
|
||||||
entry, ok := wd.EntityMap[id]
|
entry, ok := wd.EntityMap[psdId]
|
||||||
if ok {
|
if ok {
|
||||||
err := setInterlockKm(wd, entry, 4)
|
err := setInterlockKm(wd, entry, group)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ecs.NewErrResult(err)
|
return ecs.NewErrResult(err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return ecs.NewErrResult(fmt.Errorf("未找到id=%s的屏蔽门", id))
|
return ecs.NewErrResult(fmt.Errorf("未找到id=%s的屏蔽门", psdId))
|
||||||
}
|
}
|
||||||
return ecs.NewOkEmptyResult()
|
return ecs.NewOkEmptyResult()
|
||||||
})
|
})
|
||||||
return result.Err
|
return result.Err
|
||||||
}
|
}
|
||||||
|
|
||||||
func CancelInterlockKm4(world ecs.World, id string) error {
|
func CancelInterlockKm(world ecs.World, id string, group int32) error {
|
||||||
result := <-ecs.Request[ecs.EmptyType](world, func() ecs.Result[ecs.EmptyType] {
|
result := <-ecs.Request[ecs.EmptyType](world, func() ecs.Result[ecs.EmptyType] {
|
||||||
wd := entity.GetWorldData(world)
|
wd := entity.GetWorldData(world)
|
||||||
entry, ok := wd.EntityMap[id]
|
entry, ok := wd.EntityMap[id]
|
||||||
if ok {
|
if ok {
|
||||||
err := cancelInterlockKm(wd, entry, 4)
|
err := cancelInterlockKm(wd, entry, group)
|
||||||
if err != nil {
|
|
||||||
return ecs.NewErrResult(err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return ecs.NewErrResult(fmt.Errorf("未找到id=%s的屏蔽门", id))
|
|
||||||
}
|
|
||||||
return ecs.NewOkEmptyResult()
|
|
||||||
})
|
|
||||||
return result.Err
|
|
||||||
}
|
|
||||||
|
|
||||||
func SetInterlockKm8(world ecs.World, id string) error {
|
|
||||||
result := <-ecs.Request[ecs.EmptyType](world, func() ecs.Result[ecs.EmptyType] {
|
|
||||||
wd := entity.GetWorldData(world)
|
|
||||||
entry, ok := wd.EntityMap[id]
|
|
||||||
if ok {
|
|
||||||
err := setInterlockKm(wd, entry, 8)
|
|
||||||
if err != nil {
|
|
||||||
return ecs.NewErrResult(err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return ecs.NewErrResult(fmt.Errorf("未找到id=%s的屏蔽门", id))
|
|
||||||
}
|
|
||||||
return ecs.NewOkEmptyResult()
|
|
||||||
})
|
|
||||||
return result.Err
|
|
||||||
}
|
|
||||||
|
|
||||||
func CancelInterlockKm8(world ecs.World, id string) error {
|
|
||||||
result := <-ecs.Request[ecs.EmptyType](world, func() ecs.Result[ecs.EmptyType] {
|
|
||||||
wd := entity.GetWorldData(world)
|
|
||||||
entry, ok := wd.EntityMap[id]
|
|
||||||
if ok {
|
|
||||||
err := cancelInterlockKm(wd, entry, 8)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ecs.NewErrResult(err)
|
return ecs.NewErrResult(err)
|
||||||
}
|
}
|
||||||
@ -273,45 +240,35 @@ func setQDTC(wd *component.WorldData, psdEntry *ecs.Entry) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 设置联锁开门
|
// 设置联锁开门
|
||||||
func setInterlockKm(wd *component.WorldData, psdEntry *ecs.Entry, group int) error {
|
func setInterlockKm(wd *component.WorldData, psdEntry *ecs.Entry, group int32) error {
|
||||||
if psdEntry.HasComponent(component.PsdCircuitType) { //有联锁区段电路
|
if psdEntry.HasComponent(component.PsdCircuitType) { //有联锁区段电路
|
||||||
circuit := component.PsdCircuitType.Get(psdEntry)
|
circuit := component.PsdCircuitType.Get(psdEntry)
|
||||||
switch group {
|
kmj := circuit.KMJMap[group]
|
||||||
case 4:
|
if kmj == nil {
|
||||||
return setInterlockDriveKm4(wd, circuit)
|
id := component.UidType.Get(psdEntry).Id
|
||||||
case 8:
|
return errors.New(fmt.Sprintf("屏蔽门[id:%s]不支持[%d]编组操作", id, group))
|
||||||
return setInterlockDriveKm8(wd, circuit)
|
|
||||||
}
|
}
|
||||||
|
return setRelayDriveKm(wd, circuit, group)
|
||||||
} else {
|
} else {
|
||||||
psc := component.PscType.Get(psdEntry)
|
psc := component.PscType.Get(psdEntry)
|
||||||
switch group {
|
psc.InterlockKmGroup[group] = true
|
||||||
case 4:
|
|
||||||
setPscKm4(psc)
|
|
||||||
case 8:
|
|
||||||
setPscKm8(psc)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// 取消联锁开门
|
// 取消联锁开门
|
||||||
func cancelInterlockKm(wd *component.WorldData, psdEntry *ecs.Entry, group int) error {
|
func cancelInterlockKm(wd *component.WorldData, psdEntry *ecs.Entry, group int32) error {
|
||||||
if psdEntry.HasComponent(component.PsdCircuitType) { //有联锁区段电路
|
if psdEntry.HasComponent(component.PsdCircuitType) { //有联锁区段电路
|
||||||
circuit := component.PsdCircuitType.Get(psdEntry)
|
circuit := component.PsdCircuitType.Get(psdEntry)
|
||||||
switch group {
|
kmj := circuit.KMJMap[group]
|
||||||
case 4:
|
if kmj == nil {
|
||||||
return wd.SetQdBit(component.UidType.Get(circuit.KMJ4).Id, false)
|
id := component.UidType.Get(psdEntry).Id
|
||||||
case 8:
|
return errors.New(fmt.Sprintf("屏蔽门[id:%s]不支持[%d]编组操作", id, group))
|
||||||
return wd.SetQdBit(component.UidType.Get(circuit.KMJ8).Id, false)
|
|
||||||
}
|
}
|
||||||
|
return cancelRelayDriveKm(wd, circuit, group)
|
||||||
} else {
|
} else {
|
||||||
psc := component.PscType.Get(psdEntry)
|
psc := component.PscType.Get(psdEntry)
|
||||||
switch group {
|
psc.InterlockKmGroup[group] = false
|
||||||
case 4:
|
|
||||||
psc.InterlockKM4 = false
|
|
||||||
case 8:
|
|
||||||
psc.InterlockKM8 = false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -320,19 +277,22 @@ func cancelInterlockKm(wd *component.WorldData, psdEntry *ecs.Entry, group int)
|
|||||||
func setInterlockGm(wd *component.WorldData, psdEntry *ecs.Entry) error {
|
func setInterlockGm(wd *component.WorldData, psdEntry *ecs.Entry) error {
|
||||||
if psdEntry.HasComponent(component.PsdCircuitType) { //有联锁区段电路
|
if psdEntry.HasComponent(component.PsdCircuitType) { //有联锁区段电路
|
||||||
circuit := component.PsdCircuitType.Get(psdEntry)
|
circuit := component.PsdCircuitType.Get(psdEntry)
|
||||||
return setInterlockDriveGm(wd, circuit)
|
return setRelayDriveGm(wd, circuit)
|
||||||
} else {
|
} else {
|
||||||
psc := component.PscType.Get(psdEntry)
|
psc := component.PscType.Get(psdEntry)
|
||||||
setPscGm(psc)
|
for i, _ := range psc.InterlockKmGroup {
|
||||||
|
psc.InterlockKmGroup[i] = false
|
||||||
|
}
|
||||||
|
psc.InterlockGM = true
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// 取消联锁关门
|
// 取消联锁关门
|
||||||
func cancelInterlockGm(wd *component.WorldData, psdEntry *ecs.Entry) error {
|
func cancelInterlockGm(wd *component.WorldData, psdEntry *ecs.Entry) error {
|
||||||
if psdEntry.HasComponent(component.PsdCircuitType) {
|
if psdEntry.HasComponent(component.PsdCircuitType) { //有联锁区段电路
|
||||||
circuit := component.PsdCircuitType.Get(psdEntry)
|
circuit := component.PsdCircuitType.Get(psdEntry)
|
||||||
return wd.SetQdBit(component.UidType.Get(circuit.GMJ).Id, false)
|
return cancelRelayDriveGm(wd, circuit)
|
||||||
} else {
|
} else {
|
||||||
psc := component.PscType.Get(psdEntry)
|
psc := component.PscType.Get(psdEntry)
|
||||||
psc.InterlockGM = false
|
psc.InterlockGM = false
|
||||||
@ -340,50 +300,46 @@ func cancelInterlockGm(wd *component.WorldData, psdEntry *ecs.Entry) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// 联锁驱动4编组开门
|
// 设置继电器驱动开门
|
||||||
func setInterlockDriveKm4(wd *component.WorldData, circuit *component.PsdCircuit) error {
|
func setRelayDriveKm(wd *component.WorldData, circuit *component.PsdCircuit, group int32) error {
|
||||||
return wd.SetQdBits([]*component.QdBitParam{
|
var params []*component.QdBitParam
|
||||||
component.NewQdBitParam(component.UidType.Get(circuit.GMJ).Id, false),
|
params = append(params, component.NewQdBitParam(component.UidType.Get(circuit.GMJ).Id, false))
|
||||||
component.NewQdBitParam(component.UidType.Get(circuit.KMJ4).Id, true),
|
for g, entry := range circuit.KMJMap {
|
||||||
component.NewQdBitParam(component.UidType.Get(circuit.KMJ8).Id, false),
|
if g == group {
|
||||||
})
|
params = append(params, component.NewQdBitParam(component.UidType.Get(entry).Id, true))
|
||||||
|
} else {
|
||||||
|
params = append(params, component.NewQdBitParam(component.UidType.Get(entry).Id, false))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return wd.SetQdBits(params)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 联锁驱动8编组开门
|
// 取消继电器驱动开门
|
||||||
func setInterlockDriveKm8(wd *component.WorldData, circuit *component.PsdCircuit) error {
|
func cancelRelayDriveKm(wd *component.WorldData, circuit *component.PsdCircuit, group int32) error {
|
||||||
return wd.SetQdBits([]*component.QdBitParam{
|
var params []*component.QdBitParam
|
||||||
component.NewQdBitParam(component.UidType.Get(circuit.GMJ).Id, false),
|
for _, entry := range circuit.KMJMap {
|
||||||
component.NewQdBitParam(component.UidType.Get(circuit.KMJ4).Id, false),
|
params = append(params, component.NewQdBitParam(component.UidType.Get(entry).Id, false))
|
||||||
component.NewQdBitParam(component.UidType.Get(circuit.KMJ8).Id, true),
|
}
|
||||||
})
|
|
||||||
|
return wd.SetQdBits(params)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 联锁驱动关门
|
// 设置继电器驱动关门
|
||||||
func setInterlockDriveGm(wd *component.WorldData, circuit *component.PsdCircuit) error {
|
func setRelayDriveGm(wd *component.WorldData, circuit *component.PsdCircuit) error {
|
||||||
return wd.SetQdBits([]*component.QdBitParam{
|
var params []*component.QdBitParam
|
||||||
component.NewQdBitParam(component.UidType.Get(circuit.GMJ).Id, true),
|
params = append(params, component.NewQdBitParam(component.UidType.Get(circuit.GMJ).Id, true))
|
||||||
component.NewQdBitParam(component.UidType.Get(circuit.KMJ4).Id, false),
|
for _, entry := range circuit.KMJMap {
|
||||||
component.NewQdBitParam(component.UidType.Get(circuit.KMJ8).Id, false),
|
params = append(params, component.NewQdBitParam(component.UidType.Get(entry).Id, false))
|
||||||
})
|
}
|
||||||
|
|
||||||
|
return wd.SetQdBits(params)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 直接设置PSC的状态4编组开门。在无屏蔽门电路时使用
|
// 取消继电器驱动关门
|
||||||
func setPscKm4(psc *component.Psc) {
|
func cancelRelayDriveGm(wd *component.WorldData, circuit *component.PsdCircuit) error {
|
||||||
psc.InterlockKM4 = true
|
var params []*component.QdBitParam
|
||||||
psc.InterlockKM8 = false
|
params = append(params, component.NewQdBitParam(component.UidType.Get(circuit.GMJ).Id, false))
|
||||||
psc.InterlockGM = false
|
|
||||||
}
|
|
||||||
|
|
||||||
// 直接设置PSC的状态8编组开门。在无屏蔽门电路时使用
|
return wd.SetQdBits(params)
|
||||||
func setPscKm8(psc *component.Psc) {
|
|
||||||
psc.InterlockKM4 = false
|
|
||||||
psc.InterlockKM8 = true
|
|
||||||
psc.InterlockGM = false
|
|
||||||
}
|
|
||||||
|
|
||||||
// 直接设置PSC的状态关门。在无屏蔽门电路时使用
|
|
||||||
func setPscGm(psc *component.Psc) {
|
|
||||||
psc.InterlockKM4 = false
|
|
||||||
psc.InterlockKM8 = false
|
|
||||||
psc.InterlockGM = true
|
|
||||||
}
|
}
|
||||||
|
@ -29,14 +29,15 @@ func (p *PsdSys) Update(world ecs.World) {
|
|||||||
if entry.HasComponent(component.PsdCircuitType) { //有屏蔽门电路
|
if entry.HasComponent(component.PsdCircuitType) { //有屏蔽门电路
|
||||||
psdCircuit := component.PsdCircuitType.Get(entry)
|
psdCircuit := component.PsdCircuitType.Get(entry)
|
||||||
//屏蔽门驱动
|
//屏蔽门驱动
|
||||||
if psdCircuit.GMJ != nil && psdCircuit.KMJ4 != nil && psdCircuit.KMJ8 != nil {
|
if psdCircuit.GMJ != nil {
|
||||||
p.exciteGMJ(worldData, psdCircuit)
|
p.exciteGMJ(worldData, psdCircuit)
|
||||||
p.exciteKMJ4(worldData, psdCircuit)
|
|
||||||
p.exciteKMJ8(worldData, psdCircuit)
|
|
||||||
psc.InterlockGM = component.BitStateType.Get(psdCircuit.GMJ).Val
|
psc.InterlockGM = component.BitStateType.Get(psdCircuit.GMJ).Val
|
||||||
psc.InterlockKM4 = component.BitStateType.Get(psdCircuit.KMJ4).Val
|
|
||||||
psc.InterlockKM8 = component.BitStateType.Get(psdCircuit.KMJ8).Val
|
|
||||||
}
|
}
|
||||||
|
for group, kmj := range psdCircuit.KMJMap {
|
||||||
|
p.exciteKMJ(worldData, psdCircuit, kmj)
|
||||||
|
psc.InterlockKmGroup[group] = component.BitStateType.Get(kmj).Val
|
||||||
|
}
|
||||||
|
|
||||||
if psdCircuit.MGJ != nil {
|
if psdCircuit.MGJ != nil {
|
||||||
p.exciteMGJ(psdCircuit, asdList)
|
p.exciteMGJ(psdCircuit, asdList)
|
||||||
psdState.Close = component.BitStateType.Get(psdCircuit.MGJ).Val
|
psdState.Close = component.BitStateType.Get(psdCircuit.MGJ).Val
|
||||||
@ -96,12 +97,13 @@ func (p *PsdSys) Update(world ecs.World) {
|
|||||||
} else if !psc.InterlockMPL { //联锁操作没有被旁路
|
} else if !psc.InterlockMPL { //联锁操作没有被旁路
|
||||||
if psc.InterlockGM {
|
if psc.InterlockGM {
|
||||||
p.gm(asdList)
|
p.gm(asdList)
|
||||||
} else if psc.InterlockKM8 {
|
} else {
|
||||||
group := psd.FindAsdGroup(8)
|
for group, km := range psc.InterlockKmGroup {
|
||||||
p.km(group.Start, group.End, asdList)
|
if km {
|
||||||
} else if psc.InterlockKM4 {
|
asdGroup := psd.FindAsdGroup(group)
|
||||||
group := psd.FindAsdGroup(4)
|
p.km(asdGroup.Start, asdGroup.End, asdList)
|
||||||
p.km(group.Start, group.End, asdList)
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -127,55 +129,40 @@ func (p *PsdSys) exciteGMJ(data *component.WorldData, circuit *component.PsdCirc
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
gmj := component.BitStateType.Get(circuit.GMJ)
|
|
||||||
kmj4 := component.BitStateType.Get(circuit.KMJ4)
|
|
||||||
kmj8 := component.BitStateType.Get(circuit.KMJ8)
|
|
||||||
if bit { //驱动
|
if bit { //驱动
|
||||||
component.RelayDriveType.Get(circuit.GMJ).Td = true
|
component.RelayDriveType.Get(circuit.GMJ).Td = true
|
||||||
} else if gmj.Val { //自保持
|
} else if component.BitStateType.Get(circuit.GMJ).Val { //判断自保持
|
||||||
if !kmj4.Val && !kmj8.Val {
|
for _, entry := range circuit.KMJMap {
|
||||||
component.RelayDriveType.Get(circuit.GMJ).Td = true
|
if component.BitStateType.Get(entry).Val { //无法自保持
|
||||||
} else {
|
component.RelayDriveType.Get(circuit.GMJ).Td = false
|
||||||
component.RelayDriveType.Get(circuit.GMJ).Td = false
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
//自保持
|
||||||
|
component.RelayDriveType.Get(circuit.GMJ).Td = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PsdSys) exciteKMJ4(data *component.WorldData, circuit *component.PsdCircuit) {
|
func (p *PsdSys) exciteKMJ(data *component.WorldData, circuit *component.PsdCircuit, kmj *ecs.Entry) {
|
||||||
bit, err := data.QueryQdBit(component.UidType.Get(circuit.KMJ4).Id)
|
bit, err := data.QueryQdBit(component.UidType.Get(kmj).Id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
kmj4 := component.BitStateType.Get(circuit.KMJ4)
|
|
||||||
gmj := component.BitStateType.Get(circuit.GMJ)
|
|
||||||
kmj8 := component.BitStateType.Get(circuit.KMJ8)
|
|
||||||
if bit { //驱动
|
if bit { //驱动
|
||||||
component.RelayDriveType.Get(circuit.KMJ4).Td = true
|
component.RelayDriveType.Get(kmj).Td = true
|
||||||
} else if kmj4.Val { //自保持
|
} else if component.BitStateType.Get(kmj).Val { //判断自保持
|
||||||
if !gmj.Val && !kmj8.Val {
|
if component.BitStateType.Get(circuit.GMJ).Val {
|
||||||
component.RelayDriveType.Get(circuit.KMJ4).Td = true
|
component.RelayDriveType.Get(kmj).Td = false
|
||||||
} else {
|
return
|
||||||
component.RelayDriveType.Get(circuit.KMJ4).Td = false
|
|
||||||
}
|
}
|
||||||
}
|
for _, entry := range circuit.KMJMap {
|
||||||
}
|
if entry != kmj && component.BitStateType.Get(entry).Val {
|
||||||
|
component.RelayDriveType.Get(kmj).Td = false
|
||||||
func (p *PsdSys) exciteKMJ8(data *component.WorldData, circuit *component.PsdCircuit) {
|
return
|
||||||
bit, err := data.QueryQdBit(component.UidType.Get(circuit.KMJ8).Id)
|
}
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
kmj8 := component.BitStateType.Get(circuit.KMJ8)
|
|
||||||
gmj := component.BitStateType.Get(circuit.GMJ)
|
|
||||||
kmj4 := component.BitStateType.Get(circuit.KMJ4)
|
|
||||||
if bit { //驱动
|
|
||||||
component.RelayDriveType.Get(circuit.KMJ8).Td = true
|
|
||||||
} else if kmj8.Val { //自保持
|
|
||||||
if !gmj.Val && !kmj4.Val {
|
|
||||||
component.RelayDriveType.Get(circuit.KMJ8).Td = true
|
|
||||||
} else {
|
|
||||||
component.RelayDriveType.Get(circuit.KMJ8).Td = false
|
|
||||||
}
|
}
|
||||||
|
//自保持
|
||||||
|
component.RelayDriveType.Get(kmj).Td = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user