In [1]:
# Import the dymola Python package
import os
import threading
import numpy as np
from dymola.dymola_interface import DymolaInterface
from dymola.dymola_exception import DymolaException

In [2]:
from dymola.dymola_interface import DymolaInterface
from dymola.dymola_exception import DymolaException
# Set working directory
os.chdir(r'C:\Users\juliu\Documents\GIT\New folder\Modelica')
# Start the dymola Interface
dymola = DymolaInterface(use64bit = False)

In [3]:
# Name of the result file
studyname = "Gascooler_Valve_System_Tester_Constant_Valve_1.mat"
tsize = dymola.readTrajectorySize(studyname)
#tnames = dymola.readTrajectoryNames(studyname)
# Import needed results
signals = dymola.readTrajectory(studyname,["Time",
                                           "Gascooler_Valve_System.HPValve.vleFluidA.T",
                                           "Gascooler_Valve_System.HPValve.vleFluidA.p",
                                           "Gascooler_Valve_System.HPValve.vleFluidB.T",
                                           "Gascooler_Valve_System.HPValve.vleFluidB.p"],
                                tsize)
# Redefine for readability
t = np.array(signals[0])
T1 = np.array(signals[1])
p1 = np.array(signals[2])/1e5
T2 = np.array(signals[3])
p2 = np.array(signals[4])/1e5


ERROR: Bad return type. Expected int but got <class 'dict'>.
ERROR: Bad return type. Expected list2d but got <class 'dict'>.
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-3-49be5b29aa05> in <module>()
     11                                 tsize)
     12 # Redefine for readability
---> 13 t = np.array(signals[0])
     14 T1 = np.array(signals[1])
     15 p1 = np.array(signals[2])/1e5

TypeError: 'NoneType' object is not subscriptable

In [3]:
# Import Plotly
from plotly import __version__
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
from plotly.graph_objs import *
import plotly
plotly.offline.init_notebook_mode()