Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated  Rate this Document

Why Are Simulation Results Are Different Between SystemBuild and AutoCode?

Primary Software: MATRIXx
Primary Software Version: 7.1
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
When I run my simulation in SystemBuild and AutoCode I don't get the same result. When running the simulation using the output from AutoCode the model seems unstable. What could cause this?

Solution:
The most common problem when working in continuous models is the time step used for the simulation. When you generate the C code for a model using AutoCode, the scheduler frequency used by default may not be appropriate. The default time step for the continuous system is the same as the minor cycle, which is ussually determined by the discrete blocks in the model. If the model only has continuous blocks the minor step defaults to 1 Hz. For some models this default minor step is not fast enough, and you may need to set a faster rate.

To specify the frequency that AutoCode should use, you need to add a setting when generating the C code. Click on Advanced in the AutoCode tool, then go to IALG Options and there you will find two different fields.

The first field is for Minimum Scheduler Frequency. This field allows you to set a minimum frequency that will be used. AutoCode will use the faster of this rate or the calculated minor cycle. This affects all types of models: continuous, discrete, multi-rate, and hybrid. If you only want the setting to affect models that have continuous SuperBlocks, then you can use Continuous Subsystem Sample Interval which will set the interval that needs to be used but only in the continuous blocks. Note that the first is a rate and the second is a time interval.

Refer to the AutoCode documentation for more information about the minor cycle and how it is choosen.

Related Links:

Attachments:





Report Date: 04/05/2005
Last Updated: 04/13/2005
Document ID: 3K4F9NRY

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit