I need to change the value of a volatile parameter over time in a simulation. I.e. in the first 30s
of the simulation I need exp(400ms)
after that, until 60s
I need exp(800ms)
and after 60s exp(2s)
for interArrivalTime
.
Asked
Active
Viewed 651 times
2

user4786271
- 1,555
- 13
- 18

Rudi
- 6,418
- 1
- 16
- 20
1 Answers
5
For volatile parameters there is a pretty easy trick. Use the ? :
operator along with the simTime()
NED function:
**.interArrivalTime = simTime() < 30s ? exponetntial(400ms) : exponential(800ms)
or you can even chain them as ?: operator is evaluated left to right:
**.interArrivalTime = exponential(simTime() < 30s ? 400ms : simTime() < 60s ? 800ms : 2s)
would give:
exponential(400ms)
below30s
exponential(800ms)
between30
and60s
exponential(2s)
after60s

Rudi
- 6,418
- 1
- 16
- 20