38 #define round( value ) floor( value + 0.5 ) 210 tmp.
read( fileName );
234 cout <<
"--> Initializing controller ...\n";
246 cout <<
"<-- Initializing controller done.\n";
255 cout <<
"--> Initializing process ...\n";
264 cout <<
"<-- Initializing process done.\n";
338 cout <<
"--> Calling controller ...\n";
354 cout <<
"<-- Calling controller done.\n";
358 nextSamplingInstant = round( nextSamplingInstant * 1.0e6 ) / 1.0e6;
365 uPrevious.
print(
"previous u(0)");
366 u.
print(
"u(0) from controller");
379 cout <<
"--> Simulating process ...\n";
381 if ( fabs( compDelay ) < 100.0*
EPS )
416 delayGrid.
setTime( nextSamplingInstant );
420 uDelayed.setVector( 1,u );
421 uDelayed.setVector( 2,u );
425 pDelayed.setVector( 1,p );
426 pDelayed.setVector( 2,p );
446 cout <<
"<-- Simulating process done.\n";
512 int simulateComputationalDelay;
520 double computationalDelayFactor, computationalDelayOffset;
524 return acadoMax( 0.0, controllerRuntime*computationalDelayFactor + computationalDelayOffset );
SimulationEnvironment & operator=(const SimulationEnvironment &rhs)
returnValue setTime(double _time)
const int defaultPrintlevel
Calculates the control inputs of the Process based on the Process outputs.
const int defaultSimulateComputationalDelay
returnValue setController(Controller &_controller)
returnValue getY(VariablesGrid &_y) const
int acadoMax(const int x, const int y)
virtual returnValue setupLogging()
BooleanType acadoIsEqual(double x, double y, double TOL)
returnValue evaluate(double t, double *result) const
returnValue setStatus(BlockStatus _status)
BEGIN_NAMESPACE_ACADO const double EPS
BooleanType isDefined() const
returnValue initializeAlgebraicStates(const VariablesGrid &_xa_init)
returnValue add(double tStart, double tEnd, const DVector constant)
Provides a time grid consisting of vector-valued optimization variables at each grid point...
Allows to pass back messages to the calling function.
const double defaultComputationalDelayFactor
uint getNU(uint stageIdx=0) const
virtual returnValue init(double _initialTime)
Allows to conveniently handle (one-dimensional) grids consisting of time points.
BooleanType isEmpty() const
virtual returnValue step(const VariablesGrid &_u, const VariablesGrid &_p=emptyVariablesGrid)
#define CLOSE_NAMESPACE_ACADO
virtual returnValue setupOptions()
returnValue init(const DVector &x0_, const DVector &p_=emptyConstVector)
BlockStatus getStatus() const
virtual returnValue step(double currentTime, const DVector &_y, const VariablesGrid &_yRef=emptyConstVariablesGrid)
returnValue initializeAlgebraicStates(const DVector &_xaStart)
returnValue initializeAlgebraicStates(const VariablesGrid &_xa_init)
const double defaultComputationalDelayOffset
returnValue setVector(uint pointIdx, const DVector &_values)
virtual returnValue init(double startTime=0.0, const DVector &_x0=emptyConstVector, const DVector &_p=emptyConstVector, const VariablesGrid &_yRef=emptyConstVariablesGrid)
virtual returnValue print(std::ostream &stream=std::cout, const std::string &name=DEFAULT_LABEL, const std::string &startString=DEFAULT_START_STRING, const std::string &endString=DEFAULT_END_STRING, uint width=DEFAULT_WIDTH, uint precision=DEFAULT_PRECISION, const std::string &colSeparator=DEFAULT_COL_SEPARATOR, const std::string &rowSeparator=DEFAULT_ROW_SEPARATOR) const
uint getNP(uint stageIdx=0) const
double determineComputationalDelay(double controllerRuntime) const
void rhs(const real_t *x, real_t *f)
double getNextSamplingInstant(double currentTime)
returnValue read(std::istream &stream)
Base class for building-blocks of the SimulationEnvironment.
Allows to run closed-loop simulations of dynamic systems.
DVector getVector(uint pointIdx) const
#define ACADOWARNING(retval)
Simulates the process to be controlled based on a dynamic model.
#define BEGIN_NAMESPACE_ACADO
uint getNY(uint stageIdx=0) const
double getPreviousRealRuntime()
returnValue setProcess(Process &_process)
SimulationBlock & operator=(const SimulationBlock &rhs)
returnValue getU(DVector &_u) const
returnValue addOption(OptionsName name, int value)
SimulationClock simulationClock
virtual ~SimulationEnvironment()
returnValue getP(DVector &_p) const
#define ACADOERROR(retval)
virtual returnValue getTime(double &_elapsedTime)
virtual returnValue init(double _startTime=0.0, const DVector &_xStart=emptyConstVector, const DVector &_uStart=emptyConstVector, const DVector &_pStart=emptyConstVector)