[esp-r] Re: Perl script

victor bunster victorbunster at gmail.com
Thu Jul 29 01:21:03 BST 2010


Thanks Jon, I gonna switch to OS X or a portable Linux...

Victor


On Thu, Jul 29, 2010 at 1:45 AM, Jon Hand <jon at esru.strath.ac.uk> wrote:

>
> Ok, lets jump back here.
>
> XP does not, by default include the csh or bash shell that
> TEST is expecting.  You get the kind of shells used by TEST on Linux or OSX
> or
> Unix or in the Cygwin emulator on XP boxes.
>
> You might also get a minimal shell as part of the MSYS environment
> which can be loaded onto an XP box.  We use MSYS as part of our compile
> environment on Native Windows machines but I have not tried to run
> the TEST script with it.
>
> Also assuming that you can get a command shell you are going to have to
> be running the text version of ESP-r which is found in the bin_text folder
> of the XP ESP-r distribution.
>
> I think we were all assuming that you were working on  a Linux box or
> similar
> because the scripting capabilities of XP is rather minimal.
>
> There is more information about MSYS if you look in the documentation
> about setting up a Native Windows machine for ESP-r development.
>
> -Jon Hand
> ________________________________________
> From: victor bunster [victorbunster at gmail.com]
> Sent: 28 July 2010 13:44
> To: Jon Hand
> Cc: Aizaz Samuel; esp-r at lists.strath.ac.uk; David Garcia
> Subject: Re: [esp-r] Re: Perl script
>
> A newbie question (first time working with the shell), I still can't run
> the TEST file. I'm on the C:/ terminal in windows XP
> I put cd C:\Esru\esp-r\validation\benchmark\QA\model_1.1\cfg and I get into
> the folder. Then ./TEST but it says "... is not recognized as internal or
> external command"
> If I change the file extention it opens in other software (e.g. .txt in the
> notepad), but not in ESP-r
>
>
> On Wed, Jul 28, 2010 at 8:57 AM, Aizaz Samuel <aizaz.a.samuel at strath.ac.uk
> <mailto:aizaz.a.samuel at strath.ac.uk>> wrote:
> My preference for changing geometry would be to alter coordinates in the
> geometry file directly using sed. This in my opinion is simpler than going
> through the interface or a script. Also simulation results could be
> outputted in xml format and interrogated using a style sheet. This method is
> more robust than scripts because an interface change makes the script out of
> date.
>
> Regards,
> Aizaz
> ________________________________________
> From: Jon Hand
> Sent: 28 July 2010 12:15
> To: victor bunster
> Cc: Aizaz Samuel; esp-r at lists.strath.ac.uk<mailto:esp-r at lists.strath.ac.uk>;
> David Garcia
> Subject: RE: [esp-r] Re: Perl script
>
> Given the description below it would probably make more sense
> to create the base case model using the standard interface
> (graphic) facilities of ESP-r and prove that that initial model
> works and that the predictions are ok.
>
> Then (recording each step) the keystrokes needed to navigate the
> interface to the required zone and then edit the vertex X Y Z values
> associated with the window and save and exit (this would be one
> script).
>
> Another script can be used to invoke a standard simulation
> and another script can be invoked to extract specific performance
> data. The invoke standard simulation and extract results scripts
> could be based on the TEST SIMULATE.wc ANALYSE scripts
> that are found in the validation/benchmark/QA/model_1.1/cfg
> folder.  To get a feel for this go into that folder and type in
> the command ./TEST and watch what it does.
>
> One invokes scripts from a standard graphic terminal.  Scripts
> would, of course, have to be given execute attributes via an
> operating system chmod command.
> ________________________________________
> From: victor bunster [victorbunster at gmail.com<mailto:
> victorbunster at gmail.com>]
> Sent: 28 July 2010 11:21
> To: Jon Hand
> Cc: Aizaz Samuel; esp-r at lists.strath.ac.uk<mailto:esp-r at lists.strath.ac.uk>;
> David Garcia
> Subject: Re: [esp-r] Re: Perl script
>
> Thanks Jon, now I'm more clear,
>
> I think working with the text mode and calling the menus with their
> characters should be more than enough.
> But specifically, how do you call that commands with Perl (or the C shell)?
> could you give me a short example?
> For example, how write and run a script that draws a thermal zone and place
> a goup of windows with a for loop.
>
> I'm working in something like this:
> -create one 10x10x10m zone,
> -place one 1x1m window,
> -simulate and read the thermal data,
> -move the window 1m in a random direction
> -simulate, and if better maintaind or else go back.
>
> The idea is to automatize this algorithmic process in order to increase its
> complexity later, but I'm stuck at the basics.
> I'll take a look to the developers API, I'm looking for a software flexible
> enough to code some small procedures combining geometric changes &
> simulation/evaluation and ESP-r looks perfect.
>
> Regards
>
> Victor
>
>
>
>
>
> On Wed, Jul 28, 2010 at 4:21 AM, Jon Hand <jon at esru.strath.ac.uk<mailto:
> jon at esru.strath.ac.uk><mailto:jon at esru.strath.ac.uk<mailto:
> jon at esru.strath.ac.uk>>> wrote:
>
> There is perhaps a misunderstanding about how scripts drive esp-r modules.
>
> ESP-r modules can be invoked in a text-only mode and each of the menus that
> would normally be seen in the graphic mode are selected by a single
> character.
> Essentially, if you can do a task in ESP-r manually what you want to do is
> to capture the sequence of key strokes you used and embed them in a script.
>
> These scripts are not invoking a 'method', they are navigating the
> interface and
> driving the interface to do a specific task (which should work as long as
> the interface
> does not change).
>
> So first become familiar with the ESP-r interface.  It is possible to
> create a model
> from scratch via commands and it is possible to take an existing model and
> alter aspects of the model via commands.  And before going to all of that
> trouble
> it would be useful to consider what the other options are.
>
> There is a so-called META file which is a somewhat compact text file that
> some 3rd party
> software uses to pass information about building to ESP-r.
>
> The ESP-r Developers Guide includes an API for ~hundred subroutines and
> lots of
> other information that might be helpful to you.
>
> What is unclear is the big picture of what it is you are trying to do and
> your goals.
> If you could provide an outline then it might focus the discussion.
>
> -Jon Hand
> ________________________________________
> From: victor bunster [victorbunster at gmail.com<mailto:
> victorbunster at gmail.com><mailto:victorbunster at gmail.com<mailto:
> victorbunster at gmail.com>>]
> Sent: 28 July 2010 01:34
> To: Aizaz Samuel
> Cc: esp-r at lists.strath.ac.uk<mailto:esp-r at lists.strath.ac.uk><mailto:
> esp-r at lists.strath.ac.uk<mailto:esp-r at lists.strath.ac.uk>>; David Garcia;
> Jon Hand
> Subject: Re: [esp-r] Re: Perl script
>
> 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
> <mailto:aizaz.a.samuel at strath.ac.uk><mailto:aizaz.a.samuel at strath.ac.uk
> <mailto:aizaz.a.samuel at strath.ac.uk>><mailto:aizaz.a.samuel at strath.ac.uk
> <mailto:aizaz.a.samuel at strath.ac.uk><mailto:aizaz.a.samuel at strath.ac.uk
> <mailto: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<http://sesg.strath.ac.uk><http://sesg.strath.ac.uk><
> http://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><http://changegeo.pl><
> http://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
> ><mailto:david.garcia-sanchez at emn.fr<mailto:david.garcia-sanchez at emn.fr
> >><mailto:david.garcia-sanchez at emn.fr<mailto:david.garcia-sanchez at emn.fr
> ><mailto:david.garcia-sanchez at emn.fr<mailto:david.garcia-sanchez at emn.fr
> >>><mailto:david.garcia-sanchez at emn.fr<mailto:david.garcia-sanchez at emn.fr
> ><mailto:david.garcia-sanchez at emn.fr<mailto:david.garcia-sanchez at emn.fr
> >><mailto:david.garcia-sanchez at emn.fr<mailto:david.garcia-sanchez at emn.fr
> ><mailto: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/20100729/47d695a8/attachment-0001.html 


More information about the esp-r mailing list