Skip to content

Commit

Permalink
Fix tables and units
Browse files Browse the repository at this point in the history
- Adds custom CSS for `text-left` and `text-right` classes.  These are
  added to table cells by MyST parser but are not defined in Boostrap 5.
  [issue](executablebooks/MyST-Parser#785)

- Converts the post-lab model parameters table from a list-table to a
  regular table because list-tables do not support column alignment.

- Replaces the deprecated \si command with \qty.  Hopefully this will
  help with compatibility with the LaTeX siunitx package.
  • Loading branch information
jhcole committed Jun 24, 2023
1 parent fb76fe7 commit d9524d4
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 22 deletions.
4 changes: 3 additions & 1 deletion source/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,6 @@ html:
# - https://github.com/executablebooks/jupyter-book/issues/1174#issuecomment-759857170
sphinx:
config:
mathjax_path: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js
mathjax_path: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js
html_static_path: ["_static"]
html_css_files: ["custom.css"]
6 changes: 6 additions & 0 deletions source/_static/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.text-left{
text-align: left !important;
}
.text-right{
text-align: right !important;
}
35 changes: 15 additions & 20 deletions source/lab_1.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,15 @@ given folder (directory).
Some block parameters are in radians.
```

| D/A | WaveType | Amplitude | DC level | Phase Shift | Oscope | Scale |
|-----:|----------:|----------:|---------:|------------:|-------:|----------:|
| Ch 1 | Sine | 5 V | 0 V | 0 deg | Ch 1 | 5 V/div |
| Ch 2 | Sine | 5 V | 5 V | -90 deg | Ch 2 | 5 V/div |
| Ch 3 | Square | 5 V | 0 V | 0 deg | Ch 3 | 5 V/div |
```{table} Target model parameters
:name: tab:target_model_parameters
| D/A | Wave Type | Amplitude | DC level | Phase Shift | Oscope | Scale |
|-----:|-----------:|--------------:|--------------:|------------:|-------:|----------------------:|
| Ch 1 | Sine | $\qty{5}{\V}$ | $\qty{0}{\V}$ | $\ang{0}$ | Ch 1 | $\qty{5}{\V\per div}$ |
| Ch 2 | Sine | $\qty{5}{\V}$ | $\qty{5}{\V}$ | $\ang{-90}$ | Ch 2 | $\qty{5}{\V\per div}$ |
| Ch 3 | Square | $\qty{5}{\V}$ | $\qty{0}{\V}$ | $\ang{0}$ | Ch 3 | $\qty{5}{\V\per div}$ |
```
%| Ch 4 | Sawtooth | 10 V | -10 V | 0 deg | Ch 4 | 10 mA/div |

4. Simulink Real-Time (slrt) is included in the Simulink software. This software
Expand Down Expand Up @@ -390,22 +394,12 @@ and labelled plots.
We will build a Simulink model based on this equation. The parameters are
given in {numref}`tab:model_parameters`.

```{list-table} Parameters
:header-rows: 1
```{table} Model parameters.
:name: tab:model_parameters
* - $r_1$
- $r_2^\prime$
- $L_{l1}$
- $L_{l2}^\prime$
- $L_{m1}$
- $R_{L}$
* - $\si{0.1}{\ohm}$
- $\si{0.1}{\ohm}$
- $\si{1}{\mH}$
- $\si{1}{mH}$
- $\si{10}{\mH}$
- $\si{1.9}{\ohm}$
| $r_1$ | $r_2^\prime$ | $L_{l1}$ | $L_{l2}^\prime$ | $L_{m1}$ | $R_{L}$ |
|------------------:|------------------:|---------------:|----------------:|----------------:|------------------:|
| $\qty{0.1}{\ohm}$ | $\qty{0.1}{\ohm}$ | $\qty{1}{\mH}$ | $\qty{1}{mH}$ | $\qty{10}{\mH}$ | $\qty{1.9}{\ohm}$ |
```

2. Launch MATLAB, then launch Simulink by pressing the {guilabel}`Simulink` icon
Expand Down Expand Up @@ -495,7 +489,8 @@ and labelled plots.
workspace. The Simulink model has access to all workspace variables.

9. Double-click the {guilabel}`Sine Wave` icon to open its dialog window. Set
the amplitude to 100 (volts peak) and frequency to $\si{400}{\rad\per\second}$.
the amplitude to 100 (volts peak) and frequency to
$\qty{400}{\rad\per\second}$.

10. Before running the simulation, go to the top menu in the Simulink model
window and select the {guilabel}`Modelling` tab. Then press {guilabel}`Model
Expand Down
4 changes: 3 additions & 1 deletion source/macros.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
```{math}
% Poor man's siunitx
\newcommand\si[2]{#1~\mathrm{#2}}
\newcommand\ang[1]{#1^\circ}
\newcommand\qty[2]{#1~\mathrm{#2}}
\newcommand\per{/}
%
% Angle
Expand Down

0 comments on commit d9524d4

Please sign in to comment.