@@ -4,9 +4,40 @@ import (
44 "github.com/enbility/eebus-go/features"
55 "github.com/enbility/eebus-go/service"
66 "github.com/enbility/eebus-go/spine"
7+ "github.com/enbility/eebus-go/spine/model"
78 "github.com/enbility/eebus-go/util"
89)
910
11+ // used by emobility and implemented by the CEM
12+ type EmobilityDataProvider interface {
13+ // The EV provided a charge strategy
14+ EVProvidedChargeStrategy (strategy EVChargeStrategyType )
15+
16+ // Energy demand and duration is provided by the EV which requires the CEM
17+ // to respond with time slots containing power limits for each slot
18+ //
19+ // `EVWritePowerLimits` must be invoked within <55s, idealy <15s, after receiving this call
20+ //
21+ // Parameters:
22+ // - demand: Contains details about the actual demands from the EV
23+ // - constraints: Contains details about the time slot constraints
24+ EVRequestPowerLimits (demand EVDemand , constraints EVTimeSlotConstraints )
25+
26+ // Energy demand and duration is provided by the EV which requires the CEM
27+ // to respond with time slots containing incentives for each slot
28+ //
29+ // `EVWriteIncentives` must be invoked within <20s after receiving this call
30+ //
31+ // Parameters:
32+ // - demand: Contains details about the actual demands from the EV
33+ // - constraints: Contains details about the incentive slot constraints
34+ EVRequestIncentives (demand EVDemand , constraints EVIncentiveSlotConstraints )
35+
36+ // The EV provided a charge plan
37+ EVProvidedChargePlan (data []EVDurationSlotValue )
38+ }
39+
40+ // used by the CEM and implemented by emobility
1041type EmobilityI interface {
1142 // return the current charge sate of the EV
1243 EVCurrentChargeState () (EVChargeStateType , error )
@@ -42,6 +73,13 @@ type EmobilityI interface {
4273 // - and others
4374 EVCurrentLimits () ([]float64 , []float64 , []float64 , error )
4475
76+ // return the current loadcontrol obligation limits
77+ //
78+ // possible errors:
79+ // - ErrDataNotAvailable if no such measurement is (yet) available
80+ // - and others
81+ EVLoadControlObligationLimits () ([]float64 , error )
82+
4583 // send new LoadControlLimits to the remote EV
4684 //
4785 // parameters:
@@ -131,6 +169,44 @@ type EmobilityI interface {
131169 // - ErrDataNotAvailable if that information is not (yet) available
132170 // - and others
133171 EVCoordinatedChargingSupported () (bool , error )
172+
173+ // returns the current charging stratey
174+ //
175+ // returns EVChargeStrategyTypeUnknown if it could not be determined, e.g.
176+ // if the vehicle communication is via IEC61851 or the EV doesn't provide
177+ // any information about its charging mode or plan
178+ EVChargeStrategy () EVChargeStrategyType
179+
180+ // returns the current energy demand
181+ // - EVDemand: details about the actual demands from the EV
182+ // - error: if no data is available
183+ //
184+ // if duration is 0, direct charging is active, otherwise timed charging is active
185+ EVEnergyDemand () (EVDemand , error )
186+
187+ // returns the constraints for the power slots
188+ // - EVTimeSlotConstraints: details about the time slot constraints
189+ EVGetPowerConstraints () EVTimeSlotConstraints
190+
191+ // send power limits data to the EV
192+ //
193+ // returns an error if sending failed or charge slot count do not meet requirements
194+ //
195+ // this needs to be invoked either <55s, idealy <15s, of receiving a call to EVRequestPowerLimits
196+ // or if the CEM requires the EV to change its charge plan
197+ EVWritePowerLimits (data []EVDurationSlotValue ) error
198+
199+ // returns the constraints for incentive slots
200+ // - EVIncentiveConstraints: details about the incentive slot constraints
201+ EVGetIncentiveConstraints () EVIncentiveSlotConstraints
202+
203+ // send price slots data to the EV
204+ //
205+ // returns an error if sending failed or charge slot count do not meet requirements
206+ //
207+ // this needs to be invoked either within 20s of receiving a call to EVRequestIncentives
208+ // or if the CEM requires the EV to change its charge plan
209+ EVWriteIncentives (data []EVDurationSlotValue ) error
134210}
135211
136212type EMobilityImpl struct {
@@ -151,20 +227,32 @@ type EMobilityImpl struct {
151227 evMeasurement * features.Measurement
152228 evIdentification * features.Identification
153229 evLoadControl * features.LoadControl
230+ evTimeSeries * features.TimeSeries
231+ evIncentiveTable * features.IncentiveTable
232+
233+ evCurrentChargeStrategy EVChargeStrategyType
234+
235+ ski string
236+ currency model.CurrencyType
154237
155- ski string
238+ configuration EmobilityConfiguration
239+ dataProvider EmobilityDataProvider
156240}
157241
158242var _ EmobilityI = (* EMobilityImpl )(nil )
159243
160244// Add E-Mobility support
161- func NewEMobility (service * service.EEBUSService , details * service.ServiceDetails ) * EMobilityImpl {
245+ func NewEMobility (service * service.EEBUSService , details * service.ServiceDetails , currency model. CurrencyType , configuration EmobilityConfiguration , dataProvider EmobilityDataProvider ) * EMobilityImpl {
162246 ski := util .NormalizeSKI (details .SKI ())
163247
164248 emobility := & EMobilityImpl {
165- service : service ,
166- entity : service .LocalEntity (),
167- ski : ski ,
249+ service : service ,
250+ entity : service .LocalEntity (),
251+ ski : ski ,
252+ currency : currency ,
253+ dataProvider : dataProvider ,
254+ evCurrentChargeStrategy : EVChargeStrategyTypeUnknown ,
255+ configuration : configuration ,
168256 }
169257 spine .Events .Subscribe (emobility )
170258
0 commit comments