05-14-2014 07:34 AM
Hello,
Here I have some problems and I hope you could give me some help.
Now I am using sbrio 9631 as a vehicle control unit for formula student electric car. They are both programs in Host vi and FPGA vi. And I want to add Torque Vectoring and Acceleration Slip Regulation into my program.They are both in simulink models. So I started as following.
Because I'm using LV2013, so I installed VeriStand 2013 which consists of MIT. And after some effort, I compiled sine-wave.mdl to DLL file.
I know how to add this model to VS but how can I deploy it with my host vi in target? I want to run both host vi and model in sbrio.
I will be extremely grateful for your help!
Thank you.
Best Regard.
Fei
05-14-2014 07:58 AM - edited 05-14-2014 08:04 AM
Hi Fei,
running the models as a compiled dll will only work on PharLap systems (e.g. PXI or 9082). For VxWorks systems like the mentioned 9631 you will need to compile your model to a .out file (the VxWorks equivalent of a dll). There is a windriver toolchain to compile C code into .out files. I do however not know if that or something elese needs to be used to compile your model.
You will also need to install the MIT drivers. For that you have to select manual software install in MAX as it is not contained in any of the standard sets and select it there.
cheers
Mathis
edit: I have now found the information: Yes, you do need the windriver toolchain:
http://zone.ni.com/reference/en-XX/help/372846G-01/veristand/convert_model_to_dll/
05-14-2014 08:34 AM - edited 05-14-2014 08:42 AM
can't edit anymore. Here some more information to get you started:
http://www.ni.com/white-paper/5694/en/
https://decibel.ni.com/content/docs/DOC-13537
As to how to use the models. Exactly as you would use them in windows with LabVIEW. You load the model, open a parameter interface if needed and then take time steps (in a loop ... preferably timed loop) putting in all inputs and getting the outputs which you can then use.
edit: I am sorry if I misinterpreted it. It does now seem to me that you are talking about using simmulink models on RT & FPGA. While RT is possible as outlined above you unfortunately run out of luck with FPGA. If there is the possibility to export your model as vhdl code you would be able to use IP integration and use it that way on your FPGA ... but then I am not a matlab person so apologies for my ignorance on that.
05-14-2014 03:31 PM
Hi,
As said the MIT toolkit will take care of the model on RT as long as you complie from simulink for VxWorks. This will require the correct toolchain installed and then you should find a seperate .tlc file in real time workshop for VxWorks.
For FPGA it depends on the complexity of the model. There isn't anything as straightforward as the MIT toolkit. If it can be modelled as a simple transfer function there is a transfer function block in the FPGA module. There is a corresponding scaling function for the host (FPGA Interface>>Scaling>>Discrete FP Transfer Function to FXP) that will take a discrete transfer function and generate a configuration that can be transfered to the FPGA and used for the transfer function block there.
Hope that helps,
James
05-15-2014 09:27 AM
Hi Mathis,
great thanks for your help. Your comments are all very important when compiling models. Actually what confused me was how to combine my host vi and model and then deploy them on my RT target, just likt what simulation interface toolkit does. Because my computer was installed LV 2013 and there is SIT2013(change to model interface toolkit, which is part of VeriStand2013), so I installed VeriStand2013. And I thought, after I compiling the model and get a dll/out file, I still need to use VeriStand to connect this model and host vi, which turns to be wrong.
Today I search a lot of information and find there is big difference between how to use SIT and MIT, and I also do not need to use VS when I connect the model and host. vi.
The convenient way if to use the function in Control Design& Simulation---Model Interface. And then all the works turn to be easy. Hope it could help others who have the same problem.
Anyway, thank you. 谢谢您(in Chinese).
Fei
05-15-2014 09:36 AM
Hi James,
thanks for your help.
I guess you have already use MIT toolkit. After seeing your answer, I saerched functions on RT and finally found the right one and the remaining work seems to be easy. And finally I ran the host vi whicn consists of model on my sbrio. Actually I don't want to run this model on FPGA because it have lots of numerical calculation.
Thank you again. 谢谢您。
Fei
05-15-2014 09:51 AM - edited 05-15-2014 09:53 AM
Hi Fei,
apologies for assuming that you were already familiar with MIT. Attached a small example of how to use it.
The API is very similar to SIT. We were in a very similar situation that we decided to use LV2013 to avoid a future refactoring to upgrade from SIT to MIT.
best regards
Mathis