OpenModelica中为DCPM电机模型添加温度传感器报错求助
OpenModelica直流永磁电机模型添加温度传感器的兼容问题
作为OpenModelica新手,我基于DCMachines的DCPM组件搭建直流永磁(DCPM)电机模型,想要添加温度传感器测量电机温度。现有模型包含速度传感器、惯量、PI控制器等组件,但尝试将温度传感器连接至电机热端口时,出现组件不兼容错误。
模型概述
- DC_PermanentMagnet Motor(motor):已启用热端口,额定电压24V,Ra=0.5,La=0.01
- Speed Sensor(speedSensor):测量电机转速
- Inertia(inertia):转动惯量J=10,连接至电机轴
- PI Controller(PI):增益k=1.5,时间常数T=0.05,控制扭矩输入
- Feedback Block(feedback1):对比转速参考信号与实际转速
- Step Input(step):1秒时提供24V阶跃电压作为转速参考
- Constant Voltage Source(constantVoltage):为电机提供24V恒定电压
- Torque Source(torque):施加由PI控制器输出的控制扭矩至电机轴
连接关系
- 阶跃信号输入反馈模块,与传感器采集的电机转速对比
- 反馈误差输入PI控制器,控制施加给电机的扭矩
- 电机电气接口连接恒压源,机械接口连接惯量模块
模型代码
Modelica.Mechanics.Rotational.Sensors.SpeedSensor speedSensor annotation( Placement(transformation(origin = {360, 42}, extent = {{-14, -14}, {14, 14}}))); Modelica.Electrical.Machines.BasicMachines.DCMachines.DC_PermanentMagnet motor(useSupport = false, useThermalPort = true, VaNominal = 24, Ra = 0.5, La = 0.01) annotation( Placement(transformation(origin = {128, 40}, extent = {{-10, -10}, {10, 10}}))); Modelica.Blocks.Continuous.PI PI(T = 0.05, x(start = 0.0, fixed = true), k = 1.5, initType = Modelica.Blocks.Types.Init.InitialOutput) annotation( Placement(transformation(origin = {54, 40}, extent = {{-10, -10}, {10, 10}}))); Modelica.Blocks.Math.Feedback feedback1 annotation( Placement(transformation(origin = {-20, 40}, extent = {{-10, -10}, {10, 10}}))); Modelica.Blocks.Sources.Step step(height = 24, startTime = 1, offset = 0) annotation( Placement(transformation(origin = {-84, 42}, extent = {{-10, -10}, {10, 10}}))); Modelica.Mechanics.Rotational.Components.Inertia inertia(J = 10) annotation( Placement(transformation(origin = {211, 41}, extent = {{-13, -13}, {13, 13}}))); Modelica.Electrical.Analog.Sources.ConstantVoltage constantVoltage(V = 24) annotation( Placement(transformation(origin = {94, 72}, extent = {{-10, -10}, {10, 10}}))); Modelica.Mechanics.Rotational.Sources.Torque torque annotation( Placement(transformation(origin = {95, -21}, extent = {{-11, -11}, {11, 11}}))); equation connect(feedback1.y, PI.u) annotation( Line(points = {{-11, 40}, {42, 40}}, color = {0, 0, 127})); connect(step.y, feedback1.u1) annotation( Line(points = {{-72, 42}, {-28, 42}, {-28, 40}}, color = {0, 0, 127})); connect(inertia.flange_b, speedSensor.flange) annotation( Line(points = {{224, 41}, {224, 42}, {346, 42}})); connect(speedSensor.w, feedback1.u2) annotation( Line(points = {{376, 42}, {394, 42}, {394, -72}, {-20, -72}, {-20, 32}}, color = {0, 0,127})); connect(constantVoltage.p, motor.pin_ap) annotation( Line(points = {{84, 72}, {62, 72}, {62, 90}, {134, 90}, {134, 50}}, color = {0, 0, 255})); connect(PI.y, torque.tau) annotation( Line(points = {{66, 40}, {66, 39}, {82, 39}, {82, -21}}, color = {0, 0, 127})); connect(torque.flange, motor.flange) annotation( Line(points = {{106, -21}, {106, 0.5}, {138, 0.5}, {138, 40}})); connect(constantVoltage.n, motor.pin_an) annotation( Line(points = {{104, 72}, {122, 72}, {122, 50}}, color = {0, 0, 255})); connect(inertia.flange_a, motor.flange) annotation( Line(points = {{198, 41}, {198, 40}, {138, 40}})); annotation( Diagram(coordinateSystem(extent = {{-200, -100}, {400, 100}})), Icon(coordinateSystem(extent = {{-200, -100}, {400, 100}})), version = "", uses(Modelica(version = "4.0.0"))); end modelmotor;
补充说明
- 模型截图:展示现有组件的完整连接布局
- 问题截图:显示将温度传感器连接到电机热端口时出现的组件不兼容错误提示
请求协助定位组件不兼容问题,并指导如何正确添加温度传感器以测量电机温度。
内容的提问来源于stack exchange,提问作者Astha
相关产品推荐
相关产品推荐

