├── CLAUDE.md ├── packages ├── cli │ ├── src │ │ ├── c │ │ │ ├── macros.h │ │ │ ├── macros.c │ │ │ ├── model.h │ │ │ └── makefile │ │ └── sde-which.js │ ├── .prettierignore │ └── eslint.config.js ├── compile │ ├── .prettierignore │ ├── tsconfig-test.json │ ├── eslint.config.js │ ├── tsconfig.json │ ├── .npmignore │ ├── src │ │ └── _shared │ │ │ └── read-dat.spec.ts │ └── tsconfig-base.json ├── plugin-vite │ ├── .gitignore │ ├── .prettierignore │ ├── tsconfig-test.json │ ├── src │ │ └── index.ts │ ├── eslint.config.js │ ├── tsconfig-build.json │ ├── tsconfig.json │ ├── tsup.config.ts │ ├── docs │ │ └── functions │ │ │ └── vitePlugin.md │ └── tsconfig-base.json ├── plugin-wasm │ ├── .gitignore │ ├── .prettierignore │ ├── tsconfig-test.json │ ├── src │ │ └── index.ts │ ├── eslint.config.js │ ├── tsconfig-build.json │ ├── tsconfig.json │ ├── tsup.config.ts │ ├── docs │ │ └── functions │ │ │ └── wasmPlugin.md │ └── tsconfig-base.json ├── runtime │ ├── .gitignore │ ├── .prettierignore │ ├── tsconfig-test.json │ ├── src │ │ ├── model-runner │ │ │ └── index.ts │ │ ├── model-scheduler │ │ │ └── index.ts │ │ ├── perf │ │ │ └── index.ts │ │ ├── model-listing │ │ │ └── index.ts │ │ ├── _shared │ │ │ └── index.ts │ │ ├── js-model │ │ │ ├── js-model-constants.ts │ │ │ └── index.ts │ │ ├── runnable-model │ │ │ └── index.ts │ │ ├── wasm-model │ │ │ └── index.ts │ │ ├── index.ts │ │ └── index.spec.ts │ ├── docs │ │ ├── types │ │ │ ├── VarName.md │ │ │ ├── VarId.md │ │ │ ├── InputVarId.md │ │ │ ├── OutputVarId.md │ │ │ ├── SourceName.md │ │ │ ├── ParseError.md │ │ │ ├── DataMap.md │ │ │ ├── SeriesMap.md │ │ │ └── GeneratedModel.md │ │ ├── interfaces │ │ │ ├── Point.md │ │ │ ├── InputCallbacks.md │ │ │ ├── LookupDef.md │ │ │ └── WasmModule.md │ │ └── functions │ │ │ ├── createSynchronousModelRunner.md │ │ │ ├── createInputValue.md │ │ │ └── createLookupDef.md │ ├── eslint.config.js │ ├── tsconfig.json │ ├── tsup.config.ts │ ├── tsconfig-base.json │ └── tsconfig-build.json ├── plugin-check │ ├── .gitignore │ ├── .prettierignore │ ├── template-tests │ │ ├── package.json │ │ └── tsconfig.json │ ├── template-bundle │ │ ├── src │ │ │ ├── index.ts │ │ │ ├── worker.js │ │ │ └── empty-model-spec.ts │ │ └── package.json │ ├── tsconfig-test.json │ ├── src │ │ ├── bundle-spec.ts │ │ └── index.ts │ ├── template-report │ │ ├── package.json │ │ └── src │ │ │ ├── bundles │ │ │ └── unused.txt │ │ │ ├── messages.html │ │ │ ├── env.d.ts │ │ │ ├── global.css │ │ │ ├── empty-test-config.ts │ │ │ └── empty-bundle.ts │ ├── eslint.config.js │ ├── tsconfig-build.json │ ├── tsconfig.json │ ├── docs │ │ └── functions │ │ │ └── checkPlugin.md │ ├── tsup.config.ts │ └── tsconfig-base.json ├── plugin-config │ ├── .gitignore │ ├── template-config │ │ ├── outputs.csv │ │ ├── strings.csv │ │ ├── colors.csv │ │ ├── model.csv │ │ └── inputs.csv │ ├── .prettierignore │ ├── src │ │ ├── __tests__ │ │ │ ├── config1 │ │ │ │ ├── outputs.csv │ │ │ │ ├── strings.csv │ │ │ │ ├── colors.csv │ │ │ │ ├── model.csv │ │ │ │ └── inputs.csv │ │ │ ├── config2 │ │ │ │ ├── outputs.csv │ │ │ │ ├── strings.csv │ │ │ │ ├── colors.csv │ │ │ │ ├── model.csv │ │ │ │ └── inputs.csv │ │ │ └── config3 │ │ │ │ ├── outputs.csv │ │ │ │ ├── strings.csv │ │ │ │ ├── colors.csv │ │ │ │ ├── model.csv │ │ │ │ └── inputs.csv │ │ ├── index.ts │ │ └── read-config.ts │ ├── tsconfig-test.json │ ├── eslint.config.js │ ├── tsconfig-build.json │ ├── tsconfig.json │ ├── tsup.config.ts │ ├── tsconfig-base.json │ └── docs │ │ └── interfaces │ │ └── ConfigProcessorOutputPaths.md ├── plugin-worker │ ├── .gitignore │ ├── .prettierignore │ ├── tsconfig-test.json │ ├── src │ │ ├── index.ts │ │ └── options.ts │ ├── eslint.config.js │ ├── tsconfig-build.json │ ├── tsconfig.json │ ├── docs │ │ ├── functions │ │ │ └── workerPlugin.md │ │ └── interfaces │ │ │ └── WorkerPluginOptions.md │ ├── tsup.config.ts │ ├── template-worker │ │ └── worker.js │ └── tsconfig-base.json ├── runtime-async │ ├── .gitignore │ ├── .prettierignore │ ├── src │ │ └── index.ts │ ├── tsconfig-build.json │ ├── eslint.config.js │ ├── docs │ │ ├── index.md │ │ └── functions │ │ │ └── exposeModelWorker.md │ ├── .typedoc │ │ └── replacements.json │ ├── tsconfig.json │ ├── tsup.config.ts │ └── tsconfig-test.json ├── build │ ├── tests │ │ ├── config │ │ │ ├── sde.config.txt │ │ │ └── sde.config.js │ │ └── _shared │ │ │ ├── sample.mdl │ │ │ ├── submodel2.mdl │ │ │ ├── submodel1.mdl │ │ │ └── build-options.ts │ ├── .prettierignore │ ├── .gitignore │ ├── tsconfig-test.json │ ├── docs │ │ ├── types │ │ │ ├── LogLevel.md │ │ │ ├── VarName.md │ │ │ └── BuildMode.md │ │ ├── interfaces │ │ │ ├── OutputSpec.md │ │ │ ├── BuildResult.md │ │ │ └── BuildOptions.md │ │ └── functions │ │ │ └── build.md │ ├── eslint.config.js │ ├── tsconfig-build.json │ ├── tsconfig.json │ ├── src │ │ ├── _shared │ │ │ └── mode.ts │ │ └── index.ts │ ├── tsup.config.ts │ └── tsconfig-base.json ├── create │ ├── tests │ │ └── fixtures │ │ │ └── non-empty-dir │ │ │ └── packages │ │ │ └── empty-file.txt │ ├── .prettierignore │ ├── .gitignore │ ├── tsconfig-test.json │ ├── src │ │ └── types.d.ts │ ├── tsconfig-build.json │ ├── eslint.config.js │ ├── tsconfig.json │ ├── tsup.config.ts │ ├── bin │ │ └── create-sde.js │ └── tsconfig-base.json ├── parse │ ├── .gitignore │ ├── .prettierignore │ ├── tsconfig-test.json │ ├── eslint.config.js │ ├── tsconfig-build.json │ ├── tsconfig.json │ ├── docs │ │ └── index.md │ ├── tsup.config.ts │ ├── src │ │ ├── index.ts │ │ └── vensim │ │ │ ├── parse-vensim-expr.ts │ │ │ └── parse-vensim-equation.ts │ └── tsconfig-base.json ├── check-core │ ├── .gitignore │ ├── .prettierignore │ ├── tsconfig-test.json │ ├── eslint.config.js │ ├── tsconfig-build.json │ ├── tsconfig.json │ ├── src │ │ ├── comparison │ │ │ └── report │ │ │ │ └── comparison-sort-mode.ts │ │ ├── _shared │ │ │ ├── types.ts │ │ │ ├── combo.spec.ts │ │ │ └── data-source.ts │ │ └── check │ │ │ ├── check-config.ts │ │ │ ├── _mocks │ │ │ └── mock-check-spec.ts │ │ │ ├── check-predicate.ts │ │ │ └── check-action.ts │ ├── tsup.config.ts │ ├── docs │ │ └── index.md │ └── tsconfig-base.json ├── check-ui-shell │ ├── .gitignore │ ├── .prettierignore │ ├── vitest.shims.d.ts │ ├── .storybook │ │ ├── storybook.css │ │ ├── preview-head.html │ │ ├── preview.ts │ │ ├── vitest.setup.ts │ │ └── main.ts │ ├── src │ │ ├── components │ │ │ ├── compare │ │ │ │ ├── _shared │ │ │ │ │ ├── comparison-grouping-kind.ts │ │ │ │ │ └── spans.ts │ │ │ │ ├── summary │ │ │ │ │ └── comparison-summary-section-vm.ts │ │ │ │ └── detail │ │ │ │ │ └── compare-graphs-dataset-vm.ts │ │ │ ├── playground │ │ │ │ ├── wizard-card-inputs-vm.ts │ │ │ │ ├── list-item-vm.ts │ │ │ │ ├── wizard-cards-vm.ts │ │ │ │ ├── sel-list-vm.ts │ │ │ │ └── wizard-card-desc-vm.ts │ │ │ ├── trace │ │ │ │ └── trace-group-vm.ts │ │ │ ├── summary │ │ │ │ └── tab-item-vm.ts │ │ │ ├── graphs │ │ │ │ └── graph-view-config.ts │ │ │ ├── perf │ │ │ │ └── perf-table-row-vm.ts │ │ │ ├── _shared │ │ │ │ ├── close-button.svelte │ │ │ │ ├── keyboard.ts │ │ │ │ ├── reload-button.svelte │ │ │ │ └── click-outside.ts │ │ │ ├── stats │ │ │ │ └── stats-table-row-vm.ts │ │ │ └── bundle │ │ │ │ └── bundle-spec.ts │ │ ├── index.ts │ │ ├── _shared │ │ │ └── user-prefs.ts │ │ ├── _mocks │ │ │ └── mock-data.ts │ │ ├── app-shell.svelte │ │ └── types.d.ts │ ├── eslint.config.js │ ├── tsconfig-build.json │ ├── tsconfig.json │ ├── tsup.config.ts │ ├── docs │ │ └── index.md │ ├── svelte.config.js │ └── tsconfig-test.json └── plugin-deploy │ ├── .prettierignore │ ├── .gitignore │ ├── tsconfig-test.json │ ├── src │ └── index.ts │ ├── eslint.config.js │ ├── tsconfig-build.json │ ├── tsconfig.json │ ├── docs │ ├── functions │ │ └── deployPlugin.md │ └── interfaces │ │ └── BuildProduct.md │ ├── tsup.config.ts │ ├── CHANGELOG.md │ └── tsconfig-base.json ├── examples ├── house-game │ ├── .gitignore │ └── packages │ │ └── app │ │ ├── .gitignore │ │ ├── .prettierignore │ │ ├── src │ │ ├── global.css │ │ └── index.ts │ │ ├── eslint.config.js │ │ ├── index.html │ │ └── svelte.config.js ├── sample-check-bundle │ ├── .gitignore │ ├── .prettierignore │ ├── src │ │ ├── index.ts │ │ └── env.d.ts │ ├── tsconfig-test.json │ ├── eslint.config.js │ ├── tsconfig.json │ ├── README.md │ ├── tsconfig-build.json │ └── tsconfig-base.json ├── sample-check-tests │ ├── .gitignore │ ├── .prettierignore │ ├── tsconfig-test.json │ ├── tsconfig-build.json │ ├── eslint.config.js │ ├── tsconfig.json │ ├── README.md │ └── tsconfig-base.json ├── sir │ ├── config │ │ ├── outputs.csv │ │ ├── strings.csv │ │ ├── colors.csv │ │ ├── model.csv │ │ └── inputs.csv │ ├── .gitignore │ └── model │ │ └── checks │ │ └── checks.yaml ├── template-jquery │ ├── config │ │ ├── outputs.csv │ │ ├── strings.csv │ │ ├── colors.csv │ │ ├── model.csv │ │ └── inputs.csv │ ├── packages │ │ ├── app │ │ │ ├── .gitignore │ │ │ ├── .prettierignore │ │ │ ├── .prettierrc │ │ │ ├── eslint.config.js │ │ │ ├── package.json │ │ │ └── src │ │ │ │ └── dev-overlay.js │ │ └── core │ │ │ ├── vite.config.js │ │ │ ├── .gitignore │ │ │ ├── .prettierignore │ │ │ ├── src │ │ │ └── index.ts │ │ │ ├── .prettierrc │ │ │ ├── eslint.config.js │ │ │ └── tsconfig.json │ ├── .gitignore │ └── model │ │ └── checks │ │ └── checks.yaml ├── template-svelte │ ├── config │ │ ├── outputs.csv │ │ ├── strings.csv │ │ ├── colors.csv │ │ ├── model.csv │ │ └── inputs.csv │ ├── packages │ │ ├── app │ │ │ ├── .gitignore │ │ │ ├── .prettierignore │ │ │ ├── src │ │ │ │ ├── index.ts │ │ │ │ ├── global.css │ │ │ │ └── components │ │ │ │ │ └── selector │ │ │ │ │ └── selector-vm.ts │ │ │ ├── eslint.config.js │ │ │ ├── .vscode │ │ │ │ └── settings.json │ │ │ ├── index.html │ │ │ ├── .prettierrc │ │ │ └── svelte.config.js │ │ └── core │ │ │ ├── vite.config.js │ │ │ ├── .gitignore │ │ │ ├── .prettierignore │ │ │ ├── .prettierrc │ │ │ ├── eslint.config.js │ │ │ ├── src │ │ │ └── index.ts │ │ │ └── tsconfig.json │ ├── .gitignore │ ├── scripts │ │ └── ci-build.js │ ├── .prettierrc │ └── model │ │ └── checks │ │ └── checks.yaml ├── hello-world │ ├── .gitignore │ ├── model │ │ └── sample.mdl │ └── package.json ├── sample-check-app │ ├── .gitignore │ ├── .prettierignore │ ├── tsconfig-test.json │ ├── tsconfig-build.json │ ├── eslint.config.js │ ├── src │ │ └── env.d.ts │ ├── tsconfig.json │ ├── README.md │ ├── svelte.config.js │ ├── tsconfig-base.json │ └── index.html └── template-minimal │ ├── .gitignore │ ├── package.json │ └── model │ └── checks │ └── checks.yaml ├── models ├── directconst │ ├── data │ │ ├── a.csv │ │ ├── b.csv │ │ ├── f.csv │ │ ├── g.csv │ │ ├── c.csv │ │ ├── h.csv │ │ ├── a.xlsx │ │ └── directconst_in.csv │ └── directconst_spec.json ├── directsubs │ ├── c_subs.csv │ ├── b_subs.csv │ └── directsubs.dat ├── longeqns │ ├── longeqns.dat │ ├── longeqns.json │ └── longeqns.mdl ├── directconst_invalidcell │ ├── data │ │ └── c.csv │ └── directconst_invalidcell.dat ├── elmcount │ ├── elmcount.csv │ ├── elmcount.mdl │ └── elmcount.dat ├── sumif │ ├── sumif_spec.json │ ├── sumif_data.dat │ └── sumif.dat ├── comments │ ├── comments.csv │ ├── comments.dat │ ├── expected.mdl │ └── comments_check.sh ├── directdata │ ├── m.csv │ ├── data.xlsx │ ├── e_data.csv │ ├── mt.csv │ ├── directdata_spec.json │ └── g_data.csv ├── extdata │ └── extdata_spec.json ├── getdata │ ├── getdata_spec.json │ └── getdata_data.dat ├── prune │ ├── prune_data.vdfx │ └── prune_spec.json ├── directlookups │ ├── lookups.xlsx │ └── directlookups_spec.json ├── arrays │ └── arrays_spec.json ├── separateall │ ├── separateall_spec.json │ ├── separateall.dat │ └── separateall_check.sh ├── except2 │ └── except2_spec.json ├── package.json ├── allocate │ └── allocate_spec.json ├── specialchars │ ├── specialchars.dat │ └── specialchars.mdl ├── power │ ├── power.dat │ └── power.mdl ├── gamma_ln │ └── gamma_ln.dat ├── subalias │ ├── subalias.dat │ ├── subalias.mdl │ └── subalias_subs.txt ├── ref │ └── ref.dat ├── delayfixed2 │ ├── delayfixed2.csv │ ├── delayfixed2.mdl │ └── delayfixed2.dat ├── multimap │ ├── multimap.mdl │ └── multimap.dat ├── quantum │ └── quantum.dat ├── pulsetrain │ └── pulsetrain.mdl ├── mapping │ ├── mapping.dat │ └── mapping.mdl ├── index │ └── index.dat ├── trig │ └── trig.dat ├── preprocess │ ├── preprocess_check.sh │ └── expected.mdl ├── trend │ └── trend.mdl ├── initial │ └── initial_vars.txt ├── sample │ ├── sample_vars.txt │ └── sample.dat ├── flatten │ └── flatten_check.sh ├── interleaved │ └── interleaved_vars.txt └── same_family_278 │ └── same_family_278.dat ├── .prettierignore ├── tests ├── integration │ ├── ext-control-params │ │ ├── ext-control-params.csv │ │ ├── ext-control-params.mdl │ │ └── package.json │ ├── .gitignore │ ├── saveper │ │ ├── saveper.mdl │ │ ├── sde.config.js │ │ └── package.json │ ├── unicode │ │ ├── unicode.mdl │ │ ├── sde.config.js │ │ └── package.json │ ├── model-check │ │ ├── remote-bundles.json │ │ ├── model-check-test.mdl │ │ └── tests │ │ │ └── support │ │ │ └── fixtures.ts │ ├── game-inputs │ │ ├── game-inputs.mdl │ │ └── package.json │ ├── bundle-exit-code │ │ ├── checks │ │ │ └── checks.yaml │ │ ├── bundle-exit-code.mdl │ │ ├── run-tests.sh │ │ └── package.json │ ├── override-lookups │ │ ├── override-lookups.dat │ │ └── package.json │ └── impl-var-access │ │ └── package.json ├── package.json └── run-c-int-tests ├── .gitignore ├── .prettierrc ├── .release-please-manifest.json ├── pnpm-workspace.yaml ├── scripts └── precommit └── tsconfig-common.json /CLAUDE.md: -------------------------------------------------------------------------------- 1 | @AGENTS.md 2 | -------------------------------------------------------------------------------- /packages/cli/src/c/macros.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/house-game/.gitignore: -------------------------------------------------------------------------------- 1 | sde-prep 2 | -------------------------------------------------------------------------------- /models/directconst/data/a.csv: -------------------------------------------------------------------------------- 1 | a, 2 | ,2050 -------------------------------------------------------------------------------- /examples/sample-check-bundle/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | -------------------------------------------------------------------------------- /examples/sample-check-tests/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | -------------------------------------------------------------------------------- /models/directsubs/c_subs.csv: -------------------------------------------------------------------------------- 1 | DimC,, 2 | C1,C2,C3 -------------------------------------------------------------------------------- /packages/cli/.prettierignore: -------------------------------------------------------------------------------- 1 | CHANGELOG.md 2 | -------------------------------------------------------------------------------- /examples/sample-check-bundle/.prettierignore: -------------------------------------------------------------------------------- 1 | dist 2 | -------------------------------------------------------------------------------- /examples/sample-check-tests/.prettierignore: -------------------------------------------------------------------------------- 1 | dist 2 | -------------------------------------------------------------------------------- /examples/sir/config/outputs.csv: -------------------------------------------------------------------------------- 1 | variable name 2 | -------------------------------------------------------------------------------- /packages/compile/.prettierignore: -------------------------------------------------------------------------------- 1 | CHANGELOG.md 2 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | pnpm-lock.yaml 2 | **/CHANGELOG.md 3 | -------------------------------------------------------------------------------- /models/directsubs/b_subs.csv: -------------------------------------------------------------------------------- 1 | DimB 2 | B1 3 | B2 4 | B3 -------------------------------------------------------------------------------- /models/longeqns/longeqns.dat: -------------------------------------------------------------------------------- 1 | Result 2 | 0 -3 3 | 1 -3 4 | -------------------------------------------------------------------------------- /packages/plugin-vite/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | docs/entry.md 3 | -------------------------------------------------------------------------------- /packages/plugin-wasm/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | docs/entry.md 3 | -------------------------------------------------------------------------------- /packages/runtime/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | docs/entry.md 3 | -------------------------------------------------------------------------------- /examples/template-jquery/config/outputs.csv: -------------------------------------------------------------------------------- 1 | variable name 2 | -------------------------------------------------------------------------------- /examples/template-jquery/packages/app/.gitignore: -------------------------------------------------------------------------------- 1 | public 2 | -------------------------------------------------------------------------------- /examples/template-svelte/config/outputs.csv: -------------------------------------------------------------------------------- 1 | variable name 2 | -------------------------------------------------------------------------------- /examples/template-svelte/packages/app/.gitignore: -------------------------------------------------------------------------------- 1 | public 2 | -------------------------------------------------------------------------------- /models/directconst/data/b.csv: -------------------------------------------------------------------------------- 1 | b, 2 | A1,1 3 | A2,2 4 | A3,3 -------------------------------------------------------------------------------- /packages/plugin-check/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | docs/entry.md 3 | -------------------------------------------------------------------------------- /packages/plugin-config/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | docs/entry.md 3 | -------------------------------------------------------------------------------- /packages/plugin-worker/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | docs/entry.md 3 | -------------------------------------------------------------------------------- /packages/runtime-async/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | docs/entry.md 3 | -------------------------------------------------------------------------------- /examples/sir/config/strings.csv: -------------------------------------------------------------------------------- 1 | id,string 2 | __model_name,SIR 3 | -------------------------------------------------------------------------------- /examples/template-jquery/packages/core/vite.config.js: -------------------------------------------------------------------------------- 1 | // TODO 2 | -------------------------------------------------------------------------------- /examples/template-svelte/packages/core/vite.config.js: -------------------------------------------------------------------------------- 1 | // TODO 2 | -------------------------------------------------------------------------------- /models/directconst/data/f.csv: -------------------------------------------------------------------------------- 1 | f,A2,A3 2 | C1,12,13 3 | C2,22,23 -------------------------------------------------------------------------------- /models/directconst/data/g.csv: -------------------------------------------------------------------------------- 1 | g,C1,C2 2 | C1,11,12 3 | C2,21,22 -------------------------------------------------------------------------------- /packages/build/tests/config/sde.config.txt: -------------------------------------------------------------------------------- 1 | THIS IS NOT A JS FILE 2 | -------------------------------------------------------------------------------- /packages/create/tests/fixtures/non-empty-dir/packages/empty-file.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/parse/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | docs/* 3 | !docs/index.md 4 | -------------------------------------------------------------------------------- /packages/parse/.prettierignore: -------------------------------------------------------------------------------- 1 | dist 2 | docs 3 | CHANGELOG.md 4 | -------------------------------------------------------------------------------- /packages/plugin-config/template-config/outputs.csv: -------------------------------------------------------------------------------- 1 | variable name 2 | -------------------------------------------------------------------------------- /packages/runtime/.prettierignore: -------------------------------------------------------------------------------- 1 | dist 2 | docs 3 | CHANGELOG.md 4 | -------------------------------------------------------------------------------- /examples/hello-world/.gitignore: -------------------------------------------------------------------------------- 1 | baselines 2 | bundles 3 | sde-prep 4 | -------------------------------------------------------------------------------- /examples/sample-check-app/.gitignore: -------------------------------------------------------------------------------- 1 | public 2 | suite-summary.json 3 | -------------------------------------------------------------------------------- /models/directconst/data/c.csv: -------------------------------------------------------------------------------- 1 | c,C1,C2 2 | B1,1,2 3 | B2,3,4 4 | B3,5,6 -------------------------------------------------------------------------------- /packages/check-core/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | docs/* 3 | !docs/index.md 4 | -------------------------------------------------------------------------------- /packages/check-ui-shell/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | docs/* 3 | !docs/index.md 4 | -------------------------------------------------------------------------------- /packages/plugin-check/.prettierignore: -------------------------------------------------------------------------------- 1 | dist 2 | docs 3 | CHANGELOG.md 4 | -------------------------------------------------------------------------------- /packages/plugin-config/.prettierignore: -------------------------------------------------------------------------------- 1 | dist 2 | docs 3 | CHANGELOG.md 4 | -------------------------------------------------------------------------------- /packages/plugin-deploy/.prettierignore: -------------------------------------------------------------------------------- 1 | dist 2 | docs 3 | CHANGELOG.md 4 | -------------------------------------------------------------------------------- /packages/plugin-vite/.prettierignore: -------------------------------------------------------------------------------- 1 | dist 2 | docs 3 | CHANGELOG.md 4 | -------------------------------------------------------------------------------- /packages/plugin-wasm/.prettierignore: -------------------------------------------------------------------------------- 1 | dist 2 | docs 3 | CHANGELOG.md 4 | -------------------------------------------------------------------------------- /packages/plugin-worker/.prettierignore: -------------------------------------------------------------------------------- 1 | dist 2 | docs 3 | CHANGELOG.md 4 | -------------------------------------------------------------------------------- /packages/runtime-async/.prettierignore: -------------------------------------------------------------------------------- 1 | dist 2 | docs 3 | CHANGELOG.md 4 | -------------------------------------------------------------------------------- /examples/house-game/packages/app/.gitignore: -------------------------------------------------------------------------------- 1 | src/model/generated 2 | public 3 | -------------------------------------------------------------------------------- /examples/sample-check-app/.prettierignore: -------------------------------------------------------------------------------- 1 | public 2 | suite-summary.json 3 | -------------------------------------------------------------------------------- /examples/template-jquery/packages/core/.gitignore: -------------------------------------------------------------------------------- 1 | generated 2 | strings 3 | -------------------------------------------------------------------------------- /examples/template-svelte/packages/core/.gitignore: -------------------------------------------------------------------------------- 1 | generated 2 | strings 3 | -------------------------------------------------------------------------------- /models/directconst/data/h.csv: -------------------------------------------------------------------------------- 1 | h, 2 | A,1 3 | B,2 4 | , 5 | C,3 6 | D,4 -------------------------------------------------------------------------------- /packages/build/.prettierignore: -------------------------------------------------------------------------------- 1 | dist 2 | docs 3 | sde-prep 4 | CHANGELOG.md 5 | -------------------------------------------------------------------------------- /packages/check-ui-shell/.prettierignore: -------------------------------------------------------------------------------- 1 | dist 2 | docs 3 | CHANGELOG.md 4 | -------------------------------------------------------------------------------- /packages/create/.prettierignore: -------------------------------------------------------------------------------- 1 | dist 2 | tests/fixtures 3 | CHANGELOG.md 4 | -------------------------------------------------------------------------------- /packages/plugin-config/src/__tests__/config1/outputs.csv: -------------------------------------------------------------------------------- 1 | variable name 2 | -------------------------------------------------------------------------------- /packages/plugin-config/src/__tests__/config2/outputs.csv: -------------------------------------------------------------------------------- 1 | variable name 2 | -------------------------------------------------------------------------------- /packages/plugin-config/src/__tests__/config3/outputs.csv: -------------------------------------------------------------------------------- 1 | variable name 2 | -------------------------------------------------------------------------------- /examples/house-game/packages/app/.prettierignore: -------------------------------------------------------------------------------- 1 | public 2 | src/model/generated 3 | -------------------------------------------------------------------------------- /examples/template-jquery/config/strings.csv: -------------------------------------------------------------------------------- 1 | id,string 2 | __model_name,My Model 3 | -------------------------------------------------------------------------------- /examples/template-jquery/packages/app/.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | public 3 | -------------------------------------------------------------------------------- /examples/template-svelte/config/strings.csv: -------------------------------------------------------------------------------- 1 | id,string 2 | __model_name,My Model 3 | -------------------------------------------------------------------------------- /packages/check-core/.prettierignore: -------------------------------------------------------------------------------- 1 | dist 2 | docs 3 | schema 4 | CHANGELOG.md 5 | -------------------------------------------------------------------------------- /packages/plugin-deploy/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | docs/entry.md 3 | src/__fixtures__ 4 | -------------------------------------------------------------------------------- /models/directconst_invalidcell/data/c.csv: -------------------------------------------------------------------------------- 1 | c,C1,C2 2 | B1,1,2 3 | B2,3,ZERO 4 | B3,5,6 -------------------------------------------------------------------------------- /examples/template-minimal/.gitignore: -------------------------------------------------------------------------------- 1 | baselines 2 | bundles 3 | node_modules 4 | sde-prep 5 | -------------------------------------------------------------------------------- /examples/template-svelte/packages/app/.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | public 3 | dist 4 | -------------------------------------------------------------------------------- /models/elmcount/elmcount.csv: -------------------------------------------------------------------------------- 1 | Months,a,b[A1],b[A2],b[A3] 2 | 0,3,33,33,33 3 | 1,3,33,33,33 4 | -------------------------------------------------------------------------------- /packages/build/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | docs/entry.md 3 | sde-prep 4 | tests/build-prod/outputs 5 | -------------------------------------------------------------------------------- /packages/create/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | tests/fixtures/empty-dir 3 | tests/fixtures/scratch-dir 4 | -------------------------------------------------------------------------------- /tests/integration/ext-control-params/ext-control-params.csv: -------------------------------------------------------------------------------- 1 | initial time,time step 2 | 2000,0.25 3 | -------------------------------------------------------------------------------- /models/sumif/sumif_spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sumif", 3 | "externalDatfiles": ["sumif_data.dat"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/check-ui-shell/vitest.shims.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /packages/cli/src/c/macros.c: -------------------------------------------------------------------------------- 1 | #include "sde.h" 2 | 3 | extern double _time; 4 | extern double _time_step; 5 | -------------------------------------------------------------------------------- /tests/integration/.gitignore: -------------------------------------------------------------------------------- 1 | baselines 2 | bundles 3 | sde-prep 4 | playwright-report 5 | test-results 6 | -------------------------------------------------------------------------------- /examples/sir/.gitignore: -------------------------------------------------------------------------------- 1 | baselines 2 | bundles 3 | node_modules 4 | sde-prep 5 | *.vdf 6 | *.vdfx 7 | *.3vmfx 8 | -------------------------------------------------------------------------------- /models/comments/comments.csv: -------------------------------------------------------------------------------- 1 | Months,a[A1],a[A2],a[A3],b,c,d,e 2 | 0,0,1,2,3,4,8760,42 3 | 1,0,1,2,3,4,8760,42 4 | -------------------------------------------------------------------------------- /examples/house-game/packages/app/src/global.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #222; 3 | color: #f1f1f1; 4 | } 5 | -------------------------------------------------------------------------------- /models/directdata/m.csv: -------------------------------------------------------------------------------- 1 | m,1990,2005,2015,2030,2050 2 | M1,11,12,13,14,15 3 | M2,21,22,23,24,25 4 | M2,31,32,33,34,35 -------------------------------------------------------------------------------- /models/extdata/extdata_spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "extdata", 3 | "externalDatfiles": ["extdata_data.dat"] 4 | } 5 | -------------------------------------------------------------------------------- /models/getdata/getdata_spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "getdata", 3 | "externalDatfiles": ["getdata_data.dat"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/plugin-config/src/__tests__/config1/strings.csv: -------------------------------------------------------------------------------- 1 | id,string 2 | __string_1,String 1 3 | __string_2,String 2 4 | -------------------------------------------------------------------------------- /packages/plugin-config/src/__tests__/config2/strings.csv: -------------------------------------------------------------------------------- 1 | id,string 2 | __string_1,String 1 3 | __string_2,String 2 4 | -------------------------------------------------------------------------------- /packages/plugin-config/src/__tests__/config3/strings.csv: -------------------------------------------------------------------------------- 1 | id,string 2 | __string_1,String 1 3 | __string_2,String 2 4 | -------------------------------------------------------------------------------- /models/directdata/data.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/climateinteractive/SDEverywhere/HEAD/models/directdata/data.xlsx -------------------------------------------------------------------------------- /models/prune/prune_data.vdfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/climateinteractive/SDEverywhere/HEAD/models/prune/prune_data.vdfx -------------------------------------------------------------------------------- /examples/template-jquery/.gitignore: -------------------------------------------------------------------------------- 1 | baselines 2 | bundles 3 | node_modules 4 | sde-prep 5 | *.vdf 6 | *.vdfx 7 | *.3vmfx 8 | -------------------------------------------------------------------------------- /models/directconst/data/a.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/climateinteractive/SDEverywhere/HEAD/models/directconst/data/a.xlsx -------------------------------------------------------------------------------- /models/directdata/e_data.csv: -------------------------------------------------------------------------------- 1 | Year,A1,A2 2 | 1990,610,210 3 | 2005,600,200 4 | 2015,590,190 5 | 2030,593,185 6 | 2050,583,180 -------------------------------------------------------------------------------- /models/directdata/mt.csv: -------------------------------------------------------------------------------- 1 | m,M1,M2,M3 2 | 1990,11,21,31 3 | 2005,12,22,32 4 | 2015,13,23,33 5 | 2030,14,24,34 6 | 2050,15,25,35 -------------------------------------------------------------------------------- /models/directlookups/lookups.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/climateinteractive/SDEverywhere/HEAD/models/directlookups/lookups.xlsx -------------------------------------------------------------------------------- /models/longeqns/longeqns.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "longeqns", 3 | "inputVars": [], 4 | "outputVarNames": ["Time", "Result"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/plugin-config/src/__tests__/config3/colors.csv: -------------------------------------------------------------------------------- 1 | id,hex code,name,comment 2 | black,#000000,black, 3 | blue,#0000ff,blue, 4 | -------------------------------------------------------------------------------- /examples/template-svelte/.gitignore: -------------------------------------------------------------------------------- 1 | artifacts 2 | baselines 3 | bundles 4 | node_modules 5 | sde-prep 6 | *.vdf 7 | *.vdfx 8 | *.3vmfx 9 | -------------------------------------------------------------------------------- /models/directdata/directdata_spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "directdata", 3 | "directData": { 4 | "?data": "data.xlsx" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/plugin-check/template-tests/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "@sdeverywhere/check-core": "^0.1.0" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /packages/plugin-config/template-config/strings.csv: -------------------------------------------------------------------------------- 1 | id,string 2 | __model_name,Model 3 | __string_1,String 1 4 | __string_2,String 2 5 | -------------------------------------------------------------------------------- /models/arrays/arrays_spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Arrays test model", 3 | "inputVarNames": ["inputA[A1]", "inputA[A2]", "inputA[A3]"] 4 | } 5 | -------------------------------------------------------------------------------- /models/directconst/directconst_spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "directconst", 3 | "directData": { 4 | "?a": "data/a.xlsx" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /models/separateall/separateall_spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "specialSeparationDims": { "_a": "_dima" }, 3 | "separateAllVarsWithDims": ["_dimb"] 4 | } 5 | -------------------------------------------------------------------------------- /examples/template-jquery/packages/core/.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | public 3 | dist 4 | src/config/generated 5 | src/model/generated 6 | strings 7 | -------------------------------------------------------------------------------- /examples/template-svelte/packages/core/.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | public 3 | dist 4 | src/config/generated 5 | src/model/generated 6 | strings 7 | -------------------------------------------------------------------------------- /models/directlookups/directlookups_spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "directlookups", 3 | "directData": { 4 | "?lookups": "lookups.xlsx" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /examples/sir/config/colors.csv: -------------------------------------------------------------------------------- 1 | id,hex code,name,comment 2 | blue,#0072b2,, 3 | red,#d33700,, 4 | green,#53bb37,, 5 | gray,#a7a9ac,, 6 | black,#000000,, 7 | -------------------------------------------------------------------------------- /examples/sample-check-bundle/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2022 Climate Interactive / New Venture Fund 2 | 3 | export { createBundle } from './bundle' 4 | -------------------------------------------------------------------------------- /examples/template-jquery/config/colors.csv: -------------------------------------------------------------------------------- 1 | id,hex code,name,comment 2 | blue,#0072b2,, 3 | red,#d33700,, 4 | green,#53bb37,, 5 | gray,#a7a9ac,, 6 | black,#000000,, 7 | -------------------------------------------------------------------------------- /examples/template-svelte/config/colors.csv: -------------------------------------------------------------------------------- 1 | id,hex code,name,comment 2 | blue,#0072b2,, 3 | red,#d33700,, 4 | green,#53bb37,, 5 | gray,#a7a9ac,, 6 | black,#000000,, 7 | -------------------------------------------------------------------------------- /models/sumif/sumif_data.dat: -------------------------------------------------------------------------------- 1 | A Values[A1] 2 | 0 0 3 | 1 10 4 | 2 20 5 | 9 70 6 | 10 80 7 | A Values[A3] 8 | 0 20 9 | 1 30 10 | 2 40 11 | 9 90 12 | 10 100 13 | -------------------------------------------------------------------------------- /packages/plugin-config/template-config/colors.csv: -------------------------------------------------------------------------------- 1 | id,hex code,name,comment 2 | baseline,#000000,black,baseline 3 | current_scenario,#0000ff,blue,current scenario 4 | -------------------------------------------------------------------------------- /examples/sir/config/model.csv: -------------------------------------------------------------------------------- 1 | graph default min time,graph default max time,model dat files,bundle listing,custom lookups,custom outputs 2 | 0,100,,false,false,false 3 | -------------------------------------------------------------------------------- /packages/plugin-check/template-bundle/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2022 Climate Interactive / New Venture Fund 2 | 3 | export { createBundle } from './bundle' 4 | -------------------------------------------------------------------------------- /packages/plugin-config/src/__tests__/config1/colors.csv: -------------------------------------------------------------------------------- 1 | id,hex code,name,comment 2 | baseline,#000000,black,baseline 3 | current_scenario,#0000ff,blue,current scenario 4 | -------------------------------------------------------------------------------- /packages/plugin-config/src/__tests__/config2/colors.csv: -------------------------------------------------------------------------------- 1 | id,hex code,name,comment 2 | baseline,#000000,black,baseline 3 | current_scenario,#0000ff,blue,current scenario 4 | -------------------------------------------------------------------------------- /examples/template-jquery/config/model.csv: -------------------------------------------------------------------------------- 1 | graph default min time,graph default max time,model dat files,bundle listing,custom lookups,custom outputs 2 | 0,100,,false,false,false 3 | -------------------------------------------------------------------------------- /examples/template-svelte/config/model.csv: -------------------------------------------------------------------------------- 1 | graph default min time,graph default max time,model dat files,bundle listing,custom lookups,custom outputs 2 | 0,100,,false,false,false 3 | -------------------------------------------------------------------------------- /packages/build/tsconfig-test.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for testing. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/compile/tsconfig-test.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for testing. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/create/tsconfig-test.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for testing. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/parse/tsconfig-test.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for testing. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/runtime/tsconfig-test.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for testing. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"] 5 | } 6 | -------------------------------------------------------------------------------- /models/except2/except2_spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Except (with explicit set of output variables)", 3 | "inputVarNames": ["input"], 4 | "outputVarNames": ["Time", "z total"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/build/docs/types/LogLevel.md: -------------------------------------------------------------------------------- 1 | [@sdeverywhere/build](../index.md) / LogLevel 2 | 3 | # Type alias: LogLevel 4 | 5 | **LogLevel**: ``"error"`` \| ``"info"`` \| ``"verbose"`` 6 | -------------------------------------------------------------------------------- /packages/check-core/tsconfig-test.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for testing. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/plugin-check/tsconfig-test.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for testing. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/plugin-config/tsconfig-test.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for testing. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/plugin-deploy/tsconfig-test.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for testing. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/plugin-vite/tsconfig-test.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for testing. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/plugin-wasm/tsconfig-test.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for testing. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/plugin-worker/tsconfig-test.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for testing. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"] 5 | } 6 | -------------------------------------------------------------------------------- /tests/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sdeverywhere-tests", 3 | "private": true, 4 | "type": "module", 5 | "dependencies": { 6 | "@sdeverywhere/cli": "workspace:*" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /examples/sample-check-app/tsconfig-test.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for testing. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"] 5 | } 6 | -------------------------------------------------------------------------------- /examples/sample-check-bundle/tsconfig-test.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for testing. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"] 5 | } 6 | -------------------------------------------------------------------------------- /examples/sample-check-tests/tsconfig-test.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for testing. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/cli/eslint.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'eslint/config' 2 | import commonConfig from '../../eslint-config-common.js' 3 | 4 | export default defineConfig(commonConfig) 5 | -------------------------------------------------------------------------------- /packages/plugin-check/src/bundle-spec.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 Climate Interactive / New Venture Fund 2 | 3 | export interface LocalBundleSpec { 4 | name: string 5 | path: string 6 | } 7 | -------------------------------------------------------------------------------- /packages/plugin-check/template-report/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "@sdeverywhere/check-core": "^0.1.0", 4 | "@sdeverywhere/check-ui-shell": "^0.2.0" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/plugin-config/src/__tests__/config2/model.csv: -------------------------------------------------------------------------------- 1 | graph default min time,graph default max time,model dat files,bundle listing,custom lookups,custom outputs 2 | 0,200,,true,true,true 3 | -------------------------------------------------------------------------------- /packages/plugin-config/src/__tests__/config3/model.csv: -------------------------------------------------------------------------------- 1 | graph default min time,graph default max time,model dat files,bundle listing,custom lookups,custom outputs 2 | 0,200,,true,true,true 3 | -------------------------------------------------------------------------------- /examples/template-svelte/packages/app/src/index.ts: -------------------------------------------------------------------------------- 1 | import { mount } from 'svelte' 2 | 3 | import AppShell from './app-shell.svelte' 4 | 5 | mount(AppShell, { 6 | target: document.body 7 | }) 8 | -------------------------------------------------------------------------------- /packages/compile/eslint.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'eslint/config' 2 | import commonConfig from '../../eslint-config-common.js' 3 | 4 | export default defineConfig(commonConfig) 5 | -------------------------------------------------------------------------------- /models/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sdeverywhere-sample-models", 3 | "private": true, 4 | "type": "module", 5 | "dependencies": { 6 | "@sdeverywhere/runtime": "workspace:*" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/build/docs/types/VarName.md: -------------------------------------------------------------------------------- 1 | [@sdeverywhere/build](../index.md) / VarName 2 | 3 | # Type alias: VarName 4 | 5 | **VarName**: `string` 6 | 7 | A variable name as used in the modeling tool. 8 | -------------------------------------------------------------------------------- /packages/check-ui-shell/.storybook/storybook.css: -------------------------------------------------------------------------------- 1 | /* XXX: This is a workaround to fix issue where Docs view was not scrollable */ 2 | #storybook-docs { 3 | overflow: auto; 4 | height: 100vh; 5 | } 6 | -------------------------------------------------------------------------------- /packages/plugin-vite/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 Climate Interactive / New Venture Fund 2 | 3 | export type { VitePluginOptions } from './options' 4 | export { vitePlugin } from './plugin' 5 | -------------------------------------------------------------------------------- /packages/plugin-wasm/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 Climate Interactive / New Venture Fund 2 | 3 | export type { WasmPluginOptions } from './options' 4 | export { wasmPlugin } from './plugin' 5 | -------------------------------------------------------------------------------- /packages/runtime/src/model-runner/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-2022 Climate Interactive / New Venture Fund 2 | 3 | export * from './model-runner' 4 | export * from './synchronous-model-runner' 5 | -------------------------------------------------------------------------------- /packages/plugin-config/template-config/model.csv: -------------------------------------------------------------------------------- 1 | graph default min time,graph default max time,model dat files,bundle listing,custom lookups,custom outputs 2 | 0,100,Data1.dat;Data2.dat,false,false,false 3 | -------------------------------------------------------------------------------- /packages/plugin-worker/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 Climate Interactive / New Venture Fund 2 | 3 | export type { WorkerPluginOptions } from './options' 4 | export { workerPlugin } from './plugin' 5 | -------------------------------------------------------------------------------- /packages/runtime/docs/types/VarName.md: -------------------------------------------------------------------------------- 1 | [@sdeverywhere/runtime](../index.md) / VarName 2 | 3 | # Type alias: VarName 4 | 5 | **VarName**: `string` 6 | 7 | A variable name, as used in the modeling tool. 8 | -------------------------------------------------------------------------------- /models/directdata/g_data.csv: -------------------------------------------------------------------------------- 1 | ,g 2 | 1990,97 3 | 1995,15 4 | 2000,39 5 | 2005,69 6 | 2010,80 7 | 2015,41 8 | 2020,92 9 | 2025,50 10 | 2030,59 11 | 2035,54 12 | 2040,17 13 | 2045,35 14 | 2050,47 -------------------------------------------------------------------------------- /packages/plugin-config/src/__tests__/config1/model.csv: -------------------------------------------------------------------------------- 1 | graph default min time,graph default max time,model dat files,bundle listing,custom lookups,custom outputs 2 | 0,200,Data1.dat;Data2.dat,false,false,false 3 | -------------------------------------------------------------------------------- /packages/runtime/src/model-scheduler/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-2022 Climate Interactive / New Venture Fund 2 | 3 | export * from './model-scheduler' 4 | export * from './multi-context-model-scheduler' 5 | -------------------------------------------------------------------------------- /models/allocate/allocate_spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ALLOCATE AVAILABLE test model", 3 | "outputVarNames": ["Time", "shipments[Boston]", "shipments[Dayton]", "shipments[Fresno]", "total supply available"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/plugin-check/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 Climate Interactive / New Venture Fund 2 | 3 | export type { CheckBundle, CheckPluginOptions } from './options' 4 | export { checkPlugin } from './plugin' 5 | -------------------------------------------------------------------------------- /packages/runtime-async/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-2022 Climate Interactive / New Venture Fund 2 | 3 | export { spawnAsyncModelRunner } from './runner' 4 | 5 | export { exposeModelWorker } from './worker' 6 | -------------------------------------------------------------------------------- /packages/create/src/types.d.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 Climate Interactive / New Venture Fund 2 | 3 | // XXX: Workaround for lack of type declarations for the `compile` package 4 | declare module '@sdeverywhere/compile' 5 | -------------------------------------------------------------------------------- /packages/plugin-deploy/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 Climate Interactive / New Venture Fund 2 | 3 | export type { BuildProduct, DeployPluginOptions } from './options' 4 | export { deployPlugin } from './plugin' 5 | -------------------------------------------------------------------------------- /packages/plugin-check/template-report/src/bundles/unused.txt: -------------------------------------------------------------------------------- 1 | This file is not used but must remain present to ensure that the `template-report/src/bundles` 2 | directory exists. See `vite-config-for-report.ts` for details. 3 | -------------------------------------------------------------------------------- /packages/runtime/docs/types/VarId.md: -------------------------------------------------------------------------------- 1 | [@sdeverywhere/runtime](../index.md) / VarId 2 | 3 | # Type alias: VarId 4 | 5 | **VarId**: `string` 6 | 7 | A variable identifier, as used in model code generated by SDEverywhere. 8 | -------------------------------------------------------------------------------- /models/getdata/getdata_data.dat: -------------------------------------------------------------------------------- 1 | Values[A1] 2 | 0 0 3 | 1 10 4 | 2 20 5 | 9 70 6 | 10 80 7 | Values[A2] 8 | 0 10 9 | 1 20 10 | 2 30 11 | 9 80 12 | 10 90 13 | Values[A3] 14 | 0 20 15 | 1 30 16 | 2 40 17 | 9 90 18 | 10 100 19 | -------------------------------------------------------------------------------- /packages/check-ui-shell/src/components/compare/_shared/comparison-grouping-kind.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Climate Interactive / New Venture Fund 2 | 3 | export type ComparisonGroupingKind = 'views' | 'by-scenario' | 'by-dataset' 4 | -------------------------------------------------------------------------------- /packages/runtime-async/tsconfig-build.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for production builds. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"], 5 | "exclude": ["**/*.spec.ts"] 6 | } 7 | -------------------------------------------------------------------------------- /packages/runtime/src/perf/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Climate Interactive / New Venture Fund 2 | 3 | /** @hidden This is not part of the public API; exposed only for use in performance testing. */ 4 | export * from './perf' 5 | -------------------------------------------------------------------------------- /examples/sample-check-app/tsconfig-build.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for production builds. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"], 5 | "exclude": ["**/*.spec.ts"] 6 | } 7 | -------------------------------------------------------------------------------- /examples/sample-check-tests/tsconfig-build.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for production builds. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"], 5 | "exclude": ["**/*.spec.ts"] 6 | } 7 | -------------------------------------------------------------------------------- /examples/template-jquery/packages/core/src/index.ts: -------------------------------------------------------------------------------- 1 | export type { Series, Point } from '@sdeverywhere/runtime' 2 | export * from './config/generated/spec-types' 3 | export * from './config/config' 4 | export * from './model/model' 5 | -------------------------------------------------------------------------------- /packages/build/eslint.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig, globalIgnores } from 'eslint/config' 2 | import commonConfig from '../../eslint-config-common.js' 3 | 4 | export default defineConfig([globalIgnores(['dist/']), ...commonConfig]) 5 | -------------------------------------------------------------------------------- /packages/parse/eslint.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig, globalIgnores } from 'eslint/config' 2 | import commonConfig from '../../eslint-config-common.js' 3 | 4 | export default defineConfig([globalIgnores(['dist/']), ...commonConfig]) 5 | -------------------------------------------------------------------------------- /examples/template-svelte/packages/app/src/global.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #fafafa; 3 | color: #000; 4 | font-family: sans-serif; 5 | margin: 0; 6 | padding: 0; 7 | height: 100%; 8 | overflow: hidden; 9 | } 10 | -------------------------------------------------------------------------------- /models/specialchars/specialchars.dat: -------------------------------------------------------------------------------- 1 | "100% true" 2 | 0 4 3 | DOLLAR SIGN$ 4 | 0 1 5 | FINAL TIME 6 | 0 1 7 | INITIAL TIME 8 | 0 0 9 | "M&Ms" 10 | 0 3 11 | SAVEPER 12 | 0 1 13 | 1 1 14 | TIME STEP 15 | 0 1 16 | time's up 17 | 0 2 18 | -------------------------------------------------------------------------------- /packages/check-core/eslint.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig, globalIgnores } from 'eslint/config' 2 | import commonConfig from '../../eslint-config-common.js' 3 | 4 | export default defineConfig([globalIgnores(['dist/']), ...commonConfig]) 5 | -------------------------------------------------------------------------------- /packages/runtime/eslint.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig, globalIgnores } from 'eslint/config' 2 | import commonConfig from '../../eslint-config-common.js' 3 | 4 | export default defineConfig([globalIgnores(['dist/']), ...commonConfig]) 5 | -------------------------------------------------------------------------------- /packages/runtime/src/model-listing/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Climate Interactive / New Venture Fund 2 | 3 | /** @hidden This is not part of the public API; exposed only for use in testing tools. */ 4 | export * from './model-listing' 5 | -------------------------------------------------------------------------------- /models/elmcount/elmcount.mdl: -------------------------------------------------------------------------------- 1 | {UTF-8} 2 | DimA: A1, A2, A3 ~~| 3 | a = ELMCOUNT(DimA) ~~| 4 | b[DimA] = 10 * ELMCOUNT(DimA) + a ~~| 5 | 6 | INITIAL TIME = 0 ~~| 7 | FINAL TIME = 1 ~~| 8 | TIME STEP = 1 ~~| 9 | SAVEPER = TIME STEP ~~| 10 | -------------------------------------------------------------------------------- /models/power/power.dat: -------------------------------------------------------------------------------- 1 | a 2 | 0 4 3 | 1 4 4 | b 5 | 0 1.41421 6 | 1 1.41421 7 | base 8 | 0 2 9 | c 10 | 0 2.82843 11 | 1 2.82843 12 | FINAL TIME 13 | 0 1 14 | INITIAL TIME 15 | 0 0 16 | SAVEPER 17 | 0 1 18 | 1 1 19 | TIME STEP 20 | 0 1 21 | -------------------------------------------------------------------------------- /packages/build/tsconfig-build.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for production builds. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"], 5 | "exclude": ["src/**/_mocks/**/*", "**/*.spec.ts"] 6 | } 7 | -------------------------------------------------------------------------------- /packages/check-ui-shell/eslint.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig, globalIgnores } from 'eslint/config' 2 | import commonConfig from '../../eslint-config-common.js' 3 | 4 | export default defineConfig([globalIgnores(['dist/']), ...commonConfig]) 5 | -------------------------------------------------------------------------------- /packages/create/tsconfig-build.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for production builds. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"], 5 | "exclude": ["src/**/_mocks/**/*", "**/*.spec.ts"] 6 | } 7 | -------------------------------------------------------------------------------- /packages/parse/tsconfig-build.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for production builds. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"], 5 | "exclude": ["src/**/_mocks/**/*", "**/*.spec.ts"] 6 | } 7 | -------------------------------------------------------------------------------- /packages/plugin-check/eslint.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig, globalIgnores } from 'eslint/config' 2 | import commonConfig from '../../eslint-config-common.js' 3 | 4 | export default defineConfig([globalIgnores(['dist/']), ...commonConfig]) 5 | -------------------------------------------------------------------------------- /packages/plugin-config/eslint.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig, globalIgnores } from 'eslint/config' 2 | import commonConfig from '../../eslint-config-common.js' 3 | 4 | export default defineConfig([globalIgnores(['dist/']), ...commonConfig]) 5 | -------------------------------------------------------------------------------- /packages/plugin-config/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 Climate Interactive / New Venture Fund 2 | 3 | export type { ConfigProcessorOptions, ConfigProcessorOutputPaths } from './processor' 4 | export { configProcessor } from './processor' 5 | -------------------------------------------------------------------------------- /packages/plugin-deploy/eslint.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig, globalIgnores } from 'eslint/config' 2 | import commonConfig from '../../eslint-config-common.js' 3 | 4 | export default defineConfig([globalIgnores(['dist/']), ...commonConfig]) 5 | -------------------------------------------------------------------------------- /packages/plugin-vite/eslint.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig, globalIgnores } from 'eslint/config' 2 | import commonConfig from '../../eslint-config-common.js' 3 | 4 | export default defineConfig([globalIgnores(['dist/']), ...commonConfig]) 5 | -------------------------------------------------------------------------------- /packages/plugin-wasm/eslint.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig, globalIgnores } from 'eslint/config' 2 | import commonConfig from '../../eslint-config-common.js' 3 | 4 | export default defineConfig([globalIgnores(['dist/']), ...commonConfig]) 5 | -------------------------------------------------------------------------------- /packages/plugin-worker/eslint.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig, globalIgnores } from 'eslint/config' 2 | import commonConfig from '../../eslint-config-common.js' 3 | 4 | export default defineConfig([globalIgnores(['dist/']), ...commonConfig]) 5 | -------------------------------------------------------------------------------- /packages/runtime-async/eslint.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig, globalIgnores } from 'eslint/config' 2 | import commonConfig from '../../eslint-config-common.js' 3 | 4 | export default defineConfig([globalIgnores(['dist/']), ...commonConfig]) 5 | -------------------------------------------------------------------------------- /examples/sample-check-app/eslint.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig, globalIgnores } from 'eslint/config' 2 | import commonConfig from '../../eslint-config-common.js' 3 | 4 | export default defineConfig([globalIgnores(['public/']), ...commonConfig]) 5 | -------------------------------------------------------------------------------- /examples/sample-check-bundle/eslint.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig, globalIgnores } from 'eslint/config' 2 | import commonConfig from '../../eslint-config-common.js' 3 | 4 | export default defineConfig([globalIgnores(['dist/']), ...commonConfig]) 5 | -------------------------------------------------------------------------------- /examples/sample-check-tests/eslint.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig, globalIgnores } from 'eslint/config' 2 | import commonConfig from '../../eslint-config-common.js' 3 | 4 | export default defineConfig([globalIgnores(['dist/']), ...commonConfig]) 5 | -------------------------------------------------------------------------------- /packages/check-core/tsconfig-build.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for production builds. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"], 5 | "exclude": ["src/**/_mocks/**/*", "**/*.spec.ts"] 6 | } 7 | -------------------------------------------------------------------------------- /packages/cli/src/c/model.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | double roundToSignificantFigures(double num, int n); 8 | double print6(double num); 9 | 10 | #ifdef __cplusplus 11 | } 12 | #endif 13 | -------------------------------------------------------------------------------- /packages/plugin-vite/tsconfig-build.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for production builds. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"], 5 | "exclude": ["src/**/_mocks/**/*", "**/*.spec.ts"] 6 | } 7 | -------------------------------------------------------------------------------- /packages/plugin-wasm/tsconfig-build.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for production builds. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"], 5 | "exclude": ["src/**/_mocks/**/*", "**/*.spec.ts"] 6 | } 7 | -------------------------------------------------------------------------------- /packages/runtime/docs/types/InputVarId.md: -------------------------------------------------------------------------------- 1 | [@sdeverywhere/runtime](../index.md) / InputVarId 2 | 3 | # Type alias: InputVarId 4 | 5 | **InputVarId**: `string` 6 | 7 | An input variable identifier, as used in model code generated by SDEverywhere. 8 | -------------------------------------------------------------------------------- /examples/template-jquery/packages/app/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "arrowParens": "avoid", 3 | "bracketSpacing": true, 4 | "printWidth": 120, 5 | "semi": false, 6 | "singleQuote": true, 7 | "tabWidth": 2, 8 | "trailingComma": "none" 9 | } 10 | -------------------------------------------------------------------------------- /examples/template-jquery/packages/core/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "arrowParens": "avoid", 3 | "bracketSpacing": true, 4 | "printWidth": 120, 5 | "semi": false, 6 | "singleQuote": true, 7 | "tabWidth": 2, 8 | "trailingComma": "none" 9 | } 10 | -------------------------------------------------------------------------------- /examples/template-svelte/packages/core/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "arrowParens": "avoid", 3 | "bracketSpacing": true, 4 | "printWidth": 120, 5 | "semi": false, 6 | "singleQuote": true, 7 | "tabWidth": 2, 8 | "trailingComma": "none" 9 | } 10 | -------------------------------------------------------------------------------- /models/elmcount/elmcount.dat: -------------------------------------------------------------------------------- 1 | a 2 | 0 3 3 | 1 3 4 | b[A1] 5 | 0 33 6 | 1 33 7 | b[A2] 8 | 0 33 9 | 1 33 10 | b[A3] 11 | 0 33 12 | 1 33 13 | FINAL TIME 14 | 0 1 15 | INITIAL TIME 16 | 0 0 17 | SAVEPER 18 | 0 1 19 | 1 1 20 | TIME STEP 21 | 0 1 22 | -------------------------------------------------------------------------------- /packages/check-ui-shell/tsconfig-build.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for production builds. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"], 5 | "exclude": ["src/**/_test/**/*", "**/*.spec.ts"] 6 | } 7 | -------------------------------------------------------------------------------- /packages/create/eslint.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig, globalIgnores } from 'eslint/config' 2 | import commonConfig from '../../eslint-config-common.js' 3 | 4 | export default defineConfig([globalIgnores(['dist/', 'tests/fixtures/']), ...commonConfig]) 5 | -------------------------------------------------------------------------------- /packages/plugin-check/tsconfig-build.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for production builds. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"], 5 | "exclude": ["src/**/_mocks/**/*", "**/*.spec.ts"] 6 | } 7 | -------------------------------------------------------------------------------- /packages/plugin-config/tsconfig-build.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for production builds. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"], 5 | "exclude": ["src/**/_mocks/**/*", "**/*.spec.ts"] 6 | } 7 | -------------------------------------------------------------------------------- /packages/plugin-worker/tsconfig-build.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for production builds. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"], 5 | "exclude": ["src/**/_mocks/**/*", "**/*.spec.ts"] 6 | } 7 | -------------------------------------------------------------------------------- /packages/runtime/docs/types/OutputVarId.md: -------------------------------------------------------------------------------- 1 | [@sdeverywhere/runtime](../index.md) / OutputVarId 2 | 3 | # Type alias: OutputVarId 4 | 5 | **OutputVarId**: `string` 6 | 7 | An output variable identifier, as used in model code generated by SDEverywhere. 8 | -------------------------------------------------------------------------------- /packages/runtime/docs/types/SourceName.md: -------------------------------------------------------------------------------- 1 | [@sdeverywhere/runtime](../index.md) / SourceName 2 | 3 | # Type alias: SourceName 4 | 5 | **SourceName**: `string` 6 | 7 | The name of a data source for external/static datasets, e.g., 'Ref', 'Constants'. 8 | -------------------------------------------------------------------------------- /examples/sample-check-app/src/env.d.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Climate Interactive / New Venture Fund 2 | 3 | // These values are injected by Vite at build time, so we need to 4 | // declare types for them here 5 | declare const __SUITE_SUMMARY_JSON__: string 6 | -------------------------------------------------------------------------------- /examples/template-jquery/packages/app/eslint.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig, globalIgnores } from 'eslint/config' 2 | import commonConfig from '../../eslint-config-common.js' 3 | 4 | export default defineConfig([globalIgnores(['public/']), ...commonConfig]) 5 | -------------------------------------------------------------------------------- /examples/template-svelte/packages/app/eslint.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig, globalIgnores } from 'eslint/config' 2 | import commonConfig from '../../eslint-config-common.js' 3 | 4 | export default defineConfig([globalIgnores(['public/']), ...commonConfig]) 5 | -------------------------------------------------------------------------------- /models/gamma_ln/gamma_ln.dat: -------------------------------------------------------------------------------- 1 | a 2 | 0 12.8018 3 | 1 12.8018 4 | b 5 | 0 0.572365 6 | 1 0.572365 7 | c 8 | 0 -3.41362e-11 9 | 1 -3.41362e-11 10 | FINAL TIME 11 | 0 1 12 | INITIAL TIME 13 | 0 0 14 | SAVEPER 15 | 0 1 16 | 1 1 17 | TIME STEP 18 | 0 1 19 | -------------------------------------------------------------------------------- /models/power/power.mdl: -------------------------------------------------------------------------------- 1 | {UTF-8} 2 | base = 2 ~~| 3 | a = POWER(base, 2) ~~| 4 | b = POWER(base, 0.5) ~~| 5 | c = POWER(base, 1.5) ~~| 6 | 7 | INITIAL TIME = 0 ~~| 8 | FINAL TIME = 1 ~~| 9 | TIME STEP = 1 ~~| 10 | SAVEPER = TIME STEP ~~| 11 | -------------------------------------------------------------------------------- /models/specialchars/specialchars.mdl: -------------------------------------------------------------------------------- 1 | {UTF-8} 2 | DOLLAR SIGN$ = 1 ~~| 3 | time's up = 2 ~~| 4 | "M&Ms" = 3 ~~| 5 | "100% true" = 4 ~~| 6 | 7 | INITIAL TIME = 0 ~~| 8 | FINAL TIME = 1 ~~| 9 | TIME STEP = 1 ~~| 10 | SAVEPER = TIME STEP ~~| 11 | -------------------------------------------------------------------------------- /models/subalias/subalias.dat: -------------------------------------------------------------------------------- 1 | e[F1] 2 | 0 10 3 | e[F2] 4 | 0 20 5 | e[F3] 6 | 0 30 7 | f[F1] 8 | 0 1 9 | f[F2] 10 | 0 2 11 | f[F3] 12 | 0 3 13 | FINAL TIME 14 | 0 1 15 | INITIAL TIME 16 | 0 0 17 | SAVEPER 18 | 0 1 19 | 1 1 20 | TIME STEP 21 | 0 1 22 | -------------------------------------------------------------------------------- /packages/runtime/docs/types/ParseError.md: -------------------------------------------------------------------------------- 1 | [@sdeverywhere/runtime](../index.md) / ParseError 2 | 3 | # Type alias: ParseError 4 | 5 | **ParseError**: ``"invalid-point-count"`` 6 | 7 | Indicates the type of error encountered when parsing an outputs buffer. 8 | -------------------------------------------------------------------------------- /models/comments/comments.dat: -------------------------------------------------------------------------------- 1 | a[A1] 2 | 0 0 3 | a[A2] 4 | 0 1 5 | a[A3] 6 | 0 2 7 | b 8 | 0 3 9 | c 10 | 0 4 11 | d 12 | 0 8760 13 | e 14 | 0 42 15 | 1 42 16 | FINAL TIME 17 | 0 1 18 | INITIAL TIME 19 | 0 0 20 | SAVEPER 21 | 0 1 22 | TIME STEP 23 | 0 1 24 | -------------------------------------------------------------------------------- /packages/plugin-check/template-bundle/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "@sdeverywhere/check-core": "^0.1.0", 4 | "@sdeverywhere/runtime": "^0.2.0", 5 | "@sdeverywhere/runtime-async": "^0.2.0", 6 | "assert-never": "^1.2.1" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/runtime-async/docs/index.md: -------------------------------------------------------------------------------- 1 | # @sdeverywhere/runtime-async 2 | 3 | ## Main Thread 4 | 5 | - [spawnAsyncModelRunner](functions/spawnAsyncModelRunner.md) 6 | 7 | ## Worker Thread 8 | 9 | - [exposeModelWorker](functions/exposeModelWorker.md) 10 | -------------------------------------------------------------------------------- /packages/runtime/src/_shared/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-2022 Climate Interactive / New Venture Fund 2 | 3 | export * from './types' 4 | export * from './inputs' 5 | export * from './outputs' 6 | export * from './var-indices' 7 | export * from './lookup-def' 8 | -------------------------------------------------------------------------------- /packages/runtime-async/.typedoc/replacements.json: -------------------------------------------------------------------------------- 1 | [ 2 | ["`ModelRunner`", "[`ModelRunner`](../../../runtime/docs/interfaces/ModelRunner.md)"], 3 | ["`WasmModelInitResult`", "[`WasmModelInitResult`](../../../runtime/docs/interfaces/WasmModelInitResult.md)"] 4 | ] 5 | -------------------------------------------------------------------------------- /models/separateall/separateall.dat: -------------------------------------------------------------------------------- 1 | a[A1] 2 | 0 42 3 | 1 42 4 | a[A2] 5 | 0 42 6 | 1 42 7 | b[B1] 8 | 0 42 9 | 1 42 10 | b[B2] 11 | 0 42 12 | 1 42 13 | c 14 | 0 42 15 | FINAL TIME 16 | 0 1 17 | INITIAL TIME 18 | 0 0 19 | SAVEPER 20 | 0 1 21 | 1 1 22 | TIME STEP 23 | 0 1 24 | -------------------------------------------------------------------------------- /packages/build/tests/_shared/sample.mdl: -------------------------------------------------------------------------------- 1 | {UTF-8} 2 | 3 | X = TIME ~~| 4 | 5 | Y = 0 6 | ~ [-10,10,0.1] 7 | ~ 8 | | 9 | 10 | Z = X + Y 11 | ~~| 12 | 13 | INITIAL TIME = 2000 ~~| 14 | FINAL TIME = 2100 ~~| 15 | TIME STEP = 1 ~~| 16 | SAVEPER = TIME STEP ~~| 17 | -------------------------------------------------------------------------------- /packages/build/tsconfig.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for local development and testing. 2 | // It is used as the TypeScript config for tools like VSCode that look for 3 | // `tsconfig.json` by default. 4 | { 5 | "extends": "./tsconfig-test.json" 6 | } 7 | -------------------------------------------------------------------------------- /packages/check-ui-shell/src/components/playground/wizard-card-inputs-vm.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 Climate Interactive / New Venture Fund 2 | 3 | import type { Writable } from 'svelte/store' 4 | 5 | export interface WizardCardInputsViewModel { 6 | todo: Writable 7 | } 8 | -------------------------------------------------------------------------------- /packages/compile/tsconfig.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for local development and testing. 2 | // It is used as the TypeScript config for tools like VSCode that look for 3 | // `tsconfig.json` by default. 4 | { 5 | "extends": "./tsconfig-test.json" 6 | } 7 | -------------------------------------------------------------------------------- /packages/create/tsconfig.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for local development and testing. 2 | // It is used as the TypeScript config for tools like VSCode that look for 3 | // `tsconfig.json` by default. 4 | { 5 | "extends": "./tsconfig-test.json" 6 | } 7 | -------------------------------------------------------------------------------- /packages/parse/tsconfig.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for local development and testing. 2 | // It is used as the TypeScript config for tools like VSCode that look for 3 | // `tsconfig.json` by default. 4 | { 5 | "extends": "./tsconfig-test.json" 6 | } 7 | -------------------------------------------------------------------------------- /packages/plugin-deploy/tsconfig-build.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for production builds. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"], 5 | "exclude": ["src/**/_mocks/**/*", "src/**/__fixtures__/**/*", "**/*.spec.ts"] 6 | } 7 | -------------------------------------------------------------------------------- /packages/runtime/docs/types/DataMap.md: -------------------------------------------------------------------------------- 1 | [@sdeverywhere/runtime](../index.md) / DataMap 2 | 3 | # Type alias: DataMap 4 | 5 | **DataMap**: `Map`<[`SourceName`](SourceName.md), [`SeriesMap`](SeriesMap.md)\> 6 | 7 | Type alias for a map that holds data for a given source name. 8 | -------------------------------------------------------------------------------- /packages/runtime/tsconfig.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for local development and testing. 2 | // It is used as the TypeScript config for tools like VSCode that look for 3 | // `tsconfig.json` by default. 4 | { 5 | "extends": "./tsconfig-test.json" 6 | } 7 | -------------------------------------------------------------------------------- /tests/integration/saveper/saveper.mdl: -------------------------------------------------------------------------------- 1 | {UTF-8} 2 | 3 | X = TIME ~~| 4 | 5 | Y = 0 6 | ~ [-10,10,0.1] 7 | ~ 8 | | 9 | 10 | Z = X + Y 11 | ~~| 12 | 13 | INITIAL TIME = 2000 ~~| 14 | FINAL TIME = 2002 ~~| 15 | TIME STEP = 0.5 ~~| 16 | SAVEPER = TIME STEP ~~| 17 | -------------------------------------------------------------------------------- /examples/house-game/packages/app/eslint.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig, globalIgnores } from 'eslint/config' 2 | import commonConfig from '../../eslint-config-common.js' 3 | 4 | export default defineConfig([globalIgnores(['public/', 'src/model/generated/*.js']), ...commonConfig]) 5 | -------------------------------------------------------------------------------- /packages/check-core/tsconfig.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for local development and testing. 2 | // It is used as the TypeScript config for tools like VSCode that look for 3 | // `tsconfig.json` by default. 4 | { 5 | "extends": "./tsconfig-test.json" 6 | } 7 | -------------------------------------------------------------------------------- /packages/check-ui-shell/tsconfig.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for local development and testing. 2 | // It is used as the TypeScript config for tools like VSCode that look for 3 | // `tsconfig.json` by default. 4 | { 5 | "extends": "./tsconfig-test.json" 6 | } 7 | -------------------------------------------------------------------------------- /packages/compile/.npmignore: -------------------------------------------------------------------------------- 1 | # Exclude all files to start (npm will still include some mandatory files, e.g., package.json, README) 2 | * 3 | 4 | # Include all files under src directory 5 | !src/** 6 | 7 | # Exclude test-related files 8 | src/**/_tests 9 | src/**/*.spec.ts 10 | -------------------------------------------------------------------------------- /packages/plugin-check/tsconfig.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for local development and testing. 2 | // It is used as the TypeScript config for tools like VSCode that look for 3 | // `tsconfig.json` by default. 4 | { 5 | "extends": "./tsconfig-test.json" 6 | } 7 | -------------------------------------------------------------------------------- /packages/plugin-config/tsconfig.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for local development and testing. 2 | // It is used as the TypeScript config for tools like VSCode that look for 3 | // `tsconfig.json` by default. 4 | { 5 | "extends": "./tsconfig-test.json" 6 | } 7 | -------------------------------------------------------------------------------- /packages/plugin-deploy/tsconfig.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for local development and testing. 2 | // It is used as the TypeScript config for tools like VSCode that look for 3 | // `tsconfig.json` by default. 4 | { 5 | "extends": "./tsconfig-test.json" 6 | } 7 | -------------------------------------------------------------------------------- /packages/plugin-vite/tsconfig.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for local development and testing. 2 | // It is used as the TypeScript config for tools like VSCode that look for 3 | // `tsconfig.json` by default. 4 | { 5 | "extends": "./tsconfig-test.json" 6 | } 7 | -------------------------------------------------------------------------------- /packages/plugin-wasm/tsconfig.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for local development and testing. 2 | // It is used as the TypeScript config for tools like VSCode that look for 3 | // `tsconfig.json` by default. 4 | { 5 | "extends": "./tsconfig-test.json" 6 | } 7 | -------------------------------------------------------------------------------- /packages/plugin-worker/tsconfig.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for local development and testing. 2 | // It is used as the TypeScript config for tools like VSCode that look for 3 | // `tsconfig.json` by default. 4 | { 5 | "extends": "./tsconfig-test.json" 6 | } 7 | -------------------------------------------------------------------------------- /packages/runtime-async/tsconfig.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for local development and testing. 2 | // It is used as the TypeScript config for tools like VSCode that look for 3 | // `tsconfig.json` by default. 4 | { 5 | "extends": "./tsconfig-test.json" 6 | } 7 | -------------------------------------------------------------------------------- /examples/sample-check-app/tsconfig.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for local development and testing. 2 | // It is used as the TypeScript config for tools like VSCode that look for 3 | // `tsconfig.json` by default. 4 | { 5 | "extends": "./tsconfig-test.json" 6 | } 7 | -------------------------------------------------------------------------------- /examples/sample-check-bundle/tsconfig.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for local development and testing. 2 | // It is used as the TypeScript config for tools like VSCode that look for 3 | // `tsconfig.json` by default. 4 | { 5 | "extends": "./tsconfig-test.json" 6 | } 7 | -------------------------------------------------------------------------------- /examples/sample-check-tests/tsconfig.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for local development and testing. 2 | // It is used as the TypeScript config for tools like VSCode that look for 3 | // `tsconfig.json` by default. 4 | { 5 | "extends": "./tsconfig-test.json" 6 | } 7 | -------------------------------------------------------------------------------- /examples/template-jquery/packages/core/eslint.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig, globalIgnores } from 'eslint/config' 2 | import commonConfig from '../../eslint-config-common.js' 3 | 4 | export default defineConfig([globalIgnores(['dist/', 'src/model/generated/*.js']), ...commonConfig]) 5 | -------------------------------------------------------------------------------- /examples/template-svelte/packages/core/eslint.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig, globalIgnores } from 'eslint/config' 2 | import commonConfig from '../../eslint-config-common.js' 3 | 4 | export default defineConfig([globalIgnores(['dist/', 'src/model/generated/*.js']), ...commonConfig]) 5 | -------------------------------------------------------------------------------- /models/subalias/subalias.mdl: -------------------------------------------------------------------------------- 1 | {UTF-8} 2 | DimE <-> DimF ~~| 3 | DimF: F1, F2, F3 ~~| 4 | 5 | e[DimE] = 10, 20, 30 ~~~:SUPPLEMENTARY| 6 | f[DimF] = 1, 2, 3 ~~~:SUPPLEMENTARY| 7 | 8 | INITIAL TIME = 0 ~~| 9 | FINAL TIME = 1 ~~| 10 | TIME STEP = 1 ~~| 11 | SAVEPER = TIME STEP ~~| 12 | -------------------------------------------------------------------------------- /packages/check-ui-shell/src/components/trace/trace-group-vm.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 Climate Interactive / New Venture Fund 2 | 3 | import type { TraceRowViewModel } from './trace-row-vm' 4 | 5 | export interface TraceGroupViewModel { 6 | title: string 7 | rows: TraceRowViewModel[] 8 | } 9 | -------------------------------------------------------------------------------- /models/ref/ref.dat: -------------------------------------------------------------------------------- 1 | ce[t1] 2 | 0 1 3 | ce[t2] 4 | 0 3 5 | 1 3 6 | ce[t3] 7 | 0 5 8 | 1 5 9 | ecc[t1] 10 | 0 2 11 | 1 2 12 | ecc[t2] 13 | 0 4 14 | 1 4 15 | ecc[t3] 16 | 0 6 17 | 1 6 18 | FINAL TIME 19 | 0 1 20 | INITIAL TIME 21 | 0 0 22 | SAVEPER 23 | 0 1 24 | 1 1 25 | TIME STEP 26 | 0 1 27 | -------------------------------------------------------------------------------- /models/directconst_invalidcell/directconst_invalidcell.dat: -------------------------------------------------------------------------------- 1 | c[B1,C1] 2 | 0 1 3 | c[B1,C2] 4 | 0 2 5 | c[B2,C1] 6 | 0 3 7 | c[B2,C2] 8 | 0 0 9 | c[B3,C1] 10 | 0 5 11 | c[B3,C2] 12 | 0 6 13 | FINAL TIME 14 | 0 1 15 | INITIAL TIME 16 | 0 0 17 | SAVEPER 18 | 0 1 19 | 1 1 20 | TIME STEP 21 | 0 1 22 | -------------------------------------------------------------------------------- /examples/sample-check-bundle/README.md: -------------------------------------------------------------------------------- 1 | # sample-check-bundle 2 | 3 | This package defines a pretend model that can be exercised by the sample 4 | application in the `sample-check-app` directory. 5 | 6 | ## License 7 | 8 | SDEverywhere is distributed under the MIT license. See `LICENSE` for more details. 9 | -------------------------------------------------------------------------------- /packages/check-core/src/comparison/report/comparison-sort-mode.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 Climate Interactive / New Venture Fund 2 | 3 | /** The available sort modes for categorizing comparison groups. */ 4 | export type ComparisonSortMode = 'max-diff' | 'avg-diff' | 'max-diff-relative' | 'avg-diff-relative' 5 | -------------------------------------------------------------------------------- /packages/check-ui-shell/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'tsup' 2 | 3 | export default defineConfig({ 4 | tsconfig: 'tsconfig-build.json', 5 | entry: ['src/index.ts'], 6 | format: ['esm'], 7 | dts: true, 8 | splitting: false, 9 | sourcemap: true, 10 | clean: false 11 | }) 12 | -------------------------------------------------------------------------------- /packages/create/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'tsup' 2 | 3 | export default defineConfig({ 4 | tsconfig: 'tsconfig-build.json', 5 | entry: ['src/index.ts'], 6 | format: ['esm', 'cjs'], 7 | dts: true, 8 | splitting: false, 9 | sourcemap: true, 10 | clean: true 11 | }) 12 | -------------------------------------------------------------------------------- /packages/parse/docs/index.md: -------------------------------------------------------------------------------- 1 | # @sdeverywhere/parse 2 | 3 | Note: The `parse` API has not yet stabilized, so documentation is not provided at this time. 4 | If you would like to help with this task, please get in touch on the [discussion board](https://github.com/climateinteractive/SDEverywhere/discussions). 5 | -------------------------------------------------------------------------------- /packages/parse/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'tsup' 2 | 3 | export default defineConfig({ 4 | tsconfig: 'tsconfig-build.json', 5 | entry: ['src/index.ts'], 6 | format: ['esm', 'cjs'], 7 | dts: true, 8 | splitting: false, 9 | sourcemap: true, 10 | clean: true 11 | }) 12 | -------------------------------------------------------------------------------- /packages/runtime/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'tsup' 2 | 3 | export default defineConfig({ 4 | tsconfig: 'tsconfig-build.json', 5 | entry: ['src/index.ts'], 6 | format: ['esm', 'cjs'], 7 | dts: true, 8 | splitting: false, 9 | sourcemap: true, 10 | clean: true 11 | }) 12 | -------------------------------------------------------------------------------- /tests/integration/unicode/unicode.mdl: -------------------------------------------------------------------------------- 1 | {UTF-8} 2 | 3 | 中文变量名 X = TIME ~~| 4 | 5 | 中文变量名 Y = 0 6 | ~ [-10,10,0.1] 7 | ~ 8 | | 9 | 10 | 中文输出变量 Z = 中文变量名 X + 中文变量名 Y 11 | ~~| 12 | 13 | INITIAL TIME = 2000 ~~| 14 | FINAL TIME = 2002 ~~| 15 | TIME STEP = 1 ~~| 16 | SAVEPER = TIME STEP ~~| 17 | -------------------------------------------------------------------------------- /examples/sample-check-bundle/tsconfig-build.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for production builds. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "compilerOptions": { 5 | "skipLibCheck": true 6 | }, 7 | "include": ["src/**/*"], 8 | "exclude": ["**/*.spec.ts"] 9 | } 10 | -------------------------------------------------------------------------------- /examples/sample-check-tests/README.md: -------------------------------------------------------------------------------- 1 | # sample-check-tests 2 | 3 | This package defines the sample set of checks and comparisons to be run in the 4 | application in the `sample-check-app` directory. 5 | 6 | ## License 7 | 8 | SDEverywhere is distributed under the MIT license. See `LICENSE` for more details. 9 | -------------------------------------------------------------------------------- /examples/template-svelte/packages/core/src/index.ts: -------------------------------------------------------------------------------- 1 | export type { InputCallbacks, OutputVarId, Point, Series, SourceName } from '@sdeverywhere/runtime' 2 | export * from './config/generated/spec-types' 3 | export * from './config/config' 4 | export * from './model/model' 5 | export * from './model/model-inputs' 6 | -------------------------------------------------------------------------------- /models/comments/expected.mdl: -------------------------------------------------------------------------------- 1 | {UTF-8} 2 | 3 | a[DimA]= 0, 1, 2 ~~| 4 | 5 | b = 3 ~~| 6 | 7 | c = 4 ~~| 8 | 9 | d= 8760 ~~| 10 | 11 | DimA: A1, A2, A3 ~~| 12 | 13 | e = 41 + 1 ~~| 14 | 15 | FINAL TIME = 1 ~~| 16 | 17 | INITIAL TIME = 0 ~~| 18 | 19 | SAVEPER = 1 ~~| 20 | 21 | TIME STEP = 1 ~~| 22 | -------------------------------------------------------------------------------- /packages/check-core/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'tsup' 2 | 3 | export default defineConfig({ 4 | tsconfig: 'tsconfig-build.json', 5 | entry: ['src/index.ts'], 6 | format: ['esm', 'cjs'], 7 | dts: true, 8 | splitting: false, 9 | sourcemap: true, 10 | clean: true 11 | }) 12 | -------------------------------------------------------------------------------- /packages/plugin-vite/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'tsup' 2 | 3 | export default defineConfig({ 4 | tsconfig: 'tsconfig-build.json', 5 | entry: ['src/index.ts'], 6 | format: ['esm', 'cjs'], 7 | dts: true, 8 | splitting: false, 9 | sourcemap: true, 10 | clean: true 11 | }) 12 | -------------------------------------------------------------------------------- /packages/plugin-wasm/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'tsup' 2 | 3 | export default defineConfig({ 4 | tsconfig: 'tsconfig-build.json', 5 | entry: ['src/index.ts'], 6 | format: ['esm', 'cjs'], 7 | dts: true, 8 | splitting: false, 9 | sourcemap: true, 10 | clean: true 11 | }) 12 | -------------------------------------------------------------------------------- /packages/build/docs/interfaces/OutputSpec.md: -------------------------------------------------------------------------------- 1 | [@sdeverywhere/build](../index.md) / OutputSpec 2 | 3 | # Interface: OutputSpec 4 | 5 | Describes a model output variable. 6 | 7 | ## Properties 8 | 9 | ### varName 10 | 11 | **varName**: `string` 12 | 13 | The variable name (as used in the modeling tool). 14 | -------------------------------------------------------------------------------- /packages/check-core/docs/index.md: -------------------------------------------------------------------------------- 1 | # @sdeverywhere/check-core 2 | 3 | Note: The `check-core` API has not yet stabilized, so documentation is not provided at this time. 4 | If you would like to help with this task, please get in touch on the [discussion board](https://github.com/climateinteractive/SDEverywhere/discussions). 5 | -------------------------------------------------------------------------------- /packages/runtime/docs/types/SeriesMap.md: -------------------------------------------------------------------------------- 1 | [@sdeverywhere/runtime](../index.md) / SeriesMap 2 | 3 | # Type alias: SeriesMap 4 | 5 | **SeriesMap**: `Map`<[`OutputVarId`](OutputVarId.md), [`Series`](../classes/Series.md)\> 6 | 7 | Type alias for a map that holds a `Series` instance for each output (or static) variable ID. 8 | -------------------------------------------------------------------------------- /models/delayfixed2/delayfixed2.csv: -------------------------------------------------------------------------------- 1 | Months,input1,input2,output1,output2 2 | 10,110,110,0,0 3 | 11,120,120,110,0 4 | 12,130,130,120,0 5 | 13,140,140,130,0 6 | 14,150,150,140,0 7 | 15,160,160,150,110 8 | 16,170,170,160,120 9 | 17,180,180,170,130 10 | 18,190,190,180,140 11 | 19,200,200,190,150 12 | 20,210,210,200,160 13 | -------------------------------------------------------------------------------- /examples/sample-check-app/README.md: -------------------------------------------------------------------------------- 1 | # sample-check-app 2 | 3 | This is a small sample app that demonstrates use of the `@sdeverywhere/check-ui-shell` 4 | package in isolation (independent of other SDEverywhere packages). 5 | 6 | ## License 7 | 8 | SDEverywhere is distributed under the MIT license. See `LICENSE` for more details. 9 | -------------------------------------------------------------------------------- /packages/check-ui-shell/docs/index.md: -------------------------------------------------------------------------------- 1 | # @sdeverywhere/check-ui-shell 2 | 3 | Note: The `check-ui-shell` API has not yet stabilized, so documentation is not provided at this time. 4 | If you would like to help with this task, please get in touch on the [discussion board](https://github.com/climateinteractive/SDEverywhere/discussions). 5 | -------------------------------------------------------------------------------- /packages/runtime/src/js-model/js-model-constants.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Climate Interactive / New Venture Fund 2 | 3 | // This matches Vensim's definition of `:NA:`. It is also defined 4 | // with the same value in the generated `JsModel`, so make sure 5 | // these two values are the same. 6 | export const _NA_ = -Number.MAX_VALUE 7 | -------------------------------------------------------------------------------- /models/multimap/multimap.mdl: -------------------------------------------------------------------------------- 1 | {UTF-8} 2 | DimA: A1, A2, A3 -> (DimB: B3, B2, B1), DimC ~~| 3 | DimB: B1, B2, B3 ~~| 4 | DimC: C1, C2, C3 ~~| 5 | 6 | a[DimA] = 1, 2, 3 ~~| 7 | b[DimB] = a[DimA] ~~| 8 | c[DimC] = a[DimA] ~~| 9 | 10 | INITIAL TIME = 0 ~~| 11 | FINAL TIME = 1 ~~| 12 | SAVEPER = 1 ~~| 13 | TIME STEP = 1 ~~| 14 | -------------------------------------------------------------------------------- /models/quantum/quantum.dat: -------------------------------------------------------------------------------- 1 | a 2 | 0 1 3 | 1 1 4 | b 5 | 0 0 6 | 1 0 7 | c 8 | 0 0 9 | 1 0 10 | d 11 | 0 -1 12 | 1 -1 13 | e 14 | 0 110 15 | 1 110 16 | f 17 | 0 48 18 | 1 48 19 | FINAL TIME 20 | 0 1 21 | g 22 | 0 378 23 | 1 378 24 | h 25 | 0 10 26 | 1 10 27 | INITIAL TIME 28 | 0 0 29 | SAVEPER 30 | 0 1 31 | 1 1 32 | TIME STEP 33 | 0 1 34 | -------------------------------------------------------------------------------- /packages/runtime/docs/types/GeneratedModel.md: -------------------------------------------------------------------------------- 1 | [@sdeverywhere/runtime](../index.md) / GeneratedModel 2 | 3 | # Type alias: GeneratedModel 4 | 5 | **GeneratedModel**: [`JsModel`](../interfaces/JsModel.md) \| [`WasmModule`](../interfaces/WasmModule.md) 6 | 7 | Union of model types that are generated by the SDEverywhere transpiler/builder. 8 | -------------------------------------------------------------------------------- /packages/runtime/src/runnable-model/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Climate Interactive / New Venture Fund 2 | 3 | export * from './run-model-options' 4 | 5 | export * from './run-model-params' 6 | export * from './buffered-run-model-params' 7 | export * from './referenced-run-model-params' 8 | 9 | export * from './runnable-model' 10 | -------------------------------------------------------------------------------- /packages/build/src/_shared/mode.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 Climate Interactive / New Venture Fund 2 | 3 | /** 4 | * The mode used for the build process, either 'development' for local "dev mode" 5 | * (with live reload, etc) or 'production' for generating a production-ready build. 6 | */ 7 | export type BuildMode = 'development' | 'production' 8 | -------------------------------------------------------------------------------- /packages/check-core/src/_shared/types.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2022 Climate Interactive / New Venture Fund 2 | 3 | export type SourceName = string 4 | 5 | export type VarId = string 6 | 7 | export type DatasetKey = string 8 | 9 | export type Dataset = Map 10 | 11 | export type DatasetMap = Map 12 | -------------------------------------------------------------------------------- /packages/check-ui-shell/src/components/summary/tab-item-vm.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 Climate Interactive / New Venture Fund 2 | 3 | import type { Readable } from 'svelte/store' 4 | 5 | export interface TabItemViewModel { 6 | id: string 7 | title: string 8 | subtitle: Readable 9 | subtitleClass: Readable 10 | } 11 | -------------------------------------------------------------------------------- /packages/runtime/docs/interfaces/Point.md: -------------------------------------------------------------------------------- 1 | [@sdeverywhere/runtime](../index.md) / Point 2 | 3 | # Interface: Point 4 | 5 | A data point. 6 | 7 | ## Properties 8 | 9 | ### x 10 | 11 | **x**: `number` 12 | 13 | The x value (typically a time value). 14 | 15 | ___ 16 | 17 | ### y 18 | 19 | **y**: `number` 20 | 21 | The y value. 22 | -------------------------------------------------------------------------------- /models/directsubs/directsubs.dat: -------------------------------------------------------------------------------- 1 | a[A1] 2 | 0 10 3 | a[A2] 4 | 0 20 5 | a[A3] 6 | 0 30 7 | b[B1] 8 | 0 1 9 | b[B2] 10 | 0 2 11 | b[B3] 12 | 0 3 13 | c[C1] 14 | 0 11 15 | 1 11 16 | c[C2] 17 | 0 21 18 | 1 21 19 | c[C3] 20 | 0 31 21 | 1 31 22 | FINAL TIME 23 | 0 1 24 | INITIAL TIME 25 | 0 0 26 | SAVEPER 27 | 0 1 28 | 1 1 29 | TIME STEP 30 | 0 1 31 | -------------------------------------------------------------------------------- /packages/build/docs/types/BuildMode.md: -------------------------------------------------------------------------------- 1 | [@sdeverywhere/build](../index.md) / BuildMode 2 | 3 | # Type alias: BuildMode 4 | 5 | **BuildMode**: ``"development"`` \| ``"production"`` 6 | 7 | The mode used for the build process, either 'development' for local "dev mode" 8 | (with live reload, etc) or 'production' for generating a production-ready build. 9 | -------------------------------------------------------------------------------- /examples/sample-check-bundle/src/env.d.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Climate Interactive / New Venture Fund 2 | 3 | // These values are injected by Vite at build time, so we need to 4 | // declare types for them here 5 | declare const __MODEL_SIZE_IN_BYTES__: number 6 | declare const __DATA_SIZE_IN_BYTES__: number 7 | declare const __MODEL_VERSION__: number 8 | -------------------------------------------------------------------------------- /models/multimap/multimap.dat: -------------------------------------------------------------------------------- 1 | a[A1] 2 | 0 1 3 | a[A2] 4 | 0 2 5 | a[A3] 6 | 0 3 7 | b[B1] 8 | 0 3 9 | 1 3 10 | b[B2] 11 | 0 2 12 | 1 2 13 | b[B3] 14 | 0 1 15 | 1 1 16 | c[C1] 17 | 0 1 18 | 1 1 19 | c[C2] 20 | 0 2 21 | 1 2 22 | c[C3] 23 | 0 3 24 | 1 3 25 | FINAL TIME 26 | 0 1 27 | INITIAL TIME 28 | 0 0 29 | SAVEPER 30 | 0 1 31 | TIME STEP 32 | 0 1 33 | -------------------------------------------------------------------------------- /examples/house-game/packages/app/src/index.ts: -------------------------------------------------------------------------------- 1 | import { mount } from 'svelte' 2 | 3 | import { createAppViewModel } from './app-vm' 4 | import App from './app.svelte' 5 | 6 | createAppViewModel().then(appViewModel => { 7 | mount(App, { 8 | target: document.body, 9 | props: { 10 | viewModel: appViewModel 11 | } 12 | }) 13 | }) 14 | -------------------------------------------------------------------------------- /packages/plugin-worker/src/options.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 Climate Interactive / New Venture Fund 2 | 3 | export interface WorkerPluginOptions { 4 | /** 5 | * The destination paths for the generated worker JS files. If undefined, 6 | * a `worker.js` file will be written to the configured `prepDir`. 7 | */ 8 | outputPaths?: string[] 9 | } 10 | -------------------------------------------------------------------------------- /models/pulsetrain/pulsetrain.mdl: -------------------------------------------------------------------------------- 1 | {UTF-8} 2 | p = PULSE TRAIN(first pulse time, duration, repeat interval, last pulse time) ~~| 3 | 4 | first pulse time = 10 ~~| 5 | duration = 1 ~~| 6 | repeat interval = 5 ~~| 7 | last pulse time = 30 ~~| 8 | 9 | INITIAL TIME = 0 ~~| 10 | FINAL TIME = 40 ~~| 11 | TIME STEP = 0.25 ~~| 12 | SAVEPER = TIME STEP ~~| 13 | -------------------------------------------------------------------------------- /examples/house-game/packages/app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | House Game 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/template-svelte/packages/app/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.formatOnSave": true, 3 | "editor.defaultFormatter": "esbenp.prettier-vscode", 4 | "[svelte]": { 5 | "editor.defaultFormatter": "esbenp.prettier-vscode" 6 | }, 7 | "prettier.documentSelectors": ["**/*.svelte"], 8 | "files.associations": { 9 | "*.svelte": "svelte" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/check-ui-shell/.storybook/preview-head.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /examples/template-svelte/packages/app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Model Explorer 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/plugin-check/template-bundle/src/worker.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 Climate Interactive / New Venture Fund 2 | 3 | /* 4 | * This no-op module is configured as the default path alias in the tsconfig 5 | * files so that TypeScript does not complain. (The actual module will be set 6 | * up using aliases in the Vite config file.) 7 | */ 8 | 9 | export const unused = 0 10 | -------------------------------------------------------------------------------- /packages/plugin-check/template-report/src/messages.html: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /packages/runtime/src/wasm-model/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-2022 Climate Interactive / New Venture Fund 2 | 3 | export * from './wasm-model' 4 | export * from './wasm-module' 5 | 6 | /** 7 | * @hidden This mock is not part of the public API; it is exposed only for use in 8 | * tests in the runtime-async package. 9 | */ 10 | export * from './_mocks/mock-wasm-module' 11 | -------------------------------------------------------------------------------- /packages/build/docs/interfaces/BuildResult.md: -------------------------------------------------------------------------------- 1 | [@sdeverywhere/build](../index.md) / BuildResult 2 | 3 | # Interface: BuildResult 4 | 5 | ## Properties 6 | 7 | ### exitCode 8 | 9 | `Optional` **exitCode**: `number` 10 | 11 | The exit code that should be set by the process. This will be undefined 12 | if `mode` is 'development', indicating that the process should be kept alive. 13 | -------------------------------------------------------------------------------- /packages/plugin-vite/docs/functions/vitePlugin.md: -------------------------------------------------------------------------------- 1 | [@sdeverywhere/plugin-vite](../index.md) / vitePlugin 2 | 3 | # Function: vitePlugin 4 | 5 | **vitePlugin**(`options`): `Plugin` 6 | 7 | #### Parameters 8 | 9 | | Name | Type | 10 | | :------ | :------ | 11 | | `options` | [`VitePluginOptions`](../interfaces/VitePluginOptions.md) | 12 | 13 | #### Returns 14 | 15 | `Plugin` 16 | -------------------------------------------------------------------------------- /packages/plugin-wasm/docs/functions/wasmPlugin.md: -------------------------------------------------------------------------------- 1 | [@sdeverywhere/plugin-wasm](../index.md) / wasmPlugin 2 | 3 | # Function: wasmPlugin 4 | 5 | **wasmPlugin**(`options?`): `Plugin` 6 | 7 | #### Parameters 8 | 9 | | Name | Type | 10 | | :------ | :------ | 11 | | `options?` | [`WasmPluginOptions`](../interfaces/WasmPluginOptions.md) | 12 | 13 | #### Returns 14 | 15 | `Plugin` 16 | -------------------------------------------------------------------------------- /packages/check-ui-shell/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2022 Climate Interactive / New Venture Fund 2 | 3 | export type { AppShellOptions } from './app-shell-options' 4 | export type { BundleSelectorConfig } from './components/bundle/bundle-selector-config' 5 | export type { BundleLocation, BundleSpec } from './components/bundle/bundle-spec' 6 | 7 | export { initAppShell } from './app-init' 8 | -------------------------------------------------------------------------------- /packages/plugin-check/docs/functions/checkPlugin.md: -------------------------------------------------------------------------------- 1 | [@sdeverywhere/plugin-check](../index.md) / checkPlugin 2 | 3 | # Function: checkPlugin 4 | 5 | **checkPlugin**(`options?`): `Plugin` 6 | 7 | #### Parameters 8 | 9 | | Name | Type | 10 | | :------ | :------ | 11 | | `options?` | [`CheckPluginOptions`](../interfaces/CheckPluginOptions.md) | 12 | 13 | #### Returns 14 | 15 | `Plugin` 16 | -------------------------------------------------------------------------------- /packages/build/tests/_shared/submodel2.mdl: -------------------------------------------------------------------------------- 1 | {UTF-8} 2 | 3 | Z = 10 4 | ~ 5 | ~ This is used for the "flatten" test in `build-prod.spec.ts`. \ 6 | It intentionally has a different definition than the Z equation \ 7 | in `submodel1.mdl` to trigger a flatten error. 8 | | 9 | 10 | INITIAL TIME = 2000 ~~| 11 | FINAL TIME = 2100 ~~| 12 | TIME STEP = 1 ~~| 13 | SAVEPER = TIME STEP ~~| 14 | -------------------------------------------------------------------------------- /packages/plugin-deploy/docs/functions/deployPlugin.md: -------------------------------------------------------------------------------- 1 | [@sdeverywhere/plugin-deploy](../index.md) / deployPlugin 2 | 3 | # Function: deployPlugin 4 | 5 | **deployPlugin**(`options?`): `Plugin` 6 | 7 | #### Parameters 8 | 9 | | Name | Type | 10 | | :------ | :------ | 11 | | `options?` | [`DeployPluginOptions`](../interfaces/DeployPluginOptions.md) | 12 | 13 | #### Returns 14 | 15 | `Plugin` 16 | -------------------------------------------------------------------------------- /packages/plugin-worker/docs/functions/workerPlugin.md: -------------------------------------------------------------------------------- 1 | [@sdeverywhere/plugin-worker](../index.md) / workerPlugin 2 | 3 | # Function: workerPlugin 4 | 5 | **workerPlugin**(`options?`): `Plugin` 6 | 7 | #### Parameters 8 | 9 | | Name | Type | 10 | | :------ | :------ | 11 | | `options?` | [`WorkerPluginOptions`](../interfaces/WorkerPluginOptions.md) | 12 | 13 | #### Returns 14 | 15 | `Plugin` 16 | -------------------------------------------------------------------------------- /tests/integration/model-check/remote-bundles.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "feature/remote-2", 4 | "url": "http://localhost:9000/sde-prep/check-bundle.js", 5 | "lastModified": "2025-07-01T12:00:00.000Z" 6 | }, 7 | { 8 | "name": "feature/remote-1", 9 | "url": "http://localhost:9000/sde-prep/check-bundle.js", 10 | "lastModified": "2025-05-01T12:00:00.000Z" 11 | } 12 | ] 13 | -------------------------------------------------------------------------------- /packages/check-ui-shell/src/_shared/user-prefs.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Climate Interactive / New Venture Fund 2 | 3 | import type { Readable } from 'svelte/store' 4 | 5 | import type { ComparisonSortMode } from '@sdeverywhere/check-core' 6 | 7 | export interface UserPrefs { 8 | zoom: Readable 9 | consistentYRange: Readable 10 | sortMode: Readable 11 | } 12 | -------------------------------------------------------------------------------- /models/mapping/mapping.dat: -------------------------------------------------------------------------------- 1 | a[A1] 2 | 0 10 3 | 1 10 4 | a[A2] 5 | 0 10 6 | 1 10 7 | a[A3] 8 | 0 20 9 | 1 20 10 | b[B1] 11 | 0 1 12 | b[B2] 13 | 0 2 14 | c[C1] 15 | 0 1 16 | c[C2] 17 | 0 2 18 | c[C3] 19 | 0 3 20 | d[D1] 21 | 0 10 22 | 1 10 23 | d[D2] 24 | 0 20 25 | 1 20 26 | d[D3] 27 | 0 30 28 | 1 30 29 | FINAL TIME 30 | 0 1 31 | INITIAL TIME 32 | 0 0 33 | SAVEPER 34 | 0 1 35 | 1 1 36 | TIME STEP 37 | 0 1 38 | -------------------------------------------------------------------------------- /packages/build/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'tsup' 2 | 3 | export default defineConfig({ 4 | tsconfig: 'tsconfig-build.json', 5 | entry: ['src/index.ts'], 6 | format: ['esm', 'cjs'], 7 | dts: true, 8 | splitting: false, 9 | sourcemap: true, 10 | clean: true, 11 | // Enable shims so that `import.meta.url` is translated to `__dirname` in CJS bundle 12 | shims: true 13 | }) 14 | -------------------------------------------------------------------------------- /packages/runtime/src/js-model/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Climate Interactive / New Venture Fund 2 | 3 | export * from './js-model-functions' 4 | export * from './js-model' 5 | export * from './exec-js-model' 6 | 7 | /** 8 | * @hidden This mock is not part of the public API; it is exposed only for use in 9 | * tests in the runtime-async package. 10 | */ 11 | export * from './_mocks/mock-js-model' 12 | -------------------------------------------------------------------------------- /packages/cli/src/c/makefile: -------------------------------------------------------------------------------- 1 | # Do "export P={c-file-basename}" before running this makefile. 2 | OBJECTS=main.o vensim.o model.o macros.o 3 | CFLAGS=-Wall -O2 4 | LDLIBS= 5 | 6 | # In case of a Linux build we need to add 7 | # an extra flag, to link with math library 8 | UNAME_S := $(shell uname -s) 9 | ifeq ($(UNAME_S),Linux) 10 | LDLIBS+= -lm 11 | endif 12 | 13 | CC=clang 14 | 15 | $(P): $(OBJECTS) $P.o 16 | -------------------------------------------------------------------------------- /tests/integration/ext-control-params/ext-control-params.mdl: -------------------------------------------------------------------------------- 1 | {UTF-8} 2 | 3 | X = TIME ~~| 4 | 5 | Y = 0 6 | ~ [-10,10,0.1] 7 | ~ 8 | | 9 | 10 | Z = X + Y 11 | ~~| 12 | 13 | INITIAL TIME = GET DIRECT CONSTANTS('ext-control-params.csv', ',', 'A2') ~~| 14 | FINAL TIME = INITIAL TIME + 2 ~~| 15 | TIME STEP = GET DIRECT CONSTANTS('ext-control-params.csv', ',', 'B2') ~~| 16 | SAVEPER = TIME STEP * 2 ~~| 17 | -------------------------------------------------------------------------------- /tests/integration/game-inputs/game-inputs.mdl: -------------------------------------------------------------------------------- 1 | {UTF-8} 2 | 3 | DimA: A1, A2 ~~| 4 | 5 | X = 0 6 | ~ dmnl [-10,10,0.1] 7 | ~ This is an input variable. 8 | | 9 | 10 | Y[DimA] = GAME(X + 100 * (Time - INITIAL TIME + 1)) 11 | ~ dmnl 12 | ~ This is a 1D subscripted output variable. 13 | | 14 | 15 | INITIAL TIME = 2000 ~~| 16 | FINAL TIME = 2002 ~~| 17 | TIME STEP = 1 ~~| 18 | SAVEPER = TIME STEP ~~| 19 | -------------------------------------------------------------------------------- /packages/plugin-config/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'tsup' 2 | 3 | export default defineConfig({ 4 | tsconfig: 'tsconfig-build.json', 5 | entry: ['src/index.ts'], 6 | format: ['esm', 'cjs'], 7 | dts: true, 8 | splitting: false, 9 | sourcemap: true, 10 | clean: true, 11 | // Enable shims so that `import.meta.url` is translated to `__dirname` in CJS bundle 12 | shims: true 13 | }) 14 | -------------------------------------------------------------------------------- /packages/plugin-worker/docs/interfaces/WorkerPluginOptions.md: -------------------------------------------------------------------------------- 1 | [@sdeverywhere/plugin-worker](../index.md) / WorkerPluginOptions 2 | 3 | # Interface: WorkerPluginOptions 4 | 5 | ## Properties 6 | 7 | ### outputPaths 8 | 9 | `Optional` **outputPaths**: `string`[] 10 | 11 | The destination paths for the generated worker JS files. If undefined, 12 | a `worker.js` file will be written to the configured `prepDir`. 13 | -------------------------------------------------------------------------------- /packages/plugin-worker/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'tsup' 2 | 3 | export default defineConfig({ 4 | tsconfig: 'tsconfig-build.json', 5 | entry: ['src/index.ts'], 6 | format: ['esm', 'cjs'], 7 | dts: true, 8 | splitting: false, 9 | sourcemap: true, 10 | clean: true, 11 | // Enable shims so that `import.meta.url` is translated to `__dirname` in CJS bundle 12 | shims: true 13 | }) 14 | -------------------------------------------------------------------------------- /packages/check-ui-shell/src/components/graphs/graph-view-config.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2022 Climate Interactive / New Venture Fund 2 | 3 | /** 4 | * Configuration for the graph view. These are fixed values that are 5 | * provided at initialization time to control the size of the graph. 6 | */ 7 | export interface GraphViewConfig { 8 | /** The fixed width of the graph in `rem` units. */ 9 | width: number 10 | } 11 | -------------------------------------------------------------------------------- /packages/check-ui-shell/src/components/playground/list-item-vm.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 Climate Interactive / New Venture Fund 2 | 3 | /** View model for an item in a list control. */ 4 | export class ListItemViewModel { 5 | /** 6 | * @param id The ID for the item. 7 | * @param label The displayed string. 8 | */ 9 | constructor( 10 | public readonly id: string, 11 | public readonly label: string 12 | ) {} 13 | } 14 | -------------------------------------------------------------------------------- /models/index/index.dat: -------------------------------------------------------------------------------- 1 | a[A1] 2 | 0 11 3 | 1 11 4 | a[A2] 5 | 0 12 6 | 1 12 7 | a[A3] 8 | 0 13 9 | 1 13 10 | b[A1] 11 | 0 1 12 | b[A2] 13 | 0 2 14 | b[A3] 15 | 0 3 16 | c[A1] 17 | 0 2 18 | 1 2 19 | c[A2] 20 | 0 2 21 | 1 2 22 | c[A3] 23 | 0 2 24 | 1 2 25 | d[A1] 26 | 0 2 27 | 1 2 28 | d[A2] 29 | 0 3 30 | 1 3 31 | d[A3] 32 | 0 4 33 | 1 4 34 | FINAL TIME 35 | 0 1 36 | INITIAL TIME 37 | 0 0 38 | SAVEPER 39 | 0 1 40 | 1 1 41 | TIME STEP 42 | 0 1 43 | -------------------------------------------------------------------------------- /packages/check-ui-shell/src/_mocks/mock-data.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 Climate Interactive / New Venture Fund 2 | 3 | import type { Dataset } from '@sdeverywhere/check-core' 4 | 5 | export function mockDataset(delta = 0): Dataset { 6 | return new Map([ 7 | [2000, 10 + delta], 8 | [2020, 20 + delta], 9 | [2040, 80 + delta], 10 | [2060, 50 + delta], 11 | [2080, 70 + delta], 12 | [2100, 100 + delta] 13 | ]) 14 | } 15 | -------------------------------------------------------------------------------- /packages/plugin-check/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'tsup' 2 | 3 | export default defineConfig({ 4 | tsconfig: 'tsconfig-build.json', 5 | entry: ['src/index.ts'], 6 | format: ['esm', 'cjs'], 7 | external: [/^vite$/], 8 | dts: true, 9 | splitting: false, 10 | sourcemap: true, 11 | clean: true, 12 | // Enable shims so that `import.meta.url` is translated to `__dirname` in CJS bundle 13 | shims: true 14 | }) 15 | -------------------------------------------------------------------------------- /packages/plugin-deploy/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'tsup' 2 | 3 | export default defineConfig({ 4 | tsconfig: 'tsconfig-build.json', 5 | entry: ['src/index.ts'], 6 | format: ['esm', 'cjs'], 7 | external: [/^vite$/], 8 | dts: true, 9 | splitting: false, 10 | sourcemap: true, 11 | clean: true, 12 | // Enable shims so that `import.meta.url` is translated to `__dirname` in CJS bundle 13 | shims: true 14 | }) 15 | -------------------------------------------------------------------------------- /packages/plugin-deploy/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 0.1.0 (2025-12-09) 4 | 5 | 6 | ### Features 7 | 8 | * add plugin-deploy package to simplify the process of deploying to a web server ([#707](https://github.com/climateinteractive/SDEverywhere/issues/707)) ([4823509](https://github.com/climateinteractive/SDEverywhere/commit/482350975743b515e8f1dbf3e6059986f2421e0b)), closes [#706](https://github.com/climateinteractive/SDEverywhere/issues/706) 9 | -------------------------------------------------------------------------------- /packages/runtime/docs/interfaces/InputCallbacks.md: -------------------------------------------------------------------------------- 1 | [@sdeverywhere/runtime](../index.md) / InputCallbacks 2 | 3 | # Interface: InputCallbacks 4 | 5 | Callback functions that are called when the input value is changed. 6 | 7 | ## Properties 8 | 9 | ### onSet 10 | 11 | `Optional` **onSet**: () => `void` 12 | 13 | #### Type declaration 14 | 15 | (): `void` 16 | 17 | Called after a new value is set. 18 | 19 | ##### Returns 20 | 21 | `void` 22 | -------------------------------------------------------------------------------- /packages/compile/src/_shared/read-dat.spec.ts: -------------------------------------------------------------------------------- 1 | import { describe, expect, it } from 'vitest' 2 | 3 | import { readDat } from './read-dat' 4 | 5 | describe('readDat', () => { 6 | it('should fail if file does not exist or cannot be read', async () => { 7 | await expect(() => readDat('unknown_file.dat')).rejects.toThrow( 8 | `Failed to read dat file: ENOENT: no such file or directory, open 'unknown_file.dat'` 9 | ) 10 | }) 11 | }) 12 | -------------------------------------------------------------------------------- /tests/run-c-int-tests: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 4 | PROJ_DIR=$SCRIPT_DIR/.. 5 | 6 | set -e # fail on error 7 | set -x # include all commands in logs 8 | 9 | # Run the model tests with C as the code gen target. For each sample model, 10 | # we will generate C code, execute the generated model, and compare its output 11 | # to Vensim outputs. 12 | cd $PROJ_DIR 13 | GEN_FORMAT=c ./tests/modeltests 14 | -------------------------------------------------------------------------------- /packages/plugin-check/template-report/src/env.d.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 Climate Interactive / New Venture Fund 2 | 3 | // These values are injected by Vite at build time, so we need to 4 | // declare types for them here 5 | declare const __SUITE_SUMMARY_JSON__: string 6 | declare const __BASELINE_NAME__: string 7 | declare const __CURRENT_NAME__: string 8 | declare const __CURRENT_BUNDLE_LAST_MODIFIED__: string 9 | declare const __REMOTE_BUNDLES_URL__: string 10 | -------------------------------------------------------------------------------- /examples/template-jquery/packages/core/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist", 4 | "allowJs": true, 5 | "module": "es6", 6 | "target": "es6", 7 | "moduleResolution": "node", 8 | "isolatedModules": true, 9 | "verbatimModuleSyntax": true, 10 | "noImplicitAny": true, 11 | "noUnusedLocals": true, 12 | "noUnusedParameters": true, 13 | "types": ["vite/client"] 14 | }, 15 | "include": ["src/**/*"] 16 | } 17 | -------------------------------------------------------------------------------- /examples/template-svelte/packages/core/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist", 4 | "allowJs": true, 5 | "module": "es6", 6 | "target": "es6", 7 | "moduleResolution": "node", 8 | "isolatedModules": true, 9 | "verbatimModuleSyntax": true, 10 | "noImplicitAny": true, 11 | "noUnusedLocals": true, 12 | "noUnusedParameters": true, 13 | "types": ["vite/client"] 14 | }, 15 | "include": ["src/**/*"] 16 | } 17 | -------------------------------------------------------------------------------- /packages/build/tests/_shared/submodel1.mdl: -------------------------------------------------------------------------------- 1 | {UTF-8} 2 | 3 | X = TIME ~~| 4 | 5 | Y = 0 6 | ~ [-10,10,0.1] 7 | ~ 8 | | 9 | 10 | Z = X + Y 11 | ~ 12 | ~ This is used for the "flatten" test in `build-prod.spec.ts`. \ 13 | It intentionally has a different definition than the Z equation \ 14 | in `submodel2.mdl` to trigger a flatten error. 15 | | 16 | 17 | INITIAL TIME = 2000 ~~| 18 | FINAL TIME = 2100 ~~| 19 | TIME STEP = 1 ~~| 20 | SAVEPER = TIME STEP ~~| 21 | -------------------------------------------------------------------------------- /packages/check-ui-shell/src/components/compare/_shared/spans.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Climate Interactive / New Venture Fund 2 | 3 | /** 4 | * Return a string containing an HTML `` element with the appropriate 5 | * color for the given bundle side (left or right). 6 | */ 7 | export function datasetSpan(name: string, side: 'left' | 'right'): string { 8 | const color = side === 'left' ? 0 : 1 9 | return `${name}` 10 | } 11 | -------------------------------------------------------------------------------- /packages/check-ui-shell/src/components/perf/perf-table-row-vm.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2022 Climate Interactive / New Venture Fund 2 | 3 | import type { DotPlotViewModel } from './dot-plot-vm' 4 | 5 | export interface PerfTableRowViewModel { 6 | num: number 7 | minTimeL: string 8 | avgTimeL: string 9 | maxTimeL: string 10 | minTimeR: string 11 | avgTimeR: string 12 | maxTimeR: string 13 | dotPlotL: DotPlotViewModel 14 | dotPlotR: DotPlotViewModel 15 | } 16 | -------------------------------------------------------------------------------- /packages/runtime/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-2022 Climate Interactive / New Venture Fund 2 | 3 | export * from './_shared' 4 | export * from './model-listing' 5 | export * from './runnable-model' 6 | export * from './js-model' 7 | export * from './wasm-model' 8 | export * from './model-runner' 9 | export * from './model-scheduler' 10 | 11 | /** @hidden The `perf` module is not part of the public API, but is exposed for use in performance tools. */ 12 | export * from './perf' 13 | -------------------------------------------------------------------------------- /packages/runtime/tsconfig-base.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration that is shared between 2 | // testing (`tsconfig-test.json`) and production builds (`tsconfig-build.json`). 3 | { 4 | "extends": "../../tsconfig-common.json", 5 | "compilerOptions": { 6 | "outDir": "./dist", 7 | "allowJs": false, 8 | "module": "es6", 9 | "target": "es6", 10 | "noImplicitAny": true, 11 | "noUnusedLocals": true, 12 | "noUnusedParameters": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /models/sumif/sumif.dat: -------------------------------------------------------------------------------- 1 | A Values Avg 2 | 0 10 3 | 1 20 4 | 2 30 5 | 3 37.1429 6 | 4 44.2857 7 | 5 51.4286 8 | 6 58.5714 9 | 7 65.7143 10 | 8 72.8571 11 | 9 80 12 | 10 90 13 | FINAL TIME 14 | 0 10 15 | INITIAL TIME 16 | 0 0 17 | SAVEPER 18 | 0 1 19 | 1 1 20 | 2 1 21 | 3 1 22 | 4 1 23 | 5 1 24 | 6 1 25 | 7 1 26 | 8 1 27 | 9 1 28 | 10 1 29 | TIME STEP 30 | 0 1 31 | A Values[A1] 32 | 0 0 33 | 1 10 34 | 2 20 35 | 9 70 36 | 10 80 37 | A Values[A3] 38 | 0 20 39 | 1 30 40 | 2 40 41 | 9 90 42 | 10 100 43 | -------------------------------------------------------------------------------- /examples/template-svelte/scripts/ci-build.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Builds the app and model-check reports and copies the build products to the `artifacts` branch. 5 | * 6 | * Usage: node ci-build.js 7 | */ 8 | 9 | import { execSync } from 'node:child_process' 10 | 11 | // Build the app and model-check report 12 | console.log('Building the app and model-check report...') 13 | execSync('npm run build', { stdio: 'inherit' }) 14 | 15 | // Add other build and test steps here... 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # SDEverywhere intermediate files 2 | models/**/build* 3 | models/**/output* 4 | models/**/compare 5 | removals.txt 6 | 7 | # macOS 8 | .DS_Store 9 | 10 | # C / Xcode 11 | *.o 12 | *.dSYM 13 | 14 | # Java 15 | *.java 16 | *.tokens 17 | *.class 18 | 19 | # Vensim 20 | *.vdf 21 | *.vdfx 22 | *.vdf64 23 | *.3vm 24 | *.2mdl 25 | 26 | # Stella 27 | *.isdb 28 | 29 | # Logs 30 | npm-debug.log* 31 | 32 | # Dependency directories 33 | emsdk 34 | node_modules 35 | 36 | # Other tools 37 | .claude 38 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "arrowParens": "avoid", 3 | "bracketSpacing": true, 4 | "printWidth": 120, 5 | "semi": false, 6 | "singleQuote": true, 7 | "tabWidth": 2, 8 | "trailingComma": "none", 9 | "plugins": ["prettier-plugin-svelte"], 10 | "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }], 11 | "svelteSortOrder": "options-scripts-markup-styles", 12 | "svelteIndentScriptAndStyle": false, 13 | "svelteStrictMode": false, 14 | "svelteAllowShorthand": true 15 | } 16 | -------------------------------------------------------------------------------- /packages/check-ui-shell/.storybook/preview.ts: -------------------------------------------------------------------------------- 1 | import type { Preview } from '@storybook/svelte-vite' 2 | import { themes } from 'storybook/theming' 3 | import '../src/global.css' 4 | import './storybook.css' 5 | 6 | const preview: Preview = { 7 | parameters: { 8 | controls: { 9 | matchers: { 10 | color: /(background|color)$/i, 11 | date: /Date$/i 12 | } 13 | }, 14 | docs: { 15 | theme: themes.dark 16 | } 17 | } 18 | } 19 | 20 | export default preview 21 | -------------------------------------------------------------------------------- /packages/check-ui-shell/src/components/_shared/close-button.svelte: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /packages/check-ui-shell/src/components/compare/summary/comparison-summary-section-vm.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 Climate Interactive / New Venture Fund 2 | 3 | import type { Writable } from 'svelte/store' 4 | 5 | import type { ComparisonSummaryRowViewModel } from './comparison-summary-row-vm' 6 | 7 | export interface ComparisonSummarySectionViewModel { 8 | header: ComparisonSummaryRowViewModel 9 | rows: ComparisonSummaryRowViewModel[] 10 | rowsWithDiffs: number 11 | expanded: Writable 12 | } 13 | -------------------------------------------------------------------------------- /tests/integration/bundle-exit-code/checks/checks.yaml: -------------------------------------------------------------------------------- 1 | # yaml-language-server: $schema=../../../../packages/check-core/schema/check.schema.json 2 | 3 | # This check is designed to always fail so that we can test the exit code of the `sde bundle` command 4 | - describe: Force a failed check 5 | tests: 6 | - it: should always fail 7 | scenarios: 8 | - with_inputs: all 9 | at: default 10 | datasets: 11 | - name: Total inventory 12 | predicates: 13 | - eq: 0 14 | -------------------------------------------------------------------------------- /packages/check-core/src/check/check-config.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2022 Climate Interactive / New Venture Fund 2 | 3 | import type { LoadedBundle } from '../bundle/bundle-types' 4 | 5 | export interface CheckOptions { 6 | /** The strings containing check tests in YAML format. */ 7 | tests: string[] 8 | } 9 | 10 | export interface CheckConfig { 11 | /** The loaded bundle being checked. */ 12 | bundle: LoadedBundle 13 | 14 | /** The strings containing check tests in YAML format. */ 15 | tests: string[] 16 | } 17 | -------------------------------------------------------------------------------- /examples/template-svelte/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "arrowParens": "avoid", 3 | "bracketSpacing": true, 4 | "printWidth": 120, 5 | "semi": false, 6 | "singleQuote": true, 7 | "tabWidth": 2, 8 | "trailingComma": "none", 9 | "plugins": ["prettier-plugin-svelte"], 10 | "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }], 11 | "svelteSortOrder": "options-scripts-markup-styles", 12 | "svelteIndentScriptAndStyle": false, 13 | "svelteStrictMode": false, 14 | "svelteAllowShorthand": true 15 | } 16 | -------------------------------------------------------------------------------- /examples/template-svelte/packages/app/src/components/selector/selector-vm.ts: -------------------------------------------------------------------------------- 1 | import type { SyncWritable } from '@shared/stores' 2 | 3 | export interface SelectorOption { 4 | value: string 5 | stringKey: string 6 | } 7 | 8 | export interface SelectorViewModel { 9 | /** The options for the selector. */ 10 | options: SelectorOption[] 11 | /** The selected value. */ 12 | selectedValue: SyncWritable 13 | /** Called when the user has changed the value. */ 14 | onUserChange?: (newValue: string) => void 15 | } 16 | -------------------------------------------------------------------------------- /packages/check-ui-shell/.storybook/vitest.setup.ts: -------------------------------------------------------------------------------- 1 | import { beforeAll } from 'vitest' 2 | import { setProjectAnnotations } from '@storybook/svelte-vite' 3 | import * as previewAnnotations from './preview' 4 | 5 | // This is an important step to apply the right configuration when testing your stories. 6 | // More info at: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations 7 | const annotations = setProjectAnnotations([previewAnnotations]) 8 | 9 | beforeAll(annotations.beforeAll) 10 | -------------------------------------------------------------------------------- /packages/runtime/docs/interfaces/LookupDef.md: -------------------------------------------------------------------------------- 1 | [@sdeverywhere/runtime](../index.md) / LookupDef 2 | 3 | # Interface: LookupDef 4 | 5 | Specifies the data that will be used to set or override a lookup definition. 6 | 7 | ## Properties 8 | 9 | ### varRef 10 | 11 | **varRef**: [`VarRef`](VarRef.md) 12 | 13 | The reference that identifies the lookup or data variable to be modified. 14 | 15 | ___ 16 | 17 | ### points 18 | 19 | `Optional` **points**: `Float64Array` 20 | 21 | The lookup data as a flat array of (x,y) pairs. 22 | -------------------------------------------------------------------------------- /examples/sample-check-bundle/tsconfig-base.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration that is shared between 2 | // testing (`tsconfig-test.json`) and production builds (`tsconfig-build.json`). 3 | { 4 | "extends": "../../tsconfig-common.json", 5 | "compilerOptions": { 6 | "outDir": "./dist", 7 | "allowJs": false, 8 | "resolveJsonModule": true, 9 | "module": "es6", 10 | "target": "es6", 11 | "noImplicitAny": true, 12 | "noUnusedLocals": true, 13 | "noUnusedParameters": true 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/plugin-config/src/__tests__/config2/inputs.csv: -------------------------------------------------------------------------------- 1 | id,input type,viewid,varname,label,view level,group name,slider min,slider max,slider/switch default,slider step,units,format,reversed,range 2 start,range 3 start,range 4 start,range 5 start,range 1 label,range 2 label,range 3 label,range 4 label,range 5 label,enabled value,disabled value,controlled input ids,listing label,description 2 | 1,slider,v1,Input A,Slider A Label,,Input Group 1,-50,50,0,1,%,,,-25,-10,10,25,,lowest,low,status quo,high,highest,,,,This is a description of Slider A 3 | -------------------------------------------------------------------------------- /packages/plugin-config/src/__tests__/config3/inputs.csv: -------------------------------------------------------------------------------- 1 | id,input type,viewid,varname,label,view level,group name,slider min,slider max,slider/switch default,slider step,units,format,reversed,range 2 start,range 3 start,range 4 start,range 5 start,range 1 label,range 2 label,range 3 label,range 4 label,range 5 label,enabled value,disabled value,controlled input ids,listing label,description 2 | 1,slider,v1,Input A,Slider A Label,,Input Group 1,-50,50,0,1,%,,,-25,-10,10,25,,lowest,low,status quo,high,highest,,,,This is a description of Slider A 3 | -------------------------------------------------------------------------------- /packages/runtime/tsconfig-build.json: -------------------------------------------------------------------------------- 1 | // This contains the TypeScript configuration for production builds. 2 | { 3 | "extends": "./tsconfig-base.json", 4 | "include": ["src/**/*"], 5 | // TODO: For now we keep mocks included in the built package because they 6 | // are used by the runtime-async tests. Consider moving these to a separate 7 | // internal package so that we can keep them out of the published runtime package. 8 | // "exclude": ["src/**/_mocks/**/*", "**/*.spec.ts"] 9 | "exclude": ["**/*.spec.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /examples/template-svelte/packages/app/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "arrowParens": "avoid", 3 | "bracketSpacing": true, 4 | "printWidth": 120, 5 | "semi": false, 6 | "singleQuote": true, 7 | "tabWidth": 2, 8 | "trailingComma": "none", 9 | "plugins": ["prettier-plugin-svelte"], 10 | "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }], 11 | "svelteSortOrder": "options-scripts-markup-styles", 12 | "svelteIndentScriptAndStyle": false, 13 | "svelteStrictMode": false, 14 | "svelteAllowShorthand": true 15 | } 16 | -------------------------------------------------------------------------------- /packages/build/tests/config/sde.config.js: -------------------------------------------------------------------------------- 1 | import { resolve as resolvePath } from 'path' 2 | 3 | export async function config() { 4 | return { 5 | rootDir: resolvePath(__dirname, '..'), 6 | prepDir: resolvePath(__dirname, 'sde-prep'), 7 | modelFiles: [resolvePath(__dirname, '..', '_shared', 'sample.mdl')], 8 | modelSpec: async () => { 9 | return { 10 | inputs: [{ varName: 'Y', defaultValue: 0, minValue: -10, maxValue: 10 }], 11 | outputs: [{ varName: 'Z' }] 12 | } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/plugin-worker/template-worker/worker.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 Climate Interactive / New Venture Fund 2 | 3 | // NOTE: This import *must* specify "worker" at the end (instead of the general 4 | // "index" import), otherwise Vite will pull in more code than necessary and it will 5 | // generate a worker that won't run correctly in Node or the browser. 6 | import { exposeModelWorker } from '@sdeverywhere/runtime-async/worker' 7 | 8 | import loadGeneratedModel from '@_generatedModelFile_' 9 | 10 | exposeModelWorker(loadGeneratedModel) 11 | -------------------------------------------------------------------------------- /packages/runtime-async/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'tsup' 2 | 3 | export default defineConfig({ 4 | tsconfig: 'tsconfig-build.json', 5 | // Note that we generate separate runner and worker entrypoints; the 6 | // worker one in particular is used by plugin-worker to avoid having 7 | // Vite pull in extra code that breaks the worker 8 | entry: ['src/index.ts', 'src/runner.ts', 'src/worker.ts'], 9 | format: ['esm', 'cjs'], 10 | dts: true, 11 | splitting: false, 12 | sourcemap: true, 13 | clean: true 14 | }) 15 | -------------------------------------------------------------------------------- /packages/build/docs/interfaces/BuildOptions.md: -------------------------------------------------------------------------------- 1 | [@sdeverywhere/build](../index.md) / BuildOptions 2 | 3 | # Interface: BuildOptions 4 | 5 | ## Properties 6 | 7 | ### config 8 | 9 | `Optional` **config**: `string` \| [`UserConfig`](UserConfig.md) 10 | 11 | The path to an `sde.config.js` file, or a `UserConfig` object. 12 | 13 | ___ 14 | 15 | ### logLevels 16 | 17 | `Optional` **logLevels**: [`LogLevel`](../types/LogLevel.md)[] 18 | 19 | The log levels to include. If undefined, the default 'info' and 'error' levels 20 | will be active. 21 | -------------------------------------------------------------------------------- /packages/create/bin/create-sde.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 'use strict' 3 | 4 | const currentVersion = process.versions.node 5 | const requiredMajorVersion = parseInt(currentVersion.split('.')[0], 10) 6 | const minimumMajorVersion = 20 7 | 8 | if (requiredMajorVersion < minimumMajorVersion) { 9 | console.error(`Node.js v${currentVersion} is not supported by SDEverywhere.`) 10 | console.error(`Please use Node.js v${minimumMajorVersion} or higher.`) 11 | process.exit(1) 12 | } 13 | 14 | import('../dist/index.js').then(({ main }) => main()) 15 | -------------------------------------------------------------------------------- /packages/plugin-check/template-report/src/global.css: -------------------------------------------------------------------------------- 1 | #overlay-content { 2 | position: fixed; 3 | display: flex; 4 | flex-direction: column; 5 | flex: 1; 6 | bottom: 0; 7 | right: 0; 8 | margin-right: 1rem; 9 | margin-bottom: 1rem; 10 | max-width: 80%; 11 | max-height: 80%; 12 | overflow-y: auto; 13 | padding: 1rem; 14 | border-radius: 0.5rem; 15 | background-color: #ddd; 16 | color: #000; 17 | box-shadow: 0 3px 6px rgba(0, 0, 0, 0.8); 18 | } 19 | 20 | #overlay-content .overlay-error { 21 | color: crimson; 22 | } 23 | -------------------------------------------------------------------------------- /examples/hello-world/model/sample.mdl: -------------------------------------------------------------------------------- 1 | {UTF-8} 2 | 3 | Production slope = 1 4 | ~ [0,10,1] 5 | ~ 6 | | 7 | 8 | Production start year = 2020 9 | ~ [2020,2070,1] 10 | ~ 11 | | 12 | 13 | Production years = 30 14 | ~ [0,30,1] 15 | ~ 16 | | 17 | 18 | Initial inventory = 1000 19 | ~~| 20 | 21 | Total inventory = Initial inventory + RAMP(Production slope, Production start year, Production start year + Production years) 22 | ~~| 23 | 24 | INITIAL TIME = 2000 ~~| 25 | FINAL TIME = 2100 ~~| 26 | TIME STEP = 1 ~~| 27 | SAVEPER = TIME STEP ~~| 28 | -------------------------------------------------------------------------------- /models/trig/trig.dat: -------------------------------------------------------------------------------- 1 | ARCCOS calculation 2 | 0 1 3 | 1 1 4 | 2 1 5 | 3 1 6 | ARCSIN calculation 7 | 0 1 8 | 1 1 9 | 2 1 10 | 3 1 11 | ARCTAN calculation 12 | 0 1 13 | 1 1 14 | 2 1 15 | 3 1 16 | COS calculation 17 | 0 0.540302 18 | 1 0.540302 19 | 2 0.540302 20 | 3 0.540302 21 | FINAL TIME 22 | 0 3 23 | INITIAL TIME 24 | 0 0 25 | SAVEPER 26 | 0 1 27 | 1 1 28 | 2 1 29 | 3 1 30 | SIN calculation 31 | 0 0.841471 32 | 1 0.841471 33 | 2 0.841471 34 | 3 0.841471 35 | TAN calculation 36 | 0 1.55741 37 | 1 1.55741 38 | 2 1.55741 39 | 3 1.55741 40 | TIME STEP 41 | 0 1 42 | -------------------------------------------------------------------------------- /packages/parse/src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Climate Interactive / New Venture Fund 2 | 3 | export * from './_shared/canonical-id' 4 | 5 | export * from './ast/ast-types' 6 | export * from './ast/print-expr' 7 | export * from './ast/reduce-expr' 8 | 9 | export * from './vensim/parse-vensim-subscript-range' 10 | export * from './vensim/parse-vensim-expr' 11 | export * from './vensim/parse-vensim-equation' 12 | export * from './vensim/parse-vensim-model' 13 | export * from './vensim/preprocess-vensim' 14 | export * from './vensim/vensim-parse-context' 15 | -------------------------------------------------------------------------------- /packages/check-ui-shell/src/app-shell.svelte: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | 16 | {#if appViewModel} 17 | 18 | {/if} 19 | -------------------------------------------------------------------------------- /packages/plugin-config/src/read-config.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 Climate Interactive / New Venture Fund 2 | 3 | export function optionalString(stringValue?: string): string | undefined { 4 | if (stringValue !== undefined && stringValue.length > 0) { 5 | return stringValue 6 | } else { 7 | return undefined 8 | } 9 | } 10 | 11 | export function optionalNumber(stringValue?: string): number | undefined { 12 | if (stringValue !== undefined && stringValue.length > 0) { 13 | return Number(stringValue) 14 | } else { 15 | return undefined 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tests/integration/model-check/model-check-test.mdl: -------------------------------------------------------------------------------- 1 | {UTF-8} 2 | 3 | Production slope = 1 4 | ~ [0,10,1] 5 | ~ 6 | | 7 | 8 | Production start year = 2020 9 | ~ [2020,2070,1] 10 | ~ 11 | | 12 | 13 | Production years = 30 14 | ~ [0,30,1] 15 | ~ 16 | | 17 | 18 | Initial inventory = 1000 19 | ~~| 20 | 21 | Total inventory = Initial inventory + RAMP(Production slope, Production start year, Production start year + Production years) 22 | ~~| 23 | 24 | INITIAL TIME = 2000 ~~| 25 | FINAL TIME = 2100 ~~| 26 | TIME STEP = 1 ~~| 27 | SAVEPER = TIME STEP ~~| 28 | -------------------------------------------------------------------------------- /tests/integration/override-lookups/override-lookups.dat: -------------------------------------------------------------------------------- 1 | A data[A1] 2 | 2000 100 3 | 2001 200 4 | 2002 300 5 | A data[A2] 6 | 2000 101 7 | 2001 201 8 | 2002 301 9 | B data[A1,B1] 10 | 2000 102 11 | 2001 202 12 | 2002 302 13 | B data[A1,B2] 14 | 2000 103 15 | 2001 203 16 | 2002 303 17 | B data[A1,B3] 18 | 2000 104 19 | 2001 204 20 | 2002 304 21 | B data[A2,B1] 22 | 2000 105 23 | 2001 205 24 | 2002 305 25 | B data[A2,B2] 26 | 2000 106 27 | 2001 206 28 | 2002 306 29 | B data[A2,B3] 30 | 2000 107 31 | 2001 207 32 | 2002 307 33 | C data 34 | 2000 110 35 | 2001 210 36 | 2002 310 37 | -------------------------------------------------------------------------------- /models/comments/comments_check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MODEL_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 4 | PROJ_DIR="$MODEL_DIR/../.." 5 | SDE_MAIN="$PROJ_DIR/packages/cli/src/main.js" 6 | 7 | cd $MODEL_DIR 8 | node "$SDE_MAIN" generate --preprocess comments.mdl 9 | 10 | diff expected.mdl build/comments.mdl > build/diff.txt 2>&1 11 | if [ $? != 0 ]; then 12 | echo 13 | echo "ERROR: 'sde generate --preprocess' produced unexpected results:" 14 | echo 15 | cat build/diff.txt 16 | echo 17 | exit 1 18 | fi 19 | 20 | echo "All validation checks passed!" 21 | -------------------------------------------------------------------------------- /models/preprocess/preprocess_check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MODEL_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 4 | PROJ_DIR="$MODEL_DIR/../.." 5 | SDE_MAIN="$PROJ_DIR/packages/cli/src/main.js" 6 | 7 | cd $MODEL_DIR 8 | node "$SDE_MAIN" generate --preprocess input.mdl 9 | 10 | diff expected.mdl build/input.mdl > build/diff.txt 2>&1 11 | if [ $? != 0 ]; then 12 | echo 13 | echo "ERROR: 'sde generate --preprocess' produced unexpected results:" 14 | echo 15 | cat build/diff.txt 16 | echo 17 | exit 1 18 | fi 19 | 20 | echo "All validation checks passed!" 21 | -------------------------------------------------------------------------------- /packages/check-ui-shell/src/components/_shared/keyboard.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 Climate Interactive / New Venture Fund 2 | 3 | /** 4 | * Return true if the keyboard event is from an editable element (e.g., ``, 5 | * `