Neutral Current Losses Graph
@php
function haversineDistance($lat1, $lon1, $lat2, $lon2, $earthRadius = 6371) {
$latFrom = deg2rad($lat1);
$lonFrom = deg2rad($lon1);
$latTo = deg2rad($lat2);
$lonTo = deg2rad($lon2);
$latDelta = $latTo - $latFrom;
$lonDelta = $lonTo - $lonFrom;
$angle = 2 * asin(sqrt(pow(sin($latDelta / 2), 2) +
cos($latFrom) * cos($latTo) * pow(sin($lonDelta / 2), 2)));
return $earthRadius * $angle;
}
$previousDevice = null;
$totalDistance = 0;
$firstpooldistance = null;
$i = 1;
$graphData = [];
@endphp
| # |
Global Device ID |
{{-- Type | --}}
Latitude |
Longitude |
Distance |
ANT Condt Resist |
WASP Condt Resist |
A NCl |
W NCl |
{{--transformers--}}
@foreach($devices as $device)
@php
$previousDevice = null;
@endphp
@foreach($device->children as $child)
{{-- | {{ $i++ }} | --}}
↳ {{ $child->global_device_id }} |
{{ $child->installed_on }} |
{{ $child->latitude }} |
{{ $child->longitude }} |
@if($previousDevice)
@php
$distance = haversineDistance(
$previousDevice->latitude,
$previousDevice->longitude,
$child->latitude,
$child->longitude
);
$totalDistance += $distance;
@endphp
@if($distance < 1)
{{ number_format($distance * 1000, 0) }} m
@else
{{ number_format($distance, 2) }} km
@endif
@else
@php
$firstpooldistance = haversineDistance(
$device->latitude,
$device->longitude,
$child->latitude,
$child->longitude
);
$totalDistance += $firstpooldistance;
@endphp
@if($firstpooldistance < 1)
{{ number_format($firstpooldistance * 1000, 0) }} m
@else
{{ number_format($firstpooldistance, 2) }} km
@endif
@endif
|
@php $previousDevice = $child; @endphp
@endforeach
| {{ $i++ }} |
{{ $device->global_device_id }} |
{{ $device->latitude }} |
{{ $device->longitude }} |
{{ number_format($totalDistance, 2) }} km |
@php
// Number of conductors
$nc = $device->nc;
// --------------------------
// ANT Conductor Calculation
// --------------------------
$area_ant = 54.6 * pow(10, -6); // 54.6 mm² → m²
$resistivity_ant = 3.2 * pow(10, -8); // Ω·m for ANT
$r_ant = $resistivity_ant * ($totalDistance * 1000 / $area_ant); // Resistance
$ncl_ant = pow($nc, 2) * $r_ant; // NCL = NC² × R
// --------------------------
// WASP Conductor Calculation
// --------------------------
$area_wasp = 100 * pow(10, -6); // 100 mm² → m²
$resistivity_wasp = 3.1 * pow(10, -8); // Ω·m for WASP
$r_wasp = $resistivity_wasp * ($totalDistance * 1000 / $area_wasp); // Resistance
$ncl_wasp = pow($nc, 2) * $r_wasp; // NCL = NC² × R
$graphData[$device->global_device_id] = [
'ant_ncl' => round($ncl_ant, 3),
'wasp_ncl' => round($ncl_wasp, 3),
];
@endphp
{{-- Resistance and NCL display --}}
{{ number_format($r_ant, 3) }} | {{-- ANT Resistance --}}
{{ number_format($r_wasp, 3) }} | {{-- WASP Resistance --}}
{{ number_format($ncl_ant, 3) }} | {{-- ANT NCL --}}
{{ number_format($ncl_wasp, 3) }} | {{-- WASP NCL --}}
@endforeach
@php
$deviceLabels = array_keys($graphData);
$antNclValues = array_column($graphData, 'ant_ncl');
$waspNclValues = array_column($graphData, 'wasp_ncl');
@endphp