Embedded Software

Embedded Software

Ansys SCADE API Tools simplifies Python API access

Tagged: api, GitHub, PYPI, python, SCADE

    • SolutionSolution
      Participant

      In this article, we’ll take a look at Ansys SCADE API Tools (GitHub link), designed to simplify usage of the SCADE Python APIs.

      The vanilla SCADE Python API

      Most Ansys products come packaged with Python APIs (as part of the PyAnsys initiative). These open-source libraries allow engineers to interact programmatically with Ansys products, integrating them into their workflows.

      Ansys SCADE is no exception. Its Python API allows users to:

      • Walk through SCADE models and modify them using code
      • Access generated artefacts (mapping files, test results, model coverage…)

      If you’re interested in using the SCADE Python API, we’ve already written an article on getting started with your favorite IDE.

      Introducing ansys-scade-apitools

      We are pleased to announce the release of ansys-scade-apitools, a Python package that extends the standard SCADE Python API.

      Its goal is to make the SCADE API easier to use by adding a collection of high-level functions that accomplish complex operations without exposing low-level concepts to the user.

      Key benefits are:

      • Simplified configuration to run Python code from your preferred IDE.
      • High-level, Pythonic APIs allow creating models, automatically handling intermediate elements and their consistency.

      The package is structured into five modules:

      • create: collection of functions for creating or updating SCADE models. This includes creating types, operators, interfaces and other constructs.
      • expr: collection of functions for accessing expressions. This covers walking through a model’s operators and expressions.
      • info: provides information on the current version of SCADE.
      • prop: collection of functions for the storage of settings and properties.
      • query: collection of queries about SCADE Suite types.

      Some examples

      The images below illustrate a couple of the numerous functions exposed by API Tools.



      Example: accessing an If expression with a Python script (link)



      Example: printing SCADE version properties with a Python script (link)

      The library has many more functions than illustrated in this short article. You may find them described in the Examples section of our online docs.

      Ready to try it out?

      If you’re interested in using Ansys SCADE API Tools, our online docs are a great starting point. The package is published on PyPI (Python Package Index) as ansys-scade-apitools.

      If you wish to look under the hood and/or contribute, sources are available on the dedicated Ansys GitHub repository.

      About the author



      François Couadau (LinkedIn) is a Senior Product Manager at Ansys. He works on embedded HMI software aspects in the SCADE and Scade One products. His past experience includes distributed systems and telecommunications.