Show
Ignore:
Timestamp:
05/18/10 16:54:25 (14 years ago)
Author:
smidl
Message:

doc

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/doc/tutorial/01userguide_sim.dox

    r947 r948  
    22\page userguide_sim BDM Use - System, Data, Simulation 
    33 
    4 This section serves as introduction to the scenario of data simulation. Since it is the simpliest of all scenarios defined in \ref userguide0 it also serves as introduction to configuration of an experiment (see \ref ui) and basic decision making objects (bdm::RV and bdm::DS). 
    5  
    6 All experiments are demonstarted on mex file \c simulator, which is also available as a standalone application. 
     4This section serves as introduction to the scenario of data simulation. Since it is the simplest of all scenarios defined in \ref userguide0 it also serves as introduction to configuration of an experiment (see \ref ui) and basic decision making objects (bdm::RV and bdm::DS). 
     5 
     6All experiments are demonstrated on mex file \c simulator, which is also available as a standalone application. 
     7 
     8Table of contents: 
     9\section ug_sim_config  
     10\section ug_sim  
     11\section ug_memds  
     12\section ug_rvs  
     13\subsection ug_rv_connect  
     14\section ug_pdfds  
     15\section ug_arx_sim  
     16\subsection ug_ini  
     17\section ug_store  
    718 
    819 
     
    1324Specific treatment was developed for objects. Since BDM is designed as object oriented library, the configuration was designed to honor the rule of inheritance. That is, offspring of a class can be used in place of its predecessor. Hence, objects (instances of classes) are configured by a structure  with compulsory field \c class. This is a string variable corresponding to the name of the class to be used. This information is stored in Matlab structures (or objects, see section on Matlab extensions). 
    1425 
    15 Advacnded users can find more information in (\ref ui). 
     26Advanced users can find more information in (\ref ui). 
    1627 
    1728\subsection ug_first First experiment 
     
    2435which can be found in file bdmtoolbox/tutorials/userguide/memds_example.m. 
    2536 
    26 The code above is the minimum necessary information to run scenario \c simulator in matlab.  
    27 To actually do so, make sure that matlab paths are correctly set, as described in \ref install. 
     37The code above is the minimum necessary information to run scenario \c simulator in Matlab.  
     38To actually do so, make sure that Matlab paths are correctly set, as described in \ref install. 
    2839 
    2940The expected result for Matlab is: 
     
    6273 -# store log of its activity into dedicated logger. 
    6374 
    64 No fruther specification, e.g. if the data are pre-recorded or computed on-the-fly, are given. 
     75No further specification, e.g. if the data are pre-recorded or computed on-the-fly, are given. 
    6576For a list of available DataSources, see ... 
    6677 
     
    7182 
    7283Operation of such object is trivial, the data are stored as a matrix and the general operations defined above are specialized as follows: 
    73  -# data observed at time \f$ t \f$  are columns of the matrix, getdata() ruturns current column, 
     84 -# data observed at time \f$ t \f$  are columns of the matrix, getdata() returns current column, 
    7485 -# time step itself is performed by increasing the column index, 
    7586 -# each row is named as "ch0","ch1",... 
    7687 
    77 This is the default bahavior. It can be customized using the UI mechanism. Full list of options is: 
     88This is the default behavior. It can be customized using the UI mechanism. Full list of options is: 
    7889\code 
    7990DS.class = 'MemDS'; 
     
    99110 
    100111It is used for: 
    101  - desription of RV in pdfs, ways how to define marginalization and conditioning, 
     112 - description of RV in pdfs, ways how to define marginalization and conditioning, 
    102113 - connection between source of data and computational objects that use them, 
    103114 - connection <b>time</b>, more exactly time shift from \f$ t \f$, defaults to 0. 
    104115 
    105 For example, the estimators will request the data from the above mentioned data source by asking for rv 'ch0'. If a more meaninful names are available, the fields drv can be added to read: 
     116For example, the estimators will request the data from the above mentioned data source by asking for rv 'ch0'. If a more meaningful names are available, the fields drv can be added to read: 
    106117\code 
    107118DS.class='MemDS'; 
     
    109120DS.drv = RV('y'); 
    110121\endcode 
    111 Data from thsi data source will be available when estimators ask for rv 'y'. 
     122Data from this data source will be available when estimators ask for rv 'y'. 
    112123 
    113124\subsection ug_rv_connect Storing results 
    114125 
    115 results of an experiment can be stored in many ways. This functionality was abstracted into a class called logger. Exact form of the stored resuls is chosen by choosing appropriate class. 
    116 For example, \c stdlog writes all output in the console, \c dirfilelog writes all data in the dirfilelog format for high-speed data processing, \c mexlog writes data into matlab structure.  
     126results of an experiment can be stored in many ways. This functionality was abstracted into a class called logger. Exact form of the stored results is chosen by choosing appropriate class. 
     127For example, \c stdlog writes all output in the console, \c dirfilelog writes all data in the dirfilelog format for high-speed data processing, \c mexlog writes data into Matlab structure.  
    117128The \c mexlog is the default option in bdmtoolbox. 
    118129 
    119 Connection between computational blocks and loggers is controlled by structure called \c log_level which governes the level of details to be logged. 
     130Connection between computational blocks and loggers is controlled by structure called \c log_level which governs the level of details to be logged. 
    120131A standard Data source has two levels, \c logdt and \c logut which means "log all outputs, dt" and "log all inputs, ut". 
    121132Readers familiar with Simulink environment may look at the RV as being unique identifiers of inputs and outputs of simulation blocks. The inputs are connected automatically with the outputs with matching RV. This view is however, very incomplete, RV have more roles than this. 
     
    134145\f] 
    135146   
    136 The datasource itself, i.e. the instanc of \c EpdfDS can be then configured via: 
     147The datasource itself, i.e. the instance of \c EpdfDS can be then configured via: 
    137148\code 
    138149DS.class = 'pdfDS'; 
     
    150161 
    151162If the task was only to generate random realizations, this would indeed be a very clumsy way of doing it.  
    152 However, the power of the proposed approach will be revelead in more demanding examples, one of which follows next. 
     163However, the power of the proposed approach will be revealed in more demanding examples, one of which follows next. 
    153164 
    154165By default, data from this datasouce will be named after the rvs in given by the pdfs. When pdf with no rv is used, drv of the data source is set again to 'ch0'. 
     
    164175We need to handle two issues: 
    165176 -# extra unsimulated variable \f$ u \f$, 
    166  -# time delayes of the values. 
     177 -# time delays of the values. 
    167178 
    168179The first issue can be handled in two ways. First, \f$ u \f$ can be considered as input and as such it could be externally given to the datasource. This solution is used in scenario \c closedloop. 
     
    202213Explanation of this example will require few remarks: 
    203214 - class of the \c fy object is 'mlnorm\<ldmat\>' which is Normal pdf with mean value given by linear function, and covariance matrix stored in LD decomposition, see bdm::mlnorm for details. 
    204  - naming convention 'mlnorm\<ldmat\>' relates to the concept of templates in C++. For those unfamiliar with this concept, it is basicaly a way how to share code for different flavours of the same object. Note that mlnorm exist in three versions: mlnorm\<ldmat\>, mlnorm<chmat>, mlnorm<fsqmat>. Those classes act identically the only difference is that the internal data are stored either in LD decomposition, choleski decomposition or full matrices, respectively.  
     215 - naming convention 'mlnorm\<ldmat\>' relates to the concept of templates in C++. For those unfamiliar with this concept, it is basically a way how to share code for different flavors of the same object. Note that mlnorm exist in three versions: mlnorm\<ldmat\>, mlnorm<chmat>, mlnorm<fsqmat>. Those classes act identically the only difference is that the internal data are stored either in LD decomposition, choleski decomposition or full matrices, respectively.  
    205216 - the same concept is used for enorm, where enorm<chmat> and enorm<fsqmat> are also possible. In this particular use, these objects are equivalent. In specific situation, e.g. Kalman filter implemented on Choleski decomposition (bdm::KalmanCh), only enorm<chmat> is approprate. 
    206217 - class 'mprod' represents the chain rule of probability, see \ref ug_pdf_cond. 
    207218  
    208 The code above can be immediatelly run, usin the same execution sequence of \c estimator as above.  
     219The code above can be immediately run, using the same execution sequence of \c estimator as above.  
    209220 
    210221\subsection ug_ini Initializing simulation 
     
    217228 
    218229The values of \c init_values will be copied to places in history identified by corresponding values of \c init_rv. 
    219 Initial data is not checked for completeness, i.e. values of random variables missing from \c init_rv (in this case all occurences of \f$ u \f$) are still initialized to 0. 
     230Initial data is not checked for completeness, i.e. values of random variables missing from \c init_rv (in this case all occurrences of \f$ u \f$) are still initialized to 0. 
    220231 
    221232\section ug_store Storing results of simulation 
     
    226237For example, the output of \c MemDS can be stored as an .it file (filename is specified in configuration structure) which can be later read by bdm::ITppFileDS. 
    227238 
    228 In matlab, the output of mexlog is a structure of vectors or matrices. The results can be saved in a matlab file using: 
     239In Matlab, the output of mexlog is a structure of vectors or matrices. The results can be saved in a Matlab file using: 
    229240\code 
    230241Data=[M.y; M.u];