Dear All,
I run and got the error:
rPower: FUNC DOMAIN: x**y, x=0,y<0
Files attached. samjuly20201019.xlsx (59.9 KB)
I appreciate it if someone can help.
Thanks and regards,
Douglas
Hi
This kind of error is mostly due to having no starting values for the variables. Gams assumes in that case 0, causing an error in the power function.
As your model is a CGE model, you should start with an equilibrium based on your SAM data. This means if you plug in all the values of your SAM and initialize your prices and production levels to their benchmark levels (most of the time equal to 1) and setting the iteration limit to zero, your model should find a solution. Just search in the forum as I have suggested this in more detail in other posts. (In my workshop, this is my “3 AM message”: If I would wake you up in the night at 3 AM and ask you what is the most important thing you should do when working with CGE models, you should answer: Set the iteration limit to 0 and initialize the model properly to check the benchmark!
Eventually, it might be that during the solve the variables become negative. If you are sure that the variables are positive (like prices and quantities) you can define them as positive variables.
Cheers
Renger
Dear Renger,
Thank you for your reply. I think the error is because the “QDA(a)” or “QE0(a)” is zero.
The code is:
deltaCET(a)=PDA0(a)*QDA0(a)(1-rhoCET(a))/(PDA0(a)*QDA0(a)(1-rhoCET(a))+PE0(a)*QE0(a)(1-rhoCET(a)));
If I want to skip the code if “QDA(a)” or “QE0(a)” is zero, how can I do? Can I amend the code as below?
deltaCET(a)$(QDA(a),QE0(a))=PDA0(a)*QDA0(a)(1-rhoCET(a))/(PDA0(a)*QDA0(a)(1-rhoCET(a))+PE0(a)*QE0(a)(1-rhoCET(a)));
Thank you.
Regards,
Douglas