I found these links similar to my question. But they are run as part of the plugin.
Standalone application with Petrel and Ocean
How to run a simulation case using CaseRunner function?
My requirement is to call Ocean Petrel API to run eclipse and get the results back to in my application.
Does anybody have any idea?
I have checked this link but this is running as part of the plugin, not outside the Petrel.
I have tried the following code. I am getting null reference exception at SimulationRoot simroot = SimulationRoot.Get(PetrelProject.PrimaryProject);
class Program
{
static void Main(string[] args)
{
try
{
Case MyTest;
CustomCaseRunnerMonitor monit5 = new CustomCaseRunnerMonitor();
SimulationRoot simroot = SimulationRoot.Get(PetrelProject.PrimaryProject);
using (ITransaction trans = DataManager.NewTransaction())
{
trans.Lock(simroot);
MyTest = simroot.Cases.FirstOrDefault();
trans.Commit();
}
CaseRunner cRun = SimulationSystem.GetCaseRunner(MyTest);
cRun.Export();
cRun.Run(monit5);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message.ToString());
}
finally
{
Console.ReadKey();
}
}
}
public class CustomCaseRunnerMonitor : CaseRunnerMonitor
{
//...
public override void RunCompleted()
{
PetrelLogger.InfoOutputWindow("CustomCaseRunnerMonitor is completed!");
}
public override void RunAborted()
{
PetrelLogger.InfoOutputWindow("CustomCaseRunnerMonitor is abroted!");
}
public override void SimulationProgressChanged(int progress)
{
PetrelLogger.InfoOutputWindow("SimulationProgressChanged: " + progress);
}
}