如何随时间更改参数值? [英] How to change a parameter value over time?

查看:48
本文介绍了如何随时间更改参数值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在仿真中随时间更改volatile参数的值. IE.在模拟的第一个30s中,此后我需要exp(400ms),直到60s我需要exp(800ms),然后在60s exp(2s)之后需要interArrivalTime.

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.

推荐答案

对于易失性参数,有一个很简单的技巧.将? :运算符与simTime() NED函数一起使用:

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)

将给出:

  • exponential(400ms)30s
  • 以下 在3060s 之间的
  • exponential(800ms) 60s
  • 之后的
  • exponential(2s)
  • exponential(400ms) below 30s
  • exponential(800ms) between 30 and 60s
  • exponential(2s) after 60s

这篇关于如何随时间更改参数值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