Documentation Home Page RT-LAB Home Page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Description

Simulink blocks for the Softing CanAc2 board now support simulation on Win32target. In this mode, the sfunctions do not actually access a CanAc2board. This mode is rather used to emulate CanAc2 transmission. In order to achieve this, the sfunctions can be customized to execute user-specific code during initialization, execution and reset.

These features are been made available by calling specific functions within the MdlInitializeConditions, MdlOutputs and MdlTerminate sections of the sfunction of the CanAc2 blocks. The new functions are compiled in a library, and a VicualC++ project is provided so that the user can modify the functions and recompile the library at will.

Thelibrary and files are organized as follows :

>- Sourcefiles for the user-specific functions:

They arelocated in Simulink\libRn\user\src\Softing\CanAc2 where 'Rn' is one of the Matlab releases supported by RT-LAB such as R14, R2006b, etc.There is one file for each CanAc2 block : canac2_ctl_win32.c, canac2_recv_win32.c,canac2_send_win32.c and canac2_monitor_win32.c.

Each ofthese files contains 3 functions. For example, the canac2_ctl_win32.ccode contains the calls to :

OpalInit_canac2_ctl(OpalLocalData_canac2_ctl*ld), OpalClose_canac2_ctl(OpalLocalData_canac2_ctl *ld), OpalOutput_canac2_ctl(OpalLocalData_canac2_ctl*ld)

The argument ld passed to each of these functions is a structurespecific to the CanAc2 sfunctions. This structure is filled duringinitialization before the call to OpalInit_canac2_ctl().The definition of the ld structures of each CanAc2 block can be foundin the directory common/include_target, in the files canac2_ctl.h,canac2_recv.h, canac2_send.h, canac2_montor.h. Because these structuresare used by the QNX code also, it is very important not to modifythese structures, but Opal-RT may need to modify them from one releaseto the other.

RT-LAB release comes with a pre-compiled library of (quasi-)empty functions. As the user customizes the source codes of the functions,he will need to recompile the library. A Visual C++ project is provided in the same directory as the source codes. During compilation, the library, libOpalCanAc2_PCIwin32RTRn.lib, is placed in the directorySimulink\libRn\user\lib (replace Rn by the actual Matlab release number)

After a recompilation of the library, the user simply needs to recompile its model and run it. The library gets linked to the model during compilation. For this reason, the name of the library should not be modified by the user.

  • No labels