Skip to content

Problem running .mos with the command line - Dymola and Windows #597

@rpatureau

Description

@rpatureau

OS: Windows 11 Pro
Buildingspy: 5.2.dev0 (buildingspy.version)
Dymola: 2025x

Issue:
The .mos file is created but cannot be launched by dymola

Potential problem:

The absolute name of the .mos file should be provided

In the function

_runSimulation(self, mosFile, timeout, directory):
       mo_fil = mosFile.replace(directory, ".")
       ...

it appears that it leads to mo_fil being .\run.mos
If I run in the cmd window:

c:\dymola>dmc -r ".\run.mos" (OR dmc -r "run.mos" OR dmc -r run.mos)
Script:.\run.mos
Error: Input error; cannot read .\run.mos.
Error: Ensure the input exists and is readable.

But if I write:

c:\dymola>dmc -r "c:\dymola\run.mos"

Then the script runs

Steps to reproduce

from buildingspy.simulate.Dymola import Simulator
import os

out_dir = r'C:\dymola'

s=Simulator("Modelica.Blocks.Examples.PID_Controller", outputDirectory=out_dir)
s.showGUI(True)
s.simulate()

Should I take a closer look and correct if it I can?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions