cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
andrew57jm
Visitor
Visitor
3,250 Views
Registered: ‎06-14-2012

Problem with Floating point Convert (Cast) Block

Using System Generator 13.4 ......

 

If I use a convert block to convert a signal within sysgen to a standard (single or double) or a custom floating point representation, and then take that signal out to Simulink with a Gateway Out, the signal acts strangely back in Simulink.

 

This is illustrated in the attached model. If you run it as is, with the convert block converting to double precision, the output of the Gateway out is perfect, but the output of the filter is all nans.

 

Now switch the convert block to convert to a non-floating point format, say fix_16_14. The output of the gateway is again perfect and now the filter works.

 

This makes no sense. Given that the gateway output is correct in both cases, and is nominally a Simulink double at this point, how can something internal to Sysgen affect what's going on in the downstream filter block???

 

Any ideas? Thanks.

0 Kudos
1 Reply
vlavruhin
Explorer
Explorer
3,245 Views
Registered: ‎12-08-2010

Hello, Andrew.

 

First if all, the filter has feedback (i.e. its impulse response is infinite).

 

Now look at Convert block. It has a parameter named Latency. And its value is 1. This means that there is one unknown output value before conversion (at the beginning of simulation). And there is no parameter for setting this initial condition. Now assume that this value is NaN. If so, then feedback of the filter will also produce NaN values. That's why you can't see the signal at Scope.

 

To solve this issue, you need to hold filter in reset condition during first couple of cycles (if it's possible). Or you could try to set Latency = 0 in Convert block.

Best Regards,
Vitaly.
0 Kudos