Python API

This sections describes the main functions and functionalities to translate models to Python and run them. If you need more detailed description about the translation and building process, please see the Structure of the PySD library section.

The model loading information can be found in Model loading and consists of the following functions:

Translating and loading functions

pysd.read_vensim()

Translates a Vensim file to Python and returns a Model object.

pysd.read_xmile()

Translates a Xmile file to Python and returns a Model object.

pysd.load()

Loads a translated Python file and returns a Model object.

The Model and Macro classes information ad public methods and attributes can be found in Python model class.

Translating and loading functions

pysd.py_backend.model.Model

Implements functionalities to load a translated model and interact with it. The Model class inherits from Macro, therefore, some public methods and properties are defined in the Macro class.

pysd.py_backend.model.Macro

Implements functionalities to load a translated macro and interact with it. Most of its core methods are also use by Model class.

Provided functions and stateful classes to integrate python models are described in Python functions and stateful objects.