> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mangrovesystems.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Module 3 Exercise: Configure Batch Partitioning with LCA Emissions

> Set up per-delivery batch partitioning, add LCA event types, calculate and allocate process emissions, and verify net carbon output across multiple batches.

<Panel>
  <Card title="Accounting Academy" className="accounting-academy-card">
    <div className="accounting-academy-content">
      <Steps className="my-0">
        <Step title="MODULE 1: Fundamentals" icon="bookmark" iconType="solid" stepNumber={1} titleSize="p">
          * [1.1: Core Concepts & the Data Lifecycle](/accounting-academy/module-1/1-1-core-concepts-data-lifecycle)
          * [1.2: Translating Methodologies to Mangrove](/accounting-academy/module-1/1-2-translating-methodologies-to-mangrove)
          * [1.3: Events and Datapoints](/accounting-academy/module-1/1-3-events-and-datapoints)
          * [Exercise: Design and Build](/accounting-academy/module-1/1-exercise-design-and-build)
        </Step>

        <Step title="MODULE 2: Calculations" icon="bookmark" iconType="solid" stepNumber={2} titleSize="p">
          * [2.1: Calculation Architecture](/accounting-academy/module-2/2-1-calculation-architecture)
          * [2.2: Expanding Your Data Model](/accounting-academy/module-2/2-2-expanding-your-data-model)
          * [Exercise: Multi-Step Calculations](/accounting-academy/module-2/2-exercise-multi-step-calculations)
        </Step>

        <Step title="MODULE 3: Batch Partitioning & LCA" icon="bookmark" iconType="solid" stepNumber={3} titleSize="p">
          * [3.1: What Is a Batch?](/accounting-academy/module-3/3-1-what-is-a-batch)
          * [3.2: Batch Partitioning Strategies](/accounting-academy/module-3/3-2-batch-partitioning)
          * [3.3: Life Cycle Assessment & Emissions](/accounting-academy/module-3/3-3-lca-and-emissions)
          * [3.4: Allocating Emissions to Batches](/accounting-academy/module-3/3-4-allocating-emissions-to-batches)
          * [Exercise: Batch Partitioning & LCA](/accounting-academy/module-3/3-exercise-batch-partitioning-and-lca)
        </Step>

        <Step title="MODULE 4: Mass Balance with Ledgers" icon="bookmark" iconType="solid" stepNumber={4} titleSize="p">
          * [4.1: Introduction to Mass Balance](/accounting-academy/module-4/4-1-intro-to-mass-balance)
          * [4.2: Designing the Ledger Structure](/accounting-academy/module-4/4-2-designing-the-ledger-structure)
          * [4.3: Multiple Batch Types for Different Stages](/accounting-academy/module-4/4-3-multiple-batch-types)
          * [Exercise: Design & Build Mass Balance](/accounting-academy/module-4/4-exercise-design-and-build-mass-balance)
        </Step>

        <Step title="MODULE 5: Integration Testing" icon="bookmark" iconType="solid" stepNumber={5} titleSize="p">
          * [5.1: The Complete Model Assembly](/accounting-academy/module-5/5-1-the-complete-model-assembly)
          * [5.2: Testing Patterns](/accounting-academy/module-5/5-2-testing-patterns)
          * [5.3: Common Integration Pitfalls](/accounting-academy/module-5/5-3-common-integration-pitfalls)
          * [Exercise: Integration Testing](/accounting-academy/module-5/5-exercise-integration-testing)
        </Step>

        <Step title="MODULE 6: Advanced Patterns & Production" icon="bookmark" iconType="solid" stepNumber={6} titleSize="p">
          * [6.1: Model Design Best Practices](/accounting-academy/module-6/6-1-model-design-best-practices)
          * [6.2: Advanced Techniques](/accounting-academy/module-6/6-2-advanced-techniques)
          * [6.3: Production Readiness](/accounting-academy/module-6/6-3-production-readiness)
          * [Exercise: Production Deployment](/accounting-academy/module-6/6-exercise-production-deployment)
        </Step>
      </Steps>
    </div>
  </Card>
</Panel>

<Check>
  **What you'll build in this exercise:**

  * Configure per-delivery batch partitioning to generate separate batches per delivery
  * Add Energy Consumption and Transportation event types for LCA data
  * Calculate process emissions and allocate them to individual batches
  * Verify net carbon output (gross - emissions) across multiple batches
</Check>

This exercise brings together everything from Module 3: you'll configure your Mangrove Biochar project to generate **multiple batches** from partitioned deliveries, then add **LCA emissions** that are allocated to each batch and deducted from gross carbon to compute **net carbon removal**.

```mermaid theme={null}
flowchart LR
    subgraph Deliveries["4 Deliveries"]
        D1["Del 1<br/>3t"]
        D2["Del 2<br/>5t"]
        D3["Del 3<br/>4t"]
        D4["Del 4<br/>2t"]
    end

    subgraph Batches["4 Batches"]
        B1["Batch 1<br/>Net: 7.8 tCO2e"]
        B2["Batch 2<br/>Net: 13.0 tCO2e"]
        B3["Batch 3<br/>Net: 10.4 tCO2e"]
        B4["Batch 4<br/>Net: 5.2 tCO2e"]
    end

    D1 --> B1
    D2 --> B2
    D3 --> B3
    D4 --> B4

    LCA["LCA Emissions<br/>(allocated by mass)"] --> B1
    LCA --> B2
    LCA --> B3
    LCA --> B4

    style D1 fill:#42a5f5,stroke:#1976d2,stroke-width:2px,color:#000
    style D2 fill:#42a5f5,stroke:#1976d2,stroke-width:2px,color:#000
    style D3 fill:#42a5f5,stroke:#1976d2,stroke-width:2px,color:#000
    style D4 fill:#42a5f5,stroke:#1976d2,stroke-width:2px,color:#000
    style B1 fill:#ef5350,stroke:#c62828,stroke-width:2px,color:#000
    style B2 fill:#ef5350,stroke:#c62828,stroke-width:2px,color:#000
    style B3 fill:#ef5350,stroke:#c62828,stroke-width:2px,color:#000
    style B4 fill:#ef5350,stroke:#c62828,stroke-width:2px,color:#000
    style LCA fill:#ffa726,stroke:#f57c00,stroke-width:2px,color:#000
```

**Prerequisites:** Complete [Lesson 3.1](/accounting-academy/module-3/3-1-what-is-a-batch), [Lesson 3.2](/accounting-academy/module-3/3-2-batch-partitioning), [Lesson 3.3](/accounting-academy/module-3/3-3-lca-and-emissions), and [Lesson 3.4](/accounting-academy/module-3/3-4-allocating-emissions-to-batches). Your project should have the 3 event types and multi-step model from Module 2.

***

## Part 1: Design (30 min)

### 1. Choose a partition strategy

For Mangrove Biochar, decide:

* Should batches be per-delivery or time-based (e.g., monthly)?
* What does the Isometric methodology require?
* What makes operational sense for 3-4 deliveries per week?

<Tip>
  We recommend **per-delivery partitioning** — each delivery becomes its own batch with a tracking ID matching the delivery ticket number. This gives maximum traceability for verification.
</Tip>

### 2. Identify emission sources

Map the emission sources for Mangrove Biochar:

| Source                        | Category | Data Source              | Cadence      |
| ----------------------------- | -------- | ------------------------ | ------------ |
| Electricity for pyrolysis     | Process  | Monthly utility bill     | Monthly      |
| Propane for heating           | Process  | Monthly supplier invoice | Monthly      |
| Transport to application site | Process  | Per-delivery trip log    | Per-delivery |

### 3. Plan emissions allocation

| Emission    | Method                   | Rationale                       |
| ----------- | ------------------------ | ------------------------------- |
| Electricity | Proportional by mass     | Energy scales with throughput   |
| Propane     | Proportional by mass     | Heating scales with throughput  |
| Transport   | Direct to delivery batch | Each delivery has its own route |

***

## Part 2: Build in Mangrove (1.5 hrs)

### Step 1: Configure batch partitioning

1. Open your Mangrove Biochar project's batch type configuration.
2. Set the partition cadence to **per-delivery** (ID-based partitioning).
3. Verify the batch type is linked to the correct ledger and model output.

### Step 2: Add LCA event types

Add two new event types in **Data Inputs > Input Settings**:

<CardGroup cols={2}>
  <Card icon="bolt" title="Energy Consumption">
    | Datapoint         | Slug              | Type   |
    | ----------------- | ----------------- | ------ |
    | Electricity (kWh) | `electricity-kwh` | number |
    | Propane (gallons) | `propane-gallons` | number |
    | Period start      | `period-start`    | date   |
    | Period end        | `period-end`      | date   |
  </Card>

  <Card icon="truck" title="Transportation">
    | Datapoint     | Slug          | Type   |
    | ------------- | ------------- | ------ |
    | Distance (km) | `distance-km` | number |
    | Fuel type     | `fuel-type`   | text   |
    | Delivery ID   | `delivery-id` | text   |
  </Card>
