EplusLauncher .Net library online help
EplusLauncher is a .Net library which makes easy to run EnergyPlus simulations from a .Net compatible environment (.Net Framework 4.5+).
EplusLauncher library has been developed for the SABINA project. This project is funded by the research and innovation program Horizon 2020 of the European Union under the Grant No. 731211.
Research paper on the subject:
Gordillo, G.C.; Ruiz, G.R.; Stauffer, Y.; Dasen, S.; Bandera, C.F. EplusLauncher: An API to Perform Complex EnergyPlus Simulations in MATLAB® and C#. Sustainability 2020, 12, 672.
Code developed and maintained by UNAV.
Download
You can download EplusLauncher library here. If you have any questions, please send an email to Germán Ramos
Usage examples:
The easiest way to understand how to use EpLauncher library is to look at the following examples and use the Api Reference:
Example 1
Simple example in C#:
using EplusLauncher;
using System;
namespace EplusLauncherTest
{
class Program
{
private static Launcher Launcher { get; set; }
static void Main(string[] args)
{
Launcher = new Launcher();
Launcher.MaxCores = 0;
Launcher.OutputFolderNumber = 0;
Launcher.JobsLogFile = @"c:\Temp\jobs.csv";
var config = new Configuration();
config.InputFile = @"c:\Temp\template.idf";
config.WeatherFile = @"c:\Temp\weather.epw";
config.RviFile = @"c:\Temp\rviFile.rvi";
config.EnergyPlusFolder = @"c:\EnergyPlus-8-9-0";
config.OutputFolder = @"c:\Temp\OutputJob";
double[] RoofInsulations = { 0.001, 0.02,0.04,0.08,0.15,0.3};
double[] WallInsulations = { 0.001, 0.02, 0.04, 0.10};
double[] ZoneAirflows = { 0, 0.05, 0.1, 0.2};
foreach (var roofInsulation in RoofInsulations)
{
foreach (var wallInsulation in WallInsulations)
{
foreach (var zoneAirflow in ZoneAirflows)
{
var job = new Job(config);
job.AddTags("@@RoofInsulation@@", "@@WallInsulation@@", "@@ZoneAirflow@@");
job.AddValues(roofInsulation, wallInsulation, zoneAirflow);
Launcher.Jobs.Add(job);
}
}
}
Launcher.SimulationCompleted += Simulated;
Launcher.OutputMessageReceived += MessageReceived;
Launcher.JobsFinished += JobsFinished;
Launcher.Run();
}
static void JobsFinished(object sender, EventArgs e)
{
var cleaner = new Cleaner();
cleaner.SetFiles("in.idf", "eplusssz.csv", "eplusmtr.csv", "eplustbl.csv", "epluszsz.csv");
cleaner.SetFilesExtensions("err", "end", "audit", "mtr", "eio", "bnd", "dxf", "shd", "rvaudit", "rvi", "mtd");
cleaner.CleanFromLogFile(Launcher.JobsLogFile);
Console.WriteLine("All done. :)");
Console.ReadKey();
}
static void Simulated(object sender, SimulationCompletedEventArgs e)
{
Console.WriteLine("Simulated " + e.Success + e.SimulationFolder);
if (!e.Success) Launcher.StopSimulations = true;
}
static void MessageReceived(object sender, OutputMessageReceivedEventArgs e)
{
Console.WriteLine($"{e.SimulationFolder}: {e.Message}");
}
}
}
Example 2
Simple example in Matlab:
Main script (launcher.m):
NET.addAssembly('c:\Temp\EplusLauncher.dll');
global Launcher;
Launcher = EplusLauncher.Launcher();
Launcher.MaxCores = 0;
Launcher.OutputFolderNumber = 0;
Launcher.JobsLogFile = 'c:\Temp\jobs.csv';
addlistener(Launcher,'OutputMessageReceived',@EnergyPlusMessage);
addlistener(Launcher,'SimulationCompleted',@SimulationFinished);
addlistener(Launcher,'JobsFinished',@JobsFinished);
config = EplusLauncher.Configuration();
config.InputFile = 'c:\Temp\template.idf';
config.WeatherFile = 'c:\Temp\weather.epw';
config.RviFile = 'c:\Temp\rviFile.rvi';
config.EnergyPlusFolder = 'c:\EnergyPlus-8-9-0';
config.OutputFolder = 'c:\Temp\OutputJob';
RoofInsulations = [0.001, 0.02];%,0.04,0.08,0.15,0.3];
WallInsulations = [0.001, 0.02];%, 0.04, 0.10];
ZoneAirflows = [0];%, 0.05, 0.1, 0.2];
Tags = {'@@RoofInsulation@@', '@@WallInsulation@@', '@@ZoneAirflow@@'};
for roofInsulation = RoofInsulations
for wallInsulation = WallInsulations
for zoneAirflow = ZoneAirflows
job = EplusLauncher.Job(config);
job.AddTags(Tags);
job.AddValues([roofInsulation, wallInsulation, zoneAirflow]);
Launcher.Jobs.Add(job);
end
end
end
Launcher.Run();
Script file (EnergyPlusMessage.m):
function EnergyPlusMessage(~,args)
disp([char(args.SimulationFolder) ': ' char(args.Message)]);
end
Script file (SimulationFinished.m):
function SimulationFinished (~,args)
Result = 'True';
if args.Success == 0
Result = 'False';
end
disp([char(args.SimulationFolder) ' - correct simulation: ' Result])
end
Script file (JobsFinished.m):
function JobsFinished(~,args)
disp('All done. :)');
end