signal 3xh1
This commit is contained in:
parent
1d3d8e0150
commit
412de346bc
@ -2,6 +2,27 @@ package component
|
||||
|
||||
import "joylink.club/ecs"
|
||||
|
||||
// Signal2XH1Electronic 电路状态:**信号机2XH-1(红-绿) 出段(场)信号机 或 **出站区间阻挡信号机
|
||||
type Signal2XH1Electronic struct {
|
||||
// 点灯继电器,true-吸合,常态落下表示逻辑点灯
|
||||
Z2XH1_DDJ *ecs.Entry
|
||||
//灯丝继电器,true-吸合
|
||||
Z2XH1_DJ *ecs.Entry
|
||||
//列车信号继电器,true-吸合
|
||||
Z2XH1_LXJ *ecs.Entry
|
||||
//物理绿灯,true-亮
|
||||
Z2XH1_L *ecs.Entry
|
||||
// 物理红灯,true-亮
|
||||
Z2XH1_H *ecs.Entry
|
||||
}
|
||||
|
||||
var (
|
||||
//Signal2XH1ElectronicType 2XH1信号机电路组件
|
||||
Signal2XH1ElectronicType = ecs.NewComponentType[Signal2XH1Electronic]()
|
||||
)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Signal3XH1Electronic 电路状态:信号机3XH-1(红-绿-黄) 道岔防护信号机(三显示不封灯,有单黄显示、带引导)
|
||||
type Signal3XH1Electronic struct {
|
||||
// 点灯继电器,true-吸合,常态落下表示逻辑点灯
|
@ -1,24 +0,0 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
)
|
||||
|
||||
// Signal2XH1Electronic 电路状态:**信号机2XH-1(红-绿) 出段(场)信号机 或 **出站区间阻挡信号机
|
||||
type Signal2XH1Electronic struct {
|
||||
// 点灯继电器,true-吸合,常态落下表示逻辑点灯
|
||||
Z2XH1_DDJ *ecs.Entry
|
||||
//灯丝继电器,true-吸合
|
||||
Z2XH1_DJ *ecs.Entry
|
||||
//列车信号继电器,true-吸合
|
||||
Z2XH1_LXJ *ecs.Entry
|
||||
//物理绿灯,true-亮
|
||||
Z2XH1_L *ecs.Entry
|
||||
// 物理红灯,true-亮
|
||||
Z2XH1_H *ecs.Entry
|
||||
}
|
||||
|
||||
var (
|
||||
//Signal2XH1ElectronicType 2XH1信号机电路组件
|
||||
Signal2XH1ElectronicType = ecs.NewComponentType[Signal2XH1Electronic]()
|
||||
)
|
@ -10,8 +10,6 @@ import (
|
||||
"joylink.club/rtsssimulation/fi"
|
||||
"joylink.club/rtsssimulation/repository"
|
||||
"joylink.club/rtsssimulation/repository/model/proto"
|
||||
"joylink.club/rtsssimulation/sys/circuit_sys"
|
||||
"joylink.club/rtsssimulation/sys/device_sys"
|
||||
"log"
|
||||
"time"
|
||||
)
|
||||
@ -29,10 +27,8 @@ func main() {
|
||||
repo := repository.BuildRepositoryForSignalTest(proto)
|
||||
sim := rtss_simulation.NewSimulation(repo)
|
||||
loadEntities(sim, repo)
|
||||
sim.SetSpeed(1)
|
||||
sim.SetSpeed(0.1)
|
||||
sim.AddSystem(sigSys.NewSignalDebugSystem())
|
||||
sim.AddSystem(device_sys.NewRelaySys())
|
||||
sim.AddSystem(circuit_sys.NewSignal3XH1System())
|
||||
sim.StartUp()
|
||||
//
|
||||
time.Sleep(1 * time.Second)
|
||||
@ -48,7 +44,7 @@ func main() {
|
||||
fi.DriveSignal3XH1Yx(sim, IdSignal3XH1)
|
||||
time.Sleep(2 * time.Second)
|
||||
worldLog(sim, "===>>开通列车信号 .....")
|
||||
fi.DriveSignal3XH1Lx(sim, IdSignal3XH1, true)
|
||||
fi.DriveSignal3XH1Lx(sim, IdSignal3XH1, false)
|
||||
//
|
||||
time.Sleep(5 * time.Second)
|
||||
sim.Close()
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit e7797346722a572814539d9a453789b89ffe6bf4
|
||||
Subproject commit af605020f1bccf1f1b2ab5a4ae4966d1c6c9776c
|
@ -29,30 +29,23 @@ func (s *Signal2XH1System) calculateL(state *component.Signal2XH1Electronic) {
|
||||
ddj := component.BitStateType.Get(state.Z2XH1_DDJ)
|
||||
lxj := component.BitStateType.Get(state.Z2XH1_LXJ)
|
||||
isL := !ddj.Val && lxj.Val
|
||||
if driveL.Td != isL {
|
||||
driveL.Td = isL
|
||||
}
|
||||
}
|
||||
func (s *Signal2XH1System) calculateH(state *component.Signal2XH1Electronic) {
|
||||
driveH := component.LightDriveType.Get(state.Z2XH1_H)
|
||||
ddj := component.BitStateType.Get(state.Z2XH1_DDJ)
|
||||
lxj := component.BitStateType.Get(state.Z2XH1_LXJ)
|
||||
isH := !ddj.Val && !lxj.Val
|
||||
if driveH.Td != isH {
|
||||
driveH.Td = isH
|
||||
}
|
||||
}
|
||||
func (s *Signal2XH1System) calculateDJ(state *component.Signal2XH1Electronic) {
|
||||
ddj := component.BitStateType.Get(state.Z2XH1_DDJ)
|
||||
lxj := component.BitStateType.Get(state.Z2XH1_LXJ)
|
||||
dj := component.BitStateType.Get(state.Z2XH1_DJ)
|
||||
ld := component.BitStateType.Get(state.Z2XH1_L)
|
||||
hd := component.BitStateType.Get(state.Z2XH1_H)
|
||||
isDJ := !ddj.Val && lxj.Val && ld.Val || !ddj.Val && !lxj.Val && hd.Val
|
||||
//通知继电器进行动作
|
||||
if dj.Val != isDJ {
|
||||
drive := component.RelayDriveType.Get(state.Z2XH1_DJ)
|
||||
drive.Td = isDJ
|
||||
drive.Xq = isDJ
|
||||
}
|
||||
}
|
||||
|
@ -42,10 +42,8 @@ func (s *Signal3XH1System) calculateU(state *component.Signal3XH1Electronic) {
|
||||
//侧向行车信号
|
||||
isLC := !ddj.Val && lxj.Val && !zxj.Val
|
||||
isU := isY || isLC
|
||||
if driveU.Td != isU {
|
||||
driveU.Td = isU
|
||||
}
|
||||
}
|
||||
|
||||
// 绿灯点灯电路
|
||||
// 开放正线行车信号,只亮绿灯
|
||||
@ -55,10 +53,8 @@ func (s *Signal3XH1System) calculateL(state *component.Signal3XH1Electronic) {
|
||||
zxj := component.BitStateType.Get(state.Z3XH1_ZXJ)
|
||||
driveL := component.LightDriveType.Get(state.Z3XH1_L)
|
||||
isL := !ddj.Val && lxj.Val && zxj.Val
|
||||
if driveL.Td != isL {
|
||||
driveL.Td = isL
|
||||
}
|
||||
}
|
||||
|
||||
// 红灯点灯电路
|
||||
// 列车信号禁止时,亮红灯
|
||||
@ -67,10 +63,8 @@ func (s *Signal3XH1System) calculateH(state *component.Signal3XH1Electronic) {
|
||||
lxj := component.BitStateType.Get(state.Z3XH1_LXJ)
|
||||
driveH := component.LightDriveType.Get(state.Z3XH1_H)
|
||||
isH := !ddj.Val && !lxj.Val
|
||||
if driveH.Td != isH {
|
||||
driveH.Td = isH
|
||||
}
|
||||
}
|
||||
|
||||
// DJ 灯丝继电器电路
|
||||
func (s *Signal3XH1System) calculateDJ(state *component.Signal3XH1Electronic) {
|
||||
|
Loading…
Reference in New Issue
Block a user