use of org.vcell.sbmlsim.api.common.VariableList in project vcell by virtualcell.
the class VCellSimService method getVariableList.
public VariableList getVariableList(SimulationHandle simHandle) throws ExecutableException {
Gson gson = new Gson();
Executable exe = new Executable(new String[] { command().getAbsolutePath(), scriptArgDashes + "simhandle", Long.toString(simHandle.remoteId), "varlist" });
int[] expectedReturnCodes = new int[] { 0 };
exe.start(expectedReturnCodes);
VariableList varList = gson.fromJson(exe.getStdoutString(), VariableList.class);
return varList;
}
use of org.vcell.sbmlsim.api.common.VariableList in project vcell by virtualcell.
the class VCellSimServiceTest method test.
@Test
public void test() throws URISyntaxException, Exception {
VCellSimService simService = new VCellSimService();
URL sbmlFileUrl = VCellSimServiceTest.class.getResource("../optoPlexin_PRG_rule_based.xml");
File file = new File(sbmlFileUrl.toURI());
Assert.assertTrue(file.exists());
SBMLModel sbmlModel = new SBMLModel(file);
SimulationSpec simSpec = new SimulationSpec();
SimulationHandle simulationHandle = simService.submit(sbmlModel, simSpec);
long timeMS = System.currentTimeMillis();
while (simService.getStatus(simulationHandle).getSimState() != SimulationState.done && simService.getStatus(simulationHandle).getSimState() != SimulationState.failed) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
long time2MS = System.currentTimeMillis();
if (time2MS - timeMS > 10000) {
fail("timed out after 10 seconds");
}
}
VariableList vars = simService.getVariableList(simulationHandle);
Assert.assertNotNull(vars);
// TODO - Assert more things.
final TimePoints timePoints = simService.getTimePoints(simulationHandle);
Arrays.asList(vars.varInfos).stream().forEach(var -> {
try {
System.out.println(//
var.getVariableDisplayName() + "[0] = " + simService.getSimData(simulationHandle, var, 0));
} catch (Exception exc) {
exc.printStackTrace();
}
});
}
Aggregations