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 to connect two classes

Problem to connect two classes

At the moment I'm writing my masterthesis.I have to simulate an electrical curcuit with Open Modelica Notebook.
Now I'll discribe my problem:
I created several different classes (in the example Katholyt and Stromkreisaussen) and try to connect them.To fix them together I used the connect (resistor1.p,resistor2.n)  command as shown in the example (model Zweizeller). There was no error masage by compiling the model. But as I compared the values of the current at the connections, I figured out that the value of the current was not transfered from one class to the other class. How can I solve this problem?   

Here is the example:

class Katolyt
 
  Modelica.Electrical.Analog.Interfaces.Pin pinK;
  Modelica.Electrical.Analog.Interfaces.Pin pinKein;
  Modelica.Electrical.Analog.Basic.Resistor RCMo(R = 1.23);
  Modelica.Electrical.Analog.Basic.Resistor RCMu(R = 1.23);
  Modelica.Electrical.Analog.Interfaces.Pin pinKuaus;
  Modelica.Electrical.Analog.Interfaces.Pin pinKoaus;
  Modelica.Electrical.Analog.Interfaces.Pin pinKSein;
  Modelica.Electrical.Analog.Basic.Resistor RCo(R = 365.89);
  Modelica.Electrical.Analog.Basic.Resistor RCu(R = 365.89);
equation
  connect(pinK,pinKSein);
  connect(RCMu.p,pinKuaus);
  connect(RCMo.p,pinKoaus);
  connect(RCu.n,RCMu.n);
  connect(pinK,RCu.p);
  connect(pinK,pinKein);
  connect(RCo.n,pinK);
  connect(RCMo.n,RCo.p);
end Katolyt;

class Stromkreisaussen
 
  Modelica.Electrical.Analog.Interfaces.Pin pinStromein;
  Modelica.Electrical.Analog.Sources.ConstantCurrent Stromquelle(I = 1);
  Modelica.Electrical.Analog.Basic.Ground ground1;
  Modelica.Electrical.Analog.Interfaces.Pin pinStromaus;
equation
  connect(ground1.p,pinStromaus);
  connect(Stromquelle.p,pinStromein);
  connect(Stromquelle.n,ground1.p);
end Stromkreisaussen;

model Zweizeller
 
  Stromkreisaussen SKaussen;
  Anolyt HZ_01_minus;
  Zellspannung HZ1;
  Bipolarplatte BPP1;
  Katolyt HZ_01_plus;
 
equation
 
  connect(SKaussen.pinStromein,HZ_01_minus.pinAein);  // Seite Anolyt
  connect(HZ_01_minus.pinASein,HZ1.pinSein);
  connect(HZ_01_minus.pinAoaus,BPP1.pinRAMoaus);
  connect(HZ_01_minus.pinAuaus,BPP1.pinRAMuein);
  connect(HZ1.pinSaus,BPP1.pinBPPSein);
 
  connect(SKaussen.pinStromaus,HZ_01_plus.pinKein);  // Seite Katolyt
  connect(HZ_01_plus.pinKoaus,BPP1.pinRCMoaus);
  connect(HZ_01_plus.pinKuaus,BPP1.pinRCMuein);
  connect(HZ_01_plus.pinKSein,HZ1.pinSaus);
  connect(BPP1.pinBBPSaus,HZ1.pinSein);
 
end Zweizeller;

MfG SR

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