[esp-r] Re: Perl script

victor bunster victorbunster at gmail.com
Wed Jul 28 01:34:59 BST 2010


Thanks for all the feedback, its helping me a lot.


I have a couple of more basic questions, I'm not used to ESP-r scripting
"environment" (I come from other software with embedded scripting
functionality, like ecotect or rhino). I have noticed that many of the
scripts use the C:\ shell, but I have a couple of problems to advance in
that path.
First, I don't know how to run the software's commands, is there any
document with the methods or an API guide? for example if I want to create a
zone, how do I call that method from inside the shell?
The other question regards the possibility to write longer code, for
example: create a zone, then 10 windows, assign material, etc... all in one
block. I think this should be done in Perl (or Python) but I don't know how
to run it and connected to ESP-r methods.

 Thanks again,

Victor



On Tue, Jul 27, 2010 at 8:40 PM, Aizaz Samuel
<aizaz.a.samuel at strath.ac.uk>wrote:

> Some instances where scripts have been used in the past:
> 1. ESP-r modelling of domestic heating systems (ADEPT2 available from
> sesg.strath.ac.uk) has scripts that simulate and list the results into csv
> files that are readable by spreadsheet macros.
> 2. Simulation of test models that simulate and write out results in pdf
> format. These are used for running comparison tests periodically and
> writing
> out a nicely formatted report.
> 3. Running regression testing that involves subversion commands, forcheck,
> compilation, simulation, results analysis and some other software testing
> tasks. (Available at
> https://espr.svn.cvsdude.com/esp-r/trunk/tester/scripts/)
>
> The first two use bash and c shell scripts the last one uses perl
>
> Regards,
> --
> Dr Aizaz A Samuel
> Department of Mechanical Engineering
> University of Strathclyde
> M324 James Weir Building
> 75 Montrose Street
> Glasgow, UK
> G1 1XJ
>
> T:+44 141 548 5765
> F:+44 141 552 5105
>
>
> On Tuesday 27 July 2010 10:57, David Garcia wrote:
> > Normally it should be perl but other users told me that python is more
> > useful,
> >
> > Personaly I used PERL, to start programming, I recommend you to read the
> > book "Learning Perl" from Randal L.Schwartz,(O'reilly).
> >
> > Normally your perl file should look like this: (FOR YOUR CHANGE GEOMETRY
> > SECTION)
> >
> > --------------------------------------------------------------
> > $file = $ARGV[0];
> > $largo = $ARGV[1];
> > $ancho = $ARGV[2];
> > $alto = $ARGV[3];
> > $angulo = $ARGV[4];
> > $base = $largo*$ancho;
> >
> > # Parse the perl sign pound (#)
> > $val = "#";
> >
> > # open up MYFILE for writing
> > open(MYFILE,">$file");
> >
> > #or die "Can't open up myfile: $file\n"; if we want the file to be
> readed!
> >
> > # now this line format will automatically apply to MYFILE
> > format MYFILE =
> > @<geometry of test_zonep defined in: ../zones/test_zonep.geo
> > $val
> > GEN  test_zonep  test_zonep describes a for testing in perl  # type,
> name,
> > descr 8       6   @###.###    # vertices, surfaces, rotation angle
> $angulo
> > @< X co-ord, Y co-ord, Z co-ord
> > $val
> >       0.00000     0.00000     0.00000  # vert   1
> >    @###.#####     0.00000     0.00000  # vert   2
> >     $largo,
> >    @###.#####  @###.#####     0.00000  # vert   3
> >     $largo,   $ancho
> >       0.00000  @###.#####     0.00000  # vert   4
> >           $ancho  .... CONTINUE
> > ----------------------------------
> >
> > and you can invoke it in linux by type:
> >
> >
> > ./changegeo.pl<http://changegeo.pl> ARGV1 ARGV2 ARGV3
> >
> > then for your SIMULATE option check the cookbook for runing espr in text
> > mode.
> >
> > you can so do a for in a bash file, and then take out the value you are
> > interested with "awk" (a language like perl) using this command: (FOR
> YOUR
> > EVALUATE SECTION)
> >
> > awk '/Totals/ {print $2 "\n"}' prueba$i.cfg.wc_res.data > TOTAL
> >
> > then put your statement
> >
> > if Total == ValueYouWant
> >
> > Exit for
> >
> > and then voilà! :)
> >
> > Is a little bit rudimentary but I hope this could help you.
> >
> > Regards
> >
> > --
> > David GARCIA SANCHEZ
> > ------------------------------------------------------------
> > Département Systèmes Énergétiques Environnement
> > Ecole des Mines de Nantes
> > 4, Rue Alfred Kastler
> > 44300 Nantes
> > France
> > ------------------------------------------------------------
> > Email: david.garcia-sanchez at emn.fr<mailto:david.garcia-sanchez at emn.fr>
> > Tel: +33 (0) 2 51 85 82 14
> > Mobile: +33 (0) 6 78 15 08 09
> > Fax: +33 (0) 2 51 85 82 99
> > ------------------------------------------------------------
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.strath.ac.uk/archives/esp-r/attachments/20100728/f10fab07/attachment-0001.html 


More information about the esp-r mailing list