Vector CANOE VT1004A配置详解

Vector CANoe CAPL系列相关文章导览,下面链接可直接跳转

Vector CANoe VT System系列板卡文章导览,下面链接可直接跳转

引言

本章节继续聊VT1004A负载和测量板卡的功能,板卡详细内容见VT_System_Manual_EN.pdf,内容为个人理解,如有错误,欢迎指正

VT1004A

每块板卡有4个通道,有如下功能

Functions for Each Channel

Various signal paths to the original loads and bus bars are switched via relays. The relays may be used, for example, to generate short circuits to ground or to battery voltage via a bus bar, or to break the line to an original load (broken wire simulation).

通过继电器切换通往原始负载和母线的各种信号路径。例如,继电器可用于产生接地短路或通过母线与电池电压短路,或断开与原始负载的线路(断线模拟)。

Relay for short circuits between the input lines

用于输入线路间短路的继电器

Electronic load for predefined current or resistance with electronic overload protection

预定义电流或电阻的电子负载,带电子过载保护功能

Voltage measurement with calculation of instantaneous, average and effective values

电压测量,可计算瞬时值、平均值和有效值

Determination of PWM signal parameters (frequency, duty cycle, high and low voltage levels)

确定 PWM 信号参数(频率、占空比、高低压电平)

Furthermore, it is possible to reverse the two-line connections of the two bus bars via relays (combined for all channels of a module).

此外,还可以通过继电器(模块所有通道的组合)反向连接两条母线的双线。

VT1104

是在VT1004A基础上的60V版本

VT1104 FPGA

暂时没有这个可编程板卡,等遇到了再补充

前后面板图

Front

Usage

Basic Connection Scheme

Connecting the ECU

这里的功能和VT2004A有点类似,有4个通道,每个通道有两个接线端,和ECU通过这两个接线端连接,即使ECU只有一个输入引脚,也必须采用双线连接,这种情况下,传感器的地接到另一个引脚上。


典型应用场景:

VT1004A/VT1104 pin aVT1004A/VT1104 pin b
Reference potential ground
(e.g. high side switch in ECU)
ECU connectionGround(ECU ground!)
Reference potential V b a t t V_{batt} Vbatt
(e.g. low side switch in ECU)
V b a t t V_{batt} VbattECU connection

Signal Path Switching

Signal Path Switching

图上所标即是板卡功能

Bus Bars

Bus Bars

Measurement

Voltage Measurement

可以获取瞬时值、平均值、均方根值、最大/最小值。

有4种模式:

  1. 未滤波的line a和line b之间的电压差
  2. 带有10kHz低通滤波器的line a和line b之间的差分电压
  3. line a与 ECU 接地之间的电压
  4. line b与 ECU 接地之间的电压

Digital Input

每50us连续采样一次,可为每个通道设置一个阈值,用于区分高电平和低电平状态。CANoe 可获得当前状态和包含最后 20 个采样值的数组。

PWM Measurement

测量PWM信号的频率、占空比和高/低电平。

Electronic Load

电子负载,电路图左下角那里

接插件定义

手册3.4章节

Technical Data VT1004A

手册中都有,这里再贴一下

General

General

Input Signals and Switches

Input Signals and Switches

Electronic Load

Electronic Load

Voltage Measurement

Voltage Measurement

精度取决于两个部分(值的百分比 + 偏移),和VT2516A板卡类似

Digital Input

Digital Input

PWM Measurement

Low Impedance Mode

Low Impedance Mode

High Impedance Mode

High Impedance Mode

VT1104的技术资料看手册吧,就不贴图了

CAPL实例

VT System Configuration

连接板卡,不知道咋操作的,看这里里面有详细说明

VT System Control

VT System Control

模式操作等我们还是在CAPL和Panel里面操作系统变量来

CAPL函数库

(搜索这个文件CAPLfunctionsVTSystemOverview.htm,有详细介绍,包括函数使用示例等)

Functions

mode

System Variables

system-defined

system-defined

前面System Configurations里面勾选了哪些,就会注册成系统变量,在这里显示出来

创建variables

根据需要创建如下variables以便于后续panel和capl进行调用

User-defined

制作Panel

panel

编写CAPL脚本

模式枚举

variables
{
    // Defines the modes in which each channel can be
    enum VT1004Modes { None, ShortCircuit, Measurement };

    // Stores the mode in which each channel is
    enum VT1004Modes VT1004Ch1Mode = None;
    enum VT1004Modes VT1004Ch2Mode = None;
    enum VT1004Modes VT1004Ch3Mode = None;
    enum VT1004Modes VT1004Ch4Mode = None;

    // Used to refresh measurement values
    msTimer refreshTimer;
}

切换模式

