Difference between revisions of "Simulink Tester Issues"

From T-VEC Wiki
Jump to: navigation, search
(S-Functions)
(Math Functions)
 
Line 18: Line 18:
 
The way that we support S-functions is to allow the user to create an independent Simulink model that represents the input and output interface to the S-function and also represents the same functional semantics as the S-function. Then, the user can add a reference to the S-function in the block properties of the S-function block that names the external Simulink model. The sl2tvec translator then substitutes the external Simulink model for the S-function during translation. This way, the user can use S-functions for code efficiency or direct addressing of specific memory locations or for what ever reason they are necessary, but still use the sl2tvec/T-VEC processes on their model.  
 
The way that we support S-functions is to allow the user to create an independent Simulink model that represents the input and output interface to the S-function and also represents the same functional semantics as the S-function. Then, the user can add a reference to the S-function in the block properties of the S-function block that names the external Simulink model. The sl2tvec translator then substitutes the external Simulink model for the S-function during translation. This way, the user can use S-functions for code efficiency or direct addressing of specific memory locations or for what ever reason they are necessary, but still use the sl2tvec/T-VEC processes on their model.  
  
[[Examples of S Functions|Examples of S Functions]]
+
----
 +
 
 +
===Embedded Matlab Language (EML) Translation: m-script guidelines===
 +
Support for the translation of Embedded Matlab Language (EML) functions is now available. Not all EML functions will be immediately available but they will be scheduled for implementation as requested. Only those EML functions that can be graphically represented using Simulink blocks can be implemented at this time. Support for other EML functions can be added but they may require a development contract. If there is a function you need please E-mail your request to support@t-vec.com.
 +
====M-Scripting Guidance====
 +
A list of the currently supported EML functions is included in this wiki. Additionally there are a few programming shortcuts that are not supported. These are listed in the Unsupported Syntax section. If your script uses those shortcuts then minor modification will be required.
 +
 
 +
=====Global Variables=====
 +
Global variables should not be used in your EML script. All external values needed by a function should be passed into that function as parameters.
 +
 
 +
=====Workspace variables=====
 +
Because the processing of the EML script is done outside of Matlab workspace variables should be passed in as function parameters if needed.
 +
 
 +
====Unsupported syntax====
 +
=====Matrix field selection using a single parameter=====
 +
Matrix indexing with 1 parameter is not supported.
 +
<br>
 +
m=[1,2,3;4,5,6];
 +
<br>
 +
x=m(2); % not supported
 +
<br>
 +
<br>
 +
Instead, use row and column syntax for matrix indexing.
 +
<br>
 +
m=[1,2,3;4,5,6];
 +
<br>
 +
x=m(2,1);
 +
<br>
 +
=====Defining a variable and using it outside of the block containing it=====
 +
The following syntax is not supported.
 +
<br>
 +
function a=fcn1(x)
 +
<br>
 +
if (x==4)
 +
<br>
 +
&nbsp;&nbsp;s=3;  % variable s is initialized inside the if block
 +
<br>
 +
end;
 +
<br>
 +
a=x+s; %translation error: variable s is used before it has been initialized
 +
<br>
 +
<br>
 +
Instead, declare variables in the scope they will be used.
 +
<br>
 +
function a=fcn1(x)
 +
<br>
 +
s=0;  % variable s is initialized at the function scope
 +
<br>
 +
if (x==4)
 +
<br>
 +
&nbsp;&nbsp;s=3;  % ok
 +
<br>
 +
end;
 +
<br>
 +
a=x+s; %ok
 +
<br>
 +
<br>
 +
Using the unsupported syntax will cause the following error to be generated:
 +
<br>
 +
ERROR SL0251: (Internal) Unknown variable found while processing embedded Matlab script.
 +
<br>
 +
&nbsp;&nbsp;This is usually caused when a variable is used outside of the scope it was declared within.
 +
<br>
 +
&nbsp;&nbsp;Variable will be grounded. 
 +
<br>
 +
&nbsp;&nbsp;identifier : [identifier]
 +
<br>
 +
&nbsp;&nbsp;scope : [block location]
 +
<br>
 +
&nbsp;&nbsp;line: [line] pos: [column]
 +
<br>
 +
 
 +
====Supported EML syntax====
 +
We will be adding more function support with future releases. If you call an EML function that has not been implemented then you will see a message like:
 +
<br>
 +
<br>
 +
ERROR SL0253: (Internal) No subsystem implementation found. 
 +
<br>
 +
No subsystem implementation found for subsystem reference: [function name].
 +
<br>
 +
&nbsp;&nbsp;Please verify that your model passes the Matlab model check (CTRL+D). 
 +
<br>
 +
&nbsp;&nbsp;If your model is correct then you could be calling a function that has not been implemented in the T-VEC Simulink tester.
 +
<br>
 +
&nbsp;&nbsp;If you believe this to be the case, please send an E-mail to support@t-vec.com with the function name so that we can include it in a future release.
 +
<br>
 +
=====Flow control syntax=====
 +
if, elseif, else
 +
=====Conditional syntax=====
 +
&&,||  %and, or
 +
 
 +
=====Relational syntax=====
 +
<, <=,==,~=,>,>=  %less than, less than or equal, equal, not equal, greater than, greater than or equal
 +
=====Math syntax=====
 +
+,- %addition, subtraction
 +
<br>
 +
^  %power of
 +
<br>
 +
<nowiki>*</nowiki>,/  %mulitplication, division
 +
=====Unary syntax=====
 +
+,-
 +
=====Matrix syntax=====
 +
[r1c1,r1c2,r1c3;r2c1,r2c2,r2c3;]
 +
<br>
 +
[matrix]' %transpose matrix
 +
=====Comment syntax=====
 +
% [...] - single line comment
 +
<br>
 +
%{
 +
<br>
 +
[...] - multiline comment block
 +
<br>
 +
%}
 +
=====Line continuation syntax=====
 +
...  %line continuation
 +
 
 +
====Supported EML functions====
 +
Below is a list of the currently supported EML functions.
 +
=====Rounding Functions=====
 +
floor
 +
ceil
 +
round
 +
fix
 +
 
 +
=====Trigometric Functions=====
 +
sin
 +
cos
 +
tan
 +
asin
 +
acos
 +
atan
 +
atan2
 +
 
 +
=====Math Functions=====
 +
abs
 +
dot
 +
exp
 +
hypot
 +
log
 +
log10
 +
mod
 +
power
 +
rem
 +
sqrt
 +
 
 +
=====Matrix Functions=====
 +
eye
 +
inv
 +
 
 +
----
  
 
==Limitations==
 
==Limitations==
 
===Simulation Test Drivers: State Data Initialization===
 
===Simulation Test Drivers: State Data Initialization===
T-VEC produces test vectors that may contain state data for feedback constructs such as the unit delay. This results in state data, but there is currently no control mechanisms in the Matlab simulator to set (initialize) state data.  
+
T-VEC produces test vectors that may contain state data for feedback constructs such as the unit delay. This results in state data, but there is currently no control mechanisms in the Matlab simulator to set (initialize) state data.
 +
 
 
==Issues==
 
==Issues==
 
===Inlining and Coverage===
 
===Inlining and Coverage===

Latest revision as of 20:53, 21 July 2009