mirror of https://github.com/meshcore-dev/MeshCore
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
4.6 KiB
4.6 KiB
Simulation Harness Changelog
[Unreleased] — Adaptive Routing + TX Power Saving
Added
Core Infrastructure
SimRadio.h: Addedtx_power_dbmfield (public, default 20 dBm). ExtendedTxCallbacksignature to carrytx_power_dbmthrough to the bus. Existing capture-effect collision model (6 dB threshold) unchanged.SimBus.h:InFlightPacketnow carriestx_power_dbm.deliverPending()appliesreceived_snr += (tx_power_dbm - 20.0)at each receiver — lower TX power shrinks effective SNR without touching the channel model. Added_tsnode_to_seqcompound-key map(src_pub_key[0..3] << 32 | advert_ts)for concurrent-flood tracking; prevents false metric attribution when two senders fire in the same simulated second.DensityEstimator.h(new): Passive sliding-window neighbour density estimator. Counts unique direct senders (hop_count==1) over a 60 s window. Returns SPARSE / MEDIUM / DENSE tier. No protocol messages required. Usesstd::unordered_set<uint32_t>(no fixed cap).RoutingStrategies.h: AddedADAPTIVEto theRoutingStrategyenum. AddedadaptiveRelayPct(),adaptiveDelay(),hashBasedRelay()helpers alongside existingsnrWeightedDelay()andpathSnrHybridDelay().SimNode.h: Addedrouting_strategyfield (defaultDEFAULT). AddedDensityEstimator densitymember fed fromlogRx(). Added power-save fields (power_save_enabled,power_save_dense_dbm,power_save_medium_dbm,full_power_dbm). Added battery energy tracking (total_tx_energy_mah,total_rx_energy_mah,total_rx_time_ms,total_suppressed). Addedstatic float txCurrentMa(float dbm)and constantsRX_CURRENT_MA,IDLE_CURRENT_MAmatching SX1262 datasheet.scenario_adaptive.cpp: Validates ADAPTIVE vs DEFAULT vs PATH_SNR_HYBRID across FullMesh 50, Chain 20, Grid 5×5 at multiple SNR levels. Confirms ADAPTIVE reduces airtime ≈ 65% at equivalent delivery rate.scenario_concurrent.cpp: Tests 2–8 simultaneous flood sources. Confirms ADAPTIVE maintains delivery advantage in grid topologies under concurrent load; documents known limitation in adversarial full-mesh simultaneous-TX edge case.scenario_longchain.cpp: Tests 20-hop linear chains at marginal SNR. Confirms ADAPTIVE stays at SPARSE tier throughout and behaves identically to DEFAULT on chains.scenario_mixed.cpp: Tests ADAPTIVE nodes coexisting with DEFAULT (legacy) nodes. Confirms full interoperability with no delivery regression.scenario_dutycycle.cpp: Tests EU 1% duty cycle enforcement (getAirtimeBudgetFactor()). Confirms ADAPTIVE requires ≈ 40% fewer TX budget slots than DEFAULT.scenario_relay_pct_sweep.cpp: Grid sweep of DENSE% × MEDIUM% relay percentages across FM50, FM100, Chain20, Grid5×5. Identifies optimal operating point (DENSE=15%, MEDIUM=25%). Outputs CSV + ranked table.scenario_txpower.cpp(new): Tests adaptive TX power reduction at CONSERV / MODERATE / AGGRESSIVE levels across FM50, DC6x6 dense positional cluster, and CH20 chain. Measures delivery rate, latency, and per-node energy consumption. Includes 48-hour festival weekend battery projection.ADAPTIVE_ROUTING.md(new): Full design rationale, configuration reference, and empirical results.
Fixed
DensityEstimator: Replaced fixedseen[64]array withstd::unordered_set<uint32_t>— eliminated silent 64-neighbour cap that could misclassify dense networks as MEDIUM.SimBus::onTransmit: Addedif (len > 255) len = 255bounds guard beforememcpyinto 255-byteInFlightPacketbuffer.SimNode::getRetransmitDelay: Fixed redundant TX power reset condition (!power_save_enabled || strategy != ADAPTIVE→strategy != ADAPTIVE).SimNode::getRetransmitDelay: Fixed p_forward gate floating-point edge:>=→>sop_forward=1.0never silently drops a relay.scenario_concurrent.cpp: Fixed stale pointerConcurrentResult* def_base = &group.back()(invalidated by subsequentpush_back) — replaced with value copy +bool have_defflag.scenario_relay_pct_sweep.cpp: UpdatedaddSweepNodeTxCallback from 4-arg to 5-arg to match updatedSimRadiosignature. Updatedon_recvlambda to use_tsnode_to_seqcompound key instead of old_ts_to_seq.scenario_adaptive.cpp: Removed unused variablelast_suppressed.
Changed
SimBusprotected members promoted fromprivate:toprotected:to allowSweepBussubclass access inscenario_relay_pct_sweep.cpp.adaptiveRelayPct(): DENSE raised 10% → 15%, MEDIUM raised 20% → 25% — improves resilience under concurrent multi-source floods without increasing airtime in the single-source case.