Skip to content

Commit

Permalink
* Added configuration options for composite schedule default limits f…
Browse files Browse the repository at this point in the history
…or OCPP2.0.1 and OCPP1.6:

    * CompositeScheduleDefaultLimitAmps
    * CompositeScheduleDefaultLimitWatts
    * CompositeScheduleDefaultNumberPhases
    * SupplyVoltage
* Added ChargePointConfiguration member to SmartChargingHandler to allow the SmartChargingHandler to get the configuration required for its operation
* Addressed required changes in test cases due to adding ChargePointConfiguration to SmartChargingHandler and changed function signatures

Signed-off-by: Piet Gömpel <[email protected]>
  • Loading branch information
Pietfried committed Oct 23, 2024
1 parent 97cc058 commit d250b21
Show file tree
Hide file tree
Showing 25 changed files with 664 additions and 174 deletions.
1 change: 1 addition & 0 deletions config/v16/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ collect_migration_files(
INSTALL_DESTINATION ${CMAKE_INSTALL_DATADIR}/everest/modules/OCPP/core_migrations
)

set(OCPP1_6_CONFIG_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PARENT_SCOPE)
set(MIGRATION_FILE_VERSION_V16 ${TARGET_MIGRATION_FILE_VERSION} PARENT_SCOPE)
set(MIGRATION_FILES_SOURCE_DIR_V16 ${MIGRATION_FILES_LOCATION} PARENT_SCOPE)

Expand Down
29 changes: 29 additions & 0 deletions config/v16/profile_schemas/Internal.json
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,35 @@
"readOnly": true,
"default": 31536000
},
"CompositeScheduleDefaultLimitAmps": {
"description": "Default amps limit applied when composite schedule is calculated and no limit was provided by the CSMS",
"type": "number",
"readOnly": true,
"default": 48,
"minimum": 0
},
"CompositeScheduleDefaultLimitWatts": {
"description": "Default watts limit applied when composite schedule is calculated and no limit was provided by the CSMS",
"type": "number",
"readOnly": true,
"default": 33120,
"minimum": 0
},
"CompositeScheduleDefaultNumberPhases": {
"description": "Default number of phases applied when composite schedule is calculated and no limit was provided by the CSMS",
"type": "number",
"readOnly": true,
"default": 3,
"minimum": 1,
"maximum": 3
},
"SupplyVoltage": {
"description": "Supply voltage of the grid. This value is only used in case a conversion between smart charging amp and watt limits is required",
"type": "number",
"readOnly": false,
"default": 230,
"minimum": 0
},
"WebsocketPingPayload": {
"$comment": "The payload sent in a websocket ping.",
"type": "string",
Expand Down
73 changes: 73 additions & 0 deletions config/v201/component_config/standardized/SmartChargingCtrlr.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,79 @@
],
"description": "A list of supported quantities for use in a ChargingSchedule. Allowed values: 'A' and 'W\ufffd",
"type": "string"
},
"CompositeScheduleDefaultLimitAmps": {
"variable_name": "CompositeScheduleDefaultLimitAmps",
"characteristics": {
"unit": "A",
"minLimit": 0,
"supportsMonitoring": true,
"dataType": "integer"
},
"attributes": [
{
"type": "Actual",
"mutability": "ReadWrite",
"value": 48
}
],
"type": "integer",
"description": "Default amps limit applied when composite schedule is calculated and no limit was provided by the CSMS"
},
"CompositeScheduleDefaultLimitWatts": {
"variable_name": "CompositeScheduleDefaultLimitWatts",
"characteristics": {
"unit": "W",
"minLimit": 0,
"supportsMonitoring": true,
"dataType": "integer"
},
"attributes": [
{
"type": "Actual",
"mutability": "ReadWrite",
"value": 33120
}
],
"type": "integer",
"description": "Default watts limit applied when composite schedule is calculated and no limit was provided by the CSMS"
},
"CompositeScheduleDefaultNumberPhases": {
"variable_name": "CompositeScheduleDefaultNumberPhases",
"characteristics": {
"unit": "W",
"minLimit": 1,
"maxLimit": 3,
"supportsMonitoring": true,
"dataType": "integer"
},
"attributes": [
{
"type": "Actual",
"mutability": "ReadWrite",
"value": 3
}
],
"type": "integer",
"description": "Default number of phases applied when composite schedule is calculated and no limit was provided by the CSMS"
},
"SupplyVoltage": {
"variable_name": "SupplyVoltage",
"characteristics": {
"unit": "V",
"minLimit": 0,
"supportsMonitoring": true,
"dataType": "integer"
},
"attributes": [
{
"type": "Actual",
"mutability": "ReadWrite",
"value": 230
}
],
"type": "integer",
"description": "Supply voltage of the grid. This value is only used in case a conversion between smart charging amp and watt limits is required"
}
},
"required": [
Expand Down
12 changes: 12 additions & 0 deletions include/ocpp/v16/charge_point_configuration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,18 @@ class ChargePointConfiguration {
KeyValue getSupportedChargingProfilePurposeTypesKeyValue();
int32_t getMaxCompositeScheduleDuration();
KeyValue getMaxCompositeScheduleDurationKeyValue();
std::optional<int32_t> getCompositeScheduleDefaultLimitAmps();
std::optional<KeyValue> getCompositeScheduleDefaultLimitAmpsKeyValue();
void setCompositeScheduleDefaultLimitAmps(int32_t limit_amps);
std::optional<int32_t> getCompositeScheduleDefaultLimitWatts();
std::optional<KeyValue> getCompositeScheduleDefaultLimitWattsKeyValue();
void setCompositeScheduleDefaultLimitWatts(int32_t limit_watts);
std::optional<int32_t> getCompositeScheduleDefaultNumberPhases();
std::optional<KeyValue> getCompositeScheduleDefaultNumberPhasesKeyValue();
void setCompositeScheduleDefaultNumberPhases(int32_t number_phases);
std::optional<int32_t> getSupplyVoltage();
std::optional<KeyValue> getSupplyVoltageKeyValue();
void setSupplyVoltage(int32_t supply_voltage);
std::string getSupportedCiphers12();
KeyValue getSupportedCiphers12KeyValue();
std::string getSupportedCiphers13();
Expand Down
8 changes: 6 additions & 2 deletions include/ocpp/v16/profile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,15 @@ std::vector<period_entry_t> calculate_profile(const DateTime& now, const DateTim

EnhancedChargingSchedule calculate_composite_schedule(std::vector<period_entry_t>& combined_schedules,
const DateTime& now, const DateTime& end,
std::optional<ChargingRateUnit> charging_rate_unit);
std::optional<ChargingRateUnit> charging_rate_unit,
const int32_t default_number_phases,
const int32_t supply_voltage);

EnhancedChargingSchedule calculate_composite_schedule(const EnhancedChargingSchedule& charge_point_max,
const EnhancedChargingSchedule& tx_default,
const EnhancedChargingSchedule& tx);
const EnhancedChargingSchedule& tx, const float default_limit_A,
const float default_limit_W, const int32_t default_number_phases,
const int32_t supply_voltage);

} // namespace ocpp::v16

Expand Down
5 changes: 3 additions & 2 deletions include/ocpp/v16/smart_charging.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <cstddef>
#include <limits>

#include <ocpp/v16/charge_point_configuration.hpp>
#include <ocpp/v16/connector.hpp>
#include <ocpp/v16/database_handler.hpp>
#include <ocpp/v16/ocpp_types.hpp>
Expand Down Expand Up @@ -39,11 +40,11 @@ class SmartChargingHandler {
private:
std::map<int32_t, std::shared_ptr<Connector>> connectors;
std::shared_ptr<ocpp::v16::DatabaseHandler> database_handler;
std::shared_ptr<ChargePointConfiguration> configuration;
std::map<int, ChargingProfile> stack_level_charge_point_max_profiles_map;
std::mutex charge_point_max_profiles_map_mutex;
std::mutex tx_default_profiles_map_mutex;
std::mutex tx_profiles_map_mutex;
bool allow_charging_profile_without_start_schedule;

std::unique_ptr<Everest::SteadyTimer> clear_profiles_timer;

Expand All @@ -57,7 +58,7 @@ class SmartChargingHandler {
public:
SmartChargingHandler(std::map<int32_t, std::shared_ptr<Connector>>& connectors,
std::shared_ptr<DatabaseHandler> database_handler,
const bool allow_charging_profile_without_start_schedule);
std::shared_ptr<ChargePointConfiguration> configuration);

///
/// \brief validates the given \p profile according to the specification
Expand Down
4 changes: 4 additions & 0 deletions include/ocpp/v201/ctrlr_component_variables.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ extern const ComponentVariable& ExternalControlSignalsEnabled;
extern const RequiredComponentVariable& LimitChangeSignificance;
extern const ComponentVariable& NotifyChargingLimitWithSchedules;
extern const RequiredComponentVariable& PeriodsPerSchedule;
extern const RequiredComponentVariable& CompositeScheduleDefaultLimitAmps;
extern const RequiredComponentVariable& CompositeScheduleDefaultLimitWatts;
extern const RequiredComponentVariable& CompositeScheduleDefaultNumberPhases;
extern const RequiredComponentVariable& SupplyVoltage;
extern const ComponentVariable& Phases3to1;
extern const RequiredComponentVariable& ChargingProfileMaxStackLevel;
extern const RequiredComponentVariable& ChargingScheduleChargingRateUnit;
Expand Down
19 changes: 14 additions & 5 deletions include/ocpp/v201/profile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,30 @@ std::vector<period_entry_t> calculate_profile(const DateTime& now, const DateTim
/// \param now the start of the composite schedule
/// \param end the end (i.e. duration) of the composite schedule
/// \param charging_rate_unit the units to use (defaults to Amps)
/// \return the calculated composite schedule
/// \param default_number_phases default number of phases if no existing period limit applies
/// \param supply_voltage Supply voltage of the grid. This value is only used in case a conversion between smart
/// charging amp and watt limits is required \return the calculated composite schedule
CompositeSchedule calculate_composite_schedule(std::vector<period_entry_t>& combined_schedules, const DateTime& now,
const DateTime& end,
std::optional<ChargingRateUnitEnum> charging_rate_unit);
std::optional<ChargingRateUnitEnum> charging_rate_unit,
const int32_t default_number_phases, const int32_t supply_voltage);

/// \brief calculate the combined composite schedule from all of the different types of
/// CompositeSchedules
/// \param charge_point_max the composite schedule for ChargePointMax profiles
/// \param tx_default the composite schedule for TxDefault profiles
/// \param tx the composite schedule for Tx profiles
/// \return the calculated combined composite schedule
/// \note all composite schedules must have the same units configured
/// \param default_limit_A default amps limit if no existing period limit applies
/// \param default_limit_W default watts limit if no existing period limit applies
/// \param default_number_phases default number of phases if no existing period limit applies
/// \param supply_voltage Supply voltage of the grid. This value is only used in case a conversion between smart
/// charging amp and watt limits is required \return the calculated combined composite schedule \note all composite
/// schedules must have the same units configured
CompositeSchedule calculate_composite_schedule(const CompositeSchedule& charging_station_external_constraints,
const CompositeSchedule& charging_station_max,
const CompositeSchedule& tx_default, const CompositeSchedule& tx);
const CompositeSchedule& tx_default, const CompositeSchedule& tx,
const int32_t default_limit_A, const int32_t default_limit_W,
const int32_t default_number_phases, const int32_t supply_voltage);

} // namespace v201
} // namespace ocpp
Loading

0 comments on commit d250b21

Please sign in to comment.