Metadata-Version: 2.4
Name: aesim.simba
Version: 2026.8.28a1
Summary: Power Electronics and Motor Drive Simulation
Home-page: https://simba.io
Author: AESIM.tech
Author-email: contact@aesim.tech
License: By using aesim.simba, you agree to the license agreement available here: https://www.simba.io/static/EULA.pdf
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: pythonnet>=3.1.0rc0
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# SIMBA Python API

The Simba Python Module (aesim.simba) is a Python package that contains hundreds of functions providing direct access to SIMBA such as creating a circuit, modifying parameters, running a simulation, and retrieving results. aesim.simba is independent and does not require to have SIMBA installed to be used.

## Installation

The easiest way to install the Python API is using pip:

`pip install aesim.simba`

## Requirements

The current version of _aesim.simba_ is compatible with Windows, macOS and Linux (64-bit). 

## Activation
The deployment key available on your [account profile page](https://www.simba.io/profile_account/) must be used to activate _aesim.simba_. Two methods are available:

### Using Environment Variable

The easiest way to activate pysimba is to set the environment variable `SIMBA_DEPLOYMENT_KEY` value to your deployment key. To add a new environment variable in Windows: 

* Open the Start Search, type in “env”, and choose “Edit the system environment variables”:
* Click the “Environment Variables…” button.
* Set the environment variables as needed. The New button adds an additional variable.

### Code-based Activation

The _License_ API can be also used to activate _aesim.simba_.

``` python
from aesim.simba import License
License.Activate('*** YOUR DEPLOYMENT KEY ***')
```

## API Documentation
The API documentation is available [here](https://www.simba.io/doc/python_api/api_index/). 

The installed package also provides API docstrings and type annotations. In an interactive
Python session, use `help(aesim.simba.DFTCalculatorJob)` or your editor's hover help to
discover constructor overloads, properties, and supported analysis jobs.

## Performance
Running a simulation using the Python API is significantly faster than using the SIMBA User Interface because there is no overhead.

## Quick Example
The following example opens the Flyback Converter Example available in SIMBA, runs it, and plots the output voltage.

``` python
#%% Load modules
from aesim.simba import DesignExamples
import matplotlib.pyplot as plt

#%% Load project
flybackConverter = DesignExamples.DCDC_Flyback()

#%% Get the job object and solve the system
job = flybackConverter.TransientAnalysis.NewJob()
status = job.Run()

#%% Get results
t = job.TimePoints
Vout = job.GetSignalByName('R2 - Instantaneous Voltage').DataPoints

#%% Plot Curve
fig, ax = plt.subplots()
ax.set_title(flybackConverter.Name)
ax.set_ylabel('Vout (V)')
ax.set_xlabel('time (s)')
ax.plot(t,Vout)

# %%
```

## DFT Example

The following example computes the magnitude spectrum of the flyback output over the final
ten switching periods. `DFTSettings(frequency, periods, harmonics)` includes the DC component
and the requested harmonics in the resulting signal.

``` python
from aesim.simba import DFTCalculatorJob, DFTSettings, DesignExamples, Status
import matplotlib.pyplot as plt

design = DesignExamples.DCDC_Flyback()
transient_job = design.TransientAnalysis.NewJob()
if transient_job.Run() != Status.OK:
    raise RuntimeError("Transient simulation failed")

vout = transient_job.GetSignalByName("R2 - Instantaneous Voltage")
dft_job = DFTCalculatorJob(DFTSettings(100e3, 10, 20), [vout])
if dft_job.Run() != Status.OK:
    raise RuntimeError("DFT calculation failed")

spectrum = dft_job.Signals[0]
fig, ax = plt.subplots()
ax.stem(spectrum.TimePoints, spectrum.DataPoints)
ax.set(xlabel="Frequency (Hz)", ylabel=f"Amplitude ({vout.Unit})")
ax.grid()
plt.show()
```

## More Examples
A collection of simple Python script examples using the SIMBA Python API is available on this [GitHub repository](https://github.com/aesim-tech/simba-python-examples)


Copyright (c) 2019-2020 AESIM.tech
