Files
controls-web/overviews/data/newmills.php
2026-02-17 12:44:37 -06:00

262 lines
8.0 KiB
PHP

<?php
// phpcs:ignoreFile
declare(strict_types=1);
include __DIR__ . '/../../items.php';
require_once __DIR__ . '/module-helpers.php';
$eastMillMode = module_mode(isset($value['MILL1AUTOMAN']) ? (int) $value['MILL1AUTOMAN'] : null, 0);
$eastMillRows = [
[
'stage' => '1',
'level' => module_numeric($value['MILL1LVLPV']),
'sp' => module_numeric($value['MILL1SP']),
'rpm' => module_numeric($value['EMILL1RPM']),
'metric' => 'MCC FPM',
'metric_value' => module_numeric($value['MAINSPD']),
'metric_unit' => 'fpm',
],
[
'stage' => '2',
'level' => module_numeric($value['M2LVL']),
'sp' => module_numeric($value['MILL2SP']),
'rpm' => module_numeric($value['EMILL2RPM']),
'metric' => 'MCC Output',
'metric_value' => module_numeric($value['MCCOUTPUT']),
'metric_unit' => '%',
],
[
'stage' => '3',
'level' => module_numeric($value['MIL3LVL']),
'sp' => module_numeric($value['MILL3SP']),
'rpm' => module_numeric($value['EMILL3RPM']),
'metric' => 'MCC Tons',
'metric_value' => module_numeric($rounded1['MCCTONS'] ?? null),
'metric_unit' => 'tons',
],
[
'stage' => '4',
'level' => module_numeric($value['MIL4LVL']),
'sp' => module_numeric($value['MILL4SP']),
'rpm' => module_numeric($value['EMILL4RPM']),
'metric' => 'Mill 1 SP',
'metric_value' => module_numeric($value['WEIGHT_WSP']),
'metric_unit' => ($value['LEVEL_THROUGHPUT_SWITCH'] ?? 0) == 1 ? 'tons/hr' : '%',
'mode' => module_mode(isset($value['MILL1AUTOMAN1']) ? (int) $value['MILL1AUTOMAN1'] : null, 1),
],
[
'stage' => '5',
'level' => module_numeric($value['MIL5LVL']),
'sp' => module_numeric($value['MILL5SP']),
'rpm' => module_numeric($value['EMILL5RPM']),
'metric' => 'Grinding Rate',
'metric_value' => module_numeric($value['TONS_PER_HOUR']),
'metric_unit' => 'tons/hr',
],
[
'stage' => '6',
'level' => module_numeric($value['MIL6LVL']),
'sp' => module_numeric($value['MILL6SP']),
'rpm' => module_numeric($value['EMILL6RPM']),
'metric' => 'Average Rate',
'metric_value' => module_numeric($value['AVG_TONS_PER_HOUR']),
'metric_unit' => 'tons/15 min',
],
];
$eastImbibition = [
[
'label' => 'Imbibition 6',
'value' => module_numeric($value['IMBFLOW']),
'unit' => 'gpm',
'sp_label' => 'Imbibition 6 SP',
'sp_value' => module_numeric($value['IMBSP']),
],
[
'label' => 'Imbibition 5',
'value' => module_numeric($value['IMBFLOW']),
'unit' => 'gpm',
'sp_label' => 'Imbibition 5 SP',
'sp_value' => module_numeric($value['IMB5SP']),
],
];
$westAverage = module_numeric(module_capture(__DIR__ . '/west15minavg.php'));
$westRows = [
[
'stage' => '1',
'level' => module_numeric($ID['00654'] ?? null),
'sp' => null,
'rpm' => module_numeric($ID['00666'] ?? null),
'metric' => 'MCC FPM',
'metric_value' => module_numeric($value['Feet/Minute'] ?? null),
'metric_unit' => 'fpm',
],
[
'stage' => '2',
'level' => module_numeric($ID['00656'] ?? null),
'sp' => null,
'rpm' => module_numeric($ID['00670'] ?? null),
'metric' => 'MCC Output',
'metric_value' => module_numeric($ID['00638'] ?? null),
'metric_unit' => '%',
],
[
'stage' => '3',
'level' => module_numeric($ID['00657'] ?? null),
'sp' => null,
'rpm' => module_numeric($ID['00672'] ?? null),
'metric' => 'MCC Tons',
'metric_value' => module_numeric($ID['00640'] ?? null),
'metric_unit' => 'tons',
],
[
'stage' => '4',
'level' => module_numeric($ID['00658'] ?? null),
'sp' => null,
'rpm' => module_numeric($ID['00674'] ?? null),
'metric' => 'Mill 1 SP',
'metric_value' => module_numeric($ID['00642'] ?? null),
'metric_unit' => '%',
],
[
'stage' => '5',
'level' => module_numeric($ID['00660'] ?? null),
'sp' => null,
'rpm' => module_numeric($ID['00680'] ?? null),
'metric' => 'Grinding Rate',
'metric_value' => module_numeric($value['RATE'] ?? null),
'metric_unit' => 'tons/hr',
],
[
'stage' => '—',
'level' => null,
'sp' => null,
'rpm' => null,
'metric' => 'Average Rate',
'metric_value' => $westAverage,
'metric_unit' => 'tons/15 min',
],
];
$westImbibition = module_numeric($ID['00624'] ?? null);
?>
<section class="module-card">
<div class="module-heading">
<h2 class="module-heading__title">Mill Tandems</h2>
<span class="module-heading__meta">East &amp; West tandem performance</span>
</div>
<div class="module-grid module-grid--two">
<div class="module-stack">
<div class="module-tag">East Tandem</div>
<div class="module-row">
<span class="module-row__label">Mill 1 Output</span>
<span class="module-row__value"><?php echo module_number($value['MILL1OUTPUT'] ?? null); ?>%</span>
</div>
<div class="module-row">
<span class="module-row__label">Control Mode</span>
<div class="module-row__value"><?php echo $eastMillMode; ?></div>
</div>
<table class="module-table module-table--tight">
<thead>
<tr>
<th>Mill</th>
<th>Level</th>
<th>SP</th>
<th>RPM</th>
<th>Metric</th>
<th>Value</th>
<th>Units</th>
<th>Mode</th>
</tr>
</thead>
<tbody>
<?php foreach ($eastMillRows as $row) : ?>
<tr>
<td><?php echo module_html($row['stage']); ?></td>
<td>
<div class="module-progress">
<div class="module-bar">
<div class="module-bar__fill" style="width: <?php echo module_clamp_percent($row['level'] ?? 0); ?>%;"></div>
</div>
<span class="module-notes"><?php echo module_number($row['level'], 0); ?>%</span>
</div>
</td>
<td class="module-table__number"><?php echo module_number($row['sp'], 0); ?></td>
<td class="module-table__number"><?php echo module_number($row['rpm'], 0); ?></td>
<td><?php echo module_html($row['metric']); ?></td>
<td class="module-table__number"><?php echo module_number($row['metric_value'], 1); ?></td>
<td><?php echo module_html(strtoupper($row['metric_unit'])); ?></td>
<td>
<?php echo $row['mode'] ?? '—'; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div class="module-divider"></div>
<?php foreach ($eastImbibition as $imb) : ?>
<div class="module-row">
<span class="module-row__label"><?php echo module_html($imb['label']); ?></span>
<span class="module-row__value"><?php echo module_number($imb['value'], 0); ?> <?php echo module_html(strtoupper($imb['unit'])); ?></span>
</div>
<div class="module-row">
<span class="module-row__label"><?php echo module_html($imb['sp_label']); ?></span>
<span class="module-row__value"><?php echo module_number($imb['sp_value'], 0); ?> <?php echo module_html(strtoupper($imb['unit'])); ?></span>
</div>
<?php endforeach; ?>
</div>
<div class="module-stack">
<div class="module-tag">West Tandem</div>
<table class="module-table module-table--tight">
<thead>
<tr>
<th>Mill</th>
<th>Level</th>
<th>SP</th>
<th>RPM</th>
<th>Metric</th>
<th>Value</th>
<th>Units</th>
</tr>
</thead>
<tbody>
<?php foreach ($westRows as $row) : ?>
<tr>
<td><?php echo module_html($row['stage']); ?></td>
<td>
<div class="module-progress">
<div class="module-bar">
<div class="module-bar__fill" style="width: <?php echo module_clamp_percent($row['level'] ?? 0); ?>%;"></div>
</div>
<span class="module-notes"><?php echo module_number($row['level'], 0); ?>%</span>
</div>
</td>
<td class="module-table__number"><?php echo module_number($row['sp'], 0); ?></td>
<td class="module-table__number"><?php echo module_number($row['rpm'], 0); ?></td>
<td><?php echo module_html($row['metric']); ?></td>
<td class="module-table__number"><?php echo module_number($row['metric_value'], 1); ?></td>
<td><?php echo module_html(strtoupper($row['metric_unit'])); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div class="module-divider"></div>
<div class="module-row">
<span class="module-row__label">Imbibition</span>
<span class="module-row__value"><?php echo module_number($westImbibition, 0); ?> GPM</span>
</div>
</div>
</div>
</section>