[bdsim BUG] When block is completely discrete, no integrator reference should be used
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 267
- Forks
- 39
- Avg merge
- 11d 18h
- Merged PRs (30d)
- 6
Description
bdsim version 1.1.2
Describe the bug
Error:
File ".../lib/python3.10/site-packages/bdsim/run_sim.py", line 918, in run_interval
out = b.output(integrator.t, b.inputs, b._x)[p.port]
UnboundLocalError: local variable 'integrator' referenced before assignment
To Reproduce
Any block diagram with only discrete blocks
Expected behavior
Simulation runs smoothly
Operating environment (please complete the following information):
- OS: Ubuntu 22.04
Suggestion:
instead
out = b.output(integrator.t, b.inputs, b._x)[p.port]
use
out = b.output(t, b.inputs, b._x)[p.port]
as integrator is not defined here
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at lib/python3.10/site-packages/bdsim/run_sim.py around line 918 and inspect how run_interval handles diagrams containing only discrete blocks. Reproduce the issue with an all-discrete block diagram, then verify the output call uses the available simulation time and that the simulation completes without the UnboundLocalError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100