Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Problem with creating new electrical component

Problem with creating new electrical component

I would like to create a simple model of a conductor with electrical connectors but I am unable to create one. I have same number of variables and parameters and I can check model with no problems but when I try to simulate the model, I receive the following errors:

[1] 11:54:33 Symbolic Error
[Modelica.Electrical.Analog.Interfaces.PositivePin: 9:3-14:61]: Found equation without time-dependent variables: resistor.i = 0.0

[2] 11:54:33 Translation Error
Internal error IndexReduction.pantelidesIndexReduction failed! System is structurally singular and cannot be handled because the number of unassigned equations is larger than the number of states. Use -d=bltdump to get more information.

[3] 11:54:33 Translation Error
Internal error Transformation Module PFPlusExt index Reduction Method Pantelides failed!


Here is my code:

model Conductor_model_V2

Real P;
Real i;
Real v;

  Modelica.Electrical.Analog.Basic.VariableResistor resistor(T_ref = 293.15, alpha = 0.0039, useHeatPort = true)  annotation(
    Placement(visible = true, transformation(origin = {-2, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Analog.Interfaces.PositivePin pin_p annotation(
    Placement(visible = true, transformation(origin = {-100, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-92, -2}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Analog.Interfaces.NegativePin pin_n annotation(
    Placement(visible = true, transformation(origin = {106, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {106, -2}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Analog.Sensors.VoltageSensor voltageSensor annotation(
    Placement(visible = true, transformation(origin = {-2, -30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor annotation(
    Placement(visible = true, transformation(origin = {56, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a port_a annotation(
    Placement(visible = true, transformation(origin = {102, -18}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {108, 44}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Interfaces.RealOutput y annotation(
    Placement(visible = true, transformation(origin = {106, -36}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {106, -36}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  conductor_power conductor_power1 annotation(
    Placement(visible = true, transformation(origin = {60, -38}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  initial_resistivity_v2 initial_resistivity_v21 annotation(
    Placement(visible = true, transformation(origin = {-2, 36}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
equation

  v = pin_p.v - pin_n.v;
  i = pin_p.i;
  P = i * v;
 
  connect(resistor.p, pin_p) annotation(
    Line(points = {{-12, 0}, {-100, 0}}, color = {0, 0, 255}));
  connect(resistor.n, currentSensor.p) annotation(
    Line(points = {{8, 0}, {46, 0}}, color = {0, 0, 255}));
  connect(currentSensor.n, pin_n) annotation(
    Line(points = {{66, 0}, {106, 0}}, color = {0, 0, 255}));
  connect(resistor.p, voltageSensor.p) annotation(
    Line(points = {{-12, 0}, {-12, -30}}, color = {0, 0, 255}));
  connect(voltageSensor.n, resistor.n) annotation(
    Line(points = {{8, -30}, {8, 0}}, color = {0, 0, 255}));
  connect(resistor.heatPort, port_a) annotation(
    Line(points = {{-2, -10}, {49, -10}, {49, -18}, {102, -18}}, color = {191, 0, 0}));
  connect(voltageSensor.v, conductor_power1.u1) annotation(
    Line(points = {{-2, -40}, {22, -40}, {22, -44}, {48, -44}, {48, -40}}, color = {0, 0, 127}));
  connect(currentSensor.i, conductor_power1.u) annotation(
    Line(points = {{56, -10}, {56, -14}, {40, -14}, {40, -34}, {48, -34}}, color = {0, 0, 127}));
  connect(conductor_power1.y, y) annotation(
    Line(points = {{70, -38}, {84, -38}, {84, -36}, {106, -36}}, color = {0, 0, 127}));
  connect(resistor.R, initial_resistivity_v21.y) annotation(
    Line(points = {{-2, 12}, {-2, 26}}, color = {0, 0, 127}));
  annotation(
    uses(Modelica(version = "4.0.0")),
    Diagram);
end Conductor_model_V2;

Any help and/or advice are welcome.

Best, Luka

Re: Problem with creating new electrical component

Can you provide also the models for the missing models?

conductor_power
initial_resistivity_v2

Re: Problem with creating new electrical component

I managed to make the thing work, don't really know how and why but it functions now just fine so thanks for your response nevertheless. Best, Luka

There are 0 guests and 0 other users also viewing this topic
You are here: