use of org.vcell.vcellij.SimulationServiceImpl in project vcell by virtualcell.
the class SimulationServiceImplTest method test.
@Test
public void test() throws URISyntaxException, ThriftDataAccessException, TException {
SimulationServiceImpl simService = new SimulationServiceImpl();
// TODO - Eliminate code duplication.
URL sbmlFileUrl = SimulationServiceImplTest.class.getResource("../../sbml/optoPlexin_PRG_rule_based.xml");
File file = new File(sbmlFileUrl.toURI());
VCMongoMessage.enabled = false;
// TODO - Encapsulate this common setup stuff into VCellService initialization.
// Then all VCell-based scripts can focus on the customization below.
System.setProperty(PropertyLoader.installationRoot, new File("..").getAbsolutePath());
ResourceUtil.setNativeLibraryDirectory();
NativeLib.HDF5.load();
file = new File("src/test/resources/org/vcell/sbml/optoPlexin_PRG_rule_based.xml");
Assert.assertTrue(file.exists());
SBMLModel sbmlModel = new SBMLModel(file.getAbsolutePath());
SimulationSpec simSpec = new SimulationSpec();
SimulationInfo simInfo = simService.computeModel(sbmlModel, simSpec);
long timeMS = System.currentTimeMillis();
while (simService.getStatus(simInfo).simState == SimulationState.running) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
long time2MS = System.currentTimeMillis();
if (time2MS - timeMS > 10000) {
fail("timed out after 10 seconds");
}
}
List<VariableInfo> vars = simService.getVariableList(simInfo);
Assert.assertNotNull(vars);
// TODO - Assert more things.
final List<Double> timePoints = simService.getTimePoints(simInfo);
vars.stream().forEach(var -> {
try {
System.out.println(//
var.getVariableDisplayName() + "[0] = " + simService.getData(simInfo, var, 0));
} catch (Exception exc) {
exc.printStackTrace();
}
});
}
use of org.vcell.vcellij.SimulationServiceImpl in project vcell by virtualcell.
the class VCellService method runSimulation.
public Task<List<Dataset>, SimulationState> runSimulation(final VCellModel model, final SimulationSpec simSpec, final List<Species> outputSpecies, final boolean shouldCreateIndividualDatasets) {
try {
final SimulationServiceImpl client = new SimulationServiceImpl();
final Task<List<Dataset>, SimulationState> task = runSimulation(client, model, simSpec, outputSpecies, shouldCreateIndividualDatasets, opService, datasetService);
return task;
} catch (final Throwable e) {
e.printStackTrace();
}
return null;
}
use of org.vcell.vcellij.SimulationServiceImpl in project vcell by virtualcell.
the class VCellService method getSBML.
public SBMLDocument getSBML(final String vcml, final String applicationName) {
try {
final SimulationServiceImpl client = setupClient();
final SBMLDocument document = getSBML(client, vcml, applicationName);
return document;
} catch (final Throwable e) {
e.printStackTrace();
}
return null;
}
Aggregations