nx_maint_business.nx source
↩ module page · 97 lines · 4221 B
1// nx_maint_business.nx -- prove the BUSINESS in modeling (no IRL spend). Converts
2// the closed-loop simulator's MEASURED failure reduction into unit economics:
3// customer value (avoided-failure cost vs subscription), customer ROI, and
4// business margin/profit -- so the whole business is provable in software before
5// investing a penny.
6//
7// Operator (2026-06-23): "without having to invest a penny irl till its proven
8// via all modeling of the business, legal, sensors, hardware." This is the
9// BUSINESS model layer; it consumes nx_maint_simloop's result (closed-loop ~6x
10// fewer failures: 2 vs 13 / 20 cycles) as the failure-reduction input.
11//
12// Money in CENTS (integer/no-float). Verdict = is it a sustainable win-win
13// (customer saves AND business profits)? -- the go/no-go on IRL investment.
14//
15// NEVER-BRICK (#26): pure arithmetic; no syscalls, no writes.
16//
17// genealogy_id: project-maintenance-platform-sclass-2026-06-23 (business-model layer)
18// license_tier: ORIGINAL
19
20const NX_BIZ_INVALID: i64 = 0
21const NX_BIZ_VIABLE: i64 = 1 // customer saves AND business profits
22const NX_BIZ_CUSTOMER_NEGATIVE: i64 = 2 // business profits but customer doesn't save (unsustainable)
23const NX_BIZ_BUSINESS_NEGATIVE: i64 = 3 // customer saves but business loses (unsustainable)
24const NX_BIZ_BOTH_NEGATIVE: i64 = 4
25const NX_BIZ_BAD_ARG: i64 = 5
26const NX_BIZ_N: i64 = 6
27
28func nx_biz_verdict_is_valid(v: i64) -> i64 {
29 if v < 0 { return 0 }
30 if v >= NX_BIZ_N { return 0 }
31 return 1
32}
33
34struct BizParams {
35 avg_failure_cost_cents: i64, // cost of one unaddressed failure
36 failures_reactive_per_100: i64, // failures / 100 asset-years WITHOUT the platform (open loop)
37 failures_proactive_per_100: i64, // failures / 100 asset-years WITH the platform (closed loop)
38 subscription_cents_yr: i64, // what the customer pays us / asset-year
39 platform_cost_cents_yr: i64, // our sovereign cost to monitor / asset-year
40 n_assets: i64,
41}
42
43struct BizResult {
44 avoided_cost_cents: i64, // per asset-year (the customer value created)
45 customer_savings_cents: i64, // per asset-year (avoided cost - subscription)
46 customer_roi_x100: i64, // avoided cost / subscription, x100
47 business_margin_cents: i64, // per asset-year (subscription - platform cost)
48 business_profit_cents_yr: i64, // total = margin * n_assets
49 verdict: i64,
50}
51
52func nx_biz_model(p: *BizParams, out: *BizResult) -> i64 {
53 out.avoided_cost_cents = 0
54 out.customer_savings_cents = 0
55 out.customer_roi_x100 = 0
56 out.business_margin_cents = 0
57 out.business_profit_cents_yr = 0
58 out.verdict = NX_BIZ_INVALID
59
60 if p.subscription_cents_yr <= 0 {
61 out.verdict = NX_BIZ_BAD_ARG
62 return out.verdict
63 }
64 if p.avg_failure_cost_cents < 0 {
65 out.verdict = NX_BIZ_BAD_ARG
66 return out.verdict
67 }
68 // the platform must REDUCE failures (proactive <= reactive), else the input is wrong
69 if p.failures_proactive_per_100 > p.failures_reactive_per_100 {
70 out.verdict = NX_BIZ_BAD_ARG
71 return out.verdict
72 }
73
74 let avoided_failures: i64 = p.failures_reactive_per_100 - p.failures_proactive_per_100
75 out.avoided_cost_cents = (avoided_failures * p.avg_failure_cost_cents) / 100
76 out.customer_savings_cents = out.avoided_cost_cents - p.subscription_cents_yr
77 out.customer_roi_x100 = (out.avoided_cost_cents * 100) / p.subscription_cents_yr
78 out.business_margin_cents = p.subscription_cents_yr - p.platform_cost_cents_yr
79 out.business_profit_cents_yr = out.business_margin_cents * p.n_assets
80
81 var cust_ok: i64 = 0
82 if out.customer_savings_cents > 0 { cust_ok = 1 }
83 var biz_ok: i64 = 0
84 if out.business_margin_cents > 0 { biz_ok = 1 }
85
86 if cust_ok == 1 {
87 if biz_ok == 1 { out.verdict = NX_BIZ_VIABLE; return out.verdict }
88 out.verdict = NX_BIZ_BUSINESS_NEGATIVE
89 return out.verdict
90 }
91 if biz_ok == 1 {
92 out.verdict = NX_BIZ_CUSTOMER_NEGATIVE
93 return out.verdict
94 }
95 out.verdict = NX_BIZ_BOTH_NEGATIVE
96 return out.verdict
97}