From 3f862231b581bd82674af927128aaa97bc3dde79 Mon Sep 17 00:00:00 2001 From: Rahix Date: Wed, 10 Sep 2025 07:05:35 +0200 Subject: [PATCH] Render all notebooks --- Calculations/rendered/Connector-Plate.md | 25 ++++ .../rendered/Eddy-current-brake-simulation.md | 139 ++++++++++++++++++ Calculations/rendered/Laserbeam.md | 132 +++++++++++++++++ .../Laserbeam_files/Laserbeam_2_0.png | 3 + .../Laserbeam_files/Laserbeam_2_1.png | 3 + Calculations/rendered/Preamp-Current.md | 52 +++++++ .../Preamp-Current_0_0.png | 3 + Calculations/rendered/Spring-Dimensioning.md | 138 +++++++++++++++++ .../Spring-Dimensioning_2_1.png | 3 + .../Spring-Dimensioning_3_1.png | 3 + .../rendered/Tunneling-Current-Distance.md | 72 +++++++++ .../Tunneling-Current-Distance_0_1.png | 3 + .../Temp-Monitor/rendered/Temperature-Data.md | 53 +++++++ .../Temperature-Data_0_0.png | 3 + 14 files changed, 632 insertions(+) create mode 100644 Calculations/rendered/Connector-Plate.md create mode 100644 Calculations/rendered/Eddy-current-brake-simulation.md create mode 100644 Calculations/rendered/Laserbeam.md create mode 100644 Calculations/rendered/Laserbeam_files/Laserbeam_2_0.png create mode 100644 Calculations/rendered/Laserbeam_files/Laserbeam_2_1.png create mode 100644 Calculations/rendered/Preamp-Current.md create mode 100644 Calculations/rendered/Preamp-Current_files/Preamp-Current_0_0.png create mode 100644 Calculations/rendered/Spring-Dimensioning.md create mode 100644 Calculations/rendered/Spring-Dimensioning_files/Spring-Dimensioning_2_1.png create mode 100644 Calculations/rendered/Spring-Dimensioning_files/Spring-Dimensioning_3_1.png create mode 100644 Calculations/rendered/Tunneling-Current-Distance.md create mode 100644 Calculations/rendered/Tunneling-Current-Distance_files/Tunneling-Current-Distance_0_1.png create mode 100644 Misc/Temp-Monitor/rendered/Temperature-Data.md create mode 100644 Misc/Temp-Monitor/rendered/Temperature-Data_files/Temperature-Data_0_0.png diff --git a/Calculations/rendered/Connector-Plate.md b/Calculations/rendered/Connector-Plate.md new file mode 100644 index 0000000..e141ac3 --- /dev/null +++ b/Calculations/rendered/Connector-Plate.md @@ -0,0 +1,25 @@ +```python +from pint import UnitRegistry +unit = UnitRegistry() +unit.formatter.default_format = "~" + +preload_m4 = 3000 * unit.N +n_screws = 4 # 2 on each side +friction_coeff = 0.21 # Al on Al +safety_factor = 1.5 + +max_load = preload_m4 * friction_coeff * n_screws / safety_factor / unit.standard_gravity +max_load.to(unit.kg) +``` + + + + +171.312323780292 kg + + + + +```python + +``` diff --git a/Calculations/rendered/Eddy-current-brake-simulation.md b/Calculations/rendered/Eddy-current-brake-simulation.md new file mode 100644 index 0000000..10e0535 --- /dev/null +++ b/Calculations/rendered/Eddy-current-brake-simulation.md @@ -0,0 +1,139 @@ +```python +import magpylib as magpy +from scipy.spatial.transform import Rotation as R +import pyvista as pv +import numpy as np + +# Creation of our magnets including place and orientation in the space (all dimensions guessed, need to put in correct ones) +# magnetic polarization of 1.5 T pointing in x-direction +# Dimensions assumed are 0.5, 1.5 and 3 cm (x,y,z) + + +# Question: Is there a more elegant way to do this? Should I make a for-loop for creating our magnet array? + +magnet1 = magpy.magnet.Cuboid(polarization=(1.5, 0, 0), dimension=(0.005, 0.015, 0.03)) +magnet1.position = (0, 0, 0) +magnet1.orientation = R.from_euler("y", 90, degrees=True) + +magnet2 = magpy.magnet.Cuboid(polarization=(1.5, 0, 0), dimension=(0.005, 0.015, 0.03)) +magnet2.position = (0.04, 0, 0) +magnet2.orientation = R.from_euler("y", 90, degrees=True) + +magnet3 = magpy.magnet.Cuboid(polarization=(1.5, 0, 0), dimension=(0.005, 0.015, 0.03)) +magnet3.position = (0, 0.04, 0) +magnet3.orientation = R.from_euler("y", 90, degrees=True) + +magnet4 = magpy.magnet.Cuboid(polarization=(1.5, 0, 0), dimension=(0.005, 0.015, 0.03)) +magnet4.position = (0.04, 0.04, 0) +magnet4.orientation = R.from_euler("y", 90, degrees=True) + +magnet5 = magpy.magnet.Cuboid(polarization=(1.5, 0, 0), dimension=(0.005, 0.015, 0.03)) +magnet5.position = (0, 0.08, 0) +magnet5.orientation = R.from_euler("y", 90, degrees=True) + +magnet6 = magpy.magnet.Cuboid(polarization=(1.5, 0, 0), dimension=(0.005, 0.015, 0.03)) +magnet6.position = (0.04, 0.08, 0) +magnet6.orientation = R.from_euler("y", 90, degrees=True) + +magnet7 = magpy.magnet.Cuboid(polarization=(1.5, 0, 0), dimension=(0.005, 0.015, 0.03)) +magnet7.position = (0, 0.12, 0) +magnet7.orientation = R.from_euler("y", 90, degrees=True) + +magnet8 = magpy.magnet.Cuboid(polarization=(1.5, 0, 0), dimension=(0.005, 0.015, 0.03)) +magnet8.position = (0.04, 0.12, 0) +magnet8.orientation = R.from_euler("y", 90, degrees=True) + + +# Grouping the magnets to collection +coll = magpy.Collection(magnet1, magnet2, magnet3, magnet4, magnet5, magnet6, magnet7, magnet8) + +# Plotting the magnet array +magpy.show(coll, backend="plotly") +``` + + + + +```python +# Just for visualization: Showing the magnetic field vectors in 3D + +spacing = np.array([0.003, 0.003, 0.003]) # defines the grid where the magnetic field is calculated + +# The following is for getting the right dimensions and position of the grid +magnets = [magnet1, magnet2, magnet3, magnet4, magnet5, magnet6, magnet7, magnet8] +all_mins = [] +all_maxs = [] + +for m in magnets: + pos = np.array(m.position) + dim = np.array(m.dimension) / 2 + all_mins.append(pos - dim) + all_maxs.append(pos + dim) + +global_min = np.min(all_mins, axis=0) - 0.02 # add 2cm as buffer +global_max = np.max(all_maxs, axis=0) + 0.02 + +dimensions = ((global_max - global_min) / spacing).astype(int) + +grid = pv.ImageData( + spacing=tuple(spacing), + dimensions=tuple(dimensions), + origin=(-0.02, -0.02, -0.02), +) + +# Calculation of the B-field in mT +grid["B"] = coll.getB(grid.points) * 1000 +pl = pv.Plotter() +pl.add_mesh(grid.outline(), color="blue", line_width=1) +pl.add_points(grid.points, render_points_as_spheres=True, point_size=2, color='black') + +# Add magnetic field vectors as arrows (glyphs) +pl.add_mesh( + grid.glyph(orient="B", scale=True, factor=0.00001), # use "B" vectors, scaling according to field strength, factor to make arrows smaller for visibility + color="blue", + label="Magnetic field vectors" +) + +magpy.show(coll, canvas=pl, units_length="m", backend="pyvista") + + + +pl.show() + + +``` + + + Widget(value='