3.25 Set Charging Profile

The SetChargingProfile message in OCPP 1.6J is sent by the central system to configure a charging profile on the charge point. The profile defines charging parameters, such as power limits, start and end times, and energy consumption. It includes a charging profile ID and specifies the connector ID to which the profile applies. The charge point responds to confirm if the profile was successfully set. This helps manage charging sessions based on time, power or energy constraints.

API Syntax

Description

Input Params

Return Value

SetChargingProfileInit

Initializes the SetChargingProfile structure with default values

void

void

Example:

void OCPPMessagesInit(void)
{
    DataTransferInit();
    ResetInit();
    MeterValueStructInit();
    SetLocalListVersionNumber(DEFAULT_SEND_LOCAL_LIST_VERSION);   
    SetChargePointConnectorId(CHARGEPOINT_DEFAULT_CONTROLLER);
    ChargePointStatusInit();
    (void)SetAuthorizeStatus(AUTHORIZE_INVALID);
    SetOCPPWebsocketOnlineMode();
    UnlockConnectorInit();
    ReserveNowInit();
    ChangeAvailabilityInit();
    ClearCacheInit();
    ChangeConfigurationInit();
    CancelReservationInit();
    GetAllIDsFromDB();
    CheckAndStartClockAlignedMeterValueTimer();
    ClearChargingProfileInit();
    GetCompositeScheduleInit();
    GetLocalListVersionInit();
    SendLocalListInit();
    SetChargingProfileInit();
    TriggerMessageInit();
    RemoteStopTransactionInit();
    RemoteStartTransactionInit();
}

API Syntax

Description

Input Params

Return Value

SetSetChargingProfileStatus

Sets the status of the SetChargingProfile response.

SET_CHARGING_PROFILE_STATUS_T status

void

Example:


      if((params.connectorId == GetChargePointConnectorId()))
    {
        SetSetChargingProfileStatus(SET_CHARGING_PROFILE_ACCEPTED);
        LogDebug("APP_LOG", "CentralSmartCharging_TxProfile: Accepted\n");
    }
    else
    {
        SetSetChargingProfileStatus(SET_CHARGING_PROFILE_REJECTED);
        LogDebug("APP_LOG", "CentralSmartCharging_TxProfile: Rejected connector id missmacth\n");
    }

API Syntax

Description

Input Params

Return Value

GetSetChargingProfileParams

Copies parameters from the global RX_SetChargingProfile structure to the provided cur_charging_profile structure.

RX_SETCHARGINGPROFILE_T *currentChargingProfile

void

Example:

  case SET_CHARGING_PROFILE:
  {
    bool isCompositeSchedule = false;
    RX_SETCHARGINGPROFILE_T inputProfile;
    GetSetChargingProfileParams(&inputProfile);

    if (AddUpdateProfile(&inputProfile) == RETURN_SUCCESS)
    {
      LogDebug("APP_LOG", " Profile Updated successfully\n");
    }
    else
    {
      LogDebug("APP_LOG", " Failed to update Profile\n");
    }

    PrintChargingProfiles();
    ProcessSmartCharging(responsecode, isCompositeSchedule, inputProfile);
  }
  break;
       	 

Syntax

Description

Constants/Members

SETCHARGINGPROFILE_RESPONSE_T

Structure to define the response for the SetChargingProfile request

SET_CHARGING_PROFILE_STATUS_T status

RX_SETCHARGINGPROFILE_T

Structure to define the received SetChargingProfile data

char uuid[];

uint8_t connectorId;

CSCHARGINGPROFILE_DATA_T csChargingProfile;

uint8_t validData;

CSCHARGINGPROFILE_DATA_T

Structure to define the data for the charging profile

int chargingProfileId;

int transactionId;

uint8_t stackLevel;

CHARGING_PROFILE_PURPOSE_TYPE_T chargingProfilePurpose;

CHARGING_PROFILE_KIND_TYPE_T chargingProfileKind;

RECURRENCY_KIND_TYPE_T recurrencyKind;

char validFrom[VALID_DATE_MAX_LENGTH];

char validTo[VALID_DATE_MAX_LENGTH];

CHARGEINGSCHEDULE_DATA_T chargingSchedule;

CHARGEINGSCHEDULE_DATA_T

Structure to define the data for the charging schedule

uint16_t duration;

char startSchedule[];

char chargingRateUnit[];

CHARGEINGSCHEDULEPERIOD_DATA_T *chargingSchedulePeriod; float minchargingrate;

CHARGEINGSCHEDULEPERIOD_DATA_T

Structure to define the data for charging schedule periods

uint16_t startPeriod;

uint8_t limit;

uint8_t numberPhases;

SET_CHARGING_PROFILE_STATUS_T

Enumeration defining the charging profile status

SET_CHARGING_PROFILE_ACCEPTED

SET_CHARGING_PROFILE_REJECTED

SET_CHARGING_PROFILE_NOT_SUPPORTED