Please take a minute to review and accept our Terms of Use.
Welcome to the PLECS User Forum, where you can ask questions and receive answers from other members of the community.

Many technical questions regarding PLECS are answered on the Technical Solutions page of our website. Tutorial videos, specific application examples, and pre-recorded webinars are available on our YouTube page. Please follow us on LinkedIn for the latest Plexim news.

Number of Samples in external mode

0 votes
380 views
Hi, Reading the manual i find that to use the external mode with TI c2000 support i should impose the number of samples at 200. I try with the default number 8192 and then i change it to 200 as said in the manual. I don't notice any difference and my question is: What are the number of samples that I'm changing? What is the difference between the discretization step size in the general window and the number of samples in the external mode window?
asked Aug 29, 2022 by Luca Mincato (32 points)

1 Answer

+1 vote
 
Best answer

The Discretization step size is a key parameter that is used to transform all continuous states to the discrete state-space domain and to configure the nominal execution rate of the digital control loop.

The Target buffer size setting, described below, determines how much memory is allocated to store signals for the external mode.

The Number of samples in the External Mode tab then specifies how many of those signals are displayed.  If the specified Number of samples exceeds the samples available in the allocated memory then all samples are displayed.  For the TI C2000 TSP one would typically set this at the Nsamples calculated in the target buffer size (or above that value for the sake of convenience).  For the RT Box target the buffer size is much larger and so one would be more judicious in how this value is set. 

If you want to capture data over a longer time, but cannot capture more samples due to memory limitations, you can increase the Decimation setting in the External mode tab.  The decimation says that every Nth sample will be stored in the external mode buffer.

With that in mind, for a given number of words (Nwords), number of signals (Nsignals), discretization step size (Tdisc), and decimation setting (decimation) you can perform the following calculations, provided as an Octave/Matlab script:

Ts = 1e-4;                          % 10 kHz example
Nw = 2000;                          % Target buffer size
Nsignals =  2;                      % Number of scope traces & displays
Decimation = 1;                     % Every Nth sample
Nsamples=(Nw/(Nsignals*2)-1);       % Number of samples for each scope trace
Tscope=(Nsamples-1)*Ts*Decimation;  % Total time duration of scope

>> Result:
>> Nsamples =  249
>> Tscope   =  0.024800

 

answered Aug 30, 2022 by Bryan Lieblick (1,905 points)
selected Sep 1, 2022 by Luca Mincato
...