Skip to main content

motorcalc - A package to calculate and plot DC - motors

Gerrit Kocherscheidt KOCO MOTION / KOCO automotive, March 2023

Intention

With this package a simple calculation of DC motor parameters based on the input voltage, no-load current, terminal resistance and torque constant is performed. Motor performance curves can be plotted.

Installation

Installation using pip

pip install motorcalc

Installation of sources from Github

git clone https://github.com/KOCOMOTION/motorcalc.git

Basic usage

To create a DC-motor object use the following code

import motorcalc.dcmotor as dcm

m = dcm.CDCmotor(U_N=12.0, I_0=0.02, k_M=0.014, R=25.0)

Here the parameter are

  • U_N: Driving voltage [V]
  • I_0: No-load current [A]
  • k_M: Torque constant [Nm/A]
  • R: Terminal resistance [Ohm]

Note that if not stated explicitely, parameter in this package are considered to be in SI-units without magnitude scaling, i.e., I use ampere instead of milli-ampere etc.

Get information about the object

To get information about the object the print function can be used

print(m)

INPUT PARAMETER:
------------------------------------------------------------------------------------------------------
parameter	voltage		term. resist.	no-load cur.	no-load speed	torque const.
------------------------------------------------------------------------------------------------------
unit		Volt		Ohm		    Ampere		RPM		    Nm/A
value		12.0		25.00		0.020		7844		0.014

PERFORMANCE DATA:
------------------------------------------------------------------------------------------------------
parameter	unit	no-load		@max eff.	@max power	stall		@working point
------------------------------------------------------------------------------------------------------
speed		RPM	7844		6514		3922		0		    7844
current		A	0.020		0.098		0.250		0.480		0.020
torque		Nm	0.000		0.001		0.003		0.006		0.000
power		W	0.00		0.74		1.32		0.00		0.00
eff.		%	0.0		    63.3		44.1		0.0		    0.0

In addition parameter can be plotted with the list_spec_table()-function of the CDCMotorExport-Module.

import motorcalc.dcmotorexport as dcmexp

dcmexp.CDCMotorExport(m).list_spec_table()

+----+-----------------------+---------+----------+
| No | Parameter             | Unit    | Value    |
+----+-----------------------+---------+----------+
| 1  | Voltage               | V       | 12       |
+----+-----------------------+---------+----------+
| 2  | Terminal resistance   | Ω       | 25       |
+----+-----------------------+---------+----------+
| 3  | Terminal inductance   | mH      | 0        |
+----+-----------------------+---------+----------+
| 4  | No-load speed         | rpm     | 7844     |
+----+-----------------------+---------+----------+
| 5  | No-load current       | A       | 0.020    |
+----+-----------------------+---------+----------+
| 6  | Nominal torque        | mNm     | 0        |
+----+-----------------------+---------+----------+
| 7  | Nominal speed         | rpm     | 7844     |
+----+-----------------------+---------+----------+
| 8  | Nominal current       | A       | 0.020    |
+----+-----------------------+---------+----------+
| 9  | Max. output power     | W       | 1.323    |
+----+-----------------------+---------+----------+
| 10 | Max. efficiency       | %       | 63.342   |
+----+-----------------------+---------+----------+
| 11 | Back-EMF constant     | mV/rpm  | 133.690  |
+----+-----------------------+---------+----------+
| 12 | Torque constant       | mNm/A   | 14       |
+----+-----------------------+---------+----------+
| 13 | Speed/torque gradient | rpm/mNm | 1218.023 |
+----+-----------------------+---------+----------+
| 14 | Rotor inertia         | gcm^2   | 0        |
+----+-----------------------+---------+----------+

Additional parameter

Missing or additional parameter can be added either on construction or by directly accessing the member variables of the CDCMotor-class.

m = dcm.CDCMotor(U_N=12.0, I_0=0.002, k_M=0.014, R=25.0, H=1.0E-3 Theta=1.0E-8, nPoints=100, n_WP=6000.0, M_WP=0.0015, motor_name:str='test-motor' application:str='test-application')
Parameters
----------
U_N : float
    nominal Voltage in V
I_0 : float
    noload current in A
k_M : float
    torque constant in Nm/A
R : float
    terminal resistance in Ohm
H : float
    terminal inductance in mH (for information only)
Theta : float
    rotor moment of inertia in gcm^2 (for information only)
nPoints : int
    number of points to be plotted in graph
n_WP : float
    required speed at working point
M_WP : float
    required torque at working point
motor_name : str
    name of the motor used for graph plotting
application : str
    short description of application for graph plotting

Plotting

To plot performance curves the CDCMotorPlot-class from the dcmotorplot-module is needed.

import motorcalc.dcmotorplot as dcmplt
dcmplt.CDCMotorPlot(m).plot_curves()

With this command the following Matplotlib-graph is generated:

Test graph

To-Do: Description of the motorcalc.physics module

This module shall be used to store material parameter und formulas for mechanical and electrical calculations needed for a motor project calculation

Release files for motorcalc 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for motorcalc 0.2.1
File Size Uploaded
motorcalc-0.2.1.tar.gz 11.1 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for motorcalc 0.2.1
File Interpreter ABI Platform
motorcalc-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 11.2 MB

Release files / motorcalc-0.2.1.tar.gz

Download URL motorcalc-0.2.1.tar.gz
Size 11.1 MB
Tags Source
SHA-256 checksum
How to use checksums
a1a3fd4eed41148e92f7fa0872eacbe09feb983709fdf1b65eb9a23f4972f608
BLAKE2b-256 checksum
How to use checksums
39bcb02401c394011bdd5edadfd0ed027f432f848b1e0f07fc1d54c3a010c738
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.2

Release files / motorcalc-0.2.1-py3-none-any.whl

Download URL motorcalc-0.2.1-py3-none-any.whl
Size 15.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fc9706819409e7c1139389f79900797f0dceaf9bfd0eaf409ee1de650c0a83a6
BLAKE2b-256 checksum
How to use checksums
2d2c2e1576b7ba74270a9d74482ca536ff1c2ab4a6279cf99b4928c7fe085525
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.2

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page