Python script for model pre-processing

This is a beta version the implemented Python support in pre-processing steps in jEPlus, which allows IDF manipulation with user's own script (especially by using Eppy) according to the jEPlus parameter values. The new package can be downloaded here: jeplus_v1.7.0_beta.zip

How does it work

The diagram below is the pre-processing steps for preparing the EnergyPlus model for each case. The step of using an arbitrary Python script to manipulate the model is inserted right before the last step, calling ExpandObject. At this stage jEPlus has done all its processes, and the in.idf is ready in the case's folder. So the idea is that a users script can apply further operations on the in.idf file, using the arguments defined in the parameter and paths names passed in by jEPlus.

Calling convention

jEPlus calls the named script file in the project folder and passes in four arguments:

  1. Sys.argv[1] - project's base folder where the project files (e.g. project.jep) are located
  2. Sys.argv[2] - folder of the current case where in.idf (or in.dck and so forth) is located
  3. Sys.argv[3] - Other arguments specified in the parameter definition, as a ',' delimited string
  4. Sys.argv[4] - The location of the binary files of the simulation program, e.g. the location of Energy+.idd. This argument is only relevant with EnergyPlus simulations

It is expected that the script will take the existing in.idf, make changes, and produce a valid new in.idf that is ready for E+ simulation.

Parameter syntax

Here is an example of the parameter definition:

@python2(preproc_test_jy.py, P2, 99, P4, 222, abc)

It is led by the keyword @jython, @python2, or @python3 that specifies the flavour of the script file. In the brackets the first field is the name of the script file. Both relative and absolution paths names can be used here. If relative path is used, it is relative to the project's folder.

The following fields in the brackets are arguments to be passed to the script. Please note if jEPlus parameter names present in the project are used, the values of the parameters for each case will be taken. This allows the scripts to work with existing parameters.

In the given example, arguments 99, 222 and abc will be passed to the script as they are. P2 and P4, on the other hand, will be replaced by e.g. 1000 and 1.05 before being passed to the script.

If the syntax of the parameter is valid, you shall see it being displayed in a different format in the Preview box, as:

{call(python2, preproc_test_jy.py, @@cost1@@, 99, @@sizing@@, 222, abc)}

Testing

example_3-RVX_v1.6_E+v8.3/ has been modified to demonstrate the Python functions. In the folder, a Python2 script for pre-processing, preproc_test_jy.py is included in the folder. The script does nothing except prints out the system arguments it receives upon being called by jEPlus.

The parameter tree in the project is as below:

Before running the example, you would need to set up the Python executable locations first. A new configuration dialog has been introduced for this purpose. It can be accessed through the menu Tools/Configure External Programs …

If the example worked correctly, the following logs will be written by the script, to the console.log file in each case folder:

D:\bin\Python27\python.exe "D:\4\jEPlus_v1.6.4_beta\example_3-RVX_v1.6_E+v8.3\preproc_test_jy.py"  "D:\4\jEPlus_v1.6.4_beta\example_3-RVX_v1.6_E+v8.3\" "D:\4\jEPlus_v1.6.4_beta\output_ex3\LHS-000000/" "7000,99,1.65,222,abc" 
-==-
D:\4\jEPlus_v1.6.4_beta\example_3-RVX_v1.6_E+v8.3\preproc_test_jy.py is called with args: 
  argv[1] - D:\4\jEPlus_v1.6.4_beta\example_3-RVX_v1.6_E+v8.3\
  argv[2] - D:\4\jEPlus_v1.6.4_beta\output_ex3\LHS-000000/
  argv[3] - 7000,99,1.65,222,abc
-==-

WWR Example

example_8-PyPreProcess_E+v8.5 contains the windown-to-wall ratio example. In the project, a jEPlus parameter defines the alt WWR values of all external walls. The Python script (written in Python3 and Eppy) takes the WWR value and applies it to all window objects in the IDF.

Please note, to run this example, you need to have Python3 and the Eppy dependencies installed. Also set up the Python executable in jEPlus before execution. A new dialog window (see below) has been provided for this purpose. It is accessible through Tools/Configure External Programs… menu.