Notebook · Notebook without plots · Python · Python without plots
Model an Industrial IoT fleet
Factory sensors collect machine data and upload readings to a shared server. Analysts use a dashboard to inspect those readings. We will build a model of this system, inspect its footprint, then try sending fewer uploads.
For this kind of service, the fleet is the starting business input. We describe what one sensor does, how sensors form a site, and when sites are deployed. e-footprint scales that activity over the fleet's lifetime. Analyst visits form a separate demand pattern that uses the same server.
We will first define the server and its jobs, then the sensor template and its
recurrent activity. Finally, we will add deployment and analyst demand and bring
them together in a System. The assumptions are illustrative.
Install efootprint to run the example; efootprint[boaviztapi] adds an offline
fallback for Boavizta hardware sizing.
Load this scenario in the interface.
Optional charts and graphs need efootprint[viz] and Jupyter/IPython.
Read the modeling inputs
Each object will have a name, inputs and links to other objects. SourceValue
wraps a quantity with its unit and provenance: u.GB_stored describes persistent
data, while u.GB_ram describes memory. SourceObject wraps non-quantity inputs
such as a hardware profile key. Keeping these as sourced inputs lets us trace
results back to their assumptions.
from efootprint.abstract_modeling_classes.source_objects import SourceObject, SourceValue
from efootprint.builders.hardware.boavizta_cloud_server import BoaviztaCloudServer
from efootprint.builders.hardware.edge.edge_computer import EdgeComputer
from efootprint.builders.timeseries import (
ExplainableHourlyQuantitiesFromFormInputs,
ExplainableRecurrentQuantitiesFromConstant,
)
from efootprint.builders.usage.edge.recurrent_edge_process import RecurrentEdgeProcess
from efootprint.constants.countries import Countries
from efootprint.constants.sources import Sources
from efootprint.constants.units import u
from efootprint.core.hardware.device import Device
from efootprint.core.hardware.edge.edge_storage import EdgeStorage
from efootprint.core.hardware.network import Network
from efootprint.core.hardware.server_base import ServerTypes
from efootprint.core.hardware.storage import Storage
from efootprint.core.system import System
from efootprint.core.usage.edge.edge_function import EdgeFunction
from efootprint.core.usage.edge.edge_usage_journey import EdgeUsageJourney
from efootprint.core.usage.edge.edge_usage_pattern import EdgeUsagePattern
from efootprint.core.usage.edge.recurrent_server_need import RecurrentServerNeed
from efootprint.core.usage.job import Job
from efootprint.core.usage.usage_journey import UsageJourney
from efootprint.core.usage.usage_journey_step import UsageJourneyStep
from efootprint.core.usage.usage_pattern import UsagePattern
from efootprint.core.hardware.edge.edge_device_group import EdgeDeviceGroup
from efootprint.comparison.duplication import duplicate_system
from efootprint.core import attribution
from efootprint.core.lifecycle_phases import LifeCyclePhases
from pathlib import Path
output_dir = Path("iot_industrial_outputs")
include_calculated_values = False
2026-12-01 12:18:16,840 - INFO - Imported BoaviztaCloudServer in 0.03334 seconds.
Cloud work and dashboard journeys
Let's begin with the server that will receive sensor data and answer dashboard
requests. Storage describes the persistent data; passing it to the server's
storage input connects the two objects.
.from_defaults() fills unspecified inputs with defaults so we can concentrate
on the assumptions we want to set. The Boavizta builder obtains a reference
hardware profile from the provider and instance type. Here that profile is a
sizing proxy for a server that stays provisioned throughout the period.
Background RAM and CPU describe the server's standing work. The jobs below add per-operation needs. Idle power is zero in this example; a measured idle-power input is needed to account for idle electricity.
server_storage = Storage.from_defaults(
"Sensor readings storage", base_storage_need=SourceValue(500 * u.GB_stored))
data_server = BoaviztaCloudServer.from_defaults(
"Sensor data server", server_type=ServerTypes.on_premise(),
provider=SourceObject("scaleway"),
instance_type=SourceObject("ent1-l"),
base_ram_consumption=SourceValue(4 * u.GB_ram),
base_compute_consumption=SourceValue(0.25 * u.cpu_core),
average_carbon_intensity=SourceValue(100 * u.g / u.kWh),
storage=server_storage)
Describe an upload on the server
A Job describes one execution of an operation. It links to data_server and
specifies the duration, CPU, RAM and data involved in that execution. Transfers
and retained data are separate: receiving a payload need not itself write a new
record, while storing a reading adds data to the attached storage.
One sensor upload will use both jobs below. We will give uploads a frequency when we describe the sensor's activity.
receive_sensor_data = Job(
"Receive sensor upload", server=data_server,
request_duration=SourceValue(200 * u.ms),
compute_needed=SourceValue(0.05 * u.cpu_core),
ram_needed=SourceValue(80 * u.MB_ram),
data_transferred=SourceValue(30 * u.kB),
data_stored=SourceValue(0 * u.kB_stored))
store_sensor_data = Job(
"Store sensor reading", server=data_server,
request_duration=SourceValue(250 * u.ms),
compute_needed=SourceValue(0.08 * u.cpu_core),
ram_needed=SourceValue(100 * u.MB_ram),
data_transferred=SourceValue(8 * u.kB),
data_stored=SourceValue(25 * u.kB_stored))
Describe the analyst's requests
The dashboard uses different jobs on the same server. Keeping those operations separate lets the model attribute shared infrastructure to sensor uploads and analyst activity without creating duplicate servers.
open_dashboard = Job(
"Open analysis dashboard", server=data_server,
request_duration=SourceValue(150 * u.ms),
compute_needed=SourceValue(0.08 * u.cpu_core),
ram_needed=SourceValue(120 * u.MB_ram),
data_transferred=SourceValue(800 * u.kB),
data_stored=SourceValue(0 * u.kB_stored))
load_recent_readings = Job(
"Load recent sensor readings", server=data_server,
request_duration=SourceValue(600 * u.ms),
compute_needed=SourceValue(0.25 * u.cpu_core),
ram_needed=SourceValue(300 * u.MB_ram),
data_transferred=SourceValue(2 * u.MB),
data_stored=SourceValue(0 * u.kB_stored))
run_daily_report = Job(
"Prepare daily analysis report", server=data_server,
request_duration=SourceValue(2 * u.s),
compute_needed=SourceValue(0.5 * u.cpu_core),
ram_needed=SourceValue(512 * u.MB_ram),
data_transferred=SourceValue(1 * u.MB),
data_stored=SourceValue(200 * u.kB_stored))
Group requests into a journey
Put each user action's jobs in a UsageJourneyStep, then collect the steps in a
UsageJourney. This describes one analyst session. A usage pattern later will
supply the number of sessions, their location, and the analyst's device.
dashboard_steps = [
UsageJourneyStep.from_defaults("Open the dashboard", jobs=[open_dashboard]),
UsageJourneyStep.from_defaults("Review recent readings", jobs=[load_recent_readings]),
UsageJourneyStep.from_defaults("Create a daily report", jobs=[run_daily_report]),
]
analyst_journey = UsageJourney("Analyst reviews sensor data", uj_steps=dashboard_steps)
One site contains fifty sensors
Now we can describe the hardware at a factory. EdgeComputer represents one
sensor design with CPU, RAM and storage components. EdgeStorage holds its
persistent local data. Activities will be separate objects that refer to this
sensor, letting us reuse the same hardware across its different tasks.
EdgeDeviceGroup describes a site's composition: its dictionary maps the sensor
template to a count. This group membership gives the sensor a per-site
multiplicity, even though later activities refer directly to factory_sensor.
One deployment will therefore mean one site containing fifty sensors.
We create this template once and later deploy it at fifteen sites, giving 750 sensors in total. The group count scales local work and uploads automatically; multiplying those inputs by the fleet size ourselves would count that work again.
edge_storage = EdgeStorage.from_defaults(
"Sensor local storage", base_storage_need=SourceValue(2 * u.GB_stored))
factory_sensor = EdgeComputer.from_defaults(
"Factory sensor", storage=edge_storage,
base_compute_consumption=SourceValue(0.02 * u.cpu_core))
site = EdgeDeviceGroup(
"Factory site", edge_device_counts={factory_sensor: SourceValue(50 * u.dimensionless)})
Recurrent sensing and uploads
The hardware says what a sensor is; a RecurrentEdgeProcess says what it does.
Each process links to factory_sensor and supplies CPU, RAM and storage profiles
over a typical week. These profiles describe one sensor's activity, before
multiplication by site composition or deployments.
ExplainableRecurrentQuantitiesFromConstant creates a profile with the same value
in every hour. That suits the continuously running processes in this example.
CPU and RAM describe occupied resources; storage describes net writes or deletes.
Zero net writes can coexist with the persistent data already held in local storage.
measure_machine_data = RecurrentEdgeProcess.from_defaults(
"Measure temperature and vibration",
edge_device=factory_sensor,
recurrent_compute_needed=ExplainableRecurrentQuantitiesFromConstant(
{"constant_value": 1, "constant_unit": "cpu_core"}, source=Sources.HYPOTHESIS),
recurrent_ram_needed=ExplainableRecurrentQuantitiesFromConstant(
{"constant_value": 1, "constant_unit": "GB_ram"}, source=Sources.HYPOTHESIS),
recurrent_storage_needed=ExplainableRecurrentQuantitiesFromConstant(
{"constant_value": 0, "constant_unit": "GB_stored"}, source=Sources.HYPOTHESIS))
keep_recent_readings = RecurrentEdgeProcess.from_defaults(
"Keep recent readings on the sensor",
edge_device=factory_sensor,
recurrent_compute_needed=ExplainableRecurrentQuantitiesFromConstant(
{"constant_value": 1, "constant_unit": "cpu_core"}, source=Sources.HYPOTHESIS),
recurrent_ram_needed=ExplainableRecurrentQuantitiesFromConstant(
{"constant_value": 1, "constant_unit": "GB_ram"}, source=Sources.HYPOTHESIS),
recurrent_storage_needed=ExplainableRecurrentQuantitiesFromConstant(
{"constant_value": 0, "constant_unit": "GB_stored"}, source=Sources.HYPOTHESIS))
Connect the sensor to cloud work
RecurrentServerNeed is the bridge from a device to jobs on a server. It names
the sensor producing the work, the jobs triggered by an upload, and the upload
frequency for one sensor. Its constant profile expresses occurrences per hour.
The group count and active deployments will scale that frequency. Keep the input per device rather than multiplying it by the fleet size here.
upload_sensor_data = RecurrentServerNeed.from_defaults(
"Upload sensor readings", edge_device=factory_sensor,
recurrent_volume_per_edge_device=ExplainableRecurrentQuantitiesFromConstant(
{"constant_value": 1, "constant_unit": "occurrence"}, source=Sources.HYPOTHESIS),
jobs=[receive_sensor_data, store_sensor_data])
Assemble the device activity
An EdgeFunction groups the local processes and server requests belonging to a
piece of device functionality. EdgeUsageJourney collects that functionality
into a reusable description of the sensor's working week.
These objects describe what an active sensor does. We still need to say when sites enter service and how long they keep operating.
edge_function = EdgeFunction(
"Sensor records and uploads readings",
recurrent_edge_device_needs=[measure_machine_data, keep_recent_readings],
recurrent_server_needs=[upload_sensor_data])
edge_usage_journey = EdgeUsageJourney.from_defaults(
"Sensor working week", edge_functions=[edge_function])
Deployment and analyst demand
We have described the work, but not how many people or sites produce it. There are two inputs to add: analyst sessions and site deployments. They use different pattern types because a visit happens once, whereas a newly deployed site keeps operating for its usage lifetime.
The analyst's laptop and network come from predefined archetypes. The country provides environmental context, including the sensor and laptop electricity mix. The server has its own explicit electricity factor.
Repeat the analyst journey
UsagePattern connects the dashboard journey to the laptop, network, country
and hourly session volume. The dictionary weight means one dashboard journey
per session. The demand builder converts the editable projection into hourly
occurrences; it smooths out working-hour peaks.
analyst_usage_pattern = UsagePattern(
"Daily analyst sessions", {analyst_journey: SourceValue(1 * u.dimensionless)}, [laptop],
network, france,
ExplainableHourlyQuantitiesFromFormInputs({
"start_date": "2025-01-01",
"modeling_duration_value": 3,
"modeling_duration_unit": "year",
"initial_volume": 14400,
"initial_volume_timespan": "year",
"net_growth_rate_in_percentage": 5,
"net_growth_rate_timespan": "year",
}, source=Sources.USER_DATA))
Turn deployment starts into an active fleet
EdgeUsagePattern connects device activity to deployments. Its
hourly_deployment_starts input counts new sites entering service, rather than
the sites already running. usage_span says how long each deployment operates
after its own start.
The starts projection stops after the rollout, but those sites keep running for
their lifetime. Activities refer to factory_sensor; its group membership supplies
the sensors-per-site count. Together these links scale one sensor's needs into
the fleet's resource use and uploads.
edge_usage_pattern = EdgeUsagePattern(
"Factory sites starting up",
edge_usage_journeys=[edge_usage_journey],
network=network,
country=france,
usage_span=SourceValue(6 * u.year),
hourly_deployment_starts=ExplainableHourlyQuantitiesFromFormInputs({
"start_date": "2025-01-01",
"modeling_duration_value": 1,
"modeling_duration_unit": "month",
"initial_volume": 15,
"initial_volume_timespan": "month",
"net_growth_rate_in_percentage": 0,
"net_growth_rate_timespan": "month",
}, source=Sources.USER_DATA))
Combine the fleet and its analysts
Give System the analyst pattern and the edge pattern in their respective lists.
Following their links brings together the site hardware, local processes, uploads
and dashboard work. Both paths reach the same data server and storage, so these
remain shared resources in the combined model.
system = System(
"Factory sensors and analysis system",
[analyst_usage_pattern],
edge_usage_patterns=[edge_usage_pattern])
2026-12-01 12:18:17,059 - INFO - Called GET https://api.boavizta.org/v1/cloud/instance with params {'provider': 'scaleway', 'instance_type': 'ent1-l'} in 78 ms.
Inspect numerical results
The linked model now has enough information to calculate a footprint. Read
system.total_footprint for hourly emissions and use .sum() for the period
total. .display_quantity formats the result with a suitable unit.
The two counts printed below are different: total_nb_of_units is the number
of sensors in one site, while the sum of deployment starts counts sites deployed.
Their product gives the deployed sensor count; the active fleet at any hour also
depends on when those sites started and on their usage lifetime.
Each site runs for six years after its start, while analyst demand covers three
years. The total therefore extends beyond the dashboard projection. Use
attributed_footprint to distinguish fleet-driven work from analyst activity,
including each pattern's share of the common server.
print("Period total:", system.total_footprint.sum().display_quantity)
print("Sensors per site:", factory_sensor.total_nb_of_units.display_quantity)
print("Site starts:", edge_usage_pattern.hourly_deployment_starts.sum().display_quantity)
for pattern in (edge_usage_pattern, analyst_usage_pattern):
total = sum(attribution.attributed_footprint(pattern, phase) for phase in LifeCyclePhases)
print(pattern.name, total.sum().display_quantity)
Period total: 196.0 metric_ton
Sensors per site: 50.0 dimensionless
Site starts: 15.0 occurrence
Factory sites starting up 196.0 metric_ton
Daily analyst sessions 44.4 kilogram
Follow fleet and cloud attribution
The Sankey connects the physical footprint to the activities it supports. Follow sensor hardware toward local processes, or shared server work toward uploads and analyst visits. This helps identify which assumptions drive the result.
Successive columns redistribute the same period footprint; adding their totals would count it repeatedly. They show the system total, lifecycle phase, country, usage pattern, journey, step or edge function, recurrent need, job or component need, object category, edge device, and physical hardware or components.
Hover over flows and nodes for amounts, percentages and full names. Use the full-window link when the whole allocation chain is difficult to read inline.
from IPython.display import IFrame, display
from efootprint.utils.impact_repartition import ImpactRepartitionSankey
ImpactRepartitionSankey(system, display_column_information=False).figure(
filename="iot_sankey.html", height=900, width=1800)
display(IFrame("iot_sankey.html", width="100%", height=950))
2026-12-01 12:18:17,121 - INFO - Function build took 12.2 ms to execute.
2026-12-01 12:18:17,230 - INFO - Function figure took 121.6 ms to execute.
Open visualization in a full window
Inspect site relationships
A relationship graph helps check whether we connected the model as intended.
Start from the edge usage pattern to follow its journey, processes and upload
jobs. The second graph call adds the site's composition to the same graph through
input_graph=site_graph, so we can also see how the sensor belongs to the site.
Lines describe object relationships rather than emissions. The ignored classes are only hidden from this view; they still contribute to the footprint.
from efootprint.utils.object_relationships_graphs import build_object_relationships_graph
hidden_classes = ["System", "Country", "Network", "Storage", "Device", "UsagePattern",
"EdgeComponent", "RecurrentEdgeComponentNeed"]
site_graph = build_object_relationships_graph(
edge_usage_pattern, classes_to_ignore=hidden_classes, notebook=True, width="100%", height="600px")
build_object_relationships_graph(site, input_graph=site_graph, classes_to_ignore=hidden_classes)
site_graph.write_html("iot_relationships.html", notebook=True)
display(IFrame("iot_relationships.html", width="100%", height=650))
Open visualization in a full window
Read hourly and cumulative fleet footprints
To isolate use-phase emissions driven by the fleet, ask attributed_footprint
for the edge pattern and LifeCyclePhases.USE. This includes sensor electricity,
uploads and the allocated cloud work, while leaving analyst activity and
manufacturing outside these curves.
.plot() shows the CO2-eq mass emitted in each hour. With cumsum=True, it shows
the mass accumulated since the start. Deployment raises the active fleet, then
each cohort runs for its usage lifetime. A rising cumulative curve alone does
not mean hourly emissions are increasing.
fleet_use = attribution.attributed_footprint(edge_usage_pattern, LifeCyclePhases.USE)
fleet_use.plot(filepath="iot_hourly_use.png", plt_show=True)
fleet_use.plot(filepath="iot_cumulative_use.png", cumsum=True, plt_show=True)


