[TRNSYS-users] TRNSYS-MATLAB Type 155 multiple sessions

Adam Rysanek amr63 at cam.ac.uk
Tue Feb 28 02:20:23 PST 2012


Dear Hermann,

Many thanks for your e-mail. I had come to the same conclusion as you, 
and also started looking at the Type 155 source with a lot of 
frustration. Soon after my e-mail, though, I very accidentally fell onto 
an alternative solution that has worked for me. The trick to solving the 
problem is partly in your e-mail. However, instead of "engOpen" being 
limited to one "host", in fact it is only limited to one user "session". 
In other words, on a PC (Windows XP/Vista/7) with X numbers of users, 
there can be X number of concurrent TRNSYS-Matlab(Type155) sessions - 
one per user.

Although it would seem troublesome to have to create dummy users in 
order to run TRNSYS-Matlab simultaneously, it is not as hard nor 
impractical as one would think. Below I write an example for my Dell 
T7500 with 12 available processing cores. I am using Windows 7, but I 
believe the process should be similar with other version of Windows.

1) Patch your version of Windows to allow for concurrent user login. 
This is necessary if you are not running Windows Server. The best way to 
find more on this (and download the patch) is to Google: "concurrent 
user Windows <your version>".

2) For every number of desired TRNSYS/Matlab sessions, create a dummy 
user. I called mine: TRN1, TRN2, TRN3, etc... each giving them the same, 
simple password. I have not found a way to automate this process, but 
one must only do it once!

3) For every number of sessions you would like to open, create a task 
for it in Windows Task Scheduler. This can be automated from the command 
prompt using the built-in tool "SCHTASKS". An example command would be:
"schtasks /create /tn /sc onstart TRN1 /tr 'C:\TRNSYS17\Exe\TrnExe.exe 
C:\Model\Model1.dck /n'.
In this command, the task TRN1 is programmed to run only when the 
computer starts. This is just a place-holder. A future command will be 
sent to run the task on-command.

4) Run each task remotely for each user. This can also be automated from 
the command prompt using "PsExec" (there are equivalents for Linux and 
OSX if you want to run your simulations from a separate PC). Google 
"PsExec" for documentation and download instructions. An example syntax 
for running a single TRNSYS run on the local machine: "psexec 
\\localhost -u TRN1 -p TRN 'SCHTASKS /run /tn TRN1' ".

This is the basic procedure, and it will likely need tweaking for 
whatever system you may be operating. However, if the question is 
ultimately whether a single PC can automatically run multiple instances 
of TRNSYS-Matlab, the answer I found is 'yes', and only with a bit of 
extra work.

In my case, I have written a C++ script that automates the configuration 
of my .DCK and Matlab .M files, and automates the management and 
execution of individual tasks.

I hope this guidance helps you and anyone else who wants to tackle this 
problem in the future without editing the Type 155 source.

Cheers,
Adam

-- 
Adam Rysanek, B.ScE., M.Sc.,
PhD Candidate

Energy Efficient Cities initiative | EECi
Department of Engineering
University of Cambridge
Cambridge CB2 1PZ
United Kingdom

Mobile: +44 750 332 3100
Office: +44 1223 748 595
E-mail: amr63 at cam.ac.uk





On 28/02/12 07:40, Hermann Schranzhofer wrote:
> Dear Adam,
>
> We had the same problem a view months ago and found no quick solution. Also the hotline told us that there is no solution available in the near future.
> The problem is that Type155 uses the routine engOpen to launch MatLab, and it seems that engOpen is designed for one instance only on a given host.
> So it would be necessary to modify the source of Type155. I had a quick look at it but found not enough time to do the job and unfortunately I think no one is working on it.
> But if there is anyone out there having a solution or some time to do the programming job we would be very interested.
>
> Best regards,
> Hermann.
>
>
> _______________________________________________________________
>
> DI Dr. mont. Hermann Schranzhofer
> Institut fuer Waermetechnik / Institute of Thermal Engineering
> TU Graz / Graz University of Technology
> Inffeldgasse 25 / B, A-8010 Graz
>
> Tel.: +43 316 873 7314
> mobil: +43 664 60 873 7314
> Fax : +43 316 873 7305
> http://www.iwt.tugraz.at/
> _______________________________________________________________
>
>
> -----Ursprüngliche Nachricht-----
> Von: trnsys-users-bounces at cae.wisc.edu [mailto:trnsys-users-bounces at cae.wisc.edu] Im Auftrag von Adam Rysanek
> Gesendet: Donnerstag, 23. Februar 2012 15:40
> An: trnsys-users at cae.wisc.edu
> Betreff: [TRNSYS-users] TRNSYS-MATLAB Type 155 multiple sessions
>
> Ho all,
>
> I'd be very grateful for any help with this.
> I am trying to find a way to execute multiple sessions of TRNSYS on a single PC.
> Though this is usually a straightforward process, each of my sessions includes a Type 155 link to MATLAB.
> It seems that TRNSYS does not create a new MATLAB session every time I execute a simulation. Thus, I am left with the inability to run TRNSYS-MATLAB sessions in parallel.
>
> Has anyone come across this issue in their work?
> Does anyone know of a fix or a go-around that may include some programming?
>
> Many many thanks!
> Adam
>
> --
> Adam Rysanek, B.ScE., M.Sc.,
> PhD Candidate
>
> Energy Efficient Cities initiative | EECi Department of Engineering University of Cambridge Cambridge CB2 1PZ United Kingdom
>
> Mobile: +44 750 332 3100
> Office: +44 1223 748 595
> E-mail: amr63 at cam.ac.uk
>
> _______________________________________________
> TRNSYS-users mailing list
> TRNSYS-users at cae.wisc.edu
> https://mailman.cae.wisc.edu/listinfo/trnsys-users
>
>
> _______________________________________________
> TRNSYS-users mailing list
> TRNSYS-users at cae.wisc.edu
> https://mailman.cae.wisc.edu/listinfo/trnsys-users


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.onebuilding.org/pipermail/trnsys-users-onebuilding.org/attachments/20120228/83452f07/attachment-0005.htm>


More information about the TRNSYS-users mailing list