[esp-r] Re: Perl script
Aizaz Samuel
aizaz.a.samuel at strath.ac.uk
Tue Jul 27 11:40:21 BST 2010
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
> ------------------------------------------------------------
More information about the esp-r
mailing list