Skip to main content

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.

What you’ll build in this exercise:
  • Add 2 new event types (Feedstock Receipt, Lab Analysis) with appropriate datapoints
  • Expand your model to a 5-step calculation pipeline with intermediate outputs
  • Test the pipeline with varied data and verify intermediate and final results
This exercise expands the single-formula model you built in Module 1 into a multi-step calculation pipeline that processes data from three event types. By the end, your model will calculate net carbon sequestered through 5 distinct intermediate steps. Prerequisites: Complete Lesson 2.1: Calculation Architecture and Lesson 2.2: Expanding Your Data Model. Ensure your Mangrove Biochar training project has the Biochar Delivery event type and simple model from Module 1.

Part 1: Design (30 min)

Before building in Mangrove, design the expanded model on paper or in a spreadsheet.

1. Identify additional event types

Your project needs data from two new operational activities:

Feedstock Receipt

What goes into the pyrolysis process.
  • Feedstock type (text)
  • Wet mass in tonnes (number)
  • Moisture content as % (number)
  • Receipt date (date)

Lab Analysis

Quality testing of produced biochar.
  • Sample ID (text)
  • Carbon content as % (number)
  • H:C molar ratio (number)
  • Analysis date (date)

2. Map the 5-step calculation flow

For each step, identify the inputs and the formula:
StepCalculationInputsFormula
1Dry feedstock masswet_mass, moisture_contentwet_mass × (1 - moisture/100)
2Feedstock carbon contentdry_mass, carbon_pctdry_mass × (carbon_pct / 100)
3Biochar yieldfeedstock_carbon, biochar_massbiochar_mass / feedstock_carbon (efficiency ratio)
4Permanence factorhc_ratioIf H:C < 0.4 → 0.9; < 0.7 → 0.8; else → 0.7
5Net carbon sequesteredfeedstock_carbon, permanence, factor_3.67feedstock_carbon × permanence × 3.67

3. Identify validation rules

Think about what values should be flagged or rejected:
  • Moisture content must be between 0% and 100%
  • Carbon content must be between 0% and 100%
  • H:C ratio for biochar is typically 0.1–1.0
  • Wet mass must be positive

Part 2: Build in Mangrove (1.5 hrs)

Step 1: Add 2 new event types

  1. Open your Mangrove Biochar project and go to Data Inputs > Input Settings.
  2. Add a Feedstock Receipt event type (slug: feedstock-receipt) with 4 datapoints:
DatapointSlugValue Type
Feedstock typefeedstock-typetext
Wet mass (tonnes)wet-mass-tonnesnumber
Moisture content (%)moisture-content-pctnumber
Receipt datereceipt-datedate
  1. Add a Lab Analysis event type (slug: lab-analysis) with 4 datapoints:
DatapointSlugValue Type
Sample IDsample-idtext
Carbon content (%)carbon-content-pctnumber
H:C molar ratiohc-rationumber
Analysis dateanalysis-datedate
See configuring event types for details on setting up datapoints.

Step 2: Expand your model with a 5-step pipeline

  1. Open the Models section and the Model Editor .
  2. Build the multi-step calculation tree:
1

Step 1: Dry feedstock mass

Operator: product Children:
  • Input node: wet-mass-tonnes (from Feedstock Receipt)
  • Calculated node: 1 - moisture/100 (use a Keisan expression or intermediate nodes)
Expected result: If wet mass = 12 tonnes and moisture = 15%, dry mass = 12 × 0.85 = 10.2 tonnes
2

Step 2: Feedstock carbon content

Operator: product Children:
  • Intermediate: dry feedstock mass (from Step 1)
  • Input node: carbon-content-pct (from Lab Analysis, divided by 100)
Expected result: If dry mass = 10.2 tonnes and carbon = 80%, carbon mass = 10.2 × 0.80 = 8.16 tonnes C
3

Step 3: Biochar yield efficiency

Operator: quotient Children:
  • Input node: biochar-mass-tonnes (from Biochar Delivery)
  • Intermediate: dry feedstock mass (from Step 1)
Expected result: If biochar mass = 8 tonnes and dry feedstock = 10.2 tonnes, yield = 8 / 10.2 = 0.784 (78.4% yield)
4

Step 4: Permanence factor

Operator: keisan Expression: Conditional based on H:C ratio from Lab Analysis
if hc_ratio < 0.4
  0.9
elsif hc_ratio < 0.7
  0.8
else
  0.7
end
Expected result: If H:C = 0.35, permanence factor = 0.9
5

Step 5: Net carbon sequestered (tCO2e)

Operator: product Children:
  • Intermediate: feedstock carbon content (from Step 2)
  • Intermediate: permanence factor (from Step 4)
  • Constant: 3.67
Output datapoint type: net-carbon-tco2eExpected result: 8.16 × 0.9 × 3.67 = 26.95 tCO2e
The biochar yield (Step 3) is calculated for informational purposes — it doesn’t feed directly into the net carbon calculation in this simplified model. You could use it in more advanced models to adjust carbon content based on conversion efficiency.

Step 3: Test with varied data

  1. Create test eventsadd events for each of the 3 event types with the following test data:
Event TypeKey Values
Feedstock Receiptwet mass = 12 t, moisture = 15%
Lab Analysiscarbon content = 80%, H:C ratio = 0.35
Biochar Deliverymass = 8 t, carbon content = 80%
  1. Run the model in the Console and verify each intermediate step:
    • Dry mass: 12 × 0.85 = 10.2 t
    • Carbon mass: 10.2 × 0.80 = 8.16 t C
    • Yield: 8 / 10.2 = 0.784
    • Permanence: 0.9 (H:C < 0.4)
    • Net carbon: 8.16 × 0.9 × 3.67 ≈ 26.95 tCO2e
  2. Test with edge cases — create additional events with:
    • High moisture (50%) — dry mass should drop significantly
    • High H:C ratio (0.75) — permanence should be 0.7 (lowest tier)
    • Different carbon content — verify proportional impact on output
If intermediate values don’t match expectations, check: (1) datapoint slugs match between event types and model nodes, (2) percentage values are divided by 100 where needed, (3) the Keisan expression handles all H:C ranges correctly.

Success criteria

You have completed the Module 2 exercise when:
  • Two new event types exist — Feedstock Receipt and Lab Analysis — each with appropriate datapoints in Data Inputs > Input Settings
  • Model expanded to a 5-step pipeline with visible intermediate calculations
  • Intermediate outputs are verifiable — dry mass, carbon content, yield, permanence factor all produce expected values
  • Final output (net carbon in tCO2e) matches manual calculation for your test data
  • Edge cases tested — varied moisture, H:C ratios, and carbon content produce correct adjusted results

What’s next

In Module 3 you’ll learn about batch partitioning — how to split your operational data into discrete, reportable batches, and add LCA emissions calculations to compute net carbon removal. Continue to Module 3: Batch Partitioning & LCA.