Thanks Jon, now I'm more clear, <br><br>I think working with the text mode and calling the menus with their characters should be more than enough.<br>But specifically, how do you call that commands with Perl (or the C shell)? could you give me a short example?<br>
For example, how write and run a script that draws a thermal zone and place a goup of windows with a for loop.<br><br>I'm working in something like this:<br>-create one 10x10x10m zone, <br>
-place one 1x1m window, <br>
-simulate and read the thermal data, <br>
-move the window 1m in a random direction<br>-simulate, and if better maintaind or else go back.<br><br>The idea is to automatize this algorithmic process in order to increase its complexity later, but I'm stuck at the basics. <br>
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.<br><br>Regards<br><br>Victor<br><br><br><br><br><br><div class="gmail_quote">On Wed, Jul 28, 2010 at 4:21 AM, Jon Hand <span dir="ltr"><<a href="mailto:jon@esru.strath.ac.uk">jon@esru.strath.ac.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
There is perhaps a misunderstanding about how scripts drive esp-r modules.<br>
<br>
ESP-r modules can be invoked in a text-only mode and each of the menus that<br>
would normally be seen in the graphic mode are selected by a single character.<br>
Essentially, if you can do a task in ESP-r manually what you want to do is<br>
to capture the sequence of key strokes you used and embed them in a script.<br>
<br>
These scripts are not invoking a 'method', they are navigating the interface and<br>
driving the interface to do a specific task (which should work as long as the interface<br>
does not change).<br>
<br>
So first become familiar with the ESP-r interface. It is possible to create a model<br>
from scratch via commands and it is possible to take an existing model and<br>
alter aspects of the model via commands. And before going to all of that trouble<br>
it would be useful to consider what the other options are.<br>
<br>
There is a so-called META file which is a somewhat compact text file that some 3rd party<br>
software uses to pass information about building to ESP-r.<br>
<br>
The ESP-r Developers Guide includes an API for ~hundred subroutines and lots of<br>
other information that might be helpful to you.<br>
<br>
What is unclear is the big picture of what it is you are trying to do and your goals.<br>
If you could provide an outline then it might focus the discussion.<br>
<br>
-Jon Hand<br>
________________________________________<br>
From: victor bunster [<a href="mailto:victorbunster@gmail.com">victorbunster@gmail.com</a>]<br>
Sent: 28 July 2010 01:34<br>
To: Aizaz Samuel<br>
Cc: <a href="mailto:esp-r@lists.strath.ac.uk">esp-r@lists.strath.ac.uk</a>; David Garcia; Jon Hand<br>
Subject: Re: [esp-r] Re: Perl script<br>
<div class="im"><br>
Thanks for all the feedback, its helping me a lot.<br>
<br>
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.<br>
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?<br>
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.<br>
<br>
Thanks again,<br>
<br>
Victor<br>
<br>
<br>
<br>
</div><div class="im">On Tue, Jul 27, 2010 at 8:40 PM, Aizaz Samuel <<a href="mailto:aizaz.a.samuel@strath.ac.uk">aizaz.a.samuel@strath.ac.uk</a><mailto:<a href="mailto:aizaz.a.samuel@strath.ac.uk">aizaz.a.samuel@strath.ac.uk</a>>> wrote:<br>
Some instances where scripts have been used in the past:<br>
1. ESP-r modelling of domestic heating systems (ADEPT2 available from<br>
</div><a href="http://sesg.strath.ac.uk" target="_blank">sesg.strath.ac.uk</a><<a href="http://sesg.strath.ac.uk" target="_blank">http://sesg.strath.ac.uk</a>>) has scripts that simulate and list the results into csv<br>
<div><div></div><div class="h5">files that are readable by spreadsheet macros.<br>
2. Simulation of test models that simulate and write out results in pdf<br>
format. These are used for running comparison tests periodically and writing<br>
out a nicely formatted report.<br>
3. Running regression testing that involves subversion commands, forcheck,<br>
compilation, simulation, results analysis and some other software testing<br>
tasks. (Available at<br>
<a href="https://espr.svn.cvsdude.com/esp-r/trunk/tester/scripts/" target="_blank">https://espr.svn.cvsdude.com/esp-r/trunk/tester/scripts/</a>)<br>
<br>
The first two use bash and c shell scripts the last one uses perl<br>
<br>
Regards,<br>
--<br>
Dr Aizaz A Samuel<br>
Department of Mechanical Engineering<br>
University of Strathclyde<br>
M324 James Weir Building<br>
75 Montrose Street<br>
Glasgow, UK<br>
G1 1XJ<br>
<br>
T:+44 141 548 5765<br>
F:+44 141 552 5105<br>
<br>
<br>
On Tuesday 27 July 2010 10:57, David Garcia wrote:<br>
> Normally it should be perl but other users told me that python is more<br>
> useful,<br>
><br>
> Personaly I used PERL, to start programming, I recommend you to read the<br>
> book "Learning Perl" from Randal L.Schwartz,(O'reilly).<br>
><br>
> Normally your perl file should look like this: (FOR YOUR CHANGE GEOMETRY<br>
> SECTION)<br>
><br>
> --------------------------------------------------------------<br>
> $file = $ARGV[0];<br>
> $largo = $ARGV[1];<br>
> $ancho = $ARGV[2];<br>
> $alto = $ARGV[3];<br>
> $angulo = $ARGV[4];<br>
> $base = $largo*$ancho;<br>
><br>
> # Parse the perl sign pound (#)<br>
> $val = "#";<br>
><br>
> # open up MYFILE for writing<br>
> open(MYFILE,">$file");<br>
><br>
> #or die "Can't open up myfile: $file\n"; if we want the file to be readed!<br>
><br>
> # now this line format will automatically apply to MYFILE<br>
> format MYFILE =<br>
> @<geometry of test_zonep defined in: ../zones/test_zonep.geo<br>
> $val<br>
> GEN test_zonep test_zonep describes a for testing in perl # type, name,<br>
> descr 8 6 @###.### # vertices, surfaces, rotation angle $angulo<br>
> @< X co-ord, Y co-ord, Z co-ord<br>
> $val<br>
> 0.00000 0.00000 0.00000 # vert 1<br>
> @###.##### 0.00000 0.00000 # vert 2<br>
> $largo,<br>
> @###.##### @###.##### 0.00000 # vert 3<br>
> $largo, $ancho<br>
> 0.00000 @###.##### 0.00000 # vert 4<br>
> $ancho .... CONTINUE<br>
> ----------------------------------<br>
><br>
> and you can invoke it in linux by type:<br>
><br>
><br>
</div></div>> ./<a href="http://changegeo.pl" target="_blank">changegeo.pl</a><<a href="http://changegeo.pl" target="_blank">http://changegeo.pl</a>><<a href="http://changegeo.pl" target="_blank">http://changegeo.pl</a>> ARGV1 ARGV2 ARGV3<br>
<div class="im">><br>
> then for your SIMULATE option check the cookbook for runing espr in text<br>
> mode.<br>
><br>
> you can so do a for in a bash file, and then take out the value you are<br>
> interested with "awk" (a language like perl) using this command: (FOR YOUR<br>
> EVALUATE SECTION)<br>
><br>
> awk '/Totals/ {print $2 "\n"}' prueba$i.cfg.wc_res.data > TOTAL<br>
><br>
> then put your statement<br>
><br>
> if Total == ValueYouWant<br>
><br>
> Exit for<br>
><br>
> and then voilà! :)<br>
><br>
> Is a little bit rudimentary but I hope this could help you.<br>
><br>
> Regards<br>
><br>
> --<br>
> David GARCIA SANCHEZ<br>
> ------------------------------------------------------------<br>
> Département Systèmes Énergétiques Environnement<br>
> Ecole des Mines de Nantes<br>
> 4, Rue Alfred Kastler<br>
> 44300 Nantes<br>
> France<br>
> ------------------------------------------------------------<br>
</div>> Email: <a href="mailto:david.garcia-sanchez@emn.fr">david.garcia-sanchez@emn.fr</a><mailto:<a href="mailto:david.garcia-sanchez@emn.fr">david.garcia-sanchez@emn.fr</a>><mailto:<a href="mailto:david.garcia-sanchez@emn.fr">david.garcia-sanchez@emn.fr</a><mailto:<a href="mailto:david.garcia-sanchez@emn.fr">david.garcia-sanchez@emn.fr</a>>><br>
<div><div></div><div class="h5">> Tel: +33 (0) 2 51 85 82 14<br>
> Mobile: +33 (0) 6 78 15 08 09<br>
> Fax: +33 (0) 2 51 85 82 99<br>
> ------------------------------------------------------------<br>
<br>
</div></div></blockquote></div><br>