Skip to content

Commit b1aad2f

Browse files
Mortara  AlessandroMortara  Alessandro
authored andcommitted
feat!: new methods in class Conductor
News privates methods to deal with the inductance evaluation. *__constant_inductance: private method that assigns a constant value to the mutual inductance as defined by the user in variable MUTUAL_INDUCTANCE, in sheet CONDUCTOR_operation of the input file conductor_definition.xlsx. *__constant_self_inductance_evaluation: private method that assigns a constant value to the self inductance that is defined by the user in variable SELF_INDUCTANCE, in sheet CONDICTOR_operation in the input file conductor_definition.xlsx Class: Conductor modified: conductor.py BREAKING CHANGES These methods are called respectively with the new values of flags INDUCTANCE_MODE, SELF_INDUCTANCE_MODE, as follows: INDUCTANCE_MODE = 0 -> __constant_inductance SELF_INDUCTANCE_MODE = 0 -> __constant_self_inductance_evaluation
1 parent c01a0d1 commit b1aad2f

1 file changed

Lines changed: 71 additions & 0 deletions

File tree

source_code/conductor.py

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3688,6 +3688,62 @@ def build_electric_known_term_vector(self):
36883688
self.total_elements_current_carriers :
36893689
] = self.dict_node_pt["op_current"]
36903690

3691+
# CONSTANT INDUCTANCE
3692+
def __constant_inductance(self, mode: int):
3693+
"""Private method that assigns a constant value to the mutual inductance as defined by the user in sheet CONDUCTOR_operation of the input file conductor_definition.xlsx
3694+
3695+
Args:
3696+
mode (int): flag to select the equation for the analytical evaluation of self inductance. 0:constan value from sheet CONDUCTOR_operation of the input file conductor_definition.xlsx; 1: from method __self_inductance_mode1; 2: from method __self_inductance_mode2.
3697+
"""
3698+
3699+
lmod = (
3700+
(
3701+
(
3702+
self.nodal_coordinates.iloc[
3703+
self.connectivity_matrix.loc[
3704+
"StrandComponent",
3705+
"end",
3706+
],
3707+
:,
3708+
]
3709+
- self.nodal_coordinates.iloc[
3710+
self.connectivity_matrix.loc[
3711+
"StrandComponent",
3712+
"start",
3713+
],
3714+
:,
3715+
]
3716+
)
3717+
** 2
3718+
)
3719+
.sum(axis=1)
3720+
.apply(np.sqrt)
3721+
)
3722+
mutual_inductance = self.operations["MUTUAL_INDUCTANCE"] * np.ones(self.inductance_matrix.shape)
3723+
3724+
# The principal diagonal is set to 0
3725+
for ii in range(mutual_inductance.shape[0]):
3726+
mutual_inductance[ii, ii] = 0
3727+
3728+
self_inductance_switch = {
3729+
SELF_INDUCTANCE_MODE_0: self.__constant_self_inductance_evaluation,
3730+
SELF_INDUCTANCE_MODE_1: self.__self_inductance_mode1,
3731+
SELF_INDUCTANCE_MODE_2: self.__self_inductance_mode2,
3732+
}
3733+
self_inductance = self_inductance_switch[mode](lmod)
3734+
3735+
# Evaluate internal inductance
3736+
internal_inductance = lmod.to_numpy() / 2.0
3737+
3738+
self.inductance_matrix = (
3739+
constants.mu_0
3740+
/ (4.0 * constants.pi)
3741+
* (
3742+
np.diag(self_inductance + internal_inductance)
3743+
+ mutual_inductance
3744+
+ mutual_inductance.T
3745+
)
3746+
)
36913747
# START: INDUCTANCE ANALYTICAL EVALUATION
36923748

36933749
def __inductance_analytical_calculation(self, mode: int = 2):
@@ -3908,6 +3964,21 @@ def __vertex_to_vertex_distance(
39083964
.apply(np.sqrt)
39093965
)
39103966

3967+
# CONSTANT SELF INDUCTANCE
3968+
def __constant_self_inductance_evaluation(self, lmod: np.array) -> np.ndarray:
3969+
"""Private method that assigns a constant value to the self inductance that is defined by the user in sheet CONDICTOR_operation in the input file conductor_definition.xlsx
3970+
3971+
Args:
3972+
lmod (np.ndarray): array with the distance between strand component nodal nodes.
3973+
3974+
Returns:
3975+
np.ndarray: self inductances.
3976+
"""
3977+
3978+
self_inductance = np.ones(lmod.shape) * self.operations["SELF_INDUCTANCE"]
3979+
3980+
return self_inductance
3981+
39113982
def __self_inductance_mode1(self, lmod: np.ndarray) -> np.ndarray:
39123983
"""Private method that analytically evaluates self inductances according to mode 1.
39133984

0 commit comments

Comments
 (0)