Changes between Version 2 and Version 3 of MatlabObject

Show
Ignore:
Timestamp:
02/14/10 23:12:05 (15 years ago)
Author:
ismael (IP: 62.57.1.15)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MatlabObject

    v2 v3  
    5555== Model Generation == 
    5656 
     57Before you generate the code, you have to tell ALOE which signals will be used as inputs and outputs. Any Simulink signal will not be accessible from the C implementation unless we explicitly tell Simulink to enable so. This is done by selecting the signal option “Test point”.  
     58 
     59The second trick is to indicate ALOE the direction of the signal (input/output). We will insert the key in_ or out_ before the name of the signal. The name that ALOE will finally use to access this interface (in the Application Definition’s File) will be, for the case of an input interface: 
     60 
     61in_itfName_re for the real part and 
     62in_itfName_im for the imaginary part. 
     63 
     64Finally, we have to select the interface we want to use to access this signal which will be global export.  
     65 
     66All these options can be selected under the Signal Properties menu (right-click on the signal and select Signal Properties). Then, select Test point option and the name of the signal. 
     67 
     68[[Image(props.png)]] 
     69 
     70Now select storage class ExportedGlobal under Real-Time Workshop tab: 
     71 
     72[[Image(props2.png)]] 
     73 
     74  
     751)      Generate the code for the model 
     76         
     77Let’s now configure Simulink’s model to generate an implementation for the ALOE target. On the model window, go to Tools->Real Time Workshop->Options... 
     78 
     79[[Image(apptest.png)]] 
     80  
     81 
     82Select Target file: aloe.tlc (click on browse button) 
     83 
     84[[Image(configure1.png)]] 
     85 
     86Go to Interface menu and select C API interface.  
     87 
     88[[Image(configure2.png)]] 
     89 
     90 
     91Then go to ALOE Target code generation options and make sure that target files in the Linux machine are correctly specified (step 3):  
     92 
     93[[Image(configure3.png)]] 
     94 
     95  
     96Finally, we have to select the discretization model. On the same screen, select Solver menu (on the left tree). Under Solver Options, select fixed-step type and Discrete solver. Set also infinite simulation time (set inf at Stop time option). Fill the rest of the parameters according to the following capture if they are different.  
     97 
     98[[Image(configure4.png)]] 
     99 
     100 
     101Now you can generate the code. Click on Tools->Real Time Workshop->Build Model and the model will be generated (see Matlab’s main output screen for errors). 
     102 
     1032)      Compile the implementation on Linux 
     104 
     105Now, compiling the model under Linux should be easy. Copy the output files (generated by simulink model generator) to any directory on the Linux machine. The files will be generated under a directory with the name modelname_aloe_rtw on your current Matlab’s model path.  
     106 
     107On a linux console, go to your model path and type: 
     108 
     109make -f modelname.mk 
     110 
     111This should compile your model and create the executable at ../modelname 
     112 
     113 
     1143)      Running the model on ALOE 
     115 
     116On the last step, we will copy the executables for all the models of our application to the ALOE SWMAN Executable’s repository (usually at %phal-repositories%/swman_execs/linux/) so that it is accessible to the framework.  
     117 
     118Then, we will write the Application Definitions File according to how we want to interconnect the modules and paying attention to the interface name convention (step 4) for inputs/outpus and real/imaginary parts.  
     119 
     120The following is an example of a source model: 
     121 
     122object { 
     123        obj_name=crand_d_source 
     124        exe_name=crand_d_source 
     125        proc=1000 
     126        outputs { 
     127                name=out_1_re 
     128                remote_itf=in_1_re 
     129                remote_obj=prova1 
     130                bw=1000 
     131        } 
     132        outputs { 
     133                name=out_1_im 
     134                remote_itf=in_1_im 
     135                remote_obj=prova1 
     136                bw=1000 
     137        } 
     138} 
     139 
    57140 
    58141