Mathworks Melda Ulusoy
Live Editor任务是应用程序,您可以添加到实时脚本以完成一组不同的操作,而无需编写任何代码。此视频将使用Live Editor任务从测量的工厂数据中穿过控制器的设计。您将了解如何从测量数据交互方式估计状态空间模型,使识别的模型离散,最后,设计一个PID控制器,全部位于一个地方:您的直播脚本。
在19B中,我们介绍了实时编辑任务,您可以添加到实时脚本以执行特定的操作集。假设这是您需要遵循的工作流程,以便从测量的工厂数据设计控制器。Live Editor任务让您在一个地方完成所有工作流程步骤,节省您的时间并消除编写代码的需要。让我们看看如何使用这些实时编辑器任务来估计来自测量的工厂数据的状态空间模型,使识别的模型离散,然后为离散工厂设计控制器。
此代码此处加载并绘制测量的工厂数据。您可以在脚本的右侧或在脚本右侧显示此代码的输出。要在此工作流程的第一步工作,我们将使用估算状态空间模型任务。要查找此任务,我们将访问Live Editor选项卡,然后单击“任务”。在这里,您将找到不同工具箱的Live Editor任务。这是我们需要的。让我们将它插入我们的直播脚本。当您在此处看到,Live Editor任务允许您交互方式指定参数。选择数据时,它会自动查找可以在这些下拉菜单中选择的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.
现在,我们将继续前进到工作流的第二步,以便离散识别的模型。因为我们将使用转换式速率任务。如果您已经知道要使用的任务的名称,则可以简单地在Live脚本中键入其名称,并通过从建议的列表中选择它来添加任务。选择模型并指定控制器的采样时间后,可以尝试不同的转换方法来查找为您提供更好的原始和转换模型匹配的方法。
最后一步是为离散化工厂设计PID控制器。为此,我们将添加此任务,可在“控制系统”工具箱下。选择离散化工厂后,您可以尝试使用不同的控制器设置,例如自由度和控制器类型。然后,您可以使用这些滑块进行微调控制器,这有助于您更改参考跟踪和干扰抑制之间的平衡。通过选中此框,您还可以显示系统响应特性,如上升时间和过冲,并确保控制器满足您的设计要求。
如果您想与他人分享您的工作,您可以简单地与它们分享此实时脚本,并且他们可以使用不同的参数来提出新的控制器设计。或者,您可以通过在每个任务上选择此选项,然后共享生成的代码来隐藏交互式用户界面。
有关实时编辑任务的更多信息,请查看文档。
您还可以从以下列表中选择一个网站:
选择中国网站(以中文或英文)以获取最佳网站性能。其他MathWorks国家网站未优化您的位置。