# Graphics - Physical System-checkpoint

``````

In [25]:

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from Algorithms import TUBScolorscale
from Algorithms import cm2in
# Make the relevant Inputs
export_folder = "../Latex/Graphics/"
model_name = "PhysicalSystem"

# Plot width and heigth in cm
plot_width = 21.
plot_height = 7.5

``````
``````

In [26]:

# Import the needed Data
File = open('PhysicalIdentification.csv')
# Make a Dataframe
Data_60 = pd.DataFrame.from_csv(File, sep =';')
File = open('PhysicalIdentification_90.csv')
# Make a Dataframe
Data_90 = pd.DataFrame.from_csv(File, sep =';')

``````
``````

In [31]:

plt.rcParams['svg.fonttype'] = 'none'
plt.style.use('seaborn-whitegrid')

# Get the Data from 60 kW
x = Data_60['T_A']
# Get the Gains
y = Data_60[['K11','K12','K21','K22']].as_matrix()

# Get the Data from 60 kW
x2 = Data_90['T_A']
# Get the Gains
y2 = Data_90[['K11','K12','K21','K22']].as_matrix()

labels = ["Fan to Temperature", 'Fan to Pressure', 'Valve to Temperature', 'Valve to Pressure']
colors = [TUBScolorscale[1], TUBScolorscale[3], TUBScolorscale[5], TUBScolorscale[9]]
plt.clf
fig, ax = plt.subplots(2, sharex=True, figsize = cm2in(1.5*plot_width,2*plot_height))
for i in range(0,4):
ax[0].plot(x,y[:,i], marker='o', color = colors[i], label = labels[i])
ax[1].plot(x,y2[:,i], marker='o', color = colors[i], label = labels[i])
plt.legend(bbox_to_anchor=(0., 1.1, 1., 0.), loc=3,

plt.xlabel("Ambient Temperature [K]")
ax[0].set_ylabel("Gain")
ax[0].set_title("-60 kW", loc = "left")
ax[1].set_ylabel("Gain")
ax[1].set_title("-90 kW", loc = "left")
plt.xticks(x, x)
plt.show()

``````
``````

<matplotlib.figure.Figure at 0xb8d6748>

``````
``````

In [33]:

plt.savefig(export_folder+model_name+"_Gain_2.svg",format="svg")

``````
``````

In [125]:

plt.rcParams['svg.fonttype'] = 'none'
plt.style.use('seaborn-whitegrid')

# Get the Data from 60 kW
x = Data_60['T_A']
# Get the Gains
y = Data_60[['T11','T12','T21','T22']].as_matrix()

# Get the Data from 60 kW
x2 = Data_90['T_A']
# Get the Gains
y2 = Data_90[['T11','T12','T21','T22']].as_matrix()

labels = ["Fan to Temperature", 'Fan to Pressure', 'Valve to Temperature', 'Valve to Pressure']
colors = [TUBScolorscale[1], TUBScolorscale[3], TUBScolorscale[5], TUBScolorscale[9]]
plt.clf
fig, ax = plt.subplots(2, sharex=True, figsize = cm2in(plot_width,plot_width))
for i in range(0,4):
ax[0].plot(x,y[:,i], marker='o', color = colors[i], label = labels[i])
ax[1].plot(x,y2[:,i], marker='o', color = colors[i], label = labels[i])
plt.legend(bbox_to_anchor=(1., .94, .3, .102), loc=3,

plt.xlabel("Ambient Temperature [K]")
ax[0].set_ylabel("Lag [s]")
ax[0].set_title("-60 kW", loc = "left")
ax[1].set_ylabel("Lag [s]")
ax[1].set_title("-90 kW", loc = "left")
plt.xticks(x, x)
plt.show()
plt.savefig(export_folder+model_name+"_Lag.svg")

``````
``````

<matplotlib.figure.Figure at 0xd8d96d8>

``````
``````

In [124]:

plt.rcParams['svg.fonttype'] = 'none'
plt.style.use('seaborn-whitegrid')

# Get the Data from 60 kW
x = Data_60['T_A']
# Get the Gains
y = Data_60[['L11','L12','L21','L22']].as_matrix()

# Get the Data from 60 kW
x2 = Data_90['T_A']
# Get the Gains
y2 = Data_90[['L11','L12','L21','L22']].as_matrix()

labels = ["Fan to Temperature", 'Fan to Pressure', 'Valve to Temperature', 'Valve to Pressure']
colors = [TUBScolorscale[1], TUBScolorscale[3], TUBScolorscale[5], TUBScolorscale[9]]
plt.clf
fig, ax = plt.subplots(2, sharex=True, figsize = cm2in(plot_width,plot_width))
for i in range(0,4):
ax[0].plot(x,y[:,i], marker='o', color = colors[i], label = labels[i])
ax[1].plot(x,y2[:,i], marker='o', color = colors[i], label = labels[i])
plt.legend(bbox_to_anchor=(1., .94, .3, .102), loc=3,

plt.xlabel("Ambient Temperature [K]")
ax[0].set_ylabel("Delay [s]")
ax[0].set_title("-60 kW", loc = "left")
ax[1].set_ylabel("Delay [s]")
ax[1].set_title("-90 kW", loc = "left")
plt.xticks(x, x)
plt.show()
plt.savefig(export_folder+model_name+"_Delay.svg")

``````
``````

``````
``````

In [144]:

# Get the couplings for T = 273.15 K
k = np.reshape(Data_60.loc[0,['K11','K12','K21','K22']].values,(2,2))
t = np.reshape(Data_60.loc[0,['T11','T12','T21','T22']].values,(2,2))
l = np.reshape(Data_60.loc[0,['L11','L12','L21','L22']].values,(2,2))
kd = np.diag(np.diag(fod))
ka = fod-kd
np.dot(np.linalg.inv(kd),ka)

``````
``````

Out[144]:

array([[ 0.        ,  1.13381604],
[ 0.38881594,  0.        ]])

``````
``````

In [ ]:

``````