Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在modelica中,Electrical.Analog.Basic.电阻器的热端口是否仅定义为输出?如果是,如何进行?_Modelica - Fatal编程技术网

在modelica中,Electrical.Analog.Basic.电阻器的热端口是否仅定义为输出?如果是,如何进行?

在modelica中,Electrical.Analog.Basic.电阻器的热端口是否仅定义为输出?如果是,如何进行?,modelica,Modelica,我正在学习modelica,进展顺利。直到我想向我的同事展示电阻器的实用性。我们问自己的问题是:当来自电阻器的热功率为1W时,1欧姆电阻器的压降和电流是多少(显然答案应该是1V,1A)。除了0 V,0 A之外,我没有得到任何其他结果。从物理上讲,我对结果感到满意,因为我不希望电阻器在加热后变成电源,但我不明白在代码中,这种因果关系是在电阻器模型中构建的。 我通过电阻器-ConditionalHeatPort-HeatPort_a-HeatPort追溯到modelica库,但据我所知,modeli

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

谢谢

编辑:对Rene Just Nielsen的回答:

我正在使用下面的代码。其想法是,鉴于从电阻器流出的热流固定在1W,需要在电阻器上建立电流和电压,以便求解所有方程。如果我对此进行模拟,元件fixedHeatFlow1处的热流=0 W,电流和电压也都是0 V和0 A。当然这两者是一致的,但与fixedHeatFlow1处-1 W的固定边界条件不一致

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;
根据电阻器内部的方程式,我预计电阻器可以用作电源:

  R_actual = R*(1 + alpha*(T_heatPort - T_ref));
  v = R_actual*i;
  LossPower = v*i;

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


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

请发布您的模型或代码。这将使您更容易理解您的问题。对于热端口,确实没有定义因果关系,正如Hans在回答中非常好地用反向模型所示。关于您的解决方案:似乎1W的损耗功率没有到达电阻器的热端口,因为0V和0A显然不是有效的解决方案。那么,您是如何设置1W的呢?谢谢Hans,我(还)没有意识到Modelica内部存在这种逆转问题的可能性。这样就可以进行我心目中的分析。
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;