code wiki / (root) / nx_market_rt.nx

nx_market_rt.nx source

↩ module page · 89 lines · 3868 B

1// nx_market.nx -- GO-TO-MARKET / UNIT ECONOMICS. Engineering-ready + 2// buildable + provable is not the same as SELLABLE. This closes the 3// business side: the bench prototype's BOM cost -> production cost at volume 4// (Wright's-law learning curve) -> price for a target margin -> gross margin 5// -> break-even volume, and the customer's PAYBACK vs the alternative (for a 6// water system, vs buying bottled water). Composes nx_bom. 7// 8// INTEGER-EXACT, money in cents. Wright's law: unit cost falls by a fixed 9// fraction per DOUBLING of cumulative volume (learning_pct=85 -> 15% cheape 10// each doubling, a standard electronics-assembly rate). Inputs are planning 11// estimates grounded in standard benchmarks (refine with real quotes later); 12// the framework is exact. 13// 14// THE exceed: the go-to-market decision is COMPUTED -- margin, break-even, 15// and customer ROI from the real BOM -- not guessed. A product is viable 16// only if it clears a healthy margin AND pays the customer back within a year. 17// 18// grounded: wrights_law_experience_curve + gross_margin + break_even_analysis 19// + unit_economics 20// genealogy_id: unit_economics_go_to_market + nishi_market 21 22import "nx_syscalls.nx" 23import "nx_bom_rt.nx" 24 25const MK_MIN_MARGIN_PCT: i64 = 40 // healthy hardware gross margin 26const MK_MAX_PAYBACK_DAYS: i64 = 365 // customer ROI within a yea 27 28// Production unit cost = a fraction of the one-off prototype cost (bulk 29// component pricing + efficient assembly cut the retail one-off). 30func mk_production_unit_cost(prototype_cents: i64, prod_fraction_pct: i64) -> i64 { 31 return prototype_cents * prod_fraction_pct / 100 32} 33 34// Wright's law: cost after `doublings` doublings of cumulative volume. 35func mk_learning_cost(unit1_cents: i64, learning_pct: i64, doublings: i64) -> i64 { 36 var c: i64 = unit1_cents 37 var k: i64 = 0 38 while k < doublings { 39 c = c * learning_pct / 100 40 k = k + 1 41 } 42 return c 43} 44 45// Price to achieve a target gross margin: price = COGS / (1 - margin). 46func mk_price_for_margin(cogs_cents: i64, margin_pct: i64) -> i64 { 47 if margin_pct >= 100 { return 0 } 48 return cogs_cents * 100 / (100 - margin_pct) 49} 50 51// Gross margin percent at a given price and COGS. 52func mk_gross_margin_pct(price_cents: i64, cogs_cents: i64) -> i64 { 53 if price_cents <= 0 { return 0 } 54 return (price_cents - cogs_cents) * 100 / price_cents 55} 56 57// Break-even units = ceil(fixed_costs / contribution), contribution = price - variable. 58func mk_break_even_units(fixed_cents: i64, price_cents: i64, variable_cents: i64) -> i64 { 59 let contribution: i64 = price_cents - variable_cents 60 if contribution <= 0 { return 0 - 1 } 61 return (fixed_cents + contribution - 1) / contribution 62} 63 64// Customer daily savings (cents) = consumption x (alternative - our cost) per litre. 65func mk_daily_savings_cents(consumption_l: i64, alt_per_l_cents: i64, our_per_l_cents: i64) -> i64 { 66 let per_l: i64 = alt_per_l_cents - our_per_l_cents 67 if per_l <= 0 { return 0 } 68 return consumption_l * per_l 69} 70 71// Customer payback in days for a unit price against daily savings. 72func mk_payback_days(unit_price_cents: i64, daily_savings_cents: i64) -> i64 { 73 if daily_savings_cents <= 0 { return 0 - 1 } 74 return unit_price_cents / daily_savings_cents 75} 76 77// Go-to-market viable iff a healthy margin AND a customer payback within a year. 78func mk_viable(margin_pct: i64, payback_days: i64) -> i64 { 79 if margin_pct < MK_MIN_MARGIN_PCT { return 0 } 80 if payback_days < 0 { return 0 } 81 if payback_days > MK_MAX_PAYBACK_DAYS { return 0 } 82 return 1 83} 84 85// Compose the real BOM: production unit cost of the water AWG at a bulk fraction. 86func mk_water_production_cost(prod_fraction_pct: i64) -> i64 { 87 let b: *NxBom = nx_bom_water_assemble() 88 return mk_production_unit_cost(b.total_cost_cents, prod_fraction_pct) 89}