diff --git a/include/ocpp/v16/charge_point.hpp b/include/ocpp/v16/charge_point.hpp index 1cfae070b..f873a18ea 100644 --- a/include/ocpp/v16/charge_point.hpp +++ b/include/ocpp/v16/charge_point.hpp @@ -159,17 +159,22 @@ class ChargePoint { const std::optional& data); /// \brief Calculates ChargingProfiles configured by the CSMS of all connectors from now until now + given \p - /// duration_s + /// duration_s and the given \p unit /// \param duration_s + /// \param unit defaults to A /// \return ChargingSchedules of all connectors - std::map get_all_composite_charging_schedules(const int32_t duration_s); + std::map + get_all_composite_charging_schedules(const int32_t duration_s, const ChargingRateUnit unit = ChargingRateUnit::A); /// \brief Calculates EnhancedChargingSchedule(s) configured by the CSMS of all connectors from now until now + - /// given \p duration_s . EnhancedChargingSchedules contain EnhancedChargingSchedulePeriod(s) that are enhanced by - /// the stackLevel that was provided for the ChargingProfile + /// given \p duration_s and the given \p unit . EnhancedChargingSchedules contain EnhancedChargingSchedulePeriod(s) + /// that are enhanced by the stackLevel that was provided for the ChargingProfile /// \param duration_s + /// \param unit defaults to A /// \return ChargingSchedules of all connectors - std::map get_all_enhanced_composite_charging_schedules(const int32_t duration_s); + std::map + get_all_enhanced_composite_charging_schedules(const int32_t duration_s, + const ChargingRateUnit unit = ChargingRateUnit::A); /// \brief Stores the given \p powermeter values for the given \p connector . This function can be called when a new /// meter value is present. diff --git a/include/ocpp/v16/charge_point_impl.hpp b/include/ocpp/v16/charge_point_impl.hpp index 5287ca14a..69658f08c 100644 --- a/include/ocpp/v16/charge_point_impl.hpp +++ b/include/ocpp/v16/charge_point_impl.hpp @@ -495,17 +495,22 @@ class ChargePointImpl : ocpp::ChargingStationBase { const std::optional& data); /// \brief Calculates ChargingProfiles configured by the CSMS of all connectors from now until now + given \p - /// duration_s + /// duration_s and the given \p unit /// \param duration_s + /// \param unit defaults to A /// \return ChargingSchedules of all connectors - std::map get_all_composite_charging_schedules(const int32_t duration_s); + std::map + get_all_composite_charging_schedules(const int32_t duration_s, const ChargingRateUnit unit = ChargingRateUnit::A); /// \brief Calculates EnhancedChargingSchedule(s) configured by the CSMS of all connectors from now until now + - /// given \p duration_s . EnhancedChargingSchedules contain EnhancedChargingSchedulePeriod(s) that are enhanced by - /// the stackLevel that was provided for the ChargingProfile + /// given \p duration_s and the given \p unit . EnhancedChargingSchedules contain EnhancedChargingSchedulePeriod(s) + /// that are enhanced by the stackLevel that was provided for the ChargingProfile /// \param duration_s - /// \return ChargingSchedules of all connectors - std::map get_all_enhanced_composite_charging_schedules(const int32_t duration_s); + /// \param unit + /// defaults to A \return ChargingSchedules of all connectors + std::map + get_all_enhanced_composite_charging_schedules(const int32_t duration_s, + const ChargingRateUnit unit = ChargingRateUnit::A); /// \brief Stores the given \p powermeter values for the given \p connector . This function can be called when a new /// meter value is present. diff --git a/lib/ocpp/v16/charge_point.cpp b/lib/ocpp/v16/charge_point.cpp index dfc566496..dfab16e81 100644 --- a/lib/ocpp/v16/charge_point.cpp +++ b/lib/ocpp/v16/charge_point.cpp @@ -71,13 +71,14 @@ std::optional ChargePoint::data_transfer(const CiString<25 return this->charge_point->data_transfer(vendorId, messageId, data); } -std::map ChargePoint::get_all_composite_charging_schedules(const int32_t duration_s) { - return this->charge_point->get_all_composite_charging_schedules(duration_s); +std::map ChargePoint::get_all_composite_charging_schedules(const int32_t duration_s, + const ChargingRateUnit unit) { + return this->charge_point->get_all_composite_charging_schedules(duration_s, unit); } std::map -ChargePoint::get_all_enhanced_composite_charging_schedules(const int32_t duration_s) { - return this->charge_point->get_all_enhanced_composite_charging_schedules(duration_s); +ChargePoint::get_all_enhanced_composite_charging_schedules(const int32_t duration_s, const ChargingRateUnit unit) { + return this->charge_point->get_all_enhanced_composite_charging_schedules(duration_s, unit); } void ChargePoint::on_meter_values(int32_t connector, const Measurement& measurement) { diff --git a/lib/ocpp/v16/charge_point_impl.cpp b/lib/ocpp/v16/charge_point_impl.cpp index 0f00dd052..12a9cc904 100644 --- a/lib/ocpp/v16/charge_point_impl.cpp +++ b/lib/ocpp/v16/charge_point_impl.cpp @@ -3334,7 +3334,8 @@ IdTagInfo ChargePointImpl::authorize_id_token(CiString<20> idTag, const bool aut return id_tag_info; } -std::map ChargePointImpl::get_all_composite_charging_schedules(const int32_t duration_s) { +std::map ChargePointImpl::get_all_composite_charging_schedules(const int32_t duration_s, + const ChargingRateUnit unit) { std::map charging_schedules; @@ -3346,7 +3347,7 @@ std::map ChargePointImpl::get_all_composite_charging_ const auto valid_profiles = this->smart_charging_handler->get_valid_profiles(start_time, end_time, connector_id); const auto composite_schedule = this->smart_charging_handler->calculate_composite_schedule( - valid_profiles, start_time, end_time, connector_id, ChargingRateUnit::A); + valid_profiles, start_time, end_time, connector_id, unit); charging_schedules[connector_id] = composite_schedule; } @@ -3354,7 +3355,7 @@ std::map ChargePointImpl::get_all_composite_charging_ } std::map -ChargePointImpl::get_all_enhanced_composite_charging_schedules(const int32_t duration_s) { +ChargePointImpl::get_all_enhanced_composite_charging_schedules(const int32_t duration_s, const ChargingRateUnit unit) { std::map charging_schedules; @@ -3366,7 +3367,7 @@ ChargePointImpl::get_all_enhanced_composite_charging_schedules(const int32_t dur const auto valid_profiles = this->smart_charging_handler->get_valid_profiles(start_time, end_time, connector_id); const auto composite_schedule = this->smart_charging_handler->calculate_enhanced_composite_schedule( - valid_profiles, start_time, end_time, connector_id, ChargingRateUnit::A); + valid_profiles, start_time, end_time, connector_id, unit); charging_schedules[connector_id] = composite_schedule; }