def test_create(self): testPath = os.path.join(os.path.split(__file__)[0], 'data') if len(testPath) == 0: testPath = os.path.join(os.path.abspath('.'), 'data') bch = femagtools.read_bchfile(os.path.join(testPath, 'ldq.BATCH')) pm = femagtools.machine.create(bch, r1=0, ls=0) iqd = pm.iqd_torque(211.35) beta, i1 = femagtools.machine.betai1(*iqd) self.assertAlmostEqual(beta * 180 / math.pi, -30, 0) self.assertAlmostEqual(i1, 100, 0)
import femagtools import femagtools.plot import matplotlib.pylab as pl r = femagtools.read_bchfile('TEST_002.BCH') femagtools.plot.phasor(r) pl.show() #w1 = r.dqPar['npoles']*r.dqPar['speed']*math.pi #femagtools.plot.phasor(r.dqPar['up'], r.dqPar['i1'][-1], # r.dqPar['beta'][-1], 0, # w1*r.dqPar['ld'][-1], # w1*r.dqPar['lq'][-1])
#!/usr/bin/env python # -*- coding: utf-8 -*- import femagtools import femagtools.machine import numpy as np import matplotlib.pylab as pl bch = femagtools.read_bchfile('../bch-erg/TEST_001.BCH') beta = bch.ldq['beta'] i1 = bch.ldq['i1'] torque = bch.ldq['torque'] r10 = 0.1 p = 4 pm = femagtools.machine.create(bch, r1=r10, ls=1e-3) u1 = 340 tq = 200 iqx, idx = pm.iqd_torque(tq) w1 = pm.w1_u(u1, iqx, idx) i1 = femagtools.machine.betai1(iqx, idx)[1] fig, ax = pl.subplots() id = np.linspace(1.5 * idx, femagtools.machine.iqd(np.sin(beta[-1] / 180 * np.pi), i1)[1]) iq = [pm.iq_u(w1, u1, ix) for ix in id] ax.plot(id, iq, label='U1={} V'.format(u1))
# -*- coding: utf-8 -*- import femagtools import matplotlib.pylab as pl import femagtools.plot import femagtools.machine bch = femagtools.read_bchfile('TEST_001.BCH') beta = bch.ldq['beta'] i1 = bch.ldq['i1'] torque = bch.ldq['torque'] pm = femagtools.machine.create(bch, r1=0, ls=0) femagtools.plot.mtpa(pm, i1[-1]) pl.show()