diff --git a/package-lock.json b/package-lock.json
index 0847f8c..62a1e22 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@abi-software/simulationvuer",
- "version": "2.0.0",
+ "version": "2.0.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@abi-software/simulationvuer",
- "version": "2.0.0",
+ "version": "2.0.1",
"license": "Apache-2.0",
"dependencies": {
"@abi-software/plotvuer": "^1.0.0",
diff --git a/package.json b/package.json
index 63aafca..68dd0cb 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@abi-software/simulationvuer",
- "version": "2.0.0",
+ "version": "2.0.1",
"private": false,
"scripts": {
"serve": "vite serve --host",
diff --git a/src/App.vue b/src/App.vue
index 7c00cc9..eb402e9 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -13,10 +13,10 @@
Dataset {{ dataset.id }}: {{ dataset.description }}
- ISAN: {{ dataset.description }} {{ typeof dataset.id }}
+ ISAN: {{ dataset.description }}
-
{{name}}
-
+
{{name}}
+
Input parameters
- Run Simulation
+ Run Simulation
Run on oSPARC
- View Dataset
+ View Dataset
- View Workspace
+ View Workspace
Additional parameters are available on oSPARC
@@ -89,20 +89,12 @@ export default {
type: String,
},
/**
- * The ID of the simulation-based dataset.
+ * The ID of the simulation-based dataset, if it is a number, or the path
+ * to a PMR file, if it is a string.
*/
id: {
required: true,
},
- /**
- * The preferred solver to use for OpenCOR-based simulations. This property
- * is optional and defaults to "oSPARC". The only value that is currently
- * supported is "libOpenCOR". Any other value will default to "oSPARC".
- */
- preferredSolver: {
- type: String,
- default: OSPARC_SOLVER,
- },
},
data: function() {
// Retrieve some information about the dataset.
@@ -140,7 +132,6 @@ export default {
perfectScollbarOptions: {
suppressScrollX: true,
},
- pmrBasedCombineArchive: false,
showUserMessage: false,
simulationResults: {},
simulationResultsId: {},
@@ -216,27 +207,14 @@ export default {
},
/**
* @vuese
- * Run the simulation using libOpenCOR.
+ * Run a PMR-based COMBINE archive using libOpenCOR.
*/
runSimulation() {
if (this.instance === undefined) {
- const fileNameOrUrl = this.pmrBasedCombineArchive ? PMR_URL + this.id : this.simulationUiInfo.simulation.opencor.resource;
- const document = new this.libopencor.SedDocument(toRaw(this.fileManager).file(fileNameOrUrl));
-
- // Customise the ending point and point interval of the simulation, if
- // needed.
-
- if ( !this.pmrBasedCombineArchive
- && (this.simulationUiInfo.simulation.opencor.endingPoint !== undefined)
- && (this.simulationUiInfo.simulation.opencor.pointInterval !== undefined)) {
- const simulation = document.simulations().get(0);
-
- simulation.setOutputEndTime(this.simulationUiInfo.simulation.opencor.endingPoint);
- simulation.setNumberOfSteps(this.simulationUiInfo.simulation.opencor.endingPoint / this.simulationUiInfo.simulation.opencor.pointInterval);
- }
-
// Retrieve an instance of the model.
+ const document = new this.libopencor.SedDocument(toRaw(this.fileManager).file(PMR_URL + this.id));
+
this.instance = document.instantiate();
document.delete();
@@ -301,7 +279,7 @@ export default {
// Make sure that the simulation UI information is valid.
- this.hasValidSimulationUiInfo = validJson(this.simulationUiInfo, !this.pmrBasedCombineArchive);
+ this.hasValidSimulationUiInfo = validJson(this.simulationUiInfo, this.libopencor === undefined);
if (!this.hasValidSimulationUiInfo) {
return;
@@ -310,7 +288,7 @@ export default {
// Retrieve and keep track of the solver to be used for the simulation, if
// needed.
- if (!this.pmrBasedCombineArchive) {
+ if (this.libopencor === undefined) {
this.simulationUiInfo.simulation.solvers.forEach((solver) => {
if ((solver.if === undefined) || evaluateValue(this, solver.if)) {
this.solver = solver;
@@ -330,14 +308,14 @@ export default {
// load libOpenCOR if we are dealing with an OpenCOR-based simulation and
// we want to use libOpenCOR.
- if (this.pmrBasedCombineArchive) {
+ if (this.libopencor !== undefined) {
this.userMessage = "Running the model...";
this.showUserMessage = true;
this.$nextTick(() => {
this.runSimulation();
});
- } else if (this.opencorBasedSimulation && (this.preferredSolver === LIBOPENCOR_SOLVER)) {
+ } else if (this.opencorBasedSimulation && (this.libopencor !== undefined)) {
this.userMessage = "Retrieving and running the model...";
this.showUserMessage = true;
@@ -583,6 +561,16 @@ export default {
];
});
},
+ /**
+ * @vuese
+ * Show an HTTP issue using the given `xmlhttp`.
+ * @arg `xmlhttp`
+ */
+ showHttpIssue(xmlhttp) {
+ this.isSimulationValid = false;
+ this.showUserMessage = false;
+ this.errorMessage = xmlhttp.statusText.toLowerCase() + " (
" + xmlhttp.status + ")";
+ },
/**
* @vuese
* Check the progress of the simulation using the given `data`, a JSON object that contains the simulation job ID,
@@ -623,12 +611,10 @@ export default {
}
} else {
this.showUserMessage = false;
- this.errorMessage = response.description;
+ this.errorMessage = response.description + "QWEQWEQWE";
}
} else {
- this.isSimulationValid = false;
- this.showUserMessage = false;
- this.errorMessage = xmlhttp.statusText.toLowerCase() + " (
" + xmlhttp.status + ")";
+ this.showHttpIssue(xmlhttp);
}
}
};
@@ -664,12 +650,10 @@ export default {
this.checkSimulation(response.data);
} else {
this.showUserMessage = false;
- this.errorMessage = response.description;
+ this.errorMessage = response.description + "ASDASDASD";
}
} else {
- this.isSimulationValid = false;
- this.showUserMessage = false;
- this.errorMessage = xmlhttp.statusText.toLowerCase() + " (
" + xmlhttp.status + ")";
+ this.showHttpIssue(xmlhttp);
}
}
};
@@ -704,7 +688,7 @@ export default {
xmlhttp.send();
});
} else if (this.id !== 0) {
- this.userMessage = "Retrieving OMEX file...";
+ this.userMessage = "Retrieving COMBINE archive from PMR...";
this.showUserMessage = true;
// Retrieve the OMEX file, extract the simulation UI JSON file from it and
@@ -716,24 +700,27 @@ export default {
xmlhttp.open("POST", this.apiLocation + "/pmr_file");
xmlhttp.setRequestHeader("Content-type", "application/json");
xmlhttp.onreadystatechange = () => {
- if ((xmlhttp.readyState === 4) && (xmlhttp.status === 200)) {
- libOpenCOR().then((libopencor) => {
- this.pmrBasedCombineArchive = true;
- this.libopencor = libopencor;
- this.fileManager = this.libopencor.FileManager.instance();
+ if (xmlhttp.readyState === 4) {
+ if (xmlhttp.status === 200) {
+ libOpenCOR().then((libopencor) => {
+ this.libopencor = libopencor;
+ this.fileManager = this.libopencor.FileManager.instance();
- const fileContents = Uint8Array.from(atob(xmlhttp.response), (c) => c.charCodeAt(0));
- const file = this.manageFile(PMR_URL + this.id, fileContents);
+ const fileContents = Uint8Array.from(atob(xmlhttp.response), (c) => c.charCodeAt(0));
+ const file = this.manageFile(PMR_URL + this.id, fileContents);
- const decoder = new TextDecoder();
- const simulationUiInfo = JSON.parse(decoder.decode(file.childFile("simulation.json").contents()));
+ const decoder = new TextDecoder();
+ const simulationUiInfo = JSON.parse(decoder.decode(file.childFile("simulation.json").contents()));
- this.showUserMessage = false;
+ this.showUserMessage = false;
- this.$nextTick(() => {
- this.buildSimulationUi(simulationUiInfo);
+ this.$nextTick(() => {
+ this.buildSimulationUi(simulationUiInfo);
+ });
});
- });
+ } else {
+ this.showUserMessage = false;
+ }
}
};
xmlhttp.send(JSON.stringify({path: this.id}));