}
};
+interface ChargingProfilesLimit {
+ limit: number;
+ matchingChargingProfile: ChargingProfile;
+}
+
/**
* Charging profiles should already be sorted by connector id and stack level (highest stack level has priority)
*
* @param chargingProfiles -
* @param logPrefix -
- * @returns
+ * @returns ChargingProfilesLimit
*/
const getLimitFromChargingProfiles = (
chargingStation: ChargingStation,
connectorId: number,
chargingProfiles: ChargingProfile[],
logPrefix: string,
-):
- | {
- limit: number;
- matchingChargingProfile: ChargingProfile;
- }
- | undefined => {
+): ChargingProfilesLimit | undefined => {
const debugLogMsg = `${logPrefix} ${moduleName}.getLimitFromChargingProfiles: Matching charging profile found for power limitation: %j`;
const currentDate = new Date();
for (const chargingProfile of chargingProfiles) {
}
break;
}
+ } else if (chargingProfile.chargingProfileKind === ChargingProfileKindType.RELATIVE) {
+ chargingSchedule.startSchedule =
+ chargingStation.getConnectorStatus(connectorId)?.transactionStart;
}
// Check if the charging profile is active
if (
- isAfter(addSeconds(chargingSchedule.startSchedule, chargingSchedule.duration!), currentDate)
+ isAfter(addSeconds(chargingSchedule.startSchedule!, chargingSchedule.duration!), currentDate)
) {
let lastButOneSchedule: ChargingSchedulePeriod | undefined;
// Search the right schedule period
// Find the right schedule period
if (
isAfter(
- addSeconds(chargingSchedule.startSchedule, schedulePeriod.startPeriod),
+ addSeconds(chargingSchedule.startSchedule!, schedulePeriod.startPeriod),
currentDate,
)
) {