3D Field Simulation of Complex Systems With Permanent Magnets and Excitation Coils