code wiki / (root) / nx_arousal_lib.nx

nx_arousal_lib.nx

buildroot/runtime/nx_arousal_lib.nx

14817 B330 linesdepth 2pulls 2 transitivereach 9 importersview sourcekind librarytopic arousal
docsdependenciesstructsconstsfunctions

about

nx_arousal_lib.nx -- pure physiological-arousal math core. NO main(): this is the shared substrate for nx_arousal (simulate) and nx_arousal_fit (fit). Extracted so the two CLIs cannot drift into duplicate twins -- the exact class nx_dupfunc measures (1838 product-only copies). Integer/fixed-point ONLY: time=ms, drive/perfusion/amp=permil, temp=millidegC, vel=cm/s*100. PROVENANCE (auditable, not trusted): Kukkonen 2007 thermography 32.1C -> 33.89C | Chivers 2010 concordance r=.66 M / .26 W Masters&Johnson systolic peaks at PLATEAU onset | Bohlen 1982 contraction chirp +0.1s Loken 2009 C-tactile log-tuned, peak 3 cm/s | Bancroft&Janssen dual control SES/SIS1/SIS2 license_tier: ORIGINAL

dependencies 1 imports · 5 importers

nx_syscalls.nx nx_arousal_lib.nx nx_arousal.nx nx_arousal_clinical.nx nx_arousal_fit.nx nx_arousal_profile.nx nx_arousal_skin_lib.nx

imports: nx_syscalls.nx

imported by: nx_arousal.nxnx_arousal_clinical.nxnx_arousal_fit.nxnx_arousal_profile.nxnx_arousal_skin_lib.nx

structs

none

consts

12const A_MAGIC_999999: i64 = 999999
13const A_MAGIC_1131: i64 = 1131
14const A_MAGIC_2000: i64 = 2000
15const A_MAGIC_6000000: i64 = 6000000
16const A_MAGIC_24000000000: i64 = 24000000000
17const A_MAGIC_120000000000000: i64 = 120000000000000
18const A_MAGIC_1103515245: i64 = 1103515245
19const A_MAGIC_12345: i64 = 12345
21const A_DT_MS: i64 = 50
22const A_MAXSTEP: i64 = 60000
23const A_RESMAX: i64 = 1000000000

functions

25func a_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 4: mainmainmainmain calls 1: sys_write
26func a_putn(v: i64) -> i64
38func a_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: a_conf
39func a_atoi(s: *u8) -> i64
46func a_conf(buf: *u8, n: i64, key: *u8, dflt: i64) -> i64
59func a_abs(x: i64) -> i64 { if x < 0 { return 0 - x } return x }
63func a_drive(stim: i64, ses: i64, sis1: i64, sis2: i64) -> i64
called by 2: mainmain
74func a_lag(cur: i64, target: i64, tau_ms: i64) -> i64
81func a_perf(t_ms: i64, drive: i64, tau_ms: i64) -> i64
90func a_temp(pslow: i64, base_mc: i64, span_mc: i64) -> i64 { return base_mc + (span_mc * pslow) / 1000 }
called by 1: main
91func a_hr(drive: i64, base: i64, span: i64) -> i64 { return base + (span * drive) / 1000 }
called by 1: main
92func a_rr(drive: i64, base: i64, span: i64) -> i64 { return base + (span * drive) / 1000 }
called by 1: main
94func a_bp(drive: i64, base: i64, span: i64, plateau: i64) -> i64
called by 1: main
101func a_subj(pslow: i64, coup: i64) -> i64 { return (pslow * coup) / 1000 }
called by 1: main
102func a_flush(pslow: i64, thresh: i64, propensity: i64) -> i64
119func a_rigidity(tume: i64, thresh: i64) -> i64
called by 2: mainmain
124func a_rigidity_tip(rig: i64, tipfac: i64) -> i64 { return (rig * tipfac) / 1000 }
called by 2: mainmain
129func a_refractory(t_since_ms: i64, tau_refr_ms: i64) -> i64
called by 1: main calls 1: a_exp_neg
139func a_nipple_erect(t_ms: i64, drive: i64, tau_nip: i64) -> i64
calls 1: a_perf
144func a_areola_engorge(pslow: i64) -> i64 { return pslow }
called by 1: main
149func a_nipple_apparent(erect: i64, engorge: i64, mask: i64) -> i64
called by 1: main
156func a_interval(n: i64, c0: i64, slope: i64) -> i64 { return c0 + slope * n }
called by 1: main
157func a_amp(n: i64, total: i64) -> i64
called by 1: main
167func a_ctoct(v: i64, peak: i64) -> i64
called by 1: a_ct
180func a_ct(v: i64, peak: i64) -> i64
called by 1: main calls 1: a_ctoct
188func a_pint(buf: *u8, n: i64, p: *i64) -> i64
205func a_skipnd(buf: *u8, n: i64, p: *i64) -> i64
221func a_exp_frac(r: i64) -> i64
called by 1: a_exp_neg
236func a_exp_neg(a: i64) -> i64
called by 3: maina_refractorysk_refl calls 1: a_exp_frac
254func a_lcg(s: i64) -> i64 { return ((s * A_MAGIC_1103515245) + A_MAGIC_12345) & 0x7FFFFFFF }
called by 1: main
256func a_series_count(buf: *u8, n: i64) -> i64
278func a_series_residual(buf: *u8, n: i64, tau: i64, drive: i64) -> i64
323func a_residual(tau: i64, drive: i64, t1: i64, o1: i64, t2: i64, o2: i64) -> i64
called by 3: mainf_scanmain calls 2: a_perfa_abs