Utils.getRandomInteger(this.configuration.maxDuration, this.configuration.minDuration) *
1000;
logger.info(
- `${this.logPrefix(connectorId)} transaction ${this.chargingStation
+ `${this.logPrefix(connectorId)} transaction started with id ${this.chargingStation
.getConnectorStatus(connectorId)
- ?.transactionId?.toString()} started and will stop in ${Utils.formatDurationMilliSeconds(
+ ?.transactionId?.toString()} and will stop in ${Utils.formatDurationMilliSeconds(
waitTrxEnd
)}`
);
await Utils.sleep(waitTrxEnd);
// Stop transaction
logger.info(
- `${this.logPrefix(connectorId)} stop transaction ${this.chargingStation
+ `${this.logPrefix(connectorId)} stop transaction with id ${this.chargingStation
.getConnectorStatus(connectorId)
?.transactionId?.toString()}`
);
const transactionId = this.chargingStation.getConnectorStatus(connectorId)?.transactionId;
logger.warn(
`${this.logPrefix(connectorId)} stopping a not started transaction${
- !Utils.isNullOrUndefined(transactionId) ? ` ${transactionId?.toString()}` : ''
+ !Utils.isNullOrUndefined(transactionId) ? ` with id ${transactionId?.toString()}` : ''
}`
);
}
): void {
if (!Utils.isNullOrUndefined(connectorStatus?.status)) {
logger.warn(
- `${logPrefix} Charging station information from template ${templateFile} with connector ${connectorId} status configuration defined, undefine it`
+ `${logPrefix} Charging station information from template ${templateFile} with connector id ${connectorId} status configuration defined, undefine it`
);
delete connectorStatus.status;
}
for (const connectorId of connectors.keys()) {
if (connectorId > 0 && connectors.get(connectorId)?.transactionStarted === true) {
logger.warn(
- `${logPrefix} Connector id ${connectorId} at initialization has a transaction started: ${
+ `${logPrefix} Connector id ${connectorId} at initialization has a transaction started with id ${
connectors.get(connectorId)?.transactionId
}`
);
}
/**
- * Charging profiles should already be sorted by connectorId and stack level (highest stack level has priority)
+ * Charging profiles should already be sorted by connector id and stack level (highest stack level has priority)
*
* @param chargingProfiles -
* @param logPrefix -
}
}
logger.warn(
- `${chargingStation.logPrefix()} Trying to remote stop a non existing transaction ${transactionId.toString()}`
+ `${chargingStation.logPrefix()} Trying to remote stop a non existing transaction with id: ${transactionId.toString()}`
);
return OCPP16Constants.OCPP_RESPONSE_REJECTED;
}
(chargingStation.getConnectorStatus(authorizeConnectorId).idTagAuthorized = true);
logger.debug(
`${chargingStation.logPrefix()} idTag '${requestPayload.idTag}' accepted${
- authorizeConnectorIdDefined ? ` on connector ${authorizeConnectorId}` : ''
+ authorizeConnectorIdDefined ? ` on connector id ${authorizeConnectorId}` : ''
}`
);
} else {
logger.debug(
`${chargingStation.logPrefix()} idTag '${requestPayload.idTag}' rejected with status '${
payload.idTagInfo.status
- }'${authorizeConnectorIdDefined ? ` on connector ${authorizeConnectorId}` : ''}`
+ }'${authorizeConnectorIdDefined ? ` on connector id ${authorizeConnectorId}` : ''}`
);
}
}
requestPayload: OCPP16StartTransactionRequest
): Promise<void> {
const connectorId = requestPayload.connectorId;
-
if (connectorId === 0 || !chargingStation.connectors.has(connectorId)) {
logger.error(
`${chargingStation.logPrefix()} Trying to start a transaction on a non existing connector id ${connectorId.toString()}`
}
if (chargingStation.getConnectorStatus(connectorId)?.transactionStarted === true) {
logger.debug(
- `${chargingStation.logPrefix()} Trying to start a transaction on an already used connector ${connectorId.toString()}: %j`,
+ `${chargingStation.logPrefix()} Trying to start a transaction on an already used connector id ${connectorId.toString()}: %j`,
chargingStation.getConnectorStatus(connectorId)
);
return;
chargingStation.getConnectorStatus(connectorId)?.status !== OCPP16ChargePointStatus.Preparing
) {
logger.error(
- `${chargingStation.logPrefix()} Trying to start a transaction on connector ${connectorId.toString()} with status ${
+ `${chargingStation.logPrefix()} Trying to start a transaction on connector id ${connectorId.toString()} with status ${
chargingStation.getConnectorStatus(connectorId)?.status
}`
);
return;
}
- // if (!Number.isInteger(payload.transactionId)) {
- // logger.warn(
- // `${chargingStation.logPrefix()} Trying to start a transaction on connector ${connectorId.toString()} with a non integer transaction Id ${
- // payload.transactionId
- // }, converting to integer`
- // );
- // payload.transactionId = Utils.convertToInt(payload.transactionId);
- // }
+ if (!Number.isInteger(payload.transactionId)) {
+ logger.warn(
+ `${chargingStation.logPrefix()} Trying to start a transaction on connector id ${connectorId.toString()} with a non integer transaction id ${
+ payload.transactionId
+ }, converting to integer`
+ );
+ payload.transactionId = Utils.convertToInt(payload.transactionId);
+ }
if (payload.idTagInfo?.status === OCPP16AuthorizationStatus.ACCEPTED) {
chargingStation.getConnectorStatus(connectorId).transactionStarted = true;
OCPP16ChargePointStatus.Charging
);
logger.info(
- `${chargingStation.logPrefix()} Transaction ${payload.transactionId.toString()} STARTED on ${
+ `${chargingStation.logPrefix()} Transaction with id ${payload.transactionId.toString()} STARTED on ${
chargingStation.stationInfo.chargingStationId
}#${connectorId.toString()} for idTag '${requestPayload.idTag}'`
);
);
} else {
logger.warn(
- `${chargingStation.logPrefix()} Starting transaction id ${payload.transactionId.toString()} REJECTED with status '${
+ `${chargingStation.logPrefix()} Starting transaction with id ${payload.transactionId.toString()} REJECTED with status '${
payload.idTagInfo?.status
}', idTag '${requestPayload.idTag}'`
);
);
if (Utils.isNullOrUndefined(transactionConnectorId)) {
logger.error(
- `${chargingStation.logPrefix()} Trying to stop a non existing transaction ${requestPayload.transactionId.toString()}`
+ `${chargingStation.logPrefix()} Trying to stop a non existing transaction with id ${requestPayload.transactionId.toString()}`
);
return;
}
);
chargingStation.stopMeterValues(transactionConnectorId);
parentPort?.postMessage(MessageChannelUtils.buildUpdatedMessage(chargingStation));
- const logMsg = `${chargingStation.logPrefix()} Transaction ${requestPayload.transactionId.toString()} STOPPED on ${
+ const logMsg = `${chargingStation.logPrefix()} Transaction with id ${requestPayload.transactionId.toString()} STOPPED on ${
chargingStation.stationInfo.chargingStationId
}#${transactionConnectorId?.toString()} with status '${
payload.idTagInfo?.status ?? 'undefined'
`${chargingStation.logPrefix()} MeterValues measurand ${
meterValue.sampledValue[sampledValuesIndex].measurand ??
OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
- }: connectorId ${connectorId}, transaction ${
+ }: connector id ${connectorId}, transaction id ${
connector?.transactionId
}, value: ${socMinimumValue}/${
meterValue.sampledValue[sampledValuesIndex].value
`${chargingStation.logPrefix()} MeterValues measurand ${
meterValue.sampledValue[sampledValuesIndex].measurand ??
OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
- }: connectorId ${connectorId}, transaction ${
+ }: connector id ${connectorId}, transaction ${
connector?.transactionId
}, value: ${connectorMinimumPowerRounded}/${
meterValue.sampledValue[sampledValuesIndex].value
OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
}: phase ${
meterValue.sampledValue[sampledValuesPerPhaseIndex].phase
- }, connectorId ${connectorId}, transaction ${
+ }, connector id ${connectorId}, transaction id ${
connector?.transactionId
}, value: ${connectorMinimumPowerPerPhaseRounded}/${
meterValue.sampledValue[sampledValuesPerPhaseIndex].value
`${chargingStation.logPrefix()} MeterValues measurand ${
meterValue.sampledValue[sampledValuesIndex].measurand ??
OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
- }: connectorId ${connectorId}, transaction ${
+ }: connector id ${connectorId}, transaction id ${
connector?.transactionId
}, value: ${connectorMinimumAmperage}/${
meterValue.sampledValue[sampledValuesIndex].value
OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
}: phase ${
meterValue.sampledValue[sampledValuesPerPhaseIndex].phase
- }, connectorId ${connectorId}, transaction ${
+ }, connector id ${connectorId}, transaction id ${
connector?.transactionId
}, value: ${connectorMinimumAmperage}/${
meterValue.sampledValue[sampledValuesPerPhaseIndex].value
`${chargingStation.logPrefix()} MeterValues measurand ${
meterValue.sampledValue[sampledValuesIndex].measurand ??
OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
- }: connectorId ${connectorId}, transaction ${
+ }: connector id ${connectorId}, transaction id ${
connector?.transactionId
}, value: ${energyValueRounded}/${connectorMaximumEnergyRounded}, duration: ${Utils.roundTo(
interval / (3600 * 1000),
Utils.isNullOrUndefined(chargingStation.getConnectorStatus(connectorId)?.chargingProfiles)
) {
logger.error(
- `${chargingStation.logPrefix()} Trying to set a charging profile on connectorId ${connectorId} with an uninitialized charging profiles array attribute, applying deferred initialization`
+ `${chargingStation.logPrefix()} Trying to set a charging profile on connector id ${connectorId} with an uninitialized charging profiles array attribute, applying deferred initialization`
);
chargingStation.getConnectorStatus(connectorId).chargingProfiles = [];
}
Array.isArray(chargingStation.getConnectorStatus(connectorId)?.chargingProfiles) === false
) {
logger.error(
- `${chargingStation.logPrefix()} Trying to set a charging profile on connectorId ${connectorId} with an improper attribute type for the charging profiles array, applying proper type initialization`
+ `${chargingStation.logPrefix()} Trying to set a charging profile on connector id ${connectorId} with an improper attribute type for the charging profiles array, applying proper type initialization`
);
chargingStation.getConnectorStatus(connectorId).chargingProfiles = [];
}
logger.warn(
`${chargingStation.logPrefix()} OCPP ${
chargingStation.stationInfo.ocppVersion
- } connector ${connectorId} status transition from '${
+ } connector id ${connectorId} status transition from '${
chargingStation.getConnectorStatus(connectorId).status
}' to '${status}' is not allowed`
);
const onPhaseStr = phase ? `on phase ${phase} ` : '';
if (Constants.SUPPORTED_MEASURANDS.includes(measurand) === false) {
logger.warn(
- `${chargingStation.logPrefix()} Trying to get unsupported MeterValues measurand '${measurand}' ${onPhaseStr}in template on connectorId ${connectorId}`
+ `${chargingStation.logPrefix()} Trying to get unsupported MeterValues measurand '${measurand}' ${onPhaseStr}in template on connector id ${connectorId}`
);
return;
}
)?.value?.includes(measurand) === false
) {
logger.debug(
- `${chargingStation.logPrefix()} Trying to get MeterValues measurand '${measurand}' ${onPhaseStr}in template on connectorId ${connectorId} not found in '${
+ `${chargingStation.logPrefix()} Trying to get MeterValues measurand '${measurand}' ${onPhaseStr}in template on connector id ${connectorId} not found in '${
StandardParametersKey.MeterValuesSampledData
}' OCPP parameter`
);
) === false
) {
logger.warn(
- `${chargingStation.logPrefix()} Unsupported MeterValues measurand '${measurand}' ${onPhaseStr}in template on connectorId ${connectorId}`
+ `${chargingStation.logPrefix()} Unsupported MeterValues measurand '${measurand}' ${onPhaseStr}in template on connector id ${connectorId}`
);
} else if (
phase &&
}
}
if (measurand === MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER) {
- const errorMsg = `Missing MeterValues for default measurand '${measurand}' in template on connectorId ${connectorId}`;
+ const errorMsg = `Missing MeterValues for default measurand '${measurand}' in template on connector id ${connectorId}`;
logger.error(`${chargingStation.logPrefix()} ${errorMsg}`);
throw new BaseError(errorMsg);
}
logger.debug(
- `${chargingStation.logPrefix()} No MeterValues for measurand '${measurand}' ${onPhaseStr}in template on connectorId ${connectorId}`
+ `${chargingStation.logPrefix()} No MeterValues for measurand '${measurand}' ${onPhaseStr}in template on connector id ${connectorId}`
);
}