Using PCAN in simulink real-time workshop
-
- Posts: 7
- Joined: Thu 31. Mar 2011, 20:25
Using PCAN in simulink real-time workshop
Hi everybody,
I am currently working on an implementation of PCANbasic.dll into a matlab S-function to use the Pcan_usb in simulink real-time workshop for an hardware in the loop simulation setup.
I have been able to produce the S-function and make simulink communicate on the can network but i can't use it in real-time workshop because when i build the rtw model, i have unreferenced objects error (can_write, can_open and can_close)
is there anyone who done that before? i would like to have a hint on how to get the rtw compiler to find those dependencies.
it seems to be a problem with the __stdcall use in the .h since i tried with the lcc compiler i have the same error but when using mingw everything is correct (there are known issue with __stdcall in lcc)
if you have any ideas i could try out please advice me. i can give the code i use if you ask.
once working i plan to share the code open source
Thanks for your help.
I am currently working on an implementation of PCANbasic.dll into a matlab S-function to use the Pcan_usb in simulink real-time workshop for an hardware in the loop simulation setup.
I have been able to produce the S-function and make simulink communicate on the can network but i can't use it in real-time workshop because when i build the rtw model, i have unreferenced objects error (can_write, can_open and can_close)
is there anyone who done that before? i would like to have a hint on how to get the rtw compiler to find those dependencies.
it seems to be a problem with the __stdcall use in the .h since i tried with the lcc compiler i have the same error but when using mingw everything is correct (there are known issue with __stdcall in lcc)
if you have any ideas i could try out please advice me. i can give the code i use if you ask.
once working i plan to share the code open source
Thanks for your help.
-
- Posts: 7
- Joined: Thu 31. Mar 2011, 20:25
Re: Using PCAN in simulink real-time workshop
I found a link on the matworks website wich indicate that the windows dll cannont be used with Real-time windows target. and we haeve to rewrite the whole device driver from scratch (using memory addresses)
http://www.mathworks.com/support/soluti ... on=1-190OK
is there any information available about the usb stream we have to send to use the Pcan_usb device?
is there any possibility that i could have help from peak-System to write these RTW drivers?
i think that a lot of people in the industry are using Hardware in the loop simulation and that the peak driver would be a good thing because we would not have to buy another can device from another manufacturer.
http://www.mathworks.com/support/soluti ... on=1-190OK
is there any information available about the usb stream we have to send to use the Pcan_usb device?
is there any possibility that i could have help from peak-System to write these RTW drivers?
i think that a lot of people in the industry are using Hardware in the loop simulation and that the peak driver would be a good thing because we would not have to buy another can device from another manufacturer.
- PEAK-Support
- Sales & Support
- Posts: 1646
- Joined: Fri 10. Sep 2010, 19:34
Re: Using PCAN in simulink real-time workshop
We have no experience in MatLab Simulink. But we have a Simulink and MatLab implementation for the older PCAN-Light API. Maybe this could help to start your work.
- Attachments
-
- Free-Version-Incl.SIMULINK-BLOCK.zip
- Matlab & Simulink for PCAN-Light
- (96.21 KiB) Downloaded 1820 times
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
-
- Posts: 7
- Joined: Thu 31. Mar 2011, 20:25
Re: Using PCAN in simulink real-time workshop
THank you very much, i will check what i can do with this!
Re: Using PCAN in simulink real-time workshop
Is there a 64bit implementation of this?U.Wilhelm wrote:We have no experience in MatLab Simulink. But we have a Simulink and MatLab implementation for the older PCAN-Light API. Maybe this could help to start your work.
- PEAK-Support
- Sales & Support
- Posts: 1646
- Joined: Fri 10. Sep 2010, 19:34
Re: Using PCAN in simulink real-time workshop
The pcan-light and pcan-basic DLLs are available as 64Bit version, so it should be possible to use this DLLs for build a 64Bit Version of a SimuLink Interface.
PCAN-Basic files (32/64Bit):
http://www.peak-system.com/fileadmin/me ... -basic.zip
PCAN-Light files (32/64Bit):
http://www.peak-system.com/fileadmin/me ... -light.zip
PCAN-Basic files (32/64Bit):
http://www.peak-system.com/fileadmin/me ... -basic.zip
PCAN-Light files (32/64Bit):
http://www.peak-system.com/fileadmin/me ... -light.zip
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
Re: Using PCAN in simulink real-time workshop
My programming-skills aren't good enought for building a 64Bit Version. I'm now using the 32Bit Version, which works fine, but I have to use another computer for that. If somebody compiled this Simulink implementation for 64Bit, it would be nice if he would share it.
- PEAK-Support
- Sales & Support
- Posts: 1646
- Joined: Fri 10. Sep 2010, 19:34
Re: Using PCAN in simulink real-time workshop
I do not think that you need to do anythink special for building a 64Bit SimuLink Interface if Simulink run on 64Bit, but maybe someone else could help us who have the background knowledge ?
Last edited by PEAK-Support on Wed 1. Jun 2011, 09:12, edited 1 time in total.
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
-
- Posts: 7
- Joined: Thu 31. Mar 2011, 20:25
Re: Using PCAN in simulink real-time workshop
Personally, i use a 32bit matlab into a vmware virtual machine. (real-time workshop is not available for 64bit with my version of matlab) but i guess you can recompile the s-functions using the matlab mex function.
Re: Using PCAN in simulink real-time workshop
I use it now in a WindowsXP 32bit in Oracle VirtualBox. I tried to recompile the s-functions, but I get errors. I don't have enough background knowledge and the time to make it myself. Thanks for the help and if someone compiled it for 64bit, it would be nice if he would share it.