Learn R Programming

mistat (version 0.999)

pistonSimulation: The Piston Simulator

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

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

Value

  • A data frame, a matrix-like structure, with each * n rows and with columns: lll{ 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$) }

Details

Factors affect the Cycle Time $s$ via a chain of nonlinear equations: $$s = 2\pi\sqrt{\frac{M}{k + S^2 \frac{P_0 V_0}{T_0} \frac{T}{V^2}}}$$ where $$V = \frac{S}{2k} \sqrt{A^2 + 4k \frac{P_0 V_0}{T_0} T - a}$$ and $$A = P_0 S + 19.62M - \frac{k V_0}{S}$$

References

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

See Also

powerCircuitSimulation, simulationGroup, LATHYPPISTON

Examples

Run this code
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)

Run the code above in your browser using DataLab