simulate.sim.vam: Simulation of virtual age model

View source: R/vam.R

simulate.sim.vamR Documentation

Simulation of virtual age model

Description

simulate generates a realization of Corrective Maintenance (CM) and planned Preventive Maintenance (PM) times of a virtual age model. The last simulated data set is also memorized inside the sim.vam object used for specifying the simulation model.

Usage

## S3 method for class 'sim.vam'
simulate(sim, stop.policy = 10, nb.system=1, cache.size=500, as.list=FALSE, data=NULL)

Arguments

sim

an object of class sim.vam specifying the virtual age model used for simulation.

stop.policy

indicates when to stop the simulation. stop.policy can be a scalar, then the simulation stop as soon as the number of maintenance (CM or PM) times per system (per CM-PM trajectory) reaches stop.policy. Otherwise stop.policy can be a symbolic formula, details of formula specifications are given under ‘Details’.

nb.system

the number of parallel systems (trajectories of the CM-PM process) to simulate.

cache.size

if the number of events to generate can not be directly determined thanks to the stop.policy and need to be dynamically allocated, cache.size specifies the length of each size reallocation of the table of results.

as.list

by default the function returns a data frame. But, if nb.system>1 and as.list==TRUE, the result returned is a list. The inside code of the function use a list, then if as.list==TRUE a data set class conversion is avoid and the executing time of the function can be faster when nb.system is large.

data

NOT YET IMPLEMENTED ! but the idea is to simulate the future of the data set data if this one is specified.

Details

Successive maintenance time simulation is done iteratively on each system. A symbolic formula can be written in stop.policy in order to describe when to stop the simulation. This criteria is applied to each simulated system. The symbolic formula of stop.policy can combined as many different stop conditions as required thanks to the operators | and &:

cond1 | cond2

stops as soon as cond1 or cond2 is verified.

cond1 & cond2

stops as soon as cond1 and cond2 are verified.

The stopping conditions available for cond1, cond2 and so on are of the form:

Time>a

stops as soon as the last simulated maintenance time is greater than a.

T>a

shortcut for Time>a.

Size==a

stops as soon as the total number of simulated maintenance times is equal to a.

S==a or Size>=a or S>=a

shortcut for Size==a.

Size[b]==a

stops as soon as the total number of simulated maintenance times of type b is equal to a. CM type is denoted -1. And the successive different types of PM effects defined in the formula of SimModel are denoted 1, 2, ...

S[b]==a or Size[b]>=a or S[b]>=a

shortcut for Size[b]==a.

Time>(RightCensorship=a)

stops as soon as the last simulated maintenance time is greater than a. In addition, all the possible simulated maintenance time greater than a (at least the last maintenance time simulated) are censored at time a: their times are equal to a and their types to 0. In this case, a can also be replaced by a random time distribution name, with a capital first letter and followed by its arguments: for example Unif(20,30). Then, the censorship times of each system will be simulated with the corresponding random distribution, in the previous example runif(nb.system,20,30).

T>(RC=a)

shortcut for Time>(RightCensorship=a).

Value

By default, the function produces one data frame containing all the simulated maintenances. Each line corresponds to a maintenance. If nb.system==1, the generated data frame has two columns. The first one, called Time, indicates the successive maintenance times. The second one, called Type, indicates the corresponding maintenance types. CM type is denoted -1. The successive different types of PM effects defined in the formula of SimModel are denoted 1, 2, ... Censorship time type is denoted 0. If nb.system>1, a column is added at the beginning. Its name is System, and it precises for each event to which system it refers to. The different system are denoted 1, 2, ...

If as.list=FALSE and nb.system>1, the function produces a list. Each element of the list corresponds to a different system and is a data frame with the two columns Time and Type.

Author(s)

L. Doyen and R. Drouilhet

See Also

sim.vam for model definition.

Examples

simARAInf<-sim.vam(  ~ (ARAInf(.4) | Weibull(.001,2.5)))
(simulate(simARAInf,Time>25))
(simulate(simARAInf,Time>(RightCensorship=25)))
(simData_Multi<-simulate(simARAInf,T>(RC=Unif(20,30)),nb.system=5))

(simulate(simARAInf,Time>25 | Size>5))
time_max<-100
size_max<-5.5
(simulate(simARAInf,Time>time_max|Size>size_max))
(simulate(simARAInf,Time>25 & Size>5))
(simulate(simARAInf,T>100 & S>5))
(simulate(simARAInf,T>(RC=25) & S>5))

simCMPM<-sim.vam(  ~ (ARA1(.9) | Weibull(.001,2.5)) & (ARAInf(.4) | AtIntensity(0.2)))
simData<-simulate(simCMPM,Size[-1]>10&Size[1]>5)
table(simData$Type)
simData<-simulate(simCMPM,Size[-1]>10|Size[1]>5)
table(simData$Type)
simData<-simulate(simCMPM,(Size[-1]>10&Size[1]>5)|Size>15)
table(simData$Type)

rcqls/VAM documentation built on Jan. 14, 2024, 9:07 p.m.