Skip to content

License API

Import the licensing entry point from the Python package:

1
from aesim.simba import License

For setup instructions, see Python activation, Offline Mode or the dedicated Compute License guide. The generated License reference lists the documented members from the current SIMBA assembly.

Activate a regular license

License.Activate(deployment_key)

Activates the Python API using a deployment key when an activation is needed. Returns Status.OK on success or Status.Error on failure. An already valid local activation can be reused. This method is synchronous; demo licenses cannot be used with the Python API.

1
2
3
4
5
6
7
import os

from aesim.simba import License, Status

activation = License.Activate(os.environ["SIMBA_DEPLOYMENT_KEY"])
if activation != Status.OK:
    raise RuntimeError("SIMBA activation failed")

Setting SIMBA_DEPLOYMENT_KEY before importing the package also requests activation automatically. Check simulation statuses in unattended scripts even when using automatic activation.

License.SaveLicenseRequestFile(path)

Writes a .slr request file for the current computer and SIMBA version. Use it on a connected computer to obtain a corresponding offline license file from your SIMBA account. The method raises an exception if the request cannot be generated or written.

License.ActivateUserFromLicenseFile(path)

Loads and activates an offline license file. Returns a Simba.Data.LoginStatus value; compare its string representation with "LicenseOK" to check success:

1
2
3
activation = License.ActivateUserFromLicenseFile("simba-license.slf")
if str(activation) != "LicenseOK":
    raise RuntimeError(f"Offline activation failed: {activation}")

LoginStatus is a .NET enum and is not re-exported by aesim.simba. It is different from the Status enum returned by License.Activate() and simulation jobs.

License.LoadLicenseFile(path) is also available, but does not return the activation status. Prefer ActivateUserFromLicenseFile() when a script needs to check whether activation succeeded.

License.ClearStoredLicense()

Invalidates the local regular-license rights and clears the stored activation and deployment key. It does not close the Python interpreter. Reactivate explicitly before starting further simulations.

Inspect the license

Member Result
GetLicenseStatus() Raw license category/status string from the solver, for example "Demo Mode".
GetLicenseExpirationDate() Expiration date of the locally loaded license, in YYYY-MM-DD form.
GetMaximumSimbaVersionDate() Latest SIMBA version date covered by the loaded license, in YYYY-MM-DD form.
NumberOfAvailableParallelSimulationLicense() Available parallel simulation capacity.

The local activation expiry and the latest supported SIMBA version date describe different limits. Neither replaces checking the returned status of activation or simulation jobs.

Refresh a regular activation

The package starts background validation automatically for regular licenses and stops it at interpreter exit. The generated reference describes the available methods:

The shared validation and renewal policy covers check intervals, network failures, expiration and revocation.

Methods ending in Async return .NET tasks, rather than Python asyncio coroutines. A synchronous script can retrieve a result using .GetAwaiter().GetResult().

Compute API members

Compute key creation, worker configuration, activation examples and capacity management are documented in Compute Licenses.

  • ActivateCompute(keyId, secret, slots) selects Compute mode and requests capacity for the current process. It returns a Simba.Data.LoginStatus value.
  • StopCompute() stops renewal and requests release of that process's allocation. Finish your jobs before releasing it.
  • ComputeState returns the state of the latest Compute lease request of the process: NotStarted, Active, WaitingForSlot, Retrying, Rejected or Stopped. It lets a service tell a full slot quota, which is retried automatically, from a refusal that needs the license administrator.
  • ComputeLeaseRemainingSeconds returns the seconds left on the Compute lease of the process, or 0 without a lease.
  • ComputeWaitSeconds sets how many seconds a calculation waits for a Compute lease before failing. The default, 0, fails at once. The Python API sets it from SIMBA_COMPUTE_WAIT_SECONDS.
  • IsComputeModeSelected indicates the process's licensing mode. It remains true after a failure, expiration or stop, and does not mean a valid lease is currently available.

Save an already authorized project

Projects authorized for saving while a regular license was active retain that permission for the current session if license rights later become unavailable. Demo-only projects cannot be saved.

Handle file-system errors when saving. This permission lets you preserve an open project; it does not authorize new simulations after license rights have expired or been removed.