1111import scipy
1212from matplotlib import pyplot as plt
1313import magnethub as mh
14+ import pandas as pd
1415
1516logger = logging .getLogger (__name__ )
1617
@@ -1271,7 +1272,28 @@ def calc_proximity_factor_air_gap(litz_wire_name: str, number_turns: int, r_1: f
12711272 return proximity_factor
12721273
12731274def magent_loss_model_on_cylinder_radiant (magnet_material_model : mh .loss .LossModel , r_cyl_inner : np .float64 , r_cyl_outer : np .float64 ,
1274- time_vec : np .ndarray , flux_vec : np .ndarray , h_cyl : np .ndarray , temperature : np .float64 , total_opening_angle_rad : float = 210 / 360 * 2 * np .pi ):
1275+ time_vec : np .ndarray , flux_vec : np .ndarray , h_cyl : np .ndarray , temperature : np .float64 ,
1276+ total_opening_angle_rad : float = 210 / 360 * 2 * np .pi ):
1277+ """
1278+ Get the core hysteresis losses for the radiant flux parts in a tablet. Uses the MagNet model.
1279+
1280+ :param magnet_material_model: MagNet material model
1281+ :type magnet_material_model: mh.loss.LossModel
1282+ :param r_cyl_inner: inner cylinder radius of the tablet
1283+ :type r_cyl_inner: np.float64
1284+ :param r_cyl_outer: outer cylinder radius of the tablet
1285+ :type r_cyl_outer: np.float64
1286+ :param time_vec: time vector
1287+ :type time_vec: np.ndarray
1288+ :param flux_vec: flux vector
1289+ :type flux_vec: np.ndarray
1290+ :param h_cyl: height of the tablet / cylinder
1291+ :type h_cyl: np.ndarray
1292+ :param temperature: temperature in °C
1293+ :type temperature: np.float64
1294+ :param total_opening_angle_rad: cylinder/tablet total opening angle
1295+ :type total_opening_angle_rad: float
1296+ """
12751297
12761298 def flux_density_cylinder_envelope (cylinder_radius : float | np .ndarray , flux_in_cylinder : float | np .ndarray ,
12771299 height_of_cylinder : float | np .ndarray , magnet_material_model : mh .loss .LossModel ,
@@ -1288,6 +1310,14 @@ def flux_density_cylinder_envelope(cylinder_radius: float | np.ndarray, flux_in_
12881310 :type flux_in_cylinder: float | np.ndarray
12891311 :param height_of_cylinder: cylinder height in m
12901312 :type height_of_cylinder: float | np.ndarray
1313+ :param magnet_material_model: Magnet material model
1314+ :type magnet_material_model: mh.loss.LossModel
1315+ :param time_vec: time vector
1316+ :type time_vec: np.ndarray
1317+ :param temperature: temperature in degree
1318+ :type temperature: np.float64
1319+ :param total_opening_angle_rad: total opening angle in radiant
1320+ :type total_opening_angle_rad: float
12911321 :return: Flux density in T
12921322 :rtype: float | np.ndarray
12931323 """
@@ -1302,20 +1332,18 @@ def flux_density_cylinder_envelope(cylinder_radius: float | np.ndarray, flux_in_
13021332 fundamental_frequency = 1 / time_vec [- 1 ]
13031333 p_density_middle , _ = magnet_material_model (flux_density_middle_interp , fundamental_frequency , temperature )
13041334
1305- return flux_density_middle , p_density_middle
1335+ return p_density_middle
13061336
13071337 # generate flux and loss distribution along the radius
1308- radius_list = np .linspace (r_cyl_inner , r_cyl_outer )
1309- flux_density_list = []
1310- p_density_list = []
1311- for radius in radius_list :
1312- flux_density_middle , p_density_middle = flux_density_cylinder_envelope (
1313- cylinder_radius = radius , flux_in_cylinder = flux_vec , height_of_cylinder = h_cyl , magnet_material_model = magnet_material_model ,
1314- time_vec = time_vec , temperature = temperature , total_opening_angle_rad = total_opening_angle_rad )
1315- flux_density_list .append (flux_density_middle )
1316- p_density_list .append (p_density_middle )
1338+ radius_list = np .linspace (r_cyl_inner , r_cyl_outer , 10 )
1339+ radius_list_df = pd .DataFrame ({"radius" : radius_list })
1340+
1341+ radius_list_df ["p_density" ] = radius_list_df .apply (
1342+ lambda x : flux_density_cylinder_envelope (
1343+ cylinder_radius = x ["radius" ], flux_in_cylinder = flux_vec , height_of_cylinder = h_cyl , magnet_material_model = magnet_material_model ,
1344+ time_vec = time_vec , temperature = temperature , total_opening_angle_rad = total_opening_angle_rad ), axis = 1 )
13171345
13181346 # integrate along the axis
1319- power = total_opening_angle_rad * h_cyl * np .trapezoid (p_density_list * radius_list , x = radius_list )
1347+ power = total_opening_angle_rad * h_cyl * np .trapezoid (radius_list_df [ "p_density" ] * radius_list , x = radius_list )
13201348
13211349 return power
0 commit comments