|
| 1 | +# Plant Simulation Model — Fabrikam HMI-26 |
| 2 | + |
| 3 | +This folder documents the **recycling plant simulation model** for the HMI-26 demo and the customizations applied to the `edgemqttsim` module. |
| 4 | + |
| 5 | +The simulator itself lives in the [shared module](../../modules/edgemqttsim/). |
| 6 | + |
| 7 | +This folder does **not** copy those files. Instead it records: |
| 8 | +- What the plant model represents (Fabrikam rHDPE recycling) |
| 9 | +- What was changed from the default simulator configuration |
| 10 | +- How to build and deploy the module for this environment |
| 11 | +- The MQTT topic layout and asset definitions |
| 12 | + |
| 13 | +--- |
| 14 | + |
| 15 | +## Plant Model: Fabrikam rHDPE Recycling Facility |
| 16 | + |
| 17 | +The simulated plant represents the Fabrikam post-consumer plastics recycling facility — a 100 m × 40 m operation that processes collected plastic waste into production-ready recycled HDPE (rHDPE) pellets. It is modeled in the [`message_structure.yaml`](../../modules/edgemqttsim/message_structure.yaml) config and documented in [`HMI-fabrikam-data-spec.md`](../../modules/edgemqttsim/HMI-fabrikam-data-spec.md). |
| 18 | + |
| 19 | +### Production Line and Equipment |
| 20 | + |
| 21 | +Material flows through 18 stages from collection to finished pellet packaging: |
| 22 | + |
| 23 | +| Stage | Equipment | MQTT topic | |
| 24 | +|-------|-----------|------------| |
| 25 | +| Collection | Smart bins, trucks | `fabrikam/collection`, `fabrikam/collection_transport` | |
| 26 | +| Inbound identification | Feed scanner | `fabrikam/inbound_identification` | |
| 27 | +| Feeding | Feed conveyor (FC-01) | `fabrikam/feeding` | |
| 28 | +| Sorting | NIR optical sorters (NIR-01, NIR-02) | `fabrikam/sorting` | |
| 29 | +| Primary size reduction | Shredder (SHR-01) | `fabrikam/primary_size_reduction` | |
| 30 | +| Secondary size reduction | Granulator (GRN-01) | `fabrikam/secondary_size_reduction` | |
| 31 | +| Pre-wash | Pre-wash tank (PW-01) | `fabrikam/pre_wash` | |
| 32 | +| Friction wash | Friction washers (FW-01, FW-02) | `fabrikam/friction_wash` | |
| 33 | +| Hot wash | Hot wash tank (HW-01) | `fabrikam/hot_wash` | |
| 34 | +| Rinsing | Rinse tank (RW-01) | `fabrikam/rinsing` | |
| 35 | +| Density separation | Float-sink separator (FS-01) | `fabrikam/density_separation` | |
| 36 | +| Mechanical drying | Centrifugal dryer (CD-01) | `fabrikam/mechanical_drying` | |
| 37 | +| Thermal drying | Thermal dryer (TD-01) | `fabrikam/thermal_drying` | |
| 38 | +| Post-dry buffering | Collection bin (CB-EXTR-01) | `fabrikam/post_dry_buffering` | |
| 39 | +| Extrusion | Extruders (EXT-01, EXT-02) | `fabrikam/extrusion` | |
| 40 | +| Melt filtration | Screen changers (SC-01, SC-02) | `fabrikam/melt_filtration` | |
| 41 | +| Pelletizing | Pelletizer (PEL-01) | `fabrikam/pelletizing` | |
| 42 | +| Pellet screening | Pellet screener (PS-01) | `fabrikam/pellet_screening` | |
| 43 | +| Packaging | Bagging station (PKG-01) | `fabrikam/packaging` | |
| 44 | + |
| 45 | +### Key Design Decisions |
| 46 | + |
| 47 | +- One simulated lot travels end-to-end in ~900 seconds (configurable in `message_structure.yaml`). |
| 48 | +- Machine IDs follow `<TYPE>-<NN>` (e.g., `NIR-02`, `EXT-01`). |
| 49 | +- All messages carry `lot_id` and `source_zone` to support full lineage tracing from collection bin to finished pellet. |
| 50 | +- OEE (Availability, Performance, Quality) is derivable from raw telemetry — no pre-aggregation. |
| 51 | +- The PKG station emits colour scan readings (RGB) used by the Colour Quality Ops Agent to detect blue-tint contamination. |
| 52 | + |
| 53 | +--- |
| 54 | + |
| 55 | +## edgemqttsim Module Reference |
| 56 | + |
| 57 | +Source: [`quickstart/modules/edgemqttsim/`](../../modules/edgemqttsim/) |
| 58 | + |
| 59 | +Key files: |
| 60 | + |
| 61 | +| File | Purpose | |
| 62 | +|------|---------| |
| 63 | +| `app.py` | Main MQTT client — connects to `aio-broker`, drives message loop | |
| 64 | +| `messages.py` | Message generation logic per equipment type | |
| 65 | +| `message_structure.yaml` | Tune frequencies, machine counts, quality distributions | |
| 66 | +| `deployment.yaml` | K8s deployment — update `image:` field to your ACR | |
| 67 | +| `Dockerfile` | Build image for ACR push | |
| 68 | +| `mqtt-asset-endpoint.yaml` | Azure IoT Operations Asset Endpoint Profile for the simulator | |
| 69 | +| `mqtt-asset-example.yaml` | Example Azure IoT Operations Asset definition | |
| 70 | +| `arm_asset_creation.py` | Helper to create Azure IoT Operations assets via ARM API | |
| 71 | +| `deploy-mqtt-assets.sh` | Shell wrapper for asset creation | |
| 72 | +| `HMI-fabrikam-data-spec.md` | Full payload schema for all machine types and stages | |
| 73 | + |
| 74 | +--- |
| 75 | + |
| 76 | +## HMI-26 Customizations |
| 77 | + |
| 78 | +Record changes made to the default `edgemqttsim` config for this environment below. |
| 79 | + |
| 80 | +### `message_structure.yaml` changes |
| 81 | + |
| 82 | +<!-- |
| 83 | + Document any tweaks to stage weights, machine counts, lot duration, or anomaly seed. |
| 84 | + Example: |
| 85 | + - Reduced total_duration_sec from 900 to 600 for faster demo cycles |
| 86 | + - Increased contamination probability at sorting stage to make blue-tint events more frequent |
| 87 | +--> |
| 88 | + |
| 89 | +_No customizations recorded yet. Update this section as changes are made._ |
| 90 | + |
| 91 | +### `deployment.yaml` changes |
| 92 | + |
| 93 | +| Setting | Value | Notes | |
| 94 | +|---------|-------|-------| |
| 95 | +| `image` | `<your-acr-name>.azurecr.io/edgemqttsim:latest` | HMI-26 ACR | |
| 96 | +| `MQTT_BROKER` | `aio-broker.azure-iot-operations.svc.cluster.local` | Do not change | |
| 97 | +| `MQTT_PORT` | `18883` | MQTTS | |
| 98 | + |
| 99 | +--- |
| 100 | + |
| 101 | +## Building and Deploying |
| 102 | + |
| 103 | +### 1. Build and push the image |
| 104 | + |
| 105 | +```bash |
| 106 | +# From quickstart/modules/edgemqttsim/ |
| 107 | +docker build -t <your-acr-name>.azurecr.io/edgemqttsim:latest . |
| 108 | +az acr login --name <your-acr-name> |
| 109 | +docker push <your-acr-name>.azurecr.io/edgemqttsim:latest |
| 110 | +``` |
| 111 | + |
| 112 | +### 2. Deploy to cluster |
| 113 | + |
| 114 | +```bash |
| 115 | +# From quickstart/modules/edgemqttsim/ |
| 116 | +kubectl apply -f deployment.yaml |
| 117 | +``` |
| 118 | + |
| 119 | +The [`Deploy-EdgeModules.ps1`](../../external_configuration/Deploy-EdgeModules.ps1) script automates ACR credential setup and deployment. Run it from the Windows management machine after the base Azure IoT Operations install. |
| 120 | + |
| 121 | +### 3. Verify |
| 122 | + |
| 123 | +```bash |
| 124 | +kubectl logs -l app=edgemqttsim -f |
| 125 | +# Expect: "Published: factory/cnc ..." messages every second |
| 126 | +``` |
| 127 | + |
| 128 | +--- |
| 129 | + |
| 130 | +## MQTT Asset Definitions |
| 131 | + |
| 132 | +Azure IoT Operations Asset resources map the simulator's MQTT streams into the IoT Operations asset model. The base templates are in the [shared module](../../modules/edgemqttsim/): |
| 133 | + |
| 134 | +- [`mqtt-asset-endpoint.yaml`](../../modules/edgemqttsim/mqtt-asset-endpoint.yaml) — defines the MQTT source endpoint |
| 135 | +- [`mqtt-asset-example.yaml`](../../modules/edgemqttsim/mqtt-asset-example.yaml) — example asset for a single machine type |
| 136 | + |
| 137 | +HMI-26-specific asset YAML files should be added to this folder when created. |
| 138 | + |
| 139 | +--- |
| 140 | + |
| 141 | +## References |
| 142 | + |
| 143 | +### In this repo |
| 144 | + |
| 145 | +- [HMI-fabrikam-data-spec.md](../../modules/edgemqttsim/HMI-fabrikam-data-spec.md) — full payload schema for all stages |
| 146 | +- [Foundry Local](../foundry-local/README.md) — on-cluster AI for quality ops and contamination detection |
| 147 | +- [Omniverse](../omniverse/README.md) — digital twin visualization of this plant |
| 148 | + |
| 149 | +### How to do this yourself |
| 150 | + |
| 151 | +- [IoT Operations MQTT Broker overview](https://learn.microsoft.com/azure/iot-operations/manage-mqtt-broker/overview-broker) — understand the broker that edgemqttsim publishes to |
| 152 | +- [Manage assets in IoT Operations](https://learn.microsoft.com/azure/iot-operations/discover-manage-assets/overview-manage-assets) — map MQTT streams to IoT Operations Asset resources |
| 153 | +- [Push a Docker image to Azure Container Registry](https://learn.microsoft.com/azure/container-registry/container-registry-get-started-docker-cli) — build and push the edgemqttsim image |
| 154 | +- [Pull from ACR in Kubernetes](https://learn.microsoft.com/azure/container-registry/container-registry-auth-kubernetes) — configure the ACR pull secret used by the deployment |
| 155 | +- [Configure MQTT broker authentication](https://learn.microsoft.com/azure/iot-operations/manage-mqtt-broker/howto-configure-authentication) — SAT-based auth used by the simulator pod |
0 commit comments