Open
Conversation
It was possible to use different instances of Config with different values. Just make a single instance in the config module and have users import that.
Since SLOT_TIME depends on the current preset, which may change at runtime (although it shouldn't), make a function for this rather than using a pre-computed variable which may get stale if the preset changes. Other parts of phy.py call current_preset which allows for this dynamic behavior, so adapt SLOT_TIME to match, even though the preset really shouldn't change mid-sim.
This replicates the simulation that executing `loraMesh.py 10` would do, asserting that we arrive at the expected results. This test may be relatively fragile, but IMO is important for detecting when a change influences simulation results. This should help catch any bugs or other unintentional changes that could impact simulation consistency. But there will certainly be sim improvements that warrant changing the "known good" reference simulation results.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Not as significant as I want, but a good chunk of work to check in. Instead of generating new Config objects in different modules, just use a single Config object created in the lib.config module. This should avoid issues where different modules can operate using different configurations. Later on I'd like to do more refactoring, like reorganizing the config and using more properties so it's less of a giant flat collection of mostly-static values that are directly referenced.
The biggest change is adding a large function test for the discrete simulation. I replicate the simulation that
loraMesh.pywould do for 10 nodes, as if executingloraMesh.py 10, and compare the results against a "known good" reference run. This is a bit complex and high-level for a unit test, but will be useful for easily checking if any particular change has an impact on the results generated by the simulation. This should help give confidence to make bigger changes that don't change simulation results.