2023-08-18 17:59:16 +08:00
|
|
|
|
package model
|
|
|
|
|
|
2023-08-22 11:00:14 +08:00
|
|
|
|
import (
|
|
|
|
|
"joylink.club/rtsssimulation/umi"
|
|
|
|
|
)
|
2023-08-21 15:12:57 +08:00
|
|
|
|
|
2023-08-22 11:00:14 +08:00
|
|
|
|
// 站台一侧屏蔽门模型
|
2023-08-18 17:59:16 +08:00
|
|
|
|
type PsdModel struct {
|
|
|
|
|
DeviceModel
|
|
|
|
|
//屏蔽门所包含的单元
|
|
|
|
|
Cells []*PsdCellModel
|
2023-08-22 11:00:14 +08:00
|
|
|
|
//屏蔽门移动从0-100耗时,单位ms
|
|
|
|
|
MoveTime int64
|
2023-08-18 17:59:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func NewPsdModel(id string) *PsdModel {
|
2023-08-23 16:52:01 +08:00
|
|
|
|
return &PsdModel{DeviceModel: DeviceModel{Id: id, Type: umi.Psd}, Cells: make([]*PsdCellModel, 0)}
|
2023-08-18 17:59:16 +08:00
|
|
|
|
}
|
2023-08-22 14:37:30 +08:00
|
|
|
|
func (me *PsdModel) addCell(cell *PsdCellModel) {
|
2023-08-18 17:59:16 +08:00
|
|
|
|
me.Cells = append(me.Cells, cell)
|
|
|
|
|
}
|
2023-08-23 09:54:41 +08:00
|
|
|
|
|
|
|
|
|
// 屏蔽门移动从0-100耗时,单位ms
|
2023-08-22 11:00:14 +08:00
|
|
|
|
func (me *PsdModel) MovingTime() int64 {
|
|
|
|
|
return me.MoveTime
|
|
|
|
|
}
|
2023-08-23 09:54:41 +08:00
|
|
|
|
|
|
|
|
|
// 屏蔽门的所有单元门
|
2023-08-22 14:37:30 +08:00
|
|
|
|
func (me *PsdModel) AllDeviceCells() []umi.IDeviceModel {
|
|
|
|
|
rt := make([]umi.IDeviceModel, 0, len(me.Cells))
|
|
|
|
|
for _, cell := range me.Cells {
|
|
|
|
|
rt = append(rt, cell)
|
|
|
|
|
}
|
|
|
|
|
return rt
|
|
|
|
|
}
|
2023-08-18 17:59:16 +08:00
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////
|
|
|
|
|
|
2023-08-22 11:00:14 +08:00
|
|
|
|
// 站台一侧屏蔽门单元模型
|
2023-08-18 17:59:16 +08:00
|
|
|
|
type PsdCellModel struct {
|
|
|
|
|
DeviceModel
|
|
|
|
|
//该屏蔽门单元所属的屏蔽门
|
2023-08-22 11:00:14 +08:00
|
|
|
|
psd umi.IDeviceModel
|
2023-08-18 17:59:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func NewPsdCellModel(id string, psdModel *PsdModel) *PsdCellModel {
|
2023-08-22 14:37:30 +08:00
|
|
|
|
cell := &PsdCellModel{
|
2023-08-23 16:52:01 +08:00
|
|
|
|
DeviceModel: DeviceModel{Id: id, Type: umi.PsdCell},
|
2023-08-18 17:59:16 +08:00
|
|
|
|
psd: psdModel,
|
|
|
|
|
}
|
2023-08-22 14:37:30 +08:00
|
|
|
|
psdModel.addCell(cell)
|
|
|
|
|
return cell
|
2023-08-18 17:59:16 +08:00
|
|
|
|
}
|
|
|
|
|
func (me *PsdCellModel) Psd() *PsdModel {
|
|
|
|
|
return me.psd.(*PsdModel)
|
|
|
|
|
}
|