Help with PULSE TRAIN and random variable

Use this forum to post Vensim related questions.
Post Reply
Nub_User
Member
Posts: 39
Joined: Mon Aug 16, 2021 11:55 pm
Vensim version: PLE+

Help with PULSE TRAIN and random variable

Post by Nub_User »

Dear experts,

I need model a variable that maintains a constant value (but obtained from a random variable) that lasts for 365 days and repeats periodically every 365 days.

What I want to simulate is a constant but random value every 365 days, and that the function keeps that value constant for 365 days.

I used a function based on PULSE TRAIN and RANDOM PINK NOISE, but I get a continuous random function while I need a discrete function lasting 365.

Could you please help me with that?

Thank you very much.
Attachments
PULSE_test.mdl
(1.29 KiB) Downloaded 13 times
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Help with PULSE TRAIN and random variable

Post by tomfid »

Try this instead ...
PULSE_test 2.mdl
(2.16 KiB) Downloaded 289 times
You can also use SAMPLE IF TRUE for this (though I think it's not available in all versions).
Nub_User
Member
Posts: 39
Joined: Mon Aug 16, 2021 11:55 pm
Vensim version: PLE+

Re: Help with PULSE TRAIN and random variable

Post by Nub_User »

Thank you very much for the solution @tomfid!

Iam working with PLE+ version. SAMPLE IF TRUE is available in these version. Conceptually, how can I use it?
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Re: Help with PULSE TRAIN and random variable

Post by Administrator »

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
Nub_User
Member
Posts: 39
Joined: Mon Aug 16, 2021 11:55 pm
Vensim version: PLE+

Re: Help with PULSE TRAIN and random variable

Post by Nub_User »

Thank you @administrator.
I read the syntax and help from the documentation Help. But I was referring to how the recommendation can be implemented for the specific problem I raised.
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Re: Help with PULSE TRAIN and random variable

Post by Administrator »

SAMPLE IF TRUE will hold a value until something is "true". So create a variable that equals 1 every 365 days, and use that in the call to SAMPLE IF TRUE.
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
Nub_User
Member
Posts: 39
Joined: Mon Aug 16, 2021 11:55 pm
Vensim version: PLE+

Re: Help with PULSE TRAIN and random variable

Post by Nub_User »

thank you very much @Administrator :D
Post Reply