question

Oscar Perez avatar image
2 Likes"
Oscar Perez asked Oscar Perez answered

Update Optquest Variables

simulacion-jamones-ceisa-2017-prueba2.fsm

Hi Jordan,

Please, can you help me with my model?

I have a code in post-import code and also on the boton in the main Dashboard, the boton is called "Cargar programa". This code is supposed to update the variables of the optquest according to the excel file, which is imported for each production plan. This code works propertly with version 7.7, but not with version 2016.

The variables must be permutation variables, but after executing the code they are being loaded as continuos variables.

The line that does not work is the next:

treenodeupdateOptQuestVars = node("/Tools/OptQuest/logic/updateOptQuestVars", model()); executefsnode(updateOptQuestVars, NULL);

I appreciate your answer.

Thanks in advance.

FlexSim 16.2.2
optquestvariablesupdate 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Matt Long avatar image
3 Likes"
Matt Long answered Matt Long commented

The updateOptQuestVars function was moved out of the model and into the Main tree. You can find it at:

MAIN:/project/exec/optquest/definitionLogic/updateOptQuestVars

Change your code to say:

treenodeupdateOptQuestVars = node("project/exec/optquest/definitionLogic/updateOptQuestVars", main()); 
executefsnode(updateOptQuestVars, NULL);
· 5
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Oscar Perez avatar image Oscar Perez commented ·

@Mate

Thanks Matt for your answer.

I think that something is missing, because the variables are still loaded as continuous variables and I needed them as permutation variables.

Could you help me to review my complete code from line 97 to 212 in the attached model?

The lines 151 and 152 are the ones that you helped me to correct.

You can find the code in the button called "Cargar Programa".

simulacion-jamones-ceisa-2017-v2.fsm

Thanks in advanced

0 Likes 0 ·
Matt Long avatar image Matt Long Oscar Perez commented ·

I'm not sure. I don't have your import file so I can't check what's going on, but all of the code is the same from 7.7 to 16.2.

1 Like 1 ·
Oscar Perez avatar image Oscar Perez commented ·

Hi Matt,

It was unable to attach the Excel file here, could you give me your email to send it to you?

I would like to to send you the model and the Excel file, so that you can help me to check the code and know why it does not work.

Thank you

0 Likes 0 ·
Matt Long avatar image Matt Long Oscar Perez commented ·

On line 154 you were referencing the table in the experimenter window that held the variables. The structure of the view changed so you were no longer referencing the data. This was found by putting a debug point in your code and stepping through the code. Once it go to line 154, nodo_opt was null.

Instead of referencing things in the view, you should reference the data's location in your model. Change line 154 to:

treenode nodo_opt = node("Tools/OptQuest/variables",model());
1 Like 1 ·
Matt Long avatar image Matt Long Oscar Perez commented ·
0 Likes 0 ·
Oscar Perez avatar image
0 Likes"
Oscar Perez answered

Thank you, now it works!

5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.