Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simulation on linux doesn't wait to process #207

Closed
InigoGastesi opened this issue Apr 24, 2024 · 1 comment
Closed

Simulation on linux doesn't wait to process #207

InigoGastesi opened this issue Apr 24, 2024 · 1 comment

Comments

@InigoGastesi
Copy link
Contributor

Description

When using simulate function , this function uses subprocess.Popen to create a resultfile. In windwos it waits for the process to be finished to continue, but in linux it doesn't. So, if you call simulate and then getSolutions you will have an error.

Steps to Reproduce

omc = OMCSessionZMQ()
mod = ModelicaSystem(model_path_full, model_name)

mod.setSimulationOptions(["startTime=0.0",f'stopTime={s}',f'stepSize={step_size}',"tolerance=1e-06"])
#mod.setParameters(f"{variable}={v}")
mod.simulate(resultfile=f'{filename}.mat') #Para simular el modelo, empleo el método ".simulate()"

data = {}
data["time"] = mod.getSolutions(["time"],resultfile=f'{filename}.mat')[0] #error

Error:

Cell In[3], [line 9](vscode-notebook-cell:?execution_count=3&line=9)
      [6](vscode-notebook-cell:?execution_count=3&line=6) mod.simulate(resultfile=f'{filename}.mat') #Para simular el modelo, empleo el método ".simulate()"
      [8](vscode-notebook-cell:?execution_count=3&line=8) data = {}
----> [9](vscode-notebook-cell:?execution_count=3&line=9) data["time"] = mod.getSolutions(["time"],resultfile=f'{filename}.mat')[0]
     [10](vscode-notebook-cell:?execution_count=3&line=10) print(data)
     [11](vscode-notebook-cell:?execution_count=3&line=11) # Configure Plot

TypeError: 'NoneType' object is not subscriptable

Expected Behavior

Screenshots

Version and OS

  • Python Version: 3.9.18
  • OMPython Version: 3.5.1
  • OpenModelica Version: 1.22.3
  • OS: Ubuntu 22.04-64bit

Additional Context

InigoGastesi pushed a commit to InigoGastesi/OMPython that referenced this issue Apr 24, 2024
InigoGastesi pushed a commit to InigoGastesi/OMPython that referenced this issue Apr 24, 2024
arun3688 pushed a commit that referenced this issue Apr 24, 2024
Co-authored-by: igastesi <[email protected]>
@arun3688
Copy link
Collaborator

@InigoGastesi thanks for the contribution I have merged your PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants