Creating own model

A classical error is to forget adding empty __init__.py files in all folder to be sure they are processed by platform pythonic explorations:
be sure there are __init__.py files in all your folders !

Move to your sos-trades-dev folder and load virtual environment

  • move in the sostrades-dev-tools where the platform was installed
    cd <path to your installation folder>\sostrades-dev-tools

  • activate the virtual environment
    .\.venv\Scripts\activate
    You should see a (.venv) appear at the beginning of yout DOS prompt

Every time you want to work with SoSTrades to develop or use the platform,
activate this virtual environment first by reruning this .\.venv\Scripts\activate command

Create your folder structure in one of your module repository

  • move to one of your module's sos_wrapping folder
    .../sostrades-dev-tools/models/<your repository>/<your-module>/sos_wrapping
    cd ...\sostrades-dev-tools\models\<your repository>\<your-module>\sos_wrapping

  • add a folder for your new model
    mkdir <your-model-name>
    cd <your-model-name>
    type NUL > __init__.py

  • create a folder for your model documentation
    mkdir documentation
    type NUL > documentation\__init__.py

Create your model

  • create a file <your-model-name>_disc.py in which you will create a class
    following instructions given in this developer's manual section

  • you might want to add graphs to your model
    following instructions from this developer's manual section

  • create a file documentation\<your-model-name>.md with your dfocumentation in markdown format

Update ontology

  • move to .../sostrades-dev-tools folder
    cd ...\sostrades-dev-tools

  • run the UpdateOntology.py script to initialize the ontology of parameters, models and processes :
    python scripts/UpdateOntology.py

Check your model appear in the platform

  • start the platform, select the upper-left three horizontal bars and in the menu select Ontology/Models

  • Use the Filter to check if your model appears

  • select the book icon at the end of your model line in list, to check informations were well retrieved (inputs, outputs, documentation...)