question

anon-user avatar image
0 Likes"
anon-user asked Mischa Spelt answered

Do I have to press the plus button multiple times?


About Experiment Tool.

I made 100 scenarios of 100 variables.
I have saved it in an Excel spreadsheet.


To write a scenario in the Experiment tool,
Do I have to press the plus button 100 times and 100 times?


Or
Is there a way to increase the total to 100 rows and 100 columns?


FlexSim 19.0.9
experimenterflexsim 19.0.9
· 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.

Ben Wilson avatar image Ben Wilson ♦♦ commented ·

Hi anonymous user, was joerg.vogel's answer helpful? If so, please click the red "Accept" button on 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 unaccept or comment back to reopen your question.

0 Likes 0 ·

1 Answer

Mischa Spelt avatar image
1 Like"
Mischa Spelt answered

Hi,

It is possible to get this done with a smart Excel Import and a little bit of scripting. I have attached a sample model for FlexSim 20.2, in which I did the following.

1. I reproduced your Excel workbook: ScenariosVariables.xlsx

2. I created an Excel Import to import the workbook into /Tools/Experimenter/ExperimentVariables. To get all the data, I had to check "Use Row Headers" and "Use Column Headers" and explicitly specify starting and total values:

3. I checked "Execute Post Import Code" and then clicked the "Post Import Code" button to add a bit of script, that will get the table in the exact form the Experimenter expects. This is what I put there:

int onreset = param(1); //1 if this code is being called on Reset of the model, 0 otherwise

treenode target = model.find("/Tools/Experimenter/ExperimentVariables");

// Set the number of scenarios
model.find("/Tools/Experimenter/NumberOfScenarios").value = target.first.subnodes.length - 1;

for(treenode variable = target.first; variable; variable = variable.next)
{
    // Variable should be an Object
    variable.dataType = DATATYPE_OBJECT;    
    for(int i = 1; i <= variable.subnodes.length; i++)
    {
        if(i == 1) {
            // The first node, pointing to the data, should be called variable
            variable.subnodes[i].name = "Variable";
        } else {
            // Make sure the subsequent nodes have string datatype             
            Variant value = variable.subnodes[i].value;
            variable.subnodes[i].dataType = DATATYPE_STRING;
            variable.subnodes[i].value = value.join("");            
            
            // For aesthetic reasons, copy the scenario name from the first variable, too.
            variable.subnodes[i].name = target.first.subnodes[i].name;            
        }
    }
}

4. Run the Excel import.

5. Profit.

Here is a complete demo model for 20.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.