ScadeOne app#
The ScadeOne “app” is the Python class that allows to interact with Scade One projects.
The ansys.scadeone.core module must be referenced by scripts using PyScadeOne. It exposes the ScadeOne class representing a Scade One instance.
An instance of the ScadeOne class gives access to project loading and model-related activities as shown in the next figure:
Fig. 1 ScadeOne class hierarchy#
ScadeOne class#
- class ansys.scadeone.core.ScadeOne(install_dir: str | Path | None = None)#
Bases:
IScadeOneScade One API. This is the main entry point for users of the API, providing access to projects, tools, and other functionality.
- Parameters:
- install_dir
Optional[Union[str,Path]] Optional installation directory to use for determining tool paths.
If not provided, the API will look for the Configuration/modulesLocation.config file next to the ‘ansys.scadeone.core’ module.
If neither provided nor found, tool paths will not be available and no functionality requiring code generation, or other tool-dependent features, will be accessible.
- install_dir
- class Tool(*values)#
Bases:
EnumEnum for Scade One tools, used in get_tool_path method.
- JOB_LAUNCHER = 1#
Job launcher tool for running Scade One jobs.
- LIBRARIES = 2#
LIBRARIES for Scade One libraries.
- MINGW = 3#
MINGW tool for C code generation.
- SCADE_ONE_LOCATION = 4#
Scade One installation directory.
- SIMULATOR = 5#
Simulator tool for running Scade One simulations.
- find_project(path: Path) Project | None#
Return the loaded
Projectfor the given sproj path, or None.
- get_tool_path(tool: Tool) Path | None#
Get the path of a Scade One tool.
- Parameters:
- tool
IScadeOne.Tool Enum value representing the tool. Currently supported value is IScadeOne.Tool.JOB_LAUNCHER.
- Returns
- ——-
- Path|None
Path to the tool executable, or None if not found.
- tool
- load_project(storage: Project | str | Path) Project | None#
Load a Scade One project.
- Parameters:
- storage
Union[Project,str,Path] Storage containing project data.
- storage
- Returns:
- Project|None
Project object, or None if file does not exist.
- new_project(project_path: str | Path) Project#
Create a new project.
- Parameters:
- project_path
Union[str,Path] Project location.
- project_path
- Returns:
ProjectProject object.
- subst_in_path(path: str) str#
Substitute
$(SCADE_ONE_LIBRARIES_DIR)in path.if
ScadeOne.install_diris None, no change is made.
- property install_dir: Path | None#
Installation directory as given when creating the ScadeOne instance.
- property parser: Parser#
Shared
SwanParserused by every per-project model.
Tools#
The ScadeOne.get_tool_path() method allows to retrieve the path of Scade One tools,
such as the Job Launcher, which can be used to run Scade One jobs.
Available tools are given by the IScadeOne.Tool enum.
- class ansys.scadeone.core.interfaces.IScadeOne#
Bases:
ABCInterface class
- class Tool(*values)#
Bases:
EnumEnum for Scade One tools, used in get_tool_path method.
- JOB_LAUNCHER = 1#
Job launcher tool for running Scade One jobs.
- LIBRARIES = 2#
LIBRARIES for Scade One libraries.
- MINGW = 3#
MINGW tool for C code generation.
- SCADE_ONE_LOCATION = 4#
Scade One installation directory.
- SIMULATOR = 5#
Simulator tool for running Scade One simulations.
- abstractmethod find_project(path: Path) IProject | None#
Return the loaded
IProjectfor the given sproj path, or None.
- abstract property parser: SwanParser#
Shared Swan parser used by all per-project models.