[英]How to monitor a CAN signal continuously using CAPL?
There is a signal named 'A' which counts from 0 to 20 of a specified occurrence.有一个名为“A”的信号,它从指定事件的 0 到 20 计数。 The signal will reset to 0 after it counts 20. The time interval between each occurrence is 20 ms.
计数到 20 后,信号将重置为 0。每次出现之间的时间间隔为 20 毫秒。 I need to monitor this signal A for 200 times.
我需要监视这个信号A 200 次。 Whenever the counter skips a value ,say for example: 0,1,4,5..20 ,I need to to store that particular instance.
每当计数器跳过一个值时,例如: 0,1,4,5..20 ,我需要存储该特定实例。 Is there anyway to do this?
有没有办法做到这一点? Is there any commands in CAPL to catch the value of the counter signal A whenever it changes.?
CAPL 中是否有任何命令可以在计数器信号A发生变化时捕获它的值。?
When running in a test node there are several methods available for reacting on signals.在测试节点中运行时,有多种方法可用于对信号做出反应。
Their names all start with testWaitForSignal
.他们的名字都以
testWaitForSignal
。 You can simply check CANoe's documentation for details.您可以简单地查看 CANoe 的文档以获取详细信息。
For your particular use case, you could use对于您的特定用例,您可以使用
testWaitForSignalMatch(<signal>, <expectedValue>, 20)
The call will return latest after 20ms.调用将在 20 毫秒后最晚返回。 The return value will either be
1
, which means the signal had the expected value within 20ms or 0
, which means the signal did not have the expected value within 20ms .返回值将是
1
,这意味着信号在 20ms 内具有预期值或0
,这意味着信号在 20ms 内没有预期值。
When running in a simulation/measurement node, there is no possibility to wait , as that would block the simulation.在模拟/测量节点中运行时,不可能等待,因为这会阻止模拟。
What you can do in these nodes is to create an event handler like您可以在这些节点中做的是创建一个事件处理程序,如
on signal_change <signal>
In this event handler you can access the value of the signal by using $<signal>
.在此事件处理程序中,您可以使用
$<signal>
访问信号的值。
The current timestamp can be gotten with a call to timeNowNS()
.当前时间戳可以通过调用
timeNowNS()
。
Using this information you could implement your logic in a simulation node.使用此信息,您可以在模拟节点中实现您的逻辑。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.