protected override void InitializeSinter(IJobConsumerContract job, String workingDir, String config) { if (IsSupported(job) == false) { throw new ArgumentException(String.Format("gPROMS: Found wrong Application {0}", job.ApplicationName)); } sim = new sinter.PSE.sinter_simGPROMS(); sim.workingDir = workingDir; sim.setupFile.parseFile(config); }
/** * createSinter parses part of the setup file passed in (as a string) to discover the * extension of the simulation file provided. * From that extension it creates the correct class for running that type of simulation. **/ public static ISimulation createSinter(string setupFileString) { sinter_SetupFile thisSetupFile = sinter_SetupFile.determineFileTypeAndParse(setupFileString); string extension = System.IO.Path.GetExtension(thisSetupFile.aspenFilename); sinter_Sim thisAspen = null; if (extension == ".bkp" || extension == ".apw") { thisAspen = new sinter_SimAspen(); thisAspen.setupFile = thisSetupFile; } else if (extension == ".acmf") { thisAspen = new sinter_SimACM(); thisAspen.setupFile = thisSetupFile; } else if (extension == ".xlsm" || extension == ".xls" || extension == ".xlsx") { thisAspen = new sinter_SimExcel(); thisAspen.setupFile = thisSetupFile; } else if (extension != null && extension.ToLower() == ".gencrypt") { thisAspen = new sinter.PSE.sinter_simGPROMS(); thisAspen.setupFile = thisSetupFile; } else if (extension != null && extension.ToLower() == ".gPJ") { throw new System.IO.IOException(String.Format( "gPJ is not an allowed extension for sinter simulation run. SimSinter requires a .gENCRYPT file. filename: {1}.", setupFileString)); } else { throw new System.IO.IOException(String.Format( "Unknown Aspen File extension {0} on filename: {1}. Expecting either .bkp or .apw for Aspen+, .acmf for ACM, .xlsm .xls .xlsx for Excel, or .gencrypt for GPROMS", extension, setupFileString)); } if (thisAspen == null) { throw new System.IO.IOException("Failed to create sinter object, reason unknown."); } if (thisAspen is sinter_InteractiveSim) { sinter_InteractiveSim sSim = (sinter_InteractiveSim)thisAspen; sSim.makeIOTree(); } return(thisAspen); }