3TE/formulas_reference.md
Nicolas Cantu c7db6590f0 Initial commit: 4NK Waste & Water Simulator
**Motivations :**
* Create a complete simulator for 4NK Waste & Water modular waste treatment infrastructure
* Implement frontend-only application with client-side data persistence
* Provide seed data for wastes and natural regulators from specifications

**Root causes :**
* Need for a simulation tool to configure and manage waste treatment projects
* Requirement for localhost-only access with persistent client-side storage
* Need for initial seed data to bootstrap the application

**Correctifs :**
* Implemented authentication system with AuthContext
* Fixed login/logout functionality with proper state management
* Created placeholder pages for all routes

**Evolutions :**
* Complete application structure with React, TypeScript, and Vite
* Seed data for 9 waste types and 52 natural regulators
* Settings page with import/export and seed data loading functionality
* Configuration pages for wastes and regulators with CRUD operations
* Project management pages structure
* Business plan and yields pages placeholders
* Comprehensive UI/UX design system (dark mode only)
* Navigation system with sidebar and header

**Page affectées :**
* All pages: Login, Dashboard, Waste Configuration, Regulators Configuration, Services Configuration
* Project pages: Project List, Project Configuration, Treatment Sites, Waste Sites, Investors, Administrative Procedures
* Analysis pages: Yields, Business Plan
* Utility pages: Settings, Help
* Components: Layout, Sidebar, Header, base components (Button, Input, Select, Card, Badge, Table)
* Utils: Storage, seed data, formatters, validators, constants
* Types: Complete TypeScript definitions for all entities
2025-12-09 19:09:42 +01:00

14 KiB
Raw Permalink Blame History

4NK Waste & Water - Complete Calculation Formulas Reference

1. Infrastructure Capacity Calculations

1.1 Daily Processing Capacity

Daily_processing_capacity (T/day) = Module_capacity (T) × Number_of_modules
Daily_processing_capacity = 67T × 21 = 1,407T/day

1.2 Water Content Calculation

Water_content (T) = Total_waste (T) × Water_percentage (%)
Water_content = 67T × 75% = 50.25T water per module

1.3 Total Containers

Total_containers = Number_of_modules × Containers_per_module
Total_containers = 21 × 4 = 84 containers

2. Processing Time Calculations

2.1 Mesophilic Digestion Duration

Mesophilic_duration (days) = Hygienization_duration + Additional_days
Mesophilic_duration = 18 days + 3 days = 21 days

2.2 Drying and Bioremediation Duration

Drying_bioremediation_duration (days) = Drying_duration + (Bioremediation_phases × Phase_duration)
Drying_bioremediation_duration = 21 days + (3 phases × 21 days) = 84 days (variable)

2.3 Thermophilic Digestion and Composting Duration

Thermophilic_composting_duration (days) = Thermophilic_duration + Composting_duration
Thermophilic_composting_duration = 18 days + 3 days = 21 days

2.4 Spirulina Cycle Duration

Spirulina_cycle_duration (hours) = 72 hours
Spirulina_cycle_duration (days) = 72 / 24 = 3 days

3. Methane Production Calculations

3.1 Dry Matter Calculation (VS - Volatile Solids)

Dry_matter (kg VS) = Waste_quantity (kg) × (1 - Water_percentage (%))
Dry_matter_percentage (%) = 100% - Water_percentage (%)

Example:

  • Waste quantity: 67,000 kg (67T)
  • Water percentage: 75%
  • Dry matter: 67,000 × (1 - 0.75) = 67,000 × 0.25 = 16,750 kg VS
  • Dry matter percentage: 100% - 75% = 25%

3.2 Methane Production from BMP

Methane_production (m³/day) = BMP (Nm³ CH₄/kg VS) × Dry_matter (kg VS/day) × Efficiency_factor

Parameters:

  • BMP: Biochemical Methane Potential (Nm³ CH₄/kg VS) - varies by waste type
  • Dry_matter: Calculated from waste quantity and water percentage
  • Efficiency_factor: Processing efficiency (typically 0.7-0.9)

3.3 Origin Units to Methane Conversion

Methane_per_1000m³ = Number_of_origin_units × Conversion_factor

Parameter: Number of origin units to produce 1000m³ of methane (varies by waste origin)

4. Gas Production Calculations

4.1 Biogas Composition

Biogas_total (m³/day) = Methane_production (m³/day) / Methane_percentage_in_biogas

Biogas Composition:

  • Methane (CH₄): 40% of biogas
  • CO₂: 60% of biogas

4.2 Methane from Biogas

Methane_production (m³/day) = Biogas_total (m³/day) × 0.40

4.3 CO₂ Production from Biogas

CO2_production (m³/day) = Biogas_total (m³/day) × 0.60

Alternative calculation:

CO2_production (m³/day) = Methane_production (m³/day) × (0.60 / 0.40)
CO2_production (m³/day) = Methane_production (m³/day) × 1.5

4.4 Total Gas Production

Total_gas_production (m³/day) = Methane_production (m³/day) + CO2_production (m³/day)
Total_gas_production (m³/day) = Biogas_total (m³/day)

5. Energy Calculations

5.1 Heat Energy from Biogas

Heat_energy (kJ/day) = Methane_production (m³/day) × Methane_energy_content (kJ/m³) × Combustion_efficiency

Parameters:

  • Methane_energy_content: 35,800 kJ/m³ (lower heating value)
  • Combustion_efficiency: 0.90 (90%)

5.2 Heat Energy Conversion to kWh

Heat_energy (kW.h/day) = Heat_energy (kJ/day) / 3600

5.3 Electrical Power from Biogas Generator

Electrical_power_biogas (kW) = Methane_production (m³/day) × Methane_energy_content (kJ/m³) × Electrical_efficiency / (3600 × 24)

Parameter: Electrical_efficiency: 0.40 (40% for combined heat and power systems)

5.4 Electrical Power from Solar Panels

Electrical_power_solar (kW) = Solar_panel_surface (m²) × Solar_irradiance (kW/m²) × Panel_efficiency

Parameters:

  • Solar_irradiance: Varies by location and season (typically 0.1-1.0 kW/m²)
  • Panel_efficiency: Typically 0.15-0.22

5.5 Total Electrical Power

Total_electrical_power (kW) = Electrical_power_biogas (kW) + Electrical_power_solar (kW)

5.6 Module Electrical Consumption

Module_electrical_consumption (kW) = Sum of all equipment consumption:
  - 1 pump (méthanisation): 0.5 kW
  - 1 séchoir du gaz: 2.0 kW
  - 1 compresseur: 3.0 kW
  - 1 lampe UV-C × 12m: 0.3 kW
  - 5 racloires électriques × 3: 1.5 kW
  - 1 pompe (spiruline): 0.5 kW
  - 5 × 12m LED de culture: 0.6 kW
  - 3 pompes eau: 1.5 kW
  - Capteurs: 0.1 kW
  - 1 serveur: 0.2 kW
  - 1 borne Starlink: 0.1 kW
  - 1 tableau élec: 0.1 kW
  - 1 convertisseur panneaux solaires: 0.1 kW
  Total per module: ~10.5 kW
Total_modules_consumption (kW) = Module_electrical_consumption (kW) × Number_of_modules
Total_modules_consumption (kW) = 10.5 kW × Number_of_modules

5.7 Net Electrical Power

Net_electrical_power (kW) = Total_electrical_power (kW) - Total_modules_consumption (kW)

6. Bitcoin Mining Calculations

6.1 Number of Flex Miners

Number_of_flex_miners = Available_electrical_power (kW) / Power_per_miner (kW)
Number_of_flex_miners = Available_electrical_power (kW) / 2 kW

6.2 Bitcoin Production

Bitcoins_BTC_per_year = 79.2 × 0.0001525 / flex_miner

Formula: BTC/year = 79.2 × 0.0001525 / number_of_flex_miners

Parameters:

  • 79.2: Constant factor
  • 0.0001525: BTC per flex miner factor
  • flex_miner: Number of 4NK flex miners (2kW each)

6.3 Bitcoin Value

Bitcoin_value (€) = Bitcoin_quantity (BTC) × Bitcoin_price (€/BTC)

Parameter: Bitcoin_price = 100,000 €/BTC

7. Material Output Calculations

7.1 Water Output

Water_output (t/day) = Water_input (t/day) - Water_consumed_in_processes (t/day) + Water_from_spirulina (t/day)

Water Input:

