Protein Calculator with Earth as the Organism
- travisrcstone1984
- Jul 26
- 1 min read
Input Data: Protein, Amount
#cepp:APCEA, EOCP
#by: Travis RC Stone
# Constants
TARGET_PROTEIN_GRAMS = 50
GRAMS_PER_KG = 1000
# Input Structure for each protein source
ProteinSource = {
"name": str,
"daily_protein_output_kg": float,
"daily_feed_input_kg": float,
"daily_water_input_liters": float,
"daily_waste_output_kg": float
}
def evaluate_protein_source(source: ProteinSource):
# Normalize to target protein unit (e.g. 50g)
protein_yield_g = source["daily_protein_output_kg"] * GRAMS_PER_KG
if protein_yield_g == 0:
return None # avoid divide-by-zero error
# Scaling factor to reach TARGET_PROTEIN_GRAMS
scale_factor = TARGET_PROTEIN_GRAMS / protein_yield_g
# Normalize resource input/output per 50g protein
feed_per_50g = source["daily_feed_input_kg"] * scale_factor
water_per_50g = source["daily_water_input_liters"] * scale_factor
waste_per_50g = source["daily_waste_output_kg"] * scale_factor
# Return abstracted cost vector
return {
"source": source["name"],
"protein_output_g": protein_yield_g,
"scale_factor_to_50g": scale_factor,
"normalized_feed_kg": round(feed_per_50g, 4),
"normalized_water_liters": round(water_per_50g, 4),
"normalized_waste_kg": round(waste_per_50g, 4)
}USER INTERFACE
PUBLICATION :
Stone, T. R.-C. (2025, July 26). Earth as an Organism Calculated by Protein: EOCP. Zenodo. https://doi.org/10.5281/zenodo.16454094



Comments