Inspecting IntermediateStates, DifferentialStates and Expressions
In writing your model with ACADO's IntermediateStates and DifferentialStates, you are actually producing Expression trees. Several options are available to inspect these trees.
- Exporting to a C function:
Simply flush your Expression to a Function and flush this function into a File:
DifferentialState x,y; IntermediateState X=(some difficult expression involving x and y); Function f; f << X; FILE *file = fopen("debug.cpp", "w" ); file << f; flcose(file);The 2 DifferentialStates in the generated C code are visible as x[0] and x[1] by default. If the DifferentialStates were declared with a name, they would appear with this name in the generated C code:DifferentialState x("x"),y("y"); - Using a Stream:
Introduce a Stream object to flush to stdout:
DifferentialState x,y; IntermediateState X=(some difficult expression involving x and y); Stream s; s << X;