目录
1.软件版本
matlab2020a,veristand2020 R4,labview2020 SP1,VS2017,VS2010
参考simulink&veristand&labview联合仿真环境搭建-CSDN博客
2.搭建simulink仿真模型
以之前搭的一个三相并网逆变器为例,三相全桥,锁相环,控dq轴电流

在这个模型里把所有需要输入的参数和输出的波形接到库里Veristand Blocks里面的in和out,修改好名称方便识别

最终编译生成DLL文件,具体的步骤可以参考:
simulink&veristand联合仿真------模型导入&部署简单人机界面-CSDN博客
编译错误
在编译DLL的时候报错


在尝试的过程中发现有些模块可以编译有些不能,目前发现两个不能编译的模块

由于Repeating Sequence经常用来调制SPWM,我给换成了

3.导入veristand并建立工程
参考simulink&veristand联合仿真------模型导入&部署简单人机界面-CSDN博客
按照参考导入veristand后,system explore里的模型参数如下

注意controller里目标的速率最大是1000

需要输入的参数是dq轴电流的给定,输出的参数是三相电压电流,wt,六路PWM触发脉冲

veristand中的工程需要补充别名,建立通道才能导入labiewv,点击Aliases,在上面添加别名

点击channel后面的图标选择仿真模型的输入输出,这里举例选择d轴电流的给定,改好名称,这个名称就是在labview里导入时显示的名称

其它输入输出同理,绑定通道,改好名称

保存退出,参考simulink&veristand联合仿真------模型导入&部署简单人机界面-CSDN博客搭建一个简单的人机界面可以看一下

4.veristand导入labview
为方便调试,在向labview导入veristand工程时要保持在veristand里打开对应工程
创建一个空白vi,在程序框图面板添加open project reference

程序框图面板添加run project

程序框图面板添加open workspace manager reference、get channel value、set channel value、get alias list

鼠标选择project file path,右击,创建常量,输入刚才创建的veristand工程路径


open project reference与run project连接,右击显示过程,创建常量T

run project连接open workspace manager reference,open workspace manager reference连接get alias list

get alias list控件的右侧中间两个输出,右击创建显示控件,创建两个数组,用于获取veristand工程的通道和别名

在前面板上修改数据的维度和个数

现在前面板和程序面板长这样,确定打开veristand对应工程

点击单次运行,返回veristand会出现对话框,左下角打对号

单次运行后,veristand主界面的右上角会显示connected,表示模型已经连接,可以双击打开veristand工程里的workspace,如果里面有之前搭建的界面,应该已经有波形了,在labview的前面板上会显示之前在veristand里添加的通道和别名,和之前在veristand里做的修改是一样的


labview的工程在此就获取了veristand工程里已经设置好的数据
对于仿真模型,数据无非给定或者显示
labview显示veristand工程数据
在前面板上创建波形图表,以在波形图表上显示三相电流为例
在程序面板添加索引数组

在程序面板添加get channel value

在程序面板添加捆绑,三相电流有三个值,需要用簇捆绑

按照下图方式连接索引数组和get channel value,前面单次运行后读取到的通道里,三相电流是数组里的第一、二、三项,所以索引数组创建常量1、2、3

labview设置veristand工程数据
以设置dq轴电流为例,d轴电流在刚才读取的数组里是第8项,q轴是第0项
需要使用索引数组和set channel value,按下图方式连接

前面板

运行labview工程
选择连续运行

回到veristand窗口会有对话框显示,veristand会自动部署运行模型,labview上会有波形,默认设置不好看,在属性里调整

小白一个,有错还请指正,有用的话留个赞吧

今日闲话
今天24考研,本来想给谁谁谁直接发来着,又害怕影响人家,就在这里祝各位好运
希望强哥上岸明年西门子哈哈哈哈