Replies: 1 comment 4 replies
-
@nicola907: Alongside the generated code ( I would recommend using the /**
* Run the model, reading inputs from the given `inputs` buffer, and writing outputs
* to the given `outputs` buffer.
*
* This function performs the same steps as the original `run_model` function,
* except that it uses the provided pre-allocated buffers.
*
* The `inputs` buffer is assumed to have one double value for each input variable;
* they must be in exactly the same order as the variables are listed in the spec file.
*
* After each step of the run, the `outputs` buffer will be updated with the output
* variables. The buffer needs to be at least as large as:
* `number of output variables` * `number of save points`
* where `number of save points` is typically one point for each year inclusive of
* the start and end times.
*
* The outputs will be stored in the same order as the outputs are defined in the
* spec file, with one "row" for each variable. For example, the first value in
* the buffer will be the output value at t0 for the first output variable, followed
* by the output value for that variable at t1, and so on. After the value for tN
* (where tN is the last time in the range), the second variable outputs will begin,
* and so on.
*/
void runModelWithBuffers(double* inputs, double* outputs) There is also a You can inspect how |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone.
I want to create a videogame with Unreal Engine, that is based on C/C++, which simulates a Vensim model (mymodel.mdl).
I generated the C/C++ code using the following command:
sde build mymodel.mdl
After implementing the missing functions (please see discussion "Errors generating C code from MDL file" for more details) I got a code which compiled correctly. So I took a look at the C/C++ file representing my model and I found the following auto generated functions: initConstants, initLevels, evalLevels, evalAux and other functions that are called by these ones.
I noticed that the variables that I am interested in (my outputs) are calculated in the evalLevels and evalAux functions. Therefore I organized my code in the following manner:
The problem is that the results that I got are not exactly as expected therefore there must be some problems in this sequence of calls...
Beta Was this translation helpful? Give feedback.
All reactions