67 const double g = 9.81;
73 f1 <<
dot( alpha ) == dalpha;
74 f1 <<
dot( dx ) == ddx ;
75 f1 <<
dot( dy ) == ddy;
76 f1 <<
dot( dalpha ) == ddalpha;
78 f1 << 0 == m*ddx - (Fx+u);
79 f1 << 0 == m*ddy + m*g - (Fy+u);
80 f1 << 0 == I*ddalpha - M - (Fx+u)*y + (Fy+u)*x;
81 f1 << 0 == ddx + dy*dalpha + y*ddalpha;
82 f1 << 0 == ddy - dx*dalpha - x*ddalpha;
87 f2 << 0 ==
dot( x ) - dx;
88 f2 << 0 ==
dot( y ) - dy;
89 f2 << 0 ==
dot( alpha ) - dalpha;
90 f2 << 0 ==
dot( dx ) - ddx ;
91 f2 << 0 ==
dot( dy ) - ddy;
92 f2 << 0 ==
dot( dalpha ) - ddalpha;
94 f2 << 0 == m*ddx - (Fx+u);
95 f2 << 0 == m*ddy + m*g - (Fy+u);
96 f2 << 0 == I*ddalpha - M - (Fx+u)*y + (Fy+u)*x;
97 f2 << 0 == ddx + dy*dalpha + y*ddalpha;
98 f2 << 0 == ddy - dx*dalpha - x*ddalpha;
112 cout <<
"-----------------------------------------------------------\n Using a Pendulum DAE model in ACADO syntax (semi-explicit):\n-----------------------------------------------------------\n";
113 sim1.
exportAndRun(
"pendulum_export",
"init_externModel.txt",
"controls_externModel.txt" );
128 cout <<
"-----------------------------------------------------------\n Using a Pendulum DAE model in ACADO syntax (implicit):\n-----------------------------------------------------------\n";
129 sim2.
exportAndRun(
"pendulum_export",
"init_externModel.txt",
"controls_externModel.txt" );
141 sim3.
setModel(
"model",
"rhs",
"rhs_jac" );
144 sim3.
addOutput(
"out",
"out_jac", 2, 5 );
147 cout <<
"-----------------------------------------------------------\n Using an externally defined Pendulum DAE model:\n-----------------------------------------------------------\n";
148 sim3.
exportAndRun(
"externModel_export",
"init_externModel.txt",
"controls_externModel.txt" );
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)
returnValue set(OptionsName name, int value)
User-interface to automatically generate simulation algorithms for fast optimal control.
USING_NAMESPACE_ACADO int main()
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"))
returnValue setDimensions(uint _NX1, uint _NX2, uint _NX3, uint _NDX, uint _NDX3, uint _NXA, uint _NXA3, uint _NU, uint _NOD, uint _NP)
Expression dot(const Expression &arg)
Allows to setup and evaluate differential equations (ODEs and DAEs) based on SymbolicExpressions.