From 8d595c0c08e5914498917a8335fcc8475e5c2837 Mon Sep 17 00:00:00 2001 From: Esko Dijk Date: Tue, 8 Oct 2024 10:21:22 +0200 Subject: [PATCH] fix autoplacer bug; test update to 100 nodes base case; make-pretty --- ot-rfsim/script/build | 2 +- pylibs/case_studies/large_diagnostics.py | 7 ++++--- simulation/node_config.go | 13 +++++-------- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/ot-rfsim/script/build b/ot-rfsim/script/build index dfaaf119..3593ecbb 100755 --- a/ot-rfsim/script/build +++ b/ot-rfsim/script/build @@ -29,7 +29,7 @@ set -euxo pipefail -# shellcheck source=../script/utils.sh +# shellcheck source=../../script/utils.sh . "$(dirname "$0")"/../../script/utils.sh OTRFSIM_SRCDIR="$(pwd)" diff --git a/pylibs/case_studies/large_diagnostics.py b/pylibs/case_studies/large_diagnostics.py index bddaadb5..b2eeb6ac 100755 --- a/pylibs/case_studies/large_diagnostics.py +++ b/pylibs/case_studies/large_diagnostics.py @@ -52,16 +52,17 @@ def main(): ns.go(10) ns.add("med", x=400, y=300) - for n in range(1, 60): + for n in range(1, 100): ns.add("med") - ns.go(1) + ns.go(0.2) ns.go(120) + ns.save("tmp/large_diagnostics.yaml") # try repeated TLV Type IDs #ns.node_cmd(n2, f'networkdiagnostic get ff02::d1a9 28 28 28 28 28 28 28 28 28 28 28 25 25 25 25 25 29 29 29 30') # try relatively large Child info TLVs - ns.node_cmd(n1, f'networkdiagnostic get ff02::d1a9 29 30') + ns.node_cmd(n1, f'networkdiagnostic get ff02::d1a9 29') # 30 # test - switch off radio just before receiving the rest of diagnostic answer msg. # To verify that the responding Thread device will then stop sending further Answer messages. diff --git a/simulation/node_config.go b/simulation/node_config.go index af115487..2e4bfad4 100644 --- a/simulation/node_config.go +++ b/simulation/node_config.go @@ -333,17 +333,14 @@ func (nap *NodeAutoPlacer) UpdateReference(x, y, z int) { // NextNodePosition lets the autoplacer pick the next position for a new node to be placed. func (nap *NodeAutoPlacer) NextNodePosition(isBelowParent bool) (int, int, int) { var x, y, z int + var fineCountCol, fineCountRow int if isBelowParent { - y = nap.Y + nap.NodeDeltaCoarse/2 - x = nap.X + nap.fineCount*nap.NodeDeltaFine - nap.NodeDeltaFine + fineCountCol = nap.fineCount % 16 + fineCountRow = nap.fineCount / 16 + y = nap.Y + nap.NodeDeltaCoarse/2*(fineCountRow+1) + x = nap.X + fineCountCol*nap.NodeDeltaFine - nap.NodeDeltaFine nap.fineCount++ - if nap.fineCount > 16 { - x = nap.X - y += nap.NodeDeltaCoarse / 2 - nap.Y += nap.NodeDeltaCoarse / 2 - nap.fineCount = 0 - } } else { if !nap.isReset { nap.X += nap.NodeDeltaCoarse