[esp-r] Re: sed

Gian Luca Brunetti gianluca.brunetti at polimi.it
Fri Jul 3 09:52:16 BST 2015


A very interesting approach indeed. I must try it.

Another solution would be to loop through construction letters and/or 
thicknesses in the  construction database made local.

The drawback would be that to check what has been done a print of the 
shell to a file should be inspected.

The following example is in Perl, but the substance would be almost 
identical in many languages.

Best regards

Gian Luca


!#/usr/bin/perl
my @thicknesses = ( 0.15, 0.20, 0.25 ); # Put here your thicknesses
my $entry = "a"; # Put here the letter of the construction to be changed
my $layer = "a"; # Put here the letter of the layer to be changed
my $your_path_to_config = "./myfolder/cfg/myconfigfile.cfg"; # Put here 
the path to your model configuration file

foreach my $thickness ( @thicknesses )
{
`prj   -file   $your_path_to_config   -mode    text<<YYY
b
e
a
$entry
$layer
n
$thickness
-
-
y
y
-
y
y
-
-
-
-
-
YYY
`;
}


On 03/07/2015 08:42, Achim Geissler wrote:
> Hi Jon,
>
> of course that would be the ideal solution (and was the one chosen
> initially, as far as I understood) - the problem seems to be that this does
> not work via running ESP-r in script (text) mode. Some years ago I had the
> same problem.
>
> @Gian Luca: That sounds like a good trick to try!
>
> 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 Jon Hand
> Gesendet: Freitag, 3. Juli 2015 07:42
> An: gianluca.brunetti at polimi.it; esp-r at lists.strath.ac.uk
> Betreff: [esp-r] Re: sed
>
> One approach....
> Create alternate named constructions. Then use prj's search and replace
> facility to replace construction A with construction B. To check, generate a
> model contents report and see the differences.
> -jon hand
> ________________________________________
> From: esp-r-bounces at lists.strath.ac.uk [esp-r-bounces at lists.strath.ac.uk] on
> behalf of Gian Luca Brunetti [gianluca.brunetti at polimi.it]
> Sent: 02 July 2015 21:23
> To: esp-r at lists.strath.ac.uk
> Subject: [esp-r] Re: sed
>
> Dear Achim and Arianna and list,
> one consideration about the reliability of ESP-r for batch scripting. I
> think that it is more rock-solid when ESP-r is compiled for text mode and
> not compiled for graphics (then launched with the -text mode option). I
> don't know were the difference lies. I have noticed that the two behaviours
> are not identical.
>
> Best regards
>
> Gian Luca Brunetti
>
>
>
>
> On 02/07/2015 20:14, Achim Geissler wrote:
> Dear Arianna,
>
> as I was the one to give you this idea, I guess I will have to give some
> pointers. But keep in mind that this must be considered a hack and you will
> likely need to learn a bit about writing shell scripts. You can find ample
> information and coding examples for sed and bash scripts in the internet.
>
> You have zones named "bath", "bedroom1", "entrance" and so on.
> Correspondingly, you have entries in the .cfg file of the type
>
> *con ../zones/bath.con
> .
> *con ../zones/bedroom1.con
>
> and so on. Now, the sequence (e.g. in a bash shell script which runs your
> model), the lines
>
>        # Change construction file to CON
>        new_bath_con="*con ../zones/bath_${CON}.con  # construction"
>        new_bed1_con="*con ../zones/bedroom1_${CON}.con  # construction"
>        cp ${VAR}.cfg temp.cfg
>        sed 's%.*con ../zones/bath_.*%'"${new_bath_con}"'%
>             s%.*con ../zones/bedroom1_.*%'"${new_bed1_con}"'%' temp.cfg >
> ${VAR}.cfg
>        rm temp.cfg
>
> should replace the existing con file entries (for bath and bedroom1) in .cfg
> by the new ones "bath_${CON}.con" and "bedroom1_${CON}" in the file
> ${VAR}.cfg (I haven't tried this exact example, but other similar ones). The
> "$" stuff are variables in loops inside your bash script. Basically, you
> would need to pre-define your various .con files, e.g. by numbering them
> like bath_1.con, bedroom1_1.con and so on (and the initial .cfg would need
> to have entries of this type!). Via a list
>
> CONLIST="1 2 3"
>
> and the loop
>
> foreach CON in $CONLIST
> do
>
> << here the sed changing is done >>
>
> << here you call bps and do your simulation >>
>
> done
>
> you can run through a series of simulations. I expect many people would
> prefer using python or perl for this.
>
> And, as written before, you of course always have the option of managing a
> row of models - probably quicker first time round, but in the long run
> vastly less elegant and also a lot more prone to errors in my experience. Of
> course, it would be easier if the switching of constructions and other files
> etc. were reliable when running ESP-r in text mode from a script which I
> have also found not to be the case (which originally lead me down the above
> described road).
>
> Best
> Achim
>
>
>
> On 02 Jul 2015, at 16:08, Arianna Sdei
> <<mailto:A.Sdei2 at brighton.ac.uk>A.Sdei2 at brighton.ac.uk<mailto:A.Sdei2 at bright
> on.ac.uk>> wrote:
>
> Dear All,
>
>
>
> have you used sed to modify construction files via scripting? I am having
> troubles when I modify construction files to see the effects of increased
> external insulation. I am not 100% sure that ESP-r is actually recognizing
> the changes I make and I don't trust 100% the results I get at the moment. I
> would like to try sed to make sure that my results are rigorous, let me know
> if you can help.
>
>
>
> Thank you,
> regards.
> Arianna
>
> ___________________________________________________________
> This email has been scanned by MessageLabs' Email Security System on behalf
> of the University of Brighton.
> For more information see <http://www.brighton.ac.uk/is/spam/>
> http://www.brighton.ac.uk/is/spam/
> ___________________________________________________________
> _______________________________________________
> esp-r mailing list
> esp-r at lists.strath.ac.uk<mailto:esp-r at lists.strath.ac.uk>
> http://lists.strath.ac.uk/mailman/listinfo/esp-r
>
> achim.geissler at intergga.ch<mailto:achim.geissler at intergga.ch>
>
>
>
>
>
>
>
> _______________________________________________
> esp-r mailing list
> esp-r at lists.strath.ac.uk<mailto:esp-r at lists.strath.ac.uk>
> http://lists.strath.ac.uk/mailman/listinfo/esp-r
>
>
>
> --
> Gian Luca Brunetti
> dr.arch.
> DAStU
> Politecnico di Milano
> via Bonardi 3
> 20133 Milano
> tel. (+39) 02 2399 5750
>
>
> _______________________________________________
> 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
> .
>


-- 
Gian Luca Brunetti
dr.arch.
DAStU
Politecnico di Milano
via Bonardi 3
20133 Milano
tel. (+39) 02 2399 5750




More information about the esp-r mailing list