Time in function

Use this forum to post Vensim related questions.
Post Reply
StudentGER
Junior Member
Posts: 4
Joined: Sat May 03, 2025 6:36 pm
Vensim version: PLE

Time in function

Post 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?
Administrator
Super Administrator
Posts: 4832
Joined: Wed Mar 05, 2003 3:10 am

Re: Time in function

Post by Administrator »

That looks correct to me.

What is the syntax error?
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
StudentGER
Junior Member
Posts: 4
Joined: Sat May 03, 2025 6:36 pm
Vensim version: PLE

Re: Time in function

Post 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 1695 times
Screenshot 2025-05-03 213054.png
Screenshot 2025-05-03 213054.png (28.86 KiB) Viewed 1695 times
Administrator
Super Administrator
Posts: 4832
Joined: Wed Mar 05, 2003 3:10 am

Re: Time in function

Post 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 ?
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Administrator
Super Administrator
Posts: 4832
Joined: Wed Mar 05, 2003 3:10 am

Re: Time in function

Post by Administrator »

Also try the check syntax button in the editor.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
StudentGER
Junior Member
Posts: 4
Joined: Sat May 03, 2025 6:36 pm
Vensim version: PLE

Re: Time in function

Post 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 1688 times
StudentGER
Junior Member
Posts: 4
Joined: Sat May 03, 2025 6:36 pm
Vensim version: PLE

Re: Time in function

Post 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.
Post Reply