Select Page

# Simulx API

## On the use of the R-functions

We now propose to use Simulx via R-functions. The package lixoftConnectors provides access to the project exactly in the same way as you would do with the interface. All the installation guidelines and initialization procedure can be found here. All the functions are described below.

## Description of the functions concerning the project management

• getStructuralModel: Get the model file for the structural model used in the current project.
• loadProject: Load a project by parsing the Mlxtran-formated file whose path has been given as an input.
• newProject: Create a new empty project providing model and data specification.
• saveProject: Save the current project as an Mlxtran-formated file.

## Examples

• Simple example to load an existing project, run the simulation and look at the results :
# load and initialize the API
library(lixoftConnectors)
initializeLixoftConnectors(software="simulx")

# Get the project
demoPath = '/lixoft/simulx/simulx2020R1/demos/'
project <- paste0(demoPath, "2.models/longitudinal.smlx")

# Run the simulation
runSimulation()

# The results are accessible through the function getSimulationResults()
# The results for the output is the list res and TS is one of the outputs
head(getSimulationResults()$res$TS)
id time       TS
1  1    0 10.00000
2  1    1 11.04939
3  1    2 12.20862
4  1    3 13.48915
5  1    4 14.90359
6  1    5 16.46585


where is the user’s home folder (on windows C:/Users/toto if toto is your username).

### Handling of warning/error/info messages

Error, warning and info messages from Monolix are displayed in the R console when performing actions on a monolix project. They can be hidden via the R options. Set lixoft_notificationOptions$errors, lixoft_notificationOptions$warnings and lixoft_notificationOptions$info to 1 or 0 to respectively hide or show the messages. #### Example op = options() op$lixoft_notificationOptions\$warnings = 1   #hide the warning messages
options(op)