简体   繁体   English

CAPL 脚本接收一次消息

[英]CAPL scripting receive a message once

I have a requirement that mandates that each signal inside a frame will be sent at ECU initialization with an initial value.我有一个要求,要求帧内的每个信号都将在 ECU 初始化时以初始值发送。 so I need to capture this value using CAPL what I did is that I defined a variable as follows:所以我需要使用 CAPL 捕获这个值我所做的是我定义了一个变量,如下所示:

first_reception = 0 ;

and then inside the message event I get the initial value if this variable equals to zero, and save it to a system variable then set first_reception to 1:然后在消息事件中,如果此变量等于零,我将获得初始值,并将其保存到系统变量中,然后将 first_reception 设置为 1:

{

 if (first_reception == 0 )
 {
   @sysvar::mymsg::signal_initialValue = this.signal;
   first_reception = 1;

 }

}

the issue here is that I have many frames so I wonder if there is another way to call the event once so that I don't have to define a variable for each frame这里的问题是我有很多帧,所以我想知道是否有另一种方法可以调用一次事件,这样我就不必为每个帧定义一个变量

I have a requirement that mandates that each signal inside a frame will be sent at ECU initialization with an initial value.我有一个要求,要求帧内的每个信号都将在 ECU 初始化时以初始值发送。 so I need to capture this value using CAPL what I did is that I defined a variable as follows:所以我需要使用 CAPL 捕获这个值我所做的是我定义了一个变量,如下所示:

first_reception = 0 ;

and then inside the message event I get the initial value if this variable equals to zero, and save it to a system variable then set first_reception to 1:然后在消息事件中,如果此变量等于零,我将获得初始值,并将其保存到系统变量中,然后将 first_reception 设置为 1:

{

 if (first_reception == 0 )
 {
   @sysvar::mymsg::signal_initialValue = this.signal;
   first_reception = 1;

 }

}

the issue here is that I have many frames so I wonder if there is another way to call the event once so that I don't have to define a variable for each frame这里的问题是我有很多帧,所以我想知道是否有另一种方法可以调用一次事件,这样我就不必为每个帧定义一个变量

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM