Delay of random pulses

Use this forum to post Vensim related questions.
Post Reply
aalto-comnet
Member
Posts: 37
Joined: Fri Dec 07, 2018 9:20 am
Vensim version: DSS

Delay of random pulses

Post by aalto-comnet »

Hi!

Attached you can find a model that creates pulses of random height and frequency. What I am trying to do, is to create a delay of these pulses, so that each pulse moves to the position of the next pulse, as shown in the attached figure.

However, in the current model, this is only possible when the multiplier = 1, which keeps the repeat time (i.e. the frequency) constant. For any multiplier > 1, the repeat time becomes random, and so does the delay, since the pulse train function and the delay are based on the same repeat time.

Any ideas as of how could this be possible, even without a delay but with another approach..?

Thanks! :D
Attachments
Screenshot.png
Screenshot.png (318.86 KiB) Viewed 1438 times
randomized pulse train.mdl
(3.07 KiB) Downloaded 78 times
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Re: Delay of random pulses

Post by Administrator »

I don't see how you can ever do it. You don't know when the next pulse is (as it's random), so you cannot delay the first pulse so it lines up with the 2nd.

One thing you might be able to do is to sample the time at which the next pulse happens when you generate the first pulse. That would give you the delay time. That's the only way I can think of to do this.
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
aalto-comnet
Member
Posts: 37
Joined: Fri Dec 07, 2018 9:20 am
Vensim version: DSS

Re: Delay of random pulses

Post by aalto-comnet »

Hi, and thank you for your time and feedback! :D

Knowing that there is a high chance that this can eventually never be possible is already very useful as it saves me time and effort from trying to make it happen!

May I kindly ask for some clarity though with respect to your suggestion..? I assume that what you mean is to have some Delay Variable with a SAMPLE IF TRUE function, such as:

Delay Variable = SAMPLE IF TRUE ( condition , random pulse train , random pulse train )

and then 'feed' this Delay Variable as the delay time to the Delay Fixed variable.

But what could be the condition to sample the time at which the next pulse happens when the first pulse is generated..?

Thank you once again! :)
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Delay of random pulses

Post by tomfid »

What's the purpose of this? If we knew, there might be some easier alternative.

You could certainly use SAMPLE IF TRUE, or the equivalent stock formulation, to store the height of the previous pulse, until needed when the next one occurs.
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Delay of random pulses

Post by tomfid »

Try this?
pulse.mdl
(2.56 KiB) Downloaded 122 times
aalto-comnet
Member
Posts: 37
Joined: Fri Dec 07, 2018 9:20 am
Vensim version: DSS

Re: Delay of random pulses

Post by aalto-comnet »

Hi tomfid, and thank you for your answer and model!

You are right, there might be an easier way, so let me clarify. The purpose is to use the pulses as inflow and outflow for the same stock. Every time a new pulse goes in the stock, the previous pulse should come out of the stock. This is why I was trying to create a delay.

I am currently trying to understand what happens in the model you shared, but if you think there could be an easier way, I would be happy to know..!

Thank you again! :)
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Delay of random pulses

Post by tomfid »

Ah, that makes sense. Pretty sure my example would work. If the entirety of the stock always flows out, then there's a simpler way.
pulse2.mdl
(5.91 KiB) Downloaded 121 times
aalto-comnet
Member
Posts: 37
Joined: Fri Dec 07, 2018 9:20 am
Vensim version: DSS

Re: Delay of random pulses

Post by aalto-comnet »

Hi Tom, and thank you very much for your feedback and models!! :D

The behaviour that I was looking for is already there in the first model that you shared! It's the 'previous pulse height' stock!

If you double check the second model, you will notice that the behaviour of all three stocks is the same (just a small mismatch in the initial value)!

Sorry that I did not catch you before you put more effort for the second version, I was apparently thinking about it in a much more complicated way..!

Once again, thank you so much, this was very useful overall! :)
Post Reply