Skip to content

Compute License

A Compute license runs the SIMBA Python API on servers, cloud instances, containers and cluster workers without tying the license to each machine. Each Python process obtains a renewable allocation from the SIMBA license server, called a lease, for a chosen number of simultaneous simulations (slots).

This page covers key creation, Python activation and worker operation. For installations without internet access, use an offline license.

Before you start

  • Ask your SIMBA sales representative to enable Compute licensing for your organization and confirm its available slots and end date.
  • Use a license administrator account to create and manage keys on simba.io. If Compute licenses is absent from your profile, check your administrator access and Compute entitlement with your license administrator or SIMBA support.
  • Install a version of aesim.simba that supports Compute licensing (26.10.21 or later).
  • Ensure workers can reach the SIMBA license server over HTTPS throughout their operation. Know the public outgoing IP addresses of the workers or their network gateway.

1. Create a Compute key

  1. Sign in to simba.io and open Profile > Compute licenses (direct link).
  2. Check Simultaneous calculations in use / allowed, the license End date and Active keys / allowed.
  3. In Create a key, complete the following fields:

    Field What to enter
    Name A label identifying the environment, such as production or staging.
    Public IP addresses or networks of your workers At least one public IP address or CIDR network, one per line. Use the outgoing address seen by the server, including a gateway address when workers use NAT.
    End date A date within the period allowed by your Compute license.
    Slots of this key (optional limit) A cap shared by all workers using this key. Leave it empty to use the license limit.
    Your password Your simba.io account password to confirm key creation.
  4. Click Create the key.

  5. On the confirmation page, copy the key ID and secret into your deployment's secret manager. The Copy and Download .env actions provide the environment settings; handle the downloaded file as a secret.
  6. Select I have stored the secret in a safe place., then return to Compute licenses.

The secret is displayed only once. If you lose it, revoke the key and create a replacement. Keep secrets out of scripts, project files and version control.

2. Configure and activate a Python worker

The Python API supports activation through environment variables or an explicit method call.

Automatic activation on import

Have your deployment or secret manager supply the variables before importing aesim.simba:

Variable Required Meaning
SIMBA_COMPUTE_KEY_ID Yes The ID of the key created on simba.io.
SIMBA_COMPUTE_SECRET Yes The associated secret.
SIMBA_COMPUTE_SLOTS No Simultaneous simulations reserved by this Python process; a positive integer, default 1.

Install the package in the worker environment:

1
python -m pip install aesim.simba

Then run a simulation:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
from aesim.simba import DesignExamples, Status

design = DesignExamples.DCDC_Flyback()
job = design.TransientAnalysis.NewJob()
status = job.Run()
if status != Status.OK:
    raise RuntimeError(f"Simulation failed: {status}")

time = job.TimePoints
voltage = job.GetSignalByName("R2 - Instantaneous Voltage").DataPoints

Importing the package requests the allocation and starts background renewal. The package releases it at normal interpreter exit. If activation is temporarily unavailable, automatic retries may still be pending; handle failed jobs in your worker rather than assuming the import guarantees an available license.

Explicit activation and release

For explicit lifecycle management, start a fresh Python process without the two SIMBA_COMPUTE_* credential variables and without SIMBA_DEPLOYMENT_KEY. Obtain the credentials from your secret manager under application-specific names, then call the License API:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
import os

from aesim.simba import DesignExamples, License, Status

# Inject these application-specific variables from your secret manager.
key_id = os.environ["WORKER_SIMBA_KEY_ID"]
secret = os.environ["WORKER_SIMBA_SECRET"]

try:
    activation = License.ActivateCompute(key_id, secret, 1)
    if str(activation) != "LicenseOK":
        raise RuntimeError(f"Compute activation not ready: {activation}")

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

This example exits when the initial allocation is unavailable. A persistent worker can instead handle the temporary failure and retry work after license recovery. StopCompute() stops renewal, prevents new simulations and requests release of the allocation; call it once your jobs are finished.

Choose the licensing mode for the whole process

If either Compute credential variable is present on import, Compute mode is selected and both nonempty credentials are required. Compute mode remains selected after an activation failure, lease expiration or StopCompute(); there is no fallback to a stored regular license. To return to a regular license, stop the worker, remove both Compute credential variables and start a new Python process.

3. Plan simultaneous simulations

