Success! Subscription added.
Success! Subscription removed.
Sorry, you must verify to complete this action. Please click the verification link in your email. You may re-send via your profile.
Often users put many 'To Workspace' sink blocks throughout their schematic. However, they may be best served by using Simulink’s signal logging features. (See “Logging Signals” in Simulink Help which explains all).
You can turn on signal logging for individual signals without the need for any ‘To Workspace’ Blocks, or you can just enable logging for a scope, of course. (In both cases name your signals appropriately first). You can do this programmatically, so could, for example, write a script that will turn on signal logging for all signals in a given subsystem if desired.
You can then access them and plot, analyse etc – using Fixed Point Toolbox functions if desired. E.g.
Here I’ve logged Sim_Sum and dspba_sum
I can then do, for example,
>> logsout
logsout =
Simulink.ModelDataLogs (fixedptlogtest):
Name Elements Simulink Class
dspba_Sum 1 Timeseries
Sim_Sum 1 Timeseries
Or you access by subsystem Simulink.SubsysDataLogs, or by signals logged via a scope Simulink.ScopeDataLogs
>> data = logsout.('dspba_Sum')
Name: 'dspba_Sum'
BlockPath: 'fixedptlogtest/Subsystem'
PortIndex: 3
SignalName: 'dspba_Sum'
ParentName: 'dspba_Sum'
TimeInfo: [1x1 Simulink.TimeInfo]
Time: [1001x1 double]
Data: [1001x1 embedded.fi]
>> data = logsout.('dspba_Sum').Data
data =
0
0
0
0
0
0
0
0
0
0
0
0.0314
0.0626
0.0937 (etc)
>> max(logsout.('dspba_Sum').Data)
ans =
1.3141
DataTypeMode: Fixed-point: binary point scaling
Signedness: Signed
WordLength: 19
FractionLength: 14
>> plot(logsout.('dspba_Sum').Time,logsout.('dspba_Sum').Data)
Note that one thing that you can’t really do with this is make use of the override features of the fixed point type to identify underflow & overflows – this is because DSPBA explicitly does the maths according to the output type using its own internal format and constructs the result accordingly, rather than do the math using Fixed point types directly
For example, if you change the fixed point preferences :
>> fipref
ans =
NumberDisplay: 'RealWorldValue'
NumericTypeDisplay: 'full'
FimathDisplay: 'full'
LoggingMode: 'Off'
DataTypeOverride: 'ForceOff'
>> fipref.LoggingMode = 'On'
fipref =
LoggingMode: 'On'
>> fipref.DataTypeOverride = 'ScaledDoubles'
fipref =
LoggingMode: 'On'
DataTypeOverride: 'ScaledDoubles'
The Simulink Sum block will record an overflow,
Warning: Overflow occurred. This originated from 'fixedptlogtest/Sum'.
but none of the DSPBA blocks will.
Community support is provided Monday to Friday. Other contact methods are available here.
Intel does not verify all solutions, including but not limited to any file transfers that may appear in this community. Accordingly, Intel disclaims all express and implied warranties, including without limitation, the implied warranties of merchantability, fitness for a particular purpose, and non-infringement, as well as any warranty arising from course of performance, course of dealing, or usage in trade.
For more complete information about compiler optimizations, see our Optimization Notice.