question

Rania A avatar image
0 Likes"
Rania A asked Jason Lightfoot commented

Run different tables

settablesize("Task",4,3);
settablenum("Task", 1, 1, 1);
settablenum("Task", 1, 2, 2);
settablenum("Task", 1, 3, 27);
settablenum("Task", 2, 1, 2);
settablenum("Task", 2, 2, 1);
settablenum("Task", 2, 3, 25);
settablenum("Task", 3, 1, 4);
settablenum("Task", 3, 2, 6);
settablenum("Task", 3, 3, 1);
settablenum("Task", 4, 1, 3);
settablenum("Task", 4, 2, 17);
settablenum("Task", 4, 3, 3);
settablestr ("Solution",1,1,"\solutionF00");
resetmodel();
runspeed(100000000000000);
go();
settablesize("Task",4,3);
settablenum("Task", 1, 1, 1);
settablenum("Task", 1, 2, 2);
settablenum("Task", 1, 3, 27);
settablenum("Task", 2, 1, 3);
settablenum("Task", 2, 2, 17);
settablenum("Task", 2, 3, 3);
settablenum("Task", 3, 1, 4);
settablenum("Task", 3, 2, 6);
settablenum("Task", 3, 3, 1);
settablenum("Task", 4, 1, 2);
settablenum("Task", 4, 2, 1);
settablenum("Task", 4, 3, 25);
settablestr ("Solution",1,1,"\solutionF10");
resetmodel();
runspeed(100000000000000);
go();
settablesize("Task",4,3);
settablenum("Task", 1, 1, 1);
settablenum("Task", 1, 2, 2);
settablenum("Task", 1, 3, 27);
settablenum("Task", 2, 1, 3);
settablenum("Task", 2, 2, 17);
settablenum("Task", 2, 3, 3);
settablenum("Task", 3, 1, 4);
settablenum("Task", 3, 2, 6);
settablenum("Task", 3, 3, 1);
settablenum("Task", 4, 1, 2);
settablenum("Task", 4, 2, 1);
settablenum("Task", 4, 3, 25);
settablestr ("Solution",1,1,"\solutionF20");
resetmodel();
runspeed(100000000000000);
go();

I have this flesxcript, as you can see i set different values to my global table, is like three different scenarios. What I want to accomplish , is first run the first table , then stop , reset the model and continue for the second table. However with this code it doesnt seem to work. when I run this script it goes directly to the last table and to the solutionF20. Is there any efficient way to code this , so it runs table by table my model ?

Thank you in advance

FlexSim 20.0.10
global table
· 1
5 |100000

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

Jason Lightfoot avatar image Jason Lightfoot ♦ commented ·

Hi @Rania A, was Jordan Johnson's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes 0 ·

1 Answer

·
Jordan Johnson avatar image
0 Likes"
Jordan Johnson answered Jason Lightfoot commented

I ran this script, and it does exactly what it says it does:

  • Overwrite the task table
  • Overwrite row 1, col 1 of the Solution table
  • Reset
  • Run

The script does these steps 3 times. If the model runs quickly, you might not see much, and you'll just see the end result of the third run.

It is possible that you meant to write a different row of the solution table each time, instead of always overwriting the first row.

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

Rania A avatar image Rania A commented ·

Actually what I want is first run my model with the first block , after this run the model with the second block. Its like different sceanrios. However I think , I cannot achieve this with flexscript. once it reads go, its just executes the whole code

  1. settablesize("Task",4,3);
  2. settablenum("Task", 1, 1, 1);
  3. settablenum("Task", 1, 2, 2);
  4. settablenum("Task", 1, 3, 27);
  5. settablenum("Task", 2, 1, 2);
  6. settablenum("Task", 2, 2, 1);
  7. settablenum("Task", 2, 3, 25);
  8. settablenum("Task", 3, 1, 4);
  9. settablenum("Task", 3, 2, 6);
  10. settablenum("Task", 3, 3, 1);
  11. settablenum("Task", 4, 1, 3);
  12. settablenum("Task", 4, 2, 17);
  13. settablenum("Task", 4, 3, 3);
  14. settablestr ("Solution",1,1,"\solutionF00");
  15. resetmodel();
  16. runspeed(100000000000000);
  17. go();


0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ Rania A commented ·

You should try to do this using the parameter tables and experimenter. You can add a conditional version of your script to the OnSet of a parameter. Or define the whole table to be copied to the target.

0 Likes 0 ·

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.