Mode 和 Initial value 是可以选择的,可以选择替换、增加或者是做乘法,意思就是我们从simulink导入carsim的这些量是在原来基础上替换呢还是在原来的基础上加上我们的导入值还是乘以我们的导入值的意思。
![](https://i-blog.csdnimg.cn/blog_migrate/8155fbee88f430ba1d258885c7165823.png)
where keyword is the name of the import variable, mode is one of three possible modes for using the import (ADD, MULTIPLY, or REPLACE), and initial_value is the numerical value of the imported variable during initialization. Note that mode and initial_value are optional. The keyword mode determines how the imported variable is combined with a native value embedded in the VS model. For example, if the imported variable is the brake control and the mode is REPLACE, then the brake control within the VS model is replaced with the imported value. If the mode is ADD, then the internal value is added to the imported variable. If the mode is MULTIPLY, then the internal value is multiplied by the imported value. If not specified, the default is that the mode is ADD.
Not all import variables support all three modes. The Readme file, such as the one shown in Figure 2, indicates whether the import variable is linked to an internal variable or to a constant (typically 0) in column E. For example, Figure 2 indicates that IMP_DVBK_L/R (line 61-64) is linked to an internal variable. This means that the imported value can be set for any of the three modes: ADD, MULTIPLY, or REPLACE. On the other hand, the rest of the import variables that follow (lines 44 – 60) are linked to a constant internal value 0. That means that the mode MULTIPLY would have no effect (import * 0 = 0), and that the modes ADD and REPLACE would have the same effect of using the imported variable (import + 0 = import).
![](https://i-blog.csdnimg.cn/blog_migrate/57f80198c717720dade685a9c030c8f0.png)
点击下方卡片,加入会员全年无限制学习后台(MPC各矩阵的底层逻辑、MPC纵向控制、模型验证、MPC自适应巡航控制、非线性系统如何线性化及MPC动力学跟踪任何轨迹、约束添加及新求解器的求解、轨迹规划、纵向规划等80个系列)会员专享爆品课程及资源,同时获得分佣资格,可赚回自己的学费!