You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When some variable subcripts are ready from a data file but other are initialized from a constant, usually as a shortcut override, SDEverywhere generates two declarations for the same array variable. For instance, in this model:
DimA: A1, A2 ~~|
DimB: B1, B2 ~~|
h[A1, DimB] = GET DIRECT DATA('e_data.csv', ',', 'A', 'B2') ~~|
h[A2, DimB] = 0 ~~|
i[DimA, DimB] = h[DimA, DimB] ~~|
INITIAL TIME = 1990 ~~|
FINAL TIME = 2050 ~~|
TIME STEP = 1 ~~|
SAVEPER = TIME STEP ~~|
h is initialized both from direct data as a lookup and from a constant. SDEverywhere generates two declarations:
Lookup* _h[2][2];
double _h[2][2];
The text was updated successfully, but these errors were encountered:
All subscript range elements need to be set to a variable of the same type to collapse the C decl to a single declaration of a single type. To do this, convert constant elements to lookups over the entire x axis. A new test case along the lines shown above was added to directdata.mdl.
The h[A2, DimB] = 0 equation starts out as two separated const variables. A new function at the very end of the analysis stage checks for const vars with the same var name as data vars. The var type is changed to data and lookup points are added. Because the separated array vars now all have type "data", they result in a single lookup array decl.
In EquationGen, the present of the lookup points triggers special code generation, resulting in this code in initLookups:
for (size_t i = 0; i < 2; i++) {
_h[1][i] = __new_lookup(2, /*copy=*/true, (double[]){ -1e+308, 0.0, 1e+308, 0.0 });;
}
When some variable subcripts are ready from a data file but other are initialized from a constant, usually as a shortcut override, SDEverywhere generates two declarations for the same array variable. For instance, in this model:
h is initialized both from direct data as a lookup and from a constant. SDEverywhere generates two declarations:
The text was updated successfully, but these errors were encountered: