Interactive Control Design Using Live Editor Tasks
Melda Ulusoy, MathWorks
Live Editor tasks are apps you can add to your live script to complete a set of different operations without writing any code. This video will walk you through the design of a controller from measured plant data using Live Editor tasks. You'll learn how you can interactively estimate a state-space model from measured data, discretize the identified model, and finally, design a PID controller, all in one place: your live script.
Interactive Control Design Using Live Editor Tasks
In 19b, we introduce Live Editor tasks, which are apps you can add to a live script to perform a specific set of operations. Let’s say this is the workflow you need to follow to design a controller from measured plant data. Live Editor tasks let you accomplish all the workflow steps in one place, saving you time and eliminating the need of writing code. Let’s see how you can use these Live Editor tasks to estimate a state-space model from measured plant data, discretize the identified model, and then design a controller for the discretized plant.
此代码在这里加载并绘制测量的植物数据。您可以在脚本的内联或右侧显示此代码的输出。为了在此工作流的第一步进行工作,我们将使用估算状态空间模型任务。要查找此任务,我们将转到“实时编辑”选项卡,然后单击任务。在这里,您可以从不同的工具箱中找到实时编辑器任务。这是我们需要的。让我们将其插入我们的实时脚本。如您在此处看到的,实时编辑器任务使您可以交互指定参数。当您选择数据时,它会自动从MATLAB工作区中找到适当的预定义变量,您可以在这些下拉菜单中选择。通过单击此圆形图标,您可以使任务每次调整任务中的值时自动运行并更新和显示结果。 If you don’t have the knowledge of the plant order, you can simply try out different values. Since the task is running automatically, when you change the plant order, you’ll see updated results on the right. The increased order of 5 didn’t improve the estimation fit much. So let’s set the order back to 4. If you want, you can rename the identified model in this field here. Using the task, we easily estimated a model from measured data without writing any code. If you want to see the MATLAB commands that are used by this task, you can display them by clicking the arrow on the bottom of the task. You can also enable this feature from the options menu by selecting “controls and code.” This task also lets you adjust parameters of the estimation algorithm, such as the search method and maximum iterations. As we change some of the parameters here, you see how the appropriate arguments are automatically called by these functions. This saves you time and eliminates the need to search for the specific MATLAB functions and the different options they can be set up with.
现在,我们将进入工作流的第二步,以离散确定的模型。为此,我们将使用转换模型速率任务。如果您已经知道要使用的任务的名称,则可以简单地开始在实时脚本中键入其名称,并通过从建议的列表中选择任务来添加任务。选择模型并指定控制器的示例时间之后,您可以尝试不同的转换方法,以找到可以在原始模型和转换模型之间更好地匹配的转换方法。
最后一步是为离散工厂设计一个PID控制器。为此,我们将在控制系统工具箱下添加此任务。选择离散的工厂后,您可以尝试使用不同的控制器设置,例如自由度和控制器类型。然后,您可以使用这些滑块来微调控制器,以帮助您改变参考跟踪和干扰拒绝之间的平衡。通过选中此框,您还可以显示系统响应特征,例如上升时间和超冲,并确保控制器满足您的设计要求。
If you want to share your work with others, you can simply share this live script with them, and they can play with different parameters to come up with new controller designs. Alternatively, you can hide the interactive user interface by choosing this option on each task and then share the generated code.
For more information on Live Editor tasks, check out the documentation.
You can also select a web site from the following list:
How to Get Best Site Performance
选择中国网站(中文或英语)以获得最佳场地性能。其他Mathworks乡村网站未针对您所在的访问进行优化。
美洲
- América Latina(Español)
- 加拿大(英语)
- 美国(英语)