前页 后页

模拟求解器

在模拟中使用求解器可以使您包括数学模型中的行为,并根据需要查询状态以调整相应UML模型的行为。

创建和初始化求解器

A Solver is best created once at the start of a simulation. This allows it to be used throughout the simulation without regularly incurring the delay of construction time. This is also a good time to load any required modules, define functions and define an initial state for the model.

In a StateMachine simulation, good places to perform this initialization are in the Effect for the Transition leading from the Initial State, or in the Entry for a State that is not re-entered during simulation.

In an Activity simulation, you will need to add it to the Effect for an Action.

更新规划求解模型

As a simulation progresses you can use any of the Effect fields to update parameters of the mathematical model. That might consist of updating rates or changing between algorithms. In a StateMachine simulation:

  • A Transition Effect can be used when the change is needed for a particular flow
  • A State Entry can be used to ensure the behavior is changed while the simulation is in a state, regardless of how it gets there; this includes any nested states
  • A State Exit can be used to ensure the behavior is changed any time the simulation leaves a state, regardless of how it leaves
  • A State Do Activity behaves similarly to an Entry action.

In an Activity simulation there are only Action Effects.

查询规划求解模型

With a Transition guard, call solver.get(). You can also call solver.exec() to call a function with no side effects.

学到更多