Page 1 of 1

Return degraded state to a certain value

Posted: Wed May 16, 2018 9:38 am
by nesheim
Hi

I need help on how to make my "Bearing condition" return to value 10 (100% condition) after it has been replaced (maintenance)

Right now I just put the equation as IF THEN ELSE(Bearings Condition EL 1<=2, 10, 0), so that every time the condition drops to 20% it is replaced.
However, as you see here the value given when statement is true us 10. I have 2 remaining = 12. Setting true statement to 8 will not solve my problem, as I need in several places in my simulation values set to its original ( starting) value after a maintenance event.

Is there a function to set a level to its original value when it has reached a certain value.

+Is there a way to count these events? (Number of times a level has been set to original value)

Thanks

Re: Return degraded state to a certain value

Posted: Wed May 16, 2018 9:57 am
by Administrator
Can you upload the model?

It's straightforward to do, and much easier if we can look at your model and show you how to do it.

Re: Return degraded state to a certain value

Posted: Wed May 16, 2018 11:15 am
by nesheim
I uploaded the model

Re: Return degraded state to a certain value

Posted: Wed May 16, 2018 1:56 pm
by tomfid
The generic approach is as follows.

You have:

stock = INTEG( flow, init val )

you can reset the stock with:

stock = INTEG( flow + reset, init val )
reset = (desired stock - stock)/TIME STEP - flow

In other words, the reset has to (a) adjust the stock toward the desired value (which might be init val) instantly, and (b) cancel out any net flows that would otherwise disturb it.

Re: Return degraded state to a certain value

Posted: Tue May 22, 2018 9:33 am
by nesheim
I still can't figure this out.

Is "reset" a function? I can not find it in the functions list. I tried both in the stock and flow boxes.
I am using Vensim PLE 7.2a

Typing in reset does not work either.

Re: Return degraded state to a certain value

Posted: Tue May 22, 2018 12:35 pm
by tomfid
"reset" is an additional variable.

Re: Return degraded state to a certain value

Posted: Tue May 22, 2018 5:28 pm
by nesheim
I got it to work. What a great forum.

Thanks for the quick reply!

Re: Return degraded state to a certain value

Posted: Tue May 22, 2018 5:29 pm
by tomfid
Great!

Re: Return degraded state to a certain value

Posted: Thu May 24, 2018 12:07 pm
by krissCraft
I kind of have the same problem, except I have a negative rate reducing the value in a Level. I use the same kind of "reset", however, the value does not Return to the initial value, but "initial value-rate"

How can I stop the rate from affecting the stock when need it reset?

Lets say the initial value is 100, and rate -20. When value reaches 20, I want it reset to 100. But it resets to 80, most likely because the rate made it 100-20=80
How do I make the rate = 0 when I need the stock level reset?

Thanks :)

Re: Return degraded state to a certain value

Posted: Thu May 24, 2018 12:09 pm
by Administrator
krissCraft wrote:I kind of have the same problem, except I have a negative rate reducing the value in a Level. I use the same kind of "reset", however, the value does not Return to the initial value, but "initial value-rate"

How can I stop the rate from affecting the stock when need it reset?

Lets say the initial value is 100, and rate -20. When value reaches 20, I want it reset to 100. But it resets to 80, most likely because the rate made it 100-20=80
How do I make the rate = 0 when I need the stock level reset?

Thanks :)
Can you upload the model? It's much easier to give you an answer if we can see what you are doing.

Re: Return degraded state to a certain value

Posted: Thu May 24, 2018 12:10 pm
by tomfid
Your case should just be the negative of the solution above:

stock = INTEG( - flow + reset, init val )
reset = (desired stock - stock)/TIME STEP + flow

Re: Return degraded state to a certain value

Posted: Thu May 24, 2018 12:23 pm
by krissCraft
Now it resets just how I want it to. Thank you. I should have seen that myself.