models

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const EnlightRootNodeUUID uuid.UUID = uuid.UUID("df3214a6-2db7-11e8-b467-0ed5f89f718b")

EnlightRootNodeUUID is the base/root node that all other nodes attach to, must not be deleted or updated

Variables

This section is empty.

Functions

This section is empty.

Types

type Answers

type Answers []string

func (Answers) Array

func (as Answers) Array() []string

func (Answers) Validate

func (as Answers) Validate(valueType ValueType) error

type AssetNode

type AssetNode struct {
	Criticality   Criticality  `json:"criticality" example:"criticality_a"`
	AssetType     string       `json:"assetType,omitempty" example:"CO"`
	AssetClass    string       `json:"assetClass,omitempty" example:"AX"`
	AssetSequence string       `json:"assetSequence,omitempty" example:"02"`
	Manufacturer  string       `json:"manufacturer,omitempty" example:"Atlas Copco"`
	Model         string       `json:"model,omitempty" example:"SF"`
	SerialNumber  string       `json:"serialNumber,omitempty"`
	Components    []*Component `json:"components,omitempty"`
}

func (*AssetNode) FromGRPC

func (asset *AssetNode) FromGRPC(assetNode grpcapi.AssetNode)

func (AssetNode) ToGRPC

func (asset AssetNode) ToGRPC() *grpcapi.AssetNode

func (AssetNode) Validate

func (asset AssetNode) Validate() error

type BaseNode

type BaseNode struct {
	// ID of node, as a UUID
	ID uuid.UUID `json:"id" swaggertype:"string" format:"uuid" example:"7bcd1711-21bd-4eb7-8349-b053d6d5226f"`
	// ID of parent node, as a UUID
	ParentID uuid.UUID `json:"parentId" swaggertype:"string" format:"uuid" example:"8f7551c5-3357-406d-ab82-bcb138d0b13f"`
	// Type of node
	Type NodeType `` /* 178-byte string literal not displayed */
	// Type of node
	SubType NodeSubType `` /* 178-byte string literal not displayed */
	// Industry segment of this node
	Industry *IndustrySegment `` /* 228-byte string literal not displayed */
	// Origin of node, if imported from another system
	Origin *Origin `json:"origin,omitempty"`
	// Descriptive name of the node
	Label string `json:"label" example:"01AA DE"`
	// Description of the node
	Description string `json:"description" example:"First bearing, driven end"`
	// Relative position of node in the Enlight Centre UI
	Position *int64 `json:"position"`
	// Comma separated list of free form tags on this node
	Tags *string `json:"tags"`
	// Which country the node is in
	Country *string `json:"country,omitempty" example:"SWE"`
}

Node represent a hierarchy node

func (BaseNode) Validate

func (node BaseNode) Validate() error

type Component

type Component struct {
	Id            uuid.UUID       `json:"id"`
	Type          string          `json:"type"`
	Props         json.RawMessage `json:"props"`
	SubComponents []*Component    `json:"subComponents"`
}

func (*Component) FromGRPC

func (cmp *Component) FromGRPC(c *grpcapi.Component)

func (*Component) ToGRPC

func (cmp *Component) ToGRPC() *grpcapi.Component

func (*Component) Validate

func (c *Component) Validate() error

type Criticality

type Criticality string
const (
	CriticalityA       Criticality = "criticality_a"
	CriticalityB       Criticality = "criticality_b"
	CriticalityC       Criticality = "criticality_c"
	CriticalityUnknown Criticality = "criticality_unknown"
)

func ParseCriticality

func ParseCriticality(dbCriticality string) Criticality

func (Criticality) ValidateCriticaltiy

func (cr Criticality) ValidateCriticaltiy() error

type IndustrySegment

type IndustrySegment string
const (
	Agriculture           IndustrySegment = "agriculture"
	Construction          IndustrySegment = "construction"
	FoodAndBeverage       IndustrySegment = "food_and_beverage"
	HydrocarbonProcessing IndustrySegment = "hydrocarbon_processing"
	MachineTool           IndustrySegment = "machine_tool"
	Marine                IndustrySegment = "marine"
	Metal                 IndustrySegment = "metal"
	Mining                IndustrySegment = "mining"
	PowerGeneration       IndustrySegment = "power_generation"
	PulpAndPaper          IndustrySegment = "pulp_and_paper"
	Renewable             IndustrySegment = "renewable"
	Undefined             IndustrySegment = "undefined"
)

func (IndustrySegment) String

func (seg IndustrySegment) String() string

func (IndustrySegment) Title

func (seg IndustrySegment) Title() string

func (IndustrySegment) Validate

func (seg IndustrySegment) Validate() error

type InspectionPoint

type InspectionPoint struct {
	// Type of value to record
	ValueType ValueType `json:"valueType" example:"numeric" swaggertype:"string" enums:"numeric,single_choice,multi_choice,unknown"`
	// Unit of the value recorded, in case of numeric inspection
	NumericUnit string `json:"unit" example:"bar"`
	// Possible answers for single_choice and multi_choice inspections
	Answers Answers `json:"answers" swaggertype:"array,string" example:"first,second"`

	// Type of visualization in Enlight Centre
	VisualizationType     VisualizationType `` /* 166-byte string literal not displayed */
	VisualizationMinValue string            `json:"visualizationMinValue" example:"3"`
	VisualizationMaxValue string            `json:"visualizationMaxValue" example:"13"`
}

InspectionPoint - holds parameters for inspection point

func (*InspectionPoint) FromGRPC

func (p *InspectionPoint) FromGRPC(inspectPoint grpcapi.InspectionPoint)

func (InspectionPoint) ToGRPC

func (InspectionPoint) Validate

func (p InspectionPoint) Validate() error

type LubricantUnit

type LubricantUnit string
const (
	Gram                  LubricantUnit = "gram"
	Ounce                 LubricantUnit = "ounce"
	CM3                   LubricantUnit = "cm3"
	Unknown_LubricantUnit LubricantUnit = "unknown"
)

func ParseUnit

func ParseUnit(unit string) (returnUnit LubricantUnit)

func (LubricantUnit) String

func (lu LubricantUnit) String() string

func (LubricantUnit) Validate

func (lu LubricantUnit) Validate() error

type LubricationPoint

type LubricationPoint struct {
	// Type of lubricant used
	Lubricant string `json:"lubricant" example:"grease"`
	// Volume of lubricant, in the given unit
	Volume int32 `json:"lubricantVolume" example:"10"`
	// Unit that the volume is specified in
	Unit LubricantUnit `json:"lubricantUnit" swaggertype:"string" example:"cm3" enums:"gram,ounce,cm3,unknown"`
	// Interval between lubrication in days
	Interval int32 `json:"lubricateInterval" example:"5"`
}

func (*LubricationPoint) FromGRPC

func (p *LubricationPoint) FromGRPC(lubePoint hierarchy_proto.LubricationPoint)

func (LubricationPoint) ToGRPC

func (LubricationPoint) Validate

func (lp LubricationPoint) Validate() error

type MeasurementPoint

type MeasurementPoint struct {
	// Bearing number on this asset
	Bearing int32 `json:"bearing" example:"1"`
	// Orientation of measurement
	Angular Orientation `json:"orientation" swaggertype:"string" example:"vertical" enums:"axial,radial,radial90,horizontal,vertical,unknown"`
	// Type of measurement
	MeasurementType MeasurementType `` /* 179-byte string literal not displayed */
	// Identifier of shaft that this measurement point belongs to
	Shaft string `json:"shaft" example:"C"`
	// Which side of the given shaft this measurement point belongs to
	ShaftSide ShaftSide `json:"shaftSide" swaggertype:"string" example:"nde" enums:"de,nde"`
	// Speed in RPM if this shaft has a fixed speed
	FixedSpeedRPM float64 `json:"fixedSpeedRpm,omitempty" example:"150"`
	// ID of measurement point location
	LocationId *uuid.UUID `json:"locationId,omitempty" swaggertype:"string" format:"uuid"`
	// Type of device used to take measurements on this point
	DADType string `json:"dadType,omitempty"`
}

MeasurementPoint describes an assets measurement points

func (*MeasurementPoint) FromGRPC

func (meas *MeasurementPoint) FromGRPC(measPoint grpcapi.MeasurementPoint)

FromGRPC - converts to a MeasurementPoint from the gRPC MeasurementPoint struct

func (MeasurementPoint) ToGRPC

func (meas MeasurementPoint) ToGRPC() *grpcapi.MeasurementPoint

ToGRPC - converts a MeasurementPoint struct to grpcapi.MeasurementPoint

func (MeasurementPoint) Validate

func (meas MeasurementPoint) Validate() error

Validate - validates a MeasurementPoint

type MeasurementType

type MeasurementType string

MeasurementType is measurement type unit

const (
	Displacement           MeasurementType = "displacement"
	Acceleration           MeasurementType = "acceleration"
	Velocity               MeasurementType = "velocity"
	Temperature            MeasurementType = "temperature"
	DCGAP                  MeasurementType = "dc_gap"
	AMPLPHASE              MeasurementType = "ampl_phase"
	BOV                    MeasurementType = "bov"
	Speed                  MeasurementType = "speed"
	Envelope3              MeasurementType = "envelope_3"
	Envelope2              MeasurementType = "envelope_2"
	UnknownMeasurementType MeasurementType = "unknown"
)

Valid measurement type values

func ParseMeasurementType

func ParseMeasurementType(measurementType string) MeasurementType

ParseMeasurementType takes a string and makes it a valid measurement type value

func (MeasurementType) String

func (mt MeasurementType) String() string

func (MeasurementType) ToShort

func (m MeasurementType) ToShort() string

ParseMeasurementType takes a string and makes it a valid measurement type value

func (MeasurementType) Validate

func (mt MeasurementType) Validate() error

Validate - validates a MeasurementType

type Node

func (*Node) FromGRPC

func (n *Node) FromGRPC(node hierarchy_proto.Node)

func (Node) ToGRPC

func (n Node) ToGRPC() (node *hierarchy_proto.Node)

func (Node) ToGRPCAncestorNode

func (n Node) ToGRPCAncestorNode() (node hierarchy_proto.AncestorNode)

func (Node) Validate

func (node Node) Validate() (err error)

type NodeSubType

type NodeSubType string
const (
	NodeSubTypeRoot               NodeSubType = "root"
	NodeSubTypeCompany            NodeSubType = "company"
	NodeSubTypeSite               NodeSubType = "site"
	NodeSubTypePlant              NodeSubType = "plant"
	NodeSubTypeShip               NodeSubType = "ship"
	NodeSubTypeSystem             NodeSubType = "system"
	NodeSubTypeFunctionalLocation NodeSubType = "functional_location"
	NodeSubTypeAsset              NodeSubType = "asset"
	NodeSubTypeMeasurementPoint   NodeSubType = "measurement_point"
	NodeSubTypeInspectionPoint    NodeSubType = "inspection_point"
	NodeSubTypeLubricationPoint   NodeSubType = "lubrication_point"
)

func (NodeSubType) IsTypeOf

func (nc NodeSubType) IsTypeOf(nt NodeType) bool

func (NodeSubType) String

func (nc NodeSubType) String() string

func (NodeSubType) Validate

func (nc NodeSubType) Validate() error

type NodeType

type NodeType string
const (
	NodeTypeRoot               NodeType = "root"
	NodeTypeCompany            NodeType = "company"
	NodeTypeSite               NodeType = "site"
	NodeTypePlant              NodeType = "plant"
	NodeTypeSystem             NodeType = "system"
	NodeTypeFunctionalLocation NodeType = "functional_location"
	NodeTypeAsset              NodeType = "asset"
	NodeTypeMeasurementPoint   NodeType = "measurement_point"
	NodeTypeInspectionPoint    NodeType = "inspection_point"
	NodeTypeLubricationPoint   NodeType = "lubrication_point"
	NodeTypeUnknown            NodeType = "unknown"
)

func ParseNodeType

func ParseNodeType(nodetypeInput string) NodeType

func (NodeType) HasSubType

func (nt NodeType) HasSubType(cls NodeSubType) bool

func (NodeType) IsChildOf

func (nt NodeType) IsChildOf(parentType NodeType) bool

func (NodeType) String

func (nt NodeType) String() string

func (NodeType) Validate

func (nt NodeType) Validate() error

type Orientation

type Orientation string

Orientation describes a measurement points orientation

const (
	Axial              Orientation = "axial"
	Horizontal         Orientation = "horizontal"
	Vertical           Orientation = "vertical"
	Radial             Orientation = "radial"
	Radial90           Orientation = "radial90"
	UnknownOrientation Orientation = "unknown"
)

Valid values of measurement points orientations

func ParseOrientation

func ParseOrientation(orientation string) Orientation

ParseOrientation takes a string and makes it a valid orientation value

func (Orientation) String

func (o Orientation) String() string

func (Orientation) Validate

func (o Orientation) Validate() error

Validate - validates an Orientation

type Origin

type Origin struct {
	// Origin identity
	ID string `json:"id" example:"d932a2f2-bd5e-4803-831a-0f32d50c5b8e"`
	// Origin type
	Type string `json:"type" example:"TREEELEM"`
	// Origin provider
	Provider string `json:"provider" example:"8dc6763c-4eaf-4330-914d-56486ebfd68e"`
}

func (*Origin) FromGRPC

func (o *Origin) FromGRPC(origin common.Origin)

func (Origin) ToGRPC

func (o Origin) ToGRPC() *common.Origin

func (Origin) Validate

func (o Origin) Validate() (err error)

type Relation

type Relation struct {
	ID     uuid.UUID `json:"id"`
	FromID uuid.UUID `json:"fromId"`
	ToID   uuid.UUID `json:"toId"`
}

Relation represents a relation between two nodes

type ShaftSide

type ShaftSide string

ShaftSide describes on what side of a shaft the measurement point is located

const (
	DE               ShaftSide = "de"
	NDE              ShaftSide = "nde"
	UnknownShaftSide ShaftSide = "unknown"
)

Valid shaft side values

func ParseShaftSide

func ParseShaftSide(shaftSide string) ShaftSide

ParseShaftSide takes a string and makes it a valid shaft side value

func (ShaftSide) String

func (ss ShaftSide) String() string

func (ShaftSide) Validate

func (ss ShaftSide) Validate() error

Validate - validates a ShaftSide

type ValueType

type ValueType string
const (
	ValueTypeNumeric      ValueType = "numeric"
	ValueTypeSingleChoice ValueType = "single_choice"
	ValueTypeMultiChoice  ValueType = "multi_choice"
	ValueTypeUnknown      ValueType = "unknown"
)

func ParseInspectionType

func ParseInspectionType(inspectionType string) ValueType

func (ValueType) String

func (t ValueType) String() string

func (ValueType) Validate

func (t ValueType) Validate() error

type VisualizationType

type VisualizationType string

VisualizationType - defines visualization type when value type is numeric

const (
	VisualizationTypeNone          VisualizationType = "visualization_none"
	VisualizationTypeCircularGauge VisualizationType = "visualization_circular_gauge"
	VisualizationTypeLevelGauge    VisualizationType = "visualization_level_gauge"
)

Constants for VisualizationType

func (VisualizationType) String

func (t VisualizationType) String() string

String - stringifies VisualizationType

func (VisualizationType) Validate

func (t VisualizationType) Validate() error

Validate - validates VisualizationType

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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