Circuit calculation is common in magnetic field transient analysis or integration analysis. JMAG provides not only basic components but also pre-installed macro components that aggregate functions. In addition to electrical circuit components, there are also control system components. This script places the pre-installed PWM 120deg conduction system (3-phase) component and sets its parameters.
Preconditions
- One or more magnetic field transient analysis or integration analysis studies must be created.
This script runs for the active study in the project tree.
Script Function
- To set up a circuit, it must be created first. Check whether it has already been created, and if not, create it.
- Create and place the PWM 120deg conduction system (3-phase) macro component.
- The PWM 120deg conduction system (3-phase) component parameters are 4 poles and 1,000 Hz carrier frequency.
# 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))


