Hanneli C. A. Tavante - UNIFEI
Prof. Benedito D. Bonatto - UNIFEI
Prof. Maurilio P. Coutinho - UNIFEI
INDUSCON 2018 - November 12th - 14th - São Paulo
More about programming than electromagnetic transients
INDUSCON 2018 - November 12th - 14th - São Paulo
"Open Source Implementations of Electromagnetic Transient Algorithms "
INDUSCON 2018 - November 12th - 14th - São Paulo
"Open Source Implementations of Electromagnetic Transient Algorithms "
INDUSCON 2018 - November 12th - 14th - São Paulo
H. Dommel
"Open Source Implementations of Electromagnetic Transient Algorithms "
Matrix equations to represent electromagnetic transients
INDUSCON 2018 - November 12th - 14th - São Paulo
H. Dommel
"Open Source Implementations of Electromagnetic Transient Algorithms "
ATP
EMTP
Well-known programs:
Closed source; written in Fortran, C++
INDUSCON 2018 - November 12th - 14th - São Paulo
"Open Source Implementations of Electromagnetic Transient Algorithms "
INDUSCON 2018 - November 12th - 14th - São Paulo
"Open Source Implementations of Electromagnetic Transient Algorithms "
Dommel's algorithm + Matlab/Octave + Open Source => High chances to become a good software!
INDUSCON 2018 - November 12th - 14th - São Paulo
"Open Source Implementations of Electromagnetic Transient Algorithms "
INDUSCON 2018 - November 12th - 14th - São Paulo
"Open Source Implementations of Electromagnetic Transient Algorithms "
INDUSCON 2018 - November 12th - 14th - São Paulo
"Open Source Implementations of Electromagnetic Transient Algorithms "
Python + THTA + Open Source => High chances to become a good software!
Work in progress
INDUSCON 2018 - November 12th - 14th - São Paulo
"Open Source Implementations of Electromagnetic Transient Algorithms "
INDUSCON 2018 - November 12th - 14th - São Paulo
"Open Source Implementations of Electromagnetic Transient Algorithms "
INDUSCON 2018 - November 12th - 14th - São Paulo
"Open Source Implementations of Electromagnetic Transient Algorithms "
The libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
INDUSCON 2018 - November 12th - 14th - São Paulo
"Open Source Implementations of Electromagnetic Transient Algorithms "
Importing the file
self.df = pd.read_csv('test.csv', header=None)
For this initial step, we shall use the .csv format
INDUSCON 2018 - November 12th - 14th - São Paulo
"Open Source Implementations of Electromagnetic Transient Algorithms "
Calculate the condutance and map elements
for index, row in self.elements.iterrows():
if row[0] == 'R':
resistor = Resistor(row[3])
self.gkm[index-1] = 1/resistor.value
self.nh = self.nh + 1
elif row[0] == 'C':
capacitor = Capacitor((row[3]*1e-6))
self.gkm[index-1] = 2*capacitor.value/self.dt
self.nh = self.nh + 1
elif row[0] == 'L':
inductor = Inductor((row[3]*1e-3))
self.gkm[index-1] = self.dt/(2*inductor.value)
elif row[0] == 'EDC':
self.ndcvs = self.ndcvs + 1
INDUSCON 2018 - November 12th - 14th - São Paulo
"Open Source Implementations of Electromagnetic Transient Algorithms "
Build the G matrix
self.g_matrix = np.zeros((self.elements.shape[0], self.elements.shape[0]))
for index, row in self.elements.iterrows():
k = row[1]
m = row[2]
if m == 0:
self.g_matrix[k,k] = self.g_matrix[k,k] + self.gkm[index-1]
elif k == 0:
self.g_matrix[m,m] = self.g_matrix[m,m] + self.gkm[index-1]
else:
self.g_matrix[k,k] = self.g_matrix[k,k] + self.gkm[index-1]
self.g_matrix[m,m] = self.g_matrix[m,m] + self.gkm[index-1]
self.g_matrix[k,m] = self.g_matrix[k,m] + self.gkm[index-1]
self.g_matrix[m,k] = self.g_matrix[m,k] + self.gkm[index-1]
INDUSCON 2018 - November 12th - 14th - São Paulo
"Open Source Implementations of Electromagnetic Transient Algorithms "
Build the GAA and GAB matrices
d = self.nodes_qty - self.sources_qty
self.gaa = self.g_matrix[0:d, 0:d]
self.gab = self.g_matrix[0:d, d:self.nodes_qty]
self.gba = self.g_matrix[d:self.nodes_qty, 0:d]
self.gbb = self.g_matrix[d:self.nodes_qty, d:self.nodes_qty]
INDUSCON 2018 - November 12th - 14th - São Paulo
"Open Source Implementations of Electromagnetic Transient Algorithms "
Simulation (see resolver.py)
INDUSCON 2018 - November 12th - 14th - São Paulo
"Open Source Implementations of Electromagnetic Transient Algorithms "
CSV
T,2,1,100E-6,50E-6,0,0,0,0,0
EDC,2,0,10,0,0,0,0,0,0
R,2,1,4,0,0,0,0,0,2
C,1,0,7,0,0,0,0,0,2
R,1,0,6,0,0,0,0,0,2
NV,1,2,0,0,0,0,0,0,0
INDUSCON 2018 - November 12th - 14th - São Paulo
"Open Source Implementations of Electromagnetic Transient Algorithms "
Image created on CircuitLab
INDUSCON 2018 - November 12th - 14th - São Paulo
"Open Source Implementations of Electromagnetic Transient Algorithms "
IA, IB, I
INDUSCON 2018 - November 12th - 14th - São Paulo
"Open Source Implementations of Electromagnetic Transient Algorithms "
VA, VB, V
INDUSCON 2018 - November 12th - 14th - São Paulo
"Open Source Implementations of Electromagnetic Transient Algorithms "
INDUSCON 2018 - November 12th - 14th - São Paulo
"Open Source Implementations of Electromagnetic Transient Algorithms "
Classes and object oriented programming (work in progress)
INDUSCON 2018 - November 12th - 14th - São Paulo
"Open Source Implementations of Electromagnetic Transient Algorithms "
Different languages and paradigms
3-Phase simulations
INDUSCON 2018 - November 12th - 14th - São Paulo
"Open Source Implementations of Electromagnetic Transient Algorithms "
INDUSCON 2018 - November 12th - 14th - São Paulo
"Open Source Implementations of Electromagnetic Transient Algorithms "
The authors acknowledge the support from CNPq, INERGE, CAPES, FAPEMIG and UNIFEI.
Questions?
hannelita@gmail.com
INDUSCON 2018 - November 12th - 14th - São Paulo
"Open Source Implementations of Electromagnetic Transient Algorithms "