Page 1 of 1

Time in function

Posted: Sat May 03, 2025 6:57 pm
by StudentGER
Good afternoon,
I am new to Vensim PLE. Thanks a lot for sharing the software!

In a model I'd like to have a variable changed at a certain simulation time. However, " IF THEN ELSE (Time >15 , 1000 , 0 ) " for a normal auxiliary gets me a syntax error. My model runs from 0.0 to 100.0 months, time step = 1, Euler in Vensim PLE 10.3.1. Is the idea to use the internal time variable wrong, do I have to use a step or pulse function?

Re: Time in function

Posted: Sat May 03, 2025 7:11 pm
by Administrator
That looks correct to me.

What is the syntax error?

Re: Time in function

Posted: Sat May 03, 2025 7:36 pm
by StudentGER
Thanks for your quick response.
It says "The equation has a syntax error. Do you want to ignore this and close the editor?" in the Equation Editor.
Screenshot 2025-05-03 213215.png
Screenshot 2025-05-03 213215.png (107.79 KiB) Viewed 1674 times
Screenshot 2025-05-03 213054.png
Screenshot 2025-05-03 213054.png (28.86 KiB) Viewed 1674 times

Re: Time in function

Posted: Sat May 03, 2025 7:46 pm
by Administrator
Try adding time to the sketch using the shadow variable tool <V>. Then draw an arrow from time to your auxiliary. Does that fix things ?

Re: Time in function

Posted: Sat May 03, 2025 7:47 pm
by Administrator
Also try the check syntax button in the editor.

Re: Time in function

Posted: Sat May 03, 2025 7:52 pm
by StudentGER
Yes, after adding Time as shadow varaible and re-entering in the equation editor by setting time from the list of available variables it works as I expect it to do.

Thank you very much for your quick help! I hope I can give support here, too, when I am more familar with Vensim.
Screenshot 2025-05-03 214840.jpg
Screenshot 2025-05-03 214840.jpg (94.88 KiB) Viewed 1667 times

Re: Time in function

Posted: Sat May 03, 2025 8:06 pm
by StudentGER
Just one more:
In the model version without time as shadow something is starnge:

- If I use the legacy Eqution Editor and do a "Check Syntax" or "Check Model" no Error is reported.

If I do a "Check Equation" in the new Equation Editor oz says "Syntax apperas OK, but the equation has unused inputs or variables that are not an input"
However, If I want to close the new Equation editor the syntax error message appears.

Whatever causes this behaviour... I just work around by unsing the shadow variable Time and everthing is fine.