I am therefore trying to maximize a different variable for the objective function, and to compute the payback in the command script, as following,
param payback_period := 0;
for {y in PROJECT_LIFETIME} {
let payback_period := payback_period
+ (if ((-Nb*cost_per_project + sum{i in 1..y} cash_flow[i]) <= 0) then 1)
+ (if (((-Nb*cost_per_project + sum{i in 1..y} cash_flow[i]) > 0) and ((-Nb*cost_per_project + sum{i in 1..y-1} cash_flow[i]) <= 0)) then -(-Nb*cost_per_project + sum{i in 1..y-1} cash_flow[i])/cash_flow[y]);
};
which gives the following error
Error at _cmdno 20 executing "let" command
(file primus1_year.run, line 57, offset 2492):
payback_period has an = assignment in the model.
Could you please help me and tell me where it is seeing an = assignment? I changed the name of the parameter, and it doesnt change the error (to be sure that the error doesnt come from a parameter with the same name in the model).
Thanks
Georges