Code: Select all
IF THEN ELSE( pE < w ,
# if true that pE < w
IF THEN ELSE( Time-sy <= 0 ,
# if true that Time-sy <= 0
q = 1 ,
# if false that Time-sy <= 0
IF THEN ELSE( Time-sy >= py ,
# if true that Time-sy >= py
q = (1 - p) * (1-EXP(-10*(w-pE))) + EXP(-10*(w-pE)) ,
# if false that Time-sy >= py
q = ((((Time-sy)/py)) * (1-p) + (1-(Time-sy)/py)) * (1-EXP(-10*(w-pE))) + EXP(-10*(w-pE)) ),
# if false that Time-sy <= 0
q = 1 ),
# if false that pE < w
q = 1 )
Inside that second IF statement there is third one, which evaluates to 'q = 1' if TRUE, but enters a third IF statement if FALSE.
That third IF statement assigns a long calculation to q if TRUE and an even longer one if FALSE.
Whatever I do with this code, it just comes up 'Expecting an operator'.
(future enhancement tip: it would be nice to know where it's expecting an operator)
(2nd future enhancement tip: it would be great if the Vensim editor had a parentheses matching function, like most every other editor in the world. I checked all my parentheses by copying the code into Atom. All the wrapping of the individual elements appears to be what it should be (according to the code I'm translating).
Thanks!