# pistonSimulation: The Piston Simulator In mistat: Data Sets, Functions and Examples from the Book: "Modern Industrial Statistics" by Kenett, Zacks and Amberti

## Description

A simulator of a piston moving whithin a cylinder. The piston's performance is measured by the time it takes to complete one cycle, in seconds. Several factors can affect the piston's performance, they are listed in the arguments section.

## Usage

 ```1 2 3 4``` ```pistonSimulation(m = 60, s = 0.02, v0 = 0.01, k = 5000, p0 = 110000, t = 296, t0 = 360, each = 50, seed = NA, check = TRUE) ```

## Arguments

 `m` the impact pressure determined by the piston weight (kg). A single value or a vector of length n. `s` the piston surface area (m^2). A single value or a vector. `v0` the initial volume of the gas inside the piston (m^3). A single value or a vector of length n. `k` the spring coefficient (N/m^3). A single value or a vector of length n. `p0` the atmospheric pressure (N/m^2). A single value or a vector of length n. `t` the surrounding ambient temperature (K). A single value or a vector of length n. `t0` the filling gas temperature (K). A single value or a vector of length n. `each` non-negative integer. Each element of previous parameters is repeated `each` times. `seed` a single value, interpreted as an integer. If specified make the simulation replicable. `check` if `TRUE` (the default) then a formal check on piston parameters is perfomed

## Details

Factors affect the Cycle Time s via a chain of nonlinear equations:

seconds = 2π sqrt(m/(k + s^2 ((p0 v0)/t0) (t/v^2)))

where

v = (s/2k) (sqrt(a^2 + 4k (p0 v0)/t0 t) - a)

and

a = p0 s + 19.62m - (k v0)/s

## Value

A data frame, a matrix-like structure, with `each` * n rows and with columns:

 m numeric value of `m` s numeric value of `s` v0 numeric value of `v0` k numeric value of `k` p0 numeric value of `p0` t numeric value of `t` t0 numeric value of `t0` seconds numeric time to complete one cycle (s)

Daniele Amberti

## References

Kenett, R., Zacks, S. with contributions by Amberti, D. Modern Industrial Statistics: with applications in R, MINITAB and JMP. Wiley.

`powerCircuitSimulation`, `simulationGroup`, `LATHYPPISTON`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14``` ```Ps <- pistonSimulation( m = rep(60, 100), s = rep(0.02, 100), v0 = rep(0.01, 100), k = rep(5000, 100), p0 = rep(110000, 100), t = c(rep(296,35), 296*1.1^(1:65)), t0 = rep(360, 100), each = 1, seed = 123, check = FALSE) head(Ps) tail(Ps) plot(Ps\$seconds) ```

### Example output ```   m    s   v0    k     p0   t  t0   seconds
1 60 0.02 0.01 5000 110000 296 360 0.5233827
2 60 0.02 0.01 5000 110000 296 360 0.3607560
3 60 0.02 0.01 5000 110000 296 360 0.4231793
4 60 0.02 0.01 5000 110000 296 360 0.4441514
5 60 0.02 0.01 5000 110000 296 360 0.5658896
6 60 0.02 0.01 5000 110000 296 360 0.3899954
m    s   v0    k     p0         t  t0   seconds
95  60 0.02 0.01 5000 110000  90126.57 360 0.5039282
96  60 0.02 0.01 5000 110000  99139.22 360 0.4667343
97  60 0.02 0.01 5000 110000 109053.14 360 0.4810305
98  60 0.02 0.01 5000 110000 119958.46 360 0.4956712
99  60 0.02 0.01 5000 110000 131954.30 360 0.4898428
100 60 0.02 0.01 5000 110000 145149.73 360 0.4957794
```

mistat documentation built on April 18, 2021, 5:07 p.m.