Exception: Simulation failed (Windows)

Hi guys,
a newbie here. I have a a problem running a CADET file (on windows), giving the error message “Exception: Simulation failed”. Do you need any more specific information to give me a clue how to solve it?

I am grateful for any advice. Thank you in advance for your help!

Best regards,

Phuong

Hey Phuong, could you maybe also post the error message and the return code?

Hi, Jo. Yes:

runfile('//ibt014/ho/Project PhD (FZJ)/05_Simulations/Compartment_model/compartment-model/driver.py', wdir='//ibt014/ho/Project PhD (FZJ)/05_Simulations/Compartment_model/compartment-model')
Reloaded modules: compartment_simple
CompletedProcess(args=['\\\\ibt014\\ho\\Project PhD (FZJ)\\05_Simulations\\Compartment_model\\cadet\\bin\\cadet-cli.exe', 'C:/Users/ho/compartment.h5'], returncode=3221225781, stdout=b'', stderr=b'')
Traceback (most recent call last):

  File "\\ibt014\ho\Project PhD (FZJ)\05_Simulations\Compartment_model\compartment-model\driver.py", line 21, in <module>
    results = run_model(cadet, file_name=filename.as_posix())

  File "\\ibt014\ho\Project PhD (FZJ)\05_Simulations\Compartment_model\compartment-model\compartment_simple.py", line 208, in run_model
    raise Exception("Simulation failed")

Exception: Simulation failed

I do suspect that the issue lies with the path of the file name.

Please try the following in the driver:

...
from pathlib import Path
file_name = Path('./compartment.h5')
results = run_model(cadet, file_name=file_name.as_posix())
...

make sure that the run method looks like this:

def run_model(cadet, file_name):
    cadet.filename = file_name
    cadet.save()
    
    # run the simulation
    data = cadet.run()
    
    if data.returncode == 0:
        cadet.load()   
    else:
        print(data)
        raise Exception("Simulation failed")
    
    results = get_results(cadet)
        
    return results

now I have the following error message when running the driver:

runfile(’//ibt014/ho/Project PhD (FZJ)/05_Simulations/Compartment_model/compartment-model/driver.py’, wdir=’//ibt014/ho/Project PhD (FZJ)/05_Simulations/Compartment_model/compartment-model’)
File “\ibt014\ho\Project PhD (FZJ)\05_Simulations\Compartment_model\compartment-model\driver.py”, line 24
plot_results(results)
^
IndentationError: unexpected indent

indentation problem solved.

but now it says that VCRUNTIME140_1.dll cannot be found. A reinstallation of the program might solved the problem.

This should be related to this issue.

Your system lacks the Visual C++ 2019 runtime libraries:
https://support.microsoft.com/de-de/help/2977003/the-latest-supported-visual-c-downloads
You ned vc_redist.x64.exe .

Hi j.schmoelder,
thank you for providing the solution. It works!

Best regards