メインコンテンツまでスキップ

Project

The Project class is a central component of the eMotorSolution API, representing a project that contains various motor designs and configurations. It provides methods to manage and manipulate these designs effectively.

The Project class is inherited from the dataclasses module and includes several attributes and methods to facilitate the management of motor designs.

Methods

MethodDescription
save()Saves the project to the Project.path file.
show(legend, ...)Shows the machine geometry in matplotlib.
validate()Returns the validation status in dictionary format.

Attributes

AttributeDescription
pathstr The file path to the project JSON file. ⚠️ read-only
directorystr The directory where the project is saved. ⚠️ read-only
namestr The name of the project. ⚠️ read-only
parametersdict The user-defined parameters of the project.
machineMachineData The machine data of the project, including type and dimensions.
materialsMaterialsData Controlling the materials used in the project.
statorStatorData The stator data of the project, including slots, winding, and lamination.
rotorRotorData The rotor data of the project, including holes, magnets, and lamination.
meshMeshData The mesh data of the project, including mesh size and refinement.
analysesAnalysesData The analyses collection.

Example Usage

import eMotorSolution as ems

# load an existing project
project = ems.load_project("path/to/your/project.json")

# Access the project name
print(project.name)
>> "project"

# print the parameters
print(project.parameters)
>> {"param1": "value1", "param2": "value2"}

# Add a new parameter
project.parameters["new_param"] = "new_value"

# Save the project
project.save()