> For the complete documentation index, see [llms.txt](https://docs.open-systems-pharmacology.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.open-systems-pharmacology.org/v13/working-with-pk-sim/pk-sim-documentation/importing-exporting-project-data-models.md).

# Importing and Exporting Project Data and Models

## Importing Observed data

The Open Systems Pharmacology Suite offers a convenient handling of experimental time-values data. The process of loading of observed data from file formats like MS Excel, CSV, or NONMEM, is described in [Shared Tools - Import and edit of Observed Data](/v13/shared-tools-and-example-workflows/import-edit-observed-data.md).

## Importing Individual and Population Simulation

The **Import** function of individual and population simulations allows you to use simulations that have been modified outside of PK-Sim® - most likely using MoBi® - in the PK-Sim® environment. This has several advantages:

* Simulations are handled in the well-known PK-Sim® environment.
* Performing population simulations with models extended in MoBi.
* Performing PK parameter analyses with models extended in MoBi.

#### Loading an individual simulation

A simulation previously exported as a \*.pkml file from PK-Sim® or MoBi® can be imported into the current project. To import an individual simulation:

* Click on the **Import/Export** tab then click on the **Individual Simulation** icon <img src="https://1813877937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQFXknsrmGsWTsIiMSJin%2Fuploads%2Fgit-blob-85110a9100751f117e339a6b721c170732297223%2FIndividualSimulationLoad.svg?alt=media" alt="" data-size="line"> and select the \*.pkml file to be imported. The simulation will be imported into the project and will be available from the Simulation Explorer.
* Imported simulations can be run and analysed as any standard PK-Sim® simulation. However, the structure of the simulation cannot be altered. That means that it is not possible to swap parts of the simulation using the building block concept described in [Modules, Philosophy, and Building Blocks](/v13/open-systems-pharmacology-suite/modules-philsophy-building-blocks.md).
* If an imported simulation contains parameters that are unknown in PK-Sim®, they can be found in the simulation parameter tree under the node MoBi®.

#### Loading a population simulation

Similarly to individual simulations, a simulation previously exported as a \*.pkml file from PK-Sim® or MoBi® can be imported into the current project as a population simulation. As the \*.pkml exports only contain individual simulation and no information about the population, population information must be either a) loaded from a \*.CSV file (e.g., previously exported from PK-Sim or created in R), or a Population Building Block must be created and assigned to the simulation. To import a population simulation:

* Click on the **Import/Export** tab, then click on the **Population Simulation** icon <img src="https://1813877937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQFXknsrmGsWTsIiMSJin%2Fuploads%2Fgit-blob-64c12088737d1f6c42bbc4edce53e8fa48915d1f%2FPopulationSimulationLoad.svg?alt=media" alt="" data-size="line">. In the **Simulation** section of the "Import Population Simulation" dialog, select the \*.pkml file to be imported.
* In the **Population** <img src="https://1813877937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQFXknsrmGsWTsIiMSJin%2Fuploads%2Fgit-blob-a47037b2e893e022e5408982a1c7f4ecf035e927%2FPopulation.svg?alt=media" alt="" data-size="line"> section, the population needs to be specified. There are **three** different ways of defining the aforementioned population:

1. Use a population that is defined as building block in your current project. Available populations are itemized in the drop down menu of the **Population** field. In addition, you can define a new population by clicking on the **Add** <img src="https://1813877937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQFXknsrmGsWTsIiMSJin%2Fuploads%2Fgit-blob-a47037b2e893e022e5408982a1c7f4ecf035e927%2FPopulation.svg?alt=media" alt="" data-size="line"> button or load a population from a template by clicking on the **Load from template** <img src="https://1813877937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQFXknsrmGsWTsIiMSJin%2Fuploads%2Fgit-blob-674944577247f48cea74e0b27bff1e0948c51ad3%2FLoadAction.svg?alt=media" alt="" data-size="line"> button.
2. Load a population from a .CSV file. This is a file that was previously generated from a population and saved in CSV format.
   * Use this option if you want to manually modify the default distribution generated by PK-Sim® for a given parameter or if you wish to vary parameters that were created in MoBi® and that PK-Sim® is not aware of. The file is selected by specifying the population file path.
3. Allocate the number of individuals. This is typically used when importing a simulation that was entirely created in MoBi® and is not based on a PK-Sim® model. In that case, all distributed parameters defined in the simulation will be randomly varied according to their distribution. Also all parameters marked with the flag “Can be varied in a population” in MoBi® can be varied manually after importing in the **User Defined Variability** tab of PK-Sim®.

## Export To Excel®

You can export the simulation results (time-values profiles within all included organs and compartments) to MS-Excel®.

* Right mouse click on the simulation name within the **Simulations Explorer** and select **Export results to Excel**

A window opens where you can enter the Excel® file name and the file type (\*.xls or \*.xlsx). Then Excel® is automatically started showing the exported data.

## Export To CSV

You can export the simulation results (time-values profiles within all included organs and compartments) to a text file in CSV format. The procedure is identical to the export to Excel®.

## Send To MoBi®

You can export a PK-Sim® simulation to MoBi® by one of the following steps:

* Right mouse click on the simulation name within the **Simulations Explorer** and select **Export To MoBi...** <img src="https://1813877937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQFXknsrmGsWTsIiMSJin%2Fuploads%2Fgit-blob-452e11aba1a59ad73855aded500aa5c1e19b7c2e%2FMoBi.svg?alt=media" alt="" data-size="line">

The program MoBi® will open with the exported simulation. You can then save the exported simulation within MoBi® in MoBi® format (\*.mbp3 file).

## Export to \*.pkml file for MoBi®

The **Shared Modeling File (\*.pkml)** can be used to transfer a PK-Sim® simulation into a MoBi® project. To export a PK-Sim® simulation to a \*.pkml file:

* Right mouse click on the simulation name in the **Simulations Explorer** <img src="https://1813877937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQFXknsrmGsWTsIiMSJin%2Fuploads%2Fgit-blob-ccdd63a85b408add412321d677f39cddb58a63cc%2FSimulation.svg?alt=media" alt="" data-size="line">.

and select **Save Simulation to MoBi pkml format ...**

A window opens where you can choose the directory and enter the \*.pkml file name. The file is saved an can be subsequently opened from MoBi®.

{% hint style="info" %}
The "Send to MoBi®" function described above is identical to exporting a simulation to a \*.pkml file and then opening this file from MoBi®.
{% endhint %}

## Exporting Simulation Structures To File

You can export a PK-Sim® simulation to a text file that contains all model and simulation details: model structure, rate equations and parameter values. You can export the simulation by:

* Right mouse clicking on the simulation name within the **Simulations Explorer** and selecting **Export Simulation Structure To File...**

A window opens where you can choose the directory and enter the file name. The file is saved and can be opened with a suitable text editor.

## Exporting the Project History To File

To export the project history that contains any user action to an Excel® file:

* Click on the **Export History** icon <img src="https://1813877937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQFXknsrmGsWTsIiMSJin%2Fuploads%2Fgit-blob-d2ab46bea49915201a868919bd7bc816e720b32f%2FHistory.svg?alt=media" alt="" data-size="line"> in the **Export Project** group of the **Import/Export** tab.

A window opens where you can choose the directory and enter the Excel file name.

## Exporting Population data

To export the physiological parameters which are varied within a population to a table (\*.csv format):

* Right mouse click on the population name within the **Building Blocks Explorer** and select **Export To CSV...**
* If you have created a population simulation, you can also export the population data by right mouse click on the simulation name within the **Simulations Explorer** and select **Export To CSV...**.

## Exporting Project to Snapshot / Loading Project from Snapshot

Projects, and single building blocks, can be exported to and recreated from snapshots in [JSON format](https://en.wikipedia.org/wiki/JSON). S. [Snapshots](/v13/working-with-pk-sim/pk-sim-documentation/pk-sim-snapshots.md) for details.
