49 const double D = 0.15;
50 const double Ki = 22.0;
51 const double Km = 1.2 ;
52 const double Pm = 50.0;
53 const double Yxs = 0.4 ;
54 const double alpha = 2.2 ;
55 const double beta = 0.2 ;
56 const double mum = 0.48;
58 const double Sfmin = 28.7;
59 const double Sfmax = 40.0;
63 const double t_end = 48.0;
68 mu = mum*(1.-P/Pm)*S/(Km+S+
pow(S,2)/Ki);
70 f <<
dot(X) == -D*X+mu*X;
71 f <<
dot(S) == D*(Sf-
S)-(mu/Yxs)*X;
72 f <<
dot(P) == -D*P+(alpha*mu+beta)*X;
77 OCP ocp( t_start, t_end, 20 );
78 ocp.minimizeLagrangeTerm( D*(Sf-P) );
82 ocp.subjectTo(
AT_START, S == 12.0 );
83 ocp.subjectTo(
AT_START, P == 22.0 );
89 ocp.subjectTo( Sfmin <= Sf <= Sfmax );
119 std::ofstream stream1(
"s3.txt" );
121 s3.
print(stream1, 0,
" ",
" ", 16, 16,
" ",
"\n" );
returnValue print(std::ostream &stream=std::cout, const char *const name=DEFAULT_LABEL, const char *const startString=DEFAULT_START_STRING, const char *const endString=DEFAULT_END_STRING, uint width=DEFAULT_WIDTH, uint precision=DEFAULT_PRECISION, const char *const colSeparator=DEFAULT_COL_SEPARATOR, const char *const rowSeparator=DEFAULT_ROW_SEPARATOR) const
returnValue initializeControls(const char *fileName)
User-interface to formulate and solve optimal control problems and static NLPs.
#define USING_NAMESPACE_ACADO
Provides a time grid consisting of vector-valued optimization variables at each grid point...
IntermediateState pow(const Expression &arg1, const Expression &arg2)
returnValue addSubplot(PlotWindowSubplot &_subplot)
returnValue set(OptionsName name, int value)
returnValue initializeDifferentialStates(const char *fileName, BooleanType autoinit=BT_FALSE)
Data class for defining optimal control problems.
Expression dot(const Expression &arg)
returnValue getControls(VariablesGrid &p_) const
Provides an interface to Gnuplot for plotting algorithmic outputs.
virtual returnValue solve()
returnValue getDifferentialStates(VariablesGrid &xd_) const
Allows to setup and evaluate differential equations (ODEs and DAEs) based on SymbolicExpressions.