ocpp 0.24.1
A C++ implementation of the Open Charge Point Protocol
profile.hpp
1// SPDX-License-Identifier: Apache-2.0
2// Copyright Pionix GmbH and Contributors to EVerest
3
4#ifndef PROFILE_H
5#define PROFILE_H
6
7#include <cstdint>
8#include <optional>
9#include <vector>
10
11#include <ocpp/common/types.hpp>
12
13namespace ocpp::v16 {
14class ChargingProfile;
15class EnhancedChargingSchedule;
16class ChargingSchedulePeriod;
17
18constexpr float no_limit_specified = -1.0;
19
20using ocpp::DateTime;
21
23 void init(const DateTime& in_start, int in_duration, const ChargingSchedulePeriod& in_period,
24 const ChargingProfile& in_profile);
25 bool validate(const ChargingProfile& profile, const DateTime& now);
26
27 DateTime start;
28 DateTime end;
29 float limit;
30 std::optional<std::int32_t> number_phases;
31 std::int32_t stack_level;
32 ChargingRateUnit charging_rate_unit;
33 std::optional<float> min_charging_rate;
34};
35
36std::vector<DateTime> calculate_start(const DateTime& now, const DateTime& end,
37 const std::optional<DateTime>& session_start, const ChargingProfile& profile);
38std::vector<period_entry_t> calculate_profile_entry(const DateTime& now, const DateTime& end,
39 const std::optional<DateTime>& session_start,
40 const ChargingProfile& profile, std::uint8_t period_index);
41std::vector<period_entry_t> calculate_profile(const DateTime& now, const DateTime& end,
42 const std::optional<DateTime>& session_start,
43 const ChargingProfile& profile);
44
45EnhancedChargingSchedule calculate_composite_schedule(std::vector<period_entry_t>& combined_schedules,
46 const DateTime& now, const DateTime& end,
47 std::optional<ChargingRateUnit> charging_rate_unit,
48 int32_t default_number_phases, int32_t supply_voltage);
49
50EnhancedChargingSchedule calculate_composite_schedule(const EnhancedChargingSchedule& charge_point_max,
51 const EnhancedChargingSchedule& tx_default,
53 const CompositeScheduleDefaultLimits& default_limits,
54 int32_t supply_voltage);
55
56} // namespace ocpp::v16
57
58#endif // PROFILE_H
Contains a DateTime implementation that can parse and create RFC 3339 compatible strings.
Definition: types.hpp:109
Struct containing default limits for amps, watts and number of phases.
Definition: types.hpp:833
Definition: ocpp_types.hpp:146
Definition: ocpp_types.hpp:51
Enhances ChargingSchedule by containing std::vector<EnhancedChargingSchedulePeriods> instead of std::...
Definition: types.hpp:220
Definition: profile.hpp:22
void init(const DateTime &in_start, int in_duration, const ChargingSchedulePeriod &in_period, const ChargingProfile &in_profile)
populate a schedule period
Definition: profile.cpp:122
bool validate(const ChargingProfile &profile, const DateTime &now)
validate and update entry based on profile
Definition: profile.cpp:140