62 const double tau1 = 0.012790605943772;
63 const double a1 = 0.047418203070092;
64 const double tau2 = 0.024695192379264;
65 const double a2 = 0.034087337273386;
66 const double g = 9.81;
68 const double m = 1318.0;
74 aT = -1.0 / tau1 * vT + a1 / tau1 * uT;
75 aL = -1.0 / tau2 * vL + a2 / tau2 * uL;
77 f << 0 ==
dot( xT ) - vT;
78 f << 0 ==
dot( vT ) - aT;
79 f << 0 ==
dot( xL ) - vL;
80 f << 0 ==
dot( vL ) - aL;
81 f << 0 ==
dot( phi ) - omega;
82 f << 0 ==
dot( omega ) - 1.0/xL*(-g*
sin(phi)-aT*
cos(phi)
83 -2*vL*omega-c*omega/(m*xL));
84 f << 0 ==
dot( uT ) - duT;
85 f << 0 ==
dot( uL ) - duL;
99 cout <<
"-----------------------------------------\n Using an equidistant grid:\n-----------------------------------------\n";
110 sim.
exportAndRun(
"crane_export",
"init_crane.txt",
"controls_crane.txt" );
113 cout <<
"-----------------------------------------\n Using a provided grid:\n-----------------------------------------\n";
131 sim2.
exportAndRun(
"crane_export",
"init_crane.txt",
"controls_crane.txt" );
USING_NAMESPACE_ACADO int main()
USING_NAMESPACE_ACADO IntermediateState sin(const Expression &arg)
uint addOutput(const OutputFcn &outputEquation_, const DVector &measurements)
Allows to setup and evaluate output functions based on SymbolicExpressions.
#define USING_NAMESPACE_ACADO
virtual returnValue setTimingSteps(uint _timingSteps)
returnValue setModel(const DifferentialEquation &_f)
IntermediateState cos(const Expression &arg)
returnValue set(OptionsName name, int value)
User-interface to automatically generate simulation algorithms for fast optimal control.
virtual returnValue exportAndRun(const std::string &dirName, const std::string &initStates, const std::string &controls, const std::string &results=std::string("results.txt"), const std::string &ref=std::string("ref.txt"))
Expression dot(const Expression &arg)
Allows to setup and evaluate differential equations (ODEs and DAEs) based on SymbolicExpressions.