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
  • Index
  • » Users
  • » Luka2406
  • » Profile

Posts

Posts

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

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

Hi Kristoffer, I am working on a similar project and want to incorporate a similar solution. Have you succeeded in creating the model so it's functional?
Best, Luka

Hi there,

so for my project, I will need some optimization process/method to optimize some parameters in my model. I would be very thankful for any sources of information on the topic.

I discovered OMOptim, anyone with any experiences with that software, maybe some videotutorials?

Best, Luka

Fortunately, after I posted my comment above, I figured it out. I was using protected keywords in the names of my models and because of this, the program refused to check and simulate my sub-system. So it works now fine, I just didn't know, this could present a problem and I am still at the beginning of the learning curve so yeah...

In addition, yesterday, I followed this instructions on how to create and connect submodels: https://www.claytex.com/blog/creating-a … ubsystems/
and I still receive the same translation error, I really do not know, what else to try, to solve this. Any help would be much appreciated.

So I am currently working on a model of electric propulsion, I have already modeled engine, battery and other components and now, I would like to package them into sub-models ore something similar like in symulink but when I want to connect my models with other models, I always get this translation error that goes: Expected X to be a class, but found component instead. I am very confused and I do not know, how to resolve this issue, but I can not finish my project without this feature as the model is getting increasingly more complex and harder to handle. I was trying to solve this with using packets and inserted classes into the packet but that didn't work either and now, I am out of ideas, how to deal with this (I'm a rather new to modelica so maybe is there a simple way to fix this that I'm unaware of) So if anyone knows, how to solve this riddle, I would be very grateful.
Best, Luka

Jul-26-22 13:10:23
Category: Programming

So maybe is the title a bit misleading. I created several components from block and now I want to connect them like in simulink so like working with submodels-ish. Now I packed all of my models into blocks and packaged them into a package and I want to connect them while they are packaged but when I want to check model, I always get this translation errors expected X to be a class but found component instead. I am so confused, I really dont know, what to do or where to check, what am I doing wrong.

Jul-25-22 08:46:47
Category: Programming

So I built a model of electrical wire and I want to connect the model to CombiTimeTable but I always receive translations error that goes: Expected wire to be a class, but found component instead. I created my model of a wire with real input so it should be ok with CombiTimeTables real output connector. Any ideas how to fix this, I am dealing with this problem for three days now and I am stuck whit this.
Thanks

  • Index
  • » Users
  • » Luka2406
  • » Profile
You are here: