Open-Systems-Pharmacology / OSPSuite-R

R package for the OSPSuite
https://www.open-systems-pharmacology.org/OSPSuite-R/
Other
29 stars 12 forks source link

Error when running simulation batch with state variable parameters #1367

Closed PavelBal closed 7 months ago

PavelBal commented 9 months ago

Same as we had already (https://github.com/Open-Systems-Pharmacology/OSPSuite-R/issues/1016), but apparently it was fixed for molecules onle. This time, if some parameters that are state variable are defined as variable in the SimulationBatch but are optimized in SimModel, the run fails:

sim <- loadSimulation(system.file("extdata", "Aciclovir.pkml", package = "ospsuite"))

# Get the paths of all state variable parameters
variableParametersPaths <- getAllStateVariableParametersPaths(simulation = sim)
initParamVals <- getQuantityValuesByPath(simulation = sim, quantityPaths = variableParametersPaths)
# Create simulation batch and define the state variable parameters as variable
simBatch <- createSimulationBatch(simulation = sim,
                                  parametersOrPaths = variableParametersPaths)
# Add run values
simBatch$addRunValues(parameterValues = initParamVals)

# Try to run
results <- runSimulationBatches(simBatch)
Error in rClr::clrCall(simulationRunner, "RunConcurrently") : 
  Type:    OSPSuite.Core.Domain.InvalidArgumentException
Message: Entities 'Organism|StateVariable_Parameter', 'Organism|Lumen|Stomach|Liquid', 'Organism|Lumen|Duodenum|Liquid', 'Organism|Lumen|Duodenum|Aciclovir|Oral mass absorbed segment', 'Organism|Lumen|UpperJejunum|Liquid', 'Organism|Lumen|UpperJejunum|Aciclovir|Oral mass absorbed segment', 'Organism|Lumen|LowerJejunum|Liquid', 'Organism|Lumen|LowerJejunum|Aciclovir|Oral mass absorbed segment', 'Organism|Lumen|UpperIleum|Liquid', 'Organism|Lumen|UpperIleum|Aciclovir|Oral mass absorbed segment', 'Organism|Lumen|LowerIleum|Liquid', 'Organism|Lumen|LowerIleum|Aciclovir|Oral mass absorbed segment', 'Organism|Lumen|Caecum|Liquid', 'Organism|Lumen|Caecum|Aciclovir|Oral mass absorbed segment', 'Organism|Lumen|ColonAscendens|Liquid', 'Organism|Lumen|ColonAscendens|Aciclovir|Oral mass absorbed segment', 'Organism|Lumen|ColonTransversum|Liquid', 'Organism|Lumen|ColonTransversum|Aciclovir|Oral mass absorbed segment', 'Organism|Lumen|C
PavelBal commented 9 months ago

@rwmcintosh

PavelBal commented 7 months ago

State variable parameters must be added as molecules. Will create a PR with documentation.