@sdeverywhere/cli 0.7.1 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/c/model.c +7 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdeverywhere/cli",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "description": "Contains the `sde` command line interface for the SDEverywhere tool suite.",
5
5
  "type": "module",
6
6
  "files": [
@@ -11,7 +11,7 @@
11
11
  "sde": "src/main.js"
12
12
  },
13
13
  "dependencies": {
14
- "@sdeverywhere/build": "^0.1.1",
14
+ "@sdeverywhere/build": "^0.2.0",
15
15
  "@sdeverywhere/compile": "^0.7.0",
16
16
  "bufx": "^1.0.5",
17
17
  "byline": "^5.0.0",
package/src/c/model.c CHANGED
@@ -74,7 +74,6 @@ void run() {
74
74
  #endif
75
75
 
76
76
  // Restart fresh output for all steps in this run.
77
- numSavePoints = (size_t)(round((_final_time - _initial_time) / _saveper)) + 1;
78
77
  savePointIndex = 0;
79
78
  outputIndex = 0;
80
79
 
@@ -87,6 +86,13 @@ void run() {
87
86
  while (step <= lastStep) {
88
87
  evalAux();
89
88
  if (fmod(_time, _saveper) < 1e-6) {
89
+ // Note that many Vensim models set `SAVEPER = TIME STEP`, in which case SDE
90
+ // treats `SAVEPER` as an aux rather than a constant. Therefore, we need to
91
+ // initialize `numSavePoints` here, after the first `evalAux` call, to be
92
+ // certain that `_saveper` has been initialized before it is used.
93
+ if (numSavePoints == 0) {
94
+ numSavePoints = (size_t)(round((_final_time - _initial_time) / _saveper)) + 1;
95
+ }
90
96
  outputVarIndex = 0;
91
97
  storeOutputData();
92
98
  savePointIndex++;