(<Figure size 1000x400 with 1 Axes>,
<Axes: title={'center': 'Cumulative attributed use footprint'}, ylabel='t'>)
Compare fewer uploads
Let's change the upload frequency while preserving the original fleet model.
duplicate_system gives us a copy whose corresponding objects retain their IDs.
Find the copied upload need by its ID; changing that object leaves the reference
model available for comparison.
The upload input is a recurrent profile, so assign a new constant-profile builder
to recurrent_volume_per_edge_device. That rate still applies to one sensor;
the existing group and deployment links scale it over the fleet.
The sensor count, lifetime and local process profiles stay the same. Read the totals again to see how the changed upload frequency affects transfers, cloud work and stored readings. Interpret the difference within those assumptions.
fewer_uploads = duplicate_system(system)
fewer_uploads.name = "Factory sensors with fewer uploads"
variant_upload = next(obj for obj in fewer_uploads.all_linked_objects if obj.id == upload_sensor_data.id)
variant_upload.recurrent_volume_per_edge_device = ExplainableRecurrentQuantitiesFromConstant(
{"constant_value": 0.5, "constant_unit": "occurrence"}, source=Sources.HYPOTHESIS)
print("Original:", system.total_footprint.sum().display_quantity)
print("Fewer uploads:", fewer_uploads.total_footprint.sum().display_quantity)
print("Difference:", (fewer_uploads.total_footprint - system.total_footprint).sum().display_quantity)
2026-12-01 12:18:17,619 - INFO - 1 changes affected 51 reactive slots in 4.1 ms.
2026-12-01 12:18:17,620 - INFO - Fetched GET https://api.boavizta.org/v1/cloud/instance params {'provider': 'scaleway', 'instance_type': 'ent1-l'} Boavizta API response from cache.
Original: 196.0 metric_ton
Fewer uploads: 196.0 metric_ton
Difference: -107.0 kilogram
Export to the interface
Set output_dir near the start to choose where to write the files.
system_to_json saves the original fleet. systems_to_json saves a comparison
whose first system is the reference and whose second is the fewer-upload variant.
Their matching object IDs let the interface pair corresponding parts of the models.
The single-model file contains inputs only by default. Set
include_calculated_values = True to save complete calculated snapshots as well.
Open the resulting files in the interface to inspect one model or compare the two.
The web export lesson describes the file
options in more detail.
from efootprint.api_utils.system_to_json import (
materialize_serialized_state, system_to_json, systems_to_json,
)
output_dir.mkdir(parents=True, exist_ok=True)
if include_calculated_values:
materialize_serialized_state(system)
materialize_serialized_state(fewer_uploads)
system_to_json(system, save_computed_state=include_calculated_values,
output_filepath=str(output_dir / "iot_industrial.json"))
systems_to_json([system, fewer_uploads],
output_filepath=str(output_dir / "iot_industrial_comparison.json"))
print("Exported model and reference-first comparison to", output_dir)
Exported model and reference-first comparison to iot_industrial_outputs