Under what conditions permanent electromagnet is obtained if a current-carrying solenoid is used? Support your answer with the help of a labeled circuit diagram.