Application Integration
Introduction
InterPSS has an open architecture. One can
- Integrate InterPSS components/modules, such InterPSS simulation core engine, into other applications.
- Integrate other open-source libraries InterPSS as plugins to augment its functionality
- Integrate other applications as independent runtime components with InterPSS.
This guide will walk you through integrating an application with InterPSS.
Sample Case
Please Note: The following example uses InterPSS, running in Cmd Line mode, as an external application for demo purpose. You can integrate any Windows, Linux, Unix applications in this way.
InterPSS Custom Run Scripts, Java Code, are used to integrate other applications. In the following example, InterPSS simulation engine is running outside of GEditor as an independent application. The following are key steps:
- Use a custom adapter to export InterPSS object model info to a text file
- Use IpssJavaExec.exec() to launch an outside application, using the generated text file as the input.
- The application's output is then picked up by IntePSS for display.
package <package>; // do not modify this line
import org.interpss.PluginSpringAppContext;
import org.interpss.editor.ui.IOutputTextDialog;
import org.interpss.editor.ui.UISpringAppContext;
import com.interpss.common.msg.IPSSMsgHub;
import com.interpss.simu.ISimuCaseRunner;
import com.interpss.simu.SimuContext;
import com.interpss.simu.io.IpssFileAdapter;
import com.interpss.common.util.IpssJavaExec;
public class <classname> implements ISimuCaseRunner { // do not modify this line
public boolean runCase(SimuContext simuCtx, IPSSMsgHub msg) {
// export interpss object model to a text file using your custom adapter
IpssFileAdapter adapter = PluginSpringAppContext.getCustomFileAdapterByName("Sample File Adapter");
try {
// interpss info save to file output/ipss_export.ipssdat
adapter.save("output/ipss_export.ipssdat", simuCtx, msg);
} catch (Exception e) {
System.err.println(e.toString());
}
// launch an external application
String appRootDir = "c:/eclipse/GEditor/";
String[] args = {
// application is InterPSS itself
appRootDir+"bin/ipssCmd.bat",
// input is the file generated
"-in", appRootDir+"output/ipss_export.ipssdat",
// output file specified
"-out", appRootDir+"output/ipss_export.out"};
IpssJavaExec.exec(args);
return true;
}
// display results
public void displaySummaryResult(SimuContext simuCtx) {
IOutputTextDialog dialog = UISpringAppContext.getOutputTextDialog("Custom Run Output");
// the output from the application is loaded into InterPSS to display
dialog.display("output/ipss_export.out");
}
}
Run Sample Integration Case
- Select any Loadflow project, such as the IEEE-14Bus.ipss. Click the RunScript button.
- Select Java as the scripting language and copy the scripts into the text area.
- Click run, you should see the following output display.