This directory contains modules to aid in the generation and management of test case data.
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:
-
The files should be located at
models/Resources
folder of a test case. -
The files should contain columns with keys following the convention established at
categories.json
-
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_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:
-
save_data_and_kpisjson
saves all test case data located in the CSV files of themodels/Resources
folder of the test case into theresources
folder of the test case FMU. This method also saves thekpis.json
file generated by theparser
within the same directory. This method is normally employed by theparser
in the process of creating the test case FMU. -
load_data_and_kpisjson
reads the test case data and thekpis.json
dictionary from theresources
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. -
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 theKPI_Calculator
orForecaster
modules.
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 inputsmeasurements.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
.