modelica / ModelicaStandardLibrary

Free (standard conforming) library to model mechanical (1D/3D), electrical (analog, digital, machines), magnetic, thermal, fluid, control systems and hierarchical state machines. Also numerical functions and functions for strings, files and streams are included.
https://doc.modelica.org
BSD 3-Clause "New" or "Revised" License
452 stars 165 forks source link

Electronic Switch instead of GtoThyristor #4413

Closed ceraolo closed 4 weeks ago

ceraolo commented 4 weeks ago

The model Modelica.Electric.Ideal.IdealGTOThyristor implements a behaviour that is not only of GTOs, but of a large variety of electronic switches: BJTs, FETs, Mosfets, IGBTs, IGCTs, GTOs (moreover, GTOs are being abandoned in favour of IGBTs and SIC Mosfets for nearly all application fields).

The most noticeable difference between all of them is in the physical nature of the control signal, which in IdealGTOThyristor is, very wisely, abstracted and converted into a logical input. For instance BJTs have as input the base current IGBTs the gate voltage, GTOs gate pulses, and so on.

Therefore, it is much better to name this component ElectronicSwitch (or IdealElectronicSwitch), and have a generic symbol for it.

Then, I propose a new model, which I named ElectronicSwitch, with a symbol which I've taken from the 1995 edition of Ned Mohan's book Power Electronics (in more recent editions Ned decided to use specialised symbols, which does not suit well the nature of our Modelica generic model).

A tentative implementation of this proposed component is the following (to be tested outside MSL it needs import Modelica.Units.SI; to be added, e.g. before the two extends):

model ElectronicSwitch "Ideal Electronic switch"
  extends Modelica.Electrical.Analog.Interfaces.OnePort;
  extends Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort(final T = 293.15);
  Modelica.Blocks.Interfaces.BooleanInput fire annotation (
    Placement(transformation(origin = {0, 120}, extent = {{-20, -20}, {20, 20}}, rotation = 270), iconTransformation(extent = {{-20, -20}, {20, 20}}, rotation = 270, origin = {0, 120})));
  parameter Modelica.Units.SI.Resistance Ron(final min = 0) = 1e-5 "Forward state-on differential resistance (closed resistance)";
  parameter Modelica.Units.SI.Conductance Goff(final min = 0) = 1e-5 "Backward state-off conductance (opened conductance)";
  parameter Modelica.Units.SI.Voltage Vknee(final min = 0) = 0 "Forward threshold voltage";
protected
  Boolean off "Indicates off-state";
  Real s(final unit = "1") "Auxiliary variable";
  constant SI.Voltage unitVoltage = 1 annotation (
    HideResult = true);
  constant SI.Current unitCurrent = 1 annotation (
    HideResult = true);
equation
  v = (s*unitCurrent)*(if off then 1 else Ron)+ Vknee;
  i = (s*unitVoltage)*(if off then Goff else 1)+ Goff*Vknee;
  LossPower = v*i;
  off = s < 0 or not fire;
  annotation (
    defaultComponentName = "eSwitch",
    Documentation(info="<html>
<p>This model models any electronic switch, able to open and close circuits, allowing current to flow only in one direction. This may simulate Mosfets, IGBTs, GTOs, IGCTs, etc.. </p>
<p>The component is conducting if voltage &gt; Vknee AND fire = true. Otherwise, it is locked. </p>
</html>", revisions="<html>
<ul>
<li><em>June, 2024   </em>
       by Massimo Ceraolo <br> created from IdealGTOThyristor with name taxonomy and icon change<br>
       </li>
<li><em>February 7, 2016   </em>
       by Anton Haumer<br> extending from partial IdealSemiconductor<br>
       </li>
<li><em> March 11, 2009   </em>
       by Christoph Clauss<br> conditional heat port added<br>
       </li>
<li><em>May 7, 2004   </em>
       by Christoph Clauss and Anton Haumer<br> Vknee added<br>
       </li>
<li><em>some years ago   </em>
       by Christoph Clauss<br> realized IdealGTO Thyristor<br>
       </li>
</ul>
</html>"),
    Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics={  Line(visible = useHeatPort, points = {{0, -100}, {0, -20}}, color = {127, 0, 0}, pattern = LinePattern.Dot), Line(points = {{58, 44}}, color = {255, 0, 255}, pattern = LinePattern.Dash), Polygon(points = {{42, 41.5}, {18, 37}, {25, 25}, {42, 41.5}}, lineColor = {0, 0, 255}, fillColor = {0, 0, 255}, fillPattern = FillPattern.Solid), Line(points = {{-90, 0}, {-44, 0}}, color = {0, 0, 255}), Ellipse(extent = {{-44, 4}, {-36, -4}}, lineColor = {0, 0, 255}), Line(points = {{-37, 2}, {40, 40}}, color = {0, 0, 255}), Line(points = {{40, 0}, {90, 0}}, color = {0, 0, 255}), Text(extent = {{-150, 90}, {150, 50}}, textString = "%name", textColor = {0, 0, 255})}),
    Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics={  Line(points = {{-80, 0}, {80, 0}}, color = {128, 128, 128}), Polygon(lineColor = {128, 128, 128}, fillColor = {128, 128, 128}, fillPattern = FillPattern.Solid, points = {{70, 4}, {80, 0}, {70, -4}, {70, 4}}), Line(points = {{0, 80}, {0, -80}}, color = {128, 128, 128}), Polygon(lineColor = {128, 128, 128}, fillColor = {128, 128, 128}, fillPattern = FillPattern.Solid, points = {{-4, 70}, {0, 80}, {4, 70}, {-4, 70}}), Text(textColor = {128, 128, 128}, extent = {{8, 80}, {18, 70}}, textString = "i"), Line(points = {{-86, -22}, {20, 6}, {36, 68}}, thickness = 0.5), Text(textColor = {128, 128, 128}, extent = {{70, -8}, {80, -18}}, textString = "v"), Line(points = {{20, 9}, {20, 0}}, color = {128, 128, 128}, pattern = LinePattern.Dot), Text(origin = {0, -2}, textColor = {128, 128, 128}, extent = {{10, -2}, {30, -12}}, textString = "Vknee"), Text(textColor = {128, 128, 128}, extent = {{36, 60}, {56, 50}}, textString = "Ron"), Text(textColor = {128, 128, 128}, extent = {{-64, -18}, {-44, -28}}, textString = "Goff"), Ellipse(lineColor = {0, 0, 255}, pattern = LinePattern.Dot, extent = {{18, 8}, {22, 4}}), Line(points = {{20, 6}, {74, 20}}, thickness = 0.5), Line(points = {{20, 7}, {20, -2}}, color = {128, 128, 128}, pattern = LinePattern.Dot)}),
    uses(Modelica(version = "4.0.0")));
end ElectronicSwitch;

If the idea of this change is accepted, this model can be added in next versions of MSL and IdealGTOThyristor deprecated.

Eventually, IdealGTOThyristor may be removed in 5.x.x version of MSL; in that occasion the taxonomy of components may be updated: in fact, now I could not extend from IdealSemiconductor, because of non-compatible icon, nor from IdealSwitch, because of non-compatibile equations (absence of Vknee). I did extend only from twoPort. In case of a major MSL revision, the taxonomy could improved using a more generic icon in IdealSemiconductor.

ceraolo commented 4 weeks ago

I need to make some checks. I'll close it for now.

ceraolo commented 4 weeks ago

After some verifications and changes, I reopen this ticket. I've been thinking of creating it for years, now time has come.