Restart capability, Restart capability -5 – National Instruments AutoCode NI MATRIX User Manual

Page 196

Advertising
background image

Chapter 7

Code Optimization

© National Instruments Corporation

7-5

AutoCode Reference

Write to the same variable block. Due to the cyclic nature of loops, any
Write to Variable block inside the loop appears in between the Read
from Variable block outside the loop and its use inside the loop.

Restart Capability

AutoCode generates code that supports application restart capability—that
is, an application that is being run can be stopped and restarted again
without having to download it again. Although this feature is useful, it is
expensive because restarting an application requires restoring the initial
data. In order to accomplish this, all the initialization data has to be stored,
thus increasing the static storage size. The restart capability is useful during
the development phase of an application. As the application development
nears completion and is ready for deployment, the need for restarting an
application might not arise. AutoCode provides an option to optimize this
capability so that the optimal version does not carry this extra information.

The AutoCode command option

-Onorestart

optimizes away:

Extra variables that store the initialization values

Code that is used for the initialization purpose

Example 7-3 shows generated code that uses the restart capability.

Example 7-3

Sample Segment of Code with Restart Capability (Default Case)

void subsys_1(U, Y)

struct _Sys_ExtIn *U;

struct _Subsys_1_out *Y;

{

/***** States Array. *****/

static struct _Subsys_1_states ss_1_states[2];

/***** Current and Next States Pointers. *****/

static struct _Subsys_1_states *X;

static struct _Subsys_1_states *XD;

static struct _Subsys_1_states *XTMP;

static RT_INTEGER iinfo[4];

static RT_INTEGER INIT;

const RT_DURATION TSAMP = 0.1;

/***** Parameters. *****/

static RT_FLOAT R_P[8];

RT_INTEGER cnt;

Advertising