MCPcopy Create free account
hub / github.com/InternScience/InternAgent / deltapq_loss

Function deltapq_loss

tasks/AutoPower/code/experiment.py:251–260  ·  view source on GitHub ↗
(batch, Ybus)

Source from the content-addressed store, hash-verified

249 return Ybus
250
251def deltapq_loss(batch, Ybus):
252 Vm, Va, P_net, Q_net = 0, 1, 2, 3
253 bus = batch.to_homogeneous().x
254 v = bus[:, Vm] * torch.exp(1j * bus[:, Va])
255 i = torch.conj(torch.matmul(Ybus, v))
256 s = v * i + bus[:, P_net] + 1j * bus[:, Q_net]
257
258 delta_p = torch.real(s)
259 delta_q = torch.imag(s)
260 return delta_p, delta_q
261
262
263# -------------------------- #

Callers 2

vm_va_matrixFunction · 0.70
forwardMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected