Documentation ¶
Index ¶
- Constants
- func BusChannel(topic string) chan interface{}
- func SendBusMessage(topic string, message interface{})
- func WaitForBusMessage(topic string) interface{}
- type Asset
- type ConnectionRecord
- type Connections
- type Equipment
- type ErrorCode
- type MLMap
- type MachineIntegration
- type Maintenance
- type ModbusEntry
- type Service
- type Set
- func (set *Set) Add(x interface{})
- func (set *Set) Do(f func(interface{}))
- func (set *Set) Has(x interface{}) bool
- func (set *Set) Len() int
- func (set *Set) Map(f func(interface{}) interface{}) *Set
- func (set *Set) MarshalJSON() ([]byte, error)
- func (set *Set) Remove(x interface{})
- func (set *Set) Reset()
- func (set *Set) UnmarshalJSON(body []byte) (err error)
- type SystemState
Constants ¶
const ( Modbus = "modbus" ModbusTCP = "modbusTCP" ModbusRTU = "modbusRTU" OPCUA = "OPCUA" )
Protocol/Fieldbus Definitions
Variables ¶
This section is empty.
Functions ¶
func BusChannel ¶
func BusChannel(topic string) chan interface{}
BusChannel returns the channel associated with the topic. This is useful for 'select' operations in which a loop is blocked on the channel.
func SendBusMessage ¶
func SendBusMessage(topic string, message interface{})
SendBusMessage sends the supplied message into the bus channel topic. If no listeners are waiting on the topic, this call is a no-op (as there is no store and forward)
func WaitForBusMessage ¶
func WaitForBusMessage(topic string) interface{}
WaitForBusMessage blocks until receiving a message on bus channel topic. It returns what ever primitive or object was sent.
Types ¶
type Asset ¶
type Asset struct { MachineID string `json:"machineId"` Serial string `json:"serial,omitempty"` Type string `json:"type,omitempty"` Entity string `json:"entity,omitempty"` Location string `json:"location,omitempty"` Group string `json:"group,omitempty"` Line string `json:"line,omitempty"` WorkCenter string `json:"workCenter,omitempty"` }
Asset uniquely identifies a machine/piece of equipment
var AssetConfig Asset
AssetConfig stores the global Asset configuration object
type ConnectionRecord ¶
type ConnectionRecord struct { Provider string `json:"provider"` Type string `json:"type"` Endpoint string `json:"endpoint"` Port int `json:"port"` Protocol string `json:"protocol"` ProviderKey string `json:"providerKey, omitempty"` Baudrate int `json:"baudRate, omitempty"` }
ConnectionRecord defines fieldbus and IIoT integration specifics
type Connections ¶
type Connections struct { DeviceID string `json:"deviceId"` DeviceStateConnections []ConnectionRecord `json:"deviceState"` HistorianConnections []ConnectionRecord `json:"historian"` MachineConnections []ConnectionRecord `json:"machineIntegration"` OperationsAndTelemetryConnections []ConnectionRecord `json:"machineOperationsAndTelemetry"` }
Connections defines the arrays of ConnectionRecords defined for the system
var ConnectionConfig Connections
ConnectionConfig stores the global Connection configuration object
func (Connections) GetMachineConnection ¶
func (conn Connections) GetMachineConnection(class string) (record ConnectionRecord)
GetMachineConnection returns a ConnectionRecord from the stored MachineConnections that matches the supplied class
type Equipment ¶
type Equipment struct { Ref string `json:"ref"` URI string `json:"uri"` Entity string `json:"entity"` Models []string `json:"models"` Versions []string `json:"versions"` Desc MLMap `json:"desc"` MachineIntegrations MachineIntegration `json:"machineIntegration"` ErrorCodes []ErrorCode `json:"errorCodes"` MaintenanceOps []Maintenance `json:"maintenance"` }
Equipment collects configuration information about a machien
var EquipmentConfig Equipment
EquipmentConfig stores the global Equipment configuration object
type MachineIntegration ¶
type MachineIntegration struct {
ModbusEntries []ModbusEntry `json:"modbus,omitempty"`
}
MachineIntegration houses fieldbus integration configuration information
func (MachineIntegration) FindModbusEntriesByClass ¶
func (machineIntegration MachineIntegration) FindModbusEntriesByClass(class string) (entries []ModbusEntry)
FindModbusEntriesByClass returns all ModbusEntry 's defined in the equipment configuration using the class of entry as a search parameter. If no entries are found, an empty slice is returned.
func (MachineIntegration) FindModbusEntriesByFunction ¶
func (machineIntegration MachineIntegration) FindModbusEntriesByFunction(functions []int) (entries []ModbusEntry)
FindModbusEntriesByFunction returns all ModbusEntry 's defined in the equipment configuration object using the modbus function type as a search parameter. If no entries are found, an empty slice is returned.
type Maintenance ¶
type Maintenance struct { ID string `json:"id"` Title MLMap `json:"title"` Desc MLMap `json:"desc"` Interval string `json:"interval"` URI string `json:"uri"` }
Maintenance defines a maintenance entry for specific equipment
type ModbusEntry ¶
type ModbusEntry struct { RegisterName string `json:"registerName"` Address int `json:"address"` Class string `json:"class"` Desc MLMap `json:"desc"` Functions []int `json:"functions"` }
ModbusEntry defines a single modbus port's configuration information
type Service ¶
A Service is goroutine-based 'process' that attempts to create fault-tolerant, recoverable services
func (*Service) AddServiceDependentUpon ¶
AddServiceDependentUpon adds the name of a service that this service is dependent upon. Multiple names can be added.
func (*Service) Serve ¶
func (svc *Service) Serve()
Serve satisfies the interface defined by suture.
func (*Service) WaitForServices ¶
WaitForServices will block the execution of Service until dependent Services are running normally.
type Set ¶
type Set map[interface{}]bool
Set conveniently typedefs map[interface{}]bool
func (*Set) Do ¶
func (set *Set) Do(f func(interface{}))
Do runs the supplied function across all members of set
func (*Set) Map ¶
Map applies the results of the supplied function, using the set's members as arguments, and returns those results in a new Set.
func (*Set) MarshalJSON ¶
MarshalJSON returns a JSON encoded representation of the Set
func (*Set) UnmarshalJSON ¶
UnmarshalJSON adds passed JSON-encoded body to the Set.
type SystemState ¶
type SystemState struct { Timestamp time.Time `json:"timeStamp"` MemoryConsumed float64 `json:"memoryConsumed"` DiskConsumed float64 `json:"diskConsumed"` LoadAverage float64 `json:"loadAverage"` }
SystemState defines consumed system resources in time
func GetSystemState ¶
func GetSystemState() (state *SystemState)
GetSystemState returns consumed system resources in time