scl

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessPoint

type AccessPoint struct {
	Name   string  `xml:"name,attr"`
	Server *Server `xml:"Server"`
}

type Address

type Address struct {
	AddressParameters []*AddressParameter `xml:"P"`
}

type AddressParameter

type AddressParameter struct {
	Type  string `xml:"type,attr"`
	Value string `xml:",chardata"`
}

type AttributeType

type AttributeType int
const (
	Boolean AttributeType = iota
	Int8
	Int16
	Int32
	Int64
	Int128
	Int8U
	Int16U
	Int24U
	Int32U
	Float32
	Float64
	Enumerated
	OctetString64
	OctetString6
	OctetString8
	VisibleString32
	VisibleString64
	VisibleString65
	VisibleString129
	VisibleString255
	UnicodeString255
	Timestamp
	Quality
	Check
	CodedEnum
	GenericBitString
	Constructed
	EntryTime
	PhyComAddr
	Currency
	OptFlds
	TrgOps
)

func (AttributeType) ToString

func (that AttributeType) ToString() string

type Authentication

type Authentication struct {
	None bool `xml:"none,attr"`
}

type ClientLN

type ClientLN struct {
	IedName string `xml:"iedName,attr"`
	ApRef   string `xml:"apRef,attr"`
	LdInst  string `xml:"ldInst,attr"`
	Prefix  string `xml:"prefix,attr"`
	LnClass string `xml:"lnClass,attr"`
	InInst  string `xml:"lnInst,attr"`
	Desc    string `xml:"desc,attr"`
}

type Communication

type Communication struct {
	SubNetworks []*SubNetwork `xml:"SubNetwork" validate:"nonzero"`
}

type ConfDataSet

type ConfDataSet struct {
	Max           int `xml:"max,attr"`
	MaxAttributes int `xml:"maxAttributes,attr"`
}

type ConfLNs

type ConfLNs struct {
	FixPrefix bool `xml:"fixPrefix,attr"`
	FixLnInst bool `xml:"fixLnInst,attr"`
}

type ConfReportControl

type ConfReportControl struct {
	Max int `xml:"max,attr"`
}

type ConnectedAP

type ConnectedAP struct {
	IedName  string   `xml:"iedName,attr"`
	APName   string   `xml:"apName,attr"`
	Address  *Address `xml:"Address"`
	GESNodes []*GSE   `xml:"GSE"`
	SMVNodes []*SMV   `xml:"SMV"`
}

func (*ConnectedAP) LookupGSE

func (that *ConnectedAP) LookupGSE(logicalDeviceName, name string) *GSE

func (*ConnectedAP) LookupSMV

func (that *ConnectedAP) LookupSMV(logicalDeviceName, name string) *SMV

type DOINode

type DOINode struct {
	Name  string `xml:"name,attr"`
	Desc  string `xml:"desc,attr"`
	SAddr string `xml:"sAddr,attr"`
	Val   *Val   `xml:"Val"`

	SDINodes []*DOINode `xml:"SDI"`
	DAINodes []*DOINode `xml:"DAI"`
}

type DataAttribute

type DataAttribute struct {
	Name              string
	FC                string
	AttributeType     AttributeType
	IsBasicAttribute  bool
	Count             int
	Value             *DataModelValue
	ShortAddress      string
	SubDataAttributes []*DataAttribute
	SclType           SclType
	TriggerOptions    *TriggerOptions
	Definition        *DataAttributeDefinition
}

func NewDataAttribute

func NewDataAttribute(daDefinition *DataAttributeDefinition, dataTypeTemplates *DataTypeTemplates, fc string, parent DataModelNode) (*DataAttribute, error)

func (*DataAttribute) GetChildByName

func (d *DataAttribute) GetChildByName(childName string) DataModelNode

func (*DataAttribute) GetName

func (d *DataAttribute) GetName() string

func (*DataAttribute) GetSclType

func (d *DataAttribute) GetSclType() SclType

type DataAttributeDefinition

type DataAttributeDefinition struct {
	Name        string `xml:"name,attr"`
	Fc          string `xml:"fc,attr"`
	Type        string `xml:"type,attr"`
	BType       string `xml:"bType,attr"`
	Count       int    `xml:"count,attr"`
	DchgTrigger bool   `xml:"dchg,attr"`
	DupdTrigger bool   `xml:"dupd,attr"`
	QchgTrigger bool   `xml:"qchg,attr"`
	Val         *Val   `xml:"Val"`

	// custom
	AttributeType  AttributeType
	TriggerOptions *TriggerOptions
	Value          *DataModelValue
}

type DataAttributeType

type DataAttributeType struct {
	SubDataAttributes []*DataAttributeDefinition `xml:"BDA"`
	// contains filtered or unexported fields
}

func (*DataAttributeType) GetDesc

func (s *DataAttributeType) GetDesc() string

func (*DataAttributeType) GetId

func (s *DataAttributeType) GetId() string

func (*DataAttributeType) GetUsed

func (s *DataAttributeType) GetUsed() bool

func (*DataAttributeType) SetUsed

func (s *DataAttributeType) SetUsed(used bool)

type DataModelNode

type DataModelNode interface {
	GetName() string
	GetSclType() SclType
	GetChildByName(childName string) DataModelNode
}

type DataModelValue

type DataModelValue struct {
	Value            interface{}
	UnknownEnumValue string
	EnumType         string
}

func NewDataModelValue

func NewDataModelValue(attributeType AttributeType, sclType SclType, value string) (*DataModelValue, error)

type DataObject

type DataObject struct {
	Name              string
	Count             int
	Trans             bool
	SclType           SclType
	DataTypeTemplates *DataTypeTemplates
	DataAttributes    []*DataAttribute
	SubDataObjects    []*DataObject
}

func NewDataObject

func NewDataObject(do *DataObjectDefinition, dataTypeTemplates *DataTypeTemplates, parent DataModelNode) (*DataObject, error)

func (*DataObject) GetChildByName

func (d *DataObject) GetChildByName(childName string) DataModelNode

func (*DataObject) GetName

func (d *DataObject) GetName() string

func (*DataObject) GetSclType

func (d *DataObject) GetSclType() SclType

type DataObjectDefinition

type DataObjectDefinition struct {
	Name      string `xml:"name,attr"`
	Type      string `xml:"type,attr"`
	Transient bool   `xml:"transient,attr"`
	Count     int    `xml:"count,attr"`

	// custom
	SclType SclType
}

type DataObjectType

type DataObjectType struct {
	Cdc            string                     `xml:"cdc,attr"`
	DataAttributes []*DataAttributeDefinition `xml:"DA"`
	SubDataObjects []*DataObjectDefinition    `xml:"SDO"`
	// contains filtered or unexported fields
}

func (*DataObjectType) GetDesc

func (s *DataObjectType) GetDesc() string

func (*DataObjectType) GetId

func (s *DataObjectType) GetId() string

func (*DataObjectType) GetUsed

func (s *DataObjectType) GetUsed() bool

func (*DataObjectType) SetUsed

func (s *DataObjectType) SetUsed(used bool)

type DataSet

type DataSet struct {
	Name string  `xml:"name,attr"`
	Desc string  `xml:"desc,attr"`
	FCDA []*FCDA `xml:"FCDA"`
}

type DataTypeTemplates

type DataTypeTemplates struct {
	LogicalNodeTypes   []*LogicalNodeType   `xml:"LNodeType"`
	DataObjectTypes    []*DataObjectType    `xml:"DOType"`
	DataAttributeTypes []*DataAttributeType `xml:"DAType"`
	EnumTypes          []*EnumerationType   `xml:"EnumType"`
	TypeDeclarations   []SclType            // 将LNodeType、DOType、DAType、EnumType合并到一个数组中
}

type EnumerationType

type EnumerationType struct {
	EnumValues []*EnumerationValue `xml:"EnumVal"`
	// contains filtered or unexported fields
}

func (*EnumerationType) GetDesc

func (s *EnumerationType) GetDesc() string

func (*EnumerationType) GetId

func (s *EnumerationType) GetId() string

func (*EnumerationType) GetUsed

func (s *EnumerationType) GetUsed() bool

func (*EnumerationType) SetUsed

func (s *EnumerationType) SetUsed(used bool)

type EnumerationValue

type EnumerationValue struct {
	Ord          int    `xml:"ord,attr"`
	SymbolicName string `xml:",chardata"`
}

type FCDA

type FCDA struct {
	LdInst  string `xml:"ldInst,attr"`
	Prefix  string `xml:"prefix,attr"`
	LnInst  string `xml:"lnInst,attr"`
	LnClass string `xml:"lnClass,attr"`
	DoName  string `xml:"doName,attr"`
	DaName  string `xml:"daName,attr"`
	Fc      string `xml:"fc,attr"`
}

type GSE

type GSE struct {
	LdInst     string         `xml:"ldInst,attr"`
	CbName     string         `xml:"cbName,attr"`
	MinTimeVal *Val           `xml:"MinTime"`
	MaxTimeVal *Val           `xml:"MaxTime"`
	Address    *PhyComAddress `xml:"Address"`

	// custom
	MinTime int
	MaxTime int
}

type GSEControl

type GSEControl struct {
	AppID     string `xml:"appID,attr"`
	Name      string `xml:"name,attr"`
	Desc      string `xml:"desc,attr"`
	Type      string `xml:"type,attr"`
	DatSet    string `xml:"datSet,attr"`
	ConfRev   int    `xml:"confRev,attr"`
	FixedOffs bool   `xml:"fixedOffs,attr"`
}
type Header struct {
	ID            string `xml:"id,attr"`
	ToolID        string `xml:"toolID,attr"`
	NameStructure string `xml:"nameStructure,attr"`
}

type IED

type IED struct {
	Name          string         `xml:"name,attr"`
	Type          string         `xml:"type,attr"`
	Manufacturer  string         `xml:"manufacturer,attr"`
	ConfigVersion string         `xml:"configVersion,attr"`
	Services      *Services      `xml:"Services"`
	AccessPoints  []*AccessPoint `xml:"AccessPoint"`
}

type Log

type Log struct {
	Name string `xml:"name,attr"`
}

type LogControl

type LogControl struct {
	Name           string          `xml:"name,attr"`
	Desc           string          `xml:"desc,attr"`
	DatSet         string          `xml:"datSet,attr"`
	LdInst         string          `xml:"ldInst,attr"`
	Prefix         string          `xml:"prefix,attr"`
	LnClass        string          `xml:"lnClass,attr"`
	LnInst         string          `xml:"lnInst,attr"`
	IntgPd         int             `xml:"intgPd,attr"`
	ReasonCode     bool            `xml:"reasonCode,attr"`
	LogName        string          `xml:"logName,attr"`
	LogEna         bool            `xml:"logEna,attr"`
	TriggerOptions *TriggerOptions `xml:"TrgOps"`
}

type LogicalDevice

type LogicalDevice struct {
	Inst   string         `xml:"inst,attr"`
	LdName string         `xml:"ldName,attr"`
	LN0    *LogicalNode   `xml:"LN0" validate:"nonzero"`
	LNodes []*LogicalNode `xml:"LN"`

	// custom
	LogicalNodes []*LogicalNode // 将LN0、LN合并到一个数组中
}

type LogicalNode

type LogicalNode struct {
	Prefix  string `xml:"prefix,attr"`
	Inst    string `xml:"inst,attr"`
	LnClass string `xml:"lnClass,attr"`
	LnType  string `xml:"lnType,attr"`
	Desc    string `xml:"desc,attr"`

	DataSets                  []*DataSet             `xml:"DataSet"`
	ReportControlBlocks       []*ReportControl       `xml:"ReportControl"`
	GSEControlBlocks          []*GSEControl          `xml:"GSEControl"`
	SMVControlBlocks          []*SampledValueControl `xml:"SampledValueControl"`
	LogControlBlocks          []*LogControl          `xml:"LogControl"`
	Logs                      []*Log                 `xml:"Log"`
	SettingGroupControlBlocks []*SettingControl      `xml:"SettingControl"`
	DOINodes                  []*DOINode             `xml:"DOI"`

	// custom
	SclType     SclType
	DataObjects []*DataObject
}

func (*LogicalNode) GetChildByName

func (ln *LogicalNode) GetChildByName(childName string) DataModelNode

func (*LogicalNode) GetName

func (ln *LogicalNode) GetName() string

func (*LogicalNode) GetSclType

func (ln *LogicalNode) GetSclType() SclType

type LogicalNodeType

type LogicalNodeType struct {
	LnClass               string                  `xml:"lnClass,attr"`
	DataObjectDefinitions []*DataObjectDefinition `xml:"DO"`
	// contains filtered or unexported fields
}

func (*LogicalNodeType) GetDesc

func (s *LogicalNodeType) GetDesc() string

func (*LogicalNodeType) GetId

func (s *LogicalNodeType) GetId() string

func (*LogicalNodeType) GetUsed

func (s *LogicalNodeType) GetUsed() bool

func (*LogicalNodeType) SetUsed

func (s *LogicalNodeType) SetUsed(used bool)

type OptionFields

type OptionFields struct {
	SeqNum     bool `xml:"seqNum,attr"`
	TimeStamp  bool `xml:"timeStamp,attr"`
	DataSet    bool `xml:"dataSet,attr"`
	ReasonCode bool `xml:"reasonCode,attr"`
	DataRef    bool `xml:"dataRef,attr"`
	EntryID    bool `xml:"entryID,attr"`
	ConfigRef  bool `xml:"configRef,attr"`
	BufOvfl    bool `xml:"bufOvfl,attr"`
}

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

func NewParser

func NewParser(filePath string) *Parser

func (*Parser) Parse

func (p *Parser) Parse() (*SCL, error)

type PhyComAddress

type PhyComAddress struct {
	AddressParameters []*AddressParameter `xml:"P"`

	// custom
	VlanId       int64
	VlanPriority int
	AppId        int64
	MacAddress   []int
}

type PrintStream

type PrintStream struct {
	// contains filtered or unexported fields
}

type ReportControl

type ReportControl struct {
	Name           string          `xml:"name,attr"`
	Desc           string          `xml:"desc,attr"`
	DatSet         string          `xml:"datSet,attr"`
	RptID          string          `xml:"rptID,attr"`
	ConfRev        string          `xml:"confRev,attr"`
	Buffered       bool            `xml:"buffered,attr"`
	BufTime        int             `xml:"bufTime,attr"`
	IntgPd         string          `xml:"intgPd,attr"`
	IndexedStr     string          `xml:"indexed,attr"`
	TriggerOptions *TriggerOptions `xml:"TrgOps"`
	OptionFields   *OptionFields   `xml:"OptFields"`
	RptEnabled     *RptEnabled     `xml:"RptEnabled"`

	// custom
	Indexed bool
}

type ReportSettings

type ReportSettings struct {
	CbName    string `xml:"cbName,attr"`
	DatSet    string `xml:"datSet,attr"`
	RptID     string `xml:"rptID,attr"`
	OptFields string `xml:"optFields,attr"`
	BufTime   string `xml:"bufTime,attr"`
	TrgOps    string `xml:"trgOps,attr"`
	IntgPd    string `xml:"intgPd,attr"`
	Owner     bool   `xml:"owner,attr"`
}

type RptEnabled

type RptEnabled struct {
	MaxStr    string      `xml:"max,attr"`
	Desc      string      `xml:"desc,attr"`
	ClientLNs []*ClientLN `xml:"ClientLN"`

	// custom
	Max int
}

type SCL

type SCL struct {
	XMLName           xml.Name           `xml:"SCL"`
	Header            *Header            `xml:"Header"`
	Communication     *Communication     `xml:"Communication"`
	IEDs              []*IED             `xml:"IED" validate:"nonzero"`
	DataTypeTemplates *DataTypeTemplates `xml:"DataTypeTemplates" validate:"nonzero"`

	// custom
	FileFullPath string
}

type SMV

type SMV struct {
	LdInst  string         `xml:"ldInst,attr"`
	CbName  string         `xml:"cbName,attr"`
	Address *PhyComAddress `xml:"Address"`
}

type SampledValueControl

type SampledValueControl struct {
	Name      string   `xml:"name,attr"`
	Desc      string   `xml:"desc,attr"`
	DatSet    string   `xml:"datSet,attr"`
	SmvID     string   `xml:"smvID,attr"`
	SmpRate   int      `xml:"smpRate,attr"`
	NofASDU   int      `xml:"nofASDU,attr"`
	ConfRev   int      `xml:"confRev,attr"`
	SmpModStr string   `xml:"smpMod,attr"`
	Multicast bool     `xml:"multicast,attr"`
	SmvOpts   *SmvOpts `xml:"SmvOpts"`

	// custom
	SmpMod SmpMod
}

type SclType

type SclType interface {
	GetId() string
	GetDesc() string
	GetUsed() bool
	SetUsed(used bool)
}

type Server

type Server struct {
	Authentication *Authentication  `xml:"Authentication"`
	LogicalDevices []*LogicalDevice `xml:"LDevice" validate:"nonzero"`
}

type Services

type Services struct {
	ConfDataSet       *ConfDataSet       `xml:"ConfDataSet"`
	ConfReportControl *ConfReportControl `xml:"ConfReportControl"`
	ReportSettings    *ReportSettings    `xml:"ReportSettings"`
	ConfLNs           *ConfLNs           `xml:"ConfLNs"`
}

type SettingControl

type SettingControl struct {
	ActSG    int    `xml:"actSG,attr"`
	NumOfSGs int    `xml:"numOfSGs,attr"`
	Desc     string `xml:"desc,attr"`
}

type SmpMod

type SmpMod int
const (
	SmpPerPeriod SmpMod = iota
	SmpPerSecond
	SecPerSmp
)

type SmvOpts

type SmvOpts struct {
	RefreshTime        bool `xml:"refreshTime,attr"`
	SampleSynchronized bool `xml:"sampleSynchronized,attr"`
	Security           bool `xml:"security,attr"`
	DataSet            bool `xml:"dataSet,attr"`
	SampleRate         bool `xml:"sampleRate,attr"`
}

func (*SmvOpts) GetIntValue

func (that *SmvOpts) GetIntValue() int

type StaticModelGenerator

type StaticModelGenerator struct {
	// contains filtered or unexported fields
}

func NewStaticModelGenerator

func NewStaticModelGenerator(scl *SCL, iedName, ap, outDir, outFileName, modelPrefix string, initializeOnce bool) *StaticModelGenerator

func (*StaticModelGenerator) Generate

func (s *StaticModelGenerator) Generate() error

type SubNetwork

type SubNetwork struct {
	Name        string         `xml:"name,attr"`
	Type        string         `xml:"type,attr"`
	ConnectedAP []*ConnectedAP `xml:"ConnectedAP"`
}

type TriggerOptions

type TriggerOptions struct {
	Dchg   bool `xml:"dchg,attr"`
	Qchg   bool `xml:"qchg,attr"`
	Dupd   bool `xml:"dupd,attr"`
	Period bool `xml:"period,attr"`
	Gi     bool `xml:"gi,attr"`
}

func (*TriggerOptions) GetIntValue

func (that *TriggerOptions) GetIntValue() int

type Val

type Val struct {
	Value string `xml:",chardata"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL