Skip to content

Commit

Permalink
fix autoplacer bug; test update to 100 nodes base case; make-pretty
Browse files Browse the repository at this point in the history
  • Loading branch information
EskoDijk committed Oct 8, 2024
1 parent 98f4257 commit 8d595c0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion ot-rfsim/script/build
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down
7 changes: 4 additions & 3 deletions pylibs/case_studies/large_diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
13 changes: 5 additions & 8 deletions simulation/node_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8d595c0

Please sign in to comment.