switchModeVT1004 ( int channel, enum VT1004Modes mode )
{
    if( channel == 1 )
    {
        if( VT1004Ch1Mode != mode )
        {
            VT1004Ch1Mode = mode;
            if( mode == ShortCircuit )
            {
                // Nothing to do here
            }
            else if( mode == Measurement )
            {
                // Configure VT module channel for measurement
                // See the CANoe help for details
                 // Set measurement mode to constant voltage measurement
                sysvar::VTS::Load_Ch1.SetMeasurementMode(0);
                 // Set the threshold voltage to 3V
                sysvar::VTS::Load_Ch1.SetPWMThreshold(3);
                // Set the duration of each measurement
                sysvar::VTS::Load_Ch1.SetPWMMeasurementDuration(0.05);
            }//end if
        }//end if
    }
    else if( channel == 2 )
    {
        // add code ...
    }
}

short circuit

on sysvar sysvar::VT1004::Ch1_ShortCircuit
{
  // Go to short circuit mode on this channel (switchMode function handles the VT configuration change)
    if( VT1004Ch1Mode == ShortCircuit )
        switchModeVT1004( 1, Measurement );
    else
        switchModeVT1004( 1, ShortCircuit );

    // Send setting from the panel to the VT module
    @sysvar::VTS::Load_Ch1::RelayShortCircuit = @sysvar::VT1004::Ch1_ShortCircuit;
}

Measurement

放到timer里面去采集,如果没有实物,可以配合VT2004或者VT2516来组合搭建测试环境

if( VT1004Ch1Mode == Measurement ) 
{
    float voltage = 0.0;
    float freq = 0.0;

    freq = @sysvar::VTS::Load_Ch1::PWMFreq;
    @sysvar::VT1004::Ch1_Frequency = freq;

    voltage = @sysvar::VTS::Load_Ch1::Cur;
    @sysvar::VT1004::Ch1_Voltage = voltage;
    if( abs(voltage < 3.0) )  @sysvar::VT1004::Ch1_VoltageLED = 0;
    else if( voltage < -3.0 )  @sysvar::VT1004::Ch1_VoltageLED = 2;
    else if( voltage > 3.0 || abs(freq) > 1.0 )  @sysvar::VT1004::Ch1_VoltageLED = 1;
}//end if

编译返回canoe主界面测试,在测试前请先确认接线!!!

VT2004和VT1004联动测试

这里写了一个VT2004A和VT1004A配合的实现VT2004A输出VT1004A采集的testcase

variables
{
}

void MainTest()
{
  /* Test description:
  // These test cases uses two VT modules. It is assumed that the first channels
  // of both modules are interconnected.
  // Testgroup 1 tests the voltage transfer between the two modules
  // Testgroup 2 tests the PWM transfer between the two modules
  */


  // Helper variables
  int i=0;


  TestGroupBegin("Voltage Tests", "Performs several voltage transfer tests");

  // Run the test
  for( i=1; i<=8; i++ )
    VoltageGenerationAndMeasurementTest(i);

  TestGroupEnd();



  TestGroupBegin("Frequency Tests", "Performs several frequency transfer tests");

  // Run the test
  for( i=1; i<=6; i++ )
    PWMGenerationAndMeasurementTest(i*250);

  TestGroupEnd();
}

testcase VoltageGenerationAndMeasurementTest ( double voltage )
{
  // Add test case information to the test report
  char buf[64];
  snprintf( buf, 64, "Voltage transfer test at %dV", (int)voltage );
  TestCaseTitle ("Test", buf);
  TestCaseDescription("This test case uses two VT modules. It is assumed that the first channels of both modules are interconnected. While the VT2004 is configured to generate a constant voltage of 7V on channel 1 the VT1004 is configured for voltage measurement (also on channel 1). The test case then checks if the voltage generated by the VT2004 module can bemeasured at the VT1004's input");



  // Step 1: Activate voltage generation on the VT2004 module (channel 1)

  // Set simulation mode to voltage generation
  sysvar::VTS::Stimulus_Ch1.SetStimulationMode(1);

  // Set the output curve type to be a constant
  sysvar::VTS::Stimulus_Ch1.SetCurveType(0);

  // Choose an output voltage (use @ to access the variable)
  @sysvar::VTS::Stimulus_Ch1::Voltage = voltage;

  // Start generating the signal
  sysvar::VTS::Stimulus_Ch1.StartStimulation();



  // Step 2: Activate voltage measurement on the VT1004 module (channel 1)

  // Set measurement mode to constant voltage measurement
  sysvar::VTS::Load_Ch1.SetMeasurementMode(0);



  // Step 3: perform the actual test

  // Wait 100 ms to make sure the above settings take effect
  TestWaitForTimeout(100);

  // Check if a voltage of +- 1V around given parameter can be measured
  if( abs(voltage-@sysvar::VTS::Load_Ch1::Cur) > 1.0 ) {
    // Test failed. No voltage or a wrong voltage was measured
    TestStepFail("No voltage or a wrong voltage was measured");
    return;
  }//end if

  // Testcase was successfull
}

testcase PWMGenerationAndMeasurementTest ( double f )
{
  // Add test case information to the test report
  char buf[64];
  snprintf( buf, 64, "PWM transfer test at %d Hz", (int)f );
  TestCaseTitle ("Test", buf);
  TestCaseDescription("This test case uses two VT modules. It is assumed that the first channels of both modules are interconnected. While the VT2004 is configured to generate a constant PWM signal on channel 1 the VT1004 is configured for PWM measurement (also on channel 1). The test case then checks if the frequency generated by the VT2004 module can bemeasured at the VT1004's input");


  // Step 1: Activate PWM generation on the VT2004 module (channel 1)

  // Set simulation mode to voltage generation
  sysvar::VTS::Stimulus_Ch1.SetStimulationMode(1);

  // Set the output curve type to be a PWM signal
  sysvar::VTS::Stimulus_Ch1.SetCurveType(1);

  // Specify the PWM signal (frequency, low and high voltage, duty cycle)
  @sysvar::VTS::Stimulus_Ch1::PWMFreq = f;
  sysvar::VTS::Stimulus_Ch1.SetPWMVoltageLow(0.0);
  sysvar::VTS::Stimulus_Ch1.SetPWMVoltageLow(5.0);
  @sysvar::VTS::Stimulus_Ch1::PWMDC = 40;

  // Start generating the signal
  sysvar::VTS::Stimulus_Ch1.StartStimulation();



  // Step 2: Activate PWM measurement on the VT1004 module (channel 1)

  // Set measurement mode to constant voltage measurement
  sysvar::VTS::Load_Ch1.SetMeasurementMode(0);

  // Set the threshold voltage to 3V
  sysvar::VTS::Load_Ch1.SetPWMThreshold(3);

  // Set the duration of each measurement
  sysvar::VTS::Load_Ch1.SetPWMMeasurementDuration(0.05);



  // Step 3: perform the actual test

  // Wait 100 ms to make sure the above settings take effect
  TestWaitForTimeout(500);

  // Check if a frequency of 7V (+- 1V) can be measured
  if( abs(f-@sysvar::VTS::Load_Ch1::PWMFreq) > 200.0 ) {
    // Test failed. No frequency or a wrong frequency was measured
    TestStepFail("No frequency or a wrong frequency was measured");
    return;
  }//end if

  // Testcase was successfull
}

项目实例

根据实际工况进行处理,不外乎上面的几种情况,只是和具体项目上的信号功能对应,如有问题,请关注,点赞,收藏,后台私信~~~

当前使用场景也比较单一,文中可能有部分内容未提及,或有误,请指出,谢谢!


公众号

欢迎关注公众号,加入专业技术交流。

公众号

  • 29
    点赞
  • 26
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
### 回答1: Vector Canoe是一款领先的CAN总线分析软件,它可以高效地诊断CAN总线上的通讯问题,并提供一些实用的功能,例如实时数据采集、监视和仿真等。 对于Vector Canoe上位机的官方例程,首先需要明确的是,这些例程主要提供了一些基础的功能和操作指南,以帮助用户快速上手和使用这款软件。 例如,官方例程中提供了一些CAN通信的基础概念和操作方法,例如如何建立一个CAN总线网络、如何发送和接收CAN报文、如何配置和设置CAN总线的参数等等。这些内容对于初学者而言非常重要,可以帮助他们快速理解CAN通信的工作原理和应用场景。 此外,Vector Canoe上位机的官方例程还提供了一些实际案例和应用,例如如何使用Canoe分析工具查找故障、如何诊断设备的CAN通信问题等等。这些案例可以帮助用户更好地了解Canoe的实际应用和使用方法,从而更好地应用这款软件进行CAN通信分析和诊断。 总之,Vector Canoe上位机官方例程对于使用这款软件的用户而言是非常有用的,它提供了一些实用的功能和操作指南,可以帮助用户更好地理解CAN通信的工作原理和应用场景,并掌握Canoe工具的应用方法和技巧。 ### 回答2: vector canoe是一种用于开发CAN总线应用的工具,通过与上位机相连,可以对CAN总线进行调试、诊断和监测。vector canoe上位机官方例程是vector官方提供的一种示例代码,旨在帮助开发者更快地学习和掌握使用vector canoe的方法。 vector canoe上位机官方例程主要包括两个方面的内容,一是基本的CAN通信程序,包括初始化CAN总线、发送和接收CAN数据帧等功能;二是实现进一步的CAN数据处理和分析,例如过滤和解析CAN数据、显示CAN数据的状态和参数等。 在使用官方例程的过程中,首先需要对vector canoe及其相关的开发环境进行搭建和配置,包括安装Canoe Development Kit(CDK)、配置CAN总线连接、设置CANoe工程等。然后,运行例程程序,可以通过CANoe界面对CAN总线进行实时的监测和调试,同时也可以根据需求对程序进行修改和扩展。 通过学习和使用vector canoe上位机官方例程,开发者可以更加深入理解CAN总线的工作原理和应用场景,并可以快速上手使用vector canoe进行CAN应用的开发和调试工作。同时,官方例程也为开发者提供了一个可靠的参考模板,可以根据具体需求进行灵活的调整和扩展,以满足不同CAN应用的需求。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

diagCar

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

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

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

打赏作者

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

抵扣说明:

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

余额充值