Help with simple component state modeling

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

Help with simple component state modeling

Post by Nub_User »

Hi colleagues,

I am new to using Vensim, and I am writing to ask for your help with my simple model's equations.

Component modeling is simple: it requires a component to vary between two states 1 (available) and 0 (failed). These states are given by the likelihood of being recovered and by the likelihood of failure. I'm even fine, I could raise the equations with IF THEN ELSE and RANDOM UNIFORM equations, and the model works fine with the component going in and out of service.

The problem I have is that I cannot correctly implement the following additional characteristic that the proposal has. Once the component have failed (state = 0), the time for the recovery action requires 7 units of time to be able to be returned to available (state = 1).

I tried using the DELAY and SMOOTH functions. Still, the simulation always changes state without incorporating the effect of the time needed to recover (7 time units) effectively. I am attaching the model file to ask you for help to solve this problem that may be simple but that I cannot solve.
component_states.mdl
(2.32 KiB) Downloaded 130 times

Thank you very much in advance for explaining me how to solve it and for your help.
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: Help with simple component state modeling

Post by tomfid »

Try this:

Code: Select all

Fail=
        IF THEN ELSE(State=1 :AND:Failure likelihood<=2,1,0)/TIME STEP
    Units: 1/Hour
    
Failure likelihood=
    RANDOM UNIFORM(0, 100 , 1235 )
Units: dmnl

Recover= DELAY FIXED (
    Fail,Recovery time,0)
Units: 1/Hour

Recovery time=
    7
Units: Hour


State= INTEG (
    Recover-Fail,
        1)
Units: dmnl


Nub_User
Member
Posts: 38
Joined: Mon Aug 16, 2021 11:55 pm
Vensim version: PLE+

Re: Help with simple component state modeling

Post by Nub_User »

Dear @tomfid

Thank you very much, it works! But in these equations is not considerate a variable about the "likelihood of success” of the recovery action (a RANDOM UNIFORM function that emulate the success or fail of the recovery action).

Very please, could you help me to integrate this variable in the equations?

Thank you, in advance, for helping me.
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: Help with simple component state modeling

Post by tomfid »

Is the likelihood of success a one-time factor, so that the state has one chance to recover, and failure means it never recovers?

Or is it continuous, such that a mean recovery time of 7hr means that the chance of recovery is 1/7 per hour?
Nub_User
Member
Posts: 38
Joined: Mon Aug 16, 2021 11:55 pm
Vensim version: PLE+

Re: Help with simple component state modeling

Post by Nub_User »

to this type of component correspond this-> the likelihood of success is a one-time factor, so that the state has one chance to recover, and failure means it never recovers? Yes.

to another type of component we can have 2 o 3 trys to recover it and if in the second/third if we fail overall system fails.

Thanks a lot!!!!!!!
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: Help with simple component state modeling

Post by tomfid »

You might take a look at some of the models in https://metasd.com/category/model-libra ... /discrete/ and https://metasd.com/category/model-libra ... tochastic/

The one-shot recovery is fairly easy: you could just modify the Recover flow to include some randomness.

Having 2 or 3 recovery opportunities, followed by permanent failure, is trickier - I think you would need at least 2 states: one to keep track of working/failed, and another to keep track of number of recovery attempts.
Nub_User
Member
Posts: 38
Joined: Mon Aug 16, 2021 11:55 pm
Vensim version: PLE+

Re: Help with simple component state modeling

Post by Nub_User »

Thank you very much for your help and for your website with examples. I will be working following your comments.

I have one more question. In the equations line of code of your first post "/ TIME STEP" appears.:

Fail =
IF THEN ELSE (State = 1: AND: Failure likelihood <= 2,1,0) / TIME STEP

But when I type it in the VENSIM equation, a window tells me "the following inputs were not expected".

Could you please explain to me what implications this part of the equation has? From a practical point of view I ran the model deleting it so that this window does not appear.
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: Help with simple component state modeling

Post by tomfid »

If you're using PLE, you need to add TIME STEP to the diagram as a shadow variable and draw an arrow before using it in the equation.

TIME STEP is there because all flows need a concept of "how fast" - the duration over which something changes. In the case of a discrete event, changing one unit, the flow has to be 1/TIME STEP so that it integrates to 1.

If TIME STEP=1, you can get away without this, but the model will be dimensionally inconsistent. If you aren't checking units, you aren't taking advantage of the single most important automated quality check available.

See https://vensim.com/discrete-stochastic/
https://metasd.com/2017/11/discrete-time-stinks/
https://metasd.com/2010/04/rental-car-s ... -dynamics/
Nub_User
Member
Posts: 38
Joined: Mon Aug 16, 2021 11:55 pm
Vensim version: PLE+

Re: Help with simple component state modeling

Post by Nub_User »

Thank you very much @tomfid! :D

Your answers and comments help me a lot!
Post Reply