meta data for this page
jEPlus API Examples
[This page is under construction ]
Command-line usage
The shell command:
java -jar jEPlus.jar -help
gives you the following instuctions:
jEPlus (version 1.2) for Windows XP (C) 2010, 2011, Yi Zhang, yizhang@dmu.ac.uk Usage: GUI mode: java [-Xmx1000m] -jar jEPlus.jar Batch mode: java [-Xmx1000m] -jar jEPlus.jar -batch {project_file_name.jep} [n random jobs] Job mode: java [-Xmx1000m] -jar jEPlus.jar -job {project_file_name.jep} -index|-value|-id|-file {job_string_1;...|job_id_1;...|job_file_name} where, {...} required arguement, to be replaced with your own values; [...] optional arguement, to be replaced with your own values; '|' separates alternative options. For example, "java -Xmx1000m -jar jEPlus.jar -batch my_project.jep 1000" executes 1000 randomly selected jobs of the project in my_project.jep; "java -jar jEPlus.jar -job my_project.jep -id G_X-T_4-W_0-P1_11-P2_1-P3_1-P4_0-P5_0-P6_0-P7_0-P8_3-P9_2; G_X-T_3-W_0-P1_0-P2_1-P3_1-P4_0-P5_0-P6_0-P7_0-P8_3-P9_2" executes 2 selected jobs (with the job IDs)of the project; "java -jar jEPlus.jar -job my_project.jep -index job0,0,0,12,2,4,0; job1,0,0,12,2,4,1; job2,0,1,12,2,4,0" creates three jobs with alt_value indexes and run them; "java -jar jEPlus.jar -job my_project.jep -value job0,0,0,135,non-reflective,CAV,24.5" creates one jobs with the specified parameter value and run it. "java -jar jEPlus.jar -job my_project.jep -file my_job_list.txt" creates and executes jobs from the job strings list in the specified file. The job strings in the file must be in -value format and separated by either ';' or end-of-line.
Text in ‘{ … }’ should be replaced with the actual jEPlus project file name and the job strings. The formats of job string will be explained in the next section; different job strings are separated by ‘;’.
On this command, jEPlus starts simulations immediately. When all jobs are completed, extracted results are collected into the ‘SimResults.csv’ file in the output directory specified in the project file. jEPlus then exists normally with a value ‘0’.
Example DOS and Shell scripts
Calling jEPlus from a Java program
The following example shows how to use the jEPlus programming interface in Java language:
// ... ... // load project file JEPlusProject Project = new JEPlusProject (/* "project.jep" */); // create simulation manager EPlusBatch SimManager = new EPlusBatch (null, Project); // Set simulation agent SimManager.setAgent(new EPlusAgentLocal ( Project.getExecSettings())); // specify jobs String [][] jobs = /* array of job strings */; // execute jobs – job string contains values SimManager.runJobSet(jobs); // or if job string contains indexes // SimManager.runJobSet2(jobs); // wait for jobs to finish try { do { Thread.sleep(2000); }while (SimManager.isSimulationRunning()); }catch (InterruptedException iex) { SimManager.getAgent().setStopAgent(true); } // collect simulation results HashMap<String, ArrayList<double []>> Results = SimManager.getSimulationResults(); // ... ...
Here, simulation results can be retrieved directly from the simulation manager instance as a map indexed by the job IDs. A job ID is a unique string that a user must assign to each job as the first part of the job string.