Modeling Scenario

Currently, modeling containers contain scenarios as a tree and not as individual repository objects. Use the IMsScenarioTreeEntries interface to work with a scenario tree. The following elements can be added to this tree:

NOTE. The example given below requires objects listed in variable description section.

The desired scenario must be added to the modeling problem to calculate by the required scenario:

Sub Main;

Var

ModelSpace: IMsModelSpace; // modeling container

scriptTree: IMsscriptTreeEntries; // Scripts tree

scriptElement: IMsScenarioTreeElement; // Tree element to what script corresponds

problem: IMsproblem; // modeling problem

scripts: IMsScenarios; // Collection of modelling scripts

script: IMsscript; // modelling script

Begin

ScenarioTree := ModelSpace.ScenarioTree;

ScenarioElement := ScenarioTree.Item(0) As IMsScenarioTreeElement;

Scenario := ScenarioElement.Scenario;

Scenarios := Problem.Scenarios;

Scenarios.AddScenario(Scenario);

End Sub Main;

The example of creating a scenario is given in the Working with Modeling Container Scenarios section.

See also:

General Principles of Programming using Ms Assembly