51 const double samplingTime=30.0;
52 double A1=380.1327,
A2=380.1327, A3=380.1327, A4=380.1327, a1=1.2272, a2=1.2272, a3=1.2272, a4=1.2272,
g=981.0,gamma1=0.45, gamma2=0.4;
53 double x_ss1=20.0, x_ss2=15.0, u_max1=400.0, u_max2=400.0, x_max1=40.0, x_max2=40.0, x_max3=40.0, x_max4=40.0;
57 const double t_end = t_start+T*samplingTime;
63 f <<
dot(h1) == (1.0/
A1)*(gamma1*u1+a3*
sqrt(2.0*
g*h3)-a1*
sqrt(2.0*
g*h1));
64 f <<
dot(h2)== (1.0/
A2)*(gamma2*u2+a4*
sqrt(2.0*
g*h4)-a2*
sqrt(2.0*
g*h2));
65 f <<
dot(h3)==(1.0/A3)*((1.0-gamma2)*u2-a3*
sqrt(2.0*
g*h3));
66 f <<
dot(h4)==(1.0/A4)*((1.0-gamma1)*u1-a4*
sqrt(2.0*
g*h4));
84 OCP ocp(t_start,t_end,T);
112 exit( EXIT_FAILURE );
126 Controller controller(algorithm,zeroReference);
132 double simStartTime = 0.0;
133 double simEndTime = 1200.0;
143 exit( EXIT_FAILURE );
145 exit( EXIT_FAILURE );
Calculates the control inputs of the Process based on the Process outputs.
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
Allows to setup and evaluate a general function based on SymbolicExpressions.
IntermediateState sqrt(const Expression &arg)
USING_NAMESPACE_ACADO typedef TaylorVariable< Interval > T
Allows to setup and evaluate output functions based on SymbolicExpressions.
virtual returnValue plot(PlotFrequency _frequency=PLOT_IN_ANY_CASE)
returnValue getProcessDifferentialStates(VariablesGrid &_diffStates)
Stores a DifferentialEquation together with an OutputFcn.
#define USING_NAMESPACE_ACADO
Provides a time grid consisting of vector-valued optimization variables at each grid point...
returnValue getFeedbackControl(Curve &_feedbackControl) const
Allows to simulate the behaviour of sensors within the Process.
USING_NAMESPACE_ACADO int main()
User-interface to formulate and solve model predictive control problems.
returnValue subjectTo(const DifferentialEquation &differentialEquation_)
returnValue addSubplot(PlotWindowSubplot &_subplot)
returnValue set(OptionsName name, int value)
returnValue minimizeLSQ(const DMatrix &S, const Function &h, const DVector &r)
returnValue init(const DVector &x0_, const DVector &p_=emptyConstVector)
returnValue setOutputNoise(const Noise &_noise, double _noiseSamplingTime)
Derived & setZero(Index size)
Data class for defining optimal control problems.
Allows to define a static reference trajectory that the ControlLaw aims to track. ...
Expression dot(const Expression &arg)
Generates pseudo-random Gaussian noise for simulating the Process.
Allows to run closed-loop simulations of dynamic systems.
Simulates the process to be controlled based on a dynamic model.
Provides an interface to Gnuplot for plotting algorithmic outputs.
Allows to setup and evaluate differential equations (ODEs and DAEs) based on SymbolicExpressions.