2

I am trying to create a wind turbine model in PyMAPDL. I got to a point where I have a tower and a nacelle. However, I got stuck making the blades of the wind turbine.

They should be 3 and separated 120 degrees between them. To give you some context, the length units are mm, the tower height is 180m.

The code that I tried was the following:

blade_radius = 50000
blade_count = 3

blade_tips_keypoints = []
blade_lines = []

for i in range(blade_count):
    angle = i * 360 / blade_count
    
    mapdl.kwpave(p1 = nacelle_keypoints[-1])
    mapdl.wprota(thzx = angle)

    blade_tips_keypoints.append(mapdl.k(0, 0, blade_radius))

for i in range(blade_count):
    blade_lines.append(mapdl.l(p1 = nacelle_keypoints[-1], p2 = blade_tips_keypoints[i]))

The result of this is the following:

These are the keypoints it generated These are the lines it generated

2 Answers2

1

There are a few things to be updated. The first is that the Working Plane rotation is incremental, not total. So the angle should be:

angle = 360 / blade_count

Also from the KeyPoint definition I'm pretty sure that the WP should be rotated about Z so:

mapdl.wprota(thxy = angle)

Lastly the keypoints are defined in the current coordinate system. Which you want to be the Working Plane and not the Global CS. So bookend the keypoint creation with a change in coordinate systems:

mapdl.csys(4)    
blade_tips_keypoints.append(mapdl.k(0, 0, blade_radius))
mapdl.csys(0)

Mike

Mike R
  • 41
  • 3
  • Hi @Mike R! Thanks for your reply! I tried the changes you mentioned. However, it is still not working. the rotation must be around the Y-Axis, as the blades must be perpendicular to the nacelle. I tried keeping the rotation around that axis, but it just produces one single line colinear to it. – Nicolás Olabarría May 05 '23 at 09:27
  • Hi Nicolas - I was assuming the default orientation of the WP. So I'm guessing that it was moved/orientated prior to the shown code? Anyway well done on the troubleshooting! – Mike R May 25 '23 at 14:52
  • Hi @Mike R, the WP as far as I know was the default one, but I guess when you move the WP to the KP at the edge of the nacelle, the orientation changes. Wouldn't have figured out the right code without your comment, thanks! – Nicolás Olabarría May 26 '23 at 15:12
1

After much testing, the error was in the coordinate the keypoint was being given. Instead of the z coordinate, it should have been the y coordinate. The correct code is listed below.


blade_radius = 10000
blade_count = 3

blade_tips_keypoints = []
blade_lines = []

for i in range(blade_count):
    angle = 360 / blade_count
    
    mapdl.kwpave(p1 = nacelle_keypoints[-1])
    mapdl.wprota(thzx = angle)

    mapdl.csys(4)
    blade_tips_keypoints.append(mapdl.k(0, blade_radius, 0))
    mapdl.csys(0)

    print(f' Keypoint {blade_tips_keypoints[i]} '.center(5, "#"))
    X = mapdl.get(entity = 'KP', entnum = blade_tips_keypoints[i], item1 = 'LOC', it1num = 'X')
    Y = mapdl.get(entity = 'KP', entnum = blade_tips_keypoints[i], item1 = 'LOC', it1num = 'Y')
    Z = mapdl.get(entity = 'KP', entnum = blade_tips_keypoints[i], item1 = 'LOC', it1num = 'Z')
    print(f'x = {X}\ny = {Y}\nz = {Z}')

for i in range(blade_count):
    blade_lines.append(mapdl.l(p1 = nacelle_keypoints[-1], p2 = blade_tips_keypoints[i]))