Which is the purpose of the _GAME function

Use this forum to post Vensim related questions.
Post Reply
n.secco
Junior Member
Posts: 7
Joined: Wed Apr 26, 2023 2:47 pm
Vensim version: PLE

Which is the purpose of the _GAME function

Post 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:

Code: Select all

#define _GAME(x) (x)
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:

Code: Select all

_myvariable = _GAME(0.0);
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.
Administrator
Super Administrator
Posts: 4605
Joined: Wed Mar 05, 2003 3:10 am

Re: Which is the purpose of the _GAME function

Post by Administrator »

Gaming is not available in PLE.

For what you are doing, you'll need to contact the SD Everywhere people.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
tomfid
Administrator
Posts: 3815
Joined: Wed May 24, 2006 4:54 am

Re: Which is the purpose of the _GAME function

Post 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.
n.secco
Junior Member
Posts: 7
Joined: Wed Apr 26, 2023 2:47 pm
Vensim version: PLE

Re: Which is the purpose of the _GAME function

Post 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.
tomfid
Administrator
Posts: 3815
Joined: Wed May 24, 2006 4:54 am

Re: Which is the purpose of the _GAME function

Post 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.

Code: Select all

_myvariable = 3.1415926
Or, get rid of the GAME() functions in Vensim before you translate the model.
n.secco
Junior Member
Posts: 7
Joined: Wed Apr 26, 2023 2:47 pm
Vensim version: PLE

Re: Which is the purpose of the _GAME function

Post 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.
Post Reply