Skip to content

Commit 674a5b7

Browse files
marcemmersmaaikez
andauthored
Number of fixes to the Metervalue implementation for 2.0.1 (#448)
* Add clock alignment for aligned metervalues and add clearing of values where applicable Signed-off-by: Marc Emmers <m.emmers@alfen.com> * Store extra metervalue when starting a transaction in an edge case Signed-off-by: Marc Emmers <m.emmers@alfen.com> * Meter values: use the 'starting from' interval timer also for sampled data: start from the transaction start date/time. Also include the clock aligned metervalue if it the timestamp is the same as the started timestamp Signed-off-by: Maaike Zijderveld, Alfen <maaike@iolar.nl> * Add optional variable to control the rounding of the timestamps Signed-off-by: Marc Emmers <m.emmers@alfen.com> * Fix a bunch of style issues Signed-off-by: Marc Emmers <m.emmers@alfen.com> * Add decscription and some more style fixes Signed-off-by: Marc Emmers <m.emmers@alfen.com> * Change all booleans from string to bool in component schemas Signed-off-by: Marc Emmers <m.emmers@alfen.com> --------- Signed-off-by: Marc Emmers <m.emmers@alfen.com> Signed-off-by: Maaike Zijderveld, Alfen <maaike@iolar.nl> Co-authored-by: Maaike Zijderveld, Alfen <maaike@iolar.nl>
1 parent f9e30eb commit 674a5b7

23 files changed

+189
-82
lines changed

config/v201/component_schemas/custom/Connector_1_1.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
],
3636
"description": "Component exists",
3737
"type": "boolean",
38-
"default": "0"
38+
"default": false
3939
},
4040
"ChargeProtocol": {
4141
"variable_name": "ChargeProtocol",

config/v201/component_schemas/custom/Connector_2_1.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
],
3636
"description": "Component exists",
3737
"type": "boolean",
38-
"default": "0"
38+
"default": false
3939
},
4040
"ChargeProtocol": {
4141
"variable_name": "ChargeProtocol",

config/v201/component_schemas/custom/EVSE_1.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
],
5252
"description": "Component exists",
5353
"type": "boolean",
54-
"default": "0"
54+
"default": false
5555
},
5656
"EvseId": {
5757
"variable_name": "EvseId",

config/v201/component_schemas/custom/EVSE_2.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
],
5252
"description": "Component exists",
5353
"type": "boolean",
54-
"default": "0"
54+
"default": false
5555
},
5656
"EvseId": {
5757
"variable_name": "EvseId",

config/v201/component_schemas/standardized/AlignedDataCtrlr.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"mutability": "ReadWrite"
1717
}
1818
],
19-
"default": "1",
19+
"default": true,
2020
"type": "boolean"
2121
},
2222
"AlignedDataCtrlrAvailable": {
@@ -32,7 +32,7 @@
3232
}
3333
],
3434
"description": "If this variable reports a value of true, Clock-Aligned Data is supported.",
35-
"default": "1",
35+
"default": true,
3636
"type": "boolean"
3737
},
3838
"AlignedDataInterval": {
@@ -97,7 +97,7 @@
9797
}
9898
],
9999
"description": "If set to true, the Charging Station SHALL include signed meter values in the SampledValueType in the MeterValuesRequest to the CSMS.",
100-
"default": "0",
100+
"default": false,
101101
"type": "boolean"
102102
},
103103
"AlignedDataTxEndedInterval": {

config/v201/component_schemas/standardized/AuthCacheCtrlr.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
}
1818
],
1919
"description": "Authorization caching is available, but not necessarily enabled.",
20-
"default": "1",
20+
"default": true,
2121
"type": "boolean"
2222
},
2323
"AuthCacheCtrlrEnabled": {
@@ -33,7 +33,7 @@
3333
}
3434
],
3535
"description": "If set to true, Authorization caching is enabled.",
36-
"default": "1",
36+
"default": true,
3737
"type": "boolean"
3838
},
3939
"AuthCacheLifeTime": {

config/v201/component_schemas/standardized/AuthCtrlr.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"mutability": "ReadWrite"
1717
}
1818
],
19-
"default": "1",
19+
"default": true,
2020
"type": "boolean"
2121
},
2222
"AdditionalInfoItemsPerMessage": {
@@ -47,7 +47,7 @@
4747
}
4848
],
4949
"description": "Whether a remote request to start a transaction in the form of RequestStartTransactionRequest message should be authorized beforehand like a local action to start a transaction.",
50-
"default": "1",
50+
"default": true,
5151
"type": "boolean"
5252
},
5353
"LocalAuthorizeOffline": {
@@ -63,7 +63,7 @@
6363
}
6464
],
6565
"description": "Whether the Charging Station, when Offline, will start a transaction for locally-authorized identifiers,",
66-
"default": "1",
66+
"default": true,
6767
"type": "boolean"
6868
},
6969
"LocalPreAuthorize": {
@@ -79,7 +79,7 @@
7979
}
8080
],
8181
"description": "Whether the Charging Station, when online, will start a transaction for locally-authorized identifiers without waiting for or requesting an AuthorizeResponse from the CSMS.",
82-
"default": "1",
82+
"default": true,
8383
"type": "boolean"
8484
},
8585
"MasterPassGroupId": {
@@ -110,7 +110,7 @@
110110
}
111111
],
112112
"description": "Support for unknown offline transactions.",
113-
"default": "1",
113+
"default": true,
114114
"type": "boolean"
115115
},
116116
"DisableRemoteAuthorization": {

config/v201/component_schemas/standardized/InternalCtrlr.json

+21-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"mutability": "ReadWrite"
1717
}
1818
],
19-
"default": "1",
19+
"default": true,
2020
"type": "boolean"
2121
},
2222
"ChargePointId": {
@@ -240,7 +240,7 @@
240240
"mutability": "ReadOnly"
241241
}
242242
],
243-
"default": "1",
243+
"default": true,
244244
"type": "boolean"
245245
},
246246
"LogMessages": {
@@ -255,7 +255,7 @@
255255
"mutability": "ReadOnly"
256256
}
257257
],
258-
"default": "1",
258+
"default": true,
259259
"type": "boolean"
260260
},
261261
"LogMessagesFormat": {
@@ -338,7 +338,7 @@
338338
}
339339
],
340340
"description": "Use default verify paths for validating CSMS server certificate",
341-
"default": "1",
341+
"default": true,
342342
"type": "boolean"
343343
},
344344
"OcspRequestInterval": {
@@ -483,7 +483,7 @@
483483
"mutability": "ReadOnly"
484484
}
485485
],
486-
"default": "0",
486+
"default": false,
487487
"type": "boolean"
488488
},
489489
"MessageQueueSizeThreshold": {
@@ -537,6 +537,22 @@
537537
"description": "List of criteria supported for a get custom report. Enabled,Active,Problem,Available",
538538
"default": "Enabled,Active,Problem,Available",
539539
"type": "string"
540+
},
541+
"RoundClockAlignedTimestamps": {
542+
"variable_name": "RoundClockAlignedTimestamps",
543+
"characteristics": {
544+
"supportsMonitoring": false,
545+
"dataType": "boolean"
546+
},
547+
"attributes": [
548+
{
549+
"type": "Actual",
550+
"mutability": "ReadOnly"
551+
}
552+
],
553+
"description": "If enabled the metervalues configured with the AlignedDataCtrlr will be rounded to the exact time intervals",
554+
"default": false,
555+
"type": "boolean"
540556
}
541557
},
542558
"required": [

config/v201/component_schemas/standardized/LocalAuthListCtrlr.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
}
1818
],
1919
"description": "Local Authorization List is available.",
20-
"default": "1",
20+
"default": true,
2121
"type": "boolean"
2222
},
2323
"BytesPerMessageSendLocalList": {
@@ -48,7 +48,7 @@
4848
}
4949
],
5050
"description": "If this variable exists and reports a value of true, Local Authorization List is enabled.",
51-
"default": "1",
51+
"default": true,
5252
"type": "boolean"
5353
},
5454
"LocalAuthListCtrlrEntries": {

config/v201/component_schemas/standardized/OCPPCommCtrlr.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@
278278
}
279279
],
280280
"description": "When set to true, the Charging Station SHALL unlock the cable on the Charging Station side when the cable is unplugged at the EV. For an EVSE with only fixed cables, the mutability SHALL be ReadOnly and the actual value SHALL be false. For a charging station with fixed cables and sockets, the variable is only applicable to the sockets.",
281-
"default": "1",
281+
"default": true,
282282
"type": "boolean"
283283
},
284284
"WebSocketPingInterval": {

config/v201/component_schemas/standardized/ReservationCtrlr.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
}
1818
],
1919
"description": "Whether reservation is supported.",
20-
"default": "1",
20+
"default": true,
2121
"type": "boolean"
2222
},
2323
"ReservationCtrlrEnabled": {
@@ -33,7 +33,7 @@
3333
}
3434
],
3535
"description": "Whether reservation is enabled.",
36-
"default": "1",
36+
"default": true,
3737
"type": "boolean"
3838
},
3939
"ReservationCtrlrNonEvseSpecific": {

config/v201/component_schemas/standardized/SampledDataCtrlr.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
}
1818
],
1919
"description": "If this variable reports a value of true, Sampled Data is supported",
20-
"default": "1",
20+
"default": true,
2121
"type": "boolean"
2222
},
2323
"SampledDataCtrlrEnabled": {
@@ -33,7 +33,7 @@
3333
}
3434
],
3535
"description": "If this variable reports a value of true, Sampled Data is enabled.",
36-
"default": "1",
36+
"default": true,
3737
"type": "boolean"
3838
},
3939
"SampledDataSignReadings": {

config/v201/component_schemas/standardized/SecurityCtrlr.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"mutability": "ReadWrite"
1717
}
1818
],
19-
"default": "1",
19+
"default": true,
2020
"type": "boolean"
2121
},
2222
"AdditionalRootCertificateCheck": {
@@ -32,7 +32,7 @@
3232
}
3333
],
3434
"description": "Required for all security profiles except profile 1.",
35-
"default": "0",
35+
"default": false,
3636
"type": "boolean"
3737
},
3838
"BasicAuthPassword": {

config/v201/component_schemas/standardized/TxCtrlr.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"mutability": "ReadWrite"
1717
}
1818
],
19-
"default": "1",
19+
"default": true,
2020
"type": "boolean"
2121
},
2222
"ChargingTime": {
@@ -80,7 +80,7 @@
8080
}
8181
],
8282
"description": "When set to true, the Charging Station SHALL deauthorize the transaction when the cable is unplugged from the EV.",
83-
"default": "1",
83+
"default": true,
8484
"type": "boolean"
8585
},
8686
"StopTxOnInvalidId": {
@@ -96,7 +96,7 @@
9696
}
9797
],
9898
"description": "Whether the Charging Station will deauthorize an ongoing transaction when it receives a non- Accepted authorization status in TransactionEventResponse for this transaction.",
99-
"default": "1",
99+
"default": true,
100100
"type": "boolean"
101101
},
102102
"TxBeforeAcceptedEnabled": {

config/v201/config.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,13 @@
271271
"attributes": {
272272
"Actual": "0"
273273
}
274+
},
275+
"RoundClockAlignedTimestamps": {
276+
"variable_name": "RoundClockAlignedTimestamps",
277+
"attributes": {
278+
"Actual": "0"
279+
}
274280
}
275-
276281
}
277282
},
278283
{

include/ocpp/common/aligned_timer.hpp

+15-10
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,19 @@ class ClockAlignedTimer : private Everest::Timer<std::chrono::system_clock> {
4141
return next_time;
4242
}
4343

44-
void call_next() {
44+
system_time_point call_next() {
4545
if (this->callback == nullptr) {
46-
return;
46+
return system_time_point{};
4747
}
4848

4949
auto wrapper = [this]() {
5050
this->callback();
5151
this->at(this->get_next_timepoint());
5252
};
5353

54-
this->at(wrapper, this->get_next_timepoint());
54+
auto next_timepoint = this->get_next_timepoint();
55+
this->at(wrapper, next_timepoint);
56+
return next_timepoint;
5557
}
5658

5759
public:
@@ -65,23 +67,26 @@ class ClockAlignedTimer : private Everest::Timer<std::chrono::system_clock> {
6567
}
6668

6769
template <class Rep, class Period>
68-
void interval_starting_from(const std::function<void()>& callback,
69-
const std::chrono::duration<Rep, Period> interval, system_time_point start_point) {
70+
system_time_point interval_starting_from(const std::function<void()>& callback,
71+
const std::chrono::duration<Rep, Period> interval,
72+
system_time_point start_point) {
7073
this->callback = callback;
71-
this->interval_starting_from(interval, start_point);
74+
return this->interval_starting_from(interval, start_point);
7275
}
7376

7477
template <class Rep, class Period>
75-
void interval_starting_from(const std::chrono::duration<Rep, Period> interval, system_time_point start_point) {
78+
system_time_point interval_starting_from(const std::chrono::duration<Rep, Period> interval,
79+
system_time_point start_point) {
7680
this->start_point = start_point;
7781
this->call_interval = interval;
7882

79-
this->call_next();
83+
return this->call_next();
8084
}
8185

82-
template <class Rep, class Period> void set_interval(const std::chrono::duration<Rep, Period>& interval) {
86+
template <class Rep, class Period>
87+
system_time_point set_interval(const std::chrono::duration<Rep, Period>& interval) {
8388
this->call_interval = interval;
84-
this->call_next();
89+
return this->call_next();
8590
}
8691

8792
using Everest::Timer<std::chrono::system_clock>::stop;

include/ocpp/v201/ctrlr_component_variables.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ extern const ComponentVariable& LogMessages;
5454
extern const RequiredComponentVariable& LogMessagesFormat;
5555
extern const ComponentVariable& SupportedChargingProfilePurposeTypes;
5656
extern const ComponentVariable& SupportedCriteria;
57+
extern const ComponentVariable& RoundClockAlignedTimestamps;
5758
extern const ComponentVariable& MaxCompositeScheduleDuration;
5859
extern const RequiredComponentVariable& NumberOfConnectors;
5960
extern const ComponentVariable& UseSslDefaultVerifyPaths;

include/ocpp/v201/transaction.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ struct EnhancedTransaction : public Transaction {
2020
std::optional<float> active_energy_import_start_value;
2121
bool check_max_active_import_energy;
2222

23-
Everest::SteadyTimer sampled_tx_updated_meter_values_timer;
24-
Everest::SteadyTimer sampled_tx_ended_meter_values_timer;
23+
ClockAlignedTimer sampled_tx_updated_meter_values_timer;
24+
ClockAlignedTimer sampled_tx_ended_meter_values_timer;
2525
ClockAlignedTimer aligned_tx_updated_meter_values_timer;
2626
ClockAlignedTimer aligned_tx_ended_meter_values_timer;
2727

0 commit comments

Comments
 (0)