53 double rhoc = 1450.00;
83 double PI = 3.1415926535897932;
139 dm = (rhoc*AQ/ 3.0)*dr;
146 w =
log(h/hr) /
log(h0/hr) *w0 ;
152 we[0] = w*
sin(theta)*
cos(phi) - dr ;
153 we[1] = -w*
sin(phi) - r*
sin(theta)*dphi ;
154 we[2] = -w*
cos(theta)*
cos(phi) + r *dtheta;
160 nwep =
pow( we[1]*we[1] + we[2]*we[2], 0.5 );
161 nwe =
pow( we[0]*we[0] + we[1]*we[1] + we[2]*we[2], 0.5 );
162 eta =
asin( we[0]*
tan(Psi)/ nwep ) ;
167 ewep[1] = we[1] / nwep ;
168 ewep[2] = we[2] / nwep ;
173 et [1] = (-
cos(Psi)*
sin(eta))*ewep[1] - (
cos(Psi)*
cos(eta))*ewep[2];
174 et [2] = (-
cos(Psi)*
sin(eta))*ewep[2] + (
cos(Psi)*
cos(eta))*ewep[1];
183 Caer = (rho*A/2.0 )*nwe ;
184 Cf = (rho*dc/8.0)*r*nwe ;
197 Fg [0] = Cg *
cos(theta) ;
199 Fg [2] = Cg *
sin(theta) ;
205 Faer[0] = Caer*( CL*(we[1]*et[2]-we[2]*et[1]) + CD*we[0] ) ;
206 Faer[1] = Caer*( CL*(we[2]*et[0]-we[0]*et[2]) + CD*we[1] ) ;
207 Faer[2] = Caer*( CL*(we[0]*et[1]-we[1]*et[0]) + CD*we[2] ) ;
214 Ff [1] = Cf * cc* we[1] ;
215 Ff [2] = Cf * cc* we[2] ;
222 F [0] = Fg[0] + Faer[0] ;
223 F [1] = Faer[1] + Ff[1] ;
224 F [2] = Fg[2] + Faer[2] + Ff[2] ;
231 a_pseudo [0] = - ddr0
233 +
sin(theta)*
sin(theta)*dphi *dphi )
236 a_pseudo [1] = - 2.0*
cos(theta)/
sin(theta)*dphi*dtheta
240 a_pseudo [2] =
cos(theta)*
sin(theta)*dphi*dphi
250 ddr = F[0]/m + a_pseudo[0] ;
251 ddphi = F[1]/(m*r*
sin(theta)) + a_pseudo[1] ;
252 ddtheta = -F[2]/(m*r ) + a_pseudo[2] ;
261 dn = ( dphi*ddtheta - dtheta*ddphi ) /
262 (2.0*PI*(dphi*dphi + dtheta*dtheta) ) ;
277 regularisation = 5.0e2 * ddr0 * ddr0
278 + 1.0e8 * dPsi * dPsi
281 + 2.5e7 * ddphi * ddphi;
282 + 2.5e7 * ddtheta * ddtheta;
283 + 2.5e6 * dtheta * dtheta;
293 f <<
dot(phi) == dphi ;
294 f <<
dot(theta) == dtheta ;
295 f <<
dot(dr) == ddr0 ;
296 f <<
dot(dphi) == ddphi ;
297 f <<
dot(dtheta) == ddtheta ;
299 f <<
dot(Psi) == dPsi ;
300 f <<
dot(CL) == dCL ;
301 f <<
dot(W) == (-power + regularisation)*1.0e-6;
337 const double t_end = 18.0;
340 OCP ocp( t_start, t_end, N );
353 ocp.
subjectTo( -0.065 <= dPsi <= 0.065 );
USING_NAMESPACE_ACADO IntermediateState sin(const Expression &arg)
Allows to setup and evaluate a general function based on SymbolicExpressions.
USING_NAMESPACE_ACADO int main()
#define USING_NAMESPACE_ACADO
IntermediateState asin(const Expression &arg)
IntermediateState pow(const Expression &arg1, const Expression &arg2)
BEGIN_NAMESPACE_ACADO typedef unsigned int uint
virtual returnValue exportCode(const std::string &dirName, const std::string &_realString="real_t", const std::string &_intString="int", int _precision=16)
void setAll(const T &_value)
IntermediateState tan(const Expression &arg)
returnValue subjectTo(const DifferentialEquation &differentialEquation_)
returnValue minimizeMayerTerm(const Expression &arg)
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.
Base class for all variables within the symbolic expressions family.
virtual returnValue exportCode(const std::string &dirName, const std::string &_realString="real_t", const std::string &_intString="int", int _precision=16)
Data class for defining optimal control problems.
Expression dot(const Expression &arg)
A user class for auto-generation of OCP solvers.
returnValue printDimensionsQP()
Allows to setup and evaluate differential equations (ODEs and DAEs) based on SymbolicExpressions.
IntermediateState log(const Expression &arg)