Snippet:Batch run EnergyPlus models from Matlab

From HUES Platform Wiki
Description The file RunDirMulti.bat that ships with EnergyPlus allows all files in a directory to be executed at once. This is most useful for running parallel models on the workstations. The arguments are the weather file name and the number of cores to use. This Matlab code runs all the files in C:\eplus\to_run and waits for them to complete.
Author(s) Ralph Evins
Language Matlab
Tags EnergyPlus
Snippet code fprintf('Running E+...');

curdir = cd; cd('C:\eplus\to_run'); % move to eplus/to_run tic [,out] = system(['RunDirMulti.bat GBR_London.Gatwick.037760_IWEC ' num2str(nparallel)]); % use the multi-processor batch file esc = 0; while esc == 0 % loop until all eplus jobs have completed

   d = dir('C:\eplus\to_run\*.err'); % get all .err files in dir
   if size(d,1) == size(to_run,2), esc = 1; end % if the total matches the number of runs, escape

timetaken = toc; cd(curdir); % move back to home dir fprintf(' Done (%g seconds).\n',timetaken);