[esp-r] Re: Scripting and Perl

Geissler Achim achim.geissler at fhnw.ch
Wed Oct 30 16:51:29 GMT 2013


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



More information about the esp-r mailing list