[esp-r] Re: Scripting and Perl

Ferguson, Alex Alex.Ferguson at NRCan-RNCan.gc.ca
Wed Oct 30 17:15:47 GMT 2013


Hi Amir,

Please confirm that bps was compiled with support for H3Kreports. Run the command 'bps -buildinfo'; you should get something like the following.

------------------------------------------------------------------
$ bps -buildinfo
ESP-r Integrated Building Performance Simulator (bps).
This is a development copy of bps, based on ESP-r release 11.11.

Copyright resides with the member organisations of the ESP-r
development consortium as listed at:
http://www.esru.strath.ac.uk/Programs/ESP-r_central.htm

Build information:
  - SVN Source:       Alex_Ferguson at r9508 (unmodified)
  - Platform:         i686:CYGWIN_NT-6.1:1.7.20(0.266/5/3)
  - Compilers:        gcc/g++/gfortran
  - Graphics Library: X11
  - XML output:       Supported
------------------------------------------------------------------

Provided that bps reports 'XML output:    Supported', you can produce csv output directly from bps. To do so, copy the following into a file called 'input.xml', and save that in your model's cfg folder. Run bps, and you should find a file called out.csv in the cfg directory. 

Text to copy into input.xml -----+
                                 |
                                 V

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <apply_style_sheet>false</apply_style_sheet>
  <dump_all_data>true</dump_all_data>
  <enable_xml_wildcards>false</enable_xml_wildcards>
  <hierarchy>tree</hierarchy>
  <report_startup_period_data>false</report_startup_period_data>
  <time_step_averaging>false</time_step_averaging>
</configuration>

                                 ^
                                 |
Text to copy into input.xml -----+


Note that you can also configure H3K reports to filter specific variables, apply time-step averaging, and output to xml or other text-based formats via xslt. These options are described in src/cetc/h3kreports/H3Kreports_Configuration.txt . 

Hope that helps, 

- Alex 



-----Original Message-----
From: esp-r-bounces at lists.strath.ac.uk [mailto:esp-r-bounces at lists.strath.ac.uk] On Behalf Of Amar Seeam
Sent: October 30, 2013 09:57
To: Gian Luca Brunetti
Cc: esp-r at lists.strath.ac.uk
Subject: [esp-r] Re: Scripting and Perl

Thanks,

It's still not clear what command line calls I need for bps to output CSV with a res file.

I have configured input.xml and placed it in the cfg directory, and configured H3K reports, placed a path to xsl directory and selected CSV, but there is no CSV file to be found.

Amar,

On Tue, 2013-10-29 at 16:32 +0000, Gian Luca Brunetti wrote:
> Hi Amar,
> when you'll take at look at Perl after you'll have studied some example shell scripts, you'll see that the input to the shell is (comparatively) easy with Perl, because of Perl's capability of variable interpolation (like Ruby, for instance).
> 
> Basically, you have to print to the shell what you would type to the keyboard.
> 
> The following script for example will move a zone:
> 
> print `prj -file $file -mode script<<YYY
> 
> m
> c
> a
> $zone
> i
> e
> $x_movement $y_movement $z_movement
> y
> $yes_or_no
> -
> y
> c
> -
> -
> -
> -
> -
> -
> -
> -
> YYY
> `;
> 
> The backquotes makes you enter the shell and exit from it.
> 
> The advantage of Perl over, say, Python in this case is that variables are named instead of attributed by position (order); which may make the scripts look clearer.
> 
> About the CSV output with Perl, I think that basically it is a matter of printing (items separated by commas).
> 
> If you already have a table on a file, I think that you may convert it in csv format using regular expressions instead.
> 
> Best regards
> 
> Gian Luca Brunetti
> 
> 
> ________________________________________
> From: esp-r-bounces at lists.strath.ac.uk 
> <esp-r-bounces at lists.strath.ac.uk> on behalf of Amar Seeam 
> <amar.seeam at strath.ac.uk>
> Sent: Tuesday, October 29, 2013 3:42 PM
> To: esp-r at lists.strath.ac.uk
> Subject: [esp-r]  Scripting and Perl
> 
> Hi all,
> 
> I would like some help with scripting. Basically I would like to 
> automate runs based on various .cfg files and output the simulation 
> data in CSV format (for further processing and other perl scripts).
> 
> I have tried to read through the perl scripts in the source branch 
> (tester.pl ) but was wondering if there are any other supporting 
> documentation (...or simpler scripts) for this or if there are 
> specific command line switches I need to instantiate and run bps to 
> generate the CSV files as result output (with user specified columns as well).
> 
> Thanks in advance.
> 
> Amar.
> 
> 
> _______________________________________________
> esp-r mailing list
> esp-r at lists.strath.ac.uk
> http://lists.strath.ac.uk/mailman/listinfo/esp-r



_______________________________________________
esp-r mailing list
esp-r at lists.strath.ac.uk
http://lists.strath.ac.uk/mailman/listinfo/esp-r



More information about the esp-r mailing list