1

So, I am trying to linearize my simple Symbolic System which has a nonlinear output equation and a linear state equation.

I am trying to figure out how to change the nominal value of my input, u. Aka, I want to set u0. I have figured out how to set the nominal value of the state vector, I think, below.

c_e = Variable('c_e')
c_2 = Variable('c_2')
u   = Variable('u')

x = [c_e, c_2]

sys = SymbolicVectorSystem(state = x, input = [u], dynamics = f(x, u), output = g(x))

context = sys.CreateDefaultContext()
context.get_continuous_state_vector().SetAtIndex(0, 10**-6)
linear_sys = Linearize(sys, context)

I am currently getting the error that my input port is not connected, but I am not sure what this means. What should I do to fix this error, and set my nominal point?

RuntimeError: InputPort::Eval(): required InputPort[0] (u0) of System ::_ (SymbolicVectorSystem<double>) is not connected

1 Answers1

1

The error message is pointing you in the right direction. To linearize a system with state and inputs, you need to specify not only the nominal state (x0) but also the nominal input (u0). You need to set both in the context.

You’ve set the nominal state, but need a line like

context.FixInputPort(0, [0])

to specify the nominal input.

(The particular error message was due to the linearization method calling the dynamics of your system, which needs to evaluate the input port... and failed)

Russ Tedrake
  • 4,703
  • 1
  • 7
  • 10
  • Okay, awesome. I was implementing FixInputPort, but not putting in the correct number of arguments. I am getting better at reading the documentation, but am not quite there yet. Thank you for answering these small things. It helps a lot. :} – Taylor Baum May 01 '20 at 00:52