Vector - CAPL - 数据库和CAPL_01

目录

获取CAN总线报文信息

静态访问报文信息

动态访问报文信息

静态访问数据库信息 

DBLookup(Access Message & Signal)

1、报文类型信息

2、类型信息

3、节点信息


获取CAN总线报文信息

        我们在做CAN网络管理或者通信的测试的过程中,第一步我们需要获取的就是通过CAPL获取CAN总线的报文及其相关信息,然后与我们预期的信息比较,另外一种就是通过CAPL获取dbc的信息与CAN总线信息对比,保证通信一致性,因此这两块都是相对比较重要的内容,我就重点介绍一下。

CAN 和 LIN 报文帧特定属性:

      >  ID
      >  DLC
      >  Transmitter
      >   Attributes defined the database of these objects.
这里的信息访问可以是静态的或动态的。

ObjectMessage, LIN MessageFlexRay Frame
AttributeIDDLCTransmitterAttributesfrFrame Attributes*
Static****
Dynamic**11*

1:只能通过 DBLookup 进行动态访问。
*:FR_SlotID、FR_Cycle、类型、FR_PayloadLength、FR_Flags、FR_HeaderCRC、FR_Segment、FR_Status、DIR、模拟。

静态访问报文信息

        静态访问是对已知对象的访问。 因此,可以直接或通过使用局部变量来完成访问;这里也是我们使用非常多的一种访问方式,比如常见的报文ID、周期、DLC等信息

variables
{
  message EngineData msg;
}

void Get_CAN_Msg_ID()
{
  int myID;
//  表达方式1,直接访问消息ID
  myID = EngineData.ID;
//  表达方式2,间接访问消息ID
  myID = msg.ID;
}

动态访问报文信息

        动态访问是在不知道对象名称的情况下访问属性。 这对于使用通配符选择器的事件过程来说很常见,例如 在消息*上。

on message *
{
    //使用关键字this,通过on message直接访问总线上的报文ID
    myID = this.ID;
}

//动态访问 CAN 消息的 DLC

on message *
{
  int currentDLC;
  currentDLC = this.DLC;
}

//动态访问总线上特定报文
void foo( message * msg)
{
    if (msg.id == 0x100)
    {
       write("CAN总线上出现报文0x100");
    }
}

静态访问数据库信息 

对数据库属性的直接静态访问

variables
{
  message EngineData msg;
}

void foo ()
{
    int cycleTime;
    cycleTime = EngineData.GenMsgCycleTime;
}

void foo( int id)
{
    if (id == msg.id)
    {
       // do something
    }
}

DBLookup(Access Message & Signal)

        DBLookup函数可以访问的信息主要有报文类型、信号信息、节点信息;

1、报文类型信息

SelectorDescriptionReturn TypeMessage Type
NameMessage namechar []message, pg, linFrame, frFrame
DLCThe size of the data field in bytes defined by the DLClongmessage, linFrame, frFrame
TransmitterSend nodes of the message; empty string if the number of send nodes is zero or more than onechar []message, linFrame, frFrame
AttributeNameName of a self-defined database attributechar [] for string attribute, otherwise floatmessage, linFrame/2、

2、类型信息

SelectorDescriptionReturn TypeSignalsService Signals
bitstartStart bit of the signals in the messagedword
bitcountNumber of bits in the signaldword
offsetOffset for conversion raw value -> physical valuefloat
factorFactor for conversion raw value -> physical valuefloat
unitUnit of the signalchar []
minimumMinimum of the signalfloat, 0, if not defined
maximumMaximum of the signalfloat, signal size * physical value (factor) + offset
dbtypeSignal definition from the databasedbSig *
AttributeNameName of self-defined database attributechar [] for string attribute, otherwise float
DefaultValueDefault value of the signal,int64
FlexRay specific
NotValidLowerLimitNot valid value of the signalint64
Note: This selector is only available in FIBEX databases.
NotValidUpperLimitNot valid value of the signalint64
Note: This selector is only available in FIBEX databases.
signalgroupName of the assigned signal group;char []
empty string if the signal belongs to no group.
txpduName of the send node; with multiple senders a sender list will be returned.char []
Note: This selector is only supported for FlexRay PDUs.
frameIDID of the frame that contains the signal.dword
Note: This selector is not supported for PDUs.

3、节点信息

SelectorDescriptionReturn Type
NameName of database objectchar []
AttributeNameName of a self-defined database attributechar [] for string attribute, otherwise float

        要在指定的数据库中查找message/signal,就需要使用DBLookup(variable),通过这个函数我们去访问dbc数据库中特定报文的特定信息。通过该函数查找类型为 dbNode、dbMsg、dbPDU、dbFrFrame和dbFrPDU等数据库属性。

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

车载网络测试

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值