Skip to content

Latest commit

 

History

History

data

This directory contains modules to aid in the generation and management of test case data.

Data Generation

data_generator.py is meant to help the test case developer to generate the test case boundary condition data according the BOPTEST data convention. This convention consists of a set of keys for the boundary condition variables that are grouped in different categories. The names and grouping of these variables is established at the file categories.json of this directory.

The final goal of data_generator.py is to generate and introduce the CSV data files within the models/Resources folder of the test case in order to import these data later within the test case FMU. Therefore, the use of this module takes place before the compilation process of a Modelica model using the signal exchange blocks and parser (from ../parsing). The test case developer is strongly encouraged to use this module, or at least follow it as a guideline when generating the test case data. However, the CSV data files can come from any other source as far as they comply with the three following requirements:

  1. The files should be located at models/Resources folder of a test case.

  2. The files should contain columns with keys following the convention established at categories.json

  3. The files should contain a time column specifying the time from the beginning of the year in seconds.

In order to assist the test case developer in the generation of the data sets, the Data_Generator class contains several methods to generate the test case data grouped by categories and covering most of the common signal shapes which can still be tuned using certain arguments.

Data Packaging and Use

data_manager.py is used to introduce and retrieve the data into and from the test case FMU. It contains three main methods for this purpose:

  1. save_data_and_kpisjson saves all test case data located in the CSV files of the models/Resources folder of the test case into the resources folder of the test case FMU. This method also saves the kpis.json file generated by the parser within the same directory. This method is normally employed by the parser in the process of creating the test case FMU.

  2. load_data_and_kpisjson reads the test case data and the kpis.json dictionary from the resources folder of the test case FMU and loads it into the test case object as a pandas data frame and as a dictionary, respectively. This method is normally employed by the constructor of a test case object in the process of initializing the test.

  3. get_data slices the test case data frame to return the data only for the requested index or period of time. This method would be used by the KPI_Calculator or Forecaster modules.

Generate Documentation for Test Case I/O Points

get_html_IO.py can be used to generate the html documentation code for I/O in alphabetical order. Outputs of the script:

  • inputs.txt: html code documenting the inputs
  • measurements.txt: html code documenting the outputs

In order to run the script, deploy the BOPTEST testcase, where the deployment guide is in the README.md file in the root directory. Then, open a terminal in the /data folder and run the script python get_html_IO.py.