BCH/BATCH files are created by FEMAG during a calculation. They hold most of the results. Their values are grouped into different sections such as: Flux, Torque, Machine, dqPar etc.
The actual number of sections as well as their content varyies with the type of calculation. Currently the following types are supported by femagtools:
In [1]:
import femagtools.bch
bch = femagtools.bch.read('TEST_002.BCH')
Show the calculation type that created this file
In [2]:
bch.type
Out[2]:
Print the number of torque sections:
In [3]:
len(bch.torque)
Out[3]:
The PM/Rel machine simulation is executed with a given current and beta angle. If the beta angle were 0 then there would be only 2 torque sections.
Lets look at the content of the section machine:
In [4]:
bch.machine
Out[4]:
In the above output we find the 2 beta angles 0 and -25°. The current i1 is 500 A (RMS) and the resulting torque at beta=-25 is 405.7 Nm.
The flux sections contains the fluxes and voltages for all windings and beta angles:
In [5]:
bch.flux.keys()
Out[5]:
In [6]:
len(bch.flux['1'])
Out[6]:
Show all keys of winding '1' flux:
In [7]:
bch.flux['1'][0].keys()
Out[7]:
Now lets look at some plots
In [8]:
import matplotlib.pyplot as plt
import femagtools.plot
fig = plt.figure(figsize=(10,4))
fig.add_subplot(1,2,1)
femagtools.plot.torque(bch.torque[-1]['angle'], bch.torque[-1]['torque'])
fig.add_subplot(1,2,2)
femagtools.plot.voltage('No load voltage', bch.flux['1'][0]['displ'],
bch.flux['1'][0]['voltage_dpsi'])
plt.show()
A phasor plot
In [9]:
femagtools.plot.phasor(bch)
plt.show()
Or if we want to have a complete report:
In [10]:
femagtools.plot.pmrelsim(bch, bch.filename)
plt.show()
Read another BCH file and print the torque and beta values:
In [11]:
bch = femagtools.bch.read('LDQ-0-90.BCH')
bch.ldq['torque']
Out[11]:
In [12]:
bch.ldq['beta']
Out[12]:
Create a surface plot of the torque:
In [13]:
import femagtools.plot
femagtools.plot.i1beta_torque(bch.ldq['i1'], bch.ldq['beta'], bch.ldq['torque'])
plt.show()