Skip to content
Jens Möckel edited this page Jan 4, 2016 · 4 revisions

This instance stores the results of DymolaMode - its more ore less a kind of a container. Its API gives the possibility to convert this instance content into table based HTML code and vice versa.

Note, that each attribute of a Report instance is initialized as None (except for colors).

Attributes

  • path (string, default=None):
    Path to the directory, where the report file should be stored.

  • name (string, default=None):
    Name of the report (without file extension).

  • disp (list of dictionaries, default=None):
    Key-value pairs of informations, that should be printed to the report.
    Mandatory keys: 'Key', 'Val'
    Example:

    disp = [{'Key':'Library', 'Val':Lib},  
             {'Key''Pedantic Mode', 'Val':False},  
             {'Key''Level of Detail', 'Val':1}]
    

* `cont` (*list of dictionaries*, default=`None`):  
Content of the report, so the actual results of the check.   
Mandatory keys:
 * `'Pck'` (contains name of checked library/package)
 * `'Res'` (contains overall result - `True` or `False`)
 * `'Err'` (contains number of errors)
 * `'Wrn'` (contains number of warnings)   

 Example:  

cont = [{'Pck':Lib, 'Res':'True', 'Err':'9', 'Wrn':'2'}]


* `mode` (*string*, default=`None`):  
    Either an HTML report only contains the name of the package/model and
    the result (`mode='compact'`) or there are two more columns giving the
    numbers of errors and warnings (`mode='full'`).

* `meta` (*dictionairy*, default=`None`):  
    Meta informations, which are used, if the report instance should be
    compared to another instance. These informations are also stored in the
    HTML report.  
    Mandatory keys:  
    * `'pck'` (path of checked library)  
    * `'ped'` (Dymola checkModel() mode)  
    * `'lod'` (level of detail)  
    * `'viewport'` (viewoptions for html)   


* `colors` (*dictionary*, default= `{'cTrue':'white','cFalse':'red','cNF':'yellow','cErr':'red','cWrn':'yellow'}`):  
  Background colors of cells in the HTML report.  
  Mandatory keys:  
    * `'cTrue'` (cells in the result-column, which contain the keyword 'True')  
    * `'cFalse'` (cells in the result-column, which contain the keyword 'False')  
    * `'cNF'` (cells in the result-column, which contain the keyword 'Not found')  
    * `'cErr'` (cells in the errors-column, which have entries greater than 0)  
    * `'cWrn'` (cells in the warnings-column, which have entries greater than 0)  


### Functions
* `generate_html()`:  
An HTML file is generated, which contains two tables. First table gives an overview over chosen options, second table displays row-wise results of checkModel() applied on some packages/models.

* `read_html(filepath=None)`:  
A HTML file, which must correspond to the structure given by `generate_html()`, is parsed and its content set as values of the report
instance.      
    * Optional Argument  
      * `filepath` (*string*):  
        path to a report-html file. If not given, reports name and path
        attribute are used.


* `compare_to(rep2)`:  
Compares this Report instance to the the instance rep2. An HTML is generated, which have the same layout as the usual HTML report, but uses different colors:   
  * If a result of this Report instance is better than the one of of `rep2`, the corresponding cell's background color is set to green.   
  * If the result is worse, the cell's background color is set to red.   
  * If there is no change, cell's background color remains white.  

  The new report has an additional information, to which instance it has been compared.

  * Argument:
    * `rep2` (*Report*):  
    A Report instance, which is compare to the self instance

 * Returns:  
A HTML file is generated which displays the results of the comparison.
The filename is `'[self.name]_compare.html'`.