Page 1 of 1
Which is the purpose of the _GAME function
Posted: Tue Jun 20, 2023 3:33 pm
by n.secco
Hi everyone.
Using sdeverywhere I have generated the C code of my Vensim model using the following command:
Code: Select all
sde build mymodel.mdl --spec mymodel.json
Then I have noticed that in the generated "vensim.h" file there is a macro defined like this:
It simply returns the value that I pass to it. The problem is that in the generated "mymodel.c" file, more specifically the "evalAux0" function, this macro is used like this:
It sets "myvariable" to the value 0.0. The problem is that I don't want it to be always 0.0 because it's one of my inputs and the user must be able to give other values.
Re: Which is the purpose of the _GAME function
Posted: Tue Jun 20, 2023 3:52 pm
by Administrator
Gaming is not available in PLE.
For what you are doing, you'll need to contact the SD Everywhere people.
Re: Which is the purpose of the _GAME function
Posted: Wed Jun 21, 2023 8:20 pm
by tomfid
The GAME function is for user input when running in gaming mode within Vensim. You don't need it for normal simulations. I'd simply edit the code by hand, either in Vensim or the translation.
Re: Which is the purpose of the _GAME function
Posted: Thu Jun 22, 2023 8:26 am
by n.secco
Tomfid I just tried to comment the lines where The _GAME function is used but the result has been that some variables have acquired the value -nan(ind). Instead they should be double.
Re: Which is the purpose of the _GAME function
Posted: Thu Jun 22, 2023 9:47 pm
by tomfid
I don't think you want to comment them out. You just want to change the right hand side of the equation to a number or a variable input of your choosing.
Or, get rid of the GAME() functions in Vensim before you translate the model.
Re: Which is the purpose of the _GAME function
Posted: Mon Jun 26, 2023 3:06 pm
by n.secco
I solved the problem in 2 steps:
1) Commenting the lines using the _GAME function.
2) Dividing my input by 100.
I divided my inputs by 100 because actually they aren't absolute values, but percentages, so they should be between 0 and 1, not 0 and 100.