Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Number of fixes to the Metervalue implementation for 2.0.1 #448

Merged
merged 7 commits into from
Feb 14, 2024
2 changes: 1 addition & 1 deletion config/v201/component_schemas/custom/Connector_1_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
],
"description": "Component exists",
"type": "boolean",
"default": "0"
"default": false
},
"ChargeProtocol": {
"variable_name": "ChargeProtocol",
Expand Down
2 changes: 1 addition & 1 deletion config/v201/component_schemas/custom/Connector_2_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
],
"description": "Component exists",
"type": "boolean",
"default": "0"
"default": false
},
"ChargeProtocol": {
"variable_name": "ChargeProtocol",
Expand Down
2 changes: 1 addition & 1 deletion config/v201/component_schemas/custom/EVSE_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
],
"description": "Component exists",
"type": "boolean",
"default": "0"
"default": false
},
"EvseId": {
"variable_name": "EvseId",
Expand Down
2 changes: 1 addition & 1 deletion config/v201/component_schemas/custom/EVSE_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
],
"description": "Component exists",
"type": "boolean",
"default": "0"
"default": false
},
"EvseId": {
"variable_name": "EvseId",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"mutability": "ReadWrite"
}
],
"default": "1",
"default": true,
"type": "boolean"
},
"AlignedDataCtrlrAvailable": {
Expand All @@ -32,7 +32,7 @@
}
],
"description": "If this variable reports a value of true, Clock-Aligned Data is supported.",
"default": "1",
"default": true,
"type": "boolean"
},
"AlignedDataInterval": {
Expand Down Expand Up @@ -97,7 +97,7 @@
}
],
"description": "If set to true, the Charging Station SHALL include signed meter values in the SampledValueType in the MeterValuesRequest to the CSMS.",
"default": "0",
"default": false,
"type": "boolean"
},
"AlignedDataTxEndedInterval": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}
],
"description": "Authorization caching is available, but not necessarily enabled.",
"default": "1",
"default": true,
"type": "boolean"
},
"AuthCacheCtrlrEnabled": {
Expand All @@ -33,7 +33,7 @@
}
],
"description": "If set to true, Authorization caching is enabled.",
"default": "1",
"default": true,
"type": "boolean"
},
"AuthCacheLifeTime": {
Expand Down
10 changes: 5 additions & 5 deletions config/v201/component_schemas/standardized/AuthCtrlr.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"mutability": "ReadWrite"
}
],
"default": "1",
"default": true,
"type": "boolean"
},
"AdditionalInfoItemsPerMessage": {
Expand Down Expand Up @@ -47,7 +47,7 @@
}
],
"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.",
"default": "1",
"default": true,
"type": "boolean"
},
"LocalAuthorizeOffline": {
Expand All @@ -63,7 +63,7 @@
}
],
"description": "Whether the Charging Station, when Offline, will start a transaction for locally-authorized identifiers,",
"default": "1",
"default": true,
"type": "boolean"
},
"LocalPreAuthorize": {
Expand All @@ -79,7 +79,7 @@
}
],
"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.",
"default": "1",
"default": true,
"type": "boolean"
},
"MasterPassGroupId": {
Expand Down Expand Up @@ -110,7 +110,7 @@
}
],
"description": "Support for unknown offline transactions.",
"default": "1",
"default": true,
"type": "boolean"
},
"DisableRemoteAuthorization": {
Expand Down
26 changes: 21 additions & 5 deletions config/v201/component_schemas/standardized/InternalCtrlr.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"mutability": "ReadWrite"
}
],
"default": "1",
"default": true,
"type": "boolean"
},
"ChargePointId": {
Expand Down Expand Up @@ -240,7 +240,7 @@
"mutability": "ReadOnly"
}
],
"default": "1",
"default": true,
"type": "boolean"
},
"LogMessages": {
Expand All @@ -255,7 +255,7 @@
"mutability": "ReadOnly"
}
],
"default": "1",
"default": true,
"type": "boolean"
},
"LogMessagesFormat": {
Expand Down Expand Up @@ -338,7 +338,7 @@
}
],
"description": "Use default verify paths for validating CSMS server certificate",
"default": "1",
"default": true,
"type": "boolean"
},
"OcspRequestInterval": {
Expand Down Expand Up @@ -483,7 +483,7 @@
"mutability": "ReadOnly"
}
],
"default": "0",
"default": false,
"type": "boolean"
},
"MessageQueueSizeThreshold": {
Expand Down Expand Up @@ -537,6 +537,22 @@
"description": "List of criteria supported for a get custom report. Enabled,Active,Problem,Available",
"default": "Enabled,Active,Problem,Available",
"type": "string"
},
"RoundClockAlignedTimestamps": {
"variable_name": "RoundClockAlignedTimestamps",
"characteristics": {
"supportsMonitoring": false,
"dataType": "boolean"
},
"attributes": [
{
"type": "Actual",
"mutability": "ReadOnly"
}
],
"description": "If enabled the metervalues configured with the AlignedDataCtrlr will be rounded to the exact time intervals",
"default": false,
"type": "boolean"
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}
],
"description": "Local Authorization List is available.",
"default": "1",
"default": true,
"type": "boolean"
},
"BytesPerMessageSendLocalList": {
Expand Down Expand Up @@ -48,7 +48,7 @@
}
],
"description": "If this variable exists and reports a value of true, Local Authorization List is enabled.",
"default": "1",
"default": true,
"type": "boolean"
},
"LocalAuthListCtrlrEntries": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
}
],
"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.",
"default": "1",
"default": true,
"type": "boolean"
},
"WebSocketPingInterval": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}
],
"description": "Whether reservation is supported.",
"default": "1",
"default": true,
"type": "boolean"
},
"ReservationCtrlrEnabled": {
Expand All @@ -33,7 +33,7 @@
}
],
"description": "Whether reservation is enabled.",
"default": "1",
"default": true,
"type": "boolean"
},
"ReservationCtrlrNonEvseSpecific": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}
],
"description": "If this variable reports a value of true, Sampled Data is supported",
"default": "1",
"default": true,
"type": "boolean"
},
"SampledDataCtrlrEnabled": {
Expand All @@ -33,7 +33,7 @@
}
],
"description": "If this variable reports a value of true, Sampled Data is enabled.",
"default": "1",
"default": true,
"type": "boolean"
},
"SampledDataSignReadings": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"mutability": "ReadWrite"
}
],
"default": "1",
"default": true,
"type": "boolean"
},
"AdditionalRootCertificateCheck": {
Expand All @@ -32,7 +32,7 @@
}
],
"description": "Required for all security profiles except profile 1.",
"default": "0",
"default": false,
"type": "boolean"
},
"BasicAuthPassword": {
Expand Down
6 changes: 3 additions & 3 deletions config/v201/component_schemas/standardized/TxCtrlr.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"mutability": "ReadWrite"
}
],
"default": "1",
"default": true,
"type": "boolean"
},
"ChargingTime": {
Expand Down Expand Up @@ -80,7 +80,7 @@
}
],
"description": "When set to true, the Charging Station SHALL deauthorize the transaction when the cable is unplugged from the EV.",
"default": "1",
"default": true,
"type": "boolean"
},
"StopTxOnInvalidId": {
Expand All @@ -96,7 +96,7 @@
}
],
"description": "Whether the Charging Station will deauthorize an ongoing transaction when it receives a non- Accepted authorization status in TransactionEventResponse for this transaction.",
"default": "1",
"default": true,
"type": "boolean"
},
"TxBeforeAcceptedEnabled": {
Expand Down
7 changes: 6 additions & 1 deletion config/v201/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,13 @@
"attributes": {
"Actual": "0"
}
},
"RoundClockAlignedTimestamps": {
"variable_name": "RoundClockAlignedTimestamps",
"attributes": {
"Actual": "0"
}
}

}
},
{
Expand Down
25 changes: 15 additions & 10 deletions include/ocpp/common/aligned_timer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,19 @@ class ClockAlignedTimer : private Everest::Timer<std::chrono::system_clock> {
return next_time;
}

void call_next() {
system_time_point call_next() {
if (this->callback == nullptr) {
return;
return system_time_point{};
}

auto wrapper = [this]() {
this->callback();
this->at(this->get_next_timepoint());
};

this->at(wrapper, this->get_next_timepoint());
auto next_timepoint = this->get_next_timepoint();
this->at(wrapper, next_timepoint);
return next_timepoint;
}

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

template <class Rep, class Period>
void interval_starting_from(const std::function<void()>& callback,
const std::chrono::duration<Rep, Period> interval, system_time_point start_point) {
system_time_point interval_starting_from(const std::function<void()>& callback,
const std::chrono::duration<Rep, Period> interval,
system_time_point start_point) {
this->callback = callback;
this->interval_starting_from(interval, start_point);
return this->interval_starting_from(interval, start_point);
}

template <class Rep, class Period>
void interval_starting_from(const std::chrono::duration<Rep, Period> interval, system_time_point start_point) {
system_time_point interval_starting_from(const std::chrono::duration<Rep, Period> interval,
system_time_point start_point) {
this->start_point = start_point;
this->call_interval = interval;

this->call_next();
return this->call_next();
}

template <class Rep, class Period> void set_interval(const std::chrono::duration<Rep, Period>& interval) {
template <class Rep, class Period>
system_time_point set_interval(const std::chrono::duration<Rep, Period>& interval) {
this->call_interval = interval;
this->call_next();
return this->call_next();
}

using Everest::Timer<std::chrono::system_clock>::stop;
Expand Down
1 change: 1 addition & 0 deletions include/ocpp/v201/ctrlr_component_variables.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ extern const ComponentVariable& LogMessages;
extern const RequiredComponentVariable& LogMessagesFormat;
extern const ComponentVariable& SupportedChargingProfilePurposeTypes;
extern const ComponentVariable& SupportedCriteria;
extern const ComponentVariable& RoundClockAlignedTimestamps;
extern const ComponentVariable& MaxCompositeScheduleDuration;
extern const RequiredComponentVariable& NumberOfConnectors;
extern const ComponentVariable& UseSslDefaultVerifyPaths;
Expand Down
4 changes: 2 additions & 2 deletions include/ocpp/v201/transaction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ struct EnhancedTransaction : public Transaction {
std::optional<float> active_energy_import_start_value;
bool check_max_active_import_energy;

Everest::SteadyTimer sampled_tx_updated_meter_values_timer;
Everest::SteadyTimer sampled_tx_ended_meter_values_timer;
ClockAlignedTimer sampled_tx_updated_meter_values_timer;
ClockAlignedTimer sampled_tx_ended_meter_values_timer;
ClockAlignedTimer aligned_tx_updated_meter_values_timer;
ClockAlignedTimer aligned_tx_ended_meter_values_timer;

Expand Down
Loading
Loading