matlab stateflow 与 Rhapsody

发布于 2024-09-17 17:43:41 字数 192 浏览 2 评论 0原文

在 Rhapsody 中 - 创建后,可以创建该类的许多类似对象(实例)。

在 matlab 的状态流工具中,可以创建一个状态,据我所知,它是一个对象

是否可以将 matlab 的状态流工具中的状态用作并创建它的一个或多个对象?

In Rhapsody - after creating a class, one can create many similar objects (instances) of that class.

In matlab's stateflow tool - one can create a state which is, as far as I know, an object.

Is there a possibility to use a state in matlab's stateflow tool as a class and create one or more objects of it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

甜妞爱困 2024-09-24 17:43:41

我不知道这是否是您所要求的,但是您可以从 stateflow 类创建对象。

据我所知,stateflow 有很多类。例如,stateflow 状态、stateflow junction、stateflow 函数。

当您单击创建新状态时,您正在创建状态类的新对象。要以编程方式执行此操作,您必须首先获取状态流对象的句柄(例如,这可以是整个状态流图或状态流图)。

要获取此句柄,您可以使用 sfgco 函数 - 此函数获取当前选定的 Stateflow 对象的句柄(如果未选择任何对象,您将获取 Stateflow 图对象的句柄)。

要创建一个类的新对象,该类以您拥有句柄的 Stateflow 对象作为父级,您可以使用如下内容:

创建新的 Stateflow 状态:

state = sfgco;
newState = Stateflow.State(state); %this creates a state inside the stateflow object selected by sfgco.

有关更多信息,请查找 Stateflow API pdf 文件。

I don't know if this is what you were asking, but yes you can create objects from stateflow classes.

As far as I know stateflow has many classes. For example, a stateflow state, a stateflow junction, stateflow function.

When you click to create a new state you are creating a new object of the state class. To do it programmatically you have to first get the handle of an stateflow object (this can be a whole stateflow chart or a stateflow chart for example).

To get this handle you can use the sfgco function - this function gets the handle of a stateflow object that is currently selected (in case none is selected, you get the handle to the stateflow chart object).

To create a new object of a class that has as parent a stateflow object that you have the handle you can use something like this:

Creating a new Stateflow state:

state = sfgco;
newState = Stateflow.State(state); %this creates a state inside the stateflow object selected by sfgco.

For more information look for the Stateflow API pdf file.

池予 2024-09-24 17:43:41

Stateflow 图通常在 Simulink 中使用,并驻留在 S-Function 中(Simulink 中具有时间相关输入/输出的块)。每个 S-Function 将成为状态图的实例。通常,它们形成一个 simulink 模型,其中的块通过线连接。尽管我认为动态地执行此操作也是可能的,但这将远远超出工具预期用途的舒适范围。

我通过使用库将 simulink(和 stateflow 模块)与 simulink 模型解耦。我可以实例化其中许多(以图形方式)并与它们所在的模型分开更新它们

Stateflow charts are often used within Simulink, and reside inside an S-function (a block inside Simulink with time dependent inputs/outputs). Each S-function will then be an instantiation of the statechart. Normally these form a simulink model, with blocks connected by lines. Although I think it is also possible to do this dynamically, this would be far outside of the comfort region of the tools intended usage.

I've decoupled simulink (and stateflow blocks) from simulink models by using libraries. I can instantiate many of them (graphically) and update them separately from the models in which they

寒江雪… 2024-09-24 17:43:41

Stateflow State 不是对象。从 Stateflow 图生成代码时,状态通常表示为“switch”语句中的单个“case”。它们没有属性或方法,也不能被实例化。

实际上我根本不知道可以在 Stateflow 或 Simulink 中创建类。这两种工具都旨在以图形方式表示算法,而不是类、关系或其他(抽象)对象。

A Stateflow State is not an object. When generating code from Stateflow Charts, States are usually represented as a single "case" within a "switch" statement. They do not have properties or methods and can neither be instantiated.

Actually I am not aware that it is possible to create classes in Stateflow or Simulink at all. Both tools are intended to graphically represent algorithms and not classes, relationships or other (abstract) objects.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文