首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在modelica中,Electrical.Analog.Basic.Resistor的热端口是否仅定义为输出?如果是,是如何实现的?

在modelica中,Electrical.Analog.Basic.Resistor的热端口是否仅定义为输出?如果是,是如何实现的?
EN

Stack Overflow用户
提问于 2019-05-06 23:18:11
回答 1查看 87关注 0票数 3

我正在学习modelica,进展顺利。直到我想用一个电阻器向我的同事演示声学效果。我们问自己的问题是:当电阻的热功率是1W时,1欧姆电阻的电压降和电流是多少(显然答案应该是1V,1A)。除了0V,0A,我没有得到任何其他的结果。从物理上讲,我对结果很满意,因为我不希望电阻器在加热后变成电源,但我不明白这种因果关系在代码中的什么地方建立在电阻器模型中。我通过Resistor - ConditionalHeatPort - HeatPort_a - HeatPort追溯了modelica库,但据我所知,modelica只有一个因果方程。有人能照亮这个吗?

谢谢!

编辑: Rene Just Nielsen的答案:

我使用了下面的代码。这个想法是,鉴于流出电阻的热流固定在1W的事实,需要在电阻上建立电流和电压,以便求解所有方程。如果我模拟这个,在组件fixedHeatFlow1 =0W时的热流,电流和电压也都是0V和0A。当然,这是彼此一致的,但不符合fixedHeatFlow1的固定边界条件-1 W。

代码语言:javascript
复制
model ElectricalPowerFromHeat
  Modelica.Electrical.Analog.Basic.Resistor resistor1(R = 1, alpha = 0, useHeatPort = true) annotation(
    Placement(visible = true, transformation(origin = {-28, -46}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Analog.Basic.Ground ground1 annotation(
    Placement(visible = true, transformation(origin = {12, -80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Thermal.HeatTransfer.Sources.FixedHeatFlow fixedHeatFlow1(Q_flow = -1, alpha = 1)  annotation(
    Placement(visible = true, transformation(origin = {-68, 14}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
  connect(resistor1.n, ground1.p) annotation(
    Line(points = {{-18, -46}, {12, -46}, {12, -70}, {12, -70}}, color = {0, 0, 255}));
  connect(fixedHeatFlow1.port, resistor1.heatPort) annotation(
    Line(points = {{-58, 14}, {-28, 14}, {-28, -56}, {-28, -56}}, color = {191, 0, 0}));
  connect(resistor1.p, ground1.p) annotation(
    Line(points = {{-38, -46}, {-38, -60}, {12, -60}, {12, -70}}, color = {0, 0, 255}));
  annotation(
    uses(Modelica(version = "3.2.2")),
    experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-06, Interval = 0.002));
end ElectricalPowerFromHeat;

根据电阻器内部的方程,我预计电阻器可以充当电源:

代码语言:javascript
复制
  R_actual = R*(1 + alpha*(T_heatPort - T_ref));
  v = R_actual*i;
  LossPower = v*i;
EN

回答 1

Stack Overflow用户

发布于 2019-05-07 17:19:59

如果你想找出1欧姆电阻的压降,给定的热流是1W,可以按以下方式建模。首先,获取一个为简单电路生成热流的模型(在VoltageToHeatFlow中),然后反转信号(在测试模型中):

代码语言:javascript
复制
package ShowInvertPower
  model VoltageToHeatFlow
    Modelica.Electrical.Analog.Basic.Ground ground
      annotation (Placement(transformation(extent={{-22,-16},{-2,4}})));
    Modelica.Electrical.Analog.Basic.HeatingResistor resistor(R_ref=1)
      annotation (Placement(transformation(extent={{-8,48},{12,68}})));
    Modelica.Electrical.Analog.Sources.SignalVoltage signalVoltage
      annotation (Placement(transformation(extent={{-58,52},{-38,72}})));
    Modelica.Thermal.HeatTransfer.Sensors.HeatFlowSensor heatFlowSensor
      annotation (Placement(transformation(extent={{52,22},{72,42}})));
    Modelica.Thermal.HeatTransfer.Components.HeatCapacitor heatCapacitor(C=1)
      annotation (Placement(transformation(extent={{84,36},{104,56}})));
    Modelica.Blocks.Interfaces.RealOutput Q_flow1
      "Heat flow from port_a to port_b as output signal"
      annotation (Placement(transformation(extent={{96,-18},{116,2}})));
    Modelica.Blocks.Interfaces.RealInput v1
      "Voltage between pin p and n (= p.v - n.v) as input signal"
      annotation (Placement(transformation(extent={{-126,-32},{-86,8}})));
  equation 
    connect(signalVoltage.n, resistor.p) annotation (Line(points={{-38,62},{-26,
            62},{-26,58},{-8,58}}, color={0,0,255}));
    connect(resistor.n, ground.p) annotation (Line(points={{12,58},{30,58},{30,4},
            {-12,4}}, color={0,0,255}));
    connect(signalVoltage.p, ground.p) annotation (Line(points={{-58,62},{-68,62},
            {-68,4},{-12,4}}, color={0,0,255}));
    connect(resistor.heatPort, heatFlowSensor.port_a) annotation (Line(points={{
            2,48},{28,48},{28,32},{52,32}}, color={191,0,0}));
    connect(heatFlowSensor.port_b, heatCapacitor.port) annotation (Line(points={
            {72,32},{84,32},{84,36},{94,36}}, color={191,0,0}));
    connect(heatFlowSensor.Q_flow, Q_flow1) annotation (Line(points={{62,22},{66,
            22},{66,-8},{106,-8}}, color={0,0,127}));
    connect(signalVoltage.v, v1) annotation (Line(points={{-48,74},{-106,74},{-106,
            -12}}, color={0,0,127}));
  end VoltageToHeatFlow;

  model Test
    ShowInvertPower.VoltageToHeatFlow voltageToHeatFlow annotation (Placement(
          transformation(
          extent={{-10,-10},{10,10}},
          rotation=180,
          origin={-2,58})));
    Modelica.Blocks.Math.InverseBlockConstraints inverseBlockConstraints
      annotation (Placement(transformation(extent={{-24,46},{16,70}})));
    Modelica.Blocks.Sources.Constant const(k=2)
      annotation (Placement(transformation(extent={{-86,46},{-66,66}})));
  equation 
    connect(voltageToHeatFlow.v1, inverseBlockConstraints.y2) annotation (Line(
          points={{8.6,59.2},{13.1,59.2},{13.1,58},{13,58}}, color={0,0,127}));
    connect(inverseBlockConstraints.u2, voltageToHeatFlow.Q_flow1) annotation (
        Line(points={{-20,58},{-12,58},{-12,58.8},{-12.6,58.8}}, color={0,0,127}));
    connect(const.y, inverseBlockConstraints.u1) annotation (Line(points={{-65,56},
            {-46,56},{-46,58},{-26,58}}, color={0,0,127}));
    annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
          coordinateSystem(preserveAspectRatio=false)));
  end Test;
  annotation (uses(Modelica(version="3.2.3")));
end ShowInvertPower;

结果是需要1 V(和1 A)。显然,它可以用更简单的方式建模,但以这种方式使用反向模型是Modelica中的标准方式。

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56008060

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档