integration Fronius ladestation mit ocpp.
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
class WattpilotGen1Profile
|
||||
{
|
||||
public const DEVICE_PROFILE = 'fronius_wattpilot_gen1';
|
||||
|
||||
public static function capabilities(): array
|
||||
{
|
||||
return [
|
||||
'smartCharging' => true,
|
||||
'meterValues' => true,
|
||||
'phaseMetering' => false,
|
||||
'currentImportPerPhase' => false,
|
||||
'voltagePerPhase' => false,
|
||||
'powerImport' => true,
|
||||
'powerExport' => false,
|
||||
'energyImport' => true,
|
||||
'energyExport' => false,
|
||||
'numberPhases' => false,
|
||||
'phaseToUse' => false,
|
||||
'phaseSwitching' => false,
|
||||
'dataTransfer' => false,
|
||||
'remoteStartStop' => true,
|
||||
'availability' => true,
|
||||
'simpleAmpereProfiles' => true,
|
||||
'getVariables' => false,
|
||||
'setVariables' => false,
|
||||
'transactionEvent' => false,
|
||||
'soc' => false,
|
||||
'temperature' => false,
|
||||
'signedMeterValue' => false,
|
||||
'bidirectional' => false
|
||||
];
|
||||
}
|
||||
|
||||
public static function isWattpilotBoot(array $payload): bool
|
||||
{
|
||||
$vendor = strtolower((string)($payload['chargePointVendor'] ?? ''));
|
||||
$model = strtolower((string)($payload['chargePointModel'] ?? ''));
|
||||
return strpos($vendor, 'fronius') !== false || strpos($model, 'wattpilot') !== false;
|
||||
}
|
||||
|
||||
public static function buildChargingProfile(array $setpoint, int $profileId): array
|
||||
{
|
||||
$currentA = max(0.0, (float)($setpoint['effectiveCurrentA'] ?? 0.0));
|
||||
$validTo = gmdate('Y-m-d\TH:i:s\Z', time() + 120);
|
||||
$transactionId = (string)($setpoint['transactionId'] ?? '');
|
||||
$purpose = $transactionId !== '' ? 'TxProfile' : 'TxDefaultProfile';
|
||||
|
||||
$profile = [
|
||||
'connectorId' => (int)($setpoint['connectorId'] ?? 1),
|
||||
'csChargingProfiles' => [
|
||||
'chargingProfileId' => $profileId,
|
||||
'stackLevel' => 0,
|
||||
'chargingProfilePurpose' => $purpose,
|
||||
'chargingProfileKind' => 'Absolute',
|
||||
'validTo' => $validTo,
|
||||
'chargingSchedule' => [
|
||||
'duration' => 120,
|
||||
'chargingRateUnit' => 'A',
|
||||
'chargingSchedulePeriod' => [
|
||||
[
|
||||
'startPeriod' => 0,
|
||||
'limit' => round($currentA, 1)
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
if ($transactionId !== '') {
|
||||
$profile['csChargingProfiles']['transactionId'] = is_numeric($transactionId) ? (int)$transactionId : $transactionId;
|
||||
}
|
||||
|
||||
return $profile;
|
||||
}
|
||||
|
||||
public static function supportedMeasurands(): array
|
||||
{
|
||||
return [
|
||||
'Power.Active.Import',
|
||||
'Energy.Active.Import.Register',
|
||||
'Voltage',
|
||||
'Current.Import'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user