models

package
v0.0.0-...-c6cd810 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2021 License: MIT Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Calendar

type Calendar struct {
	CalendarName CalendarName
}

Calendar contains data related to the calendar of a tariff settings log entry.

type CalendarName

type CalendarName struct {
	IsActive      bool
	SeasonProfile string // for now, the exact type is unknown
	WeekProfile   string // for now, the exact type is unknown
	DayProfile    string // for now, the exact type is unknown
}

CalendarName contains data related to the calendar of a tariff settings log entry.

type ConnectOrDisconnectPayload

type ConnectOrDisconnectPayload struct {
	Type      int
	ClientID  string
	URL       string
	Topic     string
	Timeout   int
	Connected bool
}

ConnectOrDisconnectPayload contains information related to a connect or disconnect event.

type ConnectToPLCPayload

type ConnectToPLCPayload struct {
	Interface          string
	DestinationAddress string
}

ConnectToPLCPayload contains the parsed connect to PLC payload.

type ConnectionAttemptParams

type ConnectionAttemptParams struct {
	URL    string
	SmcUID string
	At     string // eg. (@ 000A)
}

ConnectionAttemptParams contains a parsed connection attempt log entry.

type ConnectionReleasedParams

type ConnectionReleasedParams struct {
	URL string
}

ConnectionReleasedParams contains a parsed connection attempt log entry.

type DCMessageParams

type DCMessageParams struct {
	IsInComing       bool
	SourceOrDestName string
	MessageType      DCMessageType
	Payload          *DcMessagePayload
}

DCMessageParams contains the parsed info level messages that have been sent or received by the dc.

type DCMessageType

type DCMessageType int64

DCMessageType represents the type of a dc message log entry.

const (
	// UnknownDCMessage is the default value of DCMessageType.
	UnknownDCMessage        DCMessageType = iota
	IndexReceived                         // <--[index]--(SMC)
	Consumption                           // <--[consumption]--(SMC)
	MessageSentToSVI                      // --[message]-->(SVI)
	PodConfig                             // <--[pod configuration]--(DB)
	SmcAddress                            // <--[smc address]--(DB)
	SmcConfig                             // <--[smc configuration]--(DB)
	ServiceLevel                          // <--[service_level]--(DB)
	Settings                              // --[settings]-->(DB)
	DLMSLogs                              // --[DLMS Logs]-->(SVI)
	NewSmc                                // <--[new smc]--(SVI)
	IndexLowProfileGeneric                // <--[index low profile generic]--(SMC)
	IndexHighProfileGeneric               // <--[index high profile generic]--(SMC)
	Connect                               // --[connect]-->(PLC) or --[connect]-->(SVI) or --[connect]-->(UDS)
	Statistics                            // --[statistics]-->(SVI)
	ReadIndexLowProfiles                  // --[read index low profiles]-->(SMC)
	ReadIndexProfiles                     // <--[read index profiles]--(SMC)
)

func ParseDCmessageTypeFromString

func ParseDCmessageTypeFromString(messageTypeString string) DCMessageType

ParseDCmessageTypeFromString parses the dc message type from a string representation.

type DLMSLogPayload

type DLMSLogPayload struct {
	DLMSRequestTime  time.Time
	DLMSResponseTime time.Time
	DLMSError        string
}

DLMSLogPayload contains data of a log entry related to DLMS Log contents.

type DcMessagePayload

type DcMessagePayload struct {
	SmcUID         string
	PodUID         string
	ServiceLevelID int
	Value          int
	Time           time.Time

	TimeRange *TimeRange

	ConnectOrDisconnectPayload       *ConnectOrDisconnectPayload
	DLMSLogPayload                   *DLMSLogPayload
	IndexPayload                     *IndexPayload
	GenericIndexProfilePayload       *GenericIndexProfilePayload
	MessagePayload                   *MessagePayload
	SettingsPayload                  *SettingsPayload
	ServiceLevelPayload              *ServiceLevelPayload
	SmcAddressPayload                *SmcAddressParams
	SmcConfigPayload                 *SmcConfigPayload
	PodConfigPayload                 *PodConfigPayload
	ConnectToPLCPayload              *ConnectToPLCPayload
	StatisticsEntryPayload           *StatisticsEntryPayload
	ReadIndexLowProfilesEntryPayload *ReadIndexLowProfilesEntryPayload
	ReadIndexProfilesEntryPayload    *ReadIndexProfilesEntryPayload
}

DcMessagePayload contains the parsed payload of info level messages that have been sent or received by the dc.

type EntryWithLevelAndTimestamp

type EntryWithLevelAndTimestamp struct {
	Timestamp time.Time
	Level     string
	Rest      string
}

EntryWithLevelAndTimestamp contains a line of the input file with the parsed timestamp.

type EntryWithLogLevel

type EntryWithLogLevel struct {
	Level string
	Rest  string
}

EntryWithLogLevel contains a line of the input file with the parsed timestamp and log level.

type ErrorParams

type ErrorParams struct {
	ErrorCode   int
	Message     string
	Severity    int
	Description string
	Source      string // If not empty, this is the UID of an smc.
}

ErrorParams contains the parsed error parameters.

type GenericIndexProfilePayload

type GenericIndexProfilePayload struct {
	CapturePeriod  int
	CaptureObjects int
}

GenericIndexProfilePayload contains the parsed index high/low profile generic payload.

type HourlyEnergyLimit

type HourlyEnergyLimit struct {
	HourNumber int
	Limit      int
}

HourlyEnergyLimit contains the value and the hour number of an hourly energy limit.

type IndexPayload

type IndexPayload struct {
	PreviousTime  time.Time // it might be ticks or something (eg. 1591776000)
	PreviousValue int
	SerialNumber  int
}

IndexPayload contains data of an index log entry.

type InfoEntryType

type InfoEntryType int64

InfoEntryType represents the type of an INFO level log entry.

const (
	// UnknownInfoType is the default value of EntryType.
	UnknownInfoType     InfoEntryType = iota
	Routing                           // Routing Table: Addr[0x0008]...
	NetworkStatus                     // <--[Network status]--(PLC)
	SMCJoin                           // SMC Join OK [Confirmed] <--     or     SMC Join NOT OK [Rejected] <--
	ConnectionAttempt                 // Attempt to connect to SMC
	SmcConfigUpdate                   // Update SMC configuration in DB
	DCMessage                         // entries that are described by the DCMessageType enum
	ConnectionReleased                // Successfully Released DLMS connection
	InitDLMSConnection                // Initialize DLMS connection
	InternalDiagnostics               // SMC internal diagnostics
)

type InfoParams

type InfoParams struct {
	EntryType               InfoEntryType
	RoutingMessage          *RoutingTableParams      // no smc UID for this kind of entries
	JoinMessage             *SmcJoinMessageParams    // has an SMC UID
	StatusMessage           *StatusMessageParams     // no smc UID for this kind of entries
	DCMessage               *DCMessageParams         // has an SMC UID
	ConnectionAttempt       *ConnectionAttemptParams // has an SMC UID and url
	SmcConfigUpdate         *SmcConfigUpdateParams
	ConnectionReleased      *ConnectionReleasedParams
	InitConnection          *InitConnectionParams
	InternalDiagnosticsData *InternalDiagnosticsData
}

InfoParams contains the parsed info parameters.

type InitConnectionParams

type InitConnectionParams struct {
	URL string
}

InitConnectionParams contains a parsed initialize dlms connection log entry.

type InternalDiagnosticsData

type InternalDiagnosticsData struct {
	SmcUID                         string
	LastSuccessfulDlmsResponseDate time.Time
}

InternalDiagnosticsData contains a parsed internal diagnostics log entry.

type LostConnectionParams

type LostConnectionParams struct {
	Type      int
	Reason    string
	ClientID  string
	URL       string
	Topic     string
	Timeout   int
	Connected bool
}

LostConnectionParams contains a parsed lost connaction warning entry.

type MessagePayload

type MessagePayload struct {
	Current float64
	Total   float64
	URL     string
	Topic   string
}

MessagePayload contains the parameters of a log entry related to a DC message.

type ParsedLogEntry

type ParsedLogEntry struct {
	Timestamp     time.Time
	Level         string
	ErrorParams   *ErrorParams
	WarningParams *WarningParams
	InfoParams    *InfoParams
}

ParsedLogEntry contains a parsed line from the log file.

func (*ParsedLogEntry) FromJSON

func (p *ParsedLogEntry) FromJSON(bytes []byte)

Serialize serialzes a parsed log enrty.

func (*ParsedLogEntry) Serialize

func (p *ParsedLogEntry) Serialize() []byte

Serialize serialzes a parsed log enrty.

type PodConfigPayload

type PodConfigPayload struct {
	SerialNumber            int
	Phase                   int
	PositionInSmc           int
	SoftwareFirmwareVersion string
}

PodConfigPayload contains the parameters of a log entry related to a pod configuration event.

type ReadIndexLowProfilesEntryPayload

type ReadIndexLowProfilesEntryPayload struct {
	SmcUID string
	From   time.Time
	To     time.Time
}

ReadIndexLowProfilesEntryPayload contains the parsed --[read index low profiles]-->(SMC) entries.

type ReadIndexProfilesEntryPayload

type ReadIndexProfilesEntryPayload struct {
	SmcUID string
	Count  int
}

ReadIndexProfilesEntryPayload contains the parsed <--[read index profiles]--(SMC) entries.

type RoutingTableParams

type RoutingTableParams struct {
	Address        string
	NextHopAddress string
	RouteCost      int
	HopCount       int
	WeakLink       int
	ValidTimeMins  int
}

RoutingTableParams contains the parsed routing table message parameters.

type ServiceLevelPayload

type ServiceLevelPayload struct {
	MeterMode                      int
	StartHourDailyCycle            string // eg. 20h
	LoadSheddingDailyEnergyBudget  int
	LocalSheddingDailyEnergyBudget int
	MaxActivePower                 int
	InService                      bool
	Name                           string
	HourlyEnergyLimits             [24]HourlyEnergyLimit
	LocalHourlyEnergyLimits        [24]HourlyEnergyLimit
}

ServiceLevelPayload contains the parsed service level related data in info level log entries that describe messages sent or received by the dc.

type SettingsPayload

type SettingsPayload struct {
	DcUID                         string
	Locality                      string
	Region                        string
	Timezone                      string
	GlobalFtpAddress              string
	TargetFirmwareVersion         string
	IndexCollection               int
	DataPublish                   int
	LastServerCommunicationTime   time.Time
	DcDistroTargetFirmwareVersion string
	LastDcStartTime               time.Time // it might be ticks or something (eg. 1591780709)
	FrequencyBandChanged          bool
	FrequencyBandRollBackDone     bool
}

SettingsPayload contains the parsed settings payload of info level messages that have been sent or received by the dc.

type SmcAddressParams

type SmcAddressParams struct {
	SmcUID          string
	PhysicalAddress string
	LogicalAddress  string
	ShortAddress    int
	LastJoiningDate time.Time
}

SmcAddressParams contains the parsed SMC address parameters of an SMC join log entry.

type SmcConfigPayload

type SmcConfigPayload struct {
	CustomerSerialNumber           string
	PhysicalAddress                string
	SmcStatus                      string
	CurrentApp1Fw                  string
	CurrentApp2Fw                  string
	CurrentPlcFw                   string
	LastSuccessfulDlmsResponseDate time.Time
	NextHop                        int
}

SmcConfigPayload contains data related to the configuration of an SMC.

type SmcConfigUpdateParams

type SmcConfigUpdateParams struct {
	PhysicalAddress string
	LogicalAddress  string
	ShortAddress    int
	LastJoiningDate time.Time
	SmcUID          string
}

SmcConfigUpdateParams contains a parsed SMC config update log entry. Update SMC configuration in DB smc_uid[dc18-smc32] physical_address[EEBEDDFFFE6210AD]

logical_address[FE80::4021:FF:FE00:000a:61616] short_address[10]
last_joining_date[Wed Jun 10 09:20:14 2020]! (distribution_controller_plc_interface.cc::68).

type SmcJoinMessageParams

type SmcJoinMessageParams struct {
	Ok         bool
	Response   string
	JoinType   string
	SmcAddress SmcAddressParams
}

SmcJoinMessageParams contains the parsed SMC join message parameters.

type StatisticsEntryPayload

type StatisticsEntryPayload struct {
	Type     string
	Value    float64
	Time     time.Time
	SourceID string
}

StatisticsEntryPayload contains the parsed statistics log entry sent to the SVI.

type StatusMessageParams

type StatusMessageParams struct {
	Message    string
	StatusByte string
}

StatusMessageParams contains the parsed message lines from plc_manager.log.

type TaskFailedWarningParams

type TaskFailedWarningParams struct {
	Name          string // The name of the failed task.
	SmcUID        string
	UID           int
	Priority      int
	Retry         int
	FileName      string
	Creation      time.Time
	MinLaunchTime time.Time

	Details *ErrorParams
}

TaskFailedWarningParams contains a parsed task failed type, warn level log entry.

type TimeOutParams

type TimeOutParams struct {
	Protocol string
	URL      string
}

TimeOutParams contains the parsed timeout WARN level log entries.

type TimeRange

type TimeRange struct {
	From time.Time
	To   time.Time
}

TimeRange represents a time range.

type WarningEntryType

type WarningEntryType int64

WarningEntryType represents the type of a warning log entry.

const (
	// UnknownWarningTypeType is the default value of WarningEntryType.
	UnknownWarningTypeType WarningEntryType = iota
	TaskFailedWarning
	JoinRejectedWarning
	TimeoutWarning
	ConnectionLostWarning
)

type WarningParams

type WarningParams struct {
	WarningType WarningEntryType

	TaskFailedWarningParams *TaskFailedWarningParams
	JoinMessageParams       *SmcJoinMessageParams
	TimeoutParams           *TimeOutParams
	LostConnectionParams    *LostConnectionParams
}

WarningParams contains the parsed warning parameters.

Jump to

Keyboard shortcuts

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