+import { randomInt } from 'node:crypto'
import { readFileSync } from 'node:fs'
import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
import type { DefinedError, ErrorObject, JSONSchemaType } from 'ajv'
import { isDate } from 'date-fns'
-import { OCPP16Constants } from './1.6/OCPP16Constants.js'
-import { OCPP20Constants } from './2.0/OCPP20Constants.js'
-import { OCPPConstants } from './OCPPConstants.js'
import {
type ChargingStation,
getConfigurationKey,
import {
ACElectricUtils,
Constants,
- DCElectricUtils,
convertToFloat,
convertToInt,
+ DCElectricUtils,
getRandomFloatFluctuatedRounded,
getRandomFloatRounded,
- getRandomInteger,
handleFileException,
isNotEmptyArray,
isNotEmptyString,
- logPrefix,
logger,
+ logPrefix,
max,
min,
roundTo
} from '../../utils/index.js'
+import { OCPP16Constants } from './1.6/OCPP16Constants.js'
+import { OCPP20Constants } from './2.0/OCPP20Constants.js'
+import { OCPPConstants } from './OCPPConstants.js'
-export const getMessageTypeString = (messageType: MessageType): string => {
+export const getMessageTypeString = (messageType: MessageType | undefined): string => {
switch (messageType) {
case MessageType.CALL_MESSAGE:
return 'request'
parseInt(socSampledValueTemplate.value),
socSampledValueTemplate.fluctuationPercent ?? Constants.DEFAULT_FLUCTUATION_PERCENT
)
- : getRandomInteger(socMaximumValue, socMinimumValue)
+ : randomInt(socMinimumValue, socMaximumValue)
meterValue.sampledValue.push(
buildSampledValue(socSampledValueTemplate, socSampledValueTemplateValue)
)