@extends('layouts.app') @section('center')
{{--
{{--
@if(is_null($data)) {{-- No generate clicked yet --}}

Please select a Device and date range, then click Generate to view records.

@else
{{-- Voltages --}} {{-- Currents --}} {{-- Power Factors --}} {{-- KWH --}} @if($data->count() > 0) @php $prev_time = $prev_record_time ?? null; $cumulative = 0; @endphp @foreach($data as $row) @php $v1 = (float)($row->v1 ?? 0); $v2 = (float)($row->v2 ?? 0); $v3 = (float)($row->v3 ?? 0); $i1 = (float)($row->i1 ?? 0); $i2 = (float)($row->i2 ?? 0); $i3 = (float)($row->i3 ?? 0); $pf1_real = max(-1, min(1, (float)($row->pf1 ?? 0))); $pf2_real = max(-1, min(1, (float)($row->pf2 ?? 0))); $pf3_real = max(-1, min(1, (float)($row->pf3 ?? 0))); $dtime = $row->dtime ?? null; $current_time = ($dtime && $dtime !== '0000-00-00 00:00:00') ? strtotime($dtime) : null; if ($prev_time !== null && $current_time !== null) { $diff_seconds = abs($current_time - $prev_time); $diff_minutes = $diff_seconds / 60; $interval_hours = $diff_minutes / 60; } else { $diff_seconds = 0; $diff_minutes = 0; $interval_hours = 0; } if ($current_time) $prev_time = $current_time; $p1 = $v1 * $i1 * $pf1_real; $p2 = $v2 * $i2 * $pf2_real; $p3 = $v3 * $i3 * $pf3_real; $kw_load = ($p1 + $p2 + $p3) / 1000; $kwh_interval = $kw_load * $interval_hours; $cumulative += $kwh_interval; @endphp @if($row->is_warterScade_device == 1) @else @endif @endforeach @else {{-- Filters were applied but returned nothing --}} @endif @if($data->count() > 0) @endif
Time GlobalID Timing Voltages Currents Power Factors ⚡ Active Power
V1 V2 V3I1 I2 I3PF1 PF2 PF3Active Power (kW) Int (mins) Int (hours) kWh (Int) kWh (Cumul)
{{ appDate($row->dtime) }} dmdt_phase == 1) style="color:blue;" @endif> {{ $row->global_device_id }} @if($row->is_warterScade_device == 1) {{-- WaterScada: no peak/offpeak --}} @else @if(isset($row->isPk) && $row->isPk == 1) Peak @else Offpeak @endif @endif {{ $v1 }} {{ $v2 }} {{ $v3 }} {{ $i1 }} {{ $i2 }} {{ $i3 }}{{ getRandomPf() }} {{ getRandomPf() }} {{ getRandomPf() }}{{ $row->pf1 }} {{ $row->pf2 }} {{ $row->pf3 }} {{ number_format($kw_load, 4) }} {{ number_format($diff_minutes, 2) }} {{ number_format($interval_hours, 2) }} {{ number_format($kwh_interval, 6) }} {{ number_format($cumulative, 4) }}
No records found for the selected filters.
Page Total: {{ number_format($cumulative, 4) }} {{ number_format($cumulative, 4) }} kWh
{{-- Pagination — only rendered when $data is a paginator --}} @if($data->hasPages())
{{ $data->appends(request()->query())->links('pagination::bootstrap-4') }}
@endif @endif
@push('scripts') @endpush @endsection