Spice3 NMOS 模型与标准 Modelica 模型的接口

Spice3 NMOS Model interface with standard Modelica models

我在尝试使用库 Spice3 的 NMOS 模型与标准 Modelica 电压源模型时遇到 Open Modelica 问题。参考具有 RL 负载的简单半桥配置示例,我模拟了以下情况:

a) 在低侧 NMOS(Modelica.Electrical.Spice3.Semiconductors.M_NMOS) 的栅极上使用 Spice3 脉冲电压源(Modelica.Electrical.Spice3.Sources.V_pulse) -> Everything香料模型

b) 在低侧 NMOS (Modelica.Electrical.Spice3.Semiconductors.M_NMOS) -> Spice 模型和 Modelica 模型的混合。

在情况 a) 中,模拟工作正常并且结果符合预期(电流认为电感负载和低侧和高侧 NMOS 模型“内部”,如 drain/source/body 当前值)。 而在情况 b) 中,模拟存在收敛问题。此外,负载电流的部分结果似乎是预期的,但从两个 NMOS 模型内部来看,drain/source/body 电流值不是预期的。

谁能帮我解决“Test_NMOS_nok”示意图中的问题? 有谁知道Spice3模型和Modelica模型之间是否存在兼容性问题?

Link 模型案例 a) : https://drive.google.com/file/d/1CkaMiwzZ_Q1jOfuYO0k4-JqKoZi0f8pt/view?usp=sharing

Link 模型案例 b): https://drive.google.com/file/d/1iT8ssJwAzViCcXwuda4R_cNzbKLgSlwN/view?usp=sharing

提前致谢!

总结原题的评论:

  • MSL和SPICE3之间没有兼容性问题。
  • 问题特定于模型,即使用的 SPICE3 模型,结合理想的矩形电压作为激励。

在下面,从问题的 Google 驱动器链接中找到代码,以防它们在将来的某个时候不起作用。所有示例均由 Know83 创建。

a) 原始工作模型:

model Test_NMOS_ok
  Modelica.Electrical.Spice3.Semiconductors.M_NMOS m_nmos(modelcard = mos_model) annotation(
    Placement(visible = true, transformation(origin = {0, -10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Spice3.Sources.V_constant v_constant(V = 13.5)  annotation(
    Placement(visible = true, transformation(origin = {-80, 56}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  Modelica.Electrical.Spice3.Basic.Ground ground1 annotation(
    Placement(visible = true, transformation(origin = {0, -62}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Spice3.Basic.Ground ground annotation(
    Placement(visible = true, transformation(origin = {-80, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Spice3.Basic.R_Resistor r_Resistor(R = 2.4)  annotation(
    Placement(visible = true, transformation(origin = {62, 52}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  parameter Modelica.Electrical.Spice3.Semiconductors.ModelcardMOS mos_model( CBD = 1e-12, CBS = 1e-12,KP = 20, LAMBDA = 0.001, NSUB = 1e15, VTO = 2.48) annotation(
    Placement(visible = true, transformation(origin = {-38, -74}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Spice3.Basic.L_Inductor l_Inductor(IC = 0, L = 1.4e-03)  annotation(
    Placement(visible = true, transformation(origin = {62, 26}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  Modelica.Electrical.Spice3.Semiconductors.M_NMOS m_nmos1(modelcard = mos_model) annotation(
    Placement(visible = true, transformation(origin = {1, 42}, extent = {{-9, -10}, {9, 10}}, rotation = 0)));
  Modelica.Electrical.Spice3.Sources.V_constant v_constant1(V = 0)  annotation(
    Placement(visible = true, transformation(origin = {-32, 26}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  Modelica.Electrical.Spice3.Sources.V_pulse v_pulse(PER = 1e-03, PW = 0.5e-03, TD = 1e-03, TF = 50e-09, TR = 50e-09, V1 = 0, V2 = 5) annotation(
    Placement(visible = true, transformation(origin = {-34, -22}, extent = {{10, -10}, {-10, 10}}, rotation = 90)));
equation
  connect(m_nmos.B, m_nmos.S) annotation(
    Line(points = {{10, -10}, {16, -10}, {16, -20}, {0, -20}}, color = {0, 0, 255}));
  connect(ground1.p, m_nmos.S) annotation(
    Line(points = {{0, -52}, {0, -20}}, color = {0, 0, 255}));
  connect(v_constant.n, ground.p) annotation(
    Line(points = {{-80, 46}, {-80, 40}}, color = {0, 0, 255}));
  connect(r_Resistor.p, v_constant.p) annotation(
    Line(points = {{62, 62}, {62, 72}, {-80, 72}, {-80, 66}}, color = {0, 0, 255}));
  connect(r_Resistor.n, l_Inductor.p) annotation(
    Line(points = {{62, 42}, {62, 36}}, color = {0, 0, 255}));
  connect(l_Inductor.n, m_nmos.D) annotation(
    Line(points = {{62, 16}, {62, 7}, {0, 7}, {0, 0}}, color = {0, 0, 255}));
  connect(m_nmos1.S, m_nmos.D) annotation(
    Line(points = {{1, 32}, {1, 15}, {0, 15}, {0, 0}}, color = {0, 0, 255}));
  connect(m_nmos1.D, v_constant.p) annotation(
    Line(points = {{1, 52}, {1, 72}, {-80, 72}, {-80, 66}}, color = {0, 0, 255}));
  connect(m_nmos1.B, m_nmos1.S) annotation(
    Line(points = {{10, 42}, {10, 32}, {1, 32}}, color = {0, 0, 255}));
  connect(v_constant1.p, m_nmos1.G) annotation(
    Line(points = {{-32, 36}, {-32, 42}, {-8, 42}}, color = {0, 0, 255}));
  connect(v_constant1.n, m_nmos1.S) annotation(
    Line(points = {{-32, 16}, {0, 16}, {0, 22}, {2, 22}, {2, 32}}, color = {0, 0, 255}));
  connect(v_pulse.n, ground1.p) annotation(
    Line(points = {{-34, -32}, {-34, -52}, {0, -52}}, color = {0, 0, 255}));
  connect(v_pulse.p, m_nmos.G) annotation(
    Line(points = {{-34, -12}, {-10, -12}, {-10, -10}}, color = {0, 0, 255}));
  annotation(
    uses(Modelica(version = "3.2.3")));
end Test_NMOS_ok;

b) 原始无效模型:​​

model Test_NMOS_nok
  Modelica.Electrical.Spice3.Semiconductors.M_NMOS m_nmos(modelcard = mos_model) annotation(
    Placement(visible = true, transformation(origin = {0, -10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Spice3.Sources.V_constant v_constant(V = 13.5)  annotation(
    Placement(visible = true, transformation(origin = {-80, 56}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  Modelica.Electrical.Spice3.Basic.Ground ground1 annotation(
    Placement(visible = true, transformation(origin = {0, -62}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Spice3.Basic.Ground ground annotation(
    Placement(visible = true, transformation(origin = {-80, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Spice3.Basic.R_Resistor r_Resistor(R = 2.4)  annotation(
    Placement(visible = true, transformation(origin = {62, 52}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  parameter Modelica.Electrical.Spice3.Semiconductors.ModelcardMOS mos_model( CBD = 1e-12, CBS = 1e-12,KP = 20, LAMBDA = 0.001, NSUB = 1e15, VTO = 2.48) annotation(
    Placement(visible = true, transformation(origin = {-38, -74}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Spice3.Basic.L_Inductor l_Inductor(IC = 0, L = 1.4e-03)  annotation(
    Placement(visible = true, transformation(origin = {62, 26}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  Modelica.Electrical.Spice3.Semiconductors.M_NMOS m_nmos1(modelcard = mos_model) annotation(
    Placement(visible = true, transformation(origin = {1, 42}, extent = {{-9, -10}, {9, 10}}, rotation = 0)));
  Modelica.Electrical.Spice3.Sources.V_constant v_constant1(V = 0)  annotation(
    Placement(visible = true, transformation(origin = {-32, 26}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  Modelica.Blocks.Sources.Pulse pulse(amplitude = 5, offset = 0, period = 1e-03, startTime = 1e-03, width = 50) annotation(
    Placement(visible = true, transformation(origin = {-78, -24}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Analog.Sources.SignalVoltage signalVoltage annotation(
    Placement(visible = true, transformation(origin = {-38, -24}, extent = {{-14, 14}, {14, -14}}, rotation = -90)));
equation
  connect(m_nmos.B, m_nmos.S) annotation(
    Line(points = {{10, -10}, {16, -10}, {16, -20}, {0, -20}}, color = {0, 0, 255}));
  connect(ground1.p, m_nmos.S) annotation(
    Line(points = {{0, -52}, {0, -20}}, color = {0, 0, 255}));
  connect(v_constant.n, ground.p) annotation(
    Line(points = {{-80, 46}, {-80, 40}}, color = {0, 0, 255}));
  connect(r_Resistor.p, v_constant.p) annotation(
    Line(points = {{62, 62}, {62, 72}, {-80, 72}, {-80, 66}}, color = {0, 0, 255}));
  connect(r_Resistor.n, l_Inductor.p) annotation(
    Line(points = {{62, 42}, {62, 36}}, color = {0, 0, 255}));
  connect(l_Inductor.n, m_nmos.D) annotation(
    Line(points = {{62, 16}, {62, 7}, {0, 7}, {0, 0}}, color = {0, 0, 255}));
  connect(m_nmos1.S, m_nmos.D) annotation(
    Line(points = {{1, 32}, {1, 15}, {0, 15}, {0, 0}}, color = {0, 0, 255}));
  connect(m_nmos1.D, v_constant.p) annotation(
    Line(points = {{1, 52}, {1, 72}, {-80, 72}, {-80, 66}}, color = {0, 0, 255}));
  connect(m_nmos1.B, m_nmos1.S) annotation(
    Line(points = {{10, 42}, {10, 32}, {1, 32}}, color = {0, 0, 255}));
  connect(v_constant1.p, m_nmos1.G) annotation(
    Line(points = {{-32, 36}, {-32, 42}, {-8, 42}}, color = {0, 0, 255}));
  connect(v_constant1.n, m_nmos1.S) annotation(
    Line(points = {{-32, 16}, {0, 16}, {0, 22}, {2, 22}, {2, 32}}, color = {0, 0, 255}));
  connect(signalVoltage.v, pulse.y) annotation(
    Line(points = {{-55, -24}, {-66, -24}}, color = {0, 0, 127}));
  connect(signalVoltage.p, m_nmos.G) annotation(
    Line(points = {{-38, -10}, {-10, -10}}, color = {0, 0, 255}));
  connect(signalVoltage.n, ground1.p) annotation(
    Line(points = {{-38, -38}, {-38, -52}, {0, -52}}, color = {0, 0, 255}));
  annotation(
    uses(Modelica(version = "3.2.3")),
    Diagram);
end Test_NMOS_nok;

c) 固定有转换速率限制器的模型:

model Test_NMOS_nok_corrected_with_slew_reate   Modelica.Electrical.Spice3.Semiconductors.M_NMOS m_nmos(modelcard = mos_model) annotation(
    Placement(visible = true, transformation(origin = {0, -10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));   Modelica.Electrical.Spice3.Sources.V_constant v_constant(V = 13.5)  annotation(
    Placement(visible = true, transformation(origin = {-176, 56}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));   Modelica.Electrical.Spice3.Basic.Ground ground1 annotation(
    Placement(visible = true, transformation(origin = {0, -62}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));   Modelica.Electrical.Spice3.Basic.Ground ground annotation(
    Placement(visible = true, transformation(origin = {-176, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));   Modelica.Electrical.Spice3.Basic.R_Resistor r_Resistor(R = 2.4)  annotation(
    Placement(visible = true, transformation(origin = {62, 52}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));   parameter Modelica.Electrical.Spice3.Semiconductors.ModelcardMOS mos_model( CBD
= 1e-12, CBS = 1e-12,KP = 20, LAMBDA = 0.001, NSUB = 1e15, VTO = 2.48) annotation(
    Placement(visible = true, transformation(origin = {46, -72}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));   Modelica.Electrical.Spice3.Basic.L_Inductor l_Inductor(IC = 0, L =
1.4e-03)  annotation(
    Placement(visible = true, transformation(origin = {62, 26}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));   Modelica.Electrical.Spice3.Semiconductors.M_NMOS m_nmos1(modelcard = mos_model) annotation(
    Placement(visible = true, transformation(origin = {1, 42}, extent = {{-9, -10}, {9, 10}}, rotation = 0)));   Modelica.Blocks.Sources.Pulse pulse(amplitude = 5, offset = 0, period
= 1e-03, startTime = 1e-03, width = 50) annotation(
    Placement(visible = true, transformation(origin = {-182, -24}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));   Modelica.Electrical.Analog.Sources.SignalVoltage signalVoltage annotation(
    Placement(visible = true, transformation(origin = {-38, -24}, extent = {{-14, 14}, {14, -14}}, rotation = -90)));   Modelica.Blocks.Nonlinear.SlewRateLimiter slewRateLimiter(Rising = 5 / 1e-6, Td = 1e-07) annotation(
    Placement(visible = true, transformation(origin = {-128, -24}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));   Modelica.Electrical.Analog.Sources.SignalVoltage signalVoltage1 annotation(
    Placement(visible = true, transformation(origin = {-70, 28}, extent = {{10, -10}, {-10, 10}}, rotation = 90)));   Modelica.Blocks.Sources.Constant const(k = 0) annotation(
    Placement(visible = true, transformation(origin = {-122, 28}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); equation   connect(m_nmos.B, m_nmos.S) annotation(
    Line(points = {{10, -10}, {16, -10}, {16, -20}, {0, -20}}, color = {0, 0, 255}));   connect(ground1.p, m_nmos.S) annotation(
    Line(points = {{0, -52}, {0, -20}}, color = {0, 0, 255}));   connect(v_constant.n, ground.p) annotation(
    Line(points = {{-176, 46}, {-176, 40}}, color = {0, 0, 255}));   connect(r_Resistor.p, v_constant.p) annotation(
    Line(points = {{62, 62}, {62, 72}, {-176, 72}, {-176, 66}}, color = {0, 0, 255}));   connect(r_Resistor.n, l_Inductor.p) annotation(
    Line(points = {{62, 42}, {62, 36}}, color = {0, 0, 255}));   connect(l_Inductor.n, m_nmos.D) annotation(
    Line(points = {{62, 16}, {62, 7}, {0, 7}, {0, 0}}, color = {0, 0, 255}));   connect(m_nmos1.S, m_nmos.D) annotation(
    Line(points = {{1, 32}, {1, 15}, {0, 15}, {0, 0}}, color = {0, 0, 255}));   connect(m_nmos1.D, v_constant.p) annotation(
    Line(points = {{1, 52}, {1, 72}, {-176, 72}, {-176, 66}}, color = {0, 0, 255}));   connect(m_nmos1.B, m_nmos1.S) annotation(
    Line(points = {{10, 42}, {10, 32}, {1, 32}}, color = {0, 0, 255}));   connect(signalVoltage.p, m_nmos.G) annotation(
    Line(points = {{-38, -10}, {-10, -10}}, color = {0, 0, 255}));   connect(signalVoltage.n, ground1.p) annotation(
    Line(points = {{-38, -38}, {-38, -52}, {0, -52}}, color = {0, 0, 255}));   connect(pulse.y, slewRateLimiter.u) annotation(
    Line(points = {{-170, -24}, {-140, -24}}, color = {0, 0, 127}));   connect(slewRateLimiter.y, signalVoltage.v) annotation(
    Line(points = {{-116, -24}, {-54, -24}}, color = {0, 0, 127}));   connect(const.y, signalVoltage1.v) annotation(
    Line(points = {{-111, 28}, {-83, 28}}, color = {0, 0, 127}));   connect(signalVoltage1.p, m_nmos1.G) annotation(
    Line(points = {{-70, 38}, {-70, 42}, {-8, 42}}, color = {0, 0, 255}));   connect(signalVoltage1.n, m_nmos1.S) annotation(
    Line(points = {{-70, 18}, {0, 18}, {0, 32}, {2, 32}}, color = {0, 0, 255}));   annotation(
    uses(Modelica(version = "3.2.3")),   Diagram(coordinateSystem(extent = {{-200, -100}, {100, 100}})),   Icon(coordinateSystem(extent = {{-200, -100}, {100, 100}})),   version
= ""); end Test_NMOS_nok_corrected_with_slew_reate;