nx_arousal_lib.nx
buildroot/runtime/nx_arousal_lib.nx
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
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
| 12 | const A_MAGIC_999999: i64 = 999999 |
| 13 | const A_MAGIC_1131: i64 = 1131 |
| 14 | const A_MAGIC_2000: i64 = 2000 |
| 15 | const A_MAGIC_6000000: i64 = 6000000 |
| 16 | const A_MAGIC_24000000000: i64 = 24000000000 |
| 17 | const A_MAGIC_120000000000000: i64 = 120000000000000 |
| 18 | const A_MAGIC_1103515245: i64 = 1103515245 |
| 19 | const A_MAGIC_12345: i64 = 12345 |
| 21 | const A_DT_MS: i64 = 50 |
| 22 | const A_MAXSTEP: i64 = 60000 |
| 23 | const A_RESMAX: i64 = 1000000000 |
functions
| 25 | func 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 } |
| 26 | func a_putn(v: i64) -> i64 |
| 38 | func 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 |
| 39 | func a_atoi(s: *u8) -> i64 |
| 46 | func a_conf(buf: *u8, n: i64, key: *u8, dflt: i64) -> i64 |
| 59 | func a_abs(x: i64) -> i64 { if x < 0 { return 0 - x } return x } |
| 63 | func a_drive(stim: i64, ses: i64, sis1: i64, sis2: i64) -> i64 |
| 74 | func a_lag(cur: i64, target: i64, tau_ms: i64) -> i64 |
| 81 | func a_perf(t_ms: i64, drive: i64, tau_ms: i64) -> i64 |
| 90 | func a_temp(pslow: i64, base_mc: i64, span_mc: i64) -> i64 { return base_mc + (span_mc * pslow) / 1000 } called by 1: main |
| 91 | func a_hr(drive: i64, base: i64, span: i64) -> i64 { return base + (span * drive) / 1000 } called by 1: main |
| 92 | func a_rr(drive: i64, base: i64, span: i64) -> i64 { return base + (span * drive) / 1000 } called by 1: main |
| 94 | func a_bp(drive: i64, base: i64, span: i64, plateau: i64) -> i64 called by 1: main |
| 101 | func a_subj(pslow: i64, coup: i64) -> i64 { return (pslow * coup) / 1000 } called by 1: main |
| 102 | func a_flush(pslow: i64, thresh: i64, propensity: i64) -> i64 |
| 119 | func a_rigidity(tume: i64, thresh: i64) -> i64 |
| 124 | func a_rigidity_tip(rig: i64, tipfac: i64) -> i64 { return (rig * tipfac) / 1000 } |
| 129 | func a_refractory(t_since_ms: i64, tau_refr_ms: i64) -> i64 |
| 139 | func a_nipple_erect(t_ms: i64, drive: i64, tau_nip: i64) -> i64 calls 1: a_perf |
| 144 | func a_areola_engorge(pslow: i64) -> i64 { return pslow } called by 1: main |
| 149 | func a_nipple_apparent(erect: i64, engorge: i64, mask: i64) -> i64 called by 1: main |
| 156 | func a_interval(n: i64, c0: i64, slope: i64) -> i64 { return c0 + slope * n } called by 1: main |
| 157 | func a_amp(n: i64, total: i64) -> i64 called by 1: main |
| 167 | func a_ctoct(v: i64, peak: i64) -> i64 called by 1: a_ct |
| 180 | func a_ct(v: i64, peak: i64) -> i64 |
| 188 | func a_pint(buf: *u8, n: i64, p: *i64) -> i64 |
| 205 | func a_skipnd(buf: *u8, n: i64, p: *i64) -> i64 |
| 221 | func a_exp_frac(r: i64) -> i64 called by 1: a_exp_neg |
| 236 | func a_exp_neg(a: i64) -> i64 |
| 254 | func a_lcg(s: i64) -> i64 { return ((s * A_MAGIC_1103515245) + A_MAGIC_12345) & 0x7FFFFFFF } called by 1: main |
| 256 | func a_series_count(buf: *u8, n: i64) -> i64 |
| 278 | func a_series_residual(buf: *u8, n: i64, tau: i64, drive: i64) -> i64 |
| 323 | func a_residual(tau: i64, drive: i64, t1: i64, o1: i64, t2: i64, o2: i64) -> i64 |