import {
type ChangeConfigurationRequest,
type ChangeConfigurationResponse,
- ChargingRateUnitType,
type ClearChargingProfileRequest,
type ClearChargingProfileResponse,
ErrorType,
OCPP16ChargePointStatus,
type OCPP16ChargingProfile,
OCPP16ChargingProfilePurposeType,
+ OCPP16ChargingRateUnitType,
type OCPP16ChargingSchedule,
+ type OCPP16ChargingSchedulePeriod,
type OCPP16ClearCacheRequest,
type OCPP16DataTransferRequest,
type OCPP16DataTransferResponse,
chargingProfiles.push(chargingProfile);
}
}
- const compositeSchedule: OCPP16ChargingSchedule = {
- startSchedule: min(
- chargingProfiles.map(
- (chargingProfile) => chargingProfile.chargingSchedule.startSchedule ?? maxTime,
- ),
+ const compositeScheduleStart: Date = min(
+ chargingProfiles.map(
+ (chargingProfile) => chargingProfile.chargingSchedule.startSchedule ?? maxTime,
),
- duration: Math.max(
- ...chargingProfiles.map(
- (chargingProfile) => chargingProfile.chargingSchedule.duration ?? -Infinity,
- ),
+ );
+ const compositeScheduleDuration: number = Math.max(
+ ...chargingProfiles.map(
+ (chargingProfile) => chargingProfile.chargingSchedule.duration ?? -Infinity,
),
+ );
+ // FIXME: remove overlapping charging schedule periods
+ const compositeSchedulePeriods: OCPP16ChargingSchedulePeriod[] = chargingProfiles
+ .map((chargingProfile) => chargingProfile.chargingSchedule.chargingSchedulePeriod)
+ .reduce(
+ (accumulator, value) =>
+ accumulator.concat(value).sort((a, b) => a.startPeriod - b.startPeriod),
+ [],
+ );
+ const compositeSchedule: OCPP16ChargingSchedule = {
+ startSchedule: compositeScheduleStart,
+ duration: compositeScheduleDuration,
chargingRateUnit: chargingProfiles.every(
(chargingProfile) =>
- chargingProfile.chargingSchedule.chargingRateUnit === ChargingRateUnitType.AMPERE,
+ chargingProfile.chargingSchedule.chargingRateUnit === OCPP16ChargingRateUnitType.AMPERE,
)
- ? ChargingRateUnitType.AMPERE
+ ? OCPP16ChargingRateUnitType.AMPERE
: chargingProfiles.every(
(chargingProfile) =>
- chargingProfile.chargingSchedule.chargingRateUnit === ChargingRateUnitType.WATT,
+ chargingProfile.chargingSchedule.chargingRateUnit === OCPP16ChargingRateUnitType.WATT,
)
- ? ChargingRateUnitType.WATT
- : ChargingRateUnitType.AMPERE,
- // FIXME: remove overlapping charging schedule periods
- chargingSchedulePeriod: chargingProfiles
- .map((chargingProfile) => chargingProfile.chargingSchedule.chargingSchedulePeriod)
- .reduce(
- (accumulator, value) =>
- accumulator.concat(value).sort((a, b) => a.startPeriod - b.startPeriod),
- [],
- ),
+ ? OCPP16ChargingRateUnitType.WATT
+ : OCPP16ChargingRateUnitType.AMPERE,
+ chargingSchedulePeriod: compositeSchedulePeriods,
minChargeRate: Math.min(
...chargingProfiles.map(
(chargingProfile) => chargingProfile.chargingSchedule.minChargeRate ?? Infinity,
AvailabilityStatus,
type BootNotificationResponse,
ChargingProfileStatus,
- ClearChargingProfileStatus,
type ClearCacheResponse,
+ ClearChargingProfileStatus,
ConfigurationStatus,
- DataTransferStatus,
type DataTransferResponse,
+ DataTransferStatus,
type DiagnosticsStatusNotificationResponse,
type ErrorResponse,
type FirmwareStatusNotificationResponse,
type MessageEvent,
} from './WorkerBroadcastChannel';
export {
- type OCPP16ChangeAvailabilityRequest,
type ChangeConfigurationRequest,
type ClearChargingProfileRequest,
type GetConfigurationRequest,
type GetDiagnosticsRequest,
OCPP16AvailabilityType,
type OCPP16BootNotificationRequest,
+ type OCPP16CancelReservationRequest,
+ type OCPP16ChangeAvailabilityRequest,
type OCPP16ClearCacheRequest,
type OCPP16DataTransferRequest,
OCPP16DataTransferVendorId,
OCPP16IncomingRequestCommand,
OCPP16MessageTrigger,
OCPP16RequestCommand,
+ type OCPP16ReserveNowRequest,
type OCPP16StatusNotificationRequest,
type OCPP16TriggerMessageRequest,
type OCPP16UpdateFirmwareRequest,
type ResetRequest,
type SetChargingProfileRequest,
type UnlockConnectorRequest,
- type OCPP16ReserveNowRequest,
- type OCPP16CancelReservationRequest,
} from './ocpp/1.6/Requests';
export {
- type OCPP16ChangeAvailabilityResponse,
type ChangeConfigurationResponse,
type ClearChargingProfileResponse,
type GetConfigurationResponse,
type GetDiagnosticsResponse,
type OCPP16BootNotificationResponse,
+ type OCPP16ChangeAvailabilityResponse,
type OCPP16DataTransferResponse,
OCPP16DataTransferStatus,
type OCPP16DiagnosticsStatusNotificationResponse,
type OCPP16FirmwareStatusNotificationResponse,
type OCPP16GetCompositeScheduleResponse,
type OCPP16HeartbeatResponse,
+ type OCPP16ReserveNowResponse,
type OCPP16StatusNotificationResponse,
type OCPP16TriggerMessageResponse,
type OCPP16UpdateFirmwareResponse,
type SetChargingProfileResponse,
type UnlockConnectorResponse,
- type OCPP16ReserveNowResponse,
} from './ocpp/1.6/Responses';
export { ChargePointErrorCode } from './ocpp/ChargePointErrorCode';
export {
export {
type OCPP16ChargingProfile,
OCPP16ChargingProfilePurposeType,
+ OCPP16ChargingRateUnitType,
type OCPP16ChargingSchedule,
+ type OCPP16ChargingSchedulePeriod,
} from './ocpp/1.6/ChargingProfile';
export {
OCPP16StandardParametersKey,