ocpp 0.24.1
A C++ implementation of the Open Charge Point Protocol
Public Member Functions | Protected Member Functions | List of all members
ocpp::v2::SmartCharging Class Reference
Inheritance diagram for ocpp::v2::SmartCharging:
ocpp::v2::SmartChargingInterface ocpp::v2::MessageHandlerInterface

Public Member Functions

 SmartCharging (const FunctionalBlockContext &functional_block_context, std::function< void()> set_charging_profiles_callback)
 
void handle_message (const ocpp::EnhancedMessage< MessageType > &message) override
 Handles the given message from the CSMS. This includes dispatching a CALLRESULT as a response to the incoming message . More...
 
GetCompositeScheduleResponse get_composite_schedule (const GetCompositeScheduleRequest &request) override
 Gets a composite schedule based on the given request. More...
 
std::optional< CompositeScheduleget_composite_schedule (int32_t evse_id, std::chrono::seconds duration, ChargingRateUnitEnum unit) override
 Gets a composite schedule based on the given parameters. More...
 
std::vector< CompositeScheduleget_all_composite_schedules (const int32_t duration, const ChargingRateUnitEnum &unit) override
 Gets composite schedules for all evse_ids (including 0) for the given duration and unit . If no valid profiles are given for an evse for the specified period, the composite schedule will be empty for this evse. More...
 
void delete_transaction_tx_profiles (const std::string &transaction_id) override
 for the given transaction_id removes the associated charging profile. More...
 
SetChargingProfileResponse conform_validate_and_add_profile (ChargingProfile &profile, int32_t evse_id, ChargingLimitSourceEnum charging_limit_source=ChargingLimitSourceEnum::CSO, AddChargingProfileSource source_of_request=AddChargingProfileSource::SetChargingProfile) override
 validates the given profile according to the specification, adding it to our stored list of profiles if valid. More...
 
ProfileValidationResultEnum conform_and_validate_profile (ChargingProfile &profile, int32_t evse_id, AddChargingProfileSource source_of_request=AddChargingProfileSource::SetChargingProfile) override
 validates the given profile according to the specification. If a profile does not have validFrom or validTo set, we conform the values to a representation that fits the spec. More...
 
virtual std::vector< CompositeScheduleget_all_composite_schedules (const int32_t duration, const ChargingRateUnitEnum &unit)=0
 Gets composite schedules for all evse_ids (including 0) for the given duration and unit . If no valid profiles are given for an evse for the specified period, the composite schedule will be empty for this evse. More...
 
virtual void delete_transaction_tx_profiles (const std::string &transaction_id)=0
 for the given transaction_id removes the associated charging profile. More...
 
virtual SetChargingProfileResponse conform_validate_and_add_profile (ChargingProfile &profile, int32_t evse_id, ChargingLimitSourceEnum charging_limit_source=ChargingLimitSourceEnum::CSO, AddChargingProfileSource source_of_request=AddChargingProfileSource::SetChargingProfile)=0
 validates the given profile according to the specification, adding it to our stored list of profiles if valid. More...
 
virtual ProfileValidationResultEnum conform_and_validate_profile (ChargingProfile &profile, int32_t evse_id, AddChargingProfileSource source_of_request=AddChargingProfileSource::SetChargingProfile)=0
 validates the given profile according to the specification. If a profile does not have validFrom or validTo set, we conform the values to a representation that fits the spec. More...
 
virtual GetCompositeScheduleResponse get_composite_schedule (const GetCompositeScheduleRequest &request)=0
 Gets a composite schedule based on the given request. More...
 
virtual std::optional< CompositeScheduleget_composite_schedule (int32_t evse_id, std::chrono::seconds duration, ChargingRateUnitEnum unit)=0
 Gets a composite schedule based on the given parameters. More...
 
virtual void handle_message (const EnhancedMessage< MessageType > &message)=0
 Handles the given message from the CSMS. This includes dispatching a CALLRESULT as a response to the incoming message . More...
 

Protected Member Functions

CompositeSchedule calculate_composite_schedule (const ocpp::DateTime &start_time, const ocpp::DateTime &end_time, const int32_t evse_id, ChargingRateUnitEnum charging_rate_unit, bool is_offline, bool simulate_transaction_active)
 Calculates the composite schedule for the given valid_profiles and the given connector_id.
 
ProfileValidationResultEnum validate_evse_exists (int32_t evse_id) const
 validates the existence of the given evse_id according to the specification
 
ProfileValidationResultEnum validate_charging_station_max_profile (const ChargingProfile &profile, int32_t evse_id) const
 validates requirements that apply only to the ChargingStationMaxProfile profile according to the specification
 
ProfileValidationResultEnum validate_tx_default_profile (const ChargingProfile &profile, int32_t evse_id) const
 validates the given profile and associated evse_id according to the specification
 
ProfileValidationResultEnum validate_tx_profile (const ChargingProfile &profile, int32_t evse_id, AddChargingProfileSource source_of_request=AddChargingProfileSource::SetChargingProfile) const
 validates the given profile according to the specification
 
ProfileValidationResultEnum validate_profile_schedules (ChargingProfile &profile, std::optional< EvseInterface * > evse_opt=std::nullopt) const
 validates that the given profile has valid charging schedules. If a profiles charging schedule period does not have a valid numberPhases, we set it to the default value (3).
 
ProfileValidationResultEnum verify_no_conflicting_external_constraints_id (const ChargingProfile &profile) const
 Checks a given profile does not have an id that conflicts with an existing profile of type ChargingStationExternalConstraints.
 
SetChargingProfileResponse add_profile (ChargingProfile &profile, int32_t evse_id, ChargingLimitSourceEnum charging_limit_source=ChargingLimitSourceEnum::CSO)
 Adds a given profile and associated evse_id to our stored list of profiles.
 
ClearChargingProfileResponse clear_profiles (const ClearChargingProfileRequest &request)
 Clears profiles from the system using the given request.
 
std::vector< ReportedChargingProfileget_reported_profiles (const GetChargingProfilesRequest &request) const
 Gets the charging profiles for the given request.
 
std::vector< ChargingProfileget_valid_profiles (int32_t evse_id, const std::vector< ChargingProfilePurposeEnum > &purposes_to_ignore={})
 Retrieves all profiles that should be considered for calculating the composite schedule. Only profiles that belong to the given evse_id and that are not contained in purposes_to_ignore are included in the response.
 

Member Function Documentation

◆ conform_and_validate_profile()

ProfileValidationResultEnum ocpp::v2::SmartCharging::conform_and_validate_profile ( ChargingProfile profile,
int32_t  evse_id,
AddChargingProfileSource  source_of_request = AddChargingProfileSource::SetChargingProfile 
)
overridevirtual

validates the given profile according to the specification. If a profile does not have validFrom or validTo set, we conform the values to a representation that fits the spec.

Implements ocpp::v2::SmartChargingInterface.

◆ conform_validate_and_add_profile()

SetChargingProfileResponse ocpp::v2::SmartCharging::conform_validate_and_add_profile ( ChargingProfile profile,
int32_t  evse_id,
ChargingLimitSourceEnum  charging_limit_source = ChargingLimitSourceEnum::CSO,
AddChargingProfileSource  source_of_request = AddChargingProfileSource::SetChargingProfile 
)
overridevirtual

validates the given profile according to the specification, adding it to our stored list of profiles if valid.

Implements ocpp::v2::SmartChargingInterface.

◆ delete_transaction_tx_profiles()

void ocpp::v2::SmartCharging::delete_transaction_tx_profiles ( const std::string &  transaction_id)
overridevirtual

for the given transaction_id removes the associated charging profile.

Implements ocpp::v2::SmartChargingInterface.

◆ get_all_composite_schedules()

std::vector< CompositeSchedule > ocpp::v2::SmartCharging::get_all_composite_schedules ( const int32_t  duration,
const ChargingRateUnitEnum &  unit 
)
overridevirtual

Gets composite schedules for all evse_ids (including 0) for the given duration and unit . If no valid profiles are given for an evse for the specified period, the composite schedule will be empty for this evse.

Parameters
durationof the request from. Composite schedules will be retrieved from now to (now + duration)
unitof the period entries of the composite schedules
Returns
vector of composite schedules, one for each evse_id including 0.

Implements ocpp::v2::SmartChargingInterface.

◆ get_composite_schedule() [1/2]

GetCompositeScheduleResponse ocpp::v2::SmartCharging::get_composite_schedule ( const GetCompositeScheduleRequest request)
overridevirtual

Gets a composite schedule based on the given request.

Parameters
requestspecifies different options for the request
Returns
GetCompositeScheduleResponse containing the status of the operation and the composite schedule if the operation was successful

Implements ocpp::v2::SmartChargingInterface.

◆ get_composite_schedule() [2/2]

std::optional< CompositeSchedule > ocpp::v2::SmartCharging::get_composite_schedule ( int32_t  evse_id,
std::chrono::seconds  duration,
ChargingRateUnitEnum  unit 
)
overridevirtual

Gets a composite schedule based on the given parameters.

Note
This will ignore TxDefaultProfiles and TxProfiles if no transaction is active on evse_id
Parameters
evse_idEvse to get the schedule for
durationHow long the schedule should be
unitChargingRateUnit to thet the schedule for
Returns
the composite schedule if the operation was successful, otherwise nullopt

Implements ocpp::v2::SmartChargingInterface.

◆ handle_message()

void ocpp::v2::SmartCharging::handle_message ( const ocpp::EnhancedMessage< MessageType > &  message)
overridevirtual

Handles the given message from the CSMS. This includes dispatching a CALLRESULT as a response to the incoming message .

Parameters
message

Implements ocpp::v2::MessageHandlerInterface.


The documentation for this class was generated from the following files: