PRM Module
This class has functions to calculate and rotate the vectors and lines that are needed to make a plot of the position of the mirrors to eachother and to the observatory wall. Furthermore this class has functions that project the mirrors from a three dimensional space to a plane. This helps the operator to have an impression of the current position of the Heliostat in front of the laboratory.
Class documentation
Bases: QObject
This class calculates the vectors and lines for the 2D/3D view of the Heliostat.
Attributes:
| Name | Type | Description |
|---|---|---|
nn |
int
|
Number of drawing points for a circle. |
m1r |
int
|
Radius of the primary mirror |
m2r |
int
|
Radius of the secondary mirror. |
AU |
float
|
Sun-earth distance |
trafo_A_haus |
float
|
Angle between Heliostat and house normal vector |
trafoA |
float
|
Coordinate transformation parameter AzEl2Heli. |
trafoE |
float
|
Coordinate transformation parameter AzEl2Heli. |
n_p1 |
ndarray
|
Normal vector of the primary mirror. |
PV |
ndarray
|
View point in the laboratory. |
N12 |
ndarray
|
|
d2l |
int
|
|
d12 |
int
|
|
P2c |
ndarray
|
Center of secondary mirror. |
P1c |
ndarray
|
Center of primary mirror. |
n_p2 |
ndarray
|
Normalvector of mirror 2 |
n_pl |
ndarray
|
Normalvector of the projection plane. |
Source code in PRM_module.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | |
Abbildung(points)
This function calculates the orthogonal projection of a given object in 3D space
Source code in PRM_module.py
__init__()
Initialize attributes.
Retunrs
None
Source code in PRM_module.py
cart2sph(x, y, z)
Convert cartesian coordinates to spherical coordinates.
This method calculates the azimuth, elevation, and radial distance (r) from the origin to a point defined by its cartesian coordinates (x, y, z).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x |
float
|
X-coordinate of the point. |
required |
y |
float
|
Y-coordinate of the point. |
required |
z |
float
|
Z-coordinate of the point. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
A tuple containing the azimuth angle (in radians), elevation angle (in radians), and radial distance (r). |
Source code in PRM_module.py
circle_points(P, N, r, n)
Calculate points on a circle with given center, radius, and normal vector.
This method calculates 'n' points on a circle with center 'P', radius 'r', and normal vector 'N'.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
P |
ndarray
|
Coordinates of the center of the circle. |
required |
N |
ndarray
|
Normal vector of the plane containing the circle. |
required |
r |
float
|
Radius of the circle. |
required |
n |
int
|
Number of points to generate on the circle. |
required |
Returns:
| Type | Description |
|---|---|
|
numpy.ndarray: An array containing the coordinates of the points on the circle. |
Source code in PRM_module.py
drehen(alpha, n, v_in)
Rotate a vector around a given axis with a specified angle.
This method rotates the given vector 'v_in' around the axis 'n' by the angle 'alpha'.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha |
float
|
Angle of rotation in degrees. |
required |
n |
ndarray
|
Axis of rotation. |
required |
v_in |
ndarray
|
Vector to be rotated. |
required |
Returns:
| Type | Description |
|---|---|
|
numpy.ndarray: The rotated vector. |
Source code in PRM_module.py
intersection_point(P1, v, P2, n)
Calculate the intersection point of a line and a plane.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
P1 |
ndarray
|
Coordinates of a point on the line. |
required |
v |
ndarray
|
Direction vector of the line. |
required |
P2 |
ndarray
|
Coordinates of a point on the plane. |
required |
n |
ndarray
|
Normal vector of the plane. |
required |
Returns:
| Type | Description |
|---|---|
|
numpy.ndarray: Coordinates of the intersection point. |
Source code in PRM_module.py
inverse_polar_rotation(A, E, alpha, beta)
This method applies inverse polar rotation to given azimuth and elevation angles (A, E) by first rotating them around the z-axis by alpha degrees followed by a rotation around the x-axis by beta degrees.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
A |
float
|
Azimuth angle in degrees. |
required |
E |
float
|
Elevation angle in degrees. |
required |
alpha |
float
|
Rotation angle around the z-axis in degrees. |
required |
beta |
float
|
Rotation angle around the x-axis in degrees. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
A dictionary containing the updated azimuth and elevation angles after the inverse polar rotation. |
Source code in PRM_module.py
polar_rotation(A, E, alpha, beta)
staticmethod
This method applies polar rotation to given azimuth and elevation angles (A, E) by rotating them using the angles alpha and beta. The rotation is performed around the z-axis followed by the y-axis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
A |
float
|
Azimuth angle in degrees. |
required |
E |
float
|
Elevation angle in degrees. |
required |
alpha |
float
|
Rotation angle around the z-axis in degrees. |
required |
beta |
float
|
Rotation angle around the y-axis in degrees. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
A dictionary containing the updated azimuth and elevation angles after the polar rotation. |
Source code in PRM_module.py
project_m1(pos)
Project mirror M1 onto the same plane as mirror M2.
This method updates the position of mirror M1 based on the given position 'pos', then projects M1 onto the same plane as M2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pos |
dict
|
A dictionary containing 'A' and 'E' keys representing azimuth and elevation angles. |
required |
Returns:
| Type | Description |
|---|---|
|
numpy.ndarray: An array containing the coordinates of the projected points of mirror M1. |
Source code in PRM_module.py
project_m2()
Project mirror M2 onto its own plane.
This method projects mirror M2 onto the wall of the labratory.
Returns:
| Type | Description |
|---|---|
|
numpy.ndarray: An array containing the coordinates of the projected points of mirror M2. |
Source code in PRM_module.py
punkt_spiegeln_einfach(P_in)
This method mirrors the given point 'P_in' on the plane defined by mirror M2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
P_in |
ndarray
|
Coordinates of the point to be reflected. |
required |
Returns:
| Type | Description |
|---|---|
|
numpy.ndarray: Coordinates of the reflected point. |
Source code in PRM_module.py
sph2cart(azimuth, elevation, r)
Convert spherical coordinates to cartesian coordinates.
This method calculates the cartesian coordinates (x, y, z) from given spherical coordinates: azimuth angle, elevation angle, and radial distance (r).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
azimuth |
float
|
Azimuth angle in radians. |
required |
elevation |
float
|
Elevation angle in radians. |
required |
r |
float
|
Radial distance from the origin to the point. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
A tuple containing the x, y, and z coordinates of the point in cartesian space. |
Source code in PRM_module.py
update_position(pos)
This method updates the position of the PRM object based on the azimuth ('A') and elevation ('E') angles provided in the 'pos' dictionary. It calculates the normal vector 'n_p1' corresponding to mirror 1, as well as the direction of the sun 'V_sun' and the sun position 'Pc_sun'.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pos |
dict
|
A dictionary containing 'A' and 'E' keys representing azimuth and elevation angles, respectively. |
required |
Returns:
| Type | Description |
|---|---|
|
None |
Source code in PRM_module.py
vektor_spiegeln_einfach(V_in, P_in)
This method mirrrors the given vector 'V_in' on the plane defined by mirror M2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
V_in |
ndarray
|
Vector to be reflected. |
required |
P_in |
ndarray
|
Coordinates of the point on which the reflection is performed. |
required |
Returns:
| Type | Description |
|---|---|
|
numpy.ndarray: Coordinates of the reflected vector. |