<commit_before>within ThreePhase.Banks;

model CapacitorBank_3Ph "Three-Phase Capacitor Bank"
  outer OpenIPSL.Electrical.SystemBase SysData;

  parameter Real Sn = SysData.S_b "Power rating (MVA)";
  OpenIPSL.Interfaces.PwPin A annotation(Placement(transformation(extent = {{80.0, 0.0}, {100.0, 20.0}}, origin = {0.0, 0.0}, rotation = 0), iconTransformation(extent = {{-80.0, 0.0}, {-60.0, 20.0}}, origin = {159, 100}, rotation = 0), visible = true));
  OpenIPSL.Interfaces.PwPin B annotation(Placement(transformation(extent = {{-10.0, 0.0}, {10.0, 20.0}}, origin = {0.0, 0.0}, rotation = 0), iconTransformation(extent = {{-80.0, 0.0}, {-60.0, 20.0}}, origin = {70, 100}, rotation = 0), visible = true));
  OpenIPSL.Interfaces.PwPin C annotation(Placement(transformation(extent = {{-100.0, 0.0}, {-80.0, 20.0}}, origin = {0.0, 0.0}, rotation = 0), iconTransformation(extent = {{-80.0, 0.0}, {-60.0, 20.0}}, origin = {-19, 100}, rotation = 0), visible = true));

  parameter Real Q_a "Reactive power for phase A (MVAr)"
                                                        annotation (Dialog(group="Power flow"));
  parameter Real Q_b "Reactive power for phase B (MVAr)"
                                                        annotation (Dialog(group="Power flow"));
  parameter Real Q_c "Reactive power for phase C (MVAr)"
                                                        annotation (Dialog(group="Power flow"));
                                                        
  Real Pa = 0;
  Real Pb = 0;
  Real Pc = 0;
  Real Qa = Q_a/(Sn/3);
  Real Qb = Q_b/(Sn/3);
  Real Qc = Q_c/(Sn/3);
equation
  Pa = (A.vr*A.ir + A.vi*A.ii);
  Pb = (B.vr*B.ir + B.vi*B.ii);
  Pc = (C.vr*C.ir + C.vi*C.ii);
  Qa = (A.vi*A.ir - A.vr*A.ii)/((A.vr)^2+(A.vi)^2);
  Qb = (B.vi*B.ir - B.vr*B.ii)/((B.vr)^2+(B.vi)^2);
  Qc = (C.vi*C.ir - C.vr*C.ii)/((C.vr)^2+(C.vi)^2);
  annotation (Icon(coordinateSystem(
        extent={{-100,-100},{100,100}},
        preserveAspectRatio=true,
        initialScale=0.1), graphics={Rectangle(
          extent={{-100,-100},{100,100}},
          lineColor={0,0,255},
          fillColor={255,255,255},
          fillPattern=FillPattern.Solid),Line(<commit_msg>Fixing equations for capacitor Bank<commit_after>within ThreePhase.Banks;

model CapacitorBank_3Ph "Three-Phase Capacitor Bank"
  outer OpenIPSL.Electrical.SystemBase SysData;

  parameter Real Sn = SysData.S_b "Power rating (MVA)";
  OpenIPSL.Interfaces.PwPin A annotation(Placement(transformation(extent = {{80.0, 0.0}, {100.0, 20.0}}, origin = {0.0, 0.0}, rotation = 0), iconTransformation(extent = {{-80.0, 0.0}, {-60.0, 20.0}}, origin = {159, 100}, rotation = 0), visible = true));
  OpenIPSL.Interfaces.PwPin B annotation(Placement(transformation(extent = {{-10.0, 0.0}, {10.0, 20.0}}, origin = {0.0, 0.0}, rotation = 0), iconTransformation(extent = {{-80.0, 0.0}, {-60.0, 20.0}}, origin = {70, 100}, rotation = 0), visible = true));
  OpenIPSL.Interfaces.PwPin C annotation(Placement(transformation(extent = {{-100.0, 0.0}, {-80.0, 20.0}}, origin = {0.0, 0.0}, rotation = 0), iconTransformation(extent = {{-80.0, 0.0}, {-60.0, 20.0}}, origin = {-19, 100}, rotation = 0), visible = true));

  parameter Real Q_a "Reactive power for phase A (MVAr)"
                                                        annotation (Dialog(group="Power flow"));
  parameter Real Q_b "Reactive power for phase B (MVAr)"
                                                        annotation (Dialog(group="Power flow"));
  parameter Real Q_c "Reactive power for phase C (MVAr)"
                                                        annotation (Dialog(group="Power flow"));
                                                        
  Real Pa = 0;
  Real Pb = 0;
  Real Pc = 0;
  Real Qa = Q_a/(Sn/3);
  Real Qb = Q_b/(Sn/3);
  Real Qc = Q_c/(Sn/3);
equation
  Pa = (A.vr*A.ir + A.vi*A.ii);
  Pb = (B.vr*B.ir + B.vi*B.ii);
  Pc = (C.vr*C.ir + C.vi*C.ii);
  Qa = (-A.vi*A.ir + A.vr*A.ii)/((A.vr)^2+(A.vi)^2);
  Qb = (-B.vi*B.ir + B.vr*B.ii)/((B.vr)^2+(B.vi)^2);
  Qc = (-C.vi*C.ir + C.vr*C.ii)/((C.vr)^2+(C.vi)^2);
  annotation (Icon(coordinateSystem(
        extent={{-100,-100},{100,100}},
        preserveAspectRatio=true,
        initialScale=0.1), graphics={Rectangle(
          extent={{-100,-100},{100,100}},
          lineColor={0,0,255},
          fillColor={255,255,255},
          fillPattern=FillPattern.Solid),Line(
{'fraction_non_alphanumeric': 0.191353811149033, 'fraction_numerical': 0.07053469852104664, 'mean_word_length': 2.39984532095901, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4150592', 'n_tokens_mistral': 1775, 'n_tokens_neox': 1558, 'n_words': 347}