{ "cells": [ { "cell_type": "markdown", "id": "963c0e0a", "metadata": {}, "source": [ "# Playback Walkthrough\n", "\n", "Explore deterministic playback outputs for the tiny7 scenario using the shared analytics utilities." ] }, { "cell_type": "code", "execution_count": 1, "id": "3b7fa46d", "metadata": { "execution": { "iopub.execute_input": "2026-10-05T12:56:48.745899Z", "iopub.status.busy": "2026-10-05T12:56:48.745770Z", "iopub.status.idle": "2026-10-05T12:56:51.926517Z", "shell.execute_reply": "2026-10-05T12:56:51.924061Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
dayshift_idmachine_idmachine_rolesample_idproduction_unitstotal_hoursidle_hoursmobilisation_costsequencing_violationsblackout_conflictsavailable_hoursutilisation_ratiodowntime_hoursdowntime_eventsweather_severity_total
01S1H1feller_buncher01194.70892524.00.00.000024.01.00.000.0
11S1H2feller_buncher0813.20383024.00.00.000024.01.00.000.0
22S1H3grapple_skidder01438.08652924.00.00.000024.01.00.000.0
33S1H2feller_buncher01185.88305524.00.053.240024.01.00.000.0
43S1H3grapple_skidder0569.82622624.00.00.000024.01.00.000.0
\n", "
" ], "text/plain": [ " day shift_id machine_id machine_role sample_id production_units \\\n", "0 1 S1 H1 feller_buncher 0 1194.708925 \n", "1 1 S1 H2 feller_buncher 0 813.203830 \n", "2 2 S1 H3 grapple_skidder 0 1438.086529 \n", "3 3 S1 H2 feller_buncher 0 1185.883055 \n", "4 3 S1 H3 grapple_skidder 0 569.826226 \n", "\n", " total_hours idle_hours mobilisation_cost sequencing_violations \\\n", "0 24.0 0.0 0.00 0 \n", "1 24.0 0.0 0.00 0 \n", "2 24.0 0.0 0.00 0 \n", "3 24.0 0.0 53.24 0 \n", "4 24.0 0.0 0.00 0 \n", "\n", " blackout_conflicts available_hours utilisation_ratio downtime_hours \\\n", "0 0 24.0 1.0 0.0 \n", "1 0 24.0 1.0 0.0 \n", "2 0 24.0 1.0 0.0 \n", "3 0 24.0 1.0 0.0 \n", "4 0 24.0 1.0 0.0 \n", "\n", " downtime_events weather_severity_total \n", "0 0 0.0 \n", "1 0 0.0 \n", "2 0 0.0 \n", "3 0 0.0 \n", "4 0 0.0 " ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import sys\n", "from pathlib import Path\n", "\n", "PROJECT_ROOT = Path.cwd().resolve()\n", "while PROJECT_ROOT != PROJECT_ROOT.parent and not (PROJECT_ROOT / \"pyproject.toml\").exists():\n", " PROJECT_ROOT = PROJECT_ROOT.parent\n", "if not (PROJECT_ROOT / \"pyproject.toml\").exists():\n", " raise RuntimeError(\n", " \"Notebook must be executed within a FHOPS checkout (pyproject.toml not found).\"\n", " )\n", "if str(PROJECT_ROOT) not in sys.path:\n", " sys.path.insert(0, str(PROJECT_ROOT))\n", "\n", "from docs.examples.analytics import utils\n", "\n", "SCENARIO = PROJECT_ROOT / \"examples/tiny7/scenario.yaml\"\n", "ASSIGNMENTS = PROJECT_ROOT / \"tests/fixtures/playback/tiny7_assignments.csv\"\n", "\n", "playback_tables = utils.load_deterministic_playback(SCENARIO, ASSIGNMENTS)\n", "playback_tables.shift.head()" ] }, { "cell_type": "markdown", "id": "cc480be6", "metadata": {}, "source": [ "## Production by Day\n", "\n", "Visualise production totals per day. Adjust the cell below to experiment with different views." ] }, { "cell_type": "code", "execution_count": 2, "id": "a77887f6", "metadata": { "execution": { "iopub.execute_input": "2026-10-05T12:56:51.928513Z", "iopub.status.busy": "2026-10-05T12:56:51.928243Z", "iopub.status.idle": "2026-10-05T12:56:51.954677Z", "shell.execute_reply": "2026-10-05T12:56:51.953931Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "" ], "text/plain": [ "alt.Chart(...)" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "chart = utils.plot_production_by_day(playback_tables.day)\n", "chart" ] } ], "metadata": { "kernelspec": { "display_name": ".venv", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.16" } }, "nbformat": 4, "nbformat_minor": 5 }