# Copyright (c) 2026 JSOL CORPORATION # # This script is released under the MIT License. # See the full license text at: # https://www.jmag-international.com/scriptlibrary/jmag_script_library_mit/ def getCircuitInStudy(study): """Retrieve the Circuit object from the study.if it does not exist, create a new circuit.""" if study.HasCircuit(): circuit = study.GetCircuit() else: circuit = study.CreateCircuit() return circuit def createPWM120degConductionSystem3phase(circuit): """Place the PWM 120-degree firing (3-phase) device in the circuit and set the values for the items.""" componentName = u"PWM 120deg Conduction System (3phase)" circuit.CreateSubCircuit(u"PWM_120deg_Conduction_System_3-phase", componentName, -28, 9) circuit.GetComponent(componentName).SetValue(u"Npoles", 4) circuit.GetComponent(componentName).SetValue(u"fc", 1000) app = designer.GetApplication() study = app.GetCurrentStudy() createPWM120degConductionSystem3phase(getCircuitInStudy(study))