Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vensim name generation fails for arrays with > 2 dimensions #154

Closed
ToddFincannon opened this issue Oct 28, 2021 · 1 comment · Fixed by #155 or #190
Closed

Vensim name generation fails for arrays with > 2 dimensions #154

ToddFincannon opened this issue Oct 28, 2021 · 1 comment · Fixed by #155 or #190
Assignees
Labels
Milestone

Comments

@ToddFincannon
Copy link
Collaborator

SDEverywhere supports arrays with an unlimited number of dimensions, except for a problem when generating Vensim names in the output text file header row. For instance, generating C code for the 4D constant array:

ndim4[DimA, DimB, DimC, DimD] = 4

throws this exception:

TypeError: Cannot read property 'replace' of undefined
at decanonicalize (file:///Users/toddfincannon/Projects/SDEverywhere/src/Helpers.js:52:17)
at Object.vensimName (file:///Users/toddfincannon/Projects/SDEverywhere/src/Model.js:662:32)
at headerTitle (file:///Users/toddfincannon/Projects/SDEverywhere/src/CodeGen.js:344:18)
@ToddFincannon ToddFincannon added this to the 0.6.0 milestone Oct 28, 2021
@ToddFincannon ToddFincannon self-assigned this Oct 28, 2021
@ToddFincannon
Copy link
Collaborator Author

The vensimName function was limited to 2 subscripts. I used the new matchAll JS String function to extract subscript names with any number of dimensions. I added a 4D array variable to the arrays_cname and arrays_varname test models. I also brought arrays_varname up to date with the arrays_cname model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment