[esp-r] Re: esp-r Digest, Vol 87, Issue 16
Amar Seeam
amar.seeam at strath.ac.uk
Wed Oct 30 20:07:50 GMT 2013
Thanks Geissler,
this is exactly what I was looking for.
Amar.
________________________________________
From: esp-r-bounces at lists.strath.ac.uk [esp-r-bounces at lists.strath.ac.uk] on behalf of esp-r-request at lists.strath.ac.uk [esp-r-request at lists.strath.ac.uk]
Sent: Wednesday, October 30, 2013 5:30 PM
To: esp-r at lists.strath.ac.uk
Subject: esp-r Digest, Vol 87, Issue 16
Send esp-r mailing list submissions to
esp-r at lists.strath.ac.uk
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.strath.ac.uk/mailman/listinfo/esp-r
or, via email, send a message with subject or body 'help' to
esp-r-request at lists.strath.ac.uk
You can reach the person managing the list at
esp-r-owner at lists.strath.ac.uk
When replying, please edit your Subject line so it is more specific
than "Re: Contents of esp-r digest..."
Today's Topics:
1. Re: Scripting and Perl (Geissler Achim)
2. Re: Scripting and Perl (Ferguson, Alex)
----------------------------------------------------------------------
Message: 1
Date: Wed, 30 Oct 2013 16:51:29 +0000
From: Geissler Achim <achim.geissler at fhnw.ch>
Subject: [esp-r] Re: Scripting and Perl
To: "esp-r at lists.strath.ac.uk" <esp-r at lists.strath.ac.uk>
Message-ID:
<BC9FF28A18B2A8499742D2B15D1A323A24E21D75 at MXAMU23.adm.ds.fhnw.ch>
Content-Type: text/plain; charset="iso-8859-1"
Dear Amar,
to use xml output, you need to put the input.xml file in the directory from which you fire up ESP-r, not necessarily the cfg folder (however, it has proven good practice to start up ESP-r from the cfg folder on Unix like systems, in any case).
You should then get files "dictionary.out", "out.xml" and "out.csv" if you have defined some <step_variable> xxx </step_variable> output.
If you want to generate csv files via scripting, you must call res from a script, like so:
===
# Expects 3 parameters on call!
#
RESFILE=$1
FILEOUT=$2
ZONE=$3
res -file $RESFILE -mode text >> /dev/null <<ZZZ
# confirm res file
c # Timestep reports
g # performance metrics
* # toggle time output format
a # no mark between days
4 # Select zones
$ZONE
- # exit zone select menu
> # switch output to file
$FILEOUT$ZONE.dat
# confirm title 3rd party graph
^ # change delimiter
e # e comma, c tabulator
h # Heat/cool/humidify
a # Sensible heating load
! # List data
> # switch display to screen ("flush")
- # exit
- # exit tab output
- # Quit res analysis
ZZZ
unset RESFILE
unset FILEOUT
unset ZONE
===
Best
Achim
> -----Urspr?ngliche Nachricht-----
> Von: esp-r-bounces at lists.strath.ac.uk [mailto:esp-r-bounces at lists.strath.ac.uk] Im
> Auftrag von Gian Luca Brunetti
> Gesendet: Mittwoch, 30. Oktober 2013 17:21
> An: Amar Seeam
> Cc: esp-r at lists.strath.ac.uk
> Betreff: [esp-r] Re: Scripting and Perl
>
> I am sorry. I now realize I had not fully understood the question.
>
> I am afraid I cannot be of help about it, since I never used the xml output.
>
> (I usually make a program read the bps-made plain text grt files, spot the
> information I need with regular expressions and push it in memory or print it (in csv
> format or plain text) with a print loop.)
>
> 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: Wednesday, October 30, 2013 2:57 PM
> 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
> _______________________________________________
> esp-r mailing list
> esp-r at lists.strath.ac.uk
> http://lists.strath.ac.uk/mailman/listinfo/esp-r
------------------------------
Message: 2
Date: Wed, 30 Oct 2013 17:15:47 +0000
From: "Ferguson, Alex" <Alex.Ferguson at NRCan-RNCan.gc.ca>
Subject: [esp-r] Re: Scripting and Perl
To: "esp-r at lists.strath.ac.uk" <esp-r at lists.strath.ac.uk>
Message-ID:
<6E91C8562E39DD498E62F5AE4BF7224569B0D99C at S-BSC-MBX3.nrn.nrcan.gc.ca>
Content-Type: text/plain; charset="us-ascii"
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
------------------------------
_______________________________________________
esp-r mailing list
esp-r at lists.strath.ac.uk
http://lists.strath.ac.uk/mailman/listinfo/esp-r
End of esp-r Digest, Vol 87, Issue 16
*************************************
More information about the esp-r
mailing list