Patent ID: 8793601

Claim:
A method comprising: accessing a parameter for a block in a graphical model, accessing the parameter being performed by a device; determining that the parameter contains an expression including at least a mathematical operator or a logical operator, determining that the parameter contains the expression being performed by the device, and the expression containing: a first variable that is accessible and updatable during a simulation based on an execution of code generated for the graphical model, and one or more second variables that remain constant during the execution of the generated code; constructing a data structure describing the expression based on the first variable and the one or more second variables, constructing the data structure describing the expression being performed by the device; using the data structure to pool the one or more second variables by allocating a common memory location for references to the one or more second variables, using the data structure to pool the one or more second variables being performed by the device; generating the code for the graphical model based on the first variable and the references to the one or more pooled second variables in the common memory location, generating the code for the graphical model being performed by the device; and causing the generated code to be executed, causing the generated code to be executed being performed by the device, and causing the generated code to be executed including: updating the first variable, and accessing at least one of the second variables from the common memory location during the execution of the generated code.