Skip to content

Commit 6ed3976

Browse files
authored
Merge pull request #91 from c-jimenez/dev/get_composite_schedule
Get composite schedule implementation
2 parents 1b1a761 + 8656aa2 commit 6ed3976

17 files changed

+3444
-135
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ This implementation is based on the following libraries :
6060

6161
As of this version :
6262

63-
* All the messages defined in the OCPP 1.6 edition 2 protocol have been implemented except GetCompositeSchedule for Charge Point role
63+
* All the messages defined in the OCPP 1.6 edition 2 protocol have been implemented
6464
* All the configuration keys defined in the OCPP 1.6 edition 2 protocol have been implemented for the Charge Point role
6565
* All the messages defined in the OCPP 1.6 security whitepaper edition 2 have been implemented
6666
* All the messages defined in the Using ISO 15118 Plug & Charge with OCPP 1.6 Application Note v1.0 have been implemented
@@ -93,7 +93,7 @@ The standard OCPP configuration persistency has to be handled by the user applic
9393
| Firmware Management | Support for firmware update management and diagnostic log file download | Actual file download/upload as well as firmware installation must be handled by the user application in the callbacks provided by **Open OCPP** |
9494
| Local Auth List Management | Features to manage the local authorization list in Charge Points | None |
9595
| Reservation | Support for reservation of a Charge Point. | None |
96-
| Smart Charging | Support for basic Smart Charging, for instance using control pilot | GetCompositeSchedule is not supported for now in Charge Point role |
96+
| Smart Charging | Support for basic Smart Charging, for instance using control pilot | GetCompositeSchedule is not supported for connector 0 in Charge Point role |
9797
| Remote Trigger | Support for remote triggering of Charge Point initiated messages | None |
9898

9999
### Supported OCPP configuration keys

examples/common/DefaultChargePointEventsHandler.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,16 @@ void DefaultChargePointEventsHandler::transactionDeAuthorized(unsigned int conne
181181
cout << "Transaction deauthorized on connector : " << connector_id << endl;
182182
}
183183

184+
/** @copydoc bool IChargePointEventsHandler::getLocalLimitationsSchedule(unsigned int, ocpp::types::ChargingSchedule&) */
185+
bool DefaultChargePointEventsHandler::getLocalLimitationsSchedule(unsigned int connector_id,
186+
unsigned int duration,
187+
ocpp::types::ChargingSchedule& schedule)
188+
{
189+
(void)schedule;
190+
cout << "Local limitations schedule requested : " << connector_id << " - " << duration << endl;
191+
return false;
192+
}
193+
184194
/** @copydoc bool IChargePointEventsHandler::resetRequested(ocpp::types::ResetType) */
185195
bool DefaultChargePointEventsHandler::resetRequested(ocpp::types::ResetType reset_type)
186196
{

examples/common/DefaultChargePointEventsHandler.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ class DefaultChargePointEventsHandler : public ocpp::chargepoint::IChargePointEv
9696
/** @copydoc void IChargePointEventsHandler::transactionDeAuthorized(unsigned int) */
9797
void transactionDeAuthorized(unsigned int connector_id) override;
9898

99+
/** @copydoc bool IChargePointEventsHandler::getLocalLimitationsSchedule(unsigned int, unsigned int, ocpp::types::ChargingSchedule&) */
100+
bool getLocalLimitationsSchedule(unsigned int connector_id, unsigned int duration, ocpp::types::ChargingSchedule& schedule) override;
101+
99102
/** @copydoc bool IChargePointEventsHandler::resetRequested(ocpp::types::ResetType) */
100103
bool resetRequested(ocpp::types::ResetType reset_type) override;
101104

src/chargepoint/ChargePoint.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ bool ChargePoint::start()
279279
m_smart_charging_manager = std::make_unique<SmartChargingManager>(m_stack_config,
280280
m_ocpp_config,
281281
m_database,
282+
m_events_handler,
282283
*m_timer_pool,
283284
*m_worker_pool,
284285
m_connectors,

src/chargepoint/interface/IChargePointEventsHandler.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ along with OpenOCPP. If not, see <http://www.gnu.org/licenses/>.
2020
#define OPENOCPP_ICHARGEPOINTEVENTSHANDLER_H
2121

2222
#include "Certificate.h"
23+
#include "ChargingSchedule.h"
2324
#include "DateTime.h"
2425
#include "Enums.h"
2526
#include "MeterValue.h"
@@ -137,6 +138,15 @@ class IChargePointEventsHandler
137138
*/
138139
virtual void transactionDeAuthorized(unsigned int connector_id) = 0;
139140

141+
/**
142+
* @brief Called on reception of a GetCompositeSchedule request
143+
* @param connector_id Id of the concerned connector
144+
* @param duration Duration in seconds of the schedule
145+
* @param schedule Schedule containing the local limitations for the requested duration
146+
* @return true if a schedule has been defined, false if there are no local limitations for the requested duration
147+
*/
148+
virtual bool getLocalLimitationsSchedule(unsigned int connector_id, unsigned int duration, ocpp::types::ChargingSchedule& schedule) = 0;
149+
140150
/**
141151
* @brief Called on a reset request from the Central System
142152
* @param reset_type Type of reset

src/chargepoint/smartcharging/ProfileDatabase.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ class ProfileDatabase
5151

5252
/** @brief Stores a profile alongside its target connector */
5353
typedef std::pair<unsigned int, ocpp::types::ChargingProfile> ChargingProfileInfo;
54-
/** @brief Allow sorting of profiles by stack level */
54+
/** @brief Allow sorting of profiles by stack level and connector id*/
5555
struct ChargingProfileInfoLess
5656
{
5757
bool operator()(const ChargingProfileInfo& lhs, const ChargingProfileInfo& rhs) const
5858
{
59-
return (lhs.second.stackLevel > rhs.second.stackLevel);
59+
return ((lhs.second.stackLevel > rhs.second.stackLevel) || (lhs.first > rhs.first));
6060
}
6161
};
6262
/** @brief List of charging profiles stored by stack level */

0 commit comments

Comments
 (0)