Example #1
0
 def powerflowreact(model, i):
     if i in gb:
         return model.Qg[i]-Qd[i] == sum(model.vm[i]*model.vm[j]*abs(y[i, j]) *
                                         sin(model.va[i] - model.va[j] - ang(y[i, j])) for j in range(nb))
     else:
         return sum(model.vm[i]*model.vm[j]*abs(y[i, j]) * sin(model.va[i] - model.va[j] -
                                                               ang(y[i, j])) for j in range(nb)) == -Qd[i]
Example #2
0
 def qto(model, i):
     if i in tp:
         return model.Qt[i] == model.vm[to[i]] ** 2 * abs(yft[i]) * np.sin(-ang(yft[i])) - \
                               model.vm[to[i]] * model.vm[fr[i]] * abs(yk[i]) / model.tr[i] * \
                               sin(model.va[to[i]] - model.va[fr[i]] - ang(yk[i]))
     else:
         return model.Qt[i] == model.vm[to[i]] ** 2 * abs(yft[i]) * np.sin(-ang(yft[i])) - \
                               model.vm[to[i]] * model.vm[fr[i]] * abs(yk[i]) / tr0[i] * \
                               sin(model.va[to[i]] - model.va[fr[i]] - ang(yk[i]))
Example #3
0
 def powerflowreact(model, i):
     bfrom_i = tp[find(fr[tp] == i)]  # branches from bus i with transformer
     bto_i = tp[find(to[tp] == i)]  # branches to bus i with transformer
     allbut_i = find(bus[:, BUS_I] != i)  # Set of other buses
     sh = sd[find(sd == i)]  # Detect shunt elements
     if i in gb:
         return model.Qg[i]-Qd[i] == \
                sum(model.vm[i] * model.vm[j] * abs(y[i, j]) *
                    sin(model.va[i] - model.va[j] - ang(y[i, j])) for j in allbut_i) - \
                sum(model.vm[i] * model.vm[to[j]] * abs(yk[j]) * sin(model.va[i] - model.va[to[j]] - ang(yk[j]))
                    * (1 / model.tr[j] - 1) for j in bfrom_i) - \
                sum(model.vm[i] * model.vm[fr[j]] * abs(yk[j]) * sin(model.va[i] - model.va[fr[j]] - ang(yk[j]))
                    * (1 / model.tr[j] - 1) for j in bto_i) + \
                model.vm[i] ** 2 * (sum(abs(yk[j]) * (1 / model.tr[j] ** 2 - 1) * np.sin(- ang(yk[j]))
                                        for j in bfrom_i) - imag(y[i, i]) - sum(model.Bs[j] for j in sh))
     else:
         return sum(model.vm[i] * model.vm[j] * abs(y[i, j]) *
                    sin(model.va[i] - model.va[j] - ang(y[i, j])) for j in allbut_i) - \
                sum(model.vm[i] * model.vm[to[j]] * abs(yk[j]) * sin(model.va[i] -
                    model.va[to[j]] - ang(yk[j])) * (1 / model.tr[j] - 1) for j in bfrom_i) - \
                sum(model.vm[i] * model.vm[fr[j]] * abs(yk[j]) * sin(model.va[i] -
                    model.va[fr[j]] - ang(yk[j])) * (1 / model.tr[j] - 1) for j in bto_i) + \
                model.vm[i] ** 2 * (sum(abs(yk[j]) * (1 / model.tr[j] ** 2 - 1) * np.sin(- ang(yk[j]))
                                        for j in bfrom_i) - imag(y[i, i]) - sum(model.Bs[j] for j in sh)) == - Qd[i]
Example #4
0
 def qto(model, i):
     return model.Qt[i] == model.vm[to[i]] ** 2 * abs(yft[i]) * np.sin(-ang(yft[i])) - \
                           model.vm[to[i]] * model.vm[fr[i]] * abs(yk[i]) * \
                           sin(model.va[to[i]] - model.va[fr[i]] - ang(yk[i]))
Example #5
0
 def qfrom(model, i):
     return model.Qf[i] == model.vm[fr[i]] ** 2 * abs(yft[i]) / (tr[i] ** 2) * np.sin(-ang(yft[i])) - \
                           model.vm[fr[i]] * model.vm[to[i]] * abs(yk[i]) * \
                           sin(model.va[fr[i]] - model.va[to[i]] - ang(yk[i]))