comtrade

package
v0.0.0-...-91c7ab2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ComtradeTimestampLayout = "02/01/2006,15:04:05.000000"

	ErrStringLength    = "Comtrade attribution length range err"
	ErrRangeValue      = "Comtrade attribution value range err"
	ErrConstraintValue = "Comtrade attribution value constraint err"
)

Variables

This section is empty.

Functions

func CalcPrimaryBySecondary

func CalcPrimaryBySecondary(PrimaryFactor, SecondaryFactor, Secondary float32) float32

func CalcSecondaryByPrimary

func CalcSecondaryByPrimary(PrimaryFactor, SecondaryFactor, Primary float32) float32

func CalcValue

func CalcValue(multiplier, offset, x float32) float32

Types

type AnalogChannelInfo

type AnalogChannelInfo struct {
	ChannelIndex    uint32  //M
	ChannelID       string  //O 0-64characters
	PhaseID         string  //O 0-2characters
	MonitoredDevice string  //O ccbm 0-64characters
	Unit            string  //M 1-32characters
	Multiplier      float32 //M value = x*Multiplier + Offset
	Offset          float32 //M
	Skew            float32 //O us channel timestamp offset
	MinRange        int32   //M
	MaxRange        int32   //M
	PrimaryFactor   float32 //M
	SecondaryFactor float32 //M
	PS              byte    //M ax+b represent P or S
}

AnalogChannelInfo An,ch_id,ph,ccbm,uu,a,b,skew,min,max,primary,secondary,PS <CR/LF>

func (AnalogChannelInfo) Convertor

func (a AnalogChannelInfo) Convertor() string

func (AnalogChannelInfo) Parser

func (a AnalogChannelInfo) Parser(line string) error

func (AnalogChannelInfo) Validator

func (a AnalogChannelInfo) Validator() error

type AnalogsPoints

type AnalogsPoints []int16

func MockAnalogsPoints

func MockAnalogsPoints(pointCount uint32) AnalogsPoints

type CfgFileInfo

type CfgFileInfo struct {
	SubstationInfo
	ChannelCountInfo
	AnalogChannels []AnalogChannelInfo
	StatusChannels []StatusChannelInfo
	SampleInfo
	TimestampInfo
	FileTypeInfo  string
	TimeMultiInfo float32
}

func NewComtradeCfgInfo

func NewComtradeCfgInfo() *CfgFileInfo

func (*CfgFileInfo) GenerateAsciiFile

func (c *CfgFileInfo) GenerateAsciiFile(filename string) error

func (*CfgFileInfo) InitAnalogChannelInfo

func (c *CfgFileInfo) InitAnalogChannelInfo(channelIndex uint32, channelID, phaseID, monitoredDevice, unit string, multiplier, offset, skew, primaryFactor, secondaryFactor float32, minRange, maxRange int32, ps byte)

func (*CfgFileInfo) InitChannelCountInfo

func (c *CfgFileInfo) InitChannelCountInfo(analogChannelCount, statusChannelCount uint32)

func (*CfgFileInfo) InitFileTypeInfo

func (c *CfgFileInfo) InitFileTypeInfo(fileType string)

func (*CfgFileInfo) InitSampleInfo

func (c *CfgFileInfo) InitSampleInfo(channelFrequency float32, sampleCount uint32, sampleDetails []SampleDetail)

func (*CfgFileInfo) InitStatusChannelInfo

func (c *CfgFileInfo) InitStatusChannelInfo(channelIndex uint32, channelID, phaseID, monitoredDevice string, state byte)

func (*CfgFileInfo) InitSubstationInfo

func (c *CfgFileInfo) InitSubstationInfo(substation, deviceID string)

func (*CfgFileInfo) InitTimeMultiInfo

func (c *CfgFileInfo) InitTimeMultiInfo(timeMulti float32)

func (*CfgFileInfo) InitTimestampInfo

func (c *CfgFileInfo) InitTimestampInfo(startTimestamp, triggerTimestamp time.Time)

type ChannelCountInfo

type ChannelCountInfo struct {
	TotalChannelCount  uint32 //M 1-999999  TotalChannelCount = AnalogChannelCount + StatusChannelCount
	AnalogChannelCount uint32 //M
	StatusChannelCount uint32 //M
}

ChannelCountInfo channel means DO TT,##A,##D <CR/LF>

func (ChannelCountInfo) Convertor

func (c ChannelCountInfo) Convertor() string

func (ChannelCountInfo) Parser

func (c ChannelCountInfo) Parser(line string) error

func (ChannelCountInfo) Validator

func (c ChannelCountInfo) Validator() error

type Comtrader

type Comtrader interface {
	Parser(line string) error
	Validator() error
	Convertor() string
}

type DatFileInfo

type DatFileInfo struct {
	SampleIndex uint32          //M
	Timestamp   time.Time       //O, depends on SampleCount\SampleDetail
	Analogs     []AnalogsPoints //O
	States      []StatusPoints  //O
	// contains filtered or unexported fields
}

func NewDatFileInfo

func NewDatFileInfo(cfgInfo *CfgFileInfo) *DatFileInfo

func (*DatFileInfo) GenerateBinaryFile

func (d *DatFileInfo) GenerateBinaryFile(filename string) error

type SampleDetail

type SampleDetail struct {
	Frequency  float32 //M
	PointCount uint32  //M
}

type SampleInfo

type SampleInfo struct {
	ChannelFrequency float32        //O Hz
	SampleCount      uint32         //M 0-999, sample count with N frequency
	SampleDetails    []SampleDetail //M
}

SampleInfo lf <CR/LF> nrates <CR/LF> samp,endsamp <CR/LF> samp,endsamp <CR/LF>

func (SampleInfo) Convertor

func (s SampleInfo) Convertor() string

func (SampleInfo) Parser

func (s SampleInfo) Parser(line string) error

func (SampleInfo) Validator

func (s SampleInfo) Validator() error

type StatusChannelInfo

type StatusChannelInfo struct {
	ChannelIndex    uint32 //M
	ChannelID       string //O 0-64characters
	PhaseID         string //O 0-2characters
	MonitoredDevice string //O ccbm 0-64characters
	State           byte   //M 0 or 1
}

StatusChannelInfo Dn,ch_id,ph,ccbm,y <CR/LF>

func (StatusChannelInfo) Convertor

func (s StatusChannelInfo) Convertor() string

func (StatusChannelInfo) Parser

func (s StatusChannelInfo) Parser(line string) error

func (StatusChannelInfo) Validator

func (s StatusChannelInfo) Validator() error

type StatusPoints

type StatusPoints []byte

func MockStatusPoints

func MockStatusPoints(pointCount uint32) StatusPoints

type SubstationInfo

type SubstationInfo struct {
	Substation   string //O 0-64characters
	DeviceID     string //O 0-64characters
	RevisionYear string //M 1999
}

SubstationInfo station_name,rec_dev_id,rev_year <CR/LF>

func (SubstationInfo) Convertor

func (s SubstationInfo) Convertor() string

func (SubstationInfo) Parser

func (s SubstationInfo) Parser(line string) error

func (SubstationInfo) Validator

func (s SubstationInfo) Validator() error

type TimestampInfo

type TimestampInfo struct {
	StartTimestamp   time.Time //O
	TriggerTimestamp time.Time //O
}

TimestampInfo dd/mm/yyyy,hh:mm:ss.ssssss <CR/LF> dd/mm/yyyy,hh:mm:ss.ssssss <CR/LF>

func (TimestampInfo) Convertor

func (t TimestampInfo) Convertor() string

func (TimestampInfo) Parser

func (t TimestampInfo) Parser(line string) error

func (TimestampInfo) Validator

func (t TimestampInfo) Validator() error

Jump to

Keyboard shortcuts

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