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

Handle case where index (subscript) appears in expression position #397

Closed
chrispcampbell opened this issue Nov 15, 2023 · 0 comments · Fixed by #398 or #401
Closed

Handle case where index (subscript) appears in expression position #397

chrispcampbell opened this issue Nov 15, 2023 · 0 comments · Fixed by #398 or #401

Comments

@chrispcampbell
Copy link
Contributor

I received a Vensim model where the modeler has an equation like this (simplified):

    DimA: A1, A2 ~~|
    x[DimA] = IF THEN ELSE(DimA = A2, 1, 0) ~~|

This works fine in Vensim, but fails in SDEverywhere. We do handle the case where a dimension is used in expression position, but we don't currently handle the case where a subscript/index is used in expression position.

Note that this case is more commonly handled using separate equations (in my experience) like in the following sample, but there are probably valid use cases for subscripts in expression position, so we should fix SDE to allow the form above.

    DimA: A1, A2 ~~|
    x[A1] = 0 ~~|
    x[A2] = 1 ~~|

Or:

    DimA: A1, A2, A3 ~~|
    x[DimA] :EXCEPT: [A2] = 0 ~~|
    x[A2] = 1 ~~|
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment