Modelica_CSV



In [1]:
import pandas as pd
import plotly.figure_factory as FF

dfl = pd.read_csv(r'C:\Users\juliu\Documents\GIT\New folder\Modelica\Results\Gascooler_Valve_System_20170531.csv', header = 1, names = ['t','d2','h2', 'p2', 's2', 'T2','M2','q2','cp2','cv2','d1','h1','p1','s1','T1','M1','q1','cp1','cv1','w1','k1','b1','b2','k2','w2','px2','hx2','g2','px1','hx1','g1'])
sample_table = FF.create_table(dfl.head())

In [2]:
# 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() 

iplot(sample_table)



In [8]:
trace1 = Scatter(
    x = dfl['T1'],
    y = dfl['b1'],
    mode = 'lines+markers',
    yaxis ='y1'
)

trace2 = Scatter(
    x = dfl['T1'],
    y = dfl['d1'],
    mode = 'lines+markers',
    yaxis='y2'
)

layout = Layout(
    title='Coefficient of thermal expansion and density over Temperature at Valve Inlet',
    yaxis=dict(
        title='b in [1/K]'
    ),
    yaxis2=dict(
        title='v in [m^3/kg]',
        titlefont=dict(
            color='rgb(148, 103, 189)'
        ),
        tickfont=dict(
            color='rgb(148, 103, 189)'
        ),
        overlaying='y',
        side='right'
    )
)
fig = Figure(data=[trace1,trace2], layout=layout)

iplot(fig)



In [11]:
trace1 = Scatter(
    x = dfl['t'][4900:10002],
    y = dfl['d1'][4900:10002],
    mode = 'lines+markers',
    name = 'Density at Valve Inlet',
    yaxis ='y1'
)

trace2 = Scatter(
    x = dfl['t'][4900:10002],
    y = dfl['T1'][4900:10002],
    mode = 'lines+markers',
    name = 'Temperature at Valve Inlet',
    yaxis='y2'
)

trace3 = Scatter(
    x = dfl['t'][4900:10002],
    y = dfl['p2'][4900:10002],
    mode = 'lines+markers',
    name = 'Pressure at valve Outlet',
    yaxis='y3'
)

layout = Layout(
    title='Density and Temperature over time',
    yaxis=dict(
        title='d in kg/m^3'
    ),
    yaxis2=dict(
        title='T_1 in K',
        titlefont=dict(
            color='rgb(148, 103, 189)'
        ),
        tickfont=dict(
            color='rgb(148, 103, 189)'
        ),
        overlaying='y',
        side='right'
    )
)
fig = Figure(data=[trace1,trace2,trace3], layout=layout)

iplot(fig)



In [119]:
trace1 = Scatter(
    x = dfl['T2'][4900:10002],
    y = dfl['q2'][4900:10002],
    mode = 'lines+markers',
    name = 'Steam Fraction at Valve Outlet',
    yaxis ='y1'
)

trace2 = Scatter(
    x = dfl['T2'][4900:10002],
    y = dfl['p2'][4900:10002],
    mode = 'lines+markers',
    name = 'Pressure at Valve Outlet',
    yaxis='y2'
)

layout = Layout(
    title='Steam Fraction over Temperature',
    yaxis=dict(
        title='p_2 in Pa'
    ),
    yaxis2=dict(
        title='T_2 in K',
        titlefont=dict(
            color='rgb(148, 103, 189)'
        ),
        tickfont=dict(
            color='rgb(148, 103, 189)'
        ),
        overlaying='y',
        side='right'
    )
)
fig = Figure(data=[trace1,trace2], layout=layout)

iplot(fig)



In [130]:
trace1 = Scatter(
    x = dfl['p2'][4900:10002],
    y = dfl['d2'][4900:10002],
    mode = 'lines+markers',
    name = 'Steam Fraction at Valve Outlet',
    yaxis ='y1'
)

trace2 = Scatter(
    x = dfl['p2'][4900:10002],
    y = dfl['d1'][4900:10002],
    mode = 'lines+markers',
    name = 'Pressure at Valve Outlet',
    yaxis='y2'
)

layout = Layout(
    title='Steam Fraction over Temperature',
    yaxis=dict(
        title='p_2 in Pa'
    ),
    yaxis2=dict(
        title='T_2 in K',
        titlefont=dict(
            color='rgb(148, 103, 189)'
        ),
        tickfont=dict(
            color='rgb(148, 103, 189)'
        ),
        overlaying='y',
        side='right'
    )
)
fig = Figure(data=[trace1,trace2], layout=layout)

iplot(fig)



In [148]:
trace1 = Scatter(
    x = dfl['t'][4900:10002],
    y = dfl['T1'][4900:10002],
    mode = 'lines+markers',
    name = 'Entropy Difference',
    yaxis ='y1'
)

trace2 = Scatter(
    x = dfl['t'][4900:10002],
    y = dfl['d2'][4900:10002],
    mode = 'lines+markers',
    name = 'Pressure at Valve Outlet',
    yaxis='y2'
)

layout = Layout(
    title='Steam Fraction over Temperature',
    yaxis=dict(
        title='T in K'
    ),
    yaxis2=dict(
        title='T_2 in K',
        titlefont=dict(
            color='rgb(148, 103, 189)'
        ),
        tickfont=dict(
            color='rgb(148, 103, 189)'
        ),
        overlaying='y',
        side='right'
    )
)
fig = Figure(data=[trace1,trace2], layout=layout)

iplot(fig)



In [ ]: