-
I am trying to use a class method in a NonlinearIOSystem. To test, I adapted the predator-prey example such that the predprey_rhs function becomes a method in the new predprey class. Then, I create an instance of the predprey class (pp), and create the NonlinearIOSystem using the pp.predprey_rhs method. All good to that point. When I try to calculate the open-loop response with control.input_output_response, I get "TypeError: dynamics() takes 4 positional arguments but 5 were given". The method predprey_rhs has the self argument in its definition, so that shouldn't be a problem. Anyone have any ideas? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I figured it out. Apparently, "params" is required as an argument for the predprey_rhs method. Previously, I defined the parameters in init, and didn't include "params" as a predprey_rhs method. Once I added it back in, even though is wasn't used, the error went away. I still don't understand why it threw the TypeError, but no matter. |
Beta Was this translation helpful? Give feedback.
I figured it out. Apparently, "params" is required as an argument for the predprey_rhs method. Previously, I defined the parameters in init, and didn't include "params" as a predprey_rhs method. Once I added it back in, even though is wasn't used, the error went away. I still don't understand why it threw the TypeError, but no matter.