ConnectSystemModelController[model,controller]
根据控制器数据 controller 将系统模型 model 与控制器相连.
ConnectSystemModelController
ConnectSystemModelController[model,controller]
根据控制器数据 controller 将系统模型 model 与控制器相连.
更多信息
- ConnectSystemModelController 通常用于将控制器连接到 SystemModel 工厂模型并返回闭环系统. 然后可以对生成的系统进行模拟和分析,以了解系统在真实世界的性能.
- model 可以是 SystemModel 对象、SystemModel 接受的完整模型名称字符串或模型简称.
- ConnectSystemModelController["NewModel",…] 将创建的模型命名为 "NewModel".
- controller 是一个由控制设计函数生成的 SystemsModelControllerData 对象.
- 对于有来自 model 的状态反馈的情况,控制设计函数包括:
-
StateFeedbackGains 极点放置状态反馈 LQRegulatorGains 线性二次最优控制 DiscreteLQRegulatorGains 离散时间线性二次最优控制 ModelPredictiveController 约束模型预测控制器 - 对于有来自 model 的输出反馈的情况,控制设计函数包括:
-
EstimatorRegulator 组合状态反馈和状态估计器 LQGRegulator 线性二次控制和估计器 PIDTune 自动调谐的 PID 控制器 - ConnectSystemModelController 返回一个 SystemModel.
范例
打开所有单元 关闭所有单元基本范例 (1)
model = [image];ctrl = PIDTune[SystemModelLinearize[model], Automatic, "Data"]csys = ConnectSystemModelController[model, ctrl]SystemModelPlot[csys, {"out"}, 10, <|"Inputs" -> {"ref" -> Function[2], "ctrlDist" -> Cos, "sensNoise" -> Sin}|>, PlotRange -> All]范围 (16)
StateFeedbackGains (3)
model = [image];lin = SystemModelLinearize[model]ctrl = StateFeedbackGains[<|"InputModel" -> lin, "FeedbackInputs" -> {1}|>, {-2 + I, -2 - I}, "Data"]csys = ConnectSystemModelController[model, ctrl]simModel = SystemModelSimulate[model, 10, <|"Inputs" -> {"f" -> Function[t, 10^8(UnitStep[t] - UnitStep[t - 1])], "deltarho" -> Function[0]}|>]simCsys = SystemModelSimulate[csys, 10, <|"Inputs" -> {"f" -> Function[t, 10^8(UnitStep[t] - UnitStep[t - 1])], "deltarho" -> Function[0]}|>]SystemModelPlot[simModel, {"y"}]SystemModelPlot[simCsys, {"y"}]model = [image];lin = SystemModelLinearize[model]ctrl = StateFeedbackGains[lin, {-0.5, -1.5, -1, -2.5}, "Data"]csys = ConnectSystemModelController[model, ctrl]simModel = SystemModelSimulate[model, 20, <|"InitialValues" -> {"keplerDynamics.vx" -> 0.1}|>]simCsys = SystemModelSimulate[csys, 20, <|"InitialValues" -> {"eSys.sys.keplerDynamics.vx" -> 0.1}|>]Row[Table[SystemModelPlot[simModel, {var}, TargetUnits -> {"Seconds", Automatic}, PlotRange -> All, PlotLabel -> var, ImageSize -> 225], {var, {"dphi", "dr"}}]]Row[Table[SystemModelPlot[simCsys, {var}, TargetUnits -> {"Seconds", Automatic}, PlotRange -> All, PlotLabel -> var, ImageSize -> 225], {var, {"dphi", "dr"}}]]model = \!\(\*GraphicsBox[«8»]\);lin = SystemModelLinearize[model]ctrl = StateFeedbackGains[<|"InputModel" -> lin, "FeedbackInputs" -> {2}|>, {-9 + 9I, -9 - 9I, -10, -10.5}, "Data"]csys = ConnectSystemModelController[model, ctrl]simModel = SystemModelSimulate[model, 5, <|"Inputs" -> {"d" -> Function[t, 0.1(UnitStep[t] - UnitStep[t - 1])], "f" -> Function[0]}|>]simCsys = SystemModelSimulate[csys, 5, <|"Inputs" -> {"d" -> Function[t, 0.1(UnitStep[t] - UnitStep[t - 1])], "f" -> Function[0]}|>]SystemModelPlot[simModel, {"phi"}, PlotRange -> All]SystemModelPlot[simCsys, {"phi"}, PlotRange -> All]LQRegulatorGains (2)
model = [image];lin = SystemModelLinearize[model]ctrl = LQRegulatorGains[lin, {(| | | |
| - | - | - |
| 1 | 0 | 0 |
| 0 | 1 | 0 |
| 0 | 0 | 1 |), {{1}}}, "Data"]csys = ConnectSystemModelController[model, ctrl]simModel = SystemModelSimulate[model, Quantity[1, "Hours"], <|"InitialValues" -> {"x1" -> -1000}|>]simCsys = SystemModelSimulate[csys, Quantity[1, "Hours"], <|"InitialValues" -> {"eSys.sys.x1" -> -1000}|>]SystemModelPlot[simModel, {"deltaCA"}, PlotRange -> All, TargetUnits -> {"Hours", None}]SystemModelPlot[simCsys, {"deltaCA"}, PlotRange -> All, TargetUnits -> {"Hours", None}]model = SystemModel[[image], <|"ParameterValues" -> {"world.enableAnimation" -> False}|>];lin = SystemModelLinearize[model]ctrl = LQRegulatorGains[lin, {(| | | | |
| - | - | - | - |
| 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 0 |
| 0 | 0 | 1 | 0 |
| 0 | 0 | 0 | 1 |), (1)}, "Data"]csys = ConnectSystemModelController[model, ctrl]simModel = SystemModelSimulate[model, 10, <|"InitialValues" -> {"ballAndBeamDynamics.rs" -> 0.4}|>]simCsys = SystemModelSimulate[csys, 10, <|"InitialValues" -> {"eSys.sys.ballAndBeamDynamics.rs" -> 0.4}|>]SystemModelPlot[simModel, {"ballAndBeamDynamics.rs"}]SystemModelPlot[simCsys, {"eSys.sys.ballAndBeamDynamics.rs"}, PlotRange -> All]DiscreteLQRegulatorGains (2)
model = [image];lin = SystemModelLinearize[model]ctrl = DiscreteLQRegulatorGains[lin, {(| | | |
| - | - | - |
| 1 | 0 | 0 |
| 0 | 1 | 0 |
| 0 | 0 | 1 |), {{1}}}, 60, "Data"]csys = ConnectSystemModelController[model, ctrl]simModel = SystemModelSimulate[model, Quantity[4, "Hours"], <|"InitialValues" -> {"x1" -> -1000}|>]simCsys = SystemModelSimulate[csys, Quantity[4, "Hours"], <|"InitialValues" -> {"eSys.sys.x1" -> -1000}|>]SystemModelPlot[simModel, {"deltaCA"}, PlotRange -> All, TargetUnits -> {"Hours", None}]SystemModelPlot[simCsys, {"deltaCA"}, PlotRange -> All, TargetUnits -> {"Hours", None}]model = SystemModel[[image], <|"ParameterValues" -> {"world.enableAnimation" -> False}|>];lin = SystemModelLinearize[model]ctrl = DiscreteLQRegulatorGains[lin, {(| | | | |
| - | - | - | - |
| 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 0 |
| 0 | 0 | 1 | 0 |
| 0 | 0 | 0 | 1 |), (1)}, 0.1, "Data"]csys = ConnectSystemModelController[model, ctrl]simModel = SystemModelSimulate[model, 10, <|"InitialValues" -> {"ballAndBeamDynamics.rs" -> 0.4}|>]simCsys = SystemModelSimulate[csys, 10, <|"InitialValues" -> {"eSys.sys.ballAndBeamDynamics.rs" -> 0.4}|>]SystemModelPlot[simModel, {"ballAndBeamDynamics.rs"}]SystemModelPlot[simCsys, {"eSys.sys.ballAndBeamDynamics.rs"}, PlotRange -> All]EstimatorRegulator (2)
model = [image];lin = SystemModelLinearize[model]设计一个控制器和观测器,把它们放在 EstimatorRegulator 中:
k = StateFeedbackGains[lin, {-0.5, -1.5, -1, -2.5}];l = EstimatorGains[lin, 3 {-0.5, -1.5, -1, -2.5}];ctrl = EstimatorRegulator[lin, {l, k}, "Data"]csys = ConnectSystemModelController[model, ctrl]simCSys = SystemModelSimulate[csys, 12, <|"InitialValues" -> {"sys.keplerDynamics.vx" -> 0.1}|>]SystemModelPlot[simCSys, {"dr"}, PlotRange -> All]model = \!\(\*GraphicsBox[«8»]\);lin = SystemModelLinearize[model]设计一个控制器和观测器,把它们放在 EstimatorRegulator 中:
sysSpec = <|"InputModel" -> lin, "FeedbackInputs" -> {2}|>;k = StateFeedbackGains[sysSpec, {-1 + 1.5I, -1 - 1.5I, -5, -5.5}];l = EstimatorGains[lin, {-9 + 9I, -9 - 9I, -10, -10.5}];ctrl = EstimatorRegulator[sysSpec, {l, k}, "Data"]csys = ConnectSystemModelController[model, ctrl]simCsys = SystemModelSimulate[csys, 10, <|"InitialValues" -> {"sys.pendulumDamper.phi_rel" -> 0.1}|>]SystemModelPlot[simCsys, {"sys.pendulumDamper.phi_rel"}, PlotRange -> All]LQGRegulator (2)
model = [image];lin = SystemModelLinearize[model]ctrl = LQGRegulator[lin, {{{}}, (| | | |
| - | - | - |
| 1 | 0 | 0 |
| 0 | 1 | 0 |
| 0 | 0 | 1 |)}, {(| | | |
| - | - | - |
| 1 | 0 | 0 |
| 0 | 1 | 0 |
| 0 | 0 | 1 |), (1)}, "Data"]csys = ConnectSystemModelController[model, ctrl]simCsys = SystemModelSimulate[csys, Quantity[8, "Hours"], <|"InitialValues" -> {"sys.x1" -> -1000}|>]SystemModelPlot[simCsys, {"deltaCA"}, PlotRange -> All, TargetUnits -> {"Hours", None}]从放置在梁顶部的球的模型开始,该梁可以围绕其质心旋转,并添加一些旋转阻尼:
model = SystemModel[[image], <|"ParameterValues" -> {"b" -> 1, "world.enableAnimation" -> False}|>];lin = SystemModelLinearize[model]ctrl = LQGRegulator[lin, {{{}}, (| | |
| ----- | ----- |
| 10^-6 | 0 |
| 0 | 10^-6 |)}, {(| | | | |
| ---- | ---- | ---- | ---- |
| 10^4 | 0 | 0 | 0 |
| 0 | 10^4 | 0 | 0 |
| 0 | 0 | 10^4 | 0 |
| 0 | 0 | 0 | 10^4 |), (1)}, "Data"]csys = ConnectSystemModelController[model, ctrl]simCsys = SystemModelSimulate[csys, 20, <|"InitialValues" -> {"sys.ballAndBeamDynamics.rs" -> 0.4}|>]SystemModelPlot[simCsys, {"sys.ballAndBeamDynamics.rs"}, PlotRange -> All]PIDTune (1)
model = [image];lin = SystemModelLinearize[model]ctrl = PIDTune[lin, Automatic, "Data"]csys = ConnectSystemModelController[model, ctrl]SystemModelPlot[csys, {"out"}, 0.1, <|"Inputs" -> {"ref" -> Function[2], "ctrlDist" -> Cos, "sensNoise" -> Sin}|>, PlotRange -> All]ModelPredictiveController (2)
model = \!\(\*GraphicsBox[«8»]\);SystemModelLinearize[model]sspec = <|"InputModel" -> model, "SamplingPeriod" -> 0.05, "SamplingMethod" -> "ForwardRectangularRule", "FeedbackInputs" -> {"fa"}|>;cost = <|"Horizon" -> 3, "StateWeight" -> (| | | | | | |
| - | ---- | - | - | ---- | - |
| 1 | 0 | 0 | 0 | 0 | 0 |
| 0 | 10^6 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 0 | 0 |
| 0 | 0 | 0 | 1 | 0 | 0 |
| 0 | 0 | 0 | 0 | 10^6 | 0 |
| 0 | 0 | 0 | 0 | 0 | 1 |), "InputWeight" -> (1)|>;cons = {-0.1 <= "xce" <= 0.1};ctrl = ModelPredictiveController[sspec, cost, cons]csys = ConnectSystemModelController["CLSMPC", model, ctrl]bumpInputs = <|"Inputs" -> {"fa" -> Function[t, 0], "fw" -> Function[t, 2000(UnitStep[t] - UnitStep[t - 0.25])]}|>;simModel = SystemModelSimulate[model, 10, bumpInputs]simCsys = SystemModelSimulate[csys, 10, bumpInputs]SystemModelPlot[simModel, {"xce"}, PlotRange -> {-0.025, 0.025}]SystemModelPlot[simCsys, {"eSys.sys.xce"}, PlotRange -> {-0.025, 0.025}]model = [image];SystemModelLinearize[model]sspec = <|"InputModel" -> model, "SamplingPeriod" -> 60, "SamplingMethod" -> "ForwardRectangularRule"|>;cost = <|"Horizon" -> ∞, "StateWeight" -> (| | | |
| - | - | - |
| 1 | 0 | 0 |
| 0 | 1 | 0 |
| 0 | 0 | 1 |), "InputWeight" -> (1)|>;cons = {-50 ≤ "deltaCA" ≤ 50};ctrl = ModelPredictiveController[sspec, cost, cons]csys = ConnectSystemModelController["CLSMPC", model, ctrl]simModel = SystemModelSimulate[model, Quantity[4, "Hours"], <|"InitialValues" -> {"x1" -> -20}|>]simCsys = SystemModelSimulate[csys, Quantity[4, "Hours"], <|"InitialValues" -> {"eSys.sys.x1" -> -20}|>]SystemModelPlot[simModel, {"x1"}, PlotRange -> All, TargetUnits -> {"Hours", Automatic}]SystemModelPlot[simCsys, {"eSys.sys.x1"}, PlotRange -> All, TargetUnits -> {"Hours", Automatic}]Tracking (2)
model = [image];lin = SystemModelLinearize[model]sspec = <|"InputModel" -> lin, "FeedbackInputs" -> {1}, "TrackedOutputs" -> {1}|>;ctrl = StateFeedbackGains[sspec, {-2 + I, -2 - I, -2}, "Data"]csys = ConnectSystemModelController[model, ctrl]sim = SystemModelSimulate[csys, 100, <|"Inputs" -> {"refY" -> Function[t, -10Tanh[t / 10]], "f" -> RandomFunction[WienerProcess[0, 10^6], {0, 100, 0.1}]}|>]SystemModelPlot[sim, {"refY", "y"}, PlotRange -> All]SystemModelPlot[sim, {"eSys.sys.deltarho"}, PlotRange -> All]model = SystemModel[[image], <|"ParameterValues" -> {"world.enableAnimation" -> False}|>];lin = SystemModelLinearize[model]sspec = <|"InputModel" -> lin, "TrackedOutputs" -> {1}|>;ctrl = LQGRegulator[sspec, {{{}}, (| | |
| ----- | ----- |
| 10^-5 | 0 |
| 0 | 10^-5 |)}, {10^4(| | | | | |
| - | - | - | - | - |
| 1 | 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 0 |
| 0 | 0 | 0 | 1 | 0 |
| 0 | 0 | 0 | 0 | 1 |), (1)}, "Data"]csys = ConnectSystemModelController[model, ctrl]sim = Quiet[SystemModelSimulate[csys, 100, <|"Inputs" -> {"refRs" -> Function[t, 1 / 2 E ^ (-(1 / 8) (-10 + t) ^ 2)], "noiseRs" -> RandomFunction[WienerProcess[0, 0.0001], {0, 100, 0.01}], "noiseThetab" -> RandomFunction[WienerProcess[0, 0.00001], {0, 100, 0.01}]}|>], {General::munfl}]SystemModelPlot[sim, {"rs", "refRs"}, PlotRange -> All]SystemModelPlot[sim, {"sys.T"}, PlotRange -> All]相关指南
文本
Wolfram Research (2021),ConnectSystemModelController,Wolfram 语言函数,https://reference.wolfram.com/language/ref/ConnectSystemModelController.html (更新于 2022 年).
CMS
Wolfram 语言. 2021. "ConnectSystemModelController." Wolfram 语言与系统参考资料中心. Wolfram Research. 最新版本 2022. https://reference.wolfram.com/language/ref/ConnectSystemModelController.html.
APA
Wolfram 语言. (2021). ConnectSystemModelController. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/ConnectSystemModelController.html 年
BibTeX
@misc{reference.wolfram_2026_connectsystemmodelcontroller, author="Wolfram Research", title="{ConnectSystemModelController}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/ConnectSystemModelController.html}", note=[Accessed: 12-September-2026]}
BibLaTeX
@online{reference.wolfram_2026_connectsystemmodelcontroller, organization={Wolfram Research}, title={ConnectSystemModelController}, year={2022}, url={https://reference.wolfram.com/language/ref/ConnectSystemModelController.html}, note=[Accessed: 12-September-2026]}