Page 1 of 2

eML

PostPosted: Thu Mar 19, 2009 1:39 pm
by jyoung
What is T-VESC's current capability to handle eML and what are the planned capabilties for the near future?

The models that we are devloping will utilize eML and I woudl like to know what it can handle and what it can not so we can steer our model developers in the right direction.

Thanks

Re: eML

PostPosted: Fri Mar 20, 2009 8:19 am
by snyder
The most current information on the EML support in the translator is available here:

http://www.t-vec.com/wiki/index.php/Simulink_Tester_Issues#Embedded_Matlab_Language_.28EML.29_Translation:_m-script_guidelines

As far as near future capabilities it all depends on customer requests as to what will be implemented next. At a minimum I would expect that looping constructs would need to be supported (for, while). In regards to adding new capabilities, in general, if an EML function can be modeled with the graphical blocks currently supported by the translator then adding support for the EML function equivalent is not difficult.

If there are functions you would like to see added please send your request to support@t-vec.com.

Chris

Re: eML

PostPosted: Fri Mar 20, 2009 12:03 pm
by jyoung
I gave it a shot and I received the following error.. it s a simple block and I thought it used only supported elements

Converting State Machines...
[1] Compute_the_Out_Of_Plane__nWasting__if_selected__sf

parse error: undeclared identifier <eML_blk_kernel>
ERROR SM0002: Parse error detected processing expression
in transition <5> in statemachine <Compute_the_Out_Of_Plane__nWasting__if_selected__sf>
-----------------------------------------------------------------------
eML_blk_kernel();
-----------------------------------------------------------------------
{eML_blk_kernel();}
---------------------------


here is the eml code.. slightly altered so I could post leagally


function y = compute_oopw(x1, x2, x3, x4, x5, x6, x7)
%Compute the Out-Of-Plane Wasting (if selected)

y = x6;
if( abs(x1) > 0.0 )
y1= x5 * log( x2/ x3 );

if( x2<= x3)
y1 = 0.0;
end

y2 = y1.^2 - dot( x7, x7 );

if( y2 > 0.0 )
y = x7 - x1 * sqrt(y2) * x4;
end
end

Re: eML

PostPosted: Fri Mar 20, 2009 1:57 pm
by snyder
The output looks like you are using a version of the translator that did not have EML support enabled. Which version of sl2tvec and Matlab are you using?

I tried your sample function with Matlab 2007b and the latest translator and got these errors:

ERROR SL0252: Unknown function found while processing embedded Matlab script.
Found an unrecognized function call to:abs
This may be an Embedded Matlab Function that has not been implemented in the T-VEC Simulink Tester m-script processing.
If you believe this to be the case, please send an E-mail to support@t-vec.com so we can add it to a future release.


ERROR SL0252: Unknown function found while processing embedded Matlab script.
Found an unrecognized function call to:dot
This may be an Embedded Matlab Function that has not been implemented in the T-VEC Simulink Tester m-script processing.
If you believe this to be the case, please send an E-mail to support@t-vec.com so we can add it to a future release.


which are expected because the sl2tvec EML translator does not have support for the abs and dot functions. Adding support for those functions would not be difficult. I'll add them to the queue and see if we can get them into the next beta release for you to try.

Here is a list of the currently supported functions which can also be found in the wiki:

Rounding Functions
floor ceil round fix

Trigometric Functions
sin cos tan asin acos atan atan2

Math Functions
exp log log10 sqrt power hypot rem mod

Matrix Functions
eye

The current list is small but it was enough to satisfy our current customers. Please let us know if there are other functions you need added to the list.

Thanks,
Chris

Re: eML

PostPosted: Fri Mar 20, 2009 2:46 pm
by jyoung
Chris,

I have v4.2.0 Build 1451

If there is a newer version how can I go about downlaoding it?

I will talk with our model developers and get a list of the functions they use in eML so we can get them added to the que as well.


Thanks

Re: eML

PostPosted: Fri Mar 20, 2009 3:35 pm
by snyder
I just noticed this bit from your post:

ERROR SM0002: Parse error detected processing expression
in transition <5> in statemachine <Compute_the_Out_Of_Plane__nWasting__if_selected__sf>


The EML processing is only done on EML function blocks in simulink and not on function blocks inside of stateflow charts. I'll have to look into what is required to handle the stateflow functions. From what I can tell it looks like I just need to add the right calls to the existing EML handling code. I'll have to do some research and get back to you.

Re: eML

PostPosted: Fri Mar 20, 2009 3:48 pm
by jyoung
Chris,

I'm not using eML within stateflow. At least not now but we probably will in teh future. RIght now I just take the Embedded MAtlab Function directly from the Simulink library and paste in the code I provided above. So I think I'm using it how you intended.

I often get a stateflow machine type error with eML with other applications so I think there is an underlining connection between the two.

Re: eML

PostPosted: Fri Mar 20, 2009 4:55 pm
by snyder
Ok, EML support was enabled in version 4.3.0. You should have access to the downloads area on the t-vec website to get the latest version. Log into the client area, go to the Product Downloads area, select "T-VEC Tester for simulink (current)" from the drop down and click retrieve. The latest download should be "Simulink Tester 4.4.0(2009-01-27)".

That should give you a better result.

Chris

Re: eML

PostPosted: Fri Mar 20, 2009 5:01 pm
by jyoung
OK

I'll get the new version on Monday and see what happens. I can work around a abs and dot for now.

I also send an email to our format control guy to see if he had a list of the function that the develoeprs are allowed to use in eML.

Thanks

Re: eML

PostPosted: Thu Mar 26, 2009 8:53 am
by jyoung
Chirs,

Here is the primary list of functions that we are allowed to use in eML.

Matrices: +, -, *, /, ^, cross, dot, inv, transpose [this is the command transpose(A) and not [A]' )
Vectors: +, -, *, /, ^, cross, dot, norm,
Trig: sin, cos, tan, asin, acos, atan, atan2
Flow Control: if, else, for, while
Math: exp, log, log10, sqrt, ^, abs,

Based on the list you provided we woudl need the follwoing added

cross, dot, norm, transpose, abs, for, while and possibly all function to be able to work with Matrices and vectors

I also have to ask if elemenst wise math is allow such as [A].^2?

Also can we call in-house functions? and how are they handled in the vector generation process.