You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a spec.json file is used to expose a subset of output variables, only those specified variables can be accessed as outputs. For a testing tool we are working on internally, we would like to be able to inspect the data for any variable in the model, not just the ones exposed as outputs. The En-ROADS model uses thousands of variables; if we listed them all as outputs, it would use a lot of memory and would slow down the model. It would be preferable to have a way at runtime to select the variables for which to capture data into the output buffer.
I'm envisioning a few parts to this:
Add a new sde generate --listjson option that outputs a JSON file containing information about all variables and subscripts used in the model. (This would also be useful for a dependency tree tracking tool that we developed internally.)
Generate a new storeOutput function that includes a big switch statement, which will select the output (and subscripts) by index based on the values from the outputIndices buffer:
chrispcampbell
changed the title
Add support for accessing data for any variable at runtime
Add support for capturing data for any variable at runtime
Aug 27, 2021
That looks useful. Instead of adding a new --listjson option we could add JSON output to the --list option. It already outputs all variables and subscripts in text and YAML format. It could do JSON too, or JSON could replace YAML. I'm probably the only one who uses the YAML listing, for my dependency tool.
When a
spec.json
file is used to expose a subset of output variables, only those specified variables can be accessed as outputs. For a testing tool we are working on internally, we would like to be able to inspect the data for any variable in the model, not just the ones exposed as outputs. The En-ROADS model uses thousands of variables; if we listed them all as outputs, it would use a lot of memory and would slow down the model. It would be preferable to have a way at runtime to select the variables for which to capture data into the output buffer.I'm envisioning a few parts to this:
Add a new
sde generate --listjson
option that outputs a JSON file containing information about all variables and subscripts used in the model. (This would also be useful for a dependency tree tracking tool that we developed internally.)Accept a new
outputIndices
buffer parameter:storeOutput
function that includes a big switch statement, which will select the output (and subscripts) by index based on the values from theoutputIndices
buffer:The flag would be set to 0 by default so that there would be no impact on size/speed unless you opt-in to use this new output mode.
Things to revisit before finalizing this work:
--genc
and--list
in the same command so that we don't have to runsde
twicestoreOutput
if they have more than 3 dimensions (we only support variables with <= 3 dimensions for now)The text was updated successfully, but these errors were encountered: