openafpm_cad_core

alternator_cells

app

class Assembly(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

BLADE_TEMPLATE = 'Blade Template'
COIL_WINDER = 'Coil Winder'
MAGNET_JIG = 'Magnet Jig'
ROTOR_MOLD = 'Rotor Mold'
STATOR_MOLD = 'Stator Mold'
WIND_TURBINE = 'Wind Turbine'
class WindTurbineShape(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Enumeration of wind turbine shapes.

H = 'H Shape'

Medium-sized wind turbine with a frame shaped like an “H”.

STAR = 'Star Shape'

Largest wind turbine with a frame shaped like a six-pointed star.

T = 'T Shape'

Smallest wind turbine with a frame shaped like a “T”.

static from_string(string: str)
to_string()
close_all_documents() None

Close all open FreeCAD documents safely, handling deleted objects.

exec_turbine_function(description: str, turbine_function: Callable[[WindTurbineShape], str] | Callable[[WindTurbineShape, Namespace], str], argument_parser_customizer: Callable[[ArgumentParser], None] | None = None) None
find_descendent_by_label(obj, label: str)
find_object_by_label(document: Document, label: str) object | None

Find an object in a document by the given label.

Returns None if no object is found.

get_assembly_to_obj(assembly: Assembly, root_document: Document) str
get_default_parameters(preset: WindTurbineShape | str) dict

Get default parameters for “T Shape”, “H Shape”, “Star Shape”, or another preset turbine.

get_dimension_tables(spreadsheet_document: Document, alternator_document: Document, img_path_prefix: str = '') List[Element]
get_dxf_archive(root_documents, magnafpm_parameters: MagnafpmParameters) bytes
get_dxf_as_svg(root_documents: List[Document], magnafpm_parameters: MagnafpmParameters, font_family: str = 'sans-serif', foreground: str = '#FFFFFF', background: str = '#000000') str
get_freecad_archive(root_documents, spreadsheet_document) bytes
get_furl_transform(wind_turbine_document: Document, spreadsheet_document: Document) FurlTransform
get_parameters_schema(wind_turbine_shape: WindTurbineShape) dict
get_presets() List[str]
hash_parameters(magnafpm_parameters: MagnafpmParameters, furling_parameters: FurlingParameters, user_parameters: UserParameters) str
load_all(magnafpm_parameters: MagnafpmParameters, furling_parameters: FurlingParameters, user_parameters: UserParameters, progress_callback=None, progress_range=(0, 100), cancel_event=None) Tuple[List[Document], Document]

Load all wind turbine CAD documents with optional progress reporting.

Loads the complete set of OpenAFPM wind turbine documents including: - Wind Turbine assembly - Stator Mold, Rotor Mold assemblies - Magnet Jig, Coil Winder assemblies - Blade Template

Args:

magnafpm_parameters: Generator/alternator parameters from MagnAFPM tool furling_parameters: Tail and furling mechanism parameters user_parameters: User-defined construction parameters progress_callback: Optional callback function(stage_name: str, percent: int) progress_range: Tuple of (start_percent, end_percent) for progress scaling cancel_event: Optional threading.Event to signal cancellation

Returns:

Tuple of (root_documents, spreadsheet_document) - root_documents: List of 6 loaded FreeCAD Document objects (root of document hierarchy) - spreadsheet_document: Master parameter spreadsheet Document

Example:
>>> def progress_handler(stage, percent):
...     print(f"[{percent}%] {stage}")
>>> 
>>> params = get_default_parameters("T Shape")
>>> root_docs, sheet = load_all(
...     params['magnafpm'], 
...     params['furling'], 
...     params['user'],
...     progress_callback=progress_handler,
...     progress_range=(0, 80)  # Reserve 80-100% for other operations
... )
Note:

Loading typically takes 50+ seconds due to document recomputation. Progress callback provides detailed feedback during this process.

load_assembly_to_obj(assembly: Assembly, magnafpm_parameters: MagnafpmParameters, furling_parameters: FurlingParameters, user_parameters: UserParameters) str
load_dimension_tables(magnafpm_parameters: MagnafpmParameters, furling_parameters: FurlingParameters, user_parameters: UserParameters, img_path_prefix: str = '') List[Element]
load_dxf_archive(magnafpm_parameters: MagnafpmParameters, furling_parameters: FurlingParameters, user_parameters: UserParameters) bytes
load_dxf_as_svg(magnafpm_parameters: MagnafpmParameters, furling_parameters: FurlingParameters, user_parameters: UserParameters, font_family: str = 'sans-serif', foreground: str = '#FFFFFF', background: str = '#000000') str
load_freecad_archive(magnafpm_parameters: MagnafpmParameters, furling_parameters: FurlingParameters, user_parameters: UserParameters) bytes
load_furl_transform(magnafpm_parameters: MagnafpmParameters, furling_parameters: FurlingParameters, user_parameters: UserParameters) FurlTransform
load_spreadsheet_document(magnafpm_parameters: MagnafpmParameters, furling_parameters: FurlingParameters, user_parameters: UserParameters) Document
loadmat(filename, meta=False)

Load data from MAT-file:

data = loadmat(filename, meta=False)

The filename argument is either a string with the filename, or a file like object.

The returned parameter data is a dict with the variables found in the MAT file.

Call loadmat with parameter meta=True to include meta data, such as file header information and list of globals.

A ParseError exception is raised if the MAT-file is corrupt or contains a data type that cannot be parsed.

map_magnafpm_parameters(magnafpm: dict) MagnafpmParameters
map_rotor_disk_radius_to_wind_turbine_shape(rotor_disk_radius: float) WindTurbineShape
unhash_parameters(parameter_hash: str) dict
upsert_spreadsheet_document(path: Path, magnafpm_parameters: MagnafpmParameters, furling_parameters: FurlingParameters, user_parameters: UserParameters, cancel_event=None) Document

assembly_to_obj

get_assembly_to_obj(assembly: Assembly, root_document: Document) str
load_assembly_to_obj(assembly: Assembly, magnafpm_parameters: MagnafpmParameters, furling_parameters: FurlingParameters, user_parameters: UserParameters) str

blade_cells

close_all_documents

close_all_documents() None

Close all open FreeCAD documents safely, handling deleted objects.

create_placement_cells

create_placement_cells(name: str, base: Tuple[str, str, str], axis: Tuple[str, str, str], angle: str) List[List[Cell]]

dimension_tables

Module for retrieving dimensions to display in a tabular format.

get_dimension_tables(spreadsheet_document: Document, alternator_document: Document, img_path_prefix: str = '') List[Element]
load_dimension_tables(magnafpm_parameters: MagnafpmParameters, furling_parameters: FurlingParameters, user_parameters: UserParameters, img_path_prefix: str = '') List[Element]

dxf_archive

export_dxf_as_zip(export_set: Set[object], svg: str) bytes
get_dxf_archive(root_documents, magnafpm_parameters: MagnafpmParameters) bytes
load_dxf_archive(magnafpm_parameters: MagnafpmParameters, furling_parameters: FurlingParameters, user_parameters: UserParameters) bytes

dxf_as_svg

get_dxf_as_svg(root_documents: List[Document], magnafpm_parameters: MagnafpmParameters, font_family: str = 'sans-serif', foreground: str = '#FFFFFF', background: str = '#000000') str
load_dxf_as_svg(magnafpm_parameters: MagnafpmParameters, furling_parameters: FurlingParameters, user_parameters: UserParameters, font_family: str = 'sans-serif', foreground: str = '#FFFFFF', background: str = '#000000') str

exec_turbine_function

exec_turbine_function(description: str, turbine_function: Callable[[WindTurbineShape], str] | Callable[[WindTurbineShape, Namespace], str], argument_parser_customizer: Callable[[ArgumentParser], None] | None = None) None

export_set_to_svg

export_set_to_svg(export_set: Set[object], get_part_count: Callable[[object], int], precision: int = 2, font_size: int = 72, font_family: str = 'sans-serif', padding: int = 16, row_gap: int = 64, column_gap: int = 32, text_margin_bottom: int = 48, stroke_width: float = 2.5, foreground: str = '#FFFFFF', background: str = '#000000') str

Transform the DXF export set to SVG.

Flat parts are grouped by material and thickness.

Some of the following code is adapted from importSVG.export: https://github.com/FreeCAD/FreeCAD/blob/0.19.4/src/Mod/Draft/importSVG.py#L1772-L1883

get_svg_style_options(rotor_disk_radius: float) dict

fastener_cells

get_fastener_cells() List[List[Cell]]

Get cells related to fasteners such as nuts and bolts.

Inputs
BracketThickness =Spreadsheet.BracketThickness
VaneThickness =Spreadsheet.VaneThickness
FlatMetalThickness =Spreadsheet.FlatMetalThickness
HolesDiameter =Spreadsheet.HolesDiameter
HubHolesDiameter =Spreadsheet.HubHolesDiameter
Static
HolesRadius =HolesDiameter / 2
HubHolesRadius =HubHolesDiameter / 2
HexNutThickness =1.64 * HolesRadius + 0.35
HubHexNutThickness =1.64 * HubHolesRadius + 0.35
WasherThickness 2.5
DistanceThreadsExtendFromNuts 5
HubHolesBoltLength 50
WoodScrewDiameter 5
ScrewHoleDiameter =WoodScrewDiameter - 1
Calculated
UnroundedTailVaneBracketBoltLength =BracketThickness + VaneThickness + FlatMetalThickness + DistanceThreadsExtendFromNuts + WasherThickness
TailVaneBracketBoltLength =UnroundedTailVaneBracketBoltLength + 5 - mod(UnroundedTailVaneBracketBoltLength; 5)
HolesWidthAcrossCorners Select C (MAX) based on HolesRadius. https://www.atlrod.com/metric-hex-bolt-dimensions/
HWACrange7 =HolesRadius <= 18 ? 63.51 : 75.05
HWACrange6 =HolesRadius <= 15 ? 53.12 : HWACrange7
HWACrange5 =HolesRadius <= 12 ? 41.57 : HWACrange6
HWACrange4 =HolesRadius <= 10 ? 34.64 : HWACrange5
HWACrange3 =HolesRadius <= 8 ? 27.71 : HWACrange4
HWACrange2 =HolesRadius <= 7 ? 24.25 : HWACrange3
HWACrange1 =HolesRadius <= 6 ? 20.78 : HWACrange2
HolesWidthAcrossCorners =HolesRadius <= 5 ? 18.48 : HWACrange1
HubHolesWidthAcrossCorners Select C (MAX) based on HubHolesRadius. https://www.atlrod.com/metric-hex-bolt-dimensions/
HHWACrange7 =HubHolesRadius <= 18 ? 63.51 : 75.05
HHWACrange6 =HubHolesRadius <= 15 ? 53.12 : HHWACrange7
HHWACrange5 =HubHolesRadius <= 12 ? 41.57 : HHWACrange6
HHWACrange4 =HubHolesRadius <= 10 ? 34.64 : HHWACrange5
HHWACrange3 =HubHolesRadius <= 8 ? 27.71 : HHWACrange4
HHWACrange2 =HubHolesRadius <= 7 ? 24.25 : HHWACrange3
HHWACrange1 =HubHolesRadius <= 6 ? 20.78 : HHWACrange2
HubHolesWidthAcrossCorners =HubHolesRadius <= 5 ? 18.48 : HHWACrange1

find_descendent_by_label

find_descendent_by_label(obj, label: str)

find_object_by_label

find_object_by_label(document: Document, label: str) object | None

Find an object in a document by the given label.

Returns None if no object is found.

freecad_archive

get_freecad_archive(root_documents, spreadsheet_document) bytes
load_freecad_archive(magnafpm_parameters: MagnafpmParameters, furling_parameters: FurlingParameters, user_parameters: UserParameters) bytes

freecad_spreadsheet

Custom Sphinx directive for viewing FreeCAD spreadsheets defined in Python code as HTML tables.

To use, add the .. freecad-spreadsheet:: directive to the docstring of any zero-argument function producing a 2-dimensional list of Cell objects (i.e. List[List[Cell]]).

For example:

def get_cells() -> List[List[Cell]]:
    """Get example cells for a FreeCAD Spreadhseet.

    .. freecad-spreadsheet::
    """
    return [
        [
            Cell('Inputs', styles=[Style.UNDERLINE])
        ],
        [
            Cell('BracketThickness'),
            Cell('=Spreadsheet.BracketThickness',
                alias='BracketThickness')
        ]
    ]

The FreeCAD Spreadsheet directive will produce HTML tables with various class names to emulate how FreeCAD styles spreadsheets.

These class names include underline and `freecad-spreadsheet-alias.

It’s recommended to include a custom CSS stylesheet to target these class names:

/**
 * FreeCAD Spreadsheet directive styles.
 */
.underline {
    text-decoration: underline
}

.freecad-spreadsheet-alias {
    background-color: #feffaa !important;
}
.freecad-spreadsheet-alias > span {
    border-bottom: 1px dotted;
}

 /**
  * Make tables span 100% width of parent,
  * and cell content wrap instead of horizontal scrolling.
  * .wy-table-responsive class is specific to sphinx_rtd_theme.
  */
.wy-table-responsive > table.docutils {
    table-layout: fixed;
    width: 100%;
}
.wy-table-responsive > .docutils td {
    word-wrap: break-word;
    white-space: normal;
}

See Adding Custom CSS to Sphinx Documentation for details on how to do this.

class FreeCADSpreadsheet(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)

Bases: SphinxDirective

has_content = False

May the directive have content?

optional_arguments = 0

Number of optional arguments after the required arguments.

run()
setup(app: <module 'FreeCAD' from '/home/docs/checkouts/readthedocs.org/user_builds/openafpm-cad-core/conda/latest/lib/FreeCAD.so'>) None

Setup extension.

Parameters:

app – application object controlling high-level functionality, such as the setup of extensions, event dispatching, and logging.

See Also: https://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx.application.Sphinx

furl_transform

get_furl_transform(wind_turbine_document: Document, spreadsheet_document: Document) FurlTransform
load_furl_transform(magnafpm_parameters: MagnafpmParameters, furling_parameters: FurlingParameters, user_parameters: UserParameters) FurlTransform

generate_width_across_corners_cells

generate_width_across_corners_cells(parameter_name: str, prefix: str, radius: str) List[List[Cell]]

get_2d_projection

get_2d_projection(obj: object) object

get_default_parameters

Module for retrieving values for various wind turbine preset designs.

get_default_parameters(preset: WindTurbineShape | str) dict

Get default parameters for “T Shape”, “H Shape”, “Star Shape”, or another preset turbine.

get_presets() List[str]

get_docstring_by_key

get_docstring_by_key(typed_dict: TypedDict) OrderedDict

get_documents_path

get_documents_path() Path

get_dxf_export_set

get_dxf_export_set(root_documents: List[Document]) Set[object]

get_parameters_schema

Module to generate JSON schema document describing parameters for validation purposes.

See JSON Schema: https://json-schema.org/understanding-json-schema/

get_description(group_name: str, parameter_name: str) str
get_docstring(group_name: str, parameter_name: str) str
get_flat_metal_thickness_minimum(wind_turbine_shape: WindTurbineShape) float
get_holes_diameter_minimum(wind_turbine_shape: WindTurbineShape) float
get_hub_holes_diameter_minimum(wind_turbine_shape: WindTurbineShape) float
get_hub_pitch_circle_diameter_minimum(wind_turbine_shape: WindTurbineShape) float
get_metal_length_l_maximum(wind_turbine_shape: WindTurbineShape) float
get_metal_length_l_minimum(wind_turbine_shape: WindTurbineShape) float
get_metal_thickness_l_maximum(wind_turbine_shape: WindTurbineShape) float
get_metal_thickness_l_minimum(wind_turbine_shape: WindTurbineShape) float
get_multiple_of(json_schema_type: str, integer_mulitple_of: int = 1) float
get_numeric_type_and_multiple_of(group_name: str, parameter_name: str, integer_mulitple_of: int = 1) dict
get_parameter_group_by_name() dict
get_parameters_schema(wind_turbine_shape: WindTurbineShape) dict
get_pipe_sizes() List[float]
get_pipe_thickness_maximum(wind_turbine_shape: WindTurbineShape) float
get_pipe_thickness_minimum(wind_turbine_shape: WindTurbineShape) float
get_type(group_name: str, parameter_name: str) str
get_yaw_pipe_diameter_enum(wind_turbine_shape: WindTurbineShape) List[float]

Get default diameter and one size up.

For T Shape, also allow one size down from the default.

map_type_to_json_schema_type(type_hint) str

https://json-schema.org/understanding-json-schema/reference/type.html

multiples_of(integer: int, start: int, end: int) List[int]

gui_document

get_gui_document_by_path(document_paths: List[Path]) Dict[str, bytes]
rekey_gui_document_by_path(gui_document_by_source: Dict[str, bytes], destination_by_source: Dict[str, str]) Dict[str, str]
write_gui_documents(gui_document_by_path: Dict[str, bytes]) None

high_end_stop_cells

hub_cells

The following ASCII diagram is a side view of the Hub with labels used in aliases for spreadsheet cells.

The two vertical lines labeled “Frame” and “Rotor” denote where they are in relation to the Hub.

The terms “Width” and “Radius” are used in the spreadsheet aliases.

Width dimensions are on the horizontal axis, and Radius dimensions are on vertical axis.

Each part of the hub is made from 2-dimensional sketches, and then “padded” to form a 3D solid.

For lack of better names, this is where the names “frame-side pad”, “middle pad” and “rotor-side pad” come from.

        ^
        |                                          MiddlePad
        |
        |                  +                       +-------+    +
        |                  |                       |       |    |
        |                  |                       |       |    |
        |                  |                       |       |    |
        |                  |                       |       |    |
        |                  |      +----------------+       |    |
        |                  |      |                |       |    |
        |                  |      |                |       +-------+
        |               +---------+                |       |    |  |
Radius  | StubAxleShaft |  |      |  FrameSidePad  |       |    |  | RotorSidePad
        |               |  |      |                |       |    |  |
        |               +---------+                |       |    |  |
        |                  |      |                |       +-------+
        |                  |      |                |       |    |
        |                  |      +----------------+       |    |
        |                  |                       |       |    |
        |                  |                       |       |    |
        |                  |                       |       |    |
        |                  |                       |       |    |
        |                  +                       +-------+    +
        |
        |                Frame                                Rotor
        |
        +------------------------------------------------------------------------->
                                           Width

load

class Assembly(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

BLADE_TEMPLATE = 'Blade Template'
COIL_WINDER = 'Coil Winder'
MAGNET_JIG = 'Magnet Jig'
ROTOR_MOLD = 'Rotor Mold'
STATOR_MOLD = 'Stator Mold'
WIND_TURBINE = 'Wind Turbine'
load_alernator(recompute_all=False) Document
load_all(magnafpm_parameters: MagnafpmParameters, furling_parameters: FurlingParameters, user_parameters: UserParameters, progress_callback=None, progress_range=(0, 100), cancel_event=None) Tuple[List[Document], Document]

Load all wind turbine CAD documents with optional progress reporting.

Loads the complete set of OpenAFPM wind turbine documents including: - Wind Turbine assembly - Stator Mold, Rotor Mold assemblies - Magnet Jig, Coil Winder assemblies - Blade Template

Args:

magnafpm_parameters: Generator/alternator parameters from MagnAFPM tool furling_parameters: Tail and furling mechanism parameters user_parameters: User-defined construction parameters progress_callback: Optional callback function(stage_name: str, percent: int) progress_range: Tuple of (start_percent, end_percent) for progress scaling cancel_event: Optional threading.Event to signal cancellation

Returns:

Tuple of (root_documents, spreadsheet_document) - root_documents: List of 6 loaded FreeCAD Document objects (root of document hierarchy) - spreadsheet_document: Master parameter spreadsheet Document

Example:
>>> def progress_handler(stage, percent):
...     print(f"[{percent}%] {stage}")
>>> 
>>> params = get_default_parameters("T Shape")
>>> root_docs, sheet = load_all(
...     params['magnafpm'], 
...     params['furling'], 
...     params['user'],
...     progress_callback=progress_handler,
...     progress_range=(0, 80)  # Reserve 80-100% for other operations
... )
Note:

Loading typically takes 50+ seconds due to document recomputation. Progress callback provides detailed feedback during this process.

load_assembly(assembly: Assembly, magnafpm_parameters: MagnafpmParameters, furling_parameters: FurlingParameters, user_parameters: UserParameters)
load_turbine(magnafpm_parameters: MagnafpmParameters, furling_parameters: FurlingParameters, user_parameters: UserParameters) Tuple[Document, Document]

load_root_document

load_document(get_root_document_path: Callable[[Path], Path], recompute: bool = False, recompute_all: bool = False) Document
load_root_document(get_root_document_path: Callable[[Path], Path], magnafpm_parameters: MagnafpmParameters, furling_parameters: FurlingParameters, user_parameters: UserParameters, progress_callback=None) Tuple[List[Document], Document]
load_root_documents(get_root_document_paths: List[Callable[[Path], Path]], magnafpm_parameters: MagnafpmParameters, furling_parameters: FurlingParameters, user_parameters: UserParameters, progress_callback=None, progress_range=(0, 100), cancel_event=None) Tuple[List[Document], Document]

load_spreadsheet_document

Module for loading spreadsheet document.

load_spreadsheet_document(magnafpm_parameters: MagnafpmParameters, furling_parameters: FurlingParameters, user_parameters: UserParameters) Document

loadmat

Adapted from: https://github.com/nephics/mat4py/blob/v0.6.0/mat4py/loadmat.py

Changes: * Commented out lines for handling mxCHAR_CLASS:

# elif mc == ‘mxCHAR_CLASS’: # return read_char_array(fd, endian, header)

loadmat(filename, meta=False)

Load data from MAT-file:

data = loadmat(filename, meta=False)

The filename argument is either a string with the filename, or a file like object.

The returned parameter data is a dict with the variables found in the MAT file.

Call loadmat with parameter meta=True to include meta data, such as file header information and list of globals.

A ParseError exception is raised if the MAT-file is corrupt or contains a data type that cannot be parsed.

low_end_stop_cells

make_archive

Module for “zipping up” the contents of a directory recursively into an archive.

make_archive(source: str) bytes

Recursively “zip up” the contents of source into an archive.

Adapted from:

http://www.seanbehan.com/how-to-use-python-shutil-make_archive-to-zip-up-a-directory-recursively-including-the-root-folder/

make_archive('/path/to/folder')
Parameters:

source – Directory from where to create the archive from.

Returns:

Binary content of ZIP archive file.

make_get_part_count

make_get_part_count(root_documents: List[Document], magnafpm_parameters: MagnafpmParameters) Callable[[object], int]
traverse(objects: List[object], visit: Callable[[object, list], Any]) None

map_magnafpm_parameters

map_magnafpm_parameters(magnafpm: dict) MagnafpmParameters

parameter_groups

Module containing parameter group definitions.

The wind turbine has many parameters which are organized into 3 broad categories.

class FurlingParameters

Bases: TypedDict

Furling Parameters.

These mainly relate to the tail, hinge, and “furling”.

Furling” is defined as:

an automatic self-protective operation that reduces exposure to violent winds by facing the blades away from the wind.

That furling motion is produced by a lateral offset of the blade rotor from the center of yaw.

The tail and its hinge control the yawing motion, so that it limits power production.

— page 60, Glossary section of “A Wind Turbine Recipe Book (2014)”.

BoomLength: int

Length of tail boom pipe.

See “Tail boom” section on page 31 of “A Wind Turbine Recipe Book (2014)”.

BoomPipeDiameter: float

Outer diameter of tail boom pipe including thickness.

See “Tail boom” section on page 31 of “A Wind Turbine Recipe Book (2014)”.

BoomPipeThickness: int

Thickness of tail boom pipe.

BracketLength: int

Length of vane brackets.

BracketThickness: int

Thickness of vane brackets.

BracketWidth: int

Width of vane brackets.

HorizontalPlaneAngle: int

Angle of the alternator frame from a horizontal plane when welding the tail hinge (in degrees).

See “The inclined hinge” section on pages 30 - 31 of “A Wind Turbine Recipe Book (2014)”.

Offset: int

Distance from center of alternator to yaw-bearing for furling action.

For T shape, Offset is used in calculation of X.

Where X is described on the right-hand side of page 26 of “A Wind Turbine Recipe Book (2014)”.

For H Shape, see “Mounting the alternator to the yaw bearing” section on page 27 of “A Wind Turbine Recipe Book (2014)”.

Notably, the diagram on the left-hand side of page 29.

Further discussion can be found in “The tail” section on page 30.

VaneLength: int

Length of vane.

VaneThickness: int

Thickness of vane.

VaneWidth: int

Width of vane.

VerticalPlaneAngle: int

Angle between outer pipe of yaw-bearing and inner pipe of tail hinge (in degrees).

See “The inclined hinge” section on pages 30 - 31 of “A Wind Turbine Recipe Book (2014)”.

class MagnafpmParameters

Bases: TypedDict

Parameters from the MagnAFPM tool.

These mainly relate to:

  • the alternator (a.k.a. generator)

  • how electricity is generated

  • and (magn)etism.

CoilHoleWidthAtInnerRadius: float

Width of coil hole at the inner radius of the effective length of the generator.

Also corresponds to the width of the coil hole at the outer radius of the rotor disk(s) minus the magnet length and a small offset to align the corners of the magnets to the rotor disk.

In conjuction with CoilHoleWidthAtOuterRadius, controls the type of coil:

  • rectangular

  • keyhole

  • or triangular

See Winding Type section at:

https://openafpm.net/design-tips

“Coil hole at R in” in Winding Type diagram.

CoilHoleWidthAtOuterRadius: float

Width of coil hole at the outer radius of the effective length of the generator.

Also corresponds to the width of the coil hole at the outer radius of the rotor disk(s).

In conjuction with CoilHoleWidthAtInnerRadius, controls the type of coil:

  • rectangular

  • keyhole

  • or triangular

See Winding Type section at:

https://openafpm.net/design-tips

“Coil hole at R out” in Winding Type diagram.

CoilLegWidth: float

Distance from the inner-most edge, surrounding the hole, to the outer-most edge of the coil.

See “Wire sizes and power losses” section on page 55 of “A Wind Turbine Recipe Book (2014)”.

CoilType: int

Type of coil: (1) rectangular, (2) keyhole, or (3) triangular.

See Winding Type section at:

https://openafpm.net/design-tips

InnerDistanceBetweenMagnets: float

The distance between two consecutive magnets at the inner radius.

For determining which kind of Magnet Jig to use: inner or outer.

MagnetLength: int

Length of magnet.

Not always the longest dimension of the magnet, but the radial dimension of the magnet (in terms of the rotor circle).

MagnetMaterial: str

Material and grade of the magnet.

Neodymium magnets are more powerful than Ferrite magnets.

However, Ferrite magnets are immune to corrosion and cheaper than Neodymium magnets.

See “Number of Poles” and “Winding Type” sections at:

https://openafpm.net/design-tips

MagnetThickness: int

Thickness of magnet.

See “Magnet Thickness” section at:

https://openafpm.net/design-tips

MagnetWidth: int

Width of magnet.

Not always shorter than MagnetLength, but the tangential dimension of the magnet (in terms of the rotor circle).

MechanicalClearance: float

Air gap distance between stator and one rotor disk.

NumberMagnet: int

Number of magnets per rotor disk.

NumberOfCoilsPerPhase: int

Number of coils in a phase.

Phase is defined as:

The timing of the cyclical aternation of voltage in a circuit. Different phases will peak at different times.

A group of coils with the same timing is known as a ‘phase’.

— page 61, Glossary section of “A Wind Turbine Recipe Book (2014)”.

See “Three-phase stators” section on page 35 and “Connecting the coils” section on page 38 of “A Wind Turbine Recipe Book (2014)”.

NumberOfWiresInHand: int

Number of wires in hand when winding a coil.

RotorDiameter: float

The width of the circle swept by the rotating blades.

Also referred to as the “turbine diameter”.

RotorDiskInnerRadius: float

Inner radius of the effective length of the generator.

RotorDiskRadius: float

Outer radius of rotor disk(s) for the generator.

RotorDiskThickness: int

Thickness of rotor disk.

See “Rotor Disk Thickness” section at:

https://openafpm.net/design-tips

RotorTopology: str

One of ‘Double’, ‘Single and metal disk’, and ‘Single’.

Two magnet rotors sandwiching the stator is most common.

The single rotor is featured in the 1.2m diameter turbine, and the single rotor with magnet disk is featured in the 1.8m diameter design in “A Wind Turbine Recipe Book (2014)”.

The single rotor topologies for smaller designs is due to using the same 46x30x10mm magnets used in larger designs.

A double rotor topology can be used in smaller designs by using smaller magnets.

See “Rotor mounting options” section on the right-hand side of page 46 in “A Wind Turbine Recipe Book (2014)”.

StatorThickness: int

Thickness of stator.

TurnsPerCoil: int

Number of turns per coil.

WireDiameter: float

Diameter of copper wire in coils.

WireWeight: float

Total copper mass for coils in kilograms including two extra coils for contingency.

class UserParameters

Bases: TypedDict

User parameters have default values, and may be overridden by individual users to satisfy unique needs.

BladeWidth: float

The width of the blade near the root.

The width depends on available wood.

If no value is specified, then it defaults to the minimum.

See “Selecting the wood” section on the right-hand side of page 15 and “The blank shapes” section on page 16 of “A Wind Turbine Recipe Book (2014)”.

FlatMetalThickness: int

Thickness of various flat metal pieces which can be cut by a 2D CNC laser cutter.

HolesDiameter: int

Diameter of various holes like stator mounting holes and vane bracket holes.

HubHolesDiameter: int

Diameter of hub holes.

HubPitchCircleDiameter: int

Diameter of circle which passes through center of hub holes.

MetalLengthL: int

Width of angle bars used in frame.

MetalThicknessL: int

Thickness of angle bars used in frame.

PipeThickness: int

Thickness of yaw bearing and tail hinge pipes.

RotorDiskCentralHoleDiameter: int

Diameter of central hole for rotor disk.

RotorResinMargin: int

Margin of resin to surround and protect the outer edge of the magnets.

See left-hand side of page 42 of “A Wind Turbine Recipe Book (2014)”.

WindTurbineShape: str

The shape of the wind turbine: one of ‘Calculated’, ‘T’, ‘H’, or ‘Star’.

The shape of the turbine controls the topology of the model.

‘Calculated’ means the shape is determined from rotor disk radius.

Its name is based on the shape of the frame.

YawPipeDiameter: float

Outer diameter of yaw bearing pipe including thickness.

parameter_hash

Module to hash and unhash parameters into a unique string.

The algorithm is as follows: 1. Order parameters based on parameter group definitions. 2. Disregard keys, and only consider values. 3. Convert enum values into integer values. 4. Base 62 encode numeric values while preserving decimal point ‘.’ for float values. 5. Concatenate all values together with a ‘-‘.

hash_parameters(magnafpm_parameters: MagnafpmParameters, furling_parameters: FurlingParameters, user_parameters: UserParameters) str
unhash_parameters(parameter_hash: str) dict

parameters_by_key_to_cells

parameters_by_key_to_cells(parameters_by_key: Dict[str, Dict[str, Any]]) List[List[Cell]]

pipe_size

class PipeSize(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: float, Enum

Enumeration of pipe sizes.

Outer diameter (OD) in mm including thickness.

OD_101_6 = 101.6
OD_114_3 = 114.3
OD_127_0 = 127.0
OD_141_3 = 141.3
OD_33_4 = 33.4
OD_42_2 = 42.2
OD_48_3 = 48.3
OD_60_3 = 60.3
OD_73_0 = 73.0
OD_88_9 = 88.9

plywood_thickness

class PlywoodThickness(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: int, Enum

Enumeration of birch plywood thicknesses in millimeters.

MM_12 = 12
MM_15 = 15
MM_18 = 18
MM_21 = 21
MM_24 = 24
MM_27 = 27
MM_30 = 30
MM_6 = 6
MM_9 = 9

tail_cells

upsert_spreadsheet_document

upsert_spreadsheet_document(path: Path, magnafpm_parameters: MagnafpmParameters, furling_parameters: FurlingParameters, user_parameters: UserParameters, cancel_event=None) Document

wind_turbine_cells

wind_turbine_shape

Module defining wind turbine shapes.

class WindTurbineShape(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Enumeration of wind turbine shapes.

H = 'H Shape'

Medium-sized wind turbine with a frame shaped like an “H”.

STAR = 'Star Shape'

Largest wind turbine with a frame shaped like a six-pointed star.

T = 'T Shape'

Smallest wind turbine with a frame shaped like a “T”.

static from_string(string: str)
to_string()
map_rotor_disk_radius_to_wind_turbine_shape(rotor_disk_radius: float) WindTurbineShape

yaw_bearing_cells

The following ASCII diagram (not drawn to scale) is a Bottom View depiction of YawBearing_Extended_Assembly.

It explains below AV, VO, and SideX calcuations.

A, V, and O are points, denoted by “•”.

AV and VO are line segments from the corresponding points.

Additionally, it includes L and MM dimensions mentioned in below spreadsheet cells.

                                                          SideX
                                                       <--------->
                                                                   A
                    ^  +-------------------------------+---------•-------------+   ^
                    |  |                               |         |             |   |
FlatMetalThickness  |  |           Side                |         | V           |   |
                    |  |                               |   , + ~ • ~ + ,       |   |
                    v  +-------------------------------+ '       |       ' ,   |   |
                                /                    ,           |           , |   |
                               /                    ,            |            ,|   |
                              /                    ,             | O           ,   |
                        Top  /                     ,             •             ,   |  MM
                            /                      ,                           ,   |
                           /                        ,                         ,|   |
                          /                          ,                       , |   |
                         /                   Yaw Pipe  ,                  , '  |   |
                        /                                ' + , _ _ _ ,  '      |   |
                       /                                                       |   |
                      / 45°                                                    |   |
                     +---------------------------------------------------------+   v
                     <--------------------------------------------------------->
                                                   L

The following ASCII diagram (not drawn to scale) is a Bottom View depiction of the Top piece.

See YawBearing_Extended_Top document.

                            ↗         +-----------------------------------------+   ^
                           /         /|                                         |   |
                          /         / |                                         |   |
                         /         /  |                                         |   |
                        /         /   |                                         |   |
                       /         /    |                                         |   |
HypotenuseTopTriangle /         /     |                                         |   |
                     /         /      |                                         |   |
                    /    Top  /       |                                         |   |  MM
                   /         /        | AdjacentSide                            |   |
                  /         /         |                                         |   |
                 /         /          |                                         |   |
                /         /           |                                         |   |
               /         /            |                                         |   |
              /         /            _|                                         |   |
             ↙         / 45°        | |                                         |   |
                      +---------------+-----------------------------------------+   v
                      <--------------------------------------------------------->
                                                    L

The following ASCII diagram (not drawn to scale) is a Top View depiction, of the Top piece meeting the Channel Sections of Alternator Frame.

                                        +                                ^
                 Frame Channel Sections |\                              |
                                        | \                             |
             ^   +----------------------+  \                            |
             |   +--------------------+ |   \                           |
             |                        | |45° \                          |
             |                        | |     \                         |
             |                        | |      \                        |
MetalLengthL |                        | |       \                       |
             |                        | |        \                      |
             |                        | |         \                     |
             |                        | |          \                    |
             |                        | |           \                   |
             |                        | |            \                  |
Alternator   V                Center  +-+             \                 |  HypotenuseTopTriangle
                                      | |              \                |
                                      | |               \               |
                                      | |                \              |
                                      | |                 \             |
                                      | |                  \            |
                                      | |                   \           |
                                      | |                    \          |
                                      | |                     \         |
                                      | |                      \        |
                +---------------------+ |                       \       |
                +-----------------------+                        \      |
             ^                        \ |          Top            \     |
             |                         \|\                         \    |
             V                          + \                         \   V
HalfSideChannelSectionOverhangDistance   \ \                         \
                                          \ \                         \
                                           \ \                         \
                                           Side
                                      (underneath Top)