<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://fbswiki.org/wiki/index.php?action=history&amp;feed=atom&amp;title=Figure_3.22%3A_Queuing_dynamics</id>
	<title>Figure 3.22: Queuing dynamics - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://fbswiki.org/wiki/index.php?action=history&amp;feed=atom&amp;title=Figure_3.22%3A_Queuing_dynamics"/>
	<link rel="alternate" type="text/html" href="http://fbswiki.org/wiki/index.php?title=Figure_3.22:_Queuing_dynamics&amp;action=history"/>
	<updated>2026-04-24T21:40:31Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>http://fbswiki.org/wiki/index.php?title=Figure_3.22:_Queuing_dynamics&amp;diff=1273&amp;oldid=prev</id>
		<title>Murray at 18:46, 16 November 2024</title>
		<link rel="alternate" type="text/html" href="http://fbswiki.org/wiki/index.php?title=Figure_3.22:_Queuing_dynamics&amp;diff=1273&amp;oldid=prev"/>
		<updated>2024-11-16T18:46:56Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 18:46, 16 November 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l42&quot; &gt;Line 42:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 42:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Create I/O system representation&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Create I/O system representation&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;queuing_sys = ct.&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;NonlinearIOSystem&lt;/del&gt;(&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;queuing_sys = ct.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;nlsys&lt;/ins&gt;(&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     updfcn=queuing_model, inputs=1, outputs=1, states=1)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     updfcn=queuing_model, inputs=1, outputs=1, states=1)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Murray</name></author>
	</entry>
	<entry>
		<id>http://fbswiki.org/wiki/index.php?title=Figure_3.22:_Queuing_dynamics&amp;diff=964&amp;oldid=prev</id>
		<title>Murray at 16:36, 28 May 2023</title>
		<link rel="alternate" type="text/html" href="http://fbswiki.org/wiki/index.php?title=Figure_3.22:_Queuing_dynamics&amp;diff=964&amp;oldid=prev"/>
		<updated>2023-05-28T16:36:10Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 16:36, 28 May 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Figure&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Figure&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|Chapter=System Modeling&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|Chapter=System Modeling&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|Figure number=22&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|Figure number=&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;3.&lt;/ins&gt;22&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;|Sort key=322&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|Figure title=Queuing dynamics&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|Figure title=Queuing dynamics&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|GitHub URL=https://github.com/murrayrm/fbs2e-python/blob/main/example-3.15-queuing_systems.py&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|GitHub URL=https://github.com/murrayrm/fbs2e-python/blob/main/example-3.15-queuing_systems.py&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Murray</name></author>
	</entry>
	<entry>
		<id>http://fbswiki.org/wiki/index.php?title=Figure_3.22:_Queuing_dynamics&amp;diff=743&amp;oldid=prev</id>
		<title>Murray: Created page with &quot;{{Figure |Chapter=System Modeling |Figure number=22 |Figure title=Queuing dynamics |GitHub URL=https://github.com/murrayrm/fbs2e-python/blob/main/example-3.15-queuing_systems....&quot;</title>
		<link rel="alternate" type="text/html" href="http://fbswiki.org/wiki/index.php?title=Figure_3.22:_Queuing_dynamics&amp;diff=743&amp;oldid=prev"/>
		<updated>2021-08-30T05:32:05Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{Figure |Chapter=System Modeling |Figure number=22 |Figure title=Queuing dynamics |GitHub URL=https://github.com/murrayrm/fbs2e-python/blob/main/example-3.15-queuing_systems....&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Figure&lt;br /&gt;
|Chapter=System Modeling&lt;br /&gt;
|Figure number=22&lt;br /&gt;
|Figure title=Queuing dynamics&lt;br /&gt;
|GitHub URL=https://github.com/murrayrm/fbs2e-python/blob/main/example-3.15-queuing_systems.py&lt;br /&gt;
}}&lt;br /&gt;
[[Image:figure-3.22-queuing_dynamics.png|640px]]&lt;br /&gt;
&lt;br /&gt;
'''Figure 3.22:''' Queuing dynamics. (a) The steady-state queue length as a function of &amp;lt;math&amp;gt;\lambda/\mu_\text{max}&amp;lt;/math&amp;gt;. (b) The behavior of the queue length when there is a temporary overload in the system. The solid line shows a realization of an event-based simulation, and the dashed line shows the behavior of the flow model (3.33). The maximum service rate is &amp;lt;math&amp;gt;\mu_{max} = 1&amp;lt;/math&amp;gt;, and the arrival rate starts at &amp;lt;math&amp;gt;\lambda = 0.5&amp;lt;/math&amp;gt;. The arrival rate is increased to &amp;lt;math&amp;gt;\lambda = 4&amp;lt;/math&amp;gt; at time 20, and it returns to &amp;lt;math&amp;gt;\lambda =0.5&amp;lt;/math&amp;gt; at # time 25.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
# example-3.15-queuing_systems.py - Queuing system modeling&lt;br /&gt;
# RMM, 29 Aug 2021&lt;br /&gt;
#&lt;br /&gt;
# Figure 3.22: Queuing dynamics. (a) The steady-state queue length as a&lt;br /&gt;
# function of $\lambda/\mu_{max}$. (b) The behavior of the queue length when&lt;br /&gt;
# there is a temporary overload in the system. The solid line shows a&lt;br /&gt;
# realization of an event-based simulation, and the dashed line shows the&lt;br /&gt;
# behavior of the flow model (3.33). The maximum service rate is $\mu_{max}&lt;br /&gt;
# = 1$, and the arrival rate starts at $\lambda = 0.5$. The arrival rate is&lt;br /&gt;
# increased to $\lambda = 4$ at time 20, and it returns to $\lambda =0.5$ at&lt;br /&gt;
# time 25.&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
import control as ct&lt;br /&gt;
import numpy as np&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
&lt;br /&gt;
# Queing parameters &lt;br /&gt;
&lt;br /&gt;
# Queuing system model (KJA, 2006)&lt;br /&gt;
def queuing_model(t, x, u, params={}):&lt;br /&gt;
    # Define default parameters&lt;br /&gt;
    mu = params.get('mu', 1)&lt;br /&gt;
&lt;br /&gt;
    # Get the current load&lt;br /&gt;
    lambda_ = u&lt;br /&gt;
&lt;br /&gt;
    # Return the change in queue size&lt;br /&gt;
    return np.array(lambda_ - mu * x[0] / (1 + x[0]))&lt;br /&gt;
&lt;br /&gt;
# Create I/O system representation&lt;br /&gt;
queuing_sys = ct.NonlinearIOSystem(&lt;br /&gt;
    updfcn=queuing_model, inputs=1, outputs=1, states=1)&lt;br /&gt;
&lt;br /&gt;
# Set up the plotting grid to match the layout in the book&lt;br /&gt;
fig = plt.figure(constrained_layout=True)&lt;br /&gt;
gs = fig.add_gridspec(3, 2)&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
# (a) The steady-state queue length as a function of $\lambda/\mu_{max}$.&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
fig.add_subplot(gs[0, 0])       # first row, first column&lt;br /&gt;
&lt;br /&gt;
# Steady state queue length&lt;br /&gt;
x = np.linspace(0.01, 0.99, 100)&lt;br /&gt;
plt.plot(x, x / (1 - x), 'b-')&lt;br /&gt;
&lt;br /&gt;
# Label the plot&lt;br /&gt;
plt.xlabel(r&amp;quot;Service rate excess $\lambda/\mu_{max}$&amp;quot;)&lt;br /&gt;
plt.ylabel(r&amp;quot;Queue length $x_{e}$&amp;quot;)&lt;br /&gt;
plt.title(&amp;quot;Steady-state queue length&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
# (b) The behavior of the queue length when there is a temporary overload&lt;br /&gt;
# in the system. The solid line shows a realization of an event-based&lt;br /&gt;
# simulation, and the dashed line shows the behavior of the flow model&lt;br /&gt;
# (3.33). The maximum service rate is $\mu_{max} = 1$, and the arrival&lt;br /&gt;
# rate starts at $\lambda = 0.5$. The arrival rate is increased to $\lambda&lt;br /&gt;
# = 4$ at time 20, and it returns to $\lambda =0.5$ at time 25.&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
fig.add_subplot(gs[0, 1])       # first row, first column&lt;br /&gt;
&lt;br /&gt;
# Construct the loading condition&lt;br /&gt;
t = np.linspace(0, 80, 100)&lt;br /&gt;
&lt;br /&gt;
u =np.ones_like(t) * 0.5&lt;br /&gt;
u[t &amp;lt;= 25] = 4&lt;br /&gt;
u[t &amp;lt; 20] = 0.5&lt;br /&gt;
&lt;br /&gt;
# Simulate the system dynamics&lt;br /&gt;
response = ct.input_output_response(queuing_sys, t, u)&lt;br /&gt;
&lt;br /&gt;
# Plot the results&lt;br /&gt;
plt.plot(response.time, response.outputs, 'b-')&lt;br /&gt;
&lt;br /&gt;
# Label the plot&lt;br /&gt;
plt.xlabel(&amp;quot;Time $t$ [s]&amp;quot;)&lt;br /&gt;
plt.ylabel(r&amp;quot;Queue length $x_{e}$&amp;quot;)&lt;br /&gt;
plt.title(&amp;quot;Overload condition&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Save the figure&lt;br /&gt;
plt.savefig(&amp;quot;figure-3.22-queuing_dynamics.png&amp;quot;, bbox_inches='tight')&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Murray</name></author>
	</entry>
</feed>