
The problem is that you are not specifying values for the control input “m.u” correctly. From the perspective of the Simulator, m.u is a time-varying input. Meaning its value needs to be specified before running the simulation and its value could vary over time (because m.u is indexed by m.t). See the online documentation for specifying time-varying inputs here: https://pyomo.readthedocs.io/en/latest/modeling_extensions/dae.html#specifying-time-varing-inputs
In your case, swap out lines 55 and 57 with the following:
m.var_input = Suffix(direction=Suffix.LOCAL)
m.var_input[m.u] = {0:1} # If you want u to be set to 0 over the whole simulation use {0:0} instead
sim = Simulator(m, package='scipy')
tsim, profiles = sim.simulate(numpoints=100, integrator='lsoda', varying_inputs=m.var_input)
--
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
pyomo-forum...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/pyomo-forum/2d7b68eb-27ba-43d1-a0b2-173ea15b2634n%40googlegroups.com.
Rune,
The Simulator interface to CasADi only supports simulation at this time. However, you could use the Simulator code as an example of how to convert your Pyomo model to a CasADi model (including the objective function and inequality constraints) and then use CasADi’s Python API to solve an optimal control problem.
Bethany
Best,
Tyler
--
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyomo-forum/2d7b68eb-27ba-43d1-a0b2-173ea15b2634n%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
pyomo-forum...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyomo-forum/5c2a18ba-e639-4653-af89-b1f936fe6c31n%40googlegroups.com.