tag:blogger.com,1999:blog-32072709278984224362024-03-25T20:08:30.809+01:00AlPacini's SpacePhD in Electronics Engineering. Addicted to sustainability and freedom.Alex Pacinihttp://www.blogger.com/profile/13304951646877405715noreply@blogger.comBlogger27125tag:blogger.com,1999:blog-3207270927898422436.post-57352414809989222342020-08-06T23:20:00.052+02:002021-11-09T19:24:41.837+01:00Matchable Loads from S-Parameters Defined Matching Networks<p>This post compares two different ways for finding the matchable loads <span class="math inline">\(Z_L^{'}\)</span> that provide the desired impedance <span class="math inline">\(Z_G^{*}\)</span> to the generator.</p>
<p>I will show the difference between two approaches, one rigorous and the other approximate, by using a set of S-parameters obtained by a black box network. The only requirement is that the black-box is linear, as the S-parameters requires linearity. For the curious, they are obtained from a binary weighted sweep of a lossy <span class="math inline">\(LL\)</span> network composed of 1024 states in total from <a href="http://www.ae6ty.com/Smith_Charts.html">SimSmith</a>. <a name='more'></a></p>
<p>Note that <span class="math inline">\(Z_G\)</span> does <strong>NOT</strong> generally represent the output impedance of switching amplifiers, or more generally of non-linear amplifiers. It is not possible to define an operating point for a small signal (linear) analysis from the output, as the conditions change during the analysis and therefore a Thevenin equivalent cannot be defined. For example, an ideal class E amplifier has a particular particular optimum load <span class="math inline">\(Z_G^{*}\)</span> where the efficiency is 100%, which would not be possible if there was an internal impedance to conjugate match (it would be 50%).</p>
<hr />
<p>The first method uses the de-embedding matrix, or the matrix that if cascaded with itself will create a transparent block. It is a rigorous and mathematically correct method.</p>
<p>That matrix is obtained by converting the S matrix to a T matrix, or transmission matrix (similar to ABCD or more generally A matrix), inverted, and then converted back to an S matrix. Notice that, by multiplying those two S matrices will not provide an identity matrix as it would by multiplying <span class="math inline">\(\mathrm{T T^{-1} = I}\)</span>, because the cascade of S matrices is not done by multiplying them together due to their definition. For a 2x2 network, it will however provide the anti-diagonal identity matrix, where the ones are on the anti-diagonal. Indeed, this will result in a perfectly matched and lossless block, and therefore transparent. There are some works that extend the concept of T matrices (or ABCD) to higher order matrices (2nx2n), they are interesting in some cases, but this will focus on the traditional 2x2 case.</p>
<p>Given <span class="math inline">\(\mathbf{b} = \left[b_1, b_2 \right]^{T}\)</span>, <span class="math inline">\(\mathbf{a} = \left[a_1, a_2 \right]^{T}\)</span> and <span class="math inline">\(\mathbf{b^{'}} = \left[b_2, b_1 \right]^{T}\)</span> and <span class="math inline">\(\mathbf{a^{'}} = \left[a_2, a_1 \right]^{T}\)</span>, by definition of S and T parameters:</p>
<p><span class="math display">\[
\left[
\begin{matrix}
b_1 \\
b_2
\end{matrix}
\right]
=
\underline{{S}}
\left[
\begin{matrix}
a_1\\
a_2
\end{matrix}
\right]
\]</span></p>
<p><span class="math display">\[
\left[
\begin{matrix}
b_1 \\
a_1
\end{matrix}
\right]
=
\underline{T}
\left[
\begin{matrix}
a_2\\
b_2
\end{matrix}
\right]
\]</span> so, the inverse of the T matrix is (or de-embedding matrix with T parameters): <span class="math display">\[
\left[
\begin{matrix}
a_2 \\
b_2
\end{matrix}
\right]
=
\underline{T}^{\,-1}
\left[
\begin{matrix}
b_1\\
a_1
\end{matrix}
\right]
\]</span> which results in (use the definitions of S and T with the swapped terms): <span class="math display">\[
\left[
\begin{matrix}
a_2\\
a_1
\end{matrix}
\right]
=
\underline{\tilde{S}}
\left[
\begin{matrix}
b_2 \\
b_1
\end{matrix}
\right]
\]</span></p>
<p>Therefore, it can be said that: <span class="math display">\[
\mathbf{a^{'}} = \mathrm{t2s}\left(\left(\mathrm{s2t}\left(\underline{S}\right)\right)^{-1}\right) \; \mathbf{b^{'}} = \underline{\tilde{S}} \; \mathbf{b^{'}}
\]</span> where <span class="math inline">\(\mathrm{t2s}\)</span> and <span class="math inline">\(\mathrm{s2t}\)</span> are the operators to covert to the T-parameters and back to the S-parameters, respectively. The mirrored <span class="math inline">\(\mathbf{b^{'}}\)</span> and <span class="math inline">\(\mathbf{a^{'}}\)</span> come from the fact that input and output are reversed by the operation done above.</p>
<p>Now, considering for simplicity that <span class="math inline">\(Z_G^{*} = Z_0\)</span>, so that <span class="math inline">\(b_1 = 0\)</span>, and using the above expression, the load <span class="math inline">\(Z_L^{'}\)</span> can be defined as <span class="math inline">\(\underline{\tilde{S}}_{11}\)</span>. Indeed, <span class="math inline">\(b_2\)</span> is the wave going into <span class="math inline">\(Z_L^{'}\)</span>, or out of the S block, and <span class="math inline">\(a_2\)</span> is the wave reflected out of <span class="math inline">\(Z_L^{'}\)</span>, or into the S block, so: <span class="math display">\[
\Gamma_L^{'} = \frac{a_2}{b_2} = \underline{\tilde{S}}_{11}
\]</span></p>
<p>The efficiency will be defined as: <span class="math display">\[
\mathrm{eff_{inv}}
=
\frac{\mathrm{P_{out}}}{\mathrm{P_{in}}}
=
\frac{\left| b_2 \right|^{2} - \left| a_2 \right|^{2}}{\left| a_1 \right|^{2}}
=
\frac{1 - \left| \tilde{S}_{11} \right|^{\,2}}{\left| \tilde{S}_{21} \right|^{\,2}}
\]</span></p>
<p>The expression above might seem unexpected, as it allows to compute the power delivered on the load without apparently knowing the load, but which is actually known and is <span class="math inline">\(Z_L^{'}\)</span>.</p>
<p>It might be easier to see it the other way around. By using the de-embedding matrix, the source of power is now the load (<span class="math inline">\(Z_L^{'}\)</span>), which delivers <span class="math inline">\(\mathrm{P_{out}}\)</span>, and the load is <span class="math inline">\(Z_G^{*}\)</span> (<span class="math inline">\(Z_0\)</span>, so no reflection to be included) and receives <span class="math inline">\(\mathrm{P_{in}}\)</span>. The result is an efficiency over than one when going from load to generator. Again it might be a strange result, but if one thinks that it is a matrix that de-embedded the original, it must also de-embed the losses, so the efficiency must be the inverse of the one of the original. Using the symbols for the power as above, with the load that generates power (<span class="math inline">\(\mathrm{P_{out}}\)</span>), does the inversion and therefore the efficiency does not need to be inverted again.</p>
<p>In other words, as the de-embedding will compensate the original losses in order to properly de-embed the original matrix, the ratio of the powers is inverted.</p>
<hr />
<p>The second is an approximate method, which is correct only when the matching network is lossless, but it is a good approximation when the losses are small.</p>
<p>It uses the fact that a conjugate match on a section of the network will provide a conjugate match in all the sections. Indeed, without losses, a conjugate match provides the maximum power available from the generator, which means that it must be true in every section, as there are no losses between the sections. It can be proved using the Thevenin theorem. It is also called <em>Everitt’s Theorem</em>. In case that there are losses, this is not mathematically true, as erroneously stated by Walter Maxwell.</p>
<hr />
<p>The analysis is done with python and scikit-rf</p>
<pre class="prettyprint"><code class='lang-python'>%matplotlib inline
#%config InlineBackend.figure_format = 'svg'
import numpy as np
import skrf as rf
import matplotlib.pylab as plt
import glob as glob
from smithplot import SmithAxes
plt.rcParams.update({'figure.dpi': 300})
plt.close('all')
hot = plt.get_cmap('hot')
params = {'legend.fontsize': 10,
'axes.labelsize': 10,
'axes.titlesize': 10,
'xtick.labelsize': 9,
'ytick.labelsize': 9,
'mathtext.fontset': 'stix',
# 'mathtext.fontset': 'cm',
'font.family': 'Times New Roman',
'mathtext.rm': 'serif',
'mathtext.bf': 'serif:bold',
'mathtext.it': 'serif:italic',
'mathtext.sf': 'sans\\-serif',
'grid.color': 'k',
'grid.linestyle': ':',
'grid.linewidth': 0.5,
'axes.xmargin': 0,
# 'axes.ymargin': 0,
'axes.axisbelow': False,
'lines.linewidth': 0.5,
'legend.frameon': False,
# 'pgf.rcfonts': False, # http://matplotlib.org/users/pgf.html
# 'pgf.texsystem': 'pdflatex',
'figure.figsize': [6, 4.8],
# When there are twin axis figures: set them using figsize=(3.6, 2.4)
# when creating the figure
# 'figure.figsize': [3.6, 2.4],
}
plt.rcParams.update(params)
</code></pre>
<p>The following block loads all the networks in a list and for simplicity uses a single frequency of 6.78Mhz, which is an ISM band.</p>
<pre class="prettyprint"><code class='lang-python'>names = sorted(glob.glob("./S2P/*.s2p"))
N_names = [rf.Network(x)['6.78MHz'] for x in names]
</code></pre>
<pre class="prettyprint"><code class='lang-python'>def eff_inv(S):
return (1 - np.abs(S.inv.s[0,0,0])**2)/(np.abs(S.inv.s[0,1,0])**2)
eff_max = np.argmax([eff_inv(x) for x in N_names])
print(f"Max efficiency: {max([eff_inv(x) for x in N_names])} @ {eff_max}")
print(f"{N_names[eff_max]}, Match. Load: {N_names[eff_max].inv.s11.z[0,0,0]}")
eff_min = np.argmin([eff_inv(x) for x in N_names])
print(f"min efficiency: {min([eff_inv(x) for x in N_names])} @ {eff_min}")
print(f"{N_names[eff_min]}, Match. Load: {N_names[eff_min].inv.s11.z[0,0,0]}")
</code></pre>
<pre><code>Max efficiency: 0.9610989764358663 @ 16
2-Port Network: '0_0_11_0', 6780000.0-6780000.0 Hz, 1 pts, z0=[50.+0.j 50.+0.j],
Match. Load: (21.95363882455083+19.32579329596367j)
min efficiency: -1.3983108977772765 @ 951
2-Port Network: '0_7_15_7', 6780000.0-6780000.0 Hz, 1 pts, z0=[50.+0.j 50.+0.j],
Match. Load: (-0.38480054383560236+7.076547636573117j)</code></pre>
<p>Where:</p>
<ul>
<li><code>0_0_11_0.s2p</code>
<pre class="prettyprint"><code>!Created with skrf (http://scikit-rf.org).
# Hz S RI R 50.0
!freq ReS11 ImS11 ReS21 ImS21 ReS12 ImS12 ReS22 ImS22
6780000.0 -0.390350341796875 0.202789306640625 0.16522216796875 -0.85809326171875 0.16552734375 -0.857086181640625 -0.286376953125 -0.3515625
</code></pre></li>
<li><code>0_7_15_7.s2p</code>
<pre class="prettyprint"><code>!Created with skrf (http://scikit-rf.org).
# Hz S RI R 50.0
!freq ReS11 ImS11 ReS21 ImS21 ReS12 ImS12 ReS22 ImS22
6780000.0 -0.87652587890625 -0.42828369140625 -0.05519866943359375 0.13173675537109375 -0.055084228515625 0.1311492919921875 -0.92669677734375 -0.26641845703125
</code></pre></li>
</ul>
<p><code>eff_inv</code> is the efficiency calculated using the de-embedding network.</p>
<p>The minimum of the resulting efficiency is negative and this might seem a bizarre result. However, it means that the matching network in that matching state would be able to match a negative resistance, which is effectively a generator. It technically dissipates all the power delivered by the two generators in the matching network, but that would mathematically still provide a match, albeit a very lossy one. Unless it is a very exotic application, those cases can be safely ignored as they will end up outside the Smith Chart.</p>
<p>By using a RF circuit simulator, like ADS or even SimSmith, it is immediate to verify that with both of the above networks and the respective matched load, the impedance at the generator is perfectly matched. The efficiencies also match.</p>
<hr />
<pre class="prettyprint"><code class='lang-python'>def eff(S):
return np.abs(S.s[0,0,1])**2 / (1 - np.abs(S.s[0,1,1])**2)
eff_max = np.argmax([eff(x) for x in N_names])
print(f"Max efficiency: {max([eff(x) for x in N_names])} @ {eff_max}")
print(f"{N_names[eff_max]}, Match. Load: {np.conj(N_names[eff_max].s22.z[0,0,0])}")
eff_min = np.argmin([eff(x) for x in N_names])
print(f"min efficiency: {min([eff(x) for x in N_names])} @ {eff_min}")
print(f"{N_names[eff_min]}, Match. Load: {np.conj(N_names[eff_min].s22.z[0,0,0])}")
</code></pre>
<pre><code>Max efficiency: 0.9597088223702781 @ 120
2-Port Network: '0_0_9_0', 6780000.0-6780000.0 Hz, 1 pts, z0=[50.+0.j 50.+0.j],
Match. Load: (20.7203287068673+18.174720956555028j)
min efficiency: 0.2880167093064851 @ 951
2-Port Network: '0_7_15_7', 6780000.0-6780000.0 Hz, 1 pts, z0=[50.+0.j 50.+0.j],
Match. Load: (0.9285184032718548+7.042258777529751j)</code></pre>
<p>Where:</p>
<ul>
<li><code>0_0_9_0.s2p</code>
<pre class="prettyprint"><code>!Created with skrf (http://scikit-rf.org).
# Hz S RI R 50.0
!freq ReS11 ImS11 ReS21 ImS21 ReS12 ImS12 ReS22 ImS22
6780000.0 -0.447967529296875 0.110107421875 0.227874755859375 -0.83343505859375 0.22833251953125 -0.83294677734375 -0.326416015625 -0.34088134765625
</code></pre></li>
<li><code>0_7_15_7.s2p</code>
<pre class="prettyprint"><code>!Created with skrf (http://scikit-rf.org).
# Hz S RI R 50.0
!freq ReS11 ImS11 ReS21 ImS21 ReS12 ImS12 ReS22 ImS22
6780000.0 -0.87652587890625 -0.42828369140625 -0.05519866943359375 0.13173675537109375 -0.055084228515625 0.1311492919921875 -0.92669677734375 -0.26641845703125
</code></pre></li>
</ul>
<p><code>eff(s)</code> is defined as the efficiency by looking from load to the generator. This is different from the previous case, as this effectively as powering from the receiver to the transmitter, where the generator is replaced by the desired load <span class="math inline">\(Z_G^{*}\)</span>. Here the desired load is again <span class="math inline">\(Z_0\)</span>, for simplicity.</p>
<p>This is not the correct way to calculate the efficiency, but only an approximation when the losses are small. It will be same when there are no losses of course, as the efficiency is 1. Notice that there is no negative efficiency this time, and this is a wrong result because of the very lossy match in those situations.</p>
<p>I used this method to calculate the efficiency for the single sided conjugate match, only to show the difference between the two methods.</p>
<p>Repeating the same exercise on those two extreme cases, it is easy to verify that the match is not perfect and that the efficiency is different. In the case with low efficiency, the result is completely wrong.</p>
<p>For reference, using the non correct (W. Maxwell) method:</p>
<ul>
<li><code>0_0_9_0.s2p</code> with a load of <code>20.72 + 18.17j</code>, the load at the generator is <code>48.8 - 1.16j</code> (<code>SWR 1.034</code>), which is a sufficiently good match.</li>
<li><code>0_7_15_7.s2p</code> with a load of <code>0.9285 + 7.042j</code>, the load at the generator is <code>9.33 - 10.6j</code> (<code>SWR 5.610</code>), therefore very different from a matched load.</li>
</ul>
<hr />
The following plot shows the entire 1024 different tuner’s configurations:
<pre class="prettyprint"><code class='lang-python'>
fig_S = plt.figure('S', figsize=(5, 10))
ax_S_inv = fig_S.add_subplot(2, 1, 1, projection='smith')
ax_S_inv.set_title("Matchable loads using the de-embedding matrix")
[ax_S_inv.plot(
x.inv.s[0,0,0], datatype=SmithAxes.S_PARAMETER,
marker='.', markersize=5, linewidth=0, color=hot(1- eff_inv(x))
)
for x in N_names];
ax_S = fig_S.add_subplot(2, 1, 2, projection='smith')
ax_S.set_title("Matchable loads using S22*")
[ax_S.plot(
np.conj(x.s[0,1,1]), datatype=SmithAxes.S_PARAMETER,
marker='.', markersize=5, linewidth=0, color=hot(1- eff(x))
)
for x in N_names];
im = ax_S_inv.imshow(np.array([[0,1]]), cmap="hot_r")
im.set_visible(False)
cb_ax = fig_S.add_axes([0.2, 0.52, 0.65, 0.01])
cbar = fig_S.colorbar(im, cax=cb_ax, orientation="horizontal")
</code></pre>
<p><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtEjZNFuNcn4FGk8pfsYrbhphV_x8NafhUeVZYullMy4qcA0zEwRF7TYxz0Lt6SAdf1B28zjnu3bda5YxXEs5NsuYSPAaoCcXjkEqQgxM_1Mtqjb2e7len9IbMCDyvGXP6ySopTNNPpQY/d/smithchart.png"
width="98%"></p>
<p>The plot on top is obtained with the connection of the desired generator load to the de-embedding matrix. The one on the bottom is obtained with <span class="math inline">\(S_{22}^*\)</span>.</p>
<p>As you can see from the following above, the error is more relevant near the extremes of the Smithchart, where the VSWR is high and therefore the losses are also higher. Comparing the two, it is possible to see that high efficiency matches (lower temperature color, black) are almost identical, while low efficiency matches (higher temperature color, up to yellow), are different.</p>
<p>Given the results and the not big additional computational complexity to compute the matchable loads using the correct equations, I believe it is better to always use the de-embedding matrix unless there are good reasons not to do so.</p>
<hr />
If you like it and feel the desire to cite it, you can use the BibTex below:
<pre class="prettyprint"><code>@misc{APacini_MatchableLoads,
author = {Alex Pacini},
title = {{Matchable Loads from S-parameters}},
howpublished = "\url{https://pacinispace.blogspot.com/2020/08/matchable-loads-from-S-parameters.html}",
year = 2020,
}
</code></pre>
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
</script>
<!--
<script type="text/javascript" async src="https://unpkg.com/mathjax@latest/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" async src="https://cdn.jsdelivr.net/npm/mathjax@latest/unpacked/MathJax.min.js?config=TeX-AMS-MML_HTMLorMML"></script>
-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: { equationNumbers: { autoNumber: "AMS" } }
});
</script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/styles/agate.min.css">
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/highlight.min.js"></script>
<script>hljs.highlightAll();</script>Alex Pacinihttp://www.blogger.com/profile/13304951646877405715noreply@blogger.com0123 Iffley Rd, Cowley, Oxford OX4 1EJ, UK51.7457188 -1.24047329.741218513131876 -36.396723 73.750219086868128 33.915777tag:blogger.com,1999:blog-3207270927898422436.post-44066021953152376492020-02-07T10:04:00.002+01:002021-11-09T19:48:39.119+01:00STM32CubeIDE programmer and ST-LINK GDB server on Linux<p>This article discusses how to create a minimal set-up for running a gdb server on Linux using ST tools.</p>
<p>ST provides the STM32CubeIDE, which is an IDE based on Eclipse and designed to include the entire STM32 workflow. I am not super fan of all this super complex and bloated IDEs, as they tend force a fixed development strategy on the user. I therefore tried to look for alternatives. <a name='more'></a></p>
<p>The obvious choice is to use the J-Link from Segger, which is straightforward to use and support tons of different platforms, but commercial licenses are quite expensive.</p>
<p>An open-source option is to use the <a href="https://github.com/blacksphere/blackmagic">Black Magic Probe</a>, which also includes a gdb server and VCOM running directly on the probe. It can be bought from the developer (and support the project) or even flashed into the famous <em>Blue Pill</em> (STM32F103x8) or in the STLink. It can be even used as a software layer on top of the STLinks V2-1, which is the programming boards included in all Nucleo boards, and is a very handy feature. All the reviews are great and it works very well, but does not support thread awareness out of the box, which is sometimes a limiting factor.</p>
<p>There are also many other open alternatives, as OpenOCD, pyOCD and texane/stlink. OpenOCD has tons of features, supports thread awareness but is not always straightforward to use and install. pyOCD is very easy to use and works very well, it is thread aware (at least with FreeRTOS, Zephyr, and some others), but has some bugs with the CMSIS packs and therefore I haven’t managed yet to flash the firmware. You need to use one of the other methods to flash it. I haven’t tried texane/stlink, so I cannot comment on that.</p>
<p>Anyway, if you want to minimize every possible problem and avoid compatibility issues, it is also possible to use tools directly provided by ST, but on the command line and without having to use the entire STM32CubeIDE.</p>
<p>So, as an example, you can flash the firmware using STM32CubeProg and then run the GDB server using pyOCD and have a fully thread aware debugging tool, or just use STM32CubeIDE ST-LINK GDB server if you don’t need thread awareness.</p>
<h2 id="installing-stm32cubeprog">Installing STM32CubeProg</h2>
<p>STM32CubeProg can be downloaded directly from <a href="https://www.st.com/en/development-tools/stm32cubeprog.html">ST Website</a>.</p>
To install it, unzip the downloaded file, and run the installer. Do not create any shortcut or launcher at the end of the installation.
<pre class="prettyprint"><code class='lang-bash'>./SetupSTM32CubeProgrammer*.linux
</code></pre>
After the installation is completed, open the folder in your home. With the default path it should be:
<pre class="prettyprint"><code class='lang-bash'>cd ~/STMicroelectronics/STM32Cube/STM32CubeProgrammer/
</code></pre>
<p>You need to update the <code>udev</code> rules in order to properly enumerate the device. This can be done with:</p>
<pre class="prettyprint"><code class='lang-bash'>sudo cp ./Drivers/rules/*.rules /etc/udev/rules.d/
</code></pre>
<p>If you want to be able to run the command from the cli without having to add the path, you need to add the executable to a folder that is in the <code>PATH</code> variable.</p>
Check with <code>echo ${PATH}</code> if there already is a user folder. It could be <code>~/bin</code> or <code>~/.local/bin</code>. I have both. If not add it to your <code>.bashrc</code> with
<pre class="prettyprint"><code class='lang-bash'>echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc
</code></pre>
Now create the launcher in <code>~/bin</code> with a small bash script to launch the STM32CubeProgrammer and make it executable
<pre class="prettyprint"><code class='lang-bash'>cat << EOF > STM32_Programmer_CLI
#!/bin/bash
cd ~/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/
bash STM32_Programmer.sh "\$@"
EOF
chmod +x STM32_Programmer_CLI
</code></pre>
<p>You should now be able to run it from you cli. If not, try to open a new one or to <code>source ~/.bashrc</code>, as the path needs to be updated.</p>
<p>The manual for STM32CubeProg can be found searching for <code>UM2237</code>.</p>
The following is an example command to flash and verify the hex executable <code>image.hex</code> through SWD.
<pre class="prettyprint"><code class='lang-bash'>STM32_Programmer_CLI -c port=SWD -w $(pwd)/image.hex -v -ob displ -rst
</code></pre>
<h2 id="st-link-gdb-server">ST-LINK GDB server</h2>
<p>The GDB server can be connected by a GDB client compiled for the ARM platform and then used directly or by using a GDB gui, as <a href="https://www.gdbgui.com/">gdbgui</a>.</p>
<h3 id="install-st-link-server">Install ST-LINK server</h3>
<p>The ST-LINK server is an application to share the debug interface of a single ST-LINK board among several host applications, typically a debugging tool and a monitoring tool.</p>
<p>Is is not really mandatory in order to use the GDB server, but it is used for the option <code>-t, --shared</code>. It is therefore optional to install.</p>
It can be downloaded directly <a href="https://www.st.com/en/development-tools/st-link-server.html">from ST</a>. Unpack the archive and simply copy the executable in
<pre class="prettyprint"><code class='lang-bash'>~/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin
</code></pre>
create a symlink from <code>~/bin</code> to the executable above
<pre class="prettyprint"><code class='lang-bash'>cd ~/bin
ln -s ../STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/stlink-server.1.1.1-3 stlink-server
</code></pre>
<p>replace the version (here <code>1.1.1-3</code>) with your version.</p>
<h3 id="install-stm32cubeide-st-link-gdb-server">Install STM32CubeIDE ST-LINK GDB server</h3>
<p>I have not been able to find a standalone gdb server, but it needs to be installed from STM32CubeIDE.</p>
<p>The first step is to download the generic Linux installer for <a href="https://www.st.com/en/development-tools/stm32cubeide.html">STM32CubeIDE from ST website</a> It is quite heavy, around 700Mb at the time of writing. It includes a complete IDE and lot of other software, from openOCD to a patched ARM compiler. Download it in a independent folder, for example in <code>mkdir en.st-stm32cubeide</code>. The ST website requires to accept a license before downloading, therefore it cannot be done using <code>wget</code> (or <code>curl</code>, <code>aria2</code>, …).</p>
The downloaded archive contains a Makeself bash archive that ca be used to install the IDE. It is not required to install it to get the gdb server, but it needs to be uncompressed, which is simply done by running
<pre class="prettyprint"><code class='lang-bash'>unzip en.st-stm32cubeide*
bash st-stm32cubeide* --noexec
cd st-stm32cubeide*.root
tar xvzf st-stm32cubeide*.tar.gz
cd plugins
</code></pre>
<p>You can see that there are tons of plugins available, including the software that we installed in the previous steps. However, I prefer to install them individually as they might be more recent.</p>
The gdb server is included in <code>com.st.stm32cube.ide.mcu.externaltools.stlink-gdb-server.linux64*</code>, and to install it
<pre class="prettyprint"><code class='lang-bash'>cd com.st.stm32cube.ide.mcu.externaltools.stlink-gdb-server.linux64*/tools
cp -r * ~/STMicroelectronics/STM32Cube/STM32CubeProgrammer/ --verbose
cat << EOF > ~/bin/ST-LINK_gdbserver
#!/bin/bash
cd ~/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/
./ST-LINK_gdbserver --verify -c config.txt -cp . "\$@"
EOF
chmod +x ~/bin/ST-LINK_gdbserver
</code></pre>
<p>The entire procedure can be placed in a single script if desired.</p>
To start the gdb server
<pre class="prettyprint"><code class='lang-bash'>ST-LINK_gdbserver
</code></pre>
<p>by default it listens on the port 61234.</p>
Then to start the gbd client, run in another terminal session
<pre class="prettyprint"><code class='lang-bash'>arm-none-eabi-gdb <program.elf>
</code></pre>
<p>Consider that the gdb client shall be compiled for cross debugging. The arm gcc toolchain in the plugins or the gcc toolchain that can be downloaded from ARM’s website are already compiled with proper flags.</p>
Once the gdb client has started, connect to the server by issuing
<pre class="prettyprint"><code class='lang-bash'>target extended-remote localhost:61234
</code></pre>
<p>For more example and help, please refer to the <code>ST-LINK_gdbserver</code> manual that can be found searching <code>UM2576</code></p>
<p>I hope your gdb is now up and running and ready to debug.</p>
<h2 id="pyocd">pyOCD</h2>
<p>Since there is a bug in pyOCD, you need to stop the gdb server and flash the firmware using another flashing tool and not GDB.</p>
This can be done for example with
<pre class="prettyprint"><code class='lang-bash'>STM32_Programmer_CLI -c port=SWD -e all -w $(pwd)/build/image.hex -v -ob displ -rst
</code></pre>
<p>Then start pyOCD gdb server and connect a client, which can be a GDB client compiled for the ARM platform and then used directly or by using a GDB gui, as <a href="https://www.gdbgui.com/">gdbgui</a>.</p>
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
</script>
<!--
<script type="text/javascript" async src="https://unpkg.com/mathjax@latest/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" async src="https://cdn.jsdelivr.net/npm/mathjax@latest/unpacked/MathJax.min.js?config=TeX-AMS-MML_HTMLorMML"></script>
-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: { equationNumbers: { autoNumber: "AMS" } }
});
</script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/styles/agate.min.css">
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/highlight.min.js"></script>
<script>hljs.highlightAll();</script>
Alex Pacinihttp://www.blogger.com/profile/13304951646877405715noreply@blogger.com0tag:blogger.com,1999:blog-3207270927898422436.post-1356537191899232612019-12-19T22:13:00.004+01:002021-11-09T19:49:41.693+01:00Tandem Directional Coupler: Circuit Theory Approach<p>This document discusses the analysis of an ideal “tandem” directional coupler using lumped element circuit theory.</p>
<p>A directional coupler is a four port device that is used to sample the forward and reflected wave in a transmission line. It is a key component of a VNA and can be used to measure power flowing in a transmission line, but it can have countless possible uses. Generally they are built using distributed elements structures, but there are also versions built using lumped elements.</p>
<p>The tandem directional coupler, or also tandem bridge, is one of those directional couplers that is built using a lumped element approach. This kind of directional coupler, famous for radio-hams, has inherently large bandwidth and can handle a lot of power. It is also well suited for low frequency scenarios, down to the kHz range. It is composed of two current transformers, or two transformers with a high turn ratio, and two termination resistors with the desired characteristic impedance <span class="math inline">\(Z_0\)</span>, which can be arbitrary but usually 50<span class="math inline">\(\Omega\)</span>.</p>
<a name='more'></a>
<p>To give an example, by changing those terminations it is possible to measure S-parameters with a different characteristic impedance and without the need to use any post-processing. It is worth saying that many instruments have a characteristic impedance of 50 Ohm (why 50? There are many articles about power handling, attenuation, etc.)</p>
<p><img src="https://alexpacini.gitlab.io/blog/2019/12_17_TandemCoupler/figures/tandem.svg" width="98%"> The load can be also seen as the transformed load after an arbitrary transmission line of arbitrary length at the directional coupler output. This circuit analysis does not include additional losses in the transformers, which would slightly change the insertion loss, and non ideal transformers, which would introduce frequency dependent relations. Including those non-idealities is not fundamental for grasping its behavior and introduces complications for the solutions, which would hide the important aspects. They can be introduced using a SPICE simulation and is done in the section <a href="#spice-simulation">Spice Simulation</a>.</p>
<p>The coupled outputs are taken on <span class="math inline">\(\mathrm{R_{fw}}\)</span> (forward) and <span class="math inline">\(\mathrm{R_{rw}}\)</span> (reverse), while the output is on <span class="math inline">\(\mathrm{R_{L}}\)</span>.</p>
<p>The input consists of an ideal voltage generator, with a zero internal impedance, and will results in a load dependent forward (and reverse) voltage. If the generator impedance was equal to <span class="math inline">\(Z_0\)</span>, the forward voltage would be without any dependence on the load impedance <span class="math inline">\(Z_L\)</span>. The analysis does not have any loss of generality, as the analysis with a <span class="math inline">\(Z_0\)</span> generator impedance can be easily obtained by adding a voltage divider in the generator voltage.</p>
I decided to use Python for performing the analysis: the symbolic mathematics package <code>Sympy</code> for solving the linear system of equations, <code>numpy</code> for numerical stuff, <code>numba</code> and <code>multiprocessing</code> to speed up some number crunching functions and <code>matplotlib</code> for plotting.
<pre class="prettyprint"><code class='lang-python'># Setting up packages
%reset -f
%matplotlib inline
%config InlineBackend.figure_format = 'svg'
from multiprocessing import Pool
import sympy as sy
import numpy as np
import matplotlib.pyplot as plt
from cycler import cycler
from IPython.display import *
sy.init_printing()
</code></pre>
<h2 id="symbolic-solution">Symbolic solution</h2>
In this section, the circuit is solved using a mesh analysis.
<pre class="prettyprint"><code class='lang-python'>Vin, VL1, VL2, RL, Rfw, Rrw, N, i1, i2, i3, i4, Z0 = sy.symbols(
r'V_{in}, V_{L1}, V_{L2}, R_L, R_{fw}, R_{rw}, N, i_1, i_2, i_3, i_4, Z_0')
Vin, Rfw, Rrw, N, Z0 = sy.symbols(
r'V_{in}, R_{fw}, R_{rw}, N, Z_0', real=True)
eq = [Vin - VL1 - RL*(i1 - i4)]
eq += [N*VL1 - Rfw * (i2 - i3)]
eq += [Rfw * (i2 - i3) - Rrw * i3 - VL2]
eq += [-VL2 * N + RL * (i1 - i4)]
eq += [i1/N - i2]
eq += [i4 + i3/N]
sol = sy.solve(eq, (VL1, VL2, i1, i2, i3, i4))
display(sol)
</code></pre>
<p>The solutions to the previous system of equations is: <span class="math display">\[
\begin{aligned}
V_{L1} =& \frac{R_{fw} V_{in} \left(N^{2} R_{L} + N^{2} R_{rw} + R_{L}\right)}{N^{4} R_{L} R_{fw} + N^{4} R_{L} R_{rw} + 2 N^{2} R_{L} R_{fw} + N^{2} R_{fw} R_{rw} + R_{L} R_{fw}}\\[2mm]
V_{L2} =& \frac{N R_{L} V_{in} \left(N^{2} \left(R_{fw} + R_{rw}\right) + R_{fw}\right)}{N^{4} R_{L} \left(R_{fw} + R_{rw}\right) + 2 N^{2} R_{L} R_{fw} - N^{2} R_{fw}^{2} + N^{2} R_{fw} \left(R_{fw} + R_{rw}\right) + R_{L} R_{fw}}\\[2mm]
i_{1} =& \frac{N^{2} V_{in} \left(N^{2} \left(R_{fw} + R_{rw}\right) + R_{L}\right)}{N^{4} R_{L} \left(R_{fw} + R_{rw}\right) + 2 N^{2} R_{L} R_{fw} - N^{2} R_{fw}^{2} + N^{2} R_{fw} \left(R_{fw} + R_{rw}\right) + R_{L} R_{fw}}\\[2mm]
i_{2} =& \frac{N V_{in} \left(N^{2} \left(R_{fw} + R_{rw}\right) + R_{L}\right)}{N^{4} R_{L} \left(R_{fw} + R_{rw}\right) + 2 N^{2} R_{L} R_{fw} - N^{2} R_{fw}^{2} + N^{2} R_{fw} \left(R_{fw} + R_{rw}\right) + R_{L} R_{fw}}\\[2mm]
i_{3} =& - \frac{N^{3} V_{in} \left(R_{L} - R_{fw}\right)}{N^{4} R_{L} R_{fw} + N^{4} R_{L} R_{rw} + 2 N^{2} R_{L} R_{fw} + N^{2} R_{fw} R_{rw} + R_{L} R_{fw}}\\[2mm]
i_{4} =& \frac{N^{2} V_{in} \left(R_{L} - R_{fw}\right)}{N^{4} R_{L} R_{fw} + N^{4} R_{L} R_{rw} + 2 N^{2} R_{L} R_{fw} + N^{2} R_{fw} R_{rw} + R_{L} R_{fw}}
\end{aligned}
\]</span></p>
<pre class="prettyprint"><code class='lang-python'>Vout = (Vin - sol[VL1]).simplify()
Vfw = ((sol[i2] - sol[i3]) * Rfw).simplify()
Vrw = (sol[i3] * Rrw).simplify()
Pin = sy.re(Vin * sol[i1]/2)
Pout = (sol[i1] - sol[i4])**2 * sy.re(RL)/2
Pfw = (sol[i2] - sol[i3])**2 * Rfw/2
Prw = (sol[i3])**2 * Rrw/2
L = (Pin/Pout)
C = (Pin/Pfw)
I = (Pin/Prw)
D = (I / C)
eff = (1/L)
dircouplerf = [L, C, I, D]
p = Pool(processes = 8)
p.map(sy.simplify, dircouplerf)
Ls, Cs, Is, Ds = sy.symbols(r'L, C, I, D')
[display(sy.Eq(x, y)) for x, y in zip([Ls, Cs, Is, Ds], dircouplerf)];
</code></pre>
<div style="overflow-x:scroll;overflow-y:hidden;width:100%;white-space: nowrap;">
<p><span class="math display">\[
L = \frac{2 \left(\frac{N^{2} V_{in}^{2} \left(N^{2} \left(R_{fw} + R_{rw}\right) + \operatorname{re}{\left(R_{L}\right)}\right) \left(N^{4} \left(R_{fw} + R_{rw}\right) \operatorname{re}{\left(R_{L}\right)} - N^{2} R_{fw}^{2} + N^{2} R_{fw} \left(R_{fw} + R_{rw}\right) + 2 N^{2} R_{fw} \operatorname{re}{\left(R_{L}\right)} + R_{fw} \operatorname{re}{\left(R_{L}\right)}\right)}{2 \left(\left(N^{4} \left(R_{fw} + R_{rw}\right) \operatorname{im}{\left(R_{L}\right)} + 2 N^{2} R_{fw} \operatorname{im}{\left(R_{L}\right)} + R_{fw} \operatorname{im}{\left(R_{L}\right)}\right)^{2} + \left(N^{4} \left(R_{fw} + R_{rw}\right) \operatorname{re}{\left(R_{L}\right)} - N^{2} R_{fw}^{2} + N^{2} R_{fw} \left(R_{fw} + R_{rw}\right) + 2 N^{2} R_{fw} \operatorname{re}{\left(R_{L}\right)} + R_{fw} \operatorname{re}{\left(R_{L}\right)}\right)^{2}\right)} - \frac{N^{2} V_{in}^{2} \left(- N^{4} \left(R_{fw} + R_{rw}\right) \operatorname{im}{\left(R_{L}\right)} - 2 N^{2} R_{fw} \operatorname{im}{\left(R_{L}\right)} - R_{fw} \operatorname{im}{\left(R_{L}\right)}\right) \operatorname{im}{\left(R_{L}\right)}}{2 \left(\left(N^{4} \left(R_{fw} + R_{rw}\right) \operatorname{im}{\left(R_{L}\right)} + 2 N^{2} R_{fw} \operatorname{im}{\left(R_{L}\right)} + R_{fw} \operatorname{im}{\left(R_{L}\right)}\right)^{2} + \left(N^{4} \left(R_{fw} + R_{rw}\right) \operatorname{re}{\left(R_{L}\right)} - N^{2} R_{fw}^{2} + N^{2} R_{fw} \left(R_{fw} + R_{rw}\right) + 2 N^{2} R_{fw} \operatorname{re}{\left(R_{L}\right)} + R_{fw} \operatorname{re}{\left(R_{L}\right)}\right)^{2}\right)}\right)}{\left(- \frac{N^{2} V_{in} \left(R_{L} - R_{fw}\right)}{N^{4} R_{L} R_{fw} + N^{4} R_{L} R_{rw} + 2 N^{2} R_{L} R_{fw} + N^{2} R_{fw} R_{rw} + R_{L} R_{fw}} + \frac{N^{2} V_{in} \left(N^{2} \left(R_{fw} + R_{rw}\right) + R_{L}\right)}{N^{4} R_{L} \left(R_{fw} + R_{rw}\right) + 2 N^{2} R_{L} R_{fw} - N^{2} R_{fw}^{2} + N^{2} R_{fw} \left(R_{fw} + R_{rw}\right) + R_{L} R_{fw}}\right)^{2} \operatorname{re}{\left(R_{L}\right)}}
\]</span> <span class="math display">\[
C = \frac{2 \left(\frac{N^{2} V_{in}^{2} \left(N^{2} \left(R_{fw} + R_{rw}\right) + \operatorname{re}{\left(R_{L}\right)}\right) \left(N^{4} \left(R_{fw} + R_{rw}\right) \operatorname{re}{\left(R_{L}\right)} - N^{2} R_{fw}^{2} + N^{2} R_{fw} \left(R_{fw} + R_{rw}\right) + 2 N^{2} R_{fw} \operatorname{re}{\left(R_{L}\right)} + R_{fw} \operatorname{re}{\left(R_{L}\right)}\right)}{2 \left(\left(N^{4} \left(R_{fw} + R_{rw}\right) \operatorname{im}{\left(R_{L}\right)} + 2 N^{2} R_{fw} \operatorname{im}{\left(R_{L}\right)} + R_{fw} \operatorname{im}{\left(R_{L}\right)}\right)^{2} + \left(N^{4} \left(R_{fw} + R_{rw}\right) \operatorname{re}{\left(R_{L}\right)} - N^{2} R_{fw}^{2} + N^{2} R_{fw} \left(R_{fw} + R_{rw}\right) + 2 N^{2} R_{fw} \operatorname{re}{\left(R_{L}\right)} + R_{fw} \operatorname{re}{\left(R_{L}\right)}\right)^{2}\right)} - \frac{N^{2} V_{in}^{2} \left(- N^{4} \left(R_{fw} + R_{rw}\right) \operatorname{im}{\left(R_{L}\right)} - 2 N^{2} R_{fw} \operatorname{im}{\left(R_{L}\right)} - R_{fw} \operatorname{im}{\left(R_{L}\right)}\right) \operatorname{im}{\left(R_{L}\right)}}{2 \left(\left(N^{4} \left(R_{fw} + R_{rw}\right) \operatorname{im}{\left(R_{L}\right)} + 2 N^{2} R_{fw} \operatorname{im}{\left(R_{L}\right)} + R_{fw} \operatorname{im}{\left(R_{L}\right)}\right)^{2} + \left(N^{4} \left(R_{fw} + R_{rw}\right) \operatorname{re}{\left(R_{L}\right)} - N^{2} R_{fw}^{2} + N^{2} R_{fw} \left(R_{fw} + R_{rw}\right) + 2 N^{2} R_{fw} \operatorname{re}{\left(R_{L}\right)} + R_{fw} \operatorname{re}{\left(R_{L}\right)}\right)^{2}\right)}\right)}{R_{fw} \left(\frac{N^{3} V_{in} \left(R_{L} - R_{fw}\right)}{N^{4} R_{L} R_{fw} + N^{4} R_{L} R_{rw} + 2 N^{2} R_{L} R_{fw} + N^{2} R_{fw} R_{rw} + R_{L} R_{fw}} + \frac{N V_{in} \left(N^{2} \left(R_{fw} + R_{rw}\right) + R_{L}\right)}{N^{4} R_{L} \left(R_{fw} + R_{rw}\right) + 2 N^{2} R_{L} R_{fw} - N^{2} R_{fw}^{2} + N^{2} R_{fw} \left(R_{fw} + R_{rw}\right) + R_{L} R_{fw}}\right)^{2}}
\]</span> <span class="math display">\[
I = \frac{2 \left(\frac{N^{2} V_{in}^{2} \left(N^{2} \left(R_{fw} + R_{rw}\right) + \operatorname{re}{\left(R_{L}\right)}\right) \left(N^{4} \left(R_{fw} + R_{rw}\right) \operatorname{re}{\left(R_{L}\right)} - N^{2} R_{fw}^{2} + N^{2} R_{fw} \left(R_{fw} + R_{rw}\right) + 2 N^{2} R_{fw} \operatorname{re}{\left(R_{L}\right)} + R_{fw} \operatorname{re}{\left(R_{L}\right)}\right)}{2 \left(\left(N^{4} \left(R_{fw} + R_{rw}\right) \operatorname{im}{\left(R_{L}\right)} + 2 N^{2} R_{fw} \operatorname{im}{\left(R_{L}\right)} + R_{fw} \operatorname{im}{\left(R_{L}\right)}\right)^{2} + \left(N^{4} \left(R_{fw} + R_{rw}\right) \operatorname{re}{\left(R_{L}\right)} - N^{2} R_{fw}^{2} + N^{2} R_{fw} \left(R_{fw} + R_{rw}\right) + 2 N^{2} R_{fw} \operatorname{re}{\left(R_{L}\right)} + R_{fw} \operatorname{re}{\left(R_{L}\right)}\right)^{2}\right)} - \frac{N^{2} V_{in}^{2} \left(- N^{4} \left(R_{fw} + R_{rw}\right) \operatorname{im}{\left(R_{L}\right)} - 2 N^{2} R_{fw} \operatorname{im}{\left(R_{L}\right)} - R_{fw} \operatorname{im}{\left(R_{L}\right)}\right) \operatorname{im}{\left(R_{L}\right)}}{2 \left(\left(N^{4} \left(R_{fw} + R_{rw}\right) \operatorname{im}{\left(R_{L}\right)} + 2 N^{2} R_{fw} \operatorname{im}{\left(R_{L}\right)} + R_{fw} \operatorname{im}{\left(R_{L}\right)}\right)^{2} + \left(N^{4} \left(R_{fw} + R_{rw}\right) \operatorname{re}{\left(R_{L}\right)} - N^{2} R_{fw}^{2} + N^{2} R_{fw} \left(R_{fw} + R_{rw}\right) + 2 N^{2} R_{fw} \operatorname{re}{\left(R_{L}\right)} + R_{fw} \operatorname{re}{\left(R_{L}\right)}\right)^{2}\right)}\right) \left(N^{4} R_{L} R_{fw} + N^{4} R_{L} R_{rw} + 2 N^{2} R_{L} R_{fw} + N^{2} R_{fw} R_{rw} + R_{L} R_{fw}\right)^{2}}{N^{6} R_{rw} V_{in}^{2} \left(R_{L} - R_{fw}\right)^{2}}
\]</span> <span class="math display">\[
D = \frac{R_{fw} \left(\frac{N^{3} V_{in} \left(R_{L} - R_{fw}\right)}{N^{4} R_{L} R_{fw} + N^{4} R_{L} R_{rw} + 2 N^{2} R_{L} R_{fw} + N^{2} R_{fw} R_{rw} + R_{L} R_{fw}} + \frac{N V_{in} \left(N^{2} \left(R_{fw} + R_{rw}\right) + R_{L}\right)}{N^{4} R_{L} \left(R_{fw} + R_{rw}\right) + 2 N^{2} R_{L} R_{fw} - N^{2} R_{fw}^{2} + N^{2} R_{fw} \left(R_{fw} + R_{rw}\right) + R_{L} R_{fw}}\right)^{2} \left(N^{4} R_{L} R_{fw} + N^{4} R_{L} R_{rw} + 2 N^{2} R_{L} R_{fw} + N^{2} R_{fw} R_{rw} + R_{L} R_{fw}\right)^{2}}{N^{6} R_{rw} V_{in}^{2} \left(R_{L} - R_{fw}\right)^{2}}
\]</span></p>
</div>
<p>The relations above, which are quite long, represents the characteristic parameters of the directional coupler with arbitrary terminations but without additional losses:</p>
<ul>
<li>L is the <em>Insertion Loss</em></li>
<li>C is the <em>Coupling</em></li>
<li>I is the <em>Isolation</em></li>
<li>D is the <em>Directivity</em></li>
</ul>
<p>Those can be simplified to the definition case, when the terminations and the load are the same as the characteristic impedance <span class="math inline">\(Z_0\)</span>. Those parameters are obtained from the general expression above, with <span class="math inline">\(1:50\)</span> transformers. Those are the ideal expressions for this directional coupler without considering uncertainties on the parameters. The general expressions can include uncertainties and be evaluated using random variables or numerically.</p>
<pre class="prettyprint"><code class='lang-python'>subs = {Rrw:Z0, Rfw:Z0, RL:Z0, N:50}
effs = sy.symbols(r'eff')
coupler_param = {Cs: C.subs(subs).simplify(),
Is: I.subs(subs).simplify(),
Ls: L.subs(subs).simplify(),
Ds: D.subs(subs).simplify(),
effs: (1/L.subs(subs)).simplify(),
}
[display(sy.Eq(key, val)) for key, val in coupler_param.items()];
</code></pre>
<p><span class="math display">\[
\begin{aligned}
C &= 2501\\[2mm]
I &= \tilde{\infty} Z_{0}^{2}\\[2mm]
L &= \frac{2501}{2500}\\[2mm]
D &= \tilde{\infty} Z_{0}^{2}\\[2mm]
eff &= \frac{2500}{2501}
\end{aligned}
\]</span></p>
<p>It is possible to notice that the directivity ideally <span class="math inline">\(\to \infty\)</span> and that the insertion loss is approximately <span class="math inline">\(N^{2}\)</span>, as it can be obtained by a simplified analysis using waves or again a circuit theory approach.</p>
<h2 id="spice-simulation">Spice Simulation</h2>
In the following is the spice netlist of the simulation, which will be used later for comparison with the theoretical results.
<pre class="prettyprint"><code class="nocode plaintext">* Simulation of the directional coupler
* Alex Pacini, 2019
Vin Vin_ 0 SIN(0 10 200E3) AC 1
RVin Vin_ Vin 1u
L11 Vin Vout 1E-6
L12 Vfwd 0 2.5E-3
K1 L11 L12 1
Rfwd Vfwd 0 49.98
L21 Vfwd Vref 1E-6
Rref Vref 0 50
L22 Vout 0 2.5E-3
K2 L21 L22 1
RL Vout 0 {RL}
***********************************************************
*.tran 0 16u 10u 100n
*.print tran V(Vout) I(RL) V(Vfwd) V(Vref)
.step param RL 1 1000 1
.ac lin 1 200E3 200E3
*.print ac V(Vout) I(RL) V(Vfwd) V(Vref)
</code></pre>
<p>The following code is used to import the LTSpice exported data to ascii (from the plot, as LTSpice does not normally print to a file).</p>
<pre class="prettyprint"><code class='lang-python'>import re
def converter_func(s):
subs = {r',(?!-)(.*)': r'+\1j',
r',(?=-)(.*)': r'\1j',
}
for key, val in subs.items():
s = re.sub(key, val, s)
return complex(s)
converters = {
1: converter_func,
2: converter_func,
3: converter_func,
}
sim = np.genfromtxt('dcoupler.txt', delimiter='\t', names=True,
dtype=None, encoding='iso-8859-1', converters=converters)
# To change the dtype, LTspice likes to call the independent variable Freq, but in
# this case it is RL
sim.dtype.names = tuple(['RL'] + list(sim.dtype.names)[1:])
sim.dtype.names
</code></pre>
<pre><code>('RL', 'Vvfwd', 'Vvout', 'Vvref')</code></pre>
<h2 id="numerical-evaluation">Numerical evaluation</h2>
<p>In this section the symbolic equations are converted to their numerical equivalent using <code>numpy</code>. <code>sympy</code> provides a tool (<code>lambdify</code>) for doing this conversion. Using the <code>numba</code> decorator on those functions, the speed-up is around five times.</p>
<pre class="prettyprint"><code class='lang-python'>from numba import njit
funcs = {key: njit(sy.lambdify((Rfw, Rrw, RL, Vin, N), val,'numpy'))
for key, val in zip('Vout,Vfw,Vrw,i1,i2,i3,i4'.split(','),
[Vout, Vfw, Vrw, sol[i1], sol[i2], sol[i3], sol[i4]])}
</code></pre>
<h3 id="parameter-uncertainties">Parameter uncertainties</h3>
<p>This can be done using multiple approaches.</p>
<p>The theoretical way is to treat the forward and reverse terminations as random variables with a certain distribution. The mean value will be the nominal value, <span class="math inline">\(Z_0\)</span>, while the variance should be a value that provides the manufacturer tolerance.</p>
<p>With a Gaussian distribution the variance can be found by setting standard deviation to a fifth of the tolerance. The problem is that the distribution is unknown and using a Gaussian random distribution might be the wrong choice. Indeed, the distribution depends on the manufacturing process and component selection process. The selection process might select the resistors with tighter tolerance and include them in a series with better tolerance, leaving a hole in the middle of the distribution and placing de-facto all the values out of the mean value, like a bimodal distribution.</p>
<p>In this case it might be better to do an evaluation for the worst case for all the possible combinations, but the equations are quite tedious and analytically computing the maximum error might be overly complicated, especially because the function has multiple variables. Doing it numerically provides very similar insights, especially because the probability distribution of the random variable is unknown, and is simpler to compute.</p>
<p>We can test a number of steps inside that error band and select the one with the greatest distance. If done for each load, this means taking the maximum and minimum of all the possible variations of the termination resistances.</p>
<p>It turns out, as was also possible to expect, that the the error functions have only a local minimum and that the maximum errors are at the boundaries. This is true apart from the numerical error, which requires more values to provide a more consistent result in some specific conditions (they are discussed below).</p>
<pre class="prettyprint"><code class='lang-python'>a = np.geomspace(1, 10000, 10000)
a_sim = sim['RL']
p = 0.05
size = 11
Rfw = 50 * np.linspace(1-p, 1+p, size)
Rrw = 50 * np.linspace(1-p, 1+p, size)
args = (50, 50, a, 1, 50, size)
xlabel = 'RL'
simmap = {'Vout': sim['Vvout'],
'Vfw': sim['Vvfwd'],
'Vrw': sim['Vvref'],
}
def varf(fun, Rfw, Rrw, RL, Vin, N, size):
temp = np.empty((size, size, a.size))
for i in range(size):
for j in range(size):
temp[i, j, :] = fun(Rfw[i], Rrw[j], RL, Vin, N)
return np.stack((np.amin(temp, axis=(0,1)),
np.amax(temp, axis=(0,1))), 0)
rho = lambda *args: -funcs['Vrw'](*args)/funcs['Vfw'](*args)
for (key, val) in list(funcs.items()):
if key in ['Vout','Vfw','Vrw']:
fig = plt.figure(key)
ax = fig.add_subplot(1,1,1)
evf = val(*args[:-1])
lines = plt.semilogx(a, evf, label=key)
ax.set_xlabel(xlabel)
if key not in ['Vout']:
plt.plot([a.min(), a.max()], [0, 0], linewidth=0.5);
plt.semilogx(a_sim, np.real(simmap[key]), label=(key + ' spice'),
color=lines[0].get_color(), linestyle='-.')
bands = varf(val, Rfw, Rrw, a, *args[3:6])
lines += ax.semilogx(np.repeat(a[np.newaxis, :], 2, 0).T, bands.T,
color=lines[0].get_color(), linewidth=0.1);
ax.fill_between(a, bands[0], bands[1], color=lines[0].get_color(), alpha=0.2)
ax.legend()
fig.tight_layout()
</code></pre>
<p><img src="https://alexpacini.gitlab.io/blog/2019/12_17_TandemCoupler/figures/output_18_0.svg"
width="98%"> <img src="https://alexpacini.gitlab.io/blog/2019/12_17_TandemCoupler/figures/output_18_1.svg"
width="98%"> <img src="https://alexpacini.gitlab.io/blog/2019/12_17_TandemCoupler/figures/output_18_2.svg"
width="98%"></p>
<p>The plots above are representative of <span class="math inline">\(V_{out}\)</span>, <span class="math inline">\(V_{fw}\)</span> and <span class="math inline">\(V_{rw}\)</span> with a <span class="math inline">\(V_{in}=\mathrm{1V}\)</span>. The orange line is the <span class="math inline">\(\mathrm{0V}\)</span> line for reference.</p>
<p>The maximum error from the variation of the termination resistances has been included in the plot as a filled area around the main line. In this case the termination resistances are supposed to be <span class="math inline">\(\pm 5 \%\)</span>.</p>
<p>It is possible to see that this directional coupler has <span class="math inline">\(V_{rw}\)</span> with the opposite sign, so when it is open <span class="math inline">\(V_{rw}\)</span> is negative instead of positive.</p>
<p>Since <span class="math inline">\(C\)</span> is defined as <span class="math inline">\(P_{in}/P_{fw}\)</span> and the terminating resistances <span class="math inline">\(\mathrm{R_{fw}}\)</span> and <span class="math inline">\(\mathrm{R_{rw}}\)</span> when the coupler is in nominal conditions are <span class="math inline">\(\mathrm{Z_0}\)</span> (also the load is <span class="math inline">\(\mathrm{R_L} = \mathrm{Z_0}\)</span>), it follows that: <span class="math display">\[
C = \frac{\mathrm{P_{in}}}{\mathrm{P_{fw}}} = \left(\frac{\mathrm{V_{in}}}{\mathrm{V_{fw}}}\right)^2
\]</span> For this particular directional coupler, the forward wave is therefore <span class="math inline">\(\mathrm{Vf = Vfw/\sqrt{C}}\)</span> and the reflected wave is <span class="math inline">\(\mathrm{Vr = -Vrw/\sqrt{C}}\)</span>. The reflected wave is scaled, with a good approximation, by the same <span class="math inline">\(\sqrt{C}\)</span>, since the definition is the same but using the output port as the input.</p>
<p>If an OSL calibration is added, the calibration will compensate the sign (there are various resources online, for example from Keysight (<a href="http://literature.cdn.keysight.com/litweb/pdf/5988-9477EN.pdf">1</a>, <a href="http://www2.electron.frba.utn.edu.ar/~jcecconi/Bibliografia/04%20-%20Param_S_y_VNA/Network_Analyzer_Error_Models_and_Calibration_Methods.pdf">2</a>), <a href="http://www.rekirsch.at/user_html/1282834349/pix/a/media/ME7838A/Understanding_Vector_Network_Analysis.pdf">Anritsu</a>, <a href="https://doi.org/10.1109/MMM.2008.919925">10.1109/MMM.2008.919925</a>, <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.662.2977&rep=rep1&type=pdf">A Review of VNA Calibration Methods</a>, <a href="https://core.ac.uk/download/pdf/11371228.pdf">Multiport Vector Network Analyzer Calibration: A General Formulation</a>).</p>
<p>Otherwise to get <span class="math inline">\((V_{r} + V_{f}) = V_{out}\)</span>, <span class="math inline">\(V_{rw}\)</span> must be multiplied by <span class="math inline">\(-1\)</span>. In other words, <span class="math inline">\((V_{rw} - V_{fw})/\sqrt{C} = V_{out}\)</span>.</p>
<p>In the following I therefore decided to define the reflection coefficient of the load <span class="math inline">\(\mathrm{S_{11}}\)</span> as</p>
<p><span class="math display">\[\mathrm{S_{11}} = \mathrm{-\frac{V_{rw}}{V_{fw}}}.\]</span></p>
<p>This definition, with this particular coupler, provides that <span class="math inline">\(\mathrm{\frac{V_{rw}}{V_{fw}}(0) = -1}\)</span> as it should be by line theory.</p>
<p>The crossing point of the orange lines denotes the matched load (<span class="math inline">\(\mathrm{R_L}/\mathrm{Z_0} = 50/50 = 1\)</span>)</p>
<p>The spice simulations are included in all plots using dash dotted lines and are representative of transformers having a finite inductance. Those lines are perfectly over-imposed to the theoretical results.</p>
<pre class="prettyprint"><code class='lang-python'>fig = plt.figure('rho')
ax = fig.add_subplot(1,1,1)
evf = rho(*args[:-1])
lines = ax.semilogx(a/50, evf, label='S11')
zero = ax.semilogx([a.min()/50,a.max()/50], [0,0], linewidth=0.5)
plt.semilogx([1,1], [-1,1], linewidth=0.5, color=zero[0].get_color())
plt.semilogx(a_sim/50, np.real(-simmap['Vrw']/simmap['Vfw']), label='S11 spice', linewidth=0.5)
bands = varf(rho, Rfw, Rrw, a, *args[3:6])
lines += ax.semilogx(np.repeat((a/50)[np.newaxis, :], 2, 0).T, bands.T,
color=lines[0].get_color(), linewidth=0.1);
ax.fill_between(a/50, bands[0], bands[1], color=lines[0].get_color(), alpha=0.2)
ax.set_xlabel(xlabel + '/50');
ax.legend()
fig.tight_layout()
</code></pre>
<p><img src="https://alexpacini.gitlab.io/blog/2019/12_17_TandemCoupler/figures/output_20_0.svg"
width="98%"></p>
<p>In this plot it is clear that the error due to the tolerance is mostly affecting the impedance near the open load.</p>
<p>It is worth noting that this variation, if it is constant during time, can be effectively reduced using the calibration procedure.</p>
<pre class="prettyprint"><code class='lang-python'>def z(*args):
return 50 * (1 + rho(*args))/(1 - rho(*args))
fig = plt.figure('z')
ax = fig.add_subplot(1,1,1)
lines = ax.loglog(a, z(*args[:-1]), label='RL sense')
bands = varf(z, Rfw, Rrw, a, *args[3:6])
lines += ax.plot(np.repeat(a[np.newaxis, :], 2, 0).T, bands.T,
color=lines[0].get_color(), linewidth=0.1);
ax.fill_between(a, bands[0], bands[1], color=lines[0].get_color(), alpha=0.2)
ax.set_xlabel(xlabel);
ax.legend()
fig.tight_layout()
</code></pre>
<p><img src="https://alexpacini.gitlab.io/blog/2019/12_17_TandemCoupler/figures/output_22_0.svg"
width="98%"></p>
<p>The large variation is because <span class="math inline">\(\mathrm{S_{11}}\)</span> gets near to one and a singularity arises, which creates the large oscillations between positive and negative values (the log of a negative value does not exist in the real space). This is due to the tolerance in the resistor and represents all the possible variations of the impedance due to the tolerance. There is also some numerical error in the plot.</p>
<p>A OSL calibration can compensate most of those errors and restore the proper relation when the errors remain constant in time after calibration. Consider anyway that the calibration can still affect the accuracy due to noise, since the range of inputs are reduced. Refer to the previously listed resources for more information.</p>
<p>The following is an example of calibration using the package <code>scikit-rf</code>. The frequency is not important and is selected to be 1 Hz just to create the network object.</p>
<pre class="prettyprint"><code class='lang-python'>import skrf as rf
n = rf.Network()
n.frequency = rf.Frequency.from_f([1], unit='Hz')
n.s = [0] # To initialize the network
ideals = [n.copy() for i in range(3)]
ideals[0].s = [-1] # Short
ideals[1].s = [0] # Load
ideals[2].s = [1] # Open
def rhof(Rfw, Rrw, RL, Vin, N, size):
temp = np.empty((size, size, a.size))
for i in range(size):
for j in range(size):
temp[i, j, :] = rho(Rfw[i], Rrw[j], RL, Vin, N)
return np.unravel_index(temp.argmax(), temp.shape)
x = rhof(Rfw, Rrw, 50, 1, 50, size)
rho(Rfw[x[0]], Rrw[x[1]], 50, 1, 50)
measured = [n.copy() for i in range(3)]
measured[0].s = rho(Rfw[x[0]], Rrw[x[1]], 0, 1, 50) # Short
measured[1].s = rho(Rfw[x[0]], Rrw[x[1]], 50, 1, 50) # Load
measured[2].s = rho(Rfw[x[0]], Rrw[x[1]], 1E10, 1, 50) # Open
cal = rf.OnePort(ideals = ideals, measured = measured)
cal.run()
def dutf(i):
temp = n.copy()
temp.s = rho(Rfw[x[0]], Rrw[x[1]], i, 1, 50)
return temp
p = Pool(processes = 8)
dut = p.map(dutf, a)
dut_cal = p.map(cal.apply_cal, dut)
ttt_uncal = [dut_i.z[0,0,0] for dut_i in dut]
ttt = [dut_cal_i.z[0,0,0] for dut_cal_i in dut_cal]
plt.plot(a, np.real(ttt), label='RL(S11) - determ.')
plt.plot(a, np.real(ttt_uncal), label='RL(S11) - uncal.')
plt.loglog(a, np.real(z(*args[:-1])), label='RL(S11) - cal.')
plt.legend();
</code></pre>
<p><img src="https://alexpacini.gitlab.io/blog/2019/12_17_TandemCoupler/figures/output_25_1.svg"
width="98%"></p>
<p>The previous plot proves that in a condition where the error due to a variation of the termination resistance creates a very high error, if this is not time dependent, it can be corrected with a calibration. Anyway, when the input has noise, it affects the result by increasing the inaccuracy, as stated before.</p>
The code block below defines the powers in the output (<span class="math inline">\(\mathrm{P_{out}}\)</span>) and on the coupler ports (<span class="math inline">\(\mathrm{P_{fw}}\)</span>, <span class="math inline">\(\mathrm{P_{rw}}\)</span>):
<pre class="prettyprint"><code class='lang-python'>def Pin(Rfw, Rrw, RL, Vin, N):
return np.real(Vin * funcs['i1'](Rfw, Rrw, RL, Vin, N) * 0.5)
def Pout(Rfw, Rrw, RL, Vin, N):
return np.real(funcs['Vout'](Rfw, Rrw, RL, Vin, N) *
(funcs['i1'](Rfw, Rrw, RL, Vin, N) -
funcs['i4'](Rfw, Rrw, RL, Vin, N)) * 0.5)
def Pfw(Rfw, Rrw, RL, Vin, N):
return np.real(Rfw * (funcs['i2'](Rfw, Rrw, RL, Vin, N) -
funcs['i3'](Rfw, Rrw, RL, Vin, N))**2 * 0.5)
def Prw(Rfw, Rrw, RL, Vin, N):
return np.real(Rrw * (funcs['i3'](Rfw, Rrw, RL, Vin, N))**2 * 0.5)
</code></pre>
The following is a check for the Tellegen theorem, or that the sum of all the powers in the circuit must be zero. This is a statement of conservation of energy. The figure shows that energy is conserved apart from a small numerical error of maximum <span class="math inline">\(10^{16}\)</span>.
<pre class="prettyprint"><code class='lang-python'>#Tellegen check
tellegen = lambda *args: Pin(*args) - (Pout(*args) + Pfw(*args) + Prw(*args))
plt.figure('tellegen')
plt.semilogx(a, tellegen(*args[:-1]), label='Sum P', linewidth=0.5)
plt.xlabel(xlabel);
plt.tight_layout();
</code></pre>
<p><img src="https://alexpacini.gitlab.io/blog/2019/12_17_TandemCoupler/figures/output_29_0.svg"
width="98%"></p>
<p>In the following part of this section, the parameters of the coupler are shown when subject to parameter uncertainties. Note that the coupler parameters, by definition, are defined <strong>only</strong> when <span class="math inline">\(R_L= 50\)</span>, and is indicated with a orange line.</p>
<p>The measurements in the following section are performed with a 50 ohm termination, which can have its small uncertainty around the orange vertical line. If it can be supposed to be 50 ohm, as per definitions, the uncertainty will be mainly on the coupled output terminations.</p>
<pre class="prettyprint"><code class='lang-python'>L = lambda *args: Pin(*args)/Pout(*args)
C = lambda *args: Pin(*args)/Pfw(*args)
I = lambda *args: Pin(*args)/Prw(*args)
D = lambda *args: I(*args)/C(*args)
for name, f in zip('L,C,I,D'.split(','), [L, C, I, D]):
fig = plt.figure(name + 'db')
ax = fig.add_subplot(1,1,1)
evf = 10*np.log10(f(*args[:-1]))
lines = ax.semilogx(a, evf, label=(name + ' (dB)'))
bands = 10*np.log10(varf(f, Rfw, Rrw, a, *args[3:6]))
lines += ax.semilogx(np.repeat(a[np.newaxis, :], 2, 0).T, bands.T,
color=lines[0].get_color(), linewidth=0.1);
ax.fill_between(a, bands[0], bands[1], color=lines[0].get_color(), alpha=0.2)
ax.set_xlabel(xlabel)
ax.plot([50, 50], [evf.min()*0.9 - 0.01, evf.max()*1.1 + 0.01], linewidth= 0.5)
ax.legend()
fig.tight_layout()
</code></pre>
<p><img src="https://alexpacini.gitlab.io/blog/2019/12_17_TandemCoupler/figures/output_31_0.svg"
width="98%"> <img src="https://alexpacini.gitlab.io/blog/2019/12_17_TandemCoupler/figures/output_31_1.svg"
width="98%"> <img src="https://alexpacini.gitlab.io/blog/2019/12_17_TandemCoupler/figures/output_31_2.svg"
width="98%"> <img src="https://alexpacini.gitlab.io/blog/2019/12_17_TandemCoupler/figures/output_31_3.svg"
width="98%"></p>
<pre class="prettyprint"><code class='lang-python'>from scipy import optimize
optimize.minimize(lambda RL: -(C(50, 50, RL, 1, 50)), [25])
</code></pre>
<pre><code> fun: -2501.0000999999925
hess_inv: array([[1.9709295]])
jac: array([0.])
message: 'Optimization terminated successfully.'
nfev: 54
nit: 8
njev: 18
status: 0
success: True
x: array([49.97999471])</code></pre>
<p>The previous code block minimizes the insertion loss and the result is not by chance, but because the power is not lost in the <span class="math inline">\(V_{rw}\)</span> resistor since the reflected wave has zero amplitude.</p>
<h2 id="measurements">Measurements</h2>
<p>A directional coupler built using two <code>Coilcraft SCS-050L_</code> current transformers and two <code>Minicircuit ANNE-50L+</code> 50 Ohm terminations has been characterized with a <code>R&S ZNL3</code> VNA. This measurement is frequency dependent, as it uses real components. The previous analysis results, without including the spice simulation, are not frequency dependent because they used ideal components.</p>
<p>It is worth noting that the measurements are done only with 50 Ohm terminations and, in the previous plots those would be represented by a single point in the non-dispersive (or non frequency dependent) case. If those were frequency dependent, then the plot would be a vertical band (or vertical line), similarly to the effect of uncertainty on the terminations but with a completely different meaning. The two cases shall not be confused.</p>
<pre class="prettyprint"><code class='lang-python'># P1 in, P2 out
iLosss2p = rf.Network(file="s2p/il.s2p")
# P1 in, P2 Vfwd
couplings2p = rf.Network(file="s2p/c.s2p")
# P1 in, P2 Vrev
isolations2p = rf.Network(file="s2p/i.s2p")
# Computing directivity: Isolation/Coupling
directivityS = rf.Network()
directivityS.frequency = isolations2p.frequency
directivityS.s = isolations2p.s[:, 0, 1] / couplings2p.s[:, 0, 1]
frequency = isolations2p.frequency.f
iLoss = iLosss2p.s[:, 0, 1]
rLoss = iLosss2p.s[:, 0, 0]
coupling = couplings2p.s[:, 0, 1]
isolation = isolations2p.s[:, 0, 1]
directivity = directivityS.s[:, 0, 0]
figA = plt.figure('Insertion Loss')
axa = figA.add_subplot(1, 1, 1)
axa.set_xlabel('Frequency (kHz)')
axa.set_ylabel('Magnitude (dB)')
axa.semilogx(frequency/1E3, -20*np.log10(np.abs(iLoss)),
label='Insertion Loss')
axa.legend()
figA.tight_layout()
figB = plt.figure('Other Directional Coupler Parameters')
axb = figB.add_subplot(1, 1, 1)
axb.set_xlabel('Frequency (kHz)')
axb.set_ylabel('Magnitude (dB)')
axb.semilogx(frequency/1E3, -20*np.log10(np.abs(rLoss)), label='Return Loss')
axb.semilogx(frequency/1E3, -20*np.log10(np.abs(coupling)), label='Coupling')
axb.semilogx(frequency/1E3, -20*np.log10(np.abs(isolation)), label='Isolation')
axb.semilogx(frequency/1E3, -20*np.log10(np.abs(directivity)), label='Directivity')
axb.legend()
figB.tight_layout()
</code></pre>
<p><img src="https://alexpacini.gitlab.io/blog/2019/12_17_TandemCoupler/figures/output_35_0.svg"
width="98%"> <img src="https://alexpacini.gitlab.io/blog/2019/12_17_TandemCoupler/figures/output_35_1.svg"
width="98%"></p>
<h2 id="conclusions">Conclusions</h2>
<p>This article described the tandem directional coupler using circuit theory and focused on the error due to uncertainties on the termination resistances. It also shows that the OSL calibration can theoretically minimise this error if the uncertainty is not time dependent (or dependent on the other circuit parameters).</p>
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
</script>
<!--
<script type="text/javascript" async src="https://unpkg.com/mathjax@latest/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" async src="https://cdn.jsdelivr.net/npm/mathjax@latest/unpacked/MathJax.min.js?config=TeX-AMS-MML_HTMLorMML"></script>
-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: { equationNumbers: { autoNumber: "AMS" } }
});
</script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/styles/agate.min.css">
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/highlight.min.js"></script>
<script>hljs.highlightAll();</script>
Alex Pacinihttp://www.blogger.com/profile/13304951646877405715noreply@blogger.com047866 Petrella Guidi RN, Italy43.8415001 12.243168943.8386371 12.2381264 43.844363099999995 12.2482114tag:blogger.com,1999:blog-3207270927898422436.post-82043933607503983302019-07-08T00:39:00.001+02:002021-11-09T19:51:17.983+01:00The Ideal Problem Solver, Second Edition - John D. Bransford, Barry S. Stein<p>ISBN: 0716722054, 9780716722052</p>
<p>This is a very well written must read book, very interesting and with tons of useful hints to improve creativity, problem solving abilities and to become better students, where student means who tries to learn.</p>
<p>The authors stress the difference between being able to memorize and being able to learn, while providing a method for proper problem solving.</p>
<p>I particularly enjoyed this claim:</p>
<blockquote>
<p><em>Successful learners are not worried of making errors</em></p>
</blockquote>
<p>In the following I will list some hints that I found valuable and worth keeping in mind. I hope you will also find those enlightening.</p>
<a name='more'></a>
<ul>
<li>Routine problems can be non routine problems for others with a different knowledge.</li>
<li>Try to identify problems and opportunities:
<ul>
<li>Problems should be treated as opportunities to do something creative.</li>
<li>It pays to look at potential problems. If problems are not identified, solutions are unlikely to be found.</li>
</ul></li>
<li>Take a systematic approach to problem solving. Break the problem into simpler problems and solve them first.</li>
<li>Philosopher Henson: “<em>The creation of new scientific theories enable people to conceptualize events in new and previously unappropriated ways</em>”.</li>
<li>Fractionatism, or to break a concept or idea into its component parts so that new thoughts are more likely to come to mind.</li>
<li>Use analogies.</li>
<li>Use writing as a discovery technique, development of ideas occur more often when trying to communicate them. The process of putting ideas in communicable form helps the development of ideas.</li>
<li>Incubation is to stop thinking for a while. This provides a new framework when the problem is approached again. If we keep the problem in the back of our mind, we may find a host of clues that can help us generate creative ideas.</li>
<li>Scientists often explore the adequacy of their theoretical assumptions by performing thought experiments that involves anticipating outcomes.</li>
<li>Analysis of factual claims is important to validate the evidence for the claim in the right context. The meaning of the claim must be analysed in the context of the claim.</li>
<li>Invited inference is often used to make claims without data, and often to express something not true but without telling the false, like for advertising, but inviting false inference over false claims. An example could be a missing physical quantity (as meter, gram, …). It is important to evaluate properly false claims.</li>
<li>It is a mistake to use correlation as cause and effect. There could be correlation even when there is no cause and effect. However, there are valid cases when correlation could be cause and effect.</li>
<li>The confirmation bias tend to make people to search only for relevant information that explains what they wanted to know and ignores what is against the hypothesis. Confirmation bias and expectancy bias are two different concepts. The confirmation bias means to search only information that confirms the hypothesis, while the expectancy bias means to modify the result based on the expectancy. For example, if you test your abilities to play tennis but you already think not to be an exceptional player, the confirmation bias means to pass over the matches won, while the expectancy bias means to play without much effort.</li>
<li>How to detect flaws in arguments:
<ul>
<li>Evaluate the accuracy of factual claims</li>
<li>Search for logical flaws and inconsistencies</li>
<li>Evaluate the assumptions om which an argument is made</li>
</ul></li>
<li>A memory strategy is to use imagery, or to visualize the statement with an impressive image.</li>
<li>An effective learner should <strong>ask why</strong> a particular characteristics and how this is related to its behavior. The effective learner should be able to identify his/her need of additional knowledge and where to search for that. The effective learner’s methods are not unlike those employed by good researchers and detective confronting with a new problem. The creative mind must be able to confront on new problems and understand the needs for new knowledge. Disciplines requiring a strong reasoning techniques will help growing this comprehension strategies. In contrast, the person who simply concentrate on techniques for memorizing facts, will never know whether there is something new to be understood.</li>
<li>The process of understanding, or better necessary to achieve understanding, are generally more complex that those necessary for memorizing. The ultimate goal of learning is to develop conceptual tools that made it easier to solve important problems.</li>
<li>Monitoring the outcome of our attempts to learn depends, to a great extent, on our ability to anticipate situations in which we will need to use them. The clearer the idea on what you need to know, the better your ability to assess whether you are prepared.</li>
<li>In today’s business environment, it is important for employees at all levels to become problem finders and problem solvers rather than simply people who follows detailed orders. Indeed, an order should be more as a goal than an order.</li>
<li>When teaching, it is important to contextualize, so to use what is taught to real problems. A passive, or transmission model, is quite old and antique. The student must be able to contextualize by itself, which could create the best students, but it is less effective on the majority. Most of the information at school remain inert, because the student does not try to apply it to a real problem. The student does not take the additional effort to do the mind exercise of what-if when required.</li>
<li>Successful learners are not worried of making errors.</li>
</ul>
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
</script>
<!--
<script type="text/javascript" async src="https://unpkg.com/mathjax@latest/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" async src="https://cdn.jsdelivr.net/npm/mathjax@latest/unpacked/MathJax.min.js?config=TeX-AMS-MML_HTMLorMML"></script>
-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: { equationNumbers: { autoNumber: "AMS" } }
});
</script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/styles/agate.min.css">
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/highlight.min.js"></script>
<script>hljs.highlightAll();</script>
Alex Pacinihttp://www.blogger.com/profile/13304951646877405715noreply@blogger.com0Oxford, UK51.7520209 -1.257726300000058551.594735899999996 -1.5804498000000584 51.9093059 -0.93500280000005853tag:blogger.com,1999:blog-3207270927898422436.post-46020537077938501302018-06-27T14:26:00.001+02:002021-11-09T20:22:59.051+01:00Coupled coils and coupling coefficient: from fraction of total flux to inductance definition<p>It is possible to relate the coupling coefficient <span class="math inline">\(k\)</span> to both the total (<span class="math inline">\(\phi_{1}\)</span> or <span class="math inline">\(\phi_{2}\)</span>) and shared flux (<span class="math inline">\(\phi_{12}\)</span> or <span class="math inline">\(\phi_{21}\)</span>) or to the self (<span class="math inline">\(L_{1}\)</span> and <span class="math inline">\(L_{2}\)</span>) and mutual (<span class="math inline">\(M\)</span>) inductances: <span class="math display">\[
k
= \frac{M}{\sqrt{L_{1} L_{2}}}
= \frac{\phi_{12}}{\phi_{1}}
= \frac{\phi_{21}}{\phi_{2}}
\]</span></p>
<p>Simple proof: <a name='more'></a></p>
<p><span class="math display">\[
\begin{aligned}
L_{1} &= \frac{N_{1} \phi_{1}}{i_{1}} &
L_{2} &= \frac{N_{2} \phi_{2}}{i_{2}} \\
M &= \frac{N_{2} \phi_{12}}{i_{1}} &
M &= \frac{N_{1} \phi_{21}}{i_{2}} \\
\end{aligned}
\]</span> <span class="math display">\[
M M = \frac{N_{1} \phi_{21} N_{2} \phi_{12}}{i_{1} i_{2}}
\]</span> If <span class="math inline">\(k = \phi_{12}/\phi_{1}\)</span> and <span class="math inline">\(k = \phi_{21}/\phi_{2}\)</span> <span class="math display">\[
M^{2} = \frac{N_{1} k \phi_{2} N_{2} k \phi_{1}}{i_{1} i_{2}}
\]</span> or <span class="math display">\[
M^{2}
= k^{2} \frac{N_{1} \phi_{1}}{i_{1}}\frac{N_{2}\phi_{2}}{i_{2}}
= k^{2} L_{1} L_{2}
\]</span> therefore <span class="math display">\[
k
= \frac{M}{\sqrt{L_{1} L_{2}}}
= \frac{\phi_{12}}{\phi_{1}}
= \frac{\phi_{21}}{\phi_{2}}
\]</span></p>
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
</script>
<!--
<script type="text/javascript" async src="https://unpkg.com/mathjax@latest/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" async src="https://cdn.jsdelivr.net/npm/mathjax@latest/unpacked/MathJax.min.js?config=TeX-AMS-MML_HTMLorMML"></script>
-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: { equationNumbers: { autoNumber: "AMS" } }
});
</script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/styles/agate.min.css">
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/highlight.min.js"></script>
<script>hljs.highlightAll();</script>
Alex Pacinihttp://www.blogger.com/profile/13304951646877405715noreply@blogger.com0Kensington, London SW7 2AZ, UK51.498799700000014 -0.1748771999999689831.062983200000012 -41.483471199999968 71.934616200000022 41.13371680000003tag:blogger.com,1999:blog-3207270927898422436.post-12864211473029641432018-06-03T00:44:00.002+02:002021-11-09T20:25:52.413+01:00Publication List using BibTeX and BibTeX-js<p>Sometimes it is useful to display a list of publications on a personal website.</p>
<p>There are many ways to do that, with the easiest being to write down each one by hand. While it is quite simple, it is also quite annoying and probably would leave the list not updated after few days (not a big issue for my few publications, but this is a different story).</p>
<p>One of the ways to deal with references is using BibTeX and the associated <code>.bib</code> files, which are the standard for <span class="math inline">\(\LaTeX\)</span> and used also by JabRef as the default database format.</p>
<p>There is a nice Javascript library, <a href="https://github.com/pcooksey/bibtex-js">BibTeX-js</a>, which is able to parse and display .bib files, with the rendering done on the client side when the page is loaded. The only thing to do is to keep an updated <code>.bib</code> file, which is not too demanding, since it is also used for references in the papers.</p>
<p>I therefore decided to share my template, which I personally feel quite clean and nice and would be maybe useful to someone else. It is responsive and the <code>bib</code> link acts as a button to show the bibtex code of the single entry. The books, journal papers and conference papers are separated automatically and ordered by the year, with the newest being first. The clickable link on the DOI is automatically added using the <code>doi</code> value, while the link on the publication title is retrieved from the <code>url</code> value.</p>
<p>As an example see my publication list (<a href="https://alexpacini.gitlab.io/pubs.html">Alex Pacini’s Publications</a>). <a name='more'></a></p>
<style>
.embed-container { position: relative; padding-bottom: 60%; height: 0; overflow: hidden; max-width: 100%; }
.embed-container iframe, .embed-container object, .embed-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
</style>
<div class="embed-container">
<iframe allowfullscreen frameborder="0" src="https://alexpacini.gitlab.io/pubs.html">
</iframe>
</div>
<p>You can find the source code by looking at the page html source code of my personal web page. This is the best way to keep it functional and have this post not getting outdated immediately.</p>
<p>Please put a link to this page if you use it :)</p>
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
</script>
<!--
<script type="text/javascript" async src="https://unpkg.com/mathjax@latest/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" async src="https://cdn.jsdelivr.net/npm/mathjax@latest/unpacked/MathJax.min.js?config=TeX-AMS-MML_HTMLorMML"></script>
-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: { equationNumbers: { autoNumber: "AMS" } }
});
</script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/styles/agate.min.css">
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/highlight.min.js"></script>
<script>hljs.highlightAll();</script>
Alex Pacinihttp://www.blogger.com/profile/13304951646877405715noreply@blogger.com0London, UK51.5073509 -0.1277582999999822351.1912379 -0.77320529999998222 51.8234639 0.51768870000001777tag:blogger.com,1999:blog-3207270927898422436.post-73916045263899351492018-01-10T19:12:00.001+01:002021-11-09T20:26:37.186+01:00Appunti Laurea Magistrale e Triennale, Ingegneria Elettronica, Università di Bologna, Cesena<p>A volte le vacanze natalizie sono utili per riordinare un po’ e così, per liberare spazio, ho deciso di digitalizzare gli appunti. In realtà solo quelli più decenti, quindi non sono tutti i corsi ma solo alcuni.</p>
<p>Meglio sempre prendere il contenuto con senso critico, non dovrebbero esserci errori, ma nel caso lasciare un commento 🤓. <strong>Se pensate vi siano stati utili, accetto ben volentieri una birra! 🍻 </strong> <a name='more'></a></p>
<p><br></p>
<hr />
<h1 id="laurea-magistrale-in-ingegneria-elettronica-e-telecomunicazioni-per-lo-sviluppo-sostenibile-università-di-bologna-cesena-a.a-2012">Laurea Magistrale in <a href="http://www.ingegneriarchitettura.unibo.it/it/corsi/corsi-di-studio/piano-didattico/2012/8199">Ingegneria elettronica e telecomunicazioni per lo sviluppo sostenibile, Università di Bologna, Cesena, A.A 2012</a></h1>
<p><a href="http://doi.org/10.5281/zenodo.1147610">DOI: 10.5281/zenodo.1147610</a></p>
<hr />
<h3 id="teoria-dellinformazione-e-codici-lm-prof.-marco-chiani">TEORIA DELL’INFORMAZIONE E CODICI LM, PROF. MARCO CHIANI</h3>
<ul>
<li><a href="https://zenodo.org/record/1147610/files/TeoInfoCod_Notes_Chiani.pdf">Appunti in PDF</a></li>
<li><a href="https://zenodo.org/record/1147610/files/TeoInfoCod_Proofs_Chiani.pdf">Handbook dimostrazioni in PDF</a></li>
<li><a href="https://pacinispace.blogspot.it/2014/02/theory-of-information-code-snippets.html">MatLab (Octave) assignments</a></li>
</ul>
<h3 id="tecniche-elettromagnetiche-per-la-localizzazione-e-il-controllo-ambientale-lm-prof.-gabriele-falciasecca">TECNICHE ELETTROMAGNETICHE PER LA LOCALIZZAZIONE E IL CONTROLLO AMBIENTALE LM, PROF. GABRIELE FALCIASECCA</h3>
<ul>
<li><a href="https://zenodo.org/record/1147610/files/TecEleLoc_Falciasecca.pdf">Appunti in PDF</a></li>
<li><a href="https://zenodo.org/record/1147610/files/TecEleLoc_Falciasecca_EsRicorrenti.pdf">Esercizi Ricorrenti in PDF</a></li>
</ul>
<h3 id="sistemi-di-telecomunicazioni-lm-prof.-davide-dardari-prof.-alessandro-vanelli-coralli">SISTEMI DI TELECOMUNICAZIONI LM, PROF. DAVIDE DARDARI, PROF. ALESSANDRO VANELLI-CORALLI</h3>
<ul>
<li><a href="https://zenodo.org/record/1147610/files/SistTelecomLM_Mod_1_Dardari.pdf">Appunti Modulo 1, Prof. Dardari, in PDF</a></li>
<li><a href="https://zenodo.org/record/1147610/files/SistTelecomLM_Mod_2_Vanelli.pdf">Appunti Modulo 2, Prof. Vanelli, in PDF</a></li>
</ul>
<h3 id="reti-di-sensori-wireless-per-monitoraggio-ambientale-lm-prof.-davide-dardari">RETI DI SENSORI WIRELESS PER MONITORAGGIO AMBIENTALE LM, PROF. DAVIDE DARDARI</h3>
<ul>
<li><a href="https://zenodo.org/record/1147610/files/RetiSensWirelessMonAmb_Dardari.pdf">Appunti in PDF</a></li>
</ul>
<h3 id="sistemi-elettronici-lm-prof.-nicolò-attilio-speciale">SISTEMI ELETTRONICI LM, PROF. NICOLÒ ATTILIO SPECIALE</h3>
<ul>
<li><a href="https://zenodo.org/record/1147610/files/SisEle_Speciale.pdf">Appunti in PDF</a></li>
</ul>
<h3 id="elaborazione-numerica-dei-segnali-multimediali-lm-prof.-andrea-giorgetti">ELABORAZIONE NUMERICA DEI SEGNALI MULTIMEDIALI LM, PROF. ANDREA GIORGETTI</h3>
<ul>
<li><a href="https://zenodo.org/record/1147610/files/ElabNumSegnMult_Giorgetti.pdf">Appunti in PDF</a></li>
</ul>
<h3 id="chimica-lm-prof.-andrea-munari">CHIMICA LM, PROF. ANDREA MUNARI</h3>
<ul>
<li><a href="https://zenodo.org/record/1147610/files/Chimica_LM_Munari.pdf">Appunti in PDF</a></li>
</ul>
<h3 id="fisica-lm">FISICA LM</h3>
<ul>
<li><a href="https://zenodo.org/record/1147610/files/FisicaLM.pdf">Appunti in PDF</a></li>
</ul>
<h3 id="propagazione-e-pianificazione-nei-sistemi-darea-lm-prof.-vittorio-degli-esposti">PROPAGAZIONE E PIANIFICAZIONE NEI SISTEMI D’AREA LM, PROF. VITTORIO DEGLI ESPOSTI</h3>
<ul>
<li><a href="https://zenodo.org/record/1147610/files/PropPianSistArea_DEsposti.pdf">Appunti in PDF</a></li>
</ul>
<h3 id="sistemi-a-rf-energeticamente-autonomi-lm-prof.-diego-masotti">SISTEMI A RF ENERGETICAMENTE AUTONOMI LM, PROF. DIEGO MASOTTI</h3>
<ul>
<li><a href="https://zenodo.org/record/1147610/files/SistRFEnergAuto_Masotti.pdf">Appunti in PDF</a></li>
</ul>
<h3 id="tecnologie-elettroniche-per-linformazione-e-lenergia-lm-prof.-enrico-sangiorgi-prof.-claudio-fiegna-prof.-franco-mastri">TECNOLOGIE ELETTRONICHE PER L’INFORMAZIONE E L’ENERGIA LM, PROF. ENRICO SANGIORGI, PROF. CLAUDIO FIEGNA, PROF. FRANCO MASTRI</h3>
<ul>
<li><a href="https://zenodo.org/record/1147610/files/TecEleInfoEnergia_m1_m2_Sangiorgi_Fiegna.pdf">Appunti Modulo 1 e 2, Prof. Sangiorgi e Prof. Fiegna, in PDF</a></li>
<li><a href="https://zenodo.org/record/1147610/files/TecEleInfoEnergia_m1_m2_HBForm_Sangiorgi_Fiegna.pdf">Handbook dimostrazioni Modulo 1 e 2, in PDF</a></li>
<li><a href="https://zenodo.org/record/1147610/files/TecEleInfoEnergia_m3_Mastri.pdf">Appunti Modulo 3, Prof. Mastri, in PDF</a></li>
</ul>
<h3 id="equazioni-differenziali-lm-prof.-massimo-cicognani">EQUAZIONI DIFFERENZIALI LM, PROF. MASSIMO CICOGNANI</h3>
<ul>
<li><a href="http://alexpacini.github.io/EqDiff_LM/Eq_diff_LS.pdf">Appunti in PDF</a></li>
</ul>
<p><br></p>
<hr />
<h1 id="laurea-triennale-in-ingegneria-elettronica-informatica-e-telecomunicazioni-università-di-bologna-cesena-a.a.-2009">Laurea Triennale in <a href="http://www.ingegneriarchitettura.unibo.it/it/corsi/corsi-di-studio/piano-didattico/2009/8196">Ingegneria elettronica, informatica e telecomunicazioni, Università di Bologna, Cesena, A.A. 2009</a></h1>
<p><a href="http://doi.org/10.5281/zenodo.1147634">DOI: 10.5281/zenodo.1147634</a></p>
<hr />
<h3 id="complementi-di-elettronica-prof.-marco-tartagni">COMPLEMENTI DI ELETTRONICA, PROF. MARCO TARTAGNI</h3>
<ul>
<li><a href="https://zenodo.org/record/1147634/files/ComplEle_Tartagni.pdf">Appunti in PDF</a></li>
</ul>
<h3 id="elettronica-industriale-prof.-rudi-paolo-paganelli">ELETTRONICA INDUSTRIALE, PROF. RUDI PAOLO PAGANELLI</h3>
<ul>
<li><a href="https://zenodo.org/record/1147634/files/EleInd_Paganelli.pdf">Appunti in PDF</a></li>
</ul>
<h3 id="fisica-generale-b-prof.-maurizio-piccinini">FISICA GENERALE B, PROF. MAURIZIO PICCININI</h3>
<ul>
<li><a href="https://zenodo.org/record/1147634/files/Fisica2_Piccinini.pdf">Appunti in PDF</a></li>
</ul>
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
</script>
<!--
<script type="text/javascript" async src="https://unpkg.com/mathjax@latest/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" async src="https://cdn.jsdelivr.net/npm/mathjax@latest/unpacked/MathJax.min.js?config=TeX-AMS-MML_HTMLorMML"></script>
-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: { equationNumbers: { autoNumber: "AMS" } }
});
</script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/styles/agate.min.css">
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/highlight.min.js"></script>
<script>hljs.highlightAll();</script>
Alex Pacinihttp://www.blogger.com/profile/13304951646877405715noreply@blogger.com0Via Venezia, 52, 47521 Cesena FC, Italy44.1514099 12.24123080000003943.9691154 11.918507300000039 44.333704399999995 12.56395430000004tag:blogger.com,1999:blog-3207270927898422436.post-92038248488664430852017-12-06T10:37:00.000+01:002019-12-21T16:45:38.966+01:00Load- and Position-Independent Moving MHz WPT System Based on GaN-Distributed Current Sources<p>This paper describes the modelling, analysis, and design of a complete (dc-to-dc) inductive wireless power transfer (WPT) system for industrial moving applications. The system operates at 6.78 MHz and delivers up to 150 W to a load moving along a linear path, providing a quasi-constant dc output voltage and maintaining a zero voltage switching operation, regardless of position and load, without any retuning or feedback.</p>
<p>The inductive link consists of an array of stationary transmitting coils and a moving receiving coil whose length is optimized to achieve a constant coupling coefficient along the path. Each Tx coil is individually driven by a constant amplitude and phase sinusoidal current that is generated from a GaN-based coupled load-independent Class EF inverter. Two adjacent transmitters are activated at a given time depending on the receiver’s position; this effectively creates a virtual series connection between the two transmitting coils. The Rx coil is connected to a passive Class E rectifier that is designed to maintain a constant dc output voltage independent of its load and position.</p>
<p>Extensive experimental results are presented to show the performance over different loading conditions and positions. A peak dc-to-dc efficiency of 80% is achieved at 100 W of dc output power and a dc output voltage variation of less than 5% is measured over a load range from 30 to 500 Ω.</p>
<p>The work in this paper is foreseen as a design solution for a high-efficient, maintenance-free, and reliable WPT system for powering sliders and mass movers in industrial automation plants.</p>
<p>This paper is published with Open Access on IEEE Xplore:</p>
<a href="https://doi.org/10.1109/TMTT.2017.2768031">A. Pacini, A. Costanzo, S. Aldhaher and P. D. Mitcheson, “Load- and Position-Independent Moving MHz WPT System Based on GaN-Distributed Current Sources,” in <em>IEEE Transactions on Microwave Theory and Techniques</em>, vol. PP, no. 99, pp. 1-10. doi: 10.1109/TMTT.2017.2768031</a>
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
</script>
<!--
<script type="text/javascript" async src="https://unpkg.com/mathjax@latest/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" async src="https://cdn.jsdelivr.net/npm/mathjax@latest/unpacked/MathJax.min.js?config=TeX-AMS-MML_HTMLorMML"></script>
-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: { equationNumbers: { autoNumber: "AMS" } }
});
</script>
<script type="text/javascript" async src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js?lang=tex&skin=sunburst"></script>
<script type="text/javascript" async src="https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js"></script>
<!--<script type="text/javascript">
$('pre').addClass('prettyprint');
</script>-->
Alex Pacinihttp://www.blogger.com/profile/13304951646877405715noreply@blogger.com0tag:blogger.com,1999:blog-3207270927898422436.post-90140852053296953042017-10-25T18:36:00.002+02:002021-01-20T23:52:13.697+01:00PhD Tutorial: Position and Load Independent DC to DC Wireless Power Transfer System for Moving Applications<p>In order to pass to the third year of the PhD at the University of Bologna, it is required to give a 40 minutes presentation to first introduce your field, in the form of a tutorial, and then briefly show your research.</p>
<p>The presentation is organized as follows</p>
<ul>
<li>Tutorial
<ul>
<li>Introduction to Wireless Power Transfer (WPT)</li>
<li>Inductive Power Transfer (IPT)</li>
<li>Class E Resonant Inverter</li>
<li>Advantages of Wide Bandgap Semiconductors (WBG)</li>
</ul></li>
<li>Research Contribution
<ul>
<li>Geometry Optimization of Sliding Inductive Links for Position-Independent Wireless Power Transfer</li>
<li>Design of a Position-Independent End-to-End Inductive WPT Link for Industrial Dynamic Systems <a name='more'></a></li>
</ul></li>
</ul>
<object data="https://alexpacini.gitlab.io/blog/2017/10_25_PhD_Tutorial_Position_and_Load_Independent_dc_dc/PhDTutorial_APacini2017.gs.pdf" height="700" type="application/pdf" width="100%">
<p>
<a href="https://alexpacini.gitlab.io/blog/2017/10_25_PhD_Tutorial_Position_and_Load_Independent_dc_dc/PhDTutorial_APacini2017.gs.pdf">Your browser does not support embedded pdfs: download the file from this link.</a>
</p>
</object>
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
</script>
<!--
<script type="text/javascript" async src="https://unpkg.com/mathjax@latest/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" async src="https://cdn.jsdelivr.net/npm/mathjax@latest/unpacked/MathJax.min.js?config=TeX-AMS-MML_HTMLorMML"></script>
-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: { equationNumbers: { autoNumber: "AMS" } }
});
</script>
<script type="text/javascript" async src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js?lang=tex&skin=sunburst"></script>
<script type="text/javascript" async src="https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js"></script>
<!--<script type="text/javascript">
$('pre').addClass('prettyprint');
</script>-->
Alex Pacinihttp://www.blogger.com/profile/13304951646877405715noreply@blogger.com0Viale del Risorgimento, 2, 40136 Bologna BO, Italy44.4881095 11.32842049999999344.4866935 11.325898999999993 44.4895255 11.330941999999993tag:blogger.com,1999:blog-3207270927898422436.post-29528226670574901592017-10-25T17:29:00.001+02:002021-01-20T23:51:39.266+01:00Introduction to Wide BandGap Semiconductors and Class E rectifier<p>As an assignment to achieve the PhD credits for the Summer School of Information Engineering, it was requested to write a short report. This is a very simple introduction to Wide BandGap Semiconductors and Class E rectifier. <a name='more'></a></p>
<object data="https://alexpacini.gitlab.io/blog/2017/10_25_Introduction_to_Wide_BandGap_Semiconductors_and_Class_E_rectifier/SSIE2017_AlexPacini.pdf" height="700" type="application/pdf" width="100%">
<p>
<a href="https://alexpacini.gitlab.io/blog/2017/10_25_Introduction_to_Wide_BandGap_Semiconductors_and_Class_E_rectifier/SSIE2017_AlexPacini.pdf">Your browser does not support embedded pdfs: download the file from this link.</a>
</p>
</object>
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
</script>
<!--
<script type="text/javascript" async src="https://unpkg.com/mathjax@latest/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" async src="https://cdn.jsdelivr.net/npm/mathjax@latest/unpacked/MathJax.min.js?config=TeX-AMS-MML_HTMLorMML"></script>
-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: { equationNumbers: { autoNumber: "AMS" } }
});
</script>
<script type="text/javascript" async src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js?lang=tex&skin=sunburst"></script>
<script type="text/javascript" async src="https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js"></script>
<!--<script type="text/javascript">
$('pre').addClass('prettyprint');
</script>-->
Alex Pacinihttp://www.blogger.com/profile/13304951646877405715noreply@blogger.com0Via Rio Bianco, 12, 39042 Bressanone BZ, Italy46.7196958 11.65251710000006846.6761413 11.571836100000068 46.763250299999996 11.733198100000068tag:blogger.com,1999:blog-3207270927898422436.post-25238396472827439682017-07-09T02:31:00.002+02:002021-11-09T20:27:54.524+01:00Python matplotlib: insets and aligned legends<p>Sometimes it is needed to create a plot with several lines and to assign a legend to each of them, which quite often ends in cumbersome and clunky legends. In my opinion, a more elegant way is include the legend as aligned text aside to each plot line, which is possible using Python and matplotlib.</p>
<p>Furthermore, to better highlight some details it is also possible to use an inset, hence to add a box which zooms a particular detail of the plot.</p>
<p>In the following is the Python code. The style is optimised for an IEEEtran journal. <a name='more'></a></p>
<pre class="prettyprint lang-python"><code>import scipy as sc
import matplotlib.pyplot as plt
import matplotlib
from cycler import cycler
from mpl_toolkits.axes_grid1.inset_locator import mark_inset
plt.close('all')
# Create a list of colours from the colormap viridis
color = plt.get_cmap('viridis')(sc.linspace(0, 1, 12))
# Set the settings to perform well in a IEEEtran document
params_IEEEtran = {'legend.fontsize': 10,
'axes.labelsize': 10,
'axes.titlesize': 10,
'xtick.labelsize': 9,
'ytick.labelsize': 9,
'mathtext.fontset': 'stix',
'font.family': 'Times New Roman',
'mathtext.rm': 'serif',
'mathtext.bf': 'serif:bold',
'mathtext.it': 'serif:italic',
'mathtext.sf': 'sans\\-serif',
'grid.color': 'k',
'grid.linestyle': ':',
'grid.linewidth': 0.5,
'axes.xmargin': 0,
'axes.axisbelow': False,
'lines.linewidth': 1.0,
'legend.frameon': False,
'axes.prop_cycle': cycler('color', color),
'figure.figsize': [3, 2.4],
}
plt.rcParams.update(params_IEEEtran)
# Create some sample data
x = sc.linspace(0.1, 100)[:, sc.newaxis]
e = sc.arange(0, 11, 1)[sc.newaxis, :]
y = e*x
# Main plot
fig = plt.figure('FIG')
ax = fig.add_subplot(1, 1, 1)
ax.plot(x, y)
# Put labels outside the plot
xmax = max(x)
text = [ax.text(1.01*xmax, y[-1, x], r'$' + str(x) + r'x$',
color=color[n]) for (n, x) in enumerate(e[0, :])]
# Create the inset
inset = fig.add_axes([0.25, 0.6, 0.3, 0.3]) # Fraction of figure size (3, 2.4)
inset.axes.get_xaxis().set_visible(False)
inset.axes.get_yaxis().set_visible(False)
inset.plot(x, y)
[x.set_linewidth(0.5) for x in inset.spines.values()]
inset.set_xlim(0, 5)
inset.set_ylim(-1, 50)
# Create the box for the inset
box, c1, c2 = mark_inset(ax, inset, loc1=4, loc2=3, lw=0.3,
fc="none", ec=matplotlib.colors.hex2color('#900000'),
zorder=200)
box.set_linewidth(1)
box.set_color('k')
# Set the axis labels
ax.set_xlabel(r'$x$')
ax.set_ylabel(r'$f(x)$')
fig.tight_layout()
# Save as png and pdf
fig.savefig('./example.pdf', bbox_inches='tight', pad_inches=0)
fig.savefig('./example.png', bbox_inches='tight', dpi=300, pad_inches=0)
</code></pre>
<p>Which will result in the following plot:</p>
<p><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXVhSYDuYuCQpplZNPuU-fHq7rmdHF3MMuPZ06kuuzAUMtCtcYk9Ie0WF9VyXk4nS3ckvEFYvP3akFk_UWkj7OeRJYu31a26FIvuX6O0rc3IuYK6elcYOLLdZb5LJfYgw_FOwHrKkVQh8/s640/example.png" style="width:500px;"></p>
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
</script>
<!--
<script type="text/javascript" async src="https://unpkg.com/mathjax@latest/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" async src="https://cdn.jsdelivr.net/npm/mathjax@latest/unpacked/MathJax.min.js?config=TeX-AMS-MML_HTMLorMML"></script>
-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: { equationNumbers: { autoNumber: "AMS" } }
});
</script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/styles/agate.min.css">
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/highlight.min.js"></script>
<script>hljs.highlightAll();</script>
Alex Pacinihttp://www.blogger.com/profile/13304951646877405715noreply@blogger.com0tag:blogger.com,1999:blog-3207270927898422436.post-19848587717837409302017-02-09T09:00:00.006+01:002021-11-09T20:43:29.905+01:00Peer review template based on IEEEtran and pandoc<p>When you start to be involved in scientific publishing, one of the <em>side-effects</em> is to become a reviewer for some journals. This <em>side-effect</em> is an extremely important part of the scientific publishing process, which should ensure the quality of the published papers. It has also some other advantages, as to be able to view the papers few months before they would be published. The major downside is the time required for a good review, even days.</p>
<p>To simplify the writing process I decided to create a simple workflow which is based on <span class="math inline">\(\LaTeX\)</span>, IEEEtran and pandoc. The final output will be made up of a .pdf file, formatted as an IEEEtran journal, and a .rst file, formatted as a reStructuredText. The .pdf is ideal for viewing the math, figures, etc., while the .rst file is ideal to be pasted in the comments part, which is the part that will be sent in the email to the authors. <a name='more'></a></p>
<p>The template is quite simple:</p>
<pre class='tex'><code>%% Template made by Alex Pacini V1.1.0
%% IEEE template adapted for reviews
\documentclass[journal]{IEEEtran}
%\usepackage[a-1b]{pdfx} %% Use this if you want a pdf/a
%\usepackage[T1]{fontenc} %% Use the T1 font encoding if you write in a language other than english.
\usepackage[utf8]{inputenc}
\usepackage{cite}
\usepackage[pdftex]{graphicx}
\graphicspath{{./images/}} %% Put your images in an "images" folder
\usepackage{amsmath,amsfonts}
\interdisplaylinepenalty=2500
\usepackage{array}
\usepackage{url}
\usepackage{microtype}
\usepackage[keeplastbox]{flushend}
%% SET HERE {
\newcommand{\revnum}{V:1.0.0} % Version of the review (Main number, 1:First Round, 2:Second Round)
\newcommand{\MID}{MID-XX-00-000} %% MID of the paper in revision
\title{Review \revnum: \\
Wonderful Paper in a Wonderful Journal} % Title of the paper.
%%}
%% Some redefinitions for the title DO NOT CHANGE {
\newcommand{\rversion}{\MID~-~\revnum~\pdfcreationdate}
\newcommand{\rheader}{\rversion}
%\author{\rversion}
\author{}
%% }
\markboth{\rheader}{\rheader}
\begin{document}
\maketitle
\section*{\textbf{Version}}
\noindent
\textbf{\rversion}
\section{Summary}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas laoreet, leo ac congue mattis, justo sem feugiat ex, id ornare dui nibh id mi. Vivamus ut sapien porta risus blandit euismod. Ut lobortis, dui ac accumsan luctus, mi velit venenatis sem, et dignissim ex nisl a sem. Mauris molestie blandit risus faucibus aliquet. Curabitur a dictum dui. Proin eu urna risus. Proin at sagittis metus. Cras ac tellus lorem. Aliquam consequat dui vestibulum consectetur sodales. Curabitur cursus convallis sem eget sollicitudin. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
Sed eleifend pulvinar convallis. Sed porta ligula in ornare interdum. Cras gravida est arcu, at ultrices dolor ullamcorper nec. Fusce sapien lacus, lacinia feugiat metus sit amet, scelerisque hendrerit odio. Curabitur sit amet dui id diam maximus faucibus. Ut fermentum quam id congue ornare. Nam placerat rutrum auctor. Cras commodo viverra nunc id venenatis.
Nunc id odio quis justo ullamcorper facilisis. Vivamus luctus eros ornare tellus mollis tincidunt. Donec eget justo tempus, consequat ante vel, tincidunt odio. Sed sagittis nisl at velit volutpat, nec sagittis nunc aliquet. Vestibulum laoreet congue pharetra. Quisque semper, sem et dapibus fringilla, purus lacus euismod nunc, eu mattis odio purus sed tortor. Curabitur eleifend, tortor vitae facilisis malesuada, felis est ullamcorper tortor, eget faucibus quam tellus a felis. Curabitur sed orci vel est vehicula ornare. Sed pharetra arcu nec euismod varius. Quisque lobortis massa sem, in ultrices leo tempus ut. Vestibulum vestibulum enim varius orci porta aliquam. Etiam tincidunt sed nulla at convallis. Nunc diam leo, laoreet ac tortor eget, vehicula tempor lectus. Quisque sit amet justo dictum, vulputate nulla in, scelerisque eros.
\section{General Comments}
Maecenas a tellus tincidunt, porttitor dui vel, varius metus. Donec vitae sem leo. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed laoreet nulla urna, eu interdum dui consectetur sed. Fusce ligula risus, egestas ac quam et, porttitor tempus turpis. Mauris rhoncus ante vitae risus tempor pulvinar et sed tortor. Donec interdum mauris sed dui tincidunt, et porta metus sodales. Aliquam id eros tortor. Donec suscipit elit ut nisl laoreet, in tempus nunc elementum. Vivamus tempor, lorem ut tincidunt pulvinar, massa nunc vestibulum neque, in convallis mauris erat non dolor. Nulla scelerisque dapibus tortor nec convallis. Donec vitae dictum est. Proin a mauris ut purus blandit rhoncus. Pellentesque tincidunt malesuada eros id tempus. Nullam eget diam eu neque tincidunt sollicitudin.
In varius lorem et ante fringilla, at sodales turpis porttitor. Praesent tempor enim ac tellus facilisis, sed lacinia metus commodo. Nunc id condimentum ipsum. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Morbi a ante dapibus, elementum ipsum id, convallis turpis. In ut orci in justo auctor tristique vitae in elit. Vivamus finibus purus a tellus venenatis, convallis dictum metus iaculis. Etiam feugiat fermentum augue sit amet suscipit.
Cras eu feugiat felis. Etiam a elit velit. Ut a purus vehicula est fermentum auctor. Suspendisse eu nunc sed elit convallis venenatis. Duis id finibus tellus. Nam sed ligula vitae tortor pulvinar mollis eu eu velit. Donec ultricies quam quis est sollicitudin vulputate. Morbi lacinia, sem ac congue rutrum, turpis ante porttitor libero, in semper purus orci in magna. Aliquam varius, justo eget sodales cursus, nisl mi condimentum tellus, rhoncus ultrices tellus diam id purus.
Vivamus a lacus ultrices, consectetur felis nec, viverra tortor. Nulla ac maximus leo. In scelerisque rutrum ornare. Proin convallis quam velit, eget mattis tellus egestas eget. Duis sagittis metus elit, quis lacinia odio fermentum non. Sed eget nulla quam. Curabitur felis leo, suscipit at porta eget, fermentum vel nulla. Quisque sollicitudin eros purus, eget ornare urna lobortis ac. Vestibulum at ultrices lacus, sed eleifend nibh. Suspendisse vitae eros vitae justo ornare pulvinar. Ut eu vestibulum neque, vitae mollis nunc. Nunc quis ullamcorper dolor. Phasellus efficitur eros a velit consectetur lobortis.
\section{Specific Comments}
Quisque volutpat non tortor non malesuada. Ut nec lacus sed ante pretium faucibus sed quis magna. Donec vel consectetur turpis, a maximus lectus. Vivamus sodales velit non nisi tempor dapibus. Suspendisse potenti. Sed viverra venenatis metus, id viverra ante ultrices lacinia. Nulla vestibulum magna sed felis efficitur lacinia et et est. Fusce sit amet neque elit. Sed dolor massa, sagittis vel bibendum nec, porttitor quis arcu. Sed interdum eros sed pellentesque commodo. Donec ultricies nisl enim, ac tempus dolor accumsan in. Aliquam erat volutpat. In hac habitasse platea dictumst. Praesent vel tempor lorem.
Nam id efficitur urna. Duis efficitur nunc urna, in placerat enim malesuada mattis. Mauris a tortor efficitur, pellentesque lacus vitae, vehicula risus. Praesent sit amet pulvinar felis. Etiam porttitor, mi ac tincidunt fermentum, lacus justo ultrices nunc, et placerat dolor nunc non sapien. Pellentesque at tellus eros. Duis iaculis ultrices erat ultricies dictum. In faucibus in ante quis auctor. Cras convallis aliquet augue in sollicitudin. Praesent sed laoreet lacus, eu iaculis mi. Nunc tincidunt lectus eget orci pharetra, eget lobortis leo condimentum. Cras at vestibulum ligula. Cras vehicula sed tellus vitae malesuada. Suspendisse potenti.
Aenean id mollis ante. Aliquam erat volutpat. Nunc ultrices, erat nec condimentum tristique, lorem sapien porta orci, eu commodo augue elit convallis dolor. Integer viverra lobortis rutrum. Sed vitae lorem neque. Suspendisse eget scelerisque sem, ut egestas nisi. Vestibulum pulvinar ornare dolor, in eleifend mi accumsan eu. Duis lobortis, libero vestibulum viverra auctor, odio turpis facilisis ante, ac congue nunc lacus vitae nisl.
Vivamus eros ipsum, dictum sit amet convallis pharetra, elementum ut nibh. Nunc eleifend urna turpis, luctus aliquet massa blandit ac. Fusce convallis nisl in diam tincidunt, semper mattis sem blandit. In tortor lectus, egestas ut pharetra ac, suscipit sed elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed interdum orci eget odio aliquet finibus congue pulvinar libero. Aenean ex urna, aliquet sed lacus a, finibus pharetra quam.
\section{Conclusions}
I recommend to \textbf{ACCEPT} the paper with a \textbf{MAJOR} revision.
%\bibliographystyle{IEEEtran} % Enable these if you want to add some bibliography
%\bibliography{ref}
% that's all folks
\end{document}
</code></pre>
<p>Which will result in the following .pdf:</p>
<object data="https://alexpacini.gitlab.io/blog/2017/02_09_Peer_review_template_based_on_IEEEtran_and_pandoc/MID-XX-00-000_R1.0.0.pdf" height="700" type="application/pdf" width="100%">
<p>
<a href="https://alexpacini.gitlab.io/blog/2017/02_09_Peer_review_template_based_on_IEEEtran_and_pandoc/MID-XX-00-000_R1.0.0.pdf">Your browser does not support embedded pdfs: download the file from this link.</a>
</p>
</object>
</br></br> And then, by running:
<pre class="prettyprint"><code> pandoc -f latex -t rst MID-XX-00-000_R1.0.0.tex > MID-XX-00-000_R1.0.0.rst
</code></pre>
the following .rst is obtained, which can be copied in the comments section:
<pre class="prettyprint lang-html"><code>**Version**
===========
**MID-XX-00-000 - V:1.0.0 **
Summary
=======
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas
laoreet, leo ac congue mattis, justo sem feugiat ex, id ornare dui nibh
id mi. Vivamus ut sapien porta risus blandit euismod. Ut lobortis, dui
ac accumsan luctus, mi velit venenatis sem, et dignissim ex nisl a sem.
Mauris molestie blandit risus faucibus aliquet. Curabitur a dictum dui.
Proin eu urna risus. Proin at sagittis metus. Cras ac tellus lorem.
Aliquam consequat dui vestibulum consectetur sodales. Curabitur cursus
convallis sem eget sollicitudin. Pellentesque habitant morbi tristique
senectus et netus et malesuada fames ac turpis egestas.
Sed eleifend pulvinar convallis. Sed porta ligula in ornare interdum.
Cras gravida est arcu, at ultrices dolor ullamcorper nec. Fusce sapien
lacus, lacinia feugiat metus sit amet, scelerisque hendrerit odio.
Curabitur sit amet dui id diam maximus faucibus. Ut fermentum quam id
congue ornare. Nam placerat rutrum auctor. Cras commodo viverra nunc id
venenatis.
Nunc id odio quis justo ullamcorper facilisis. Vivamus luctus eros
ornare tellus mollis tincidunt. Donec eget justo tempus, consequat ante
vel, tincidunt odio. Sed sagittis nisl at velit volutpat, nec sagittis
nunc aliquet. Vestibulum laoreet congue pharetra. Quisque semper, sem et
dapibus fringilla, purus lacus euismod nunc, eu mattis odio purus sed
tortor. Curabitur eleifend, tortor vitae facilisis malesuada, felis est
ullamcorper tortor, eget faucibus quam tellus a felis. Curabitur sed
orci vel est vehicula ornare. Sed pharetra arcu nec euismod varius.
Quisque lobortis massa sem, in ultrices leo tempus ut. Vestibulum
vestibulum enim varius orci porta aliquam. Etiam tincidunt sed nulla at
convallis. Nunc diam leo, laoreet ac tortor eget, vehicula tempor
lectus. Quisque sit amet justo dictum, vulputate nulla in, scelerisque
eros.
General Comments
================
Maecenas a tellus tincidunt, porttitor dui vel, varius metus. Donec
vitae sem leo. Pellentesque habitant morbi tristique senectus et netus
et malesuada fames ac turpis egestas. Sed laoreet nulla urna, eu
interdum dui consectetur sed. Fusce ligula risus, egestas ac quam et,
porttitor tempus turpis. Mauris rhoncus ante vitae risus tempor pulvinar
et sed tortor. Donec interdum mauris sed dui tincidunt, et porta metus
sodales. Aliquam id eros tortor. Donec suscipit elit ut nisl laoreet, in
tempus nunc elementum. Vivamus tempor, lorem ut tincidunt pulvinar,
massa nunc vestibulum neque, in convallis mauris erat non dolor. Nulla
scelerisque dapibus tortor nec convallis. Donec vitae dictum est. Proin
a mauris ut purus blandit rhoncus. Pellentesque tincidunt malesuada eros
id tempus. Nullam eget diam eu neque tincidunt sollicitudin.
In varius lorem et ante fringilla, at sodales turpis porttitor. Praesent
tempor enim ac tellus facilisis, sed lacinia metus commodo. Nunc id
condimentum ipsum. Cum sociis natoque penatibus et magnis dis parturient
montes, nascetur ridiculus mus. Morbi a ante dapibus, elementum ipsum
id, convallis turpis. In ut orci in justo auctor tristique vitae in
elit. Vivamus finibus purus a tellus venenatis, convallis dictum metus
iaculis. Etiam feugiat fermentum augue sit amet suscipit.
Cras eu feugiat felis. Etiam a elit velit. Ut a purus vehicula est
fermentum auctor. Suspendisse eu nunc sed elit convallis venenatis. Duis
id finibus tellus. Nam sed ligula vitae tortor pulvinar mollis eu eu
velit. Donec ultricies quam quis est sollicitudin vulputate. Morbi
lacinia, sem ac congue rutrum, turpis ante porttitor libero, in semper
purus orci in magna. Aliquam varius, justo eget sodales cursus, nisl mi
condimentum tellus, rhoncus ultrices tellus diam id purus.
Vivamus a lacus ultrices, consectetur felis nec, viverra tortor. Nulla
ac maximus leo. In scelerisque rutrum ornare. Proin convallis quam
velit, eget mattis tellus egestas eget. Duis sagittis metus elit, quis
lacinia odio fermentum non. Sed eget nulla quam. Curabitur felis leo,
suscipit at porta eget, fermentum vel nulla. Quisque sollicitudin eros
purus, eget ornare urna lobortis ac. Vestibulum at ultrices lacus, sed
eleifend nibh. Suspendisse vitae eros vitae justo ornare pulvinar. Ut eu
vestibulum neque, vitae mollis nunc. Nunc quis ullamcorper dolor.
Phasellus efficitur eros a velit consectetur lobortis.
Specific Comments
=================
Quisque volutpat non tortor non malesuada. Ut nec lacus sed ante pretium
faucibus sed quis magna. Donec vel consectetur turpis, a maximus lectus.
Vivamus sodales velit non nisi tempor dapibus. Suspendisse potenti. Sed
viverra venenatis metus, id viverra ante ultrices lacinia. Nulla
vestibulum magna sed felis efficitur lacinia et et est. Fusce sit amet
neque elit. Sed dolor massa, sagittis vel bibendum nec, porttitor quis
arcu. Sed interdum eros sed pellentesque commodo. Donec ultricies nisl
enim, ac tempus dolor accumsan in. Aliquam erat volutpat. In hac
habitasse platea dictumst. Praesent vel tempor lorem.
Nam id efficitur urna. Duis efficitur nunc urna, in placerat enim
malesuada mattis. Mauris a tortor efficitur, pellentesque lacus vitae,
vehicula risus. Praesent sit amet pulvinar felis. Etiam porttitor, mi ac
tincidunt fermentum, lacus justo ultrices nunc, et placerat dolor nunc
non sapien. Pellentesque at tellus eros. Duis iaculis ultrices erat
ultricies dictum. In faucibus in ante quis auctor. Cras convallis
aliquet augue in sollicitudin. Praesent sed laoreet lacus, eu iaculis
mi. Nunc tincidunt lectus eget orci pharetra, eget lobortis leo
condimentum. Cras at vestibulum ligula. Cras vehicula sed tellus vitae
malesuada. Suspendisse potenti.
Aenean id mollis ante. Aliquam erat volutpat. Nunc ultrices, erat nec
condimentum tristique, lorem sapien porta orci, eu commodo augue elit
convallis dolor. Integer viverra lobortis rutrum. Sed vitae lorem neque.
Suspendisse eget scelerisque sem, ut egestas nisi. Vestibulum pulvinar
ornare dolor, in eleifend mi accumsan eu. Duis lobortis, libero
vestibulum viverra auctor, odio turpis facilisis ante, ac congue nunc
lacus vitae nisl.
Vivamus eros ipsum, dictum sit amet convallis pharetra, elementum ut
nibh. Nunc eleifend urna turpis, luctus aliquet massa blandit ac. Fusce
convallis nisl in diam tincidunt, semper mattis sem blandit. In tortor
lectus, egestas ut pharetra ac, suscipit sed elit. Cum sociis natoque
penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed
interdum orci eget odio aliquet finibus congue pulvinar libero. Aenean
ex urna, aliquet sed lacus a, finibus pharetra quam.
Conclusions
===========
I recommend to **ACCEPT** the paper with a **MAJOR** revision.
</code></pre>
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
</script>
<!--
<script type="text/javascript" async src="https://unpkg.com/mathjax@latest/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" async src="https://cdn.jsdelivr.net/npm/mathjax@latest/unpacked/MathJax.min.js?config=TeX-AMS-MML_HTMLorMML"></script>
-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: { equationNumbers: { autoNumber: "AMS" } }
});
</script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/styles/agate.min.css">
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/highlight.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/languages/latex.min.js"></script>
<script>hljs.highlightAll();</script>
Alex Pacinihttp://www.blogger.com/profile/13304951646877405715noreply@blogger.com0tag:blogger.com,1999:blog-3207270927898422436.post-22044985787716498662017-02-09T08:37:00.003+01:002021-01-20T23:48:23.872+01:00International Morse Code<p>This is a nerdy post, just to share a cheat-sheet which contains the International Morse Code along with the NATO Phonetic alphabet. I created this, using various resources online, just to lose some time… <a name='more'></a></p>
<object data="https://alexpacini.gitlab.io/blog/2017/02_09_International_Morse_Code/International_Morse_Code.pdf" height="700" type="application/pdf" width="100%">
<p>
<a href="https://alexpacini.gitlab.io/blog/2017/02_09_International_Morse_Code/International_Morse_Code.pdf">Your browser does not support pdfs: download the file from this link.</a>
</p>
</object>
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
</script>
<!--
<script type="text/javascript" async src="https://unpkg.com/mathjax@latest/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" async src="https://cdn.jsdelivr.net/npm/mathjax@latest/unpacked/MathJax.min.js?config=TeX-AMS-MML_HTMLorMML"></script>
-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: { equationNumbers: { autoNumber: "AMS" } }
});
</script>
<script type="text/javascript" async src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js?lang=tex&skin=sunburst"></script>
<script type="text/javascript" async src="https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js"></script>
<!--<script type="text/javascript">
$('pre').addClass('prettyprint');
</script>-->
Alex Pacinihttp://www.blogger.com/profile/13304951646877405715noreply@blogger.com0tag:blogger.com,1999:blog-3207270927898422436.post-61350481134299966522017-02-08T22:40:00.006+01:002021-11-09T20:39:44.574+01:00Import a RF design (and logos) from svg, png or Gerber files into Kicad<p>KiCad is a wonderful software for PCB designing, it is open-source and can handle the complete workflow from the schematic to the final layout.</p>
<p>Unfortunately, it is not (yet) intended for RF circuit and antenna design. In these cases, a suitable program should be used, which could be ADS, CST, HFSS, or others. These are expensive but, unfortunately, the open-source tools are still not complete enough. I generally use multiple open-source tools depending of the requirements and quite often compare the results to evaluate the correctness.</p>
<p>Long story short, I was facing with the need to create a PCB by incorporating some custom Inductive Power Transfer coils, which I could export to a Gerber file from CST and some patch antennas and matching circuits, from ADS. The idea was to import the different parts from the Gerbers into different footprints, which are then assigned to schematics blocks and placed on the PCB.</p>
<p>There are no ways (yet) to get it simply by using some pre-baked functions, but some tricks are needed.</p>
<p>This post is a walk-through different options that can be used. I try to compare the options and outline the strengths of each one.</p>
<p>Notice that the same methods can be used to produce custom logos or any custom shape.</p>
<a name='more'></a>
<h1 id="shape-conversion">Shape conversion</h1>
<h2 id="kicads-bitmap-to-component-converter">Kicad’s Bitmap to Component Converter</h2>
<p>This is method is probably the simplest and requires only simple workarounds, simple enough to be done using a text editor, and provides an very good final PCB. It is suitable for for logos and complex shapes. The disadvantage is that the file can be quite big in size because of its raster nature, anyway I have not yet experienced any issue because of the size (in bytes) of the the footprint. At worst, for example with several footprints in a single board, it might make Kicad sluggish on old pc.</p>
<ol type="1">
<li>The <em>Gerber</em> (or another format) is converted to a <em>pdf</em> or <em>svg</em>.</li>
<li>The file is opened with Inkscape, the alpha channel (Kicad 5 might work even without that) is changed to <strong>255</strong> (File -> Document Properties -> Background Color) and, by selecting the circuit to be included in the footprint, it is then exported as a <em>png</em> image, possibly with a resolution higher than 600dpi (<strong>2400dpi or 4800dpi is better</strong>).</li>
<li>From the main Kicad window, open the tool <em>bitmap2component</em>, load the <em>png</em>, if required choose negative and/or an appropriate threshold than makes the <em>Black&White</em> image well defined, then <em>export as kicad_mod</em>. Unfortunately, the tool can only create layers that are not copper, and a workaround is needed to move the layer from SilkScreen to a Cu layer.</li>
<li>Open the <code>.kicad_mod</code> file with a text editor (Kwrite, Notepad++) (or, if you are brave enough, using perl or Python with a regex) and replace the <code>(layer F.SilkS)</code> with <code>(layer F.Cu)</code> for the front copper layer or with <code>(layer B.Cu)</code> for the bottom copper layer. Notice that layer in <code>(module NAME (layer F.Cu)</code> means the default layer for placement of the component. It is normally F.Cu and can be flipped in the editor if required (<code>F</code> hotkey).</li>
<li>From the main Kicad window, open the PCB Footprint Editor, import the kicad_mod file from the file menu, add the pads. Remind that vias, if required, need to be added as pads. My hint is to number the I/O pads with numbers (1, 2, 3, …) and the vias using the <code>~</code> as pad number (it is like a no-number).</li>
<li>Save it in a custom library, assign the footprint to a custom symbol from the schematic and then place it in the pcb. You can even use the same png to create a custom symbol and can be done using again <em>bitmap2component</em> without any particular workaround. In this way the schematic will be pretty nice (ADS does something quite similar for the schematic symbol). See <a href="http://docs.kicad-pcb.org/stable/en/getting_started_in_kicad.html">the Kicad Doc</a> for more help on this last bullet point.</li>
</ol>
<h2 id="kicads-gerber-to-pcbnew-converter">Kicad’s Gerber to PcbNew converter</h2>
<p>This is method is is probably the most complex and error prone of all the methods outlined here. It does not work with all possible Gerbers and it is not easy to know in advance when it will fail. On the other hand, it provides the most accurate translation of the Gerber file and using the same number of shapes as used in the Gerber. The result is a footprint file that has a small size (in bytes).</p>
<p>It is suitable only for footprints that have a Gerber parent, for example exported from ADS. It might require some tweaks which need a bit of experience to be properly done, as they are not known in advance and they sometimes involve a bit of creativity.</p>
<ol type="1">
<li>The Gerber (this time needs to be a gerber) is opened with <em>GerbView</em> and exported to <em>PcbNew</em> (from the File menu), hence to a <code>.kicad_pcb</code> file.</li>
<li>The issue is to convert the kicad_pcb to a kicad_mod, which is quite dependent on the Gerber file used as input. From the question <a href="https://forum.kicad.info/t/gerber-to-kicad-mod/5216">here</a> we can get some hints for the conversion. Basically, the <code>segment</code> is replaced by <code>fp_line</code> and the <code>(net x)</code> is removed, as the footprint does not have a netlist but only pads for connecting to the outside world. It replaces <code>gr_poly</code> with <code>fp_poly</code>.</li>
<li>The <code>via</code> is replaced by a <code>pad</code> on all copper layers. the arguments are different and hence this should be done carefully. The pad number could be set to <code>~</code>. For example:
<pre class="prettyprint"><code>(pad ~ thru_hole circle (at 72.39 78.73999999999999) (size 1.3 1.3) (drill 0.6) (layers F.Cu B.Cu))
</code></pre></li>
<li>A header has to be added above the text:
<pre class="prettyprint"><code>(module ModuleName
(layer F.Cu)
(at 0.000000 0.000000 0.000000)
(descr "Module Description")
</code></pre></li>
<li>A footer is added below:
<pre class="prettyprint"><code>)
</code></pre>
<!--
I tried putting up a regex using perl to do the above subsitution (probably it is incomplete, comment with issues and, possibly, fixes):
<pre class="prettyprint lang-pl"><code>perl -pe 's/(\s*)\(segment(.*)\s\(net\s0\)/\1(fp_line\2/g; s/(\s)\(via(.*)\(size\s([0-9.] )\)\s(.*)/\1(pad ~ thru_hole circle\2(size \3 \3 )(drill 0.6) \4/g; s/\s*\((?:kicad_pcb|(?:layers\s\W)|\d).*//g; s/^\s*(?:\))?\r?\n//g; eof && do{chomp; print "$_)"; exit}; print qq{(module ModuleName\n(layer F.Cu)\n(at 0.000000 0.000000 0.000000)\n(descr "Module Description")\n$_} if $. == 1;' RF.kicad_pcb > RF.kicad_mod
</code></pre>--></li>
</ol>
<p>I tried putting up a regex using python to do the all the above substitutions. It is probably incomplete, comment if you find issues. Adding also a possible fix would be ideal.</p>
<pre class="prettyprint lang-python"><code>#!python3
import re
def process_file(infile, outfile):
"""Process the body of a pcb file."""
# Define header and footer
header = '''\
(module ModuleName
(layer F.Cu)
(at 0.000000 0.000000 0.000000)
(descr "Module Description")
(fp_text reference REF** (at 0 -2.7) (layer F.SilkS)
(effects (font (size 1 1) (thickness 0.15)))
)
(fp_text user %R (at 0 0) (layer F.Fab)
(effects (font (size 0.6 0.6) (thickness 0.09)))
)
'''
footer = '''\
)
'''
outfile.write(header)
for line in infile:
# segments
m = re.search(r'(\s*)\(segment(.*)\s\(net\s0\)', line)
if m:
outfile.write(m.expand(r'\1(fp_line\2)\n'))
continue
# vias
m = re.search(
r'(\s*)\(via(.*)\(size\s([0-9.]*)\)\s(.*)\s\(net\s0\)', line
)
if m:
outfile.write(
m.expand(r'\1(pad ~ thru_hole circle\2(size \3 \3) '
r'(drill 0.6) \4)\n')
)
continue
# gr
m = re.search(r'(\s*\()gr(_.*\))', line)
if m:
outfile.write(m.expand(r'\1fp\2\n'))
continue
m = re.search(r'^(\s*(?:\(xy \d+.\d+ \d+.\d+\)\s?)+)$', line)
if m:
outfile.write(m.expand(r'\1'))
continue
m = re.search(r'^(\s*(?:\(xy \d+.\d+ \d+.\d+\)\s?)+)(\)\(layer .*\) '
r'\(width .*\) \))', line)
if m:
outfile.write(m.expand(r'\1\2\n'))
continue
outfile.write(footer)
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("infile")
parser.add_argument("outfile")
args = parser.parse_args()
with open(args.infile, 'r') as infile, open(args.outfile, 'w') as outfile:
process_file(infile, outfile)
print(args.outfile + ' has been generated from ' + args.infile)
</code></pre>
This can be called as (if the python script is placed in the same folder):
<pre class='prettyprint lang-bash'><code>python3 pcb_to_mod.py input.kicad_pcb output.kicad_mod
</code></pre>
<p>I think it can be also imported and the function called from kicad’s scripting editor.</p>
<ol start="6" type="1">
<li>Then, by using the footprint editor (GUI), it is possible to change the smd pads to <code>smd</code> from <code>thru_hole</code> and to change their <em>shape</em>, <em>position</em>, <em>layers</em> and so on. To do this double click over each pad. Those pads can be used to place components inside the footprint. For example a lumped capacitor for the matching circuit.</li>
</ol>
<h2 id="inkscapes-plugin-svg2shenzen">Inkscape’s plugin svg2shenzen</h2>
<p><a href="https://github.com/badgeek/svg2shenzhen">svg2shenzen</a> requires Inkscape and can produce arbitrary footprints quite easily. At the moment of writing, to get the script to work on Linux you need to set it manually to be executable:</p>
<pre class="prettyprint"><code>
chmod +x ~/.config/inkscape/extensions/svg2shenzhen/bitmap2component_linux64
</pre>
<p></code></p>
<p>See also <a href="https://github.com/badgeek/svg2shenzhen/issues/52">Fix file permission on Linux and directly install using git</a> and <a href="https://github.com/badgeek/svg2shenzhen/issues/2">missing chmod +x on linux</a>. If the maximum resolution is not good enough, it is possible to modify the file <code>~/.config/inkscape/extensions/svg2shenzhen_export.inx</code> and change the line with the maximum of 2000 (<a href="https://github.com/badgeek/svg2shenzhen/issues/54">Increase maximum dpi export #54</a>)</p>
<pre class="prettyprint lang-xml"><code><param name="dpi" type="int" min="0" max="2000" _gui-text="Export DPI (default: 600)">600</param>
</pre>
</code> to <code>10000</code>, which, from my tests, is the real limit of the exporter:
<pre class="prettyprint lang-xml"><code><param name="dpi" type="int" min="0" max="10000" _gui-text="Export DPI (default: 600)">600</param>
</pre>
<p></code></p>
<p>If this is not yet enough, you can export only a magnified version of the copper layers, make them as pads, and then from the custom shape primitives menu it is possible to transform them and scale the pad down to the original size. By copying the pads in the .kicad_mod file, using a text editor, in the other file (not magnified) containing the other layers it is possible to go beyond 10000 dpi. The graphical part cannot be scaled and therefore are only <em>only</em> limited to 10000 dpi. Considering that at 10000 dpi the size of a dot is already around 2.54um, it is quite difficult to find uses for higher resolutions. It is anyway possible! How to create pads is discussed in a following section.</p>
<p>This method has the advantage to start from a vector representation of the shape and that, at least theoretically, can use all the possible primitives in kicad, potentially creating the best shape. It can create all the complex shapes of the <em>bitmap2component</em> but potentially using a minimum number of shapes. It can also create multiple layers. The input file must be <code>svg</code> or <code>pdf</code> or a file-type that can be opened by Inkscape.</p>
<p>The current implementation of svg2shenzen returns a footprint containing <code>fp_poly</code> elements.</p>
<h2 id="kicad-step-up">Kicad Step Up</h2>
<p><a href="https://forum.kicad.info/t/custom-footprints-scripting-using-custom-shape-primitives/19538">See also the Kicad Forum</a></p>
<p>When the footprint is made into a mechanical CAD, in particular FreeCAD, this can be converted to a very high quality footprint using the great Kicad Step Up plugin. It makes probably the footprint with the minimum number of primitives, but at the moment of writing it still has some limitations. For example the custom shapes cannot contain holes inside, while this is supported by the other methods. A workaround is to divide the shape in two with overlapping edges, which will result into the original connected space with holes, but requires more effort. I am sure those will be resolved in the future, therefore I think this method has a big advantage if the shape needs to be done into a mechanical CAD. It is still possible to export to svg and use the other methods, but this will be more straightforward.</p>
<p>Even if a bit off topic, this plugin is also super useful to make 3D models to be used into Kicad.</p>
<p><a href="https://forum.kicad.info/t/custom-footprints-scripting-using-custom-shape-primitives/19538">See also the Kicad Forum for more information</a></p>
<h2 id="which-method">Which method?</h2>
<p>This is a tough question to answer.</p>
<p>The method I usually try first when I have a Gerber is the PcbNew converter using the Python script. When it works, sometimes with a bit of additional manual editing, the result is quick and generally very good. When it fails, the Gerber needs to be plotted to an <code>svg</code> or <code>pdf</code> and then the solution is to try the other methods.</p>
<p>The next method, particularly useful when making logos or complex shapes, is the svg2shenzen. I generally use this if I make the shape on Inkscape.</p>
<p>As said before, the StepUp method is useful if the shape was done in FreeCAD. Sometimes it is very convenient but required a bit of trial and error.</p>
<p>I initially started using the method with <em>bitmap2component</em> with Kicad 4, as it was the only reliable method. I have to admit that I still use it when I need a quick job, as it is still reliable. It is the easiest but probably provides the result that is less optimized. Use it when the other methods are failing. Each layer need to be done separately and the layers merged in the text file.</p>
<p>A combination of all the methods are also possible, merging the shapes manually in the text files.</p>
<p>The last option, which I didn’t include in the list, is to create the shapes manually from zero. This is quite tedious, in particular because there is not any official syntax reference for footprints, but can be useful to make optimized shapes, especially if generated from scripts. The official reference has the S-expression syntax for PcbNew, <a href="https://www.kicad-pcb.org/help/file-formats/">available here</a>. I found a non official one <a href="https://www.compuphase.com/electronics/LibraryFileFormats.pdf">from Compuphase</a> but it might be outdated. Use the S-expression part to get an idea. Generally, the syntax is very similar to the PcbNew and the changes are usually simple, as <code>gr</code> to <code>fp</code>. See also the previous sections to grasp a bit more of the syntax.</p>
<h1 id="drc">DRC</h1>
<p>Most of the methods discussed above, without including the Kicad StepUp, are using graphical shapes (as <code>fp_poly</code>) which were <strong>NOT</strong> DRC compliant and did not trigger an error if a track crosses those copper graphical lines.</p>
<p>As of Kicad 5.1.6, I noticed that the DRC gives an error if a track tries to cross a graphical line on the same copper layer. This is a new feature that will allow many more possibilities and is very welcome. It is not yet working with <code>fp_poly</code> and therefore I don’t call it fully DRC compliant.</p>
<p>To have a fully DRC compliant footprint, a trick is required and works only with Kicad 5, that introduced custom shaped footprints and I am currently using Kicad 5.1.4.</p>
<p>Add a small SMD pad into the copper areas (one for each closed area), select the pad and the area, right click and use the function “<em>Create pad from the selected shapes</em>”. The copper area is then magically converted to a custom shaped pad! The DRC will be now fully supported! I think this is a really game-changing feature!</p>
<p>An additional note is required. Imagine you want to make a coil, which is a single piece of copper, you convert it to a pad, give it a number, let’s say <code>1</code>, and then place another pad on the other side, let’s say <code>2</code>, to place the second connection.</p>
<p>There are two issues in this procedure. The first is that the the DRC will complain, since pad <code>2</code> is shorted on pad <code>1</code> and therefore the clearance between tracks is not sufficient. In KiCad, the concept of a line making a component is not contemplated (as it is on RF EDAs, as ADS). The second issue is that the connection to the coil can be done everywhere and not only at the extremes, again because the component cannot be made from a single copper track.</p>
<p>What I suggest is the following. Convert the coil in two pads with different numbers but by leaving a gap in the middle of the coil, not next to pads. Then create a small graphic polygon or line to connect the pads together and place the graphical element on the proper copper layer. This will cheat the DRC by getting it to believe that those are not connected. It is not perfect, as theoretically keep out zones should be used to avoid lines in between the gaps, but if the gap is made just a little bit bigger than the minimum clearance then there should be no track that can fit this gap (for example 0.3mm). For what I have seen this is the most effective method.</p>
<h1 id="inner-layers">Inner Layers</h1>
<p>In cases when the footprint requires copper tracks on the inner layers, a workaround is required and some limitations will be introduced.</p>
<p>Kicad’s footprint editor does not support pads in the inner layers and it will not even shows any layer that is not F.Cu or B.Cu. A workaround to this is to place the additional layers on some other available layers that are visible on the footprint editor, like Eco, Dwgs etc as graphical shapes.</p>
<p>If those are using <code>fp_lines</code> (graphical lines), then the DRC will be able to show conflicts on the inner layers, otherwise by using <code>fp_poly</code>, the DRC will not be available and extra care should be used to avoid conflicts, with the suggestions to avoid routing on those areas in the inner layers (for example with keepout areas or by not using those inner layers at all for routing). Remember again that pads cannot be placed in internal layers, so the custom pad method explained above cannot be used in inner layers.</p>
<p>The footprint can be then opened with a text editor and the layer changed manually. For example, if the shape uses <code>Eco1.User</code> layer and that layer is not used anywhere else, it is possible to replace all the occurrences of <code>Eco1.User</code> with <code>In1.Cu</code> (or another layer). When the footprint will be opened with the footprint editor, those inner layer will disappear, but when included in the pcb they will be available.</p>
<h1 id="complete-module-footprint-hints">Complete Module Footprint Hints</h1>
<p>When making custom footprints of complete modules, a decision has to be made if the SMD discrete components should be placed in the PCB or are considered included in the footprint.</p>
<p>In the first case, the pads in the footprint are ports and the component will be placed overlapping the pads. Those should carefully overlap. The number of the pad should be properly assigned and mapped to a schematic symbol.</p>
<p>In the second case, the component is not placed and the module, or footprint, is considered a black box. The components will not be in the bill of material. The “internal” pad numbers are not needed, but a silkscreen should also be added to the footprint, indicating the discrete components. Name the components accordingly, prefixing them with a different letter indicating that are not related to the main pcb components (as, for example, C_RF_1), avoiding the risk of duplication. Finally, assign the numbers to the external ports (or I/O pins or pads) from the footprint editor.</p>
<p>The procedure is then the same as for standard components: save it in a library, assign the footprint to a symbol from the schematic and then place it in the pcb.</p>
<h1 id="revision-history">Revision History</h1>
<ul>
<li>2020-10-14 AP: Kicad’s DRC works with graphical lines on copper layers. Added a section on the inner layers.</li>
<li>2020-09-29 AP: Supports <code>gr_poly</code>.</li>
<li>2019-10-27 AP: Fully DRC compliant footprint.</li>
<li>2019-12-27 AP: Updated the structure of the post and changed the regex substitution from perl to Python.</li>
</ul>
<p><strong>This post is a work-in-progress, I plan to add some images and example files, along with an improved regex, when the time comes</strong>.</p>
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
</script>
<!--
<script type="text/javascript" async src="https://unpkg.com/mathjax@latest/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" async src="https://cdn.jsdelivr.net/npm/mathjax@latest/unpacked/MathJax.min.js?config=TeX-AMS-MML_HTMLorMML"></script>
-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: { equationNumbers: { autoNumber: "AMS" } }
});
</script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/styles/agate.min.css">
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/highlight.min.js"></script>
<script>hljs.highlightAll();</script>
Alex Pacinihttp://www.blogger.com/profile/13304951646877405715noreply@blogger.com0tag:blogger.com,1999:blog-3207270927898422436.post-21936404142425711512016-05-09T22:00:00.000+02:002022-04-18T22:21:40.600+02:00Visually engaging periodic plots using PythonIn order to obtain periodic images with a technical feel to be embedded in a website, I decided to compose them with Python and Matplotlib. The plots are essentially some sums and multiplications of "noisy" sines.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-MxGooAwnWh0/VzGl0GjHvXI/AAAAAAAAJ1A/afyaKwBX9zUNdNqTsrSrLsKZgWIZypwkgCKgB/s1600/GOOD4.svg.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://4.bp.blogspot.com/-MxGooAwnWh0/VzGl0GjHvXI/AAAAAAAAJ1A/afyaKwBX9zUNdNqTsrSrLsKZgWIZypwkgCKgB/s200/GOOD4.svg.png" width="300" /></a><a href="https://3.bp.blogspot.com/-9202WzeirwE/VzGkZ4st0iI/AAAAAAAAJ0Q/3vsCab9raQsJ7woiF1iDeSurgfzrdv9FgCKgB/s1600/GOOD4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://3.bp.blogspot.com/-9202WzeirwE/VzGkZ4st0iI/AAAAAAAAJ0Q/3vsCab9raQsJ7woiF1iDeSurgfzrdv9FgCKgB/s200/GOOD4.png" width="300" /></a></div>
<br />
<a name='more'></a><br />
The Python script outputs a <b>SVG</b> image, which can be later converted to the desired format. Eventually, here I converted the plots to png using a simple <b>bash</b> script to be run inside the svg folder:<br />
<pre class="prettyprint">for i in *.svg; do inkscape --export-png=$i.png --export-dpi=300 --export-background-opacity=0 --without-gui $i; done
optipng *.png
</pre>
The script utilizes <b>Inkscape</b>, which converts the svg to png, and <b>optipng</b>, which optimizes the final size of the images.<br />
The png figures obtained have a transparent background, namely the alpha channel, by default. This can be changed in the script or graphically by using GIMP (or whatever). For example, if you would have a white background:<br />
<pre class="prettyprint">for i in *.svg; do inkscape --export-png=$i.png --export-dpi=300 --export-background-opacity=255 --without-gui $i; done
optipng *.png</pre>
<br />
In the following, I will illustrate some code snippets and the corresponding results obtained.<br />
<br />
<h2 style="text-align: center;">
<b>First Plot:</b></h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRGC6svLAC4ENjPrlGiDxO5dlFzAN8xMLD2M4hvg0b2m71UStRk9tP7UjGwWHlKC2p2UO4rai0C8QGUq0fkCJKw-Ffibx4qMrV3JxSiHZaKbPoJl99fqnkYiUe5gnUmkufIjWNXl3Unv4/s1600/GOOD1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRGC6svLAC4ENjPrlGiDxO5dlFzAN8xMLD2M4hvg0b2m71UStRk9tP7UjGwWHlKC2p2UO4rai0C8QGUq0fkCJKw-Ffibx4qMrV3JxSiHZaKbPoJl99fqnkYiUe5gnUmkufIjWNXl3Unv4/s640/GOOD1.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-XvsnZNfTsnA/VzGl0OI_TbI/AAAAAAAAJ08/JGT6Mpy_wRoXrWfGDDklyfjfSxbIMke7QCKgB/s1600/GOOD1.svg.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://1.bp.blogspot.com/-XvsnZNfTsnA/VzGl0OI_TbI/AAAAAAAAJ08/JGT6Mpy_wRoXrWfGDDklyfjfSxbIMke7QCKgB/s640/GOOD1.svg.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<h3 style="clear: both; text-align: left;">
<b>Code:</b></h3>
<pre class="prettyprint">import numpy as np
import matplotlib.pyplot as plt
plt.close("all")
i = 1000
j = 1024
periods = 6
x = np.array([np.linspace(0, (2 * (periods) * np.pi), i)]).T
x = np.repeat(x, j, axis=1)
n = (1 * (np.random.normal(size=(j))) *
np.random.uniform(low=1, high=1, size=j))[:, np.newaxis]
n = np.repeat(n, i, axis=1).T
y = np.sin(x) * (np.sin(n)+4) + 0.5 * n**2
f1 = plt.figure("GOOD1")
ax = f1.add_subplot(111)
ax.axis('off')
ax.set_position([0, 0, 1, 1])
ax.plot(x, y, 'b', alpha=(0.015625))
ax.set_xlim((x.min(), x.max()))
ax.set_ylim((y.min(), y.max()))
f1.patch.set_alpha(0.)
ax.patch.set_alpha(0.)
f1.savefig("GOOD1.svg", bbox_inches=0, transparent=True)</pre>
<h3>
<br /><b>Note:</b></h3>
The transparency for each line is set to <span style="font-family: "courier new" , "courier" , monospace;">alpha=(0.015625): </span><span style="font-family: inherit;">in the process of selecting that value, particular attention should be devoted to the transparency channel which is <b>8 bit</b> wide, and hence it has to be a multiple of 1/255.</span><br />
<br />
<span style="font-family: inherit;"><br /></span>
<br />
<h2 style="text-align: center;">
<b>Second plot:</b></h2>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTTrW8Doc7ZB873dyIl34inhpLaq-_brk6AbtTAbj_Z1RF3VpSlIW4I2Q1lE6ZzkH3m-1LAm6XfvmtqfpUqSZnjbjF8qQo13CFPzQba_KK2ZsPS6qdg3cc3VD_w4IYobS_OU1zCIoDxCo/s1600/GOOD2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTTrW8Doc7ZB873dyIl34inhpLaq-_brk6AbtTAbj_Z1RF3VpSlIW4I2Q1lE6ZzkH3m-1LAm6XfvmtqfpUqSZnjbjF8qQo13CFPzQba_KK2ZsPS6qdg3cc3VD_w4IYobS_OU1zCIoDxCo/s640/GOOD2.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-5a1pWqeMUgE/VzGl0NkM66I/AAAAAAAAJ08/5e3mTlZBBgYTojydUIbOEAuwDnn0ngATACKgB/s1600/GOOD2.svg.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://1.bp.blogspot.com/-5a1pWqeMUgE/VzGl0NkM66I/AAAAAAAAJ08/5e3mTlZBBgYTojydUIbOEAuwDnn0ngATACKgB/s640/GOOD2.svg.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<pre class="prettyprint">import numpy as np
import matplotlib.pyplot as plt
plt.close("all")
i = 1000
j = 1024
periods = 6
x = np.array([np.linspace(0, (2 * (periods) * np.pi), i)]).T
x = np.repeat(x, j, axis=1)
n = (1 * (np.random.normal(size=(j))) *
np.random.uniform(low=1, high=1, size=j))[:, np.newaxis]
n = np.repeat(n, i, axis=1).T
y = np.sin(x) * (np.sin(n)+4)
f2 = plt.figure("GOOD2")
ax = f2.add_subplot(111)
ax.axis('off')
ax.set_position([0, 0, 1, 1])
ax.plot(x, y, 'b', alpha=(0.015625))
ax.set_xlim((x.min(), x.max()))
ax.set_ylim((y.min(), y.max()))
f2.patch.set_alpha(0.)
ax.patch.set_alpha(0.)
plt.savefig("GOOD2.svg", bbox_inches=0, transparent=True)
</pre>
<br />
<br />
<h2 style="text-align: center;">
<b>Third plot:</b></h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKEakuEW9ehiJVaXN5H_-4ZkKvDeEeq-aQf7iZeavZhxykvLnda64ndPzq5ZXhxMtfjlwPFcb2JGR02Bsd4sXOhN2wwxLKZS_JQouh5EG4ZkkeDksk5G9vUwNXiytGB83t6fI5LA9eNRE/s1600/GOOD3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKEakuEW9ehiJVaXN5H_-4ZkKvDeEeq-aQf7iZeavZhxykvLnda64ndPzq5ZXhxMtfjlwPFcb2JGR02Bsd4sXOhN2wwxLKZS_JQouh5EG4ZkkeDksk5G9vUwNXiytGB83t6fI5LA9eNRE/s640/GOOD3.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-TVsRQ0EG6v8/VzGl0OIDeJI/AAAAAAAAJ08/wNj255IFDJIVBuazxV_7pz0KWdUyVK0igCKgB/s1600/GOOD3.svg.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://3.bp.blogspot.com/-TVsRQ0EG6v8/VzGl0OIDeJI/AAAAAAAAJ08/wNj255IFDJIVBuazxV_7pz0KWdUyVK0igCKgB/s640/GOOD3.svg.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<pre class="prettyprint">import numpy as np
import matplotlib.pyplot as plt
plt.close("all")
i = 1000
j = 1024
periods = 6
x = np.array([np.linspace(0, (2 * (periods) * np.pi), i)]).T
x = np.repeat(x, j, axis=1)
n = (1 * (np.random.normal(size=(j))) *
np.random.uniform(low=1, high=1, size=j))[:, np.newaxis]
n = np.repeat(n, i, axis=1).T
y = np.sin(x) * (np.sin(n)+4) + 0.5 * np.abs(n)
f3 = plt.figure("GOOD3")
ax = f3.add_subplot(111)
ax.axis('off')
ax.set_position([0, 0, 1, 1])
ax.plot(x, y, 'b', alpha=(0.015625))
ax.set_xlim((x.min(), x.max()))
ax.set_ylim((y.min(), y.max()))
f3.patch.set_alpha(0.)
ax.patch.set_alpha(0.)
plt.savefig("GOOD3.svg", bbox_inches=0, transparent=True)
</pre>
<br class="Apple-interchange-newline" />
<br />
<h2 style="text-align: center;">
<b>Fourth plot:</b></h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiN526HM1ZnheF48tIc7uTYGzxJmVBIeTSJVqq7eu1cZG3Q5fdo4dgTDbaSn2i1W-E0E-VW8Q_s65wXPjvA1YRJPgGNlvdBBDViYTUjuFTYI83chKAuW-36zzk2E1_xQjJjQDIetlDWapA/s1600/GOOD4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiN526HM1ZnheF48tIc7uTYGzxJmVBIeTSJVqq7eu1cZG3Q5fdo4dgTDbaSn2i1W-E0E-VW8Q_s65wXPjvA1YRJPgGNlvdBBDViYTUjuFTYI83chKAuW-36zzk2E1_xQjJjQDIetlDWapA/s640/GOOD4.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-MxGooAwnWh0/VzGl0GjHvXI/AAAAAAAAJ08/4SHjU4wo5M4daf7JwiGDWAT9I_5H2PrIACKgB/s1600/GOOD4.svg.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://4.bp.blogspot.com/-MxGooAwnWh0/VzGl0GjHvXI/AAAAAAAAJ08/4SHjU4wo5M4daf7JwiGDWAT9I_5H2PrIACKgB/s640/GOOD4.svg.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<pre class="prettyprint">import numpy as np
import matplotlib.pyplot as plt
plt.close("all")
i = 1000
j = 2048
periods = 3
x = np.array([np.linspace(- 0.5 * np.pi,
(2 * (periods) * np.pi - 0.5 * np.pi), i)]).T
x = np.repeat(x, j, axis=1)
n = (1 * (np.random.normal(size=(j))) *
np.random.uniform(low=1, high=1, size=j))[:, np.newaxis]
n = np.repeat(n, i, axis=1).T
y = np.sin(x) * (np.sin(n)+4) + 0.5 * x * np.abs(n)
x = np.array([np.linspace(0, 2 * (2 * (periods) *
np.pi - 0.5 * np.pi), 2 * i)]).T
x = np.repeat(x, j, axis=1)
y = np.concatenate((y, y[::-1]))
f4 = plt.figure("GOOD4")
ax = f4.add_subplot(111)
ax.axis('off')
ax.set_position([0, 0, 1, 1])
ax.plot(x, y, 'b', alpha=(0.015625))
ax.set_xlim((x.min(), x.max()))
ax.set_ylim((y.min(), y.max()))
f4.patch.set_alpha(0.)
ax.patch.set_alpha(0.)
plt.savefig("GOOD4.svg", bbox_inches=0, transparent=True)
</pre>
<br class="Apple-interchange-newline" />
<h2>
<div style="text-align: center;">
<br /></div>
<b><div style="text-align: center;">
<b>Fifth plot:</b></div>
</b></h2>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQH2KcRTddN5KFtewEM1zx9Y7I_b6SXdvaiAHAwJW8s3So0xUdJLLHd8sXwzsSFxnWjwzkAnFzpYIvW6amAF6sqzwpljbRvgNQaVB-PtDMiZnWHptCli7gyzmYgNSzN3OcG1WwnpC14Ow/s1600/GOOD5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQH2KcRTddN5KFtewEM1zx9Y7I_b6SXdvaiAHAwJW8s3So0xUdJLLHd8sXwzsSFxnWjwzkAnFzpYIvW6amAF6sqzwpljbRvgNQaVB-PtDMiZnWHptCli7gyzmYgNSzN3OcG1WwnpC14Ow/s640/GOOD5.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-bsk6JQffE80/VzGl0O-iCMI/AAAAAAAAJ08/B8LF2k3k9BM0wDdaj7EsxUP1n16965BRgCKgB/s1600/GOOD5.svg.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://3.bp.blogspot.com/-bsk6JQffE80/VzGl0O-iCMI/AAAAAAAAJ08/B8LF2k3k9BM0wDdaj7EsxUP1n16965BRgCKgB/s640/GOOD5.svg.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<br />
<pre class="prettyprint">import numpy as np
import matplotlib.pyplot as plt
plt.close("all")
i = 1000
j = 1024
periods = 3
x = np.array([np.linspace(0, (2 * (periods) * np.pi - 0.5 * np.pi), i)]).T
x = np.repeat(x, j, axis=1)
n = (1 * (np.random.normal(size=(j))) *
np.random.uniform(low=1, high=1, size=j))[:, np.newaxis]
n = np.repeat(n, i, axis=1).T
y = np.sin(x) * (np.sin(n) + 4) + 3 * np.abs(n) * (1 - np.sin(x) * np.abs(n))
x = np.array([np.linspace(0, 2 * (2 * (periods) *
np.pi - 0.5 * np.pi), 2 * i)]).T
x = np.repeat(x, j, axis=1)
y = np.concatenate((y, y[::-1]))
f5 = plt.figure("GOOD5")
ax = f5.add_subplot(111)
ax.axis('off')
ax.set_position([0, 0, 1, 1])
ax.plot(x, y, 'b', alpha=(0.015625))
ax.set_xlim((x.min(), x.max()))
ax.set_ylim((y.min(), y.max()))
f5.patch.set_alpha(0.)
ax.patch.set_alpha(0.)
plt.savefig("GOOD5.svg", bbox_inches=0, transparent=True)
</pre>
<br class="Apple-interchange-newline" />
<br />
<h2 style="text-align: center;">
<b>Sixth plot:</b></h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDSFuVOhk0nx20J-ahJeCitC1PejAnSfFOCsqhcdG5Wm52P7yQN2WFi2i3q5QkE5T8SIc2HLcwDu-6O6LtNrk3sKUpnKrEuBj8RBR9CxH3Xxhu-ETXK8DMeXBWJi_WrSDYlyZogcBpuLk/s1600/GOOD6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDSFuVOhk0nx20J-ahJeCitC1PejAnSfFOCsqhcdG5Wm52P7yQN2WFi2i3q5QkE5T8SIc2HLcwDu-6O6LtNrk3sKUpnKrEuBj8RBR9CxH3Xxhu-ETXK8DMeXBWJi_WrSDYlyZogcBpuLk/s640/GOOD6.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-AOqPAUhIUpI/VzGl0IyGoFI/AAAAAAAAJ08/Hg4U8HQAeqcLq3x_MewyP4WqSbo5Ei0sQCKgB/s1600/GOOD6.svg.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://2.bp.blogspot.com/-AOqPAUhIUpI/VzGl0IyGoFI/AAAAAAAAJ08/Hg4U8HQAeqcLq3x_MewyP4WqSbo5Ei0sQCKgB/s640/GOOD6.svg.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<pre class="prettyprint">import numpy as np
import matplotlib.pyplot as plt
plt.close("all")
i = 1000
j = 2048
periods = 3
x = np.array([np.linspace(0, (2 * (periods) * np.pi - 0.5 * np.pi), i)]).T
x = np.repeat(x, j, axis=1)
n = (1 * (np.random.normal(size=(j))) *
np.random.uniform(low=1, high=1, size=j))[:, np.newaxis]
n = np.repeat(n, i, axis=1).T
y = np.sin(x) * (np.sin(n) + 4) + 3 * np.abs(n) * (1 - np.sin(x))
x = np.array([np.linspace(0, 2 * (periods) * np.pi - 0.5 * np.pi, 2 * i)]).T
x = np.repeat(x, j, axis=1)
y = np.concatenate((y, y[::-1]))
f6 = plt.figure("GOOD6")
ax = f6.add_subplot(111)
ax.axis('off')
ax.set_position([0, 0, 1, 1])
ax.plot(x, y, 'b', alpha=(0.015625))
ax.set_xlim((x.min(), x.max()))
ax.set_ylim((y.min(), y.max()))
f6.patch.set_alpha(0.)
ax.patch.set_alpha(0.)
plt.savefig("GOOD6.svg", bbox_inches=0, transparent=True)
</pre>
<br class="Apple-interchange-newline" />
<br />
<h2 style="text-align: center;">
<b>Seventh plot:</b></h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSSta0rzThw75G8IGwwPXKJVqvg4uVzRxSyKSuU50jVzke2tORtzQcwq7vDYAmNslgii0MOCC8eNhRnJ1TmZGTpxIfQAu3owKViT9zvIbByVJGBpsPY1ZFy1cXwFWghNYMWkI3K6__dWY/s1600/GOOD7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSSta0rzThw75G8IGwwPXKJVqvg4uVzRxSyKSuU50jVzke2tORtzQcwq7vDYAmNslgii0MOCC8eNhRnJ1TmZGTpxIfQAu3owKViT9zvIbByVJGBpsPY1ZFy1cXwFWghNYMWkI3K6__dWY/s640/GOOD7.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-ve_0PpRIk6s/VzGl0EiyifI/AAAAAAAAJ1A/dH52W-OzDrMuyUnjB3oqfpEvD6FkQNxKgCKgB/s1600/GOOD7.svg.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://3.bp.blogspot.com/-ve_0PpRIk6s/VzGl0EiyifI/AAAAAAAAJ1A/dH52W-OzDrMuyUnjB3oqfpEvD6FkQNxKgCKgB/s640/GOOD7.svg.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<pre class="prettyprint">import numpy as np
import matplotlib.pyplot as plt
plt.close("all")
i = 1000
j = 1024
periods = 3
x = np.array([np.linspace(0, (2 * (periods) * np.pi - 0.5 * np.pi), i)]).T
x = np.repeat(x, j, axis=1)
n = (1 * (np.random.normal(size=(j))) *
np.random.uniform(low=1, high=1, size=j))[:, np.newaxis]
n = np.repeat(n, i, axis=1).T
y = (np.sin(x)*(np.sin(n)+4) + 3*np.abs(n)*(1-np.abs(np.sin(x))))
x = np.array([np.linspace(0, 2 * (2 * (periods) *
np.pi - 0.5 * np.pi), 2 * i)]).T
x = np.repeat(x, j, axis=1)
y = np.concatenate((y, y[::-1]))
f7 = plt.figure("GOOD7")
ax = f7.add_subplot(111)
ax.axis('off')
ax.set_position([0, 0, 1, 1])
ax.plot(x, y, 'b', alpha=(0.015625))
ax.set_xlim((x.min(), x.max()))
ax.set_ylim((y.min(), y.max()))
f7.patch.set_alpha(0.)
ax.patch.set_alpha(0.)
plt.savefig("GOOD7.svg", bbox_inches=0, transparent=True)
</pre>
<br class="Apple-interchange-newline" />
<br />
<h2 style="text-align: center;">
<b>Eighth plot:</b></h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggJLv7jl4x0lOo8PCLQYp7iU1eR8dMQ_aY0dunGTlAJIy0WqINpdsaYAEHG05DJ05_DRldRWzaoynS0gWJjN-FnpaGjSvdZnlA7AIwD8jAbsWPPp77Okpn0uV4MHMftUV2-avDOEyFRVE/s1600/GOOD8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggJLv7jl4x0lOo8PCLQYp7iU1eR8dMQ_aY0dunGTlAJIy0WqINpdsaYAEHG05DJ05_DRldRWzaoynS0gWJjN-FnpaGjSvdZnlA7AIwD8jAbsWPPp77Okpn0uV4MHMftUV2-avDOEyFRVE/s640/GOOD8.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-Bf9mRKJ1Hug/VzGl0LVusmI/AAAAAAAAJ1A/qOEJxHexvPQWB5JO6ih3G2qUjKxrKisNACKgB/s1600/GOOD8.svg.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://2.bp.blogspot.com/-Bf9mRKJ1Hug/VzGl0LVusmI/AAAAAAAAJ1A/qOEJxHexvPQWB5JO6ih3G2qUjKxrKisNACKgB/s640/GOOD8.svg.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<pre class="prettyprint">import numpy as np
import matplotlib.pyplot as plt
plt.close("all")
i = 1000
j = 1024
periods = 3
x = np.array([np.linspace(0, (2 * (periods) * np.pi - 0.5 * np.pi), i)]).T
x = np.repeat(x, j, axis=1)
n = (1 * (np.random.normal(size=(j))) *
np.random.uniform(low=1, high=1, size=j))[:, np.newaxis]
n = np.repeat(n, i, axis=1).T
y = (np.sin(x) * (np.sin(n) + 4) + 3 * np.abs(np.sin(n)) -
1 * (x-(2 * (periods) * np.pi - 0.5 * np.pi) * 0.5) *
np.abs((1 - 0.5 * np.sin(x)) *
np.concatenate((np.sin(n[::2]), np.sin(n[::2])))))
x = np.array([np.linspace(0, 2 * (2 * (periods) *
np.pi - 0.5 * np.pi), 2 * i)]).T
x = np.repeat(x, j, axis=1)
y = np.concatenate((y, y[::-1]))
f8 = plt.figure("GOOD8")
ax = f8.add_subplot(111)
ax.axis('off')
ax.set_position([0, 0, 1, 1])
ax.plot(x, y, 'b', alpha=(0.015625))
ax.set_xlim((x.min(), x.max()))
ax.set_ylim((y.min(), y.max()))
f8.patch.set_alpha(0.)
ax.patch.set_alpha(0.)
plt.savefig("GOOD8.svg", bbox_inches=0, transparent=True)
</pre>
<br class="Apple-interchange-newline" />
<h2>
<br /><div style="text-align: center;">
<b>Ninth plot:</b></div>
</h2>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilWdp1sFSyQMs9v_8simDgFoQjZwXs_1MWwGeSK483V822b8LhOvGwdRb5Xg5DJJUy-bUsE5c8rVw3X2Fo77otA2dzz8UzjMxj3drmVRRPU2CR6ddmm-xxoouLhsXs4mtMhIig_zzd1DI/s1600/GOOD9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilWdp1sFSyQMs9v_8simDgFoQjZwXs_1MWwGeSK483V822b8LhOvGwdRb5Xg5DJJUy-bUsE5c8rVw3X2Fo77otA2dzz8UzjMxj3drmVRRPU2CR6ddmm-xxoouLhsXs4mtMhIig_zzd1DI/s640/GOOD9.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-_nXV_hlipgM/VzGl0Jais-I/AAAAAAAAJ1A/_Ryu03ZNejkzQVpSOJbtpvs-A2XZBFUmwCKgB/s1600/GOOD9.svg.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://4.bp.blogspot.com/-_nXV_hlipgM/VzGl0Jais-I/AAAAAAAAJ1A/_Ryu03ZNejkzQVpSOJbtpvs-A2XZBFUmwCKgB/s640/GOOD9.svg.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<pre class="prettyprint">import numpy as np
import matplotlib.pyplot as plt
plt.close("all")
i = 1000
j = 1024
periods = 3
x = np.array([np.linspace(0, (2 * (periods) * np.pi - 0.5 * np.pi), i)]).T
x = np.repeat(x, j, axis=1)
n = (1 * (np.random.normal(size=(j))) *
np.random.uniform(low=1, high=1, size=j))[:, np.newaxis]
n = np.repeat(n, i, axis=1).T
y = (np.sin(x) * (np.sin(n) + 4) + 3 * np.abs(np.sin(n)) -
1 * (x-(2 * (periods) * np.pi - 0.5 * np.pi) * 0.5) *
np.abs((1 - 0.5 * np.sin(x)) *
np.concatenate((np.sin(n[::2]), np.sin(n[::2])))) +
np.sin(x) * (np.sin(n) + 4) + 3 * np.abs(n) * (1 - np.sin(x)))
x = np.array([np.linspace(0, 2 * (2 * (periods) *
np.pi - 0.5 * np.pi), 2 * i)]).T
x = np.repeat(x, j, axis=1)
y = np.concatenate((y, y[::-1]))
f9 = plt.figure("GOOD9")
ax = f9.add_subplot(111)
ax.axis('off')
ax.set_position([0, 0, 1, 1])
ax.plot(x, y, 'b', alpha=(0.015625))
ax.set_xlim((x.min(), x.max()))
ax.set_ylim((y.min(), y.max()))
f9.patch.set_alpha(0.)
ax.patch.set_alpha(0.)
plt.savefig("GOOD9.svg", bbox_inches=0, transparent=True)
</pre>
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js?lang=tex&skin=sunburst" type="text/javascript"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$('pre').addClass('prettyprint');
</script>
Alex Pacinihttp://www.blogger.com/profile/13304951646877405715noreply@blogger.com0Cesena, Italy44.138855767568813 12.24975585937543.774561267568814 11.604308859375 44.503150267568813 12.895202859375tag:blogger.com,1999:blog-3207270927898422436.post-2154040563576624272015-06-20T14:21:00.002+02:002022-09-17T13:05:59.028+02:00Reduce screen blue light - f.lux and RedShiftDay by day, artificial lights with a huge blue spectrum are becoming more ubiquitous.<br />
By mean of the melatonin mechanism <b><a href="https://justgetflux.com/research.html" target="_blank">it is said</a> </b>blue light can influence the ability to sleep.<br />
In pre-fluorescent era, the standard was the incandescent bulb: this bulb is known to radiate similarly to a 3500K black body, thus with a low blue component and with a low effect on the melanopsin-containing cells in your retina which reacts to light.<br />
The change to fluorescent and led [and...] lights has changed the paradigm.<br />
<a name='more'></a><br />
The ubiquitous presence and usage of LCD screens used before going to sleep could have huge effects on sleep capabilities.<br />
An important source of blue light is given by the computer or laptop screen; a sun-neutral rendering screen is wonderful, but the blue content of light simulates the day-light, especially with principally blank pages as is in the majority of situations, cheating the circadian rhythm.<br />
<br />
Given the previous informations, I stumbled on this little software: <a href="https://justgetflux.com/" style="font-weight: bold;">f.lux</a>.<br />
Its purposes are simple: to reduce the blue components of the screen by imposing a lower white temperature. BRILLIANT!<br />
<b>f.lux</b> is said to work great on Windows, Mac and Linux, it is free but closed source.<br />
<br />
Anyway, for the Linux world something opensource can be better. In this situation comes <a href="http://jonls.dk/redshift/" style="font-weight: bold;" target="_blank">RedShift</a> and <strike>it is the one I personally use</strike>.<div><b><br /></b></div><div><b>UPDATE: </b>I switched to the built in KDE Night Color (System Settings -> Display and Monitor -> Night Color). The rest is maintained in the post for posterity. <div><br />
The usage is simple, just add it to your startup list of software with the proper command:<br />
<i>redshift-gtk -l 44.5:11.3 -t 6500:4500</i><br />
<br />
This will load the graphical icon in the system tray. To explain the given options:<br />
*<i> -l 44.5:11.3</i> tells the software the latitude and logitude (here of Bologna). Search google with "lat long your_city" to get the coordinates;<br />
<div>
* <i>-t 6500:4500 </i>tells the software the day (6500K) and night (4500K) screen light temperature.</div>
<div>
<br />
<div>
A super cool tool to observe the effects of filters on different sources is <b><a href="https://fluxometer.com/" target="_blank">shown here</a></b>.<br />
<br />
Enjoy your newly found sleep!<br />
Comments are welcomed!</div>
</div>
</div></div>Alex Pacinihttp://www.blogger.com/profile/13304951646877405715noreply@blogger.com0tag:blogger.com,1999:blog-3207270927898422436.post-182322332777246212015-06-20T12:27:00.004+02:002019-07-08T20:29:05.980+02:00Long titles with math in LaTeXRecently, while writing my dissertation I stumbled upon some difficulties with chapter and section titles.<br />
The first problem was caused by too long headings, while the second by mathematics inside the pdf bookmarks when using <i>hyperref .</i><br />
<a name='more'></a><br />
The solution I found by googling around is what I also wrote in <b><a href="http://tex.stackexchange.com/questions/26234/chapter-title-in-header-too-long/248894#248894" target="_blank">this Tex StackExchange answer</a></b>:<br />
<pre class="prettyprint lang-latex"><code>\chapter[\texorpdfstring{TOC title \( inline math A \)
}{TOC in pdf bookmarks}
]{\chaptermark{header} Chapter title \( inline math A \)}
\chaptermark{header}
\label{CH:Chap}
</code></pre>
<br />
In this solution the pdf bookmarks are defined by <i>\texorpdfstring{#1}{#2}</i>, where <i>#1</i> is the title inside the pdf document while <i>#2</i> is the pdf bookmark.<br />
The [shorter] heading is defined by <i>\chaptermark{header}</i>. The repeated command is not a typo, but it is needed in order to have the right behaviour in every situation (do not ask why since I do not have any idea, just by tentative; if you know the reason, <b>please</b> comment below. <b>EDIT (2016-03-22): </b>Some explanations can be found <a href="http://www.tex.ac.uk/FAQ-runheadtoobig.html" target="_blank">HERE</a>)<br />
<br />
<b>Important:</b> the solution also works with \<i>section</i>, just change <i>\chaptermark </i>with <i>\sectionmark</i>.
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js?lang=tex&skin=sunburst" type="text/javascript"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$('pre').addClass('prettyprint');
</script>Alex Pacinihttp://www.blogger.com/profile/13304951646877405715noreply@blogger.com0tag:blogger.com,1999:blog-3207270927898422436.post-23663731830523724142015-06-19T20:25:00.001+02:002019-07-08T20:28:46.785+02:00Template Tesi e Frontespizio LaTeX UNIBO - Versione 2Fresco fresco dalla laurea magistrale ho deciso di pubblicare il template che ho utilizzato per preparare la tesi in \( \LaTeX \).<br />
<br />
<a name='more'></a>È un template molto semplice, comprende il frontespizio e uno scheletro.<br />
La versione precedente, costituita però dal solo frontespizio, la si può trovare <a href="http://pacinispace.blogspot.it/2012/10/frontespizio-unibo.html" target="_blank"><b>QUI</b></a>.<br />
<br />
Per utilizzarlo, si può copiare dai due gist inseriti a valle o <b><a href="https://app.box.com/s/mfdk1whx151nu8defqozy6bwmpft8br5" target="_blank">scaricare uno zip</a> (consigliato).
</b><br />
Nel primo caso è necessario inserire la struttura indicata dal template, cioè la subdirectory "images",
i vari files con "\include{}" e i files per la bibliografia ".bib".<br />
Nel secondo caso, <b>consigliato</b>, è sufficiente scompattare l'archivio, inserire i ".bib" e seguire la struttura proposta.<br />
Commenti sono ben accetti.<br />
Per quanto riguarda le slide, ho qualcosa <a href="http://pacinispace.blogspot.it/2012/10/dissertation-beamer-template.html">QUI</a>.<br />
<br />
Il risultato è il seguente: <br />
<style>.embed-container { position: relative; padding-bottom: 100%; height: 0; overflow: hidden; max-width: 100%; } .embed-container iframe, .embed-container object, .embed-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }</style><br />
<div class="embed-container">
<iframe allowfullscreen="" frameborder="0" src="https://app.box.com/embed/preview/o49lpyowpanenopbs2fzcdutl5kd3k7d?view=&sort=&direction=ASC&theme=dark"></iframe></div>
<br />
<br />
Seguono i due gist con i sorgenti \( \LaTeX \):
<br />
<script src="https://gist.github.com/alexpacini/8c11aa00b986f6105ef9.js"></script>
<script src="https://gist.github.com/alexpacini/71cebf30e0017673c4b9.js"></script>
<script async="" src="https://unpkg.com/mathjax@latest/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>
<!-- <script type="text/javascript" async src="https://cdn.jsdelivr.net/npm/mathjax@latest/unpacked/MathJax.min.js?config=TeX-AMS-MML_HTMLorMML"></script> -->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: { equationNumbers: { autoNumber: "AMS" } }
});
</script>
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js?lang=tex&skin=sunburst" type="text/javascript"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$('pre').addClass('prettyprint');
</script>Alex Pacinihttp://www.blogger.com/profile/13304951646877405715noreply@blogger.com1tag:blogger.com,1999:blog-3207270927898422436.post-89009539983490869732014-02-04T23:40:00.000+01:002019-07-08T20:28:24.932+02:00Theory of Information - Matlab Code SnippetsThat is a collection of some snippets in Octave (Matlab) I created during the course "[TIC] TEORIA DELL'INFORMAZIONE E CODICI LM" for the MS in Electronic and Telecommunication Engineering.<br />
<div>
As always, they are open-sourced on <a href="https://github.com/alexpacini/TIC">GitHub</a>, so any suggestion is welcomed. The best way is by fork & pull.</div>
<div>
<a name='more'></a><blockquote class="tr_bq">
<i>assignment01_mutinfo</i><br />
A Matlab/ <strong style="box-sizing: border-box;">Octave</strong> function that, given the transition matrix P and the probability vector for the input symbols Px, returns the mutual information I(X;Y). It is provided with some tests that show the mutual information for some channels with different sets of P and Px and outputs the 3D surface plots.</blockquote>
<blockquote class="tr_bq">
<a class="anchor" href="https://github.com/alexpacini/TIC#assignment02_apcap_numint" name="assignment02_apcap_numint" style="bottom: 0px; box-sizing: border-box; color: #4183c4; cursor: pointer; display: block; left: 0px; margin-left: -30px; padding-left: 30px; padding-right: 6px; position: absolute; text-decoration: none; top: 0px;"></a><i>assignment02_apcap_numint</i><br />
A Matlab/ <strong style="box-sizing: border-box;">Octave</strong> script to plot a comparison for the capacity of the Antipodal unquantized channel, the AWGN unquantized channel and the Antipodal 2-Level quantized channel.<br />
There is also a function for calculating the definite numerical integrals with different algorithms.</blockquote>
<blockquote class="tr_bq">
<a class="anchor" href="https://github.com/alexpacini/TIC#assignment03_noisyap2l" name="assignment03_noisyap2l" style="bottom: 0px; box-sizing: border-box; color: #4183c4; cursor: pointer; display: block; left: 0px; margin-left: -30px; padding-left: 30px; padding-right: 6px; position: absolute; text-decoration: none; top: 0px;"></a><i>assignment03_noisyap2L</i><br />
A Matlab/ <strong style="box-sizing: border-box;">Octave</strong> script to simulate a noisy antipodal 2 level transmission. </blockquote>
<blockquote class="tr_bq">
<a class="anchor" href="https://github.com/alexpacini/TIC#assignment04_noisyap2lhamm" name="assignment04_noisyap2lhamm" style="bottom: 0px; box-sizing: border-box; color: #4183c4; cursor: pointer; display: block; left: 0px; margin-left: -30px; padding-left: 30px; padding-right: 6px; position: absolute; text-decoration: none; top: 0px;"></a><i>assignment04_noisyap2LHamm</i><br />
A Matlab/ <strong style="box-sizing: border-box;">Octave</strong> script that simulates an antipodal 2-level transmission over an AWGN channel using the Hamming block code.</blockquote>
<div>
Have fun!</div>
</div>
Alex Pacinihttp://www.blogger.com/profile/13304951646877405715noreply@blogger.com0tag:blogger.com,1999:blog-3207270927898422436.post-50745792169299026152014-02-04T23:12:00.002+01:002019-07-08T20:27:49.770+02:00Appunti del corso "Equazioni Differenziali LM"Durante il corso di "Equazioni Differenziali LM" nell'ambito del corso di laurea in "Ingegneria Elettronica e Telecomunicazioni per lo Sviluppo Sostenibile" ho scritto una versione \( LaTeX \) degli appunti e delle dispense fornite dal docente Prof. Massimo Cicognani. <br />
Sono disponibili su <a href="https://github.com/alexpacini/EqDiff_LM">GitHub</a>. <br />
Nel caso si trovassero errori o typos vari, la cosa migliore sarebbe fare una fork del repository, fare i fix vari e pull request a seguire. Per i meno scaltri, anche aprire una issue potrebbe essere sufficiente e provvederò successivamente io al fix.Alex Pacinihttp://www.blogger.com/profile/13304951646877405715noreply@blogger.com0tag:blogger.com,1999:blog-3207270927898422436.post-82960439158585514232013-07-17T14:18:00.001+02:002022-04-18T22:17:57.049+02:00Markdown - StackEdit's HTML export template with highlighting by using Prettify or Highlight.js and personalized markDown.css<a href="http://benweet.github.io/stackedit/">StackEdit</a> is a <a href="http://michelf.ca/projects/php-markdown/extra/">Markdown Extra</a> editor with <a href="http://www.mathjax.org/">MathJax</a> (to display formulas using TeX Math syntax, see <a href="http://pacinispace.blogspot.it/2013/07/latex-and-code-highlighting-using.html">HERE</a> if you are interested to show them on Blogger) and <a href="https://code.google.com/p/google-code-prettify/">Prettify</a> or <a href="http://highlightjs.org/">highlight.js</a> (for code highlighting) support.<br />
It is a wonderful option when it comes to publish some HTML, even with a custom CSS!<br />
<blockquote class="tr_bq">
<a href="http://daringfireball.net/projects/markdown/">Markdown</a> is a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML).</blockquote>
<br />
<a name='more'></a><br />
If you are interested in more options to try, take a look at the article on <a href="http://mashable.com/2013/06/24/markdown-tools/">Mashable</a>.<br />
<br />
The documentation, taken from the <a href="https://github.com/benweet/stackedit/">official GitHub project</a> (it is even an opensource project), says:<br />
<br />
<pre class="prettyprint lang-html">StackEdit
=========
StackEdit is a free, open-source Markdown editor based on PageDown, the Markdown library used by Stack Overflow and the other Stack Exchange sites.
### StackEdit can:
- Manage multiple Markdown documents online or offline
- Export your documents in Markdown or HTML and format it using a template
- Synchronize your Markdown documents in the Cloud
- Edit existing Markdown documents from Google Drive, Dropbox and your local hard drive
- Post your Markdown document on Blogger/Blogspot, WordPress, Tumblr
- Publish your Markdown document on GitHub, Gist, Google Drive, Dropbox or any SSH server
- Share a link to a Markdown document that renders it in a nice viewer
- Show statistics about your document
- Convert HTML to Markdown
### Features:
- Real-time HTML preview with Scroll Link feature to bind editor and preview scrollbars
- Markdown Extra support and Prettify/Highlight.js syntax highlighting
- LaTeX mathematical expressions using MathJax
- WYSIWYG control buttons
- Configurable layout
- Theming support with multiple themes available
- A la carte extensions
- Offline editing
- Online synchronization using Google Drive and Dropbox
- One click publish on Blogger, Dropbox, Gist, GitHub, Google Drive, SSH server, Tumblr, WordPress
</pre>
The wonder comes when you can set a custom template:<br />
<blockquote class="tr_bq">
>Settings >Publish >Template</blockquote>
This makes possible to export a valid HTML which has included the script to load MathJax, Prettify and a custom CSS by going to:<br />
<blockquote class="tr_bq">
>Save as... >Save using template</blockquote>
My custom CSS is an extension of the beautiful <a href="https://kevinburke.bitbucket.org/markdowncss/">Markdown.css</a>.<br />
If you plan to use this modified style-sheet (the code is shown in the end of the post), it is better to download and host by yourself; remember to change the link in the template to your new location.<br />
<br />
The Welcome Document of StackEdit will look as this (<a href="https://jsbin.com/qohapirova">live preview</a>):<br />
<br />
<a class="jsbin-embed" href="http://jsbin.com/qohapirova/embed?output">JS Bin on jsbin.com</a><script src="https://static.jsbin.com/js/embed.min.js?3.35.5"></script>
<br />
<br />
What follows is my template for StackEdit:<br />
<br />
<script src="https://gist.github.com/alexpacini/6019439.js"></script>
The CSS I extended and used is shown below; if you like, feel free to use! (please, add a link to this post in the footer)<br />
<br />
<script src="https://gist.github.com/alexpacini/6019527.js"></script>Alex Pacinihttp://www.blogger.com/profile/13304951646877405715noreply@blogger.com0Italy41.87194 12.56737999999995729.678010500000003 -8.0869170000000423 54.065869500000005 33.221676999999957tag:blogger.com,1999:blog-3207270927898422436.post-75806503128150927452012-10-13T01:30:00.000+02:002019-07-08T20:26:21.327+02:00Frontespizio LaTeX UNIBOIn piccolo aiuto a chi dovesse scrivere la tesi; nel caso in cui, come me, vi trovaste in difficoltà nell'ottenere un bel frontespizio, potete provare questo template LaTeX.<br />
<b>Aggiornamento: </b>a <a href="http://pacinispace.blogspot.it/2015/06/template-tesi-e-frontespizio-latex.html" target="_blank">questo link</a> ho pubblicato il template LaTeX completo, non solo di frontespizio, che ho usato per la tesi di laurea magistrale. Enjoy!<br />
<a name='more'></a><br />
È un template modificato a partire <a href="http://internet.unibo.it/files/frontespizio.tex">da quello realizzato dalla facoltà di Fisica e Matematica</a>.<br />
<br />
L'ho utilizzato personalmente per la mia tesi e, devo dire, è elegante.<br />
Potete anche sostituirlo al frontespizio di una tesi fatta in un editor diverso, per esempio usando pdftk (su Linux) o <a href="http://www.angusj.com/pdftkb/#pdftkbuilder">pdftkbuilder</a> (su Windows e con interfaccia grafica), ma qualsiasi editor di pdf può andare bene.
<br />
Per quanto riguarda le slide, ho qualcosa <a href="http://pacinispace.blogspot.it/2012/10/dissertation-beamer-template.html">QUI</a>.<br />
Per chi volesse imparare ad utilizzare LaTeX, oltre alle ottime guide online (ad esempio quelle <a href="http://www.lorenzopantieri.net/LaTeX.html">sul sito di L. Pantieri</a>), c'è la famosa e sempre utile "Bibbia", ovvero <a href="http://www.amazon.it/gp/product/0201362996/ref=as_li_ss_tl?ie=UTF8&camp=3370&creative=24114&creativeASIN=0201362996&linkCode=as2&tag=pacsspa0d-21">The Latex Companion</a>.<br />
<br />
<span style="font-size: x-small;"><script src="https://gist.github.com/3882248.js?file=frontespizio.tex"></script></span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-xMZ1wuMXGW4/VdYWCTLl5UI/AAAAAAAAHw0/uTUUnwPEgr0/s1600/proveblog.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://3.bp.blogspot.com/-xMZ1wuMXGW4/VdYWCTLl5UI/AAAAAAAAHw0/uTUUnwPEgr0/s640/proveblog.png" width="452" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />Alex Pacinihttp://www.blogger.com/profile/13304951646877405715noreply@blogger.com0tag:blogger.com,1999:blog-3207270927898422436.post-46146644184047314352012-10-12T17:47:00.000+02:002019-07-08T20:26:04.733+02:00Dissertation Beamer templateA simple LaTeX Beamer template is shown (I used it for my dissertation's slides):<br />
<a name='more'></a><br />
Try the code by yourself using <a href="https://www.sharelatex.com/?r=b4f49c22&rm=d&rs=b">ShareLaTeX</a> <br />
<span style="font-size: x-small;"><script src="https://gist.github.com/3879938.js?file=dissertation.tex"></script></span><br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-AWK4a_DDwJ4/VdYWCfFhS7I/AAAAAAAAHw0/PhOa_Cqe554/s1600/az3dlK1351031521.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="481" src="https://4.bp.blogspot.com/-AWK4a_DDwJ4/VdYWCfFhS7I/AAAAAAAAHw0/PhOa_Cqe554/s640/az3dlK1351031521.gif" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />Alex Pacinihttp://www.blogger.com/profile/13304951646877405715noreply@blogger.com0tag:blogger.com,1999:blog-3207270927898422436.post-40787782307683114272012-10-12T17:22:00.001+02:002019-07-08T20:25:38.592+02:00WAVE (Waves As Virtual Eyes)<span style="font-family: inherit;">WAVE (Waves As Virtual Eyes) is a project developed in 2009 from Alex Pacini, Stefano Pratiffi, Eric Paoloni and Alessandro Renzi.</span><br />
<span style="font-family: inherit;">It consists in a guide belt for blind people.</span><br />
<span style="font-family: inherit;">It won a participation to FAST 2010 in Milan and, successively, to ESE 2010 in Moscow. </span>It also won the CNA/CAR merit, the Intel Excellence in Computer Science Award and the subscription to ANIPLA (Associazione Nazionale Italiana Per L'Automazione).<br />
<a name='more'></a><span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">The project focuses on the problem of the guidance of temporary or permanent blind people.</span><br />
<br />
<div align="JUSTIFY" style="line-height: 115%; margin-bottom: 0.14in;">
<span style="font-family: inherit; line-height: 115%;">The
device is realized to locate and notify the user about the presence of
obstacles in his path.</span></div>
<div align="JUSTIFY" style="line-height: 115%; margin-bottom: 0.14in;">
<span style="font-family: inherit;">This is possible thanks to the use of two ultrasonic rangers
located in the extremities of the central unit, which detect and
communicate the presence or absence of obstructions.</span></div>
<div align="JUSTIFY" style="line-height: 115%; margin-bottom: 0.14in;">
<span style="font-family: inherit;">The
central unit is composed of a micro-controller which coordinates all
the device’s peripherals.</span></div>
<div align="JUSTIFY" style="line-height: 115%; margin-bottom: 0.14in;">
<span style="font-family: inherit;">The
belt communicates with the user through vibrations and acoustic
signals, which can vary in intensity and frequency depending on the
distance from the obstacle.</span></div>
<div align="JUSTIFY" style="line-height: 115%; margin-bottom: 0.14in;">
<span style="font-family: inherit;">To
increase the device’s efficiency, the user can also choose between
two different maps, the first for an indoor use and the second
one for outdoor. This allows the device to adapt
itself depending on where it's used.</span></div>
<div align="JUSTIFY" style="margin-bottom: 0.14in;">
<span style="font-family: inherit;"><span style="line-height: 115%;">You can find a paper in Italian </span></span><a href="https://minus.com/lWHmQuuZr5giY" style="font-family: inherit; line-height: 115%;" target="_blank">HERE</a><span style="font-family: inherit;"><span style="line-height: 115%;">, a simple </span></span><span style="line-height: 18px;">English one <a href="https://app.box.com/s/nw7h8t5asgtjkhkcprjr96lu3vpz3uov" target="_blank">HERE</a></span><span style="font-family: inherit;"><span style="line-height: 115%;"> and a flyer <a href="https://app.box.com/s/7z1co1bh046uqnqb9xyhcv601qoa6rif">HERE</a></span></span></div>
<div align="JUSTIFY" style="line-height: 115%; margin-bottom: 0.14in;">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<style>.embed-container { position: relative; padding-bottom: 100%; height: 0; overflow: hidden; max-width: 100%; } .embed-container iframe, .embed-container object, .embed-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }</style><br />
<div class="embed-container">
<iframe allowfullscreen="" frameborder="0" src="https://app.box.com/embed/preview/8wmaf6jnhw3ip8on1b6f?view=&sort=&direction=ASC&theme=dark"></iframe></div>
Alex Pacinihttp://www.blogger.com/profile/13304951646877405715noreply@blogger.com0tag:blogger.com,1999:blog-3207270927898422436.post-46847847370805685262012-01-11T21:08:00.004+01:002022-11-08T22:37:13.012+01:00Change MAC address in Sabayon/Gentoo LinuxIf, for any reason, you want to change your MAC address in Sabayon/Gentoo Linux, there are two easy way to do it.<br />
Everything is done as <b>root</b>.<br />
<a name='more'></a><br />
The classic one is using "<b>ifconfig</b>".<br />
I do an example with wlan0.<br />
<br />
Stop interface:<br />
<blockquote class="tr_bq">
<span style="font-family: monospace;"><b>systemctl stop NetworkManager</b></span></blockquote>
Change the MAC:<br />
<blockquote class="tr_bq">
<b>ifconfig wlan0 hw ether XX:XX:XX:XX:XX:XX</b></blockquote>
where XX:XX:XX:XX:XX:XX is your desidered MAC<br />
<br />
Start interface:<br />
<blockquote class="tr_bq">
<b>systemctl start NetworkManager</b></blockquote>
Now you will connect using NetworkManager (as usually) with XX:XX:XX:XX:XX:XX as MAC.<br />
Every reboot it's reset to the original one.<br />
<br />
Another useful tool is "<b>macchanger</b>".<br />
<blockquote class="tr_bq">
Usage: macchanger [options] device<br />
-h, --help Print this help<br />
-V, --version Print version and exit<br />
-s, --show Print the MAC address and exit<br />
-e, --endding Don't change the vendor bytes<br />
-a, --another Set random vendor MAC of the same kind<br />
-A Set random vendor MAC of any kind<br />
-r, --random Set fully random MAC<br />
-l, --list[=keyword] Print known vendors<br />
-m, --mac=XX:XX:XX:XX:XX:XX Set the MAC XX:XX:XX:XX:XX:XX</blockquote>
To do the same work as above:<br />
<b><br /></b> <b style="font-family: monospace;">systemctl stop NetworkManager</b><br />
<b> macchanger --mac=XX:XX:XX:XX:XX:XX wlan0</b><br />
<b style="font-family: monospace;">systemctl start NetworkManager</b><br />
<b><br /></b>
This can even set random vendor MAC of the same kind:<br />
<br />
<b> </b><b style="font-family: monospace;">systemctl stop NetworkManager</b><br />
<b> macchanger -a wlan0 </b><br />
<b> </b><b style="font-family: monospace;">systemctl start NetworkManager</b><br />
<div>
<b style="font-family: monospace;"><br /></b></div>
You can do a script and put it in "<b>/usr/bin</b>".<br />
Take the script below and add your preferences<br />
<b><br />
<script src="https://gist.github.com/alexpacini/6029371.js"></script>
</b><br />
<br />
Copy and paste in a new text file, save it with some name (p.e. <b>nmac</b>);<br />
make it executable (<b>chmod +x nmac</b>);<br />
copy it in "<b>/usr/bin</b>" (<b>cp nmac </b><b>/usr/bin/nmac</b>);<br />
now you can simply use it from the superuser (<b>su</b>) console.<br /><br />
Don't use it for any illegal purpose, and use it at your own risk.<br />Alex Pacinihttp://www.blogger.com/profile/13304951646877405715noreply@blogger.com0