Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

## Introduction

This library provides an implementation of SPINE 1.3 in [go](https://golang.org), which is part of the [EEBUS](https://eebus.org) specification.
This library provides an implementation of SPINE 1.4 in [go](https://golang.org), which is part of the [EEBUS](https://eebus.org) specification.

Basic understanding of the EEBUS concepts SHIP and SPINE to use this library is required. Please check the corresponding specifications on the [EEBUS downloads website](https://www.eebus.org/media-downloads/).

Expand Down
3 changes: 3 additions & 0 deletions model/commandframe.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ type FilterType struct {
SupplyConditionDescriptionListDataSelectors *SupplyConditionDescriptionListDataSelectorsType `json:"supplyConditionDescriptionListDataSelectors,omitempty" eebus:"typ:selector,fct:supplyConditionDescriptionListData"`
SupplyConditionListDataSelectors *SupplyConditionListDataSelectorsType `json:"supplyConditionListDataSelectors,omitempty" eebus:"typ:selector,fct:supplyConditionListData"`
SupplyConditionThresholdRelationListDataSelectors *SupplyConditionThresholdRelationListDataSelectorsType `json:"supplyConditionThresholdRelationListDataSelectors,omitempty" eebus:"typ:selector,fct:supplyConditionThresholdRelationListData"`
SurrogateDescriptionListDataSelectors *SurrogateDescriptionListDataSelectorsType `json:"surrogateDescriptionListDataSelectors,omitempty" eebus:"typ:selector,fct:surrogateDescriptionListData"`
TariffBoundaryRelationListDataSelectors *TariffBoundaryRelationListDataSelectorsType `json:"tariffBoundaryRelationListDataSelectors,omitempty" eebus:"typ:selector,fct:tariffBoundaryRelationListData"`
TariffDescriptionListDataSelectors *TariffDescriptionListDataSelectorsType `json:"tariffDescriptionListDataSelectors,omitempty" eebus:"typ:selector,fct:tariffDescriptionListData"`
TariffListDataSelectors *TariffListDataSelectorsType `json:"tariffListDataSelectors,omitempty" eebus:"typ:selector,fct:tariffListData"`
Expand Down Expand Up @@ -235,6 +236,7 @@ type FilterType struct {
SupplyConditionDataElements *SupplyConditionDataElementsType `json:"supplyConditionDataElements,omitempty" eebus:"typ:elements,fct:supplyConditionListData"`
SupplyConditionDescriptionDataElements *SupplyConditionDescriptionDataElementsType `json:"supplyConditionDescriptionDataElements,omitempty" eebus:"typ:elements,fct:supplyConditionDescriptionListData"`
SupplyConditionThresholdRelationDataElements *SupplyConditionThresholdRelationDataElementsType `json:"supplyConditionThresholdRelationDataElements,omitempty" eebus:"typ:elements,fct:supplyConditionThresholdRelationListData"`
SurrogateDescriptionDataElements *SurrogateDescriptionDataElementsType `json:"surrogateDescriptionDataElements,omitempty" eebus:"typ:elements,fct:surrogateDescriptionListData"`
TariffBoundaryRelationDataElements *TariffBoundaryRelationDataElementsType `json:"tariffBoundaryRelationDataElements,omitempty" eebus:"typ:elements,fct:tariffBoundaryRelationListData"`
TariffDataElements *TariffDataElementsType `json:"tariffDataElements,omitempty" eebus:"typ:elements,fct:tariffListData"`
TariffDescriptionDataElements *TariffDescriptionDataElementsType `json:"tariffDescriptionDataElements,omitempty" eebus:"typ:elements,fct:tariffDescriptionListData"`
Expand Down Expand Up @@ -391,6 +393,7 @@ type CmdType struct {
SupplyConditionDescriptionListData *SupplyConditionDescriptionListDataType `json:"supplyConditionDescriptionListData,omitempty" eebus:"fct:supplyConditionDescriptionListData"`
SupplyConditionListData *SupplyConditionListDataType `json:"supplyConditionListData,omitempty" eebus:"fct:supplyConditionListData"`
SupplyConditionThresholdRelationListData *SupplyConditionThresholdRelationListDataType `json:"supplyConditionThresholdRelationListData,omitempty" eebus:"fct:supplyConditionThresholdRelationListData"`
SurrogateDescriptionListData *SurrogateDescriptionListDataType `json:"surrogateDescriptionListData,omitempty" eebus:"fct:surrogateDescriptionListData"`
TariffBoundaryRelationListData *TariffBoundaryRelationListDataType `json:"tariffBoundaryRelationListData,omitempty" eebus:"fct:tariffBoundaryRelationListData"`
TariffDescriptionListData *TariffDescriptionListDataType `json:"tariffDescriptionListData,omitempty" eebus:"fct:tariffDescriptionListData"`
TariffListData *TariffListDataType `json:"tariffListData,omitempty" eebus:"fct:tariffListData"`
Expand Down
8 changes: 8 additions & 0 deletions model/commondatatypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,11 @@ const (
ScopeTypeTypeIncentiveTableEnConsWithTF ScopeTypeType = "incentiveTableEnConsWithTF"
ScopeTypeTypeIncentiveTableEnProdWithTF ScopeTypeType = "incentiveTableEnProdWithTF"
ScopeTypeTypeActivePowerForecast ScopeTypeType = "activePowerForecast"
ScopeTypeTypeACEnergyPossibleConsumption ScopeTypeType = "acEnergyPossibleConsumption"
ScopeTypeTypeExtraPowerRequest ScopeTypeType = "extraPowerRequest"
ScopeTypeTypeTimeToMinimumSoC ScopeTypeType = "timeToMinimumSoC"
ScopeTypeTypeTimeToMaximumSoC ScopeTypeType = "timeToMaximumSoC"
ScopeTypeTypeTimeToTargetSoC ScopeTypeType = "timeToTargetSoC"
)

type RoleType string
Expand Down Expand Up @@ -693,6 +698,7 @@ const (
EntityTypeTypePVString EntityTypeType = "PVString"
EntityTypeTypeGridGuard EntityTypeType = "GridGuard"
EntityTypeTypeControllableSystem EntityTypeType = "ControllableSystem"
EntityTypeTypeSurrogate EntityTypeType = "Surrogate"
)

type FeatureTypeType string
Expand Down Expand Up @@ -730,6 +736,7 @@ const (
FeatureTypeTypeBill FeatureTypeType = "Bill"
FeatureTypeTypeIdentification FeatureTypeType = "Identification"
FeatureTypeTypeStateInformation FeatureTypeType = "StateInformation"
FeatureTypeTypeSurrogate FeatureTypeType = "Surrogate"
)

type FeatureSpecificUsageType string
Expand Down Expand Up @@ -901,6 +908,7 @@ const (
FunctionTypeSupplyConditionDescriptionListData FunctionType = "supplyConditionDescriptionListData"
FunctionTypeSupplyConditionListData FunctionType = "supplyConditionListData"
FunctionTypeSupplyConditionThresholdRelationListData FunctionType = "supplyConditionThresholdRelationListData"
FunctionTypeSurrogateDescriptionListData FunctionType = "surrogateDescriptionListData"
FunctionTypeTaskManagementJobDescriptionListData FunctionType = "taskManagementJobDescriptionListData"
FunctionTypeTaskManagementJobListData FunctionType = "taskManagementJobListData"
FunctionTypeTaskManagementJobRelationListData FunctionType = "taskManagementJobRelationListData"
Expand Down
10 changes: 10 additions & 0 deletions model/deviceconfiguration.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ const (
DeviceConfigurationKeyNameTypeIncentivesSimulationConcurrent DeviceConfigurationKeyNameType = "incentivesSimulationConcurrent"
DeviceConfigurationKeyNameTypeIncentivesTimeoutIncentiveRequest DeviceConfigurationKeyNameType = "incentivesTimeoutIncentiveRequest"
DeviceConfigurationKeyNameTypeIncentivesWaitIncentiveWriteable DeviceConfigurationKeyNameType = "incentivesWaitIncentiveWriteable"
DeviceConfigurationKeyNameTypePowerSetpointDeviation DeviceConfigurationKeyNameType = "powerSetpointDeviation"
DeviceConfigurationKeyNameTypePowerSetpointDeviationTypes DeviceConfigurationKeyNameType = "powerSetpointDeviationTypes"
DeviceConfigurationKeyNameTypeRemainingExtraPowerRequests DeviceConfigurationKeyNameType = "remainingExtraPowerRequests"
DeviceConfigurationKeyNameTypePvChargeMode DeviceConfigurationKeyNameType = "pvChargeMode"
DeviceConfigurationKeyNameTypeSurplusWithThresholdValue DeviceConfigurationKeyNameType = "surplusWithThresholdValue"
DeviceConfigurationKeyNameTypeStartDelay DeviceConfigurationKeyNameType = "startDelay"
DeviceConfigurationKeyNameTypeStopDelay DeviceConfigurationKeyNameType = "stopDelay"
DeviceConfigurationKeyNameTypeMinimumStateOfCharge DeviceConfigurationKeyNameType = "minimumStateOfCharge"
DeviceConfigurationKeyNameTypeTargetStateOfCharge DeviceConfigurationKeyNameType = "targetStateOfCharge"
DeviceConfigurationKeyNameTypePhaseRotation DeviceConfigurationKeyNameType = "phaseRotation"
)

type DeviceConfigurationKeyValueTypeType string
Expand Down
2 changes: 2 additions & 0 deletions model/identification.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const (
IdentificationTypeTypeEui48 IdentificationTypeType = "eui48"
IdentificationTypeTypeEui64 IdentificationTypeType = "eui64"
IdentificationTypeTypeUserrfidtag IdentificationTypeType = "userRfidTag"
IdentificationTypeTypePcId IdentificationTypeType = "pcid"
IdentificationTypeTypeEmaId IdentificationTypeType = "emaid"
)

type IdentificationValueType string
Expand Down
26 changes: 18 additions & 8 deletions model/setpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ const (
SetpointTypeTypeValueRelative SetpointTypeType = "valueRelative"
)

type SetpointValuesType struct {
Value []ScaledNumberType `json:"value,omitempty"`
}

type SetpointValuesElementsType struct {
Value []ScaledNumberElementsType `json:"value,omitempty"`
}

type SetpointDataType struct {
SetpointId *SetpointIdType `json:"setpointId,omitempty" eebus:"key"`
Value *ScaledNumberType `json:"value,omitempty"`
Expand Down Expand Up @@ -42,17 +50,19 @@ type SetpointListDataSelectorsType struct {
}

type SetpointConstraintsDataType struct {
SetpointId *SetpointIdType `json:"setpointId,omitempty" eebus:"key"`
SetpointRangeMin *ScaledNumberType `json:"setpointRangeMin,omitempty"`
SetpointRangeMax *ScaledNumberType `json:"setpointRangeMax,omitempty"`
SetpointStepSize *ScaledNumberType `json:"setpointStepSize,omitempty"`
SetpointId *SetpointIdType `json:"setpointId,omitempty" eebus:"key"`
SetpointRangeMin *ScaledNumberType `json:"setpointRangeMin,omitempty"`
SetpointRangeMax *ScaledNumberType `json:"setpointRangeMax,omitempty"`
SetpointStepSize *ScaledNumberType `json:"setpointStepSize,omitempty"`
SetpointValues *SetpointValuesType `json:"setpointValues,omitempty"`
}

type SetpointConstraintsDataElementsType struct {
SetpointId *ElementTagType `json:"setpointId,omitempty"`
SetpointRangeMin *ScaledNumberElementsType `json:"setpointRangeMin,omitempty"`
SetpointRangeMax *ScaledNumberElementsType `json:"setpointRangeMax,omitempty"`
SetpointStepSize *ScaledNumberElementsType `json:"setpointStepSize,omitempty"`
SetpointId *ElementTagType `json:"setpointId,omitempty"`
SetpointRangeMin *ScaledNumberElementsType `json:"setpointRangeMin,omitempty"`
SetpointRangeMax *ScaledNumberElementsType `json:"setpointRangeMax,omitempty"`
SetpointStepSize *ScaledNumberElementsType `json:"setpointStepSize,omitempty"`
SetpointValues *SetpointValuesElementsType `json:"setpointValues,omitempty"`
}

type SetpointConstraintsListDataType struct {
Expand Down
50 changes: 50 additions & 0 deletions model/surrogate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package model

type SurrogateIdType uint

type SurrogateScopeEnumType string

type SurrogateScopeType string

type SurrogateOtherSourceType string

type SurrogateSourcesType struct {
SpineSource []EntityAddressType `json:"spineSource,omitempty"`
OtherSource []SurrogateOtherSourceType `json:"otherSource,omitempty"`
}

type SurrogateDescriptionDataType struct {
SurrogateId *SurrogateIdType `json:"surrogateId,omitempty" eebus:"key"`
SurrogateScope *SurrogateScopeType `json:"surrogateScope,omitempty"`
SurrogateSources *SurrogateSourcesType `json:"surrogateSources,omitempty"`
Label *LabelType `json:"label,omitempty"`
Description *DescriptionType `json:"description,omitempty"`
}

type SurrogateSourcesElementsType struct {
SpineSource *EntityAddressElementsType `json:"spineSource,omitempty"`
OtherSource *ElementTagType `json:"otherSource,omitempty"`
}

type SurrogateDescriptionDataElementsType struct {
SurrogateId *ElementTagType `json:"surrogateId,omitempty"`
SurrogateScope *ElementTagType `json:"surrogateScope,omitempty"`
SurrogateSources *SurrogateSourcesElementsType `json:"surrogateSources,omitempty"`
Label *ElementTagType `json:"label,omitempty"`
Description *ElementTagType `json:"description,omitempty"`
}

type SurrogateDescriptionListDataType struct {
SurrogateDescriptionData []SurrogateDescriptionDataType `json:"surrogateDescriptionData,omitempty"`
}

type SurrogateDescriptionListDataSelectorsSourcesType struct {
SpineSource *EntityAddressType `json:"spineSource,omitempty"`
OtherSource *string `json:"otherSource,omitempty"`
}

type SurrogateDescriptionListDataSelectorsType struct {
SurrogateId *SurrogateIdType `json:"surrogateId,omitempty"`
SurrogateScope *SurrogateScopeType `json:"surrogateScope,omitempty"`
SurrogateSources *SurrogateDescriptionListDataSelectorsSourcesType `json:"surrogateSources,omitempty"`
}
20 changes: 20 additions & 0 deletions model/surrogate_additions.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package model

// SurrogateDescriptionListDataType

var _ Updater = (*SurrogateDescriptionListDataType)(nil)

func (r *SurrogateDescriptionListDataType) UpdateList(remoteWrite, persist bool, newList any, filterPartial, filterDelete *FilterType) (any, bool) {
var newData []SurrogateDescriptionDataType
if newList != nil {
newData = newList.(*SurrogateDescriptionListDataType).SurrogateDescriptionData
}

data, success := UpdateList(remoteWrite, r.SurrogateDescriptionData, newData, filterPartial, filterDelete)

if success && persist {
r.SurrogateDescriptionData = data
}

return data, success
}
47 changes: 47 additions & 0 deletions model/surrogate_additions_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package model

import (
"testing"

"github.com/enbility/spine-go/util"
"github.com/stretchr/testify/assert"
)

func TestSurrogateDescriptionListDataType_Update(t *testing.T) {
sut := SurrogateDescriptionListDataType{
SurrogateDescriptionData: []SurrogateDescriptionDataType{
{
SurrogateId: util.Ptr(SurrogateIdType(0)),
SurrogateScope: util.Ptr(SurrogateScopeType("old")),
},
{
SurrogateId: util.Ptr(SurrogateIdType(1)),
SurrogateScope: util.Ptr(SurrogateScopeType("test")),
},
},
}

newData := SurrogateDescriptionListDataType{
SurrogateDescriptionData: []SurrogateDescriptionDataType{
{
SurrogateId: util.Ptr(SurrogateIdType(1)),
SurrogateScope: util.Ptr(SurrogateScopeType("new")),
},
},
}

// Act
_, success := sut.UpdateList(false, true, &newData, NewFilterTypePartial(), nil)
assert.True(t, success)

data := sut.SurrogateDescriptionData
// check the non changing items
assert.Equal(t, 2, len(data))
item1 := data[0]
assert.Equal(t, 0, int(*item1.SurrogateId))
assert.Equal(t, "old", string(*item1.SurrogateScope))
// check properties of updated item
item2 := data[1]
assert.Equal(t, 1, int(*item2.SurrogateId))
assert.Equal(t, "new", string(*item2.SurrogateScope))
}
43 changes: 30 additions & 13 deletions model/timeseries.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,28 @@ type TimeSeriesSlotCountType TimeSeriesSlotIdType
type TimeSeriesTypeType string

const (
TimeSeriesTypeTypePlan TimeSeriesTypeType = "plan"
TimeSeriesTypeTypeSingleDemand TimeSeriesTypeType = "singleDemand"
TimeSeriesTypeTypeConstraints TimeSeriesTypeType = "constraints"
TimeSeriesTypeTypeEnergyRequest TimeSeriesTypeType = "energyRequest"
TimeSeriesTypeTypeDischargingEnergyRequest TimeSeriesTypeType = "dischargingEnergyRequest"
TimeSeriesTypeTypeConsumptionLimitCurve TimeSeriesTypeType = "consumptionLimitCurve"
TimeSeriesTypeTypeProductionLimitCurve TimeSeriesTypeType = "productionLimitCurve"
TimeSeriesTypeTypePlan TimeSeriesTypeType = "plan"
TimeSeriesTypeTypeSingleDemand TimeSeriesTypeType = "singleDemand"
TimeSeriesTypeTypeConstraints TimeSeriesTypeType = "constraints"
TimeSeriesTypeTypeEnergyRequest TimeSeriesTypeType = "energyRequest"
TimeSeriesTypeTypeDischargingEnergyRequest TimeSeriesTypeType = "dischargingEnergyRequest"
TimeSeriesTypeTypeConsumptionLimitCurve TimeSeriesTypeType = "consumptionLimitCurve"
TimeSeriesTypeTypeProductionLimitCurve TimeSeriesTypeType = "productionLimitCurve"
TimeSeriesTypeTypeFallbackConsumptionLimitCurve TimeSeriesTypeType = "fallbackConsumptionLimitCurve"
TimeSeriesTypeTypeFallbackProductionLimitCurve TimeSeriesTypeType = "fallbackProductionLimitCurve"
TimeSeriesTypeTypePowerRequest TimeSeriesTypeType = "powerRequest"
)

type TimeSeriesStateType string

const (
TimeSeriesStateTypeRequest TimeSeriesStateType = "request"
TimeSeriesStateTypeRequestAccepted TimeSeriesStateType = "requestAccepted"
TimeSeriesStateTypeRequestRejected TimeSeriesStateType = "requestRejected"
TimeSeriesStateTypeCancelRequest TimeSeriesStateType = "cancelRequest"
TimeSeriesStateTypeCancelRequestAccepted TimeSeriesStateType = "cancelRequestAccepted"
TimeSeriesStateTypeCancelRequestRejected TimeSeriesStateType = "cancelRequestRejected"
TimeSeriesStateTypeRequestCancelled TimeSeriesStateType = "requestCancelled"
)

type TimeSeriesSlotType struct {
Expand All @@ -39,15 +54,17 @@ type TimeSeriesSlotElementsType struct {
}

type TimeSeriesDataType struct {
TimeSeriesId *TimeSeriesIdType `json:"timeSeriesId,omitempty" eebus:"key"`
TimePeriod *TimePeriodType `json:"timePeriod,omitempty"`
TimeSeriesSlot []TimeSeriesSlotType `json:"timeSeriesSlot"`
TimeSeriesId *TimeSeriesIdType `json:"timeSeriesId,omitempty" eebus:"key"`
TimePeriod *TimePeriodType `json:"timePeriod,omitempty"`
TimeSeriesSlot []TimeSeriesSlotType `json:"timeSeriesSlot"`
TimeSeriesState *TimeSeriesStateType `json:"timeSeriesState,omitempty"`
}

type TimeSeriesDataElementsType struct {
TimeSeriesId *ElementTagType `json:"timeSeriesId,omitempty"`
TimePeriod *TimePeriodElementsType `json:"timePeriod,omitempty"`
TimeSeriesSlot *TimeSeriesSlotElementsType `json:"timeSeriesSlot"`
TimeSeriesId *ElementTagType `json:"timeSeriesId,omitempty"`
TimePeriod *TimePeriodElementsType `json:"timePeriod,omitempty"`
TimeSeriesSlot *TimeSeriesSlotElementsType `json:"timeSeriesSlot"`
TimeSeriesState *ElementTagType `json:"timeSeriesState,omitempty"`
}

type TimeSeriesListDataType struct {
Expand Down
2 changes: 1 addition & 1 deletion spine/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ package spine

import "github.com/enbility/spine-go/model"

var SpecificationVersion model.SpecificationVersionType = "1.3.0"
var SpecificationVersion model.SpecificationVersionType = "1.4.0"
Loading