rts-sim-module/repository/electronic_component.go

60 lines
1.1 KiB
Go

package repository
import "joylink.club/rtsssimulation/repository/model/proto"
// Relay 继电器
type Relay struct {
Identity
code string
model proto.Relay_Model
}
func newRelay(id string, code string, model proto.Relay_Model) *Relay {
return &Relay{
Identity: identity{
id: id,
deviceType: proto.DeviceType_DeviceType_Relay,
},
code: code,
model: model,
}
}
func (r *Relay) Code() string {
return r.code
}
func (r *Relay) Model() proto.Relay_Model {
return r.model
}
// ElectronicComponentGroup 电子元件组合
type ElectronicComponentGroup struct {
code string
components []Identity
}
func (r *ElectronicComponentGroup) Code() string {
return r.code
}
func (r *ElectronicComponentGroup) Components() []Identity {
return r.components
}
// PhaseFailureProtector 断相保护器
type PhaseFailureProtector struct {
Identity
code string
}
func newPhaseFailureProtector(id string, code string) *PhaseFailureProtector {
return &PhaseFailureProtector{
Identity: identity{
id: id,
deviceType: proto.DeviceType_DeviceType_PhaseFailureProtector,
},
code: code,
}
}