</CardGroup>

### Step 3: Add emission factors as static inputs

Configure these as <a href="/production-accounting/data-inputs" target="_blank" rel="noopener noreferrer">static inputs</a>

in the resource library:

| Factor                  | Value | Unit           |
| ----------------------- | ----- | -------------- |
| Grid emission factor    | 0.417 | kg CO2e/kWh    |
| Propane emission factor | 5.72  | kg CO2e/gallon |
| Diesel emission factor  | 2.68  | kg CO2e/liter  |
| Fuel consumption rate   | 0.30  | L/km           |

### Step 4: Build LCA calculations in the model

Expand your model in the <a href="/production-accounting/models" target="_blank" rel="noopener noreferrer">Model Editor</a>

:

<Steps>
  <Step title="Electricity emissions">
    `electricity_emissions = electricity_kwh × grid_emission_factor / 1000`

    (Divide by 1000 to convert kg to tonnes)
  </Step>

  <Step title="Propane emissions">
    `propane_emissions = propane_gallons × propane_emission_factor / 1000`
  </Step>

  <Step title="Transport emissions">
    `transport_emissions = distance_km × fuel_consumption_rate × diesel_emission_factor / 1000`
  </Step>

  <Step title="Allocate shared emissions">
    Use the `data_point_proportion` operator to allocate electricity and propane emissions proportionally by biochar mass across batches.
  </Step>

  <Step title="Total allocated emissions per batch">
    `batch_emissions = allocated_electricity + allocated_propane + transport_emissions`
  </Step>

  <Step title="Net carbon per batch">
    `net_carbon = gross_carbon - batch_emissions`
  </Step>
</Steps>

### Step 5: Create test data

<a href="/data-collection/add-data" target="_blank" rel="noopener noreferrer">Add events</a>

representing one month of operations:

**4 Biochar Deliveries:**

| Delivery | Date   | Mass (t) | Carbon % |
| -------- | ------ | -------- | -------- |
| DEL-001  | Jan 5  | 3        | 80%      |
| DEL-002  | Jan 12 | 5        | 78%      |
| DEL-003  | Jan 19 | 4        | 82%      |
| DEL-004  | Jan 26 | 2        | 79%      |

**1 Energy Consumption event (January):**

* Electricity: 10,000 kWh
* Propane: 500 gallons

**4 Transportation events:**

| Delivery | Distance (km) |
| -------- | ------------- |
| DEL-001  | 150           |
| DEL-002  | 200           |
| DEL-003  | 180           |
| DEL-004  | 120           |

### Step 6: Generate and verify batches

1. Go to **Production Accounting** and <a href="/production-accounting/generate-batches" target="_blank" rel="noopener noreferrer">generate batches</a>

   for January.
2. Verify that **4 separate batches** are created (one per delivery).
3. For each batch, check:
   * Gross carbon calculation matches expected values
   * Allocated emissions are proportional to mass
   * Transport emissions are directly assigned to the correct batch
   * Net carbon = gross - total emissions

<Warning>
  If you see only 1 batch instead of 4, check that the partition cadence is set to per-delivery (ID-based) and that each delivery event has a unique tracking ID or date range.
</Warning>

***

## Success criteria

You have completed the Module 3 exercise when:

* **Per-delivery partitioning** configured — generating batches creates one batch per delivery event
* **4 test deliveries** created across different January dates, each generating its own batch
* **Energy Consumption and Transportation event types** created with appropriate datapoints
* **Emission factors** stored as static inputs in the resource library
* **Process emissions** calculated correctly (electricity × factor, propane × factor, transport × factor)
* **Emissions allocated** — electricity and propane proportionally by mass, transport directly to each batch
* **Net carbon** = gross carbon - total allocated emissions for each batch
* **Allocation sums match** — total allocated emissions across all batches equals the total period emissions

***

## What's next

You're still using a single ledger. In [Module 4: Mass Balance with Ledgers](/accounting-academy/module-4/4-1-intro-to-mass-balance) you'll learn how to track material across multiple stages using ledgers and multiple batch types. After that, Module 5 will teach you how to run comprehensive integration tests on your complete project.
