Lab

Fixture Course

Tools11
Synthetic Course: written to test the Site template, from no Professor's material

01Thermal resistance

Sim

The plate cooling from both faces

Move tt to watch the plate cool, or α\alpha to make it another material. The table reads it where W01.2 does; the map shows the whole plate over time.

Assumed
supplied here, not in the Materials: tt tuned from 00 to 120 s120\ \text{s} in steps of 11 · α\alpha tuned from 44 to 40 mm2/s40\ \text{mm}^2/\text{s} in steps of 11
TT (°C)
xx (mm)
Fig.The temperature across the wall at the chosen time, between where it starts and where it settles, both dashed.
xx (mm)TT (°C)
020.0
1037.6
2044.9
3037.6
4020.0

Fo=αtL2\mathrm{Fo} = \frac{\alpha t}{L^2} = 0.225: the mid-plane is at 44.9 °C, the quarter points at 37.6 °C

03Gradient descent

Sim

Gradient descent on the three points

Drag the start θ(0)\theta^{(0)} on the contours of JJ, change α\alpha or the number of steps. The table fills step by step; past the largest α\alpha that converges, the steps overshoot and JJ grows.

Assumed
supplied here, not in the Materials: θ0\theta_0 and θ1\theta_1 tuned from −1-1 to 33 in steps of 0.10.1 · α\alpha tuned from 0.010.01 to 11 in steps of 0.010.01 · up to 3030 steps
θ1\theta_1θ0\theta_0
Fig.Contours of J(θ)J(\theta). Drag θ(0)\theta^{(0)} to start somewhere else.
yyxx
Fig.The data, and the line after 2 steps
kkθ0\theta_0θ1\theta_1J(θ)J(\theta)
00.00000.00004.3333
10.26670.36672.5231
20.47000.64561.4741

After 2 steps: θ0\theta_0 = 0.4700, θ1\theta_1 = 0.6456, J(θ)J(\theta) = 1.4741

Step-through

The descent path, step by step

Where the first two steps of W03.1 take θ\theta on the plane of θ0\theta_0 and θ1\theta_1.

−0.50.00.51.01.5−1.0−0.50.00.51.01.52.0θ1\theta_1θ0\theta_0θ(0)\theta^{(0)}minimum
Fig.Descent starts at θ(0)=(0,0)\theta^{(0)} = (0, 0), far from the minimum
Step 1 / 3

A step-through, not a live sim: no independent recompute could check a model of this figure, so it steps through the Materials' own values.

Derived
worked out here, no official key: the minimum, (1.1667,1.5)(1.1667, 1.5)
Python

The same line by the normal equation

Real Python with numpy: the line gradient descent steps towards, solved in one step by θ=(XTX)−1XTy\theta = (X^{\mathsf{T}} X)^{-1} X^{\mathsf{T}} y. Edit the code and run it live.

01230123456yyxxhθ(x)h_\theta(x)
Fig.The three points and the least-squares line hθ(x)=θ0+θ1xh_\theta(x) = \theta_0 + \theta_1 x

The plot and output the code gave at build. Run live downloads Python (16.5 MB) and runs the code as you edit it.

Output
theta0 = 1.1667
theta1 = 1.5000
J(theta) = 0.0278

04Full adder

Sim

The full adder in the figure

Tap a row of the truth table, or an input, to set AA, BB and CinC_{in}. Every wire carrying a 11 is inked; a 00 stays in pencil.

ABCinG1G2G3G4G5SCout
Fig.The figure's circuit. A wire carrying a 1 is inked; a 0 stays in pencil.
Inputs

S = 0, Cout = 1

ABCinSCout
00
10
10
01
10
01
01
11

05Derivatives

Sim

Secants closing on the tangent

Slide PP along the curve to move the tangent, or QQ to change the run hh. The table's secants, over hh, a tenth of it and a hundredth, close on the slope the red pen rings.

Assumed
supplied here, not in the Materials: aa tuned from 00 to 2.52.5 in steps of 0.050.05 · hh tuned from 0.10.1 to 11 in steps of 0.050.05
yyxx
Fig.f(x)f(x), its tangent at PP and the secants towards QQ. Slide PP or QQ along the curve.
hhf(a+h)f(a + h)f(a+h)−f(a)h\frac{f(a + h) - f(a)}{h}
17.00006.0000
0.11.23102.3100
0.011.02032.0301
h→0h \to 01.00002.0000

The secants close on f′(a)f'(a) = 2.0000: the tangent at PP is y = 2.0000x − 3.0000

06Tank level in STL

Sim

The tank listing, running

Set the level transmitter's raw value and the switches, then step a statement or run a whole scan. The trace shows the accumulators, AR 1, the status word and every byte each statement writes.

  1. ORGANIZATION_BLOCK OB 1
  2. TITLE = Horizontal cylindrical tank: level to volume
  3. // Tank radius r = 1.0 m, length 4.0 m.
  4. // PIW 256: level transmitter, 0..27648 = empty..full (-27648..27648 if I 0.1 = bipolar).
  5. // MD 60..72: four volume set-points in litres, written by the HMI.
  6. BEGIN
  7. NETWORK
  8. TITLE = 1 Zero-point correction
  9. L PIW 256 // raw level from the analog module
  10. L 200 // zero-point offset found at commissioning
  11. +I // INT add: wraps past 32767 and sets OV
  12. T MW 20 // corrected raw level
  13. A OV // did the addition overflow?
  14. S M 1.2 // latch: offset overflow alarm
  15. NETWORK
  16. TITLE = 2 Scale to metres with FC105
  17. CALL FC 105
  18. IN :=MW20
  19. HI_LIM :=2.000000e+000 // full = tank diameter, 2.0 m
  20. LO_LIM :=0.000000e+000 // empty = 0.0 m
  21. BIPOLAR:=I0.1
  22. RET_VAL:=MW22 // W#16#0008 = input out of range
  23. OUT :=MD24 // level h in metres
  24. NETWORK
  25. TITLE = 3 Wetted cross-section: A = r2 acos(d/r) - d sqrt(2rh - h2)
  26. L 1.000000e+000 // r = 1.0 m
  27. T MD 12
  28. L MD 12
  29. L MD 24
  30. -R // d = r - h
  31. T MD 44
  32. L MD 12
  33. /R // d / r
  34. ACOS // half the wetted angle, rad
  35. L MD 12
  36. SQR // r squared
  37. *R
  38. T MD 48 // r2 acos(d/r)
  39. L MD 12
  40. L 2.000000e+000
  41. *R // 2r
  42. L MD 24
  43. *R // 2rh
  44. L MD 24
  45. SQR // h squared
  46. -R
  47. ABS // clears -0.0 when h = 0 or h = 2r
  48. SQRT // half the chord
  49. L MD 44
  50. *R // d sqrt(2rh - h2)
  51. T MD 52
  52. L MD 48
  53. L MD 52
  54. -R // wetted area A, m2
  55. T MD 28
  56. NETWORK
  57. TITLE = 4 Volume in litres
  58. L MD 28
  59. L 4.000000e+000 // tank length 4.0 m
  60. *R
  61. L 1.000000e+003 // m3 to litres
  62. *R
  63. T MD 32 // volume V, litres
  64. NETWORK
  65. TITLE = 5 Level band: how many set-points has V passed?
  66. L 0
  67. T MW 36 // band := 0
  68. LAR1 P#60.0 // AR1 -> first set-point, MD 60
  69. L 4 // four set-points
  70. NEXT: T MW 38 // loop counter
  71. L MD 32 // volume
  72. L MD [AR1,P#0.0] // set-point under AR1
  73. >R
  74. JCN SKIP
  75. L MW 36
  76. L 1
  77. +I
  78. T MW 36 // band := band + 1
  79. SKIP: +AR1 P#4.0 // next set-point
  80. L MW 38
  81. LOOP NEXT
  82. L MW 20
  83. L 10
  84. *I // tenths of a count, 32 bits, for the trend log
  85. T MD 40
  86. NETWORK
  87. TITLE = 6 Alarms, latched until I 0.0 acknowledges
  88. A I 0.0 // acknowledge button
  89. R M 1.0
  90. R M 1.1
  91. R M 1.2
  92. L MW 22 // RET_VAL from FC105
  93. L 0
  94. <>I
  95. S M 1.0 // latch: level signal out of range
  96. L MW 36 // level band
  97. L 4
  98. >=I
  99. S M 1.1 // latch: above the high-high set-point
  100. O M 1.0
  101. O M 1.1
  102. O M 1.2
  103. = Q 4.1 // common alarm lamp
  104. NETWORK
  105. TITLE = 7 High-volume lamp (exam trap)
  106. A I 0.2 // pump running: opens a logic string ...
  107. L MD 32
  108. L 1.000000e+004
  109. >R // ... but a compare writes RLO outright
  110. = Q 4.0 // so Q 4.0 = (V > 10 000 l), whatever I 0.2 is
  111. END_ORGANIZATION_BLOCK

Scan 1 · statement 113 of 113

Statement111 BE
ACCU 110000.016#461C_4000
ACCU 26283.185516#45C4_597C
AR 1P#76.0
  • /FC0
  • RLO0
  • STA1
  • OR0
  • OS0
  • OV0
  • CC01
  • CC10
  • BR?

A ? is left by FC105: Siemens doesn't publish what the block leaves there, so the trace doesn't guess until a statement writes it.

Writtennothing
OperandValue
MW 2013824
MW 22W#16#0000
MD 241.0
MD 281.5707964
MD 326283.1855
MW 362
MD 40L#138240
Q 4.00
Q 4.10
M 1.00
M 1.10
M 1.20
LineStatementACCU 1RLO
9L PIW 256136240
10L 2002000
11+I138240
12T MW 20138240
13A OV138240
14S M 1.2138240
17CALL FC 105??
26L 1.000000e+0001.0?
27T MD 121.0?
28L MD 121.0?
29L MD 241.0?
30-R0.0?
31T MD 440.0?
32L MD 121.0?
33/R0.0?
34ACOS1.5707964?
35L MD 121.0?
36SQR1.0?
37*R1.5707964?
38T MD 481.5707964?
39L MD 121.0?
40L 2.000000e+0002.0?
41*R2.0?
42L MD 241.0?
43*R2.0?
44L MD 241.0?
45SQR1.0?
46-R1.0?
47ABS1.0?
48SQRT1.0?
49L MD 440.0?
50*R0.0?
51T MD 520.0?
52L MD 481.5707964?
53L MD 520.0?
54-R1.5707964?
55T MD 281.5707964?
58L MD 281.5707964?
59L 4.000000e+0004.0?
60*R6.2831855?
61L 1.000000e+0031000.0?
62*R6283.1855?
63T MD 326283.1855?
66L 00?
67T MW 360?
68LAR1 P#60.00?
69L 44?
70T MW 384?
71L MD 326283.1855?
72L MD [AR1,P#0.0]1000.0?
73>R1000.01
74JCN SKIP1000.01
75L MW 3601
76L 111
77+I11
78T MW 3611
79+AR1 P#4.011
80L MW 3841
81LOOP NEXT31
70T MW 3831
71L MD 326283.18551
72L MD [AR1,P#0.0]3000.01
73>R3000.01
74JCN SKIP3000.01
75L MW 3611
76L 111
77+I21
78T MW 3621
79+AR1 P#4.021
80L MW 3831
81LOOP NEXT21
70T MW 3821
71L MD 326283.18551
72L MD [AR1,P#0.0]10000.01
73>R10000.00
74JCN SKIP10000.01
79+AR1 P#4.010000.01
80L MW 3821
81LOOP NEXT11
70T MW 3811
71L MD 326283.18551
72L MD [AR1,P#0.0]12000.01
73>R12000.00
74JCN SKIP12000.01
79+AR1 P#4.012000.01
80L MW 3811
81LOOP NEXT01
82L MW 20138241
83L 10101
84*IL#1382401
85T MD 40L#1382401
88A I 0.0L#1382400
89R M 1.0L#1382400
90R M 1.1L#1382400
91R M 1.2L#1382400
92L MW 2200
93L 000
94<>I00
95S M 1.000
96L MW 3620
97L 440
98>=I40
99S M 1.140
100O M 1.040
101O M 1.140
102O M 1.240
103= Q 4.140
106A I 0.241
107L MD 326283.18551
108L 1.000000e+00410000.01
109>R10000.00
110= Q 4.010000.00
111BE10000.00

07Machine parts

3D part

The flanged hub

The hub of W07.1 as an exact solid: a flange with four bolt holes, a hub, and a bore through both. Turn it to see the holes from below.

Drawing the part…
The part's dimensions, in millimetres
DimensionmmRead as
Ø80stated
10stated
Ø40stated
30scaled off the drawing
Ø20stated
Ø8assumed
60stated

08Root locus and the step response

Sim

The loop on its root locus

Drag a closed-loop pole along the locus, or slide KK, and watch the step response, the Bode plot and the Nyquist plot follow. The red pen marks the overshoot and the settling time.

Assumed
supplied here, not in the Materials: KK tuned from 0.50.5 to 2020 in steps of 0.50.5
R(s)KG(s)Y(s)
Fig.The loop as the figure draws it: the gain and the plant under unity negative feedback.
jωj\omegaσ\sigma
Fig.The root locus: drag a closed-loop pole along it to set the gain. Crosses are the open-loop poles.
ωn\omega_n (rad/s)2.000
ζ\zeta0.500
σ\sigma−1.000
ωd\omega_d (rad/s)1.732
overshoot (%)16.303
TpT_p (s)1.814
TrT_r (s)0.819
TsT_s (s)4.038
ωc\omega_c (rad/s)1.572
PM (°)51.827

At KK = 4.0 the response overshoots by 16.303 % and settles in 4.038 s.

09A blending station in SCL

Sim

The blending station, running

Set the load cells and the buttons, then step a statement or run a whole scan. Each scan calls the Blender block once; the trace shows what every statement decided and wrote.

  1. // A blending station: three silos dose into one hopper, then a mixer runs the batch.
  2. TYPE "Silo"
  3. STRUCT
  4. target_kg : REAL; // the recipe's weight from this silo
  5. raw : INT; // load cell: 0..27648 = 0..500 kg
  6. kg : REAL; // the weight it reads
  7. short : BOOL; // still under its target
  8. END_STRUCT
  9. END_TYPE
  10. DATA_BLOCK "Recipe"
  11. VAR
  12. silo : ARRAY[1..3] OF "Silo";
  13. batches : INT; // batches mixed so far
  14. END_VAR
  15. BEGIN
  16. silo[1].target_kg := 120.0;
  17. silo[2].target_kg := 80.0;
  18. silo[3].target_kg := 120.0;
  19. END_DATA_BLOCK
  20. FUNCTION ToKg : REAL
  21. VAR_INPUT
  22. raw : INT;
  23. END_VAR
  24. BEGIN
  25. ToKg := INT_TO_REAL(raw) / 27648.0 * 500.0;
  26. END_FUNCTION
  27. FUNCTION_BLOCK "Blender"
  28. VAR_INPUT
  29. start : BOOL; // the operator's start button
  30. raw1 : INT; // the three load cells
  31. raw2 : INT;
  32. raw3 : INT;
  33. mixed : BOOL; // the mixer's timer has run out
  34. END_VAR
  35. VAR_OUTPUT
  36. valve : INT; // the silo dosing now, 0 = none
  37. total_kg : REAL; // in the hopper
  38. fill_pct : REAL; // of the batch's weight
  39. bags : INT; // 25 kg bags the hopper fills
  40. mixer : BOOL;
  41. END_VAR
  42. VAR
  43. step : INT; // 0 IDLE, 1 DOSE, 2 MIX
  44. last_start : BOOL; // start, one scan ago
  45. END_VAR
  46. VAR_TEMP
  47. i : INT;
  48. target : REAL;
  49. END_VAR
  50. BEGIN
  51. "Recipe".silo[1].raw := raw1;
  52. "Recipe".silo[2].raw := raw2;
  53. "Recipe".silo[3].raw := raw3;
  54. total_kg := 0.0;
  55. target := 0.0;
  56. FOR i := 1 TO 3 DO
  57. "Recipe".silo[i].kg := ToKg(raw := "Recipe".silo[i].raw);
  58. "Recipe".silo[i].short := "Recipe".silo[i].kg < "Recipe".silo[i].target_kg;
  59. total_kg := total_kg + "Recipe".silo[i].kg;
  60. target := target + "Recipe".silo[i].target_kg;
  61. END_FOR;
  62. fill_pct := total_kg / target * 100.0;
  63. bags := REAL_TO_INT(total_kg / 25.0); // 312.5 kg is 12.5 bags (a Divergence: the exam's answer differs from a real S7)
  64. valve := 0;
  65. CASE step OF
  66. 0: // IDLE: wait for start to rise
  67. IF start AND NOT last_start THEN
  68. step := 1;
  69. END_IF;
  70. 1: // DOSE: open the first silo still short
  71. FOR i := 1 TO 3 DO
  72. IF "Recipe".silo[i].short THEN
  73. valve := i;
  74. EXIT;
  75. END_IF;
  76. END_FOR;
  77. IF valve = 0 THEN
  78. step := 2;
  79. END_IF;
  80. 2: // MIX: run the mixer until its timer runs out
  81. mixer := NOT mixed;
  82. IF mixed THEN
  83. "Recipe".batches := "Recipe".batches + 1;
  84. step := 0;
  85. END_IF;
  86. ELSE
  87. step := 0;
  88. END_CASE;
  89. last_start := start;
  90. END_FUNCTION_BLOCK

Scan 1 · statement 27 of 27

Statement92 last_start := start;
Writtenlast_start := FALSE
VariableValue
step0
valve0
total_kg312.5
fill_pct97.65625
bags12
mixerFALSE
Recipe.silo[1].kg117.1875
Recipe.silo[2].kg78.125
Recipe.silo[3].kg117.1875
Recipe.batches0
LineStatementResult
54"Recipe".silo[1].raw := raw1;Recipe.silo[1].raw := 6480
55"Recipe".silo[2].raw := raw2;Recipe.silo[2].raw := 4320
56"Recipe".silo[3].raw := raw3;Recipe.silo[3].raw := 6480
57total_kg := 0.0;total_kg := 0.0
58target := 0.0;target := 0.0
59FOR i := 1 TO 3 DOinto the loop
60"Recipe".silo[i].kg := ToKg(raw := "Recipe".silo[i].raw);Recipe.silo[1].kg := 117.1875
61"Recipe".silo[i].short := "Recipe".silo[i].kg < "Recipe".silo[i].target_kg;Recipe.silo[1].short := TRUE
62total_kg := total_kg + "Recipe".silo[i].kg;total_kg := 117.1875
63target := target + "Recipe".silo[i].target_kg;target := 120.0
64END_FOR;again
60"Recipe".silo[i].kg := ToKg(raw := "Recipe".silo[i].raw);Recipe.silo[2].kg := 78.125
61"Recipe".silo[i].short := "Recipe".silo[i].kg < "Recipe".silo[i].target_kg;Recipe.silo[2].short := TRUE
62total_kg := total_kg + "Recipe".silo[i].kg;total_kg := 195.3125
63target := target + "Recipe".silo[i].target_kg;target := 200.0
64END_FOR;again
60"Recipe".silo[i].kg := ToKg(raw := "Recipe".silo[i].raw);Recipe.silo[3].kg := 117.1875
61"Recipe".silo[i].short := "Recipe".silo[i].kg < "Recipe".silo[i].target_kg;Recipe.silo[3].short := TRUE
62total_kg := total_kg + "Recipe".silo[i].kg;total_kg := 312.5
63target := target + "Recipe".silo[i].target_kg;target := 320.0
64END_FOR;done
65fill_pct := total_kg / target * 100.0;fill_pct := 97.65625
66bags := REAL_TO_INT(total_kg / 25.0);bags := 12
67valve := 0;valve := 0
68CASE step OF0: line 69
70IF start AND NOT last_start THENFALSE
92last_start := start;last_start := FALSE
Derived
worked out here, no official key: 12.512.5 bags, held as 1212
Divergence
The exam answer is 1313 bags, the Professor's. REAL_TO_INT rounds 12.512.5 to the even number on a real S7, so the CPU holds 1212.

10Two conveyors in ladder

Sim

The two conveyors, running

Press Start and Stop, then run time on. A rung carrying power is inked, the TON's gauge fills as ET counts up to PT, and the timing chart measures the delay from Q 4.0 to Q 4.1.

I 0.0Q 4.0I 0.1Q 4.0Q 4.0TONINQPTETDB 1T#5SMD 20Q 4.1
Fig.The figure's networks. A rung carrying power is inked; a timer's bar fills as it runs.
Inputs
Time

t = 9.0 s · a scan every 100 ms

Q 4.0 = 0, Q 4.1 = 0

DB 1: ET 0 ms of 5000 ms

I 0.0I 0.1Q 4.0Q 4.1MD 205.0 s0 s2 s4 s6 s8 s10 s
ChartThe last ten seconds, scan by scan. Red pen measures each timer from its input to its Q.