Slots are reserved per process and shared within that process. They do not set the number of CPU threads used by a simulation.

For example, four worker processes requesting two slots each reserve eight slots in total. This must fit both the key's limit and the organization's available Compute slots. A single AC sweep keeps one simulation slot for its full analysis, including its frequency calculations.

Start each worker as a fresh process and initialize SIMBA inside it. With Python multiprocessing, use the spawn start method rather than forking a process that has already initialized SIMBA. Each worker must acquire its own allocation.

An idle worker retains its allocation until it releases it or its lease expires. Start workers when work is available and shut them down cleanly when finished.

Lease expiry and refused leases

Compute leases renew in the background while calculations run. A temporary renewal failure does not interrupt work while the last signed lease remains valid. If that lease expires before a renewal succeeds, running calculations (transient, AC sweep and FMI) are interrupted and new calculations are blocked. A late acquisition authorizes new work; it cannot resume calculations whose lease already expired. Calling License.StopCompute() also interrupts running Compute calculations. Regular-license calculations keep their existing behavior and can finish after license expiry.

Without a valid lease, a calculation fails at once with an exception whose text starts with No valid Compute license lease is available. (or The Compute license lease has expired.), followed by the cause of the refusal and what to do.

To wait for a lease instead, set SIMBA_COMPUTE_WAIT_SECONDS before importing aesim.simba. While all slots are in use or the license server is unreachable, a calculation then waits up to that number of seconds for a lease. The value is an integer of 0 or more; 0, the default, fails at once. A refused key never waits. An invalid value is rejected at import, before any slot is reserved. The same setting is available in code as License.ComputeWaitSeconds.

A service can read the state of its lease directly:

1
2
3
4
from aesim.simba import License

License.ComputeState                  # NotStarted, Active, WaitingForSlot, Retrying, Rejected or Stopped
License.ComputeLeaseRemainingSeconds  # seconds left on the current lease (0 without lease)
License.ComputeState Meaning What to do
NotStarted No Compute activation in this process yet. Activate Compute.
Active The latest request obtained or renewed a lease. Nothing.
WaitingForSlot All slots of the key or license are in use. SIMBA retries automatically. Retry the calculation later, or use SIMBA_COMPUTE_WAIT_SECONDS.
Retrying Network error, timeout or busy server. SIMBA retries automatically. Retry later and check the access to simba.io on port 443.
Rejected Permanent refusal: key, secret, allowed IP, license, slot limit or solver validation. Automatic retries are suspended. Correct the problem, usually with the license administrator, then reactivate.
Stopped Stopped with License.StopCompute(). Call License.ActivateCompute() to start again.
## 4. Monitor usage and manage keys

The Compute licenses page shows slots in use, key status, end dates and recent activity. Its usage summary shows this month's and last month's slot-hours, measured by the license server:

slot-hours = reserved slots × reservation duration in hours

For example, reserving two slots for 30 minutes represents one slot-hour, including any idle time during that reservation. These server measurements are separate from the aggregate usage reports sent by Desktop and Python.

Use Edit IPs / Revoke on a key to change its allowed outgoing addresses or revoke it; both actions ask for your account password. For key replacement, create and deploy a new key, stop workers using the old key, then revoke the old key.

Revocation prevents new allocations and renewals. Existing allocations remain reserved until workers release them or their leases expire, and calculations already authorized may finish. After a worker crash or an unsuccessful release, the server frees its allocation when its lease expires.

Troubleshooting

Symptom Action
Compute page is unavailable Check that Compute is enabled and that you are a license administrator.
Credentials are refused Check the key ID, secret, key status, end date and the worker's outgoing public IP. Correct the configuration, then reactivate explicitly or restart the worker.
No slots are available Check other workers, the key limit and the organization's capacity. Reduce the requested slots or wait for allocations to be released.
Temporary network/server failure The client retries temporary failures in the background. Watch standard error for diagnostics and recovery messages. New jobs require a valid allocation.
Lease expired Restore connectivity and wait for recovery, or restart the worker. Previously authorized jobs may finish; new jobs need a valid lease.
Regular activation is refused after Compute stops Restart the Python process without the Compute credential variables.

Compute cannot operate offline. SIMBA_OFFLINE_MODE disables telemetry but does not suppress Compute acquisition, renewal or release requests.