Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
13 years ago

Input and Output while using Altera Simulink Blocks

Hi all;

I am new to Simulink and Altera blocks. Last couple days I have been working on simulating simple projects using simulink blocks. Now I started to use Altera blocks instead of simulink but I am having an Input/Output issue.

When I use constant source, i see the expected result at the output but if I use a signal generator my output is zero.

I have a screenshot but system doesnt let me post. :( But this is how I simply tested.

Simulink Constant -----> Altera Input ------>Altera Gain ---------> Altera Output -------> Simulink Scope

Simulink DSP SineWave ------->Altera Input ------>Altera Gain--------->Altera Output ------->Simulink Scope

What am I missing?

Thanks.

--

Ilker

12 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    It's not a license issue. A DSP Builder license is only required for generation. Simulation only requires Simulink licenses and would error out rather than give you incorrect results.

    Nothing is wrong here, but I can see why you might be confused by the result. There are two main issues here:

    Firstly, your scope is not returning all the data. Double-click on it and click the parameters button. Then click on the Data History tab of the scope and disable "Limit data points to last". Now you should see the full "10 sample times" worth of data, whereas previously you were seeing only 5.

    The reason it was only showing half the wave is because the Sine block has a sample time of 1/1000. The Stop time of the model is 10, so 10 / (1 / 1000) is 10000, which means you need 2 * 5000 samples.

    The second reason you may be confused is that the DSP Builder wave is jagged and the simulink wave is smooth. This is just down to sampling. You haven't configured a sample time for DSP Builder (by inserting a clock and setting its sample time) so it just uses its default which is 1. The other way to change this is to set the Sample time of the Sine Wave block to 1.

    Even after doing all the above the waves still won't be identical for 2 reasons:

    a) The Gain block has 1 pipeline stage so it will be slightly out of phase with the original.

    b) The DSP Builder Input and Output blocks are truncating the input during quantization.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    It's not a license issue. A DSP Builder license is only required for generation. Simulation only requires Simulink licenses and would error out rather than give you incorrect results.

    Nothing is wrong here, but I can see why you might be confused by the result. There are two main issues here:

    Firstly, your scope is not returning all the data. Double-click on it and click the parameters button. Then click on the Data History tab of the scope and disable "Limit data points to last". Now you should see the full "10 sample times" worth of data, whereas previously you were seeing only 5.

    The reason it was only showing half the wave is because the Sine block has a sample time of 1/1000. The Stop time of the model is 10, so 10 / (1 / 1000) is 10000, which means you need 2 * 5000 samples.

    The second reason you may be confused is that the DSP Builder wave is jagged and the simulink wave is smooth. This is just down to sampling. You haven't configured a sample time for DSP Builder (by inserting a clock and setting its sample time) so it just uses its default which is 1. The other way to change this is to set the Sample time of the Sine Wave block to 1.

    Even after doing all the above the waves still won't be identical for 2 reasons:

    a) The Gain block has 1 pipeline stage so it will be slightly out of phase with the original.

    b) The DSP Builder Input and Output blocks are truncating the input during quantization.

    --- Quote End ---

    Thank you very much. I added a clock and set the sample time and it worked.:D