plot_window.hpp
Go to the documentation of this file.
00001 /*
00002  *    This file is part of ACADO Toolkit.
00003  *
00004  *    ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
00005  *    Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau,
00006  *    Milan Vukov, Rien Quirynen, KU Leuven.
00007  *    Developed within the Optimization in Engineering Center (OPTEC)
00008  *    under supervision of Moritz Diehl. All rights reserved.
00009  *
00010  *    ACADO Toolkit is free software; you can redistribute it and/or
00011  *    modify it under the terms of the GNU Lesser General Public
00012  *    License as published by the Free Software Foundation; either
00013  *    version 3 of the License, or (at your option) any later version.
00014  *
00015  *    ACADO Toolkit is distributed in the hope that it will be useful,
00016  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  *    Lesser General Public License for more details.
00019  *
00020  *    You should have received a copy of the GNU Lesser General Public
00021  *    License along with ACADO Toolkit; if not, write to the Free Software
00022  *    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00023  *
00024  */
00025 
00026 
00033 #ifndef ACADO_TOOLKIT_PLOT_WINDOW_HPP
00034 #define ACADO_TOOLKIT_PLOT_WINDOW_HPP
00035 
00036 
00037 #include <acado/utils/acado_utils.hpp>
00038 #include <acado/matrix_vector/matrix_vector.hpp>
00039 #include <acado/symbolic_expression/symbolic_expression.hpp>
00040 #include <acado/function/function.hpp>
00041 
00042 #include <acado/user_interaction/plot_window_subplot.hpp>
00043 #include <acado/user_interaction/log_record.hpp>
00044 
00045 
00046 BEGIN_NAMESPACE_ACADO
00047 
00048 
00076 class PlotWindow
00077 {
00078         friend class PlotCollection;
00079         friend class Plotting;
00080 
00081         //
00082         // PUBLIC MEMBER FUNCTIONS:
00083         //
00084         public:
00087                 PlotWindow( );
00088 
00093                 PlotWindow(     PlotFrequency _frequency
00094                                         );
00095 
00096 
00101                 PlotWindow(     const PlotWindow& rhs
00102                                         );
00103 
00106                 virtual ~PlotWindow( );
00107 
00112                 PlotWindow& operator=(  const PlotWindow& rhs
00113                                                                 );
00114 
00115 
00121                 virtual PlotWindow* clone( ) const;
00122 
00123 
00128         virtual returnValue init( );
00129 
00130 
00137                 virtual returnValue plot(       PlotFrequency _frequency = PLOT_IN_ANY_CASE
00138                                                                         );
00139 
00140 
00147                 virtual returnValue replot(     PlotFrequency _frequency = PLOT_IN_ANY_CASE
00148                                                                         );
00149 
00150 
00159         virtual returnValue setTitle(   uint idx,
00160                                                                                 const char* const title_
00161                                                                                 );
00162 
00171         virtual returnValue setLabelX(  uint idx,
00172                                                                                 const char* const xLabel_
00173                                                                                 );
00174 
00183         virtual returnValue setLabelY(  uint idx,
00184                                                                                 const char* const yLabel_
00185                                                                                 );
00186 
00195         virtual returnValue setPlotMode(        uint idx,
00196                                                                                         PlotMode plotMode
00197                                                                                         );
00198 
00211         virtual returnValue setRanges(  uint idx,
00212                                                                                 double xRange1,
00213                                                                                 double xRange2,
00214                                                                                 double yRange1,
00215                                                                                 double yRange2
00216                                                                                 );
00217 
00218 
00227                 virtual returnValue addLine(    uint idx,
00228                                                                                 double _lineValue
00229                                                                                 );
00230 
00239                 virtual returnValue addData(    uint idx,
00240                                                                                 const VariablesGrid& _newData
00241                                                                                 );
00242 
00243 
00250                 inline PlotWindowSubplot& operator()(   uint idx
00251                                                                                                 );
00252 
00259                 inline PlotWindowSubplot operator()(    uint idx
00260                                                                                                 ) const;
00261 
00262 
00273                 returnValue operator<<( PlotWindowSubplot& _subplot
00274                                                                 );
00275 
00285                 returnValue operator<<( PlotName _name
00286                                                                 );
00287 
00297                 returnValue operator<<( const Expression& _name
00298                                                                 );
00299 
00300 
00308                 returnValue addSubplot( PlotWindowSubplot& _subplot
00309                                                                 );
00310 
00311 
00329                 returnValue addSubplot( const Expression& _expression,
00330                                                                 const char* const _title = "",
00331                                                                 const char* const _xLabel = "",
00332                                                                 const char* const _yLabel = "",
00333                                                                 PlotMode _plotMode = PM_UNKNOWN,
00334                                                                 double _xRangeLowerLimit = INFTY,
00335                                                                 double _xRangeUpperLimit = INFTY,
00336                                                                 double _yRangeLowerLimit = INFTY,
00337                                                                 double _yRangeUpperLimit = INFTY
00338                                                                 );
00339 
00358                 returnValue addSubplot( const Expression& _expressionX,
00359                                                                 const Expression& _expressionY,
00360                                                                 const char* const _title = "",
00361                                                                 const char* const _xLabel = "",
00362                                                                 const char* const _yLabel = "",
00363                                                                 PlotMode _plotMode = PM_UNKNOWN,
00364                                                                 double _xRangeLowerLimit = INFTY,
00365                                                                 double _xRangeUpperLimit = INFTY,
00366                                                                 double _yRangeLowerLimit = INFTY,
00367                                                                 double _yRangeUpperLimit = INFTY
00368                                                                 );
00369 
00387                 returnValue addSubplot( PlotName _name,
00388                                                                 const char* const _title = "",
00389                                                                 const char* const _xLabel = "",
00390                                                                 const char* const _yLabel = "",
00391                                                                 PlotMode _plotMode = PM_UNKNOWN,
00392                                                                 double _xRangeLowerLimit = INFTY,
00393                                                                 double _xRangeUpperLimit = INFTY,
00394                                                                 double _yRangeLowerLimit = INFTY,
00395                                                                 double _yRangeUpperLimit = INFTY
00396                                                                 );
00397 
00415                 returnValue addSubplot( const VariablesGrid& _variable,
00416                                                                 const char* const _title = "",
00417                                                                 const char* const _xLabel = "",
00418                                                                 const char* const _yLabel = "",
00419                                                                 PlotMode _plotMode = PM_UNKNOWN,
00420                                                                 double _xRangeLowerLimit = INFTY,
00421                                                                 double _xRangeUpperLimit = INFTY,
00422                                                                 double _yRangeLowerLimit = INFTY,
00423                                                                 double _yRangeUpperLimit = INFTY
00424                                                                 );
00425 
00443                 returnValue addSubplot3D(       const VariablesGrid& _variable,
00444                                                                         const char* const _title = "",
00445                                                                         const char* const _xLabel = "",
00446                                                                         const char* const _yLabel = "",
00447                                                                         PlotMode _plotMode = PM_UNKNOWN,
00448                                                                         double _xRangeLowerLimit = INFTY,
00449                                                                         double _xRangeUpperLimit = INFTY,
00450                                                                         double _yRangeLowerLimit = INFTY,
00451                                                                         double _yRangeUpperLimit = INFTY
00452                                                                         );
00453 
00471                 returnValue addSubplot( const Curve& _curve,
00472                                                                 double _xRangeLowerLimit = 0.0,
00473                                                                 double _xRangeUpperLimit = 1.0,
00474                                                                 const char* const _title = "",
00475                                                                 const char* const _xLabel = "",
00476                                                                 const char* const _yLabel = "",
00477                                                                 PlotMode _plotMode = PM_UNKNOWN,
00478                                                                 double _yRangeLowerLimit = INFTY,
00479                                                                 double _yRangeUpperLimit = INFTY
00480                                                                 );
00481 
00482 
00487                 returnValue clearAllSubplots( );
00488 
00489 
00495                 inline PlotFrequency getPlotFrequency( ) const;
00496 
00497 
00502                 inline uint getNumSubplots( ) const;
00503 
00509                 inline BooleanType isEmpty( ) const;
00510 
00511 
00518                 inline returnValue getPlotDataRecord(   LogRecord& _record
00519                                                                                                 ) const;
00520 
00527                 inline returnValue setPlotDataRecord(   LogRecord& _record
00528                                                                                                 );
00529 
00530 
00531 
00540                 inline returnValue setPlotData( const Expression& _name,
00541                                                                                 VariablesGrid& value
00542                                                                                 );
00543 
00552                 inline returnValue setPlotData( LogName _name,
00553                                                                                 VariablesGrid& value
00554                                                                                 );
00555 
00556 
00562                 inline BooleanType isAlias( ) const;
00563 
00569                 inline int getAliasIdx( ) const;
00570 
00571 
00572     //
00573     // PROTECTED MEMBER FUNCTIONS:
00574     //
00575     protected:
00576 
00583                 inline returnValue setNext(     PlotWindow* const _next
00584                                                                         );
00585 
00590                 inline PlotWindow* getNext( ) const;
00591 
00592 
00600                 returnValue addPlotDataItem(    VariableType _type
00601                                                                                 );
00602 
00610                 returnValue addPlotDataItem(    const Expression* const _expression
00611                                                                                 );
00612 
00620                 returnValue addPlotDataItem(    PlotName _name
00621                                                                                 );
00622 
00623 
00631                 LogName convertPlotToLogName(   PlotName _name
00632                                                                                 ) const;
00633 
00641                 PlotName convertLogToPlotName(  LogName _name
00642                                                                                 ) const;
00643 
00644 
00652                 returnValue setupLogFrequency(  PlotFrequency _frequency = PLOT_AT_EACH_ITERATION
00653                                                                                 );
00654 
00655 
00662                 inline returnValue setAliasIdx( int _aliasIdx
00663                                                                                 );
00664 
00665 
00677                 returnValue getVariableDataGrids(       const Expression* const variable,
00678                                                                                         VariableType& _type,
00679                                                                                         VariablesGrid& _dataGrid,
00680                                                                                         Grid& _discretizationGrid
00681                                                                                         );
00682 
00694                 returnValue getExpressionDataGrids(     const Expression* const expression,
00695                                                                                         VariableType& _type,
00696                                                                                         VariablesGrid& _dataGrid,
00697                                                                                         Grid& _discretizationGrid
00698                                                                                         );
00699 
00710                 returnValue getDataGrids(       const VariablesGrid* const variablesGrid,
00711                                                                         VariableType& _type,
00712                                                                         VariablesGrid& _dataGrid,
00713                                                                         Grid& _discretizationGrid
00714                                                                         );
00715 
00716 
00727                 returnValue getAutoScaleYLimits(        const VariablesGrid& dataGridY,
00728                                                                                         PlotFormat plotFormat,
00729                                                                                         double& lowerLimit,
00730                                                                                         double& upperLimit
00731                                                                                         ) const;
00732 
00733 
00734                 inline returnValue enableNominalControls( );
00735                 
00736                 inline returnValue disableNominalControls( );
00737 
00738 
00739                 inline returnValue enableNominalParameters( );
00740                 
00741                 inline returnValue disableNominalParameters( );
00742 
00743                 
00744                 inline returnValue enableNominalOutputs( );
00745                 
00746                 inline returnValue disableNominalOutputs( );
00747 
00748 
00749 
00750     //
00751     // DATA MEMBERS:
00752     //
00753         protected:
00754                 PlotWindow* next;                                               
00755                 int aliasIdx;                                                   
00757                 PlotFrequency frequency;                                
00759                 PlotWindowSubplot* first;                               
00760                 PlotWindowSubplot* last;                                
00762                 uint number;                                                    
00764                 LogRecord plotDataRecord;                               
00766                 BooleanType shallPlotNominalControls;   
00767                 BooleanType shallPlotNominalParameters; 
00768                 BooleanType shallPlotNominalOutputs;    
00769 };
00770 
00771 
00772 CLOSE_NAMESPACE_ACADO
00773 
00774 
00775 #include <acado/user_interaction/plot_window.ipp>
00776 
00777 
00778 #endif  // ACADO_TOOLKIT_PLOT_WINDOW_HPP
00779 
00780 
00781 /*
00782  *      end of file
00783  */


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Sat Jun 8 2019 19:38:42