Water_input (t/day) = Waste_quantity (t/day) × Water_percentage (%)
Water_input = 67T × 75% = 50.25T water per module per day

7.2 Fertilizer Production

Fertilizer_output (t/day) = Composting_output (t/day) × Fertilizer_yield_factor

Parameter: Fertilizer_yield_factor: 1.0 (100% - all compost becomes standardized fertilizer)

8. Valorization Calculations

8.1 Waste Treatment Valorization

Waste_treatment_valorization (€/year) = Waste_quantity (t/year) × 100 €/t

Parameter: 100 €/t

8.2 Fertilizer Valorization

Fertilizer_valorization (€/year) = Fertilizer_quantity (t/year) × 215 €/t

Parameter: 215 €/t

8.3 Heat Valorization

Heat_valorization (€/year) = Heat_quantity (t/year) × 0.12 €/t

Parameter: 0.12 €/t

8.4 Carbon Equivalent - Burned Methane (CH₄)

CH4_carbon_valorization (€/year) = CH4_quantity (tCO₂e/year) × 172 €/tCO₂e

Parameters:

  • 630 €/tC ≈ 172 €/tCO₂e
  • Conversion: 1 tC = 3.67 tCO₂e
  • Formula: 172 = 630 / 3.67

8.5 Carbon Equivalent - Sequestered CO₂

CO2_carbon_valorization (€/year) = CO2_sequestered (tCO₂e/year) × 27 €/tCO₂e

Parameters:

  • 100 €/tC ≈ 27 €/tCO₂e
  • Conversion: 1 tC = 3.67 tCO₂e
  • Formula: 27 = 100 / 3.67

8.6 Carbon Equivalent - Avoided Electricity Consumption

Energy_carbon_valorization (€/year) = Electricity_avoided (kW/year) × 0.12 €/kW

Parameter: 0.12 €/kW

8.7 Land Valorization (Brownfield)

Land_valorization (€) = Brownfield_area (m²) × Valorization_rate (€/m²)

Parameter: 4000 m² brownfield (valorization rate configurable)

9. Financial Calculations

9.1 Total Revenues

Total_Revenues (€/year) = Sum of all revenue items:
  - Raw_rental
  - Biological_waste_treatment_service
  - Bitcoin_management_service
  - Provision_of_standardized_fertilizers_service
  - Provision_of_waste_heat_service
  - Provision_of_carbon_credit_indices_service
  - Brownfield_redevelopment_service
  - Transport_service
  - Commercial_partnerships
  - Other_revenues

9.2 Total Variable Costs

Total_Variable_Costs (€/year) = Sum of all variable cost items:
  - Rental_and_services
  - Commissions_intermediaries_import
  - Other_variable_costs
  - Transport

9.3 Gross Margin

Gross_Margin (€/year) = Total_Revenues (€/year) - Total_Variable_Costs (€/year)

9.4 Total Fixed Costs (OPEX)

Total_Fixed_Costs (€/year) = Sum of all fixed cost items:
  - Salaries_and_social_charges
  - Marketing_communication_expenses
  - R&D_product_development
  - Administrative_legal_fees
  - Other_general_expenses

9.5 Operating Result (EBITDA)

EBITDA (€/year) = Gross_Margin (€/year) - Total_Fixed_Costs (€/year)

9.6 Cash Flow

Cash_Flow (€/year) = EBITDA (€/year) - Non_cash_adjustments (€/year) - Working_capital_changes (€/year)

9.7 Total Investments (CAPEX)

Total_Investments (€) = Sum of all investment items:
  - Equipment_machinery
  - Technology_development
  - Patents_IP

9.8 Funding Need

Funding_Need (€) = Total_Investments (€) - Available_Cash (€) - Cash_Flow (€)

9.9 Use of Raised Funds

Total_Use_of_Funds (€) = Sum of all fund utilization items:
  - Product_development_POC_MVP
  - Marketing_customer_acquisition
  - Team_strengthening_recruitment
  - Structure_administrative_fees

10. Key Performance Indicators (KPIs)

10.1 Customer Acquisition Cost (CAC)

CAC (€) = Marketing_Costs (€) / Number_of_New_Customers

10.2 Lifetime Value (LTV)

LTV (€) = Average_Revenue_per_Customer (€) × Average_Customer_Lifespan (years)

10.3 Break-even Point

Break_even_days = Fixed_Costs (€) / (Daily_Revenue (€/day) - Daily_Variable_Costs (€/day))

10.4 Break-even Point (Alternative)

Break_even_days = Fixed_Costs (€) / Daily_Gross_Margin (€/day)

11. Service Pricing Calculations

11.1 Service Pricing per Module per Year

Service_price_per_module_per_year (€) = Base_price (€) × Module_multiplier

11.2 Service Pricing over 10 Years

Service_price_10_years (€) = Service_price_per_module_per_year (€) × Number_of_modules × 10

11.3 First Year Prototype Pricing

First_year_price (€) = Service_price_per_module_per_year (€) × Prototype_discount_factor

Parameter: Prototype_discount_factor: Typically 0.5-0.8 (50-80% of standard price)

12. Conversion Factors

12.1 Energy Conversions

1 kW.h = 3600 kJ
1 kJ = 1/3600 kW.h

12.2 Carbon Conversions

1 tC (tonne of carbon) = 3.67 tCO₂e (tonnes of CO₂ equivalent)
1 tCO₂e = 1/3.67 tC ≈ 0.272 tC

12.3 Time Conversions

1 day = 24 hours
1 year = 365 days (or 366 for leap years)

12.4 Mass Conversions

1 tonne (t) = 1000 kg
1 kg = 0.001 t

13. Processing Efficiency Factors

13.1 Anaerobic Digestion Efficiency

Methane_efficiency = Actual_methane_production / Theoretical_methane_production

Typical range: 0.70 - 0.90 (70-90%)

13.2 Electrical Conversion Efficiency

Electrical_efficiency = Electrical_power_output / Energy_input

Typical range: 0.35 - 0.45 (35-45% for CHP systems)

13.3 Solar Panel Efficiency

Solar_panel_efficiency = Electrical_power_output / (Solar_irradiance × Panel_area)

Typical range: 0.15 - 0.22 (15-22%)

14. Water Balance Calculations

14.1 Water Input from Waste

Water_input (t/day) = Waste_quantity (t/day) × Water_percentage (%)

14.2 Water Consumption in Processes

Water_consumption (t/day) = Sum of water used in:
  - Mesophilic_digestion
  - Drying_process (evaporation)
  - Bioremediation
  - Thermophilic_digestion
  - Composting
  - Water wall cooling (evaporation)

14.3 Water from Spirulina Cycle

Spirulina_cycle_duration = 21 days
Spirulina_cycles_per_day = 1 / 21 = 0.0476 cycles/day

Water_from_spirulina (t/day) = Spirulina_cycle_water_output (t/cycle) × Spirulina_cycles_per_day

Spirulina Cycle Management:

  • Spirulina culture: 21 days cycle
  • After 21 days: Water returns to thermophilic anaerobic digestion
  • Water output from spirulina: Depends on culture volume and evaporation

14.4 Water Evaporation

Water_evaporation (t/day) = Water_wall_surface (m²) × Evaporation_rate (m/day) × Water_density (t/m³)

Parameters:

  • Evaporation_rate: Depends on temperature, humidity, wind (typically 0.001-0.01 m/day)
  • Water_density: 1 t/m³

14.5 Net Water Output

Net_water_output (t/day) = Water_input (t/day) - Water_consumption (t/day) - Water_evaporation (t/day) + Water_from_spirulina (t/day)

15. Module and Container Calculations

15.1 Modules per Year

Modules_per_year = Total_modules / Project_duration (years)

15.2 Containers per Module

Containers_per_module = 4 (fixed: mesophilic, drying/bioremediation, thermophilic/composting, water/spirulina)

15.3 Total Container Capacity

Total_container_capacity = Number_of_modules × Containers_per_module × Container_capacity

Notes on Formula Display

All formulas must be displayed with:

  • Monospace font (JetBrains Mono, Fira Code, or Courier New)
  • Clear variable names with units
  • Parameter values shown explicitly
  • Calculation steps when applicable
  • Input values used in the calculation
  • Result with appropriate units

Formula Validation Rules

  • All input values must be positive (where applicable)
  • Division by zero must be prevented
  • Unit conversions must be consistent
  • Efficiency factors must be between 0 and 1
  • Percentages must be between 0 and 100
  • Time values must be positive
  • Mass/volume values must be positive