``````

In [1]:

#Import the needed Packages
import pandas as pd
import numpy as np
import control as cn
import matplotlib.pyplot as plt
# Matplotlib inline magic
%matplotlib inline
from Algorithms import cm2in, TUBScolorscale

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

In [80]:

# Define a FOTD System
def FOTD(K,T,L,u,t):
# New Array for Output
y = np.zeros_like(u)
for i in range(0,len(u)):
if t[i]>=L:
y[i] = K*(1-np.exp(-(t[i]-L)/T))*u[i]
return y

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

In [125]:

plt.clf()
# Second Plot
t = np.linspace(0,1000,2000)
u = np.ones_like(t)
y1 = FOTD(5,40,100,u,t)
y1inf = 5*np.ones_like(t)
y2 = FOTD(5,80,400,u,t)
y2 = y1+y2
y2inf = 10*np.ones_like(t)
x0 = np.array([0,0])
z0 = np.array([0,10])
x1 = np.array([100,100])
z1 = np.array([0,5])
x2 = np.array([400,400])
z2 = np.array([5,10])
# Plot
fig2, ax2 = plt.subplots(figsize=(10,4))
# Outer Contour
ax2.plot(x0,z0,color="black")
ax2.plot(t,y2inf,color="black")
ax2.plot(t,y2,color="black")
ax2.plot(x1,z1,color="black")
ax2.plot(x2,z2,color="black")
# Fills
ax2.plot(t[np.where(t<400)],y1inf[np.where(t<400)], color="black")
ax2.fill_between(t[np.where(t<100)],y1inf[np.where(t<100)], y1[np.where(t<100)], facecolor=TUBScolorscale[6])
ax2.fill_between(t[np.where(t>=100)],y1inf[np.where(t>=100)], y1[np.where(t>=100)], facecolor=TUBScolorscale[2])
ax2.fill_between(t[np.where(t<400)],y1inf[np.where(t<400)], y2inf[np.where(t<400)], facecolor=TUBScolorscale[6])
ax2.fill_between(t[np.where(t>400)],y2inf[np.where(t>400)], y2[np.where(t>400)], facecolor=TUBScolorscale[2])
# Titles
plt.ylabel('Output')
plt.xlabel('Time [min]')
ax2.grid(True)
#plt.show()
#plt.gcf()
plt.rcParams['svg.fonttype'] = 'none'
plt.savefig("Testing.svg")

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

<matplotlib.figure.Figure at 0x12a6fca26a0>

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

In [20]:

# Make a Scatter Plot of the Gains

trace1 = Scatter(x = T, y = K1,
name ='Fan to Temperature',
mode = 'lines+markers',
line = dict(
color = TUBScolorscale[0],
width = 1
#dash = 'dash'
))
trace2 = Scatter(x = T, y = K2,
name ='Fan to Pressure',
mode = 'lines+markers',
line = dict(
color = TUBScolorscale[1],
width = 1
#dash = 'dash'
))
trace3 = Scatter(x = T, y = K3,
name ='Valve to Temperature',
mode = 'lines+markers',
line = dict(
color = TUBScolorscale[2],
width = 1
#dash = 'dash'
))
trace4 = Scatter(x = T, y = K4, name ='Valve to Pressure', mode = 'lines+markers', line = dict(
color = TUBScolorscale[3],
width = 1
#dash = 'dash'
))

fig = dict(data=[trace1, trace2, trace3, trace4], layout=layout1)
iplot(fig)

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

require(["plotly"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {};window.PLOTLYENV.BASE_URL="https://plot.ly";Plotly.newPlot("905d0c7e-b1a6-4b07-aadc-dde73681766c", [{"type": "scatter", "x": [273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307], "y": [-0.829835641436802, -0.806495199301396, -0.744387658177047, -0.716381695304366, -0.726835149414353, -0.709978920818101, -0.704872451902455, -0.682788916019958, -0.820768987525708, -0.637158562347534, -0.634461516416491, -0.670344865282989, -0.642505972413937, -0.581132027730973, -0.592449363675888, -0.595850278301061, -0.597188012046721, -0.57021629525878, -0.505873636828282, -0.515941179575119, -0.459504345745938, -0.469247697022343, -0.417942296469694, -0.401502970027959, -0.38591309981563, -0.371197768373663, -0.358432279661975, -0.347060230922094, -0.335719590635537, -0.325153942632627, -0.3153672149617, -0.306364275513559, -0.298153024163924, -0.290748000016091, -0.28461417528878], "name": "Fan to Temperature", "mode": "lines+markers", "line": {"color": "rgba(190,30,60,0.9)", "width": 1}}, {"type": "scatter", "x": [273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307], "y": [-0.27621670814219, -0.32355902490357, -0.289784700551471, -0.284152227440004, -0.306935669337381, -0.319340674822474, -0.310552813222756, -0.324517220893903, -0.435805714818454, -0.351150613967042, -0.375129273816895, -0.423767790086874, -0.434143579417144, -0.419240914176561, -0.454171654981594, -0.484593185985669, -0.514139298323615, -0.519418960751795, -0.487227689402722, -0.523002049370937, -0.49055091488057, -0.52524603071534, -0.490652314501639, -0.492754050444542, -0.49409907911055, -0.494774112122534, -0.485708256181886, -0.472664241513762, -0.472434562658509, -0.470661229247068, -0.469483610393652, -0.467097635943158, -0.464741570244042, -0.462115437693416, -0.460213015603997], "name": "Fan to Pressure", "mode": "lines+markers", "line": {"color": "rgba(255,200,42,0.9)", "width": 1}}, {"type": "scatter", "x": [273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307], "y": [2.0279890132632, 2.14223362644146, 2.20065248732365, 2.28810429704094, 2.33757380253721, 2.3652548062328, 2.40982730917736, 2.42310494944656, 2.70511894912115, 2.51529142076934, 2.45226655287607, 2.4261376197648, 2.17585874104082, 2.09690290854659, 2.09476344863608, 2.13810723995157, 2.2270432743464, 2.14988096524852, 2.1378187805215, 2.18803806009432, 2.16168061371816, 2.1265803554336, 2.08953793627419, 1.97924420647297, 1.8674444094294, 1.81654281748204, 1.76553868599491, 1.71697786436055, 1.67194099288373, 1.61689773088579, 1.55335394286789, 1.48654867093986, 1.41683574300689, 1.34357126784277, 1.26871870662557], "name": "Valve to Temperature", "mode": "lines+markers", "line": {"color": "rgba(225,109,0,0.9)", "width": 1}}, {"type": "scatter", "x": [273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307], "y": [-5.20451826833573, -5.0341043114111, -4.87727836232658, -5.04304992924588, -5.52710460965499, -6.02636809887318, -6.50617778182847, -6.98749336490416, -7.29057984134678, -7.89469834088339, -8.37437781159704, -8.87936415246093, -9.47519534892862, -9.92604174009479, -10.2912963392697, -10.5856209095801, -10.8053166753468, -11.1409111404754, -11.3851782907328, -11.5293547994291, -11.7189191591455, -11.8752164756149, -12.0008888940291, -12.1833187231152, -12.3371345017224, -12.3880883377558, -12.4759848307066, -12.6888797321087, -12.903000169169, -13.1015914459336, -13.1800572049897, -13.2487886844202, -13.340763517003, -13.4373420632064, -13.522524909929], "name": "Valve to Pressure", "mode": "lines+markers", "line": {"color": "rgba(172,193,58,0.9)", "width": 1}}], {"autosize": false, "width": 600, "height": 400, "font": {"family": "Nexus"}, "yaxis": {"zeroline": false, "title": "System Gain", "autotick": true, "ticks": "outside", "showgrid": true}, "xaxis": {"zeroline": false, "title": "Operating points in [K]", "range": [272, 308], "autotick": false, "ticks": "outside", "tick0": 273, "dtick": 2, "showgrid": true}, "legend": {"orientation": "h", "x": 0.1, "y": 1.3, "traceorder": "normal", "font": {"family": "Nexus", "size": 12, "color": "#000"}}}, {"showLink": true, "linkText": "Export to plot.ly"})});

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

In [21]:

# Define the Plot Layout
layout2 = dict(autosize = False,
width = width, # approx 20 cm
height = height, # approx 11 cm
font=dict(family='Nexus'), # TUBS Font
# Change here for title etc
yaxis = dict(
zeroline = False,
title = 'System Time Constant [s]',
#range = [1.2,1.35],
autotick = True,
ticks='outside',
#tick0 = 1.2,
#dtick = 0.05,
showgrid = True              ),

xaxis = dict(
zeroline = False,
title = 'Operating points in [K]',
range = [272,308],
autotick = False,
ticks='outside',
tick0 = 273,
dtick = 2,
showgrid = True
),

legend=dict(
x = 0,
y = 1.3,
orientation = "h",
traceorder='normal',
font=dict(
family='Nexus',
size=FontSize,
color='#000'
)
)
)

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

In [22]:

# Make a Scatter Plot of the Time Constants

trace1 = Scatter(x = T, y = T1,
name ='Fan to Temperature',
mode = 'lines+markers',
line = dict(
color = TUBScolorscale[0],
width = 1
#dash = 'dash'
))
trace2 = Scatter(x = T, y = T2,
name ='Fan to Pressure',
mode = 'lines+markers',
line = dict(
color = TUBScolorscale[1],
width = 1
#dash = 'dash'
))
trace3 = Scatter(x = T, y = T3,
name ='Valve to Temperature',
mode = 'lines+markers',
line = dict(
color = TUBScolorscale[2],
width = 1
#dash = 'dash'
))
trace4 = Scatter(x = T, y = T4,
name ='Valve to Pressure',
mode = 'lines+markers', line = dict(
color = TUBScolorscale[3],
width = 1
#dash = 'dash'
))

fig = dict(data=[trace1, trace2, trace3, trace4], layout=layout2)
iplot(fig)

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

require(["plotly"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {};window.PLOTLYENV.BASE_URL="https://plot.ly";Plotly.newPlot("123fff9e-b539-4e4b-8ab2-d758e0b41175", [{"type": "scatter", "x": [273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307], "y": [47.9035296275667, 46.7463448109714, 49.8604306113172, 50.7266096606338, 51.7148812812544, 46.7778746509423, 51.6834879022248, 48.7618803735529, 57.8728812981956, 49.0828482588134, 49.30176362308, 46.5793735658429, 46.5276121361522, 48.1121110142868, 49.3257645488757, 47.9350896306851, 47.1160069088098, 58.581188875801, 47.8980722630165, 46.8658004488742, 47.8830929322517, 45.8827781457892, 47.6741265254397, 47.5610265189872, 47.295979902842, 47.1892689417372, 46.7626548582026, 46.1514913581905, 46.2513695338865, 46.0844266955025, 46.1912271250423, 46.0232383319722, 46.0662954597737, 46.1145746064717, 46.188541112263], "name": "Fan to Temperature", "mode": "lines+markers", "line": {"color": "rgba(190,30,60,0.9)", "width": 1}}, {"type": "scatter", "x": [273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307], "y": [15.6110167061873, 16.8791238504673, 17.2281313178052, 17.813187552019, 18.0715741422302, 17.3038318874239, 20.1998687146472, 20.586497867862, 14.9017843569146, 26.1696186816844, 27.7158612302008, 29.0029984698591, 33.5889418713138, 37.4048178719535, 36.6190334912906, 36.0754260697075, 37.8199401065323, 55.4573352034252, 42.3266799666646, 42.8406014475276, 45.1844282467524, 45.7376353235942, 47.5169573619856, 48.2091542039371, 49.1261251055546, 49.7275217849684, 55.0177544083291, 59.9979195381236, 61.1906131148421, 61.4098319550019, 62.4867346461123, 62.8270748327562, 63.6911230624626, 64.119961192551, 64.8728750697795], "name": "Fan to Pressure", "mode": "lines+markers", "line": {"color": "rgba(255,200,42,0.9)", "width": 1}}, {"type": "scatter", "x": [273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307], "y": [22.3761499331933, 24.4349032311563, 23.5424887022069, 25.0141488460017, 24.7109508503818, 24.025488091476, 23.7482200791398, 23.9150275337852, 23.5283702587747, 23.3905248709868, 22.0443978516889, 21.5804977531961, 18.7188357088537, 19.1211624021147, 19.1570503594574, 18.6169427437654, 18.5336018696262, 18.7497539641339, 18.5342673361878, 18.3388500793095, 17.7536785723366, 18.0880198943806, 17.759550628947, 17.3439450415158, 16.6926547740873, 16.3194133575213, 15.9935579981651, 15.7971551550135, 16.0887516812156, 16.2030243972463, 14.8629896262849, 12.7421797676498, 11.4672216955894, 10.8486952670843, 10.0598737917946], "name": "Valve to Temperature", "mode": "lines+markers", "line": {"color": "rgba(225,109,0,0.9)", "width": 1}}, {"type": "scatter", "x": [273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307], "y": [31.0048388357324, 32.0777161840674, 32.4956127032344, 33.8682892890484, 32.5282468214193, 31.947722062068, 31.4412186108588, 31.4384819085525, 27.9052548917644, 32.8142109366239, 31.8957346227481, 29.9354387952343, 27.3585903311724, 26.6160388065281, 26.4994909089322, 26.3606119580451, 26.0608604641577, 25.7361109266963, 25.3724441056549, 24.9263075658796, 24.4687398763792, 24.0156232295069, 23.4948432622105, 23.0128188416147, 22.4208600271868, 21.9002590437045, 21.0594902801203, 19.7137263872305, 18.6256560260401, 17.9146748000349, 17.5957660860003, 17.2084508562615, 16.9939333386471, 16.8408502128308, 16.6533065132514], "name": "Valve to Pressure", "mode": "lines+markers", "line": {"color": "rgba(172,193,58,0.9)", "width": 1}}], {"autosize": false, "width": 600, "height": 400, "font": {"family": "Nexus"}, "yaxis": {"zeroline": false, "title": "System Time Constant [s]", "autotick": true, "ticks": "outside", "showgrid": true}, "xaxis": {"zeroline": false, "title": "Operating points in [K]", "range": [272, 308], "autotick": false, "ticks": "outside", "tick0": 273, "dtick": 2, "showgrid": true}, "legend": {"x": 0, "y": 1.3, "orientation": "h", "traceorder": "normal", "font": {"family": "Nexus", "size": 12, "color": "#000"}}}, {"showLink": true, "linkText": "Export to plot.ly"})});

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

In [27]:

# Define the Plot Layout
layout3 = dict(autosize = False,
width = width,
height = height,
font=dict(family='Nexus', size = FontSize), # TUBS Font
# Change here for title etc
yaxis = dict(
zeroline = False,
title = 'System Time Delay [s]',
#range = [1.2,1.35],
autotick = True,
ticks='outside',
#tick0 = 1.2,
#dtick = 0.05,
showgrid = True              ),

xaxis = dict(
zeroline = False,
title = 'Operating points in [K]',
range = [272,308],
autotick = False,
ticks='outside',
tick0 = 273,
dtick = 2,
showgrid = True
),

legend=dict(
x = 0,
y = 1.3,
orientation = "h",
traceorder='normal',
font=dict(
family='Nexus',
size=FontSize,
color='#000'
)
)
)

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

In [28]:

# Make a Scatter Plot of the Time Delays

trace1 = Scatter(x = T, y = L1,
name ='Fan to Temperature',
mode = 'lines+markers',
line = dict(
color = TUBScolorscale[0],
width = 1
#dash = 'dash'
))
trace2 = Scatter(x = T, y = L2,
name ='Fan to Pressure',
mode = 'lines+markers',
line = dict(
color = TUBScolorscale[1],
width = 1
#dash = 'dash'
))
trace3 = Scatter(x = T, y = L3,
name ='Valve to Temperature',
mode = 'lines+markers',
line = dict(
color = TUBScolorscale[2],
width = 1
#dash = 'dash'
))
trace4 = Scatter(x = T, y = L4,
name ='Valve to Pressure',
mode = 'lines+markers', line = dict(
color = TUBScolorscale[3],
width = 1
#dash = 'dash'
))

fig = dict(data=[trace1, trace2, trace3, trace4], layout=layout3)
iplot(fig)

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

require(["plotly"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {};window.PLOTLYENV.BASE_URL="https://plot.ly";Plotly.newPlot("6ecf9fc1-e539-4e89-a888-a9cbdd1884ec", [{"type": "scatter", "x": [273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307], "y": [18.8475983278214, 20.5553026289689, 18.5307614228446, 18.1347254302408, 18.2932620713479, 19.8874905938738, 12.6099753639028, 17.4210071400365, 2.0, 16.9331506224647, 16.7587167181105, 17.4328616402766, 18.9760354197053, 16.0894484447287, 16.4409111110795, 16.3283219984773, 14.2767824313738, 13.537183545854, 15.3104307513708, 13.2762120131555, 14.7219414904043, 14.4790019686006, 14.2238719824945, 13.9598591017028, 13.7631934086124, 13.50640830387, 13.4790908108114, 13.5182631626768, 13.2238565514691, 13.0479567938084, 12.7694394100773, 12.6139520363818, 12.3885148003645, 12.1648920134171, 11.9399010104241], "name": "Fan to Temperature", "mode": "lines+markers", "line": {"color": "rgba(190,30,60,0.9)", "width": 1}}, {"type": "scatter", "x": [273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307], "y": [10.3494724465511, 11.1997110423483, 11.0223455408645, 10.9103099316776, 11.098550409737, 11.3133233061621, 8.24941021827641, 10.4362055843811, 3.63516110977164, 9.44504781261732, 9.29363440340172, 10.2947643360683, 8.57847727735118, 6.36947030585982, 7.29797754421413, 6.51443985594774, 6.89021925802842, 2.0, 5.42147405547557, 6.5983316834995, 5.17814308139657, 6.99265695369397, 5.07705074449917, 5.23456955893887, 5.26673377683352, 5.41306866909812, 3.18169230603122, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0], "name": "Fan to Pressure", "mode": "lines+markers", "line": {"color": "rgba(255,200,42,0.9)", "width": 1}}, {"type": "scatter", "x": [273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307], "y": [9.14819785048904, 8.05297108763758, 8.36111451823263, 7.95834075802227, 8.12111519803224, 8.23896759677983, 8.05184753245656, 8.36031757122367, 8.13558259076072, 8.87832313799917, 9.73013087877858, 8.28753215774426, 8.21206144350905, 7.48201090652571, 7.84243464140517, 8.79234630340341, 8.36377464159083, 7.88362990947068, 7.91726433229718, 7.09209039929266, 8.30847570611604, 6.67536724645242, 6.7917998678514, 7.72863466640035, 9.15035265531881, 9.20947648088958, 9.27416126819082, 9.33703635737823, 9.21103439891924, 9.16935537347059, 9.59721602653471, 10.2785516549732, 10.6113024152502, 10.7421719694376, 10.9008217941722], "name": "Valve to Temperature", "mode": "lines+markers", "line": {"color": "rgba(225,109,0,0.9)", "width": 1}}, {"type": "scatter", "x": [273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307], "y": [7.34247129892932, 7.84907997405605, 8.36760074917358, 8.11208031842455, 8.49668537640088, 8.59573302485388, 8.65243990534792, 8.86287160430413, 13.0294945241313, 8.50412335851446, 8.31222078642086, 9.35071499169382, 9.74522569019243, 8.51511440005091, 7.81822838093208, 7.51344692191876, 7.36265568515183, 7.28243868136049, 7.14397417249326, 7.0196060444475, 6.75954246665339, 6.68855313328854, 6.56005005745304, 6.40009678004456, 6.28460574363957, 6.16475560558943, 6.23397383951971, 6.72396986625912, 7.12128750750078, 7.30274359029534, 7.2441542382675, 7.21828747765384, 7.16747613736278, 7.11302522141245, 7.06737623759848], "name": "Valve to Pressure", "mode": "lines+markers", "line": {"color": "rgba(172,193,58,0.9)", "width": 1}}], {"autosize": false, "width": 600, "height": 400, "font": {"family": "Nexus", "size": 12}, "yaxis": {"zeroline": false, "title": "System Time Delay [s]", "autotick": true, "ticks": "outside", "showgrid": true}, "xaxis": {"zeroline": false, "title": "Operating points in [K]", "range": [272, 308], "autotick": false, "ticks": "outside", "tick0": 273, "dtick": 2, "showgrid": true}, "legend": {"x": 0, "y": 1.3, "orientation": "h", "traceorder": "normal", "font": {"family": "Nexus", "size": 12, "color": "#000"}}}, {"showLink": true, "linkText": "Export to plot.ly"})});

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

In [29]:

# Define the Plot Layout
layout4 = dict(autosize = False,
width = width,
height = height,
font=dict(family='Nexus'), # TUBS Font
# Change here for title etc
yaxis = dict(
zeroline = False,
title = 'System Coupling',
#range = [1.2,1.35],
autotick = True,
ticks='outside',
#tick0 = 1.2,
#dtick = 0.05,
showgrid = True              ),

xaxis = dict(
zeroline = False,
title = 'Operating points in [K]',
range = [272,308],
autotick = False,
ticks='outside',
tick0 = 273,
dtick = 2,
showgrid = True
),

legend=dict(
x = 0,
y = 1.3,
orientation = "h",
traceorder='normal',
font=dict(
family='Nexus',
size=12,
color='#000'
)
)
)

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

In [41]:

# Make a Scatter Plot of the Couplings

trace1 = Scatter(x = T, y = K2*(L1+T1-L2-T2),
line = dict(
color = TUBScolorscale[0],
width = 1
#dash = 'dash'
),
name ='Valve to Temperature',
mode = 'lines+markers')
trace2 = Scatter(x = T, y = K3*(L4+T4-L3-T3),
line = dict(
color = TUBScolorscale[1],
width = 1
#dash = 'dash'
),
name ='Fan to Pressure',
mode = 'lines+markers')

fig = dict(data=[trace1, trace2], layout=layout4)
iplot(fig)

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

require(["plotly"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {};window.PLOTLYENV.BASE_URL="https://plot.ly";Plotly.newPlot("0c4160e4-c8af-4846-aaa8-ebdcd1d37ec8", [{"type": "scatter", "x": [273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307], "y": [-11.267055973084982, -12.690894981723181, -11.632165127051866, -11.405255960704789, -12.534644634985481, -12.15034107354706, -11.131512282351538, -11.410085217706207, -18.014437062740683, -10.675446533102878, -10.8978747970232, -10.473197352192447, -10.131273730794595, -8.563947886063813, -9.923498343279464, -10.502852564068538, -8.577195669859252, -7.6152207154363065, -7.5327101168522725, -5.597732424694076, -6.005551471402038, -4.008408694890031, -4.565024424572201, -3.98005422153402, -3.2938198204630225, -2.748513135048153, -0.9919614638669316, 1.1004403520003219, 1.7552772463825517, 2.013229152903112, 2.594398408030083, 2.891280400083551, 3.363015374529305, 3.623213581178646, 4.024301856328337], "line": {"color": "rgba(190,30,60,0.9)", "width": 1}, "name": "Valve to Temperature", "mode": "lines+markers"}, {"type": "scatter", "x": [273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307], "y": [13.836892685694632, 15.93590850868156, 19.716988542431782, 20.61096894312078, 19.15142927854569, 19.58194311849334, 19.986121853075034, 19.447860697355615, 25.07860746510849, 22.762095217928923, 20.681010170312362, 22.849664643138997, 22.134834443017283, 17.882345852014303, 15.32996969715603, 13.822371184119604, 14.533995388459347, 13.727346272455879, 12.965628495871314, 14.255009172706053, 11.16751888518779, 12.633565655196941, 11.49986151228626, 8.590584711422617, 5.345481826909819, 4.606979309447605, 3.576530906428144, 2.238088786554102, 0.7476208766230527, -0.2505567043221075, 0.5898312820588332, 2.0900977053138843, 2.9511064339592097, 3.1748699201353348, 3.501647346133638], "line": {"color": "rgba(255,200,42,0.9)", "width": 1}, "name": "Fan to Pressure", "mode": "lines+markers"}], {"autosize": false, "width": 600, "height": 400, "font": {"family": "Nexus"}, "yaxis": {"zeroline": false, "title": "System Coupling", "autotick": true, "ticks": "outside", "showgrid": true}, "xaxis": {"zeroline": false, "title": "Operating points in [K]", "range": [272, 308], "autotick": false, "ticks": "outside", "tick0": 273, "dtick": 2, "showgrid": true}, "legend": {"x": 0, "y": 1.3, "orientation": "h", "traceorder": "normal", "font": {"family": "Nexus", "size": 12, "color": "#000"}}}, {"showLink": true, "linkText": "Export to plot.ly"})});

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

In [33]:

# Make a Scatter Plot of the Couplings - Aström

trace1 = Scatter(x = T, y = (K1*K2/(K1*K4-K2*K3))*(L1+T1-L2-T2), name ='Valve to Temperature', mode = 'lines+markers')
trace2 = Scatter(x = T, y = (K3*K4/(K1*K4-K2*K3))*(L4+T4-L3-T3), name ='Fan to Pressure', mode = 'lines+markers')

fig = dict(data=[trace1, trace2], layout=layout4)
iplot(fig)

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

require(["plotly"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {};window.PLOTLYENV.BASE_URL="https://plot.ly";Plotly.newPlot("e8c8b2c0-a57f-4021-81db-d1ffc56128ef", [{"type": "scatter", "x": [273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307], "y": [1.9163130078464454, 2.1533531477694017, 2.028638484173128, 1.9166485184209052, 1.9241913747649477, 1.7136728906070904, 1.4708852490443416, 1.40187653166294, 2.0642368580566717, 1.1502567512090551, 1.1092779939438906, 1.005773191069937, 0.9256167119018147, 0.7486759142287575, 0.8341077566673936, 0.8521929240501254, 0.6741672075814905, 0.5813468915990583, 0.5602944350895032, 0.40718667155220767, 0.4281528061861805, 0.2811818263363967, 0.315832382002701, 0.27237524879158337, 0.22364196188546126, 0.1855927112431709, 0.06671586272438129, -0.07322967430353375, -0.11505634961011253, -0.13037313390152147, -0.16746138122221998, -0.18635085097621457, -0.2162817246331165, -0.23266269777296217, -0.25839861736458564], "name": "Valve to Temperature", "mode": "lines+markers"}, {"type": "scatter", "x": [273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307], "y": [-14.759886636833759, -16.877971945369783, -22.53009714415719, -24.382859598461177, -22.35626205583242, -23.44258193665031, -24.376342443165118, -24.452747229647198, -25.526036322860392, -30.388481098853816, -27.785460373630702, -29.065927010597832, -29.823212241282057, -26.702112524982702, -22.38295911005377, -19.924727780695314, -20.66967950659689, -20.474840844226925, -21.704831409337906, -23.17147775923122, -20.304884908374895, -22.427485209598487, -22.845635896452897, -17.839316865848694, -11.602861035375398, -10.381934826400197, -8.372670718134225, -5.445231352052227, -1.8834769348411646, 0.6537865029718969, -1.5911332600922423, -5.825669035276901, -8.49214324498397, -9.422266787009635, -10.682509949723105], "name": "Fan to Pressure", "mode": "lines+markers"}], {"autosize": false, "width": 600, "height": 400, "font": {"family": "Nexus"}, "yaxis": {"zeroline": false, "title": "System Coupling", "autotick": true, "ticks": "outside", "showgrid": true}, "xaxis": {"zeroline": false, "title": "Operating points in [K]", "range": [272, 308], "autotick": false, "ticks": "outside", "tick0": 273, "dtick": 2, "showgrid": true}, "legend": {"x": 0, "y": 1.3, "orientation": "h", "traceorder": "normal", "font": {"family": "Nexus", "size": 12, "color": "#000"}}}, {"showLink": true, "linkText": "Export to plot.ly"})});

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

In [34]:

# Define the Plot Layout
layout5 = dict(autosize = False,
width = width,
height = height,
font=dict(family='Nexus'), # TUBS Font
# Change here for title etc
yaxis = dict(
zeroline = False,
title = 'Controller Gain',
#range = [1.2,1.35],
autotick = True,
ticks='outside',
#tick0 = 1.2,
#dtick = 0.05,
showgrid = True              ),

xaxis = dict(
zeroline = False,
title = 'Operating points in [K]',
range = [272,308],
autotick = False,
ticks='outside',
tick0 = 273,
dtick = 2,
showgrid = True
),

legend=dict(
x = 0,
y = 1.3,
orientation = "h",
traceorder='normal',
font=dict(
family='Nexus',
size=12,
color='#000'
)
)
)

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

In [35]:

# Define the controller proportional and integral gain

P1 = 0.15/K1 + (0.35 - (L1*T1)/(L1+T1)**2)*T1/K1/L1
P2 = 0.15/K4 + (0.35 - (L4*T4)/(L4+T4)**2)*T4/K4/L4
I1 = 0.35*L1+13*L1*T1**2/(T1**2+12*L1*T1+7*L1**2)
I2 = 0.35*L4+13*L4*T4**2/(T4**2+12*L4*T4+7*L4**2)

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

In [36]:

# Make a scatter plot of the controller variables

trace1 = Scatter(x = T, y = P1, name ='Valve Controller', mode = 'lines+markers')
trace2 = Scatter(x = T, y = P2, name ='Fan Controller', mode = 'lines+markers')

fig = dict(data=[trace1, trace2], layout=layout5)
iplot(fig)

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

require(["plotly"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {};window.PLOTLYENV.BASE_URL="https://plot.ly";Plotly.newPlot("8eaa5480-df4a-457a-a29c-328da29b55d4", [{"type": "scatter", "x": [273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307], "y": [-0.6321206539765607, -0.5747342144728088, -0.7526041176764473, -0.8185186365071936, -0.8169278534149447, -0.67732513401357, -1.3311801627822624, -0.8594495693430408, -11.38377149297886, -0.9600866720364796, -0.9814116054347362, -0.8289478493038547, -0.7838617475430112, -1.092718238574731, -1.0761210740380749, -1.0423851263350814, -1.1990898420388318, -1.7621055244818264, -1.3258886810645811, -1.508478612057686, -1.530753625377881, -1.4519505021532664, -1.7463634981343708, -1.854981034560081, -1.950568706905813, -2.070002411953162, -2.1250366419295657, -2.151444506286416, -2.291787903075766, -2.3951681372859404, -2.5440510711123845, -2.6470791413364676, -2.7851956382118375, -2.925815179071669, -3.0657863231048257], "name": "Valve Controller", "mode": "lines+markers"}, {"type": "scatter", "x": [273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307], "y": [-0.18718710730343457, -0.1857155542581506, -0.17978003951346883, -0.19043944801047563, -0.15582241844933745, -0.1377147293480615, -0.12401576055619065, -0.11205613054006963, -0.05964937629156089, -0.11017466669376293, -0.10314166954365553, -0.07769384220175643, -0.062151301702431425, -0.0675014535392528, -0.0719096824345234, -0.07296438448819718, -0.07227022757640629, -0.06995529357331776, -0.06887840277873303, -0.06800202455914776, -0.0685231150353522, -0.06693924195327958, -0.06603034613210361, -0.06536286071336112, -0.06392007366645534, -0.06332229440550528, -0.0590738923979857, -0.04887197497255761, -0.04201318327041292, -0.038462462831651764, -0.03781115829984991, -0.036840582367202744, -0.03636530829865493, -0.03604720749320689, -0.03563247784254916], "name": "Fan Controller", "mode": "lines+markers"}], {"autosize": false, "width": 600, "height": 400, "font": {"family": "Nexus"}, "yaxis": {"zeroline": false, "title": "Controller Gain", "autotick": true, "ticks": "outside", "showgrid": true}, "xaxis": {"zeroline": false, "title": "Operating points in [K]", "range": [272, 308], "autotick": false, "ticks": "outside", "tick0": 273, "dtick": 2, "showgrid": true}, "legend": {"x": 0, "y": 1.3, "orientation": "h", "traceorder": "normal", "font": {"family": "Nexus", "size": 12, "color": "#000"}}}, {"showLink": true, "linkText": "Export to plot.ly"})});

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

In [37]:

# Make a Scatter Plot of the Couplings - Aström

trace1 = Scatter(x = T, y = I1, name ='Valve Controller', mode = 'lines+markers')
trace2 = Scatter(x = T, y = I2, name ='Fan Controller', mode = 'lines+markers')

fig = dict(data=[trace1, trace2], layout=layout5)
iplot(fig)

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

require(["plotly"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {};window.PLOTLYENV.BASE_URL="https://plot.ly";Plotly.newPlot("4fdfb275-c823-4921-9c70-8b04306f561f", [{"type": "scatter", "x": [273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307], "y": [42.60233821312563, 42.21596561625768, 43.96992767781319, 44.466069009932916, 45.256523639363635, 42.054507607759305, 42.14605583736216, 42.73944794754057, 18.97046139737265, 42.78077450384124, 42.86754736080158, 41.1200241495545, 41.59076718959833, 41.719831878889124, 42.74855483764707, 41.69361477986372, 40.155494058941414, 47.17628282880543, 41.21466604535984, 39.43536949844217, 40.91776374547726, 39.39153372961291, 40.5148707379562, 40.29472138080461, 40.004719766410226, 39.78740255790105, 39.48150418675926, 39.085272270287746, 38.98855255255856, 38.77386231157624, 38.680237748665064, 38.472902523931694, 38.3603581576946, 38.24744021594794, 38.145078182589074], "name": "Valve Controller", "mode": "lines+markers"}, {"type": "scatter", "x": [273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307], "y": [25.11204208792362, 26.17519909328799, 26.814387115421884, 27.502897743924013, 26.92307933899063, 26.60613654756414, 26.304674269028933, 26.4288566624089, 25.396943399287366, 27.11444863333988, 26.386653372964805, 25.653813394189978, 23.968346562371547, 22.905675750429673, 22.472825922753408, 22.20780703123895, 21.91738945736779, 21.650999681001153, 21.32425062563011, 20.950028835180543, 20.487067420993803, 20.140369907603276, 19.713509338151837, 19.293884347819333, 18.826892717623252, 18.40512947127325, 17.87063791126117, 17.15055967099292, 16.495202783599304, 16.012701199472687, 15.7494172836137, 15.442495458015435, 15.261414713014696, 15.12687091114097, 14.96809607925888], "name": "Fan Controller", "mode": "lines+markers"}], {"autosize": false, "width": 600, "height": 400, "font": {"family": "Nexus"}, "yaxis": {"zeroline": false, "title": "Controller Gain", "autotick": true, "ticks": "outside", "showgrid": true}, "xaxis": {"zeroline": false, "title": "Operating points in [K]", "range": [272, 308], "autotick": false, "ticks": "outside", "tick0": 273, "dtick": 2, "showgrid": true}, "legend": {"x": 0, "y": 1.3, "orientation": "h", "traceorder": "normal", "font": {"family": "Nexus", "size": 12, "color": "#000"}}}, {"showLink": true, "linkText": "Export to plot.ly"})});

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

In [42]:

len(T)

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

Out[42]:

35

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

In [ ]:

``````