Factors affecting magnetism of electromagnets