Documentation ¶
Overview ¶
Package info provides the OSI presentation layer.
Index ¶
Constants ¶
const ( // Overflow marks whether the value is beyond a predefined range. Overflow = 1 << iota // TimeInvalid flags that the elapsed time was incorrectly acquired. // This attribute is only valid for events of protection equipment. // See companion standard 101, subclause 7.2.6.4. TimeInvalid // Blocked flags that the value is blocked for transmission; the // value remains in the state that was acquired before it was blocked. Blocked // Substituted flags that the value was provided by the input of // an operator (dispatcher) instead of an automatic source. Substituted // NotTopical flags that the most recent update was unsuccessful. NotTopical // Invalid flags that the value was incorrectly acquired. Invalid // OK means no flags, no problems. OK = 0 )
Quality descriptor flags attribute measured values. See companion standard 101, subclause 7.2.6.3.
const ( Threashold // 1: threshold value Smoothing // 2: smoothing factor (filter time constant) LowLimit // 3: low limit for transmission of measured values HighLimit // 4: high limit for transmission of measured values ChangeFlag = 64 // marks local parameter change InOperationFlag = 128 // marks parameter operation )
Qualifier Of Parameter Of Measured Values See companion standard 101, subclause 7.2.6.24.
Variables ¶
var ( // Narrow is the smalles configuration. Narrow = &Params{CauseSize: 1, AddrSize: 1, ObjAddrSize: 1, TimeZone: time.UTC} // Wide is the largest configuration. Wide = &Params{CauseSize: 2, AddrSize: 2, ObjAddrSize: 3, TimeZone: time.UTC} )
var ErrType = errors.New("part5: type identification unknown")
ErrType signals an unknown TypeID.
var ObjSize [256]int = builtins
ObjSize maps the type identification (TypeID) to the serial octet size. Type extensions must register here.
Functions ¶
This section is empty.
Types ¶
type ASDU ¶
type ASDU struct { *Params ID InfoSeq bool // marks Info as a sequence Info []byte // information object serial // contains filtered or unexported fields }
ASDU (Application Service Data Unit) is an application message.
func MustNewInro ¶
func MustNewInro(p *Params, addr CommonAddr, orig uint8, group uint) *ASDU
MustNewInro returns a new interrogation command C_IC_NA_1. Use group 1 to 16, or 0 for the default.
func (*ASDU) AddObjAddr ¶
AddObjAddr appends an information object address to Info.
func (*ASDU) MarshalBinary ¶
MarshalBinary honors the encoding.BinaryMarshaler interface.
func (*ASDU) Reply ¶
Reply returns a new "responding" ASDU which addresses "initiating" u with a copy of Info.
func (*ASDU) UnmarshalBinary ¶
UnmarshalBinary honors the encoding.BinaryUnmarshaler interface. Params must be set in advance. All other fields are initialized.
type Cause ¶
type Cause uint8
Cause is the cause of transmission. See companion standard 101, subclause 7.2.3.
const ( Percyc Cause // periodic, cyclic Back // background scan Spont // spontaneous Init // initialized Req // request or requested Act // activation Actcon // activation confirmation Deact // deactivation Deactcon // deactivation confirmation Actterm // activation termination Retrem // return information caused by a remote command Retloc // return information caused by a local command File // file transfer Auth // authentication Seskey // maintenance of authentication session key Usrkey // maintenance of user role and update key Inrogen // interrogated by station interrogation Inro1 // interrogated by group 1 interrogation Inro2 // interrogated by group 2 interrogation Inro3 // interrogated by group 3 interrogation Inro4 // interrogated by group 4 interrogation Inro5 // interrogated by group 5 interrogation Inro6 // interrogated by group 6 interrogation Inro7 // interrogated by group 7 interrogation Inro8 // interrogated by group 8 interrogation Inro9 // interrogated by group 9 interrogation Inro10 // interrogated by group 10 interrogation Inro11 // interrogated by group 11 interrogation Inro12 // interrogated by group 12 interrogation Inro13 // interrogated by group 13 interrogation Inro14 // interrogated by group 14 interrogation Inro15 // interrogated by group 15 interrogation Inro16 // interrogated by group 16 interrogation Reqcogen // requested by general counter request Reqco1 // requested by group 1 counter request Reqco2 // requested by group 2 counter request Reqco3 // requested by group 3 counter request Reqco4 // requested by group 4 counter request UnkType // unknown type identification UnkCause // unknown cause of transmission UnkAddr // unknown common address of ASDU UnkInfo // unknown information object address )
type Cmd ¶
type Cmd uint
Cmd is a command. See companion standard 101, subclause 7.2.6.26.
func (Cmd) Exec ¶
Exec returns whether the command executes (or selects). See section 5, subclause 6.8.
func (Cmd) Qual ¶
Qual returns the qualifier of command.
0: no additional definition 1: short pulse duration (circuit-breaker), duration determined by a system parameter in the outstation 2: long pulse duration, duration determined by a system parameter in the outstation 3: persistent output 4‥8: reserved for standard definitions of this companion standard 9‥15: reserved for the selection of other predefined functions 16‥31: reserved for special use (private range)
type CommonAddr ¶
type CommonAddr uint16
CommonAddr is a station address. Zero is not used. The width is controlled by Params.AddrSize. See companion standard 101, subclause 7.2.4.
const GlobalAddr CommonAddr = 65535
GlobalAddr is the broadcast address. Use is restricted to C_IC_NA_1, C_CI_NA_1, C_CS_NA_1 and C_RP_NA_1. When in 8-bit mode 255 is mapped to this value on the fly.
type DoublePoint ¶
type DoublePoint uint
DoublePoint is a measured value of a determination aware switch. See companion standard 101, subclause 7.2.6.2. See http://blog.iec61850.com/2009/04/why-do-we-need-single-point-and-double.html
const ( IndeterminateOrIntermediate DoublePoint = iota DeterminedOff DeterminedOn Indeterminate )
type ID ¶
type ID struct { Addr CommonAddr // station address // Originator Address [1, 255] or 0 for the default. // The applicability is controlled by Params.CauseSize. Orig uint8 Type TypeID // information content Cause Cause // submission category }
ID identifies the application data.
type Normal ¶
type Normal int16
Normal is a 16-bit normalized value. See companion standard 101, subclause 7.2.6.6.
type ObjAddr ¶
type ObjAddr uint
ObjAddr is the information object address. The width is controlled by Params.ObjAddrSize. See companion standard 101, subclause 7.2.5.
const IrrelevantAddr ObjAddr = 0
Zero means that the address is irrelevant.
type Params ¶
type Params struct { // Number of octets for an ASDU common address. // The standard requires "a" in [1, 2]. AddrSize int // Number of octets for an ASDU cause of transmission. // The standard requires "b" in [1, 2]. // Value 2 includes/activates the originator address. CauseSize int // Number of octets for an ASDU information object address. // The standard requires "c" in [1, 3]. ObjAddrSize int // TimeZone controls the time tag interpretation. // The standard fails to mention this one. TimeZone *time.Location }
Params defines network-specific fixed system parameters. See companion standard 101, subclause 7.1.
func (*Params) ObjAddr ¶
ObjAddr decodes an information object address from buf. The function panics when the byte array is too small or when the address size parameter is out of bounds.
func (Params) ValidAddr ¶
func (p Params) ValidAddr(addr CommonAddr) error
ValidAddr returns the validation result of a station address.
type SetpointCmd ¶
type SetpointCmd uint
SetpointCmd is the qualifier of a set-point command. See companion standard 101, subclause 7.2.6.39.
func (SetpointCmd) Exec ¶
func (c SetpointCmd) Exec() bool
Exec returns whether the command executes (or selects). See section 5, subclause 6.8.
func (SetpointCmd) Qual ¶
func (c SetpointCmd) Qual() uint
Qual returns the qualifier of set-point command.
0: default 0‥63: reserved for standard definitions of this companion standard (compatible range) 64‥127: reserved for special use (private range)
type SinglePoint ¶
type SinglePoint uint
SinglePoint is a measured value of a switch. See companion standard 101, subclause 7.2.6.1.
const ( Off SinglePoint = iota On )
type StepPos ¶
type StepPos uint
StepPos is a measured value with transient state indication. See companion standard 101, subclause 7.2.6.5.
func NewStepPos ¶
NewStepPos returns a new step position. Values out of [-64, 63] oveflow silently.
type TypeID ¶
type TypeID uint8
TypeID is the ASDU type identification.
const ( M_SP_NA_1 TypeID // single-point information M_SP_TA_1 // single-point information with time tag M_DP_NA_1 // double-point information M_DP_TA_1 // double-point information with time tag M_ST_NA_1 // step position information M_ST_TA_1 // step position information with time tag M_BO_NA_1 // bitstring of 32 bit M_BO_TA_1 // bitstring of 32 bit with time tag M_ME_NA_1 // measured value, normalized value M_ME_TA_1 // measured value, normalized value with time tag M_ME_NB_1 // measured value, scaled value M_ME_TB_1 // measured value, scaled value with time tag M_ME_NC_1 // measured value, short floating point number M_ME_TC_1 // measured value, short floating point number with time tag M_IT_NA_1 // integrated totals M_IT_TA_1 // integrated totals with time tag M_EP_TA_1 // event of protection equipment with time tag M_EP_TB_1 // packed start events of protection equipment with time tag M_EP_TC_1 // packed output circuit information of protection equipment with time tag M_PS_NA_1 // packed single-point information with status change detection M_ME_ND_1 // measured value, normalized value without quality descriptor M_SP_TB_1 // single-point information with time tag CP56Time2a M_DP_TB_1 // double-point information with time tag CP56Time2a M_ST_TB_1 // step position information with time tag CP56Time2a M_BO_TB_1 // bitstring of 32 bits with time tag CP56Time2a M_ME_TD_1 // measured value, normalized value with time tag CP56Time2a M_ME_TE_1 // measured value, scaled value with time tag CP56Time2a M_ME_TF_1 // measured value, short floating point number with time tag CP56Time2a M_IT_TB_1 // integrated totals with time tag CP56Time2a M_EP_TD_1 // event of protection equipment with time tag CP56Time2a M_EP_TE_1 // packed start events of protection equipment with time tag CP56Time2a M_EP_TF_1 // packed output circuit information of protection equipment with time tag CP56Time2a S_IT_TC_1 // integrated totals containing time-tagged security statistics C_SC_NA_1 // single command C_DC_NA_1 // double command C_RC_NA_1 // regulating step command C_SE_NA_1 // set-point command, normalized value C_SE_NB_1 // set-point command, scaled value C_SE_NC_1 // set-point command, short floating point number C_BO_NA_1 // bitstring of 32 bits C_SC_TA_1 // single command with time tag CP56Time2a C_DC_TA_1 // double command with time tag CP56Time2a C_RC_TA_1 // regulating step command with time tag CP56Time2a C_SE_TA_1 // set-point command with time tag CP56Time2a, normalized value C_SE_TB_1 // set-point command with time tag CP56Time2a, scaled value C_SE_TC_1 // set-point command with time tag CP56Time2a, short floating point number C_BO_TA_1 // bitstring of 32-bit with time tag CP56Time2a M_EI_NA_1 // end of initialization S_CH_NA_1 // authentication challenge S_RP_NA_1 // authentication reply S_AR_NA_1 // aggressive mode authentication request S_KR_NA_1 // session key status request S_KS_NA_1 // session key status S_KC_NA_1 // session key change S_ER_NA_1 // authentication error S_US_NA_1 // user status change S_UQ_NA_1 // update key change request S_UR_NA_1 // update key change reply S_UK_NA_1 // update key change — symetric S_UA_NA_1 // update key change — asymetric S_UC_NA_1 // update key change confirmation C_IC_NA_1 // interrogation command C_CI_NA_1 // counter interrogation command C_RD_NA_1 // read command C_CS_NA_1 // clock synchronization command C_TS_NA_1 // test command C_RP_NA_1 // reset process command C_CD_NA_1 // delay acquisition command C_TS_TA_1 // test command with time tag CP56Time2a P_ME_NA_1 // parameter of measured value, normalized value P_ME_NB_1 // parameter of measured value, scaled value P_ME_NC_1 // parameter of measured value, short floating point number P_AC_NA_1 // parameter activation F_FR_NA_1 // file ready F_SR_NA_1 // section ready F_SC_NA_1 // call directory, select file, call file, call section F_LS_NA_1 // last section, last segment F_AF_NA_1 // ack file, ack section F_SG_NA_1 // segment F_DR_TA_1 // directory F_SC_NB_1 // QueryLog - request archive file (section 104) )
The standard ASDU labels specified over here follow a hierarchical order. At the root you'll find M for monitored information, C for control information, P for parameter and F for file transfer.