masfaraud / BMSpy

Python Block-Model Simulator. An alternative to simulink in python.
GNU Lesser General Public License v3.0
222 stars 36 forks source link

IndexError in "VariablesValues" method #31

Closed ordonezt closed 4 years ago

ordonezt commented 4 years ago

te = 10 ns = 500

R = Step(('In', 'R')) Y = bms.Variable(('Out', 'Y'))

G = Gain(R, Y, 1)

system = bms.DynamicSystem(te, ns, [G]) simulation = system.Simulate() system.VariablesValues(Y, t=1)



* **What is the expected behavior?**
>>> 1 (Print a number)

* **What is the motivation / use case for changing the behavior?**
The function dont work

* **Possible fixes**
cast "i" variable in line 505 and 510 like "int(i)"

`variables.values[int(i)]*((ti-t)/self.ts+1)+variables.values[i+1]*(t-ti)/self.ts)`

* **Please tell us about your environment:**

  - branch: master
  - commit:  245d56c
  - python version: Python 3.7.7
masfaraud commented 4 years ago

Should be corrected by 8830a674184560d56ddceef707b26459e9bfcc7f Can you confirm?

ordonezt commented 4 years ago

Yes! Great!