Salta al contenuto
Note per Studenti Course Overview and Laboratory Setup Report

Course Overview and Laboratory Setup

In questa pagina 5

Course structure

The course is an application-oriented extension of a basic Automatic Control course, with an experimental focus. The tools are numerical (MATLAB/Simulink) and a physical control setup (a DC servomotor). Learning outcome: the ability to apply theoretical and numerical tools for the analysis, simulation and control of dynamic systems.

Activity CFU Hours Lectures (2 h each)
In-class lectures 2.50 20 10
Computer laboratory 2.25 18 9
Experimental laboratory 1.25 10 5
Total 6 48 24

Weekly schedule (as printed on the slide):

Day Hours Room
Monday 08:30 - 10:30 De / Ue-Te
Wednesday 08:30 - 10:30 Me / CSL

Ue/Te are the computer rooms, CSL is the Control Systems Laboratory (the experimental one). The slide does not explain the first code of each pair (De, Me).

Where the labs are:

  • Computer rooms (Ue/Te): 2nd floor of the engineering teaching building ("Polo Didattico di Ingegneria") of Via Gradenigo 6/A.
  • Control Systems Laboratory: 1st floor of the DEI/D building, at the end of the corridor, opposite the main lecture hall (Aula Magna).

Teaching methods

In-class lectures (Mondays or Wednesdays, see the course calendar), three modules:

  • 5 review lectures on fundamental Automatic Control topics;
  • 2 introductory lectures on digital control;
  • 3 preparatory lectures for the experimental lab activities.

Supporting material: slides and notes posted on the course Moodle page.

Numerical laboratory sessions (Mondays):

  • 50 + 50 workstations available (computer rooms Ue/Te);
  • 3 introductory sessions on numerical tools;
  • 6 preparatory activities for the experimental lab;
  • supporting material: lab handouts and MATLAB/Simulink solutions to the proposed exercises.

Experimental laboratory sessions (Wednesdays):

  • 12 workstations / experimental benches;
  • two shifts: 8:30-10:30 (Shift 1) and 10:30-12:30 (Shift 2);
  • 1 introductory lecture on the experimental setup;
  • 4 lab activities with mandatory in-person attendance;
  • 1 optional catch-up session.

Groups are needed only for the experimental sessions: at most 4 students per group, the registration link appears on Moodle in mid-March, and the lab activities start at the end of April.

Access requirements

  • A departmental account (an address of the form [email protected]) is required to log in to the laboratory PC workstations; instructions to request or update it are on the department web page "DEI Account Procedures".
  • Access to the experimental laboratory requires the mandatory safety training courses:
    • "Basic Course in Health and Safety: General Training" (4 hours);
    • "Health and Safety at the Workplace - High Risk" (12 hours).
  • Once finished, upload a single PDF with the certificates of attendance through the link "Safety course certificate submission" on the course Moodle page. Anyone who already did these courses in the past just uploads the certificate and does not retake them.

Moodle page and support

  • Course code on the STEM Moodle: INQ1097824, academic year 2025-2026. No enrollment key.
  • It is used to share course materials, post announcements and send other information.
  • The Moodle page text visible on the slide adds: lectures are in person, but a few lessons are delivered asynchronously (introduction to the Control System Toolbox of MATLAB, introduction to Simulink, introduction to the simulation of hybrid systems); experimental activities are done in groups of 3 or 4 people in the experimental laboratory; participation in the experimental activities is mandatory to pass the exam (the screenshot reads "at least 3 out of the 4"; the slide of the teaching methods says 4 activities with mandatory attendance, so check Moodle for the current rule).
  • Email: always put [CSLAB 2025-26] in the subject line. Clarifications are normally given during or after lectures. Office hours are by appointment only, requested by email.

Final exam

  • Group report on one of the lab activities: 1/3 of the final grade.
  • Individual exam (numerical lab test): 2/3 of the final grade.
  • The partial grades (report + exam) are valid for one academic year.
  • The final grade can be registered only if the group report has been submitted and the individual exam is passed with a minimum score of 18/30.
  • Sessions: Summer 1, Summer 2, Fall 1, Winter 1 (hours and rooms were still "to be defined" on the slide).

Evaluation criteria:

  • ability to formalise a problem of applied nature;
  • ability to model a dynamic system;
  • ability to analyse and simulate a dynamic system;
  • ability to design a controller and evaluate its performance;
  • ability to write a technical report;
  • learning and understanding of the theoretical content.

Prerequisites

Course rationale: from model to real system

The course follows the typical development workflow of a control system, from theoretical modeling to real-time implementation:

  1. system modeling;
  2. continuous-time control design;
  3. digital implementation;
  4. simulation-based validation;
  5. real-time experimental testing.

The methodological principle is a chain Modeling -> Design -> Implement -> Test -> Refine, with a feedback arrow from "Refine" back to the earlier steps:

Modeling --> Design --> Implement --> Test --> Refine
   ^           ^           ^           ^         |
   |           .           .           .         |
   +-----------+-----------+-----------+---------+

The emphasis is on the iterative nature of control engineering: models are validated, controllers are tuned, performance is progressively improved through experiments.

Case study: speed control of a DC servomotor

The speed control of a DC servomotor is the unifying case study that illustrates the whole workflow. The plant is a servomotor module (photographs on the slide: a box with a gear train on top, BNC connectors on the front, a coreless DC motor with a gearbox inside).

1. System modeling

Goal: derive a mathematical model from physical principles:

  • Kirchhoff's voltage law: armature circuit dynamics;
  • Newton's second law: rotational mechanical dynamics;
  • electromechanical coupling laws: torque proportional to armature current, back-EMF proportional to angular velocity.

Lumped-element diagram (as drawn): the command uu goes through an input stage (R1 = 7.5 kOhm in series, then C1 = 100 nF and R2 = 1.6 kOhm to ground) into the non-inverting input of an operational amplifier supplied at ±12 V\pm 12\,\text{V}, with feedback resistor R3 = 1.2 kOhm and R4 = 500 Ohm to ground. The amplifier output is the voltage udrvu_{drv}; through a series (shunt) resistor RsR_s it feeds the armature, giving the armature voltage uau_a. The motor is drawn as the back-EMF source ueu_e, the inductance LaL_a and the resistance RaR_a in series. On the mechanical side: rotor inertia JmJ_m with torque τm\tau_m and angle ϑm\vartheta_m, a planetary gearbox (stage labelled 1÷141\div 14), then external gears (stage labelled 1÷11\div 1, with its own inertia printed as J72J_{72} on the slide), the load shaft with torque τl\tau_l and angle ϑl\vartheta_l, an extra disc inertia JdJ_d and a disturbance torque τd\tau_d.

Mathematical model (symbols as on the slide: iai_a armature current, ωm\omega_m motor speed, ωl\omega_l load speed, Bm,BlB_m, B_l viscous friction coefficients, JlJ_l load inertia, τl′\tau_l' load torque reflected on the motor side):

{Ladiadt+(Ra+Rs) ia=udrv−ue(electrical dynamics)Jmdωmdt+Bm ωm=τm−τl′(rotor mechanical dynamics)Jldωldt+Bl ωl=τl−τd(load mechanical dynamics)\begin{cases} L_a \dfrac{di_a}{dt} + (R_a+R_s)\, i_a = u_{drv} - u_e & \text{(electrical dynamics)}\\[2mm] J_m \dfrac{d\omega_m}{dt} + B_m\, \omega_m = \tau_m - \tau_l' & \text{(rotor mechanical dynamics)}\\[2mm] J_l \dfrac{d\omega_l}{dt} + B_l\, \omega_l = \tau_l - \tau_d & \text{(load mechanical dynamics)} \end{cases}

{ue=ke ωm(law of generators)τm=kt ia(law of motors){ωl=ωm/N(gearbox speed transformation)τl=N τl′(gearbox torque transformation)\begin{cases} u_e = k_e\, \omega_m & \text{(law of generators)}\\ \tau_m = k_t\, i_a & \text{(law of motors)} \end{cases} \qquad \begin{cases} \omega_l = \omega_m / N & \text{(gearbox speed transformation)}\\ \tau_l = N\, \tau_l' & \text{(gearbox torque transformation)} \end{cases}

The slide then reduces the model to the motor side (the intermediate steps are cut with "[...]"). Substituting τl′=τl/N\tau_l' = \tau_l/N, ωl=ωm/N\omega_l=\omega_m/N and the load equation into the rotor equation gives the reduced model

{Ladiadt+Req ia=udrv−ke ωmJeqdωmdt+Beq ωm=kt ia−1NτdTdrvdudrvdt+udrv=kdrv u  → L   {(Las+Req) Ia(s)=Udrv(s)−ke Ωm(s)(Jeqs+Beq) Ωm(s)=kt Ia(s)−1NTd(s)(Tdrvs+1) Udrv(s)=kdrv U(s)\begin{cases} L_a \dfrac{di_a}{dt} + R_{eq}\, i_a = u_{drv} - k_e\, \omega_m\\[2mm] J_{eq} \dfrac{d\omega_m}{dt} + B_{eq}\, \omega_m = k_t\, i_a - \dfrac{1}{N}\tau_d\\[2mm] T_{drv} \dfrac{du_{drv}}{dt} + u_{drv} = k_{drv}\, u \end{cases} \;\xrightarrow{\ \mathcal{L}\ }\; \begin{cases} (L_a s + R_{eq})\, I_a(s) = U_{drv}(s) - k_e\, \Omega_m(s)\\ (J_{eq} s + B_{eq})\, \Omega_m(s) = k_t\, I_a(s) - \tfrac{1}{N} T_d(s)\\ (T_{drv} s + 1)\, U_{drv}(s) = k_{drv}\, U(s) \end{cases}

Here Req=Ra+RsR_{eq} = R_a + R_s, and the block diagram on the slide shows the mechanical block as 1(Jm+Jl/N2) s+(Bm+Bl/N2)\dfrac{1}{(J_m + J_l/N^2)\,s + (B_m + B_l/N^2)}, i.e. Jeq=Jm+Jl/N2J_{eq} = J_m + J_l/N^2 and Beq=Bm+Bl/N2B_{eq} = B_m + B_l/N^2 (the load inertia and friction are seen through the gearbox divided by N2N^2). The driver is modelled as a first-order system with gain kdrvk_{drv} and time constant TdrvT_{drv}.

Block diagram (as drawn): u→kdrvTdrvs+1→udrvu \to \dfrac{k_{drv}}{T_{drv}s+1} \to u_{drv}; a summing node subtracts ueu_e; then 1Las+(Ra+Rs)→ia→kt→τm\dfrac{1}{L_a s + (R_a+R_s)} \to i_a \to k_t \to \tau_m; a second summing node subtracts τd/N\tau_d/N (through the block 1/N1/N); then the mechanical block gives ωm\omega_m; ωm\omega_m is fed back through kek_e to produce ueu_e; ωm\omega_m also goes through 1/N1/N to give ωl\omega_l, and through an integrator 1/s1/s to give ϑm\vartheta_m (and ωl→1/s→ϑl\omega_l \to 1/s \to \vartheta_l).

Transfer function and model reduction (from the input uu; the reduced form below also contains the integrator that gives the load position):

Pu→ωm(s)=Ωm(s)U(s)=kdrvTdrvs+1⋅kt(Las+Req)(Jeqs+Beq)+ktkeP_{u\to\omega_m}(s) = \frac{\Omega_m(s)}{U(s)} = \frac{k_{drv}}{T_{drv}s+1}\cdot\frac{k_t}{(L_a s + R_{eq})(J_{eq} s + B_{eq}) + k_t k_e}

P(s)≈kdrv ktReq (Jeqs+Beq)+ktke⋅1Ns=kmTms+1⋅1NsP(s) \approx \frac{k_{drv}\, k_t}{R_{eq}\,(J_{eq} s + B_{eq}) + k_t k_e}\cdot\frac{1}{N s} = \frac{k_m}{T_m s + 1}\cdot\frac{1}{N s}

The approximation on the slide drops the factor Tdrvs+1T_{drv}s+1 and the term LasL_a s (fast electrical and driver dynamics), leaving a first-order motor with static gain kmk_m and time constant TmT_m, followed by the gearbox ratio and an integrator. Collecting the denominator ReqBeq+ktke+ReqJeq sR_{eq}B_{eq} + k_t k_e + R_{eq}J_{eq}\,s gives km=kdrvktReqBeq+ktkek_m = \dfrac{k_{drv}k_t}{R_{eq}B_{eq}+k_tk_e} and Tm=ReqJeqReqBeq+ktkeT_m = \dfrac{R_{eq}J_{eq}}{R_{eq}B_{eq}+k_tk_e}. The full theory of this model is the subject of Modeling a DC ServomotorA permanent-magnet DC motor is modeled by an electrical equation with a back-EMF term and a mechanical equation with inertia and viscous friction, a gearbox just adds the load inertia and friction divided by N squared on the motor side, and for the laboratory servomotor (voltage driver plus gearmotor plus disc) this gives a transfer function from input voltage to load angle that reduces to a first-order lag times an integrator.Modeling a DC Servomotor →.

2. Parameter estimation

Goal: identify unknown or uncertain parameters from experimental data acquired with ad-hoc tests.

Friction parameters. The friction torque seen at the motor side is modelled as viscous plus Coulomb friction:

τf′=Beq ωm+τsfN sign(ωm)\tau_f' = B_{eq}\,\omega_m + \frac{\tau_{sf}}{N}\,\text{sign}(\omega_m)

The slide plots the measured friction torque against the motor speed (from −6.3-6.3 to 6.36.3 krpm, torque of the order of 10−310^{-3} Nm): the experimental points lie on two straight lines, one for positive and one for negative speed, with a jump at zero speed. A least-squares (LS) fit of the two lines gives BeqB_{eq} (the slope) and τsf/N\tau_{sf}/N (the intercept, roughly 0.5×10−30.5\times 10^{-3} Nm read from the plot).

Inertia parameters. With the friction estimate τ^f′\hat\tau_f' already known, the part of the motor torque that accelerates the rotor is

τ^i=τm−τ^f′=J^eq dωmdtwithdωmdt≠0\hat\tau_i = \tau_m - \hat\tau_f' = \hat J_{eq}\,\frac{d\omega_m}{dt}\qquad\text{with}\quad \frac{d\omega_m}{dt}\neq 0

so the experiment must make the motor accelerate. The test shown applies a triangular speed profile (between 0 and about 6 krpm, period 2 s, over 8 s): the armature current iai_a is measured (up to about 0.25 A), the acceleration ama_m alternates between about +6+6 and −6-6 krpm/s, and τ^i\hat\tau_i alternates between about +5×10−4+5\times 10^{-4} and −5×10−4-5\times 10^{-4} Nm. The ratio of τ^i\hat\tau_i to the acceleration gives J^eq\hat J_{eq}.

3. Continuous-time (CT) control design

Goal: continuous-time speed control design and validation. The control loop on the slide: reference ω∗\omega^*, error ee, controller C(s)C(s), command uu, a disturbance dd added at the plant input (uau_a), plant P(s)P(s) made of P′(s)P'(s) (giving ω\omega) followed by an integrator 1/s1/s (giving ϑ\vartheta), and a sensor H(s)H(s) with measurement noise nn returning ωm\omega_m and ϑm\vartheta_m.

Control specifications (as printed):

  • perfect steady-state tracking of step position (load side) references;
  • perfect steady-state rejection of constant torque disturbances;
  • step response with settling time ts,5%≤0.15 st_{s,5\%} \le 0.15\,\text{s} and overshoot Mp≤10%M_p \le 10\%;
  • PID control structure.

The step response sketch defines the figures of merit: rise time trt_r (from 10% to 90% of the final value), peak time tpt_p, overshoot MpM_p (from the peak ymax⁡y_{\max} to 1), and settling time tst_s (entering the band of ±0.05\pm 0.05 around the final value). See Control System Design SpecificationsA control design starts from specifications on stability, steady-state and transient performance and robustness, which are stated on the closed-loop time or frequency response and then translated into a crossover frequency and a phase margin of the loop transfer function.Control System Design Specifications → and Second-Order System Step ResponseThe unit step response of a BIBO stable second-order system with complex conjugate poles is W(0) times one minus an exponentially decaying sinusoid, and its rise time, settling time and overshoot are approximately 1.8 over the natural frequency, 4.6 over the real part of the pole magnitude, and exp of minus pi times the damping ratio over the square root of one minus its square.Second-Order System Step Response →.

Frequency-domain design (Bode's method). The PID is in parallel form with a filtered derivative:

C(s)=U(s)E(s)=KP(1+1TIs+TDs1+TDNs)C(s) = \frac{U(s)}{E(s)} = K_P\left(1 + \frac{1}{T_I s} + \frac{T_D s}{1+\frac{T_D}{N}s}\right)

(parallel branches KPK_P, KI/sK_I/s and KDs/(1+TDNs)K_D s/(1+\frac{T_D}{N}s) summed into uu). Imposing the crossover pulsation ωgc\omega_{gc} and the phase margin φm\varphi_m on the Nyquist plot of the loop, the slide gives the tuning formulas

KP=ΔKcos⁡Δφ,TD=tan⁡Δφ+tan⁡2Δφ+4/α2 ωgc,TI=α TDK_P = \Delta K\cos\Delta\varphi,\qquad T_D = \frac{\tan\Delta\varphi + \sqrt{\tan^2\Delta\varphi + 4/\alpha}}{2\,\omega_{gc}},\qquad T_I = \alpha\, T_D

where α\alpha is the ratio TI/TDT_I/T_D (a design choice). The slide does not define ΔK\Delta K and Δφ\Delta\varphi in words; they appear in the figure as the gain and phase correction at ω=ωgc\omega=\omega_{gc}. See The Root LocusThe positive root locus is the set of closed-loop poles of the loop with a proportional controller C(s)=K, K>=0, as K varies; it consists of n branches that start at the poles of G(s) and end at its zeros or at infinity along asymptotes, and four sketching rules (real-axis rule, asymptotes with centroid, multiple points) let one draw it and read off stability and transient requirements.The Root Locus → and The Feedback Control Scheme and RequirementsThe basic control scheme feeds the plant G(s) with the output of a controller C(s) acting on the tracking error e = r - y, giving the closed-loop transfer function W(s) = C(s)G(s) / (1 + C(s)G(s)); the requirement y close to r splits into steady-state conditions (small error for some references, disturbances, model uncertainty) and transient conditions on rise time, settling time and overshoot, which become a region of the complex plane where the poles of W(s) must lie.The Feedback Control Scheme and Requirements → for the underlying theory.

Simulation-based validation. The Simulink model is a loop made of: a Repeating Sequence block (reference wl_ref), a sum producing e [rpm], the Speed controller (output u [V]), and the yellow subsystem "DC Servomotor - numerical model" containing, in series, DAC -> Voltage driver -> DC motor + gearbox (outputs thl [deg] and wl [rpm]) and the Encoder (thl [pulses] to thl [deg]). The measured angle goes through a gain pulse2deg and a Speed filter (th [deg] -> w [rpm]), giving wl_meas that closes the loop.

Results shown (step of about 450 rpm applied at t=3t=3 s): the load speed ωl\omega_l rises to the reference with an overshoot; the command uu stays saturated at 10 V for the first part of the transient; the integrator part uintu_{int} climbs to about 15 V, beyond the saturation limit, and comes back down only slowly (until about t=3.4t=3.4 s) - this is the integrator windup problem addressed next.

4. Design improvements

Goal: add two improvements to the controller.

  • Integrator anti-windup (AWU).
  • Command feedforward (FF) compensation.

The Simulink controller subsystem on the slide has three inputs: al_ref [rpm/s] (acceleration reference), wl_ref [rpm] (speed reference) and e [rpm] (error), each converted to rad/s by a gain, and one output u [V]. Blocks:

  • feedback part: a P gain and an I gain + Integrator (1/s1/s) acting on the error, summed;
  • feedforward part: FF comp (inertia) from the acceleration reference; FF comp (viscous fric) and FF comp (Coulomb fric) (the latter after a Sign block) from the speed reference, summed into FF comp (friction); FF comp (BEMF) from the speed reference;
  • all contributions are summed and pass through the Controller saturation block; the difference between the saturated and the unsaturated command is fed back through an AWU gain to the integrator input.

Validation: with AWU the integrator state uintu_{int} peaks at about 12 V instead of about 15 V and returns to its steady value much sooner, so the overshoot of ωl\omega_l is smaller than without AWU. With feedforward and a trapezoidal speed reference between about +450+450 and −450-450 rpm, the tracking error ee stays around ±20\pm 20 rpm without FF and becomes almost zero with FF, with a similar command uu (limited to ±10\pm 10 V). More on these topics: Speed PI Control Improvements for a DC ServomotorLab activity 4 improves the speed PI control of a DC servomotor in two ways: feedforward compensation of the reference (inertia, friction and back-EMF terms computed from the motor model and a known speed profile) and anti-windup of the integrator when the actuator saturates.Speed PI Control Improvements for a DC Servomotor →.

5. Discrete-time (DT) control design

Goal: digital control design and validation:

  • analysis of sampled-data systems;
  • discretization methods;
  • design by emulation (EMU) versus direct digital design (DDD).

The digital loop on the slide: the digital processing unit contains the reference r[k]r[k], the error e[k]e[k], the digital control block (output u[k]u[k]), and the analog-to-digital conversion of the plant output y[k]y[k]; the digital-to-analog conversion produces the piecewise-constant u(t)u(t) that drives the plant, whose output is y(t)y(t). The small plots show quantised samples (3-bit codes 001 ... 101) in the digital part and a staircase signal after the DAC. See Digital Control SystemsA digital control system replaces the analog controller with a processing unit interfaced to the plant through an A/D converter (sampling plus quantization) and a D/A converter (zero-order hold), and neglecting quantization it becomes a sampled-data system that can be designed by emulation or directly in discrete time.Digital Control Systems →, Sampling and the Sampling TheoremSampling multiplies a continuous-time signal by a pulse train, which replicates its spectrum every omega_s; if the signal is band-limited with maximum angular frequency omega_M and omega_s exceeds 2 omega_M, an ideal low-pass filter recovers it exactly (Shannon theorem and sinc interpolation formula).Sampling and the Sampling Theorem → and Aliasing and Anti-Aliasing FiltersAliasing is the overlap of spectral replicas that occurs when the band-limited or Nyquist assumptions of the sampling theorem fail; an anti-aliasing low-pass filter with cut-off omega_s/2 applied before sampling removes it at the price of losing the high frequencies; two worked exercises.Aliasing and Anti-Aliasing Filters →.

Validation of emulation (EMU): the continuous-time PI is discretized with forward Euler, backward Euler and trapezoidal (Tustin) methods and simulated for the sampling times Ts=4T_s = 4, 1010, 2020 ms (reference step of 250 rpm). Observations on the plots: with Ts=4T_s = 4 ms all three methods behave well; as TsT_s grows forward Euler degrades (large overshoot at 10 ms and strongly oscillating response at 20 ms), while backward Euler and Tustin remain well damped even at 20 ms.

Validation of direct digital design (DDD): the controller is designed directly in discrete time with the Control System Designer (root locus editor, tunable block named C with sample time 0.02 s; the preview shows a compensator with gain 0.22857 and a zero at 0.3, with a pole at 1 that is only partly visible). With Ts=20T_s = 20 ms the step response of ωl\omega_l is well damped and settles quickly.

6. From simulation to real-time execution: Rapid Control Prototyping

The course adopts Rapid Control Prototyping (RCP) for a seamless transition from numerical simulation to experimental validation. The same MATLAB/Simulink environment is used for system modeling, controller design (Control System Toolbox / SISO Tool), simulation-based validation and real-time experimental implementation.

RCP methodology:

  1. develop and validate the controller in Simulink;
  2. convert the model automatically into C code;
  3. compile and load the executable into memory;
  4. execute it under a real-time kernel;
  5. interface with the physical DC motor setup via a DAQ board.

Steps 2-5 are handled automatically by Simulink Coder (automatic code generation and compilation) and Simulink Desktop Real-Time (real-time execution with hardware interaction). See Experimental Setup and Simulink Desktop Real-TimeDescription of the laboratory setup (Quanser SRV-02 DC servomotor unit with voltage driver and encoder, NI data acquisition board with BNC-2110 terminal board, PC workstation) and of the Simulink Desktop Real-Time toolbox with its normal, accelerator and external execution modes.Experimental Setup and Simulink Desktop Real-Time →.

The two Simulink models differ only in the plant block. In the simulation model the block is "DC Servomotor - numerical model" (DAC, voltage driver, motor + gearbox, encoder). In the real-time implementation it is "DC Servomotor - interface with experimental setup": an Analog Output block and an Analog Input block, and an Encoder Input block, all for the National Instruments PCI-6221 data acquisition board, plus a Current sense subsystem that subtracts the two measured voltages uRs1 and uRs2 across the shunt resistor and multiplies by 1/Rshunt to obtain the armature current ia. The controller, speed filter and pulse2deg blocks are the same.

RCP bridges the gap between theory and hardware: same environment for simulation and experiment, reduced implementation gap, faster design iterations, immediate experimental validation, and a real industrial methodology.

Versione ripasso

Structure: 6 CFU = 20 h lectures (2.50 CFU) + 18 h computer lab (2.25) + 10 h experimental lab (1.25). Lectures: 5 review, 2 on digital control, 3 preparatory. Computer lab (Mondays): 3 introductory sessions, 6 preparatory activities. Experimental lab (Wednesdays, 12 benches, two shifts): 1 introduction, 4 mandatory activities, 1 optional catch-up. Groups of at most 4 for the experimental lab only; labs start at end of April.

Access: departmental account for the PCs; safety courses (General Training 4 h, High Risk 12 h) for the experimental lab; upload one PDF of certificates on Moodle. Email subject: [CSLAB 2025-26].

Exam: group report on one lab activity = 1/3; individual numerical lab test = 2/3 (minimum 18/30, report must be submitted); partial grades valid one academic year.

Prerequisites: calculus, physics, The Laplace Transform and Transfer FunctionsThe unilateral Laplace transform turns a linear constant-coefficient ODE into an algebraic equation Y(s) = C(s)/A(s) + B(s)/A(s) U(s), whose second term defines the rational transfer function H(s) = B(s)/A(s).The Laplace Transform and Transfer Functions → and Z-transform, Bode/Nyquist, Stability of Dynamical SystemsFor an LTI system the response to a perturbation of an equilibrium does not depend on the equilibrium or on the perturbation amplitude, so stability reduces to the free evolution being bounded (stable) or vanishing (asymptotically stable), decided by the roots of the characteristic polynomial, and is related to BIBO stability.Stability of Dynamical Systems →, continuous-time controller design.

Workflow (iterative): modeling -> design -> implement -> test -> refine. Steps: system modeling, CT control design, digital implementation, simulation-based validation, real-time testing.

DC servomotor case study

  • Model: Lai˙a+Reqia=udrv−keωmL_a \dot i_a + R_{eq} i_a = u_{drv} - k_e\omega_m; Jeqω˙m+Beqωm=ktia−τd/NJ_{eq}\dot\omega_m + B_{eq}\omega_m = k_t i_a - \tau_d/N; Tdrvu˙drv+udrv=kdrvuT_{drv}\dot u_{drv} + u_{drv} = k_{drv}u; with Jeq=Jm+Jl/N2J_{eq} = J_m + J_l/N^2, Beq=Bm+Bl/N2B_{eq} = B_m + B_l/N^2, Req=Ra+RsR_{eq}=R_a+R_s.
  • Reduced: P(s)≈kmTms+1⋅1NsP(s)\approx \dfrac{k_m}{T_m s+1}\cdot\dfrac{1}{Ns} (electrical and driver dynamics neglected).
  • Parameter estimation: friction τf′=Beqωm+τsfNsign(ωm)\tau_f' = B_{eq}\omega_m + \frac{\tau_{sf}}{N}\text{sign}(\omega_m) by LS fit of two lines; inertia from τ^i=τm−τ^f′=J^eqω˙m\hat\tau_i = \tau_m-\hat\tau_f' = \hat J_{eq}\dot\omega_m with a triangular speed test.
  • CT design: specs ts,5%≤0.15t_{s,5\%}\le 0.15 s, Mp≤10%M_p\le 10\%, zero steady-state error to step reference and constant torque disturbance, PID C(s)=KP(1+1TIs+TDs1+TDNs)C(s)=K_P(1+\frac{1}{T_Is}+\frac{T_Ds}{1+\frac{T_D}{N}s}); Bode tuning KP=ΔKcos⁡ΔφK_P=\Delta K\cos\Delta\varphi, TD=tan⁡Δφ+tan⁡2Δφ+4/α2ωgcT_D=\dfrac{\tan\Delta\varphi+\sqrt{\tan^2\Delta\varphi+4/\alpha}}{2\omega_{gc}}, TI=αTDT_I=\alpha T_D.
  • Improvements: anti-windup (feedback of saturation difference through AWU gain) reduces overshoot; feedforward (inertia, friction, back-EMF) removes tracking error.
  • DT design: EMU (forward Euler, backward Euler, Tustin) vs DDD. Forward Euler worsens with TsT_s (bad at 20 ms), backward Euler and Tustin stay good.
  • RCP: Simulink -> C code (Simulink Coder) -> real-time kernel (Simulink Desktop Real-Time) -> DAQ (NI PCI-6221). Only the plant block changes between simulation and experiment.

Typical mistake: forgetting that the saturated actuator makes the integrator wind up; anti-windup is needed.

Crediti e ore:

Attività CFU Ore
Lezioni in aula (5 di ripasso di Controlli Automatici, 2 di controllo digitale, 3 preparatorie) 2.50 20
Laboratorio computer (3 introduttive, 6 preparatorie) 2.25 18
Laboratorio sperimentale (1 introduttiva, 4 obbligatorie, 1 di recupero facoltativa) 1.25 10
Totale 6 48

Lezioni di lunedì e mercoledì 08:30-10:30. Gruppi di al massimo 4 studenti solo per il laboratorio sperimentale; le attività di laboratorio iniziano a fine aprile.

Accesso: account dipartimentale per le postazioni; corsi sulla sicurezza (Formazione generale 4 h, Alto rischio 12 h) per il laboratorio sperimentale; caricare un solo PDF con gli attestati su Moodle. Oggetto delle email: [CSLAB 2025-26].

Esame: relazione di gruppo su una attività di laboratorio = 1/3; prova individuale in laboratorio numerico = 2/3, con minimo 18/30. Il voto finale si registra solo con relazione consegnata; i voti parziali valgono un anno accademico.

Criteri: formalizzare un problema applicato, modellare un sistema dinamico, analizzarlo e simularlo, progettare il regolatore e valutarne le prestazioni, scrivere una relazione tecnica, comprendere la teoria.

Modello ridotto del servomotore:

  • Req=Ra+RsR_{eq}=R_a+R_s, Jeq=Jm+Jl/N2J_{eq}=J_m+J_l/N^2, Beq=Bm+Bl/N2B_{eq}=B_m+B_l/N^2.
  • Trascurando LasL_a s e Tdrvs+1T_{drv}s+1 (dinamiche veloci): km=kdrvktReqBeq+ktkek_m = \dfrac{k_{drv}k_t}{R_{eq}B_{eq}+k_tk_e}, Tm=ReqJeqReqBeq+ktkeT_m = \dfrac{R_{eq}J_{eq}}{R_{eq}B_{eq}+k_tk_e}.
  • Quindi P(s)≈kmTms+1⋅1NsP(s)\approx \dfrac{k_m}{T_m s+1}\cdot\dfrac{1}{Ns}.

Stima dei parametri:

  1. Attrito: τf′=Beqωm+τsfN sign(ωm)\tau_f' = B_{eq}\omega_m + \frac{\tau_{sf}}{N}\,\text{sign}(\omega_m). Un fit a minimi quadrati delle due rette (velocità positive e negative) dà la pendenza BeqB_{eq} e l'intercetta τsf/N\tau_{sf}/N (circa 0.5×10−30.5\times 10^{-3} Nm).
  2. Inerzia: τ^i=τm−τ^f′=J^eq dωmdt\hat\tau_i = \tau_m - \hat\tau_f' = \hat J_{eq}\,\dfrac{d\omega_m}{dt}, con accelerazione diversa da zero. Il test usa un profilo triangolare di velocità (da 0 a circa 6 krpm, periodo 2 s); il rapporto tra τ^i\hat\tau_i e l'accelerazione dà J^eq\hat J_{eq}.

Specifiche CT: ts,5%≤0.15t_{s,5\%}\le 0.15 s, Mp≤10%M_p\le 10\%, errore nullo al gradino di posizione e alla coppia costante, regolatore PID.

Simulazione: gradino di circa 450 rpm a t=3t=3 s. Senza miglioramenti uu resta saturo a 10 V nella prima parte, l'integratore sale a circa 15 V e torna lentamente (fino a circa 3.4 s): è il windup.

  • Con anti-windup (AWU): l'integratore arriva a circa 12 V e torna prima; overshoot minore.
  • Con feedforward e riferimento trapezoidale tra ±450\pm 450 rpm: errore ee di circa ±20\pm 20 rpm senza FF, quasi nullo con FF; uu limitato a ±10\pm 10 V.

Discreto (EMU): PI continuo discretizzato con Eulero in avanti, Eulero indietro e Tustin, con Ts=4T_s = 4, 1010, 2020 ms. A 4 ms tutti vanno bene; Eulero in avanti peggiora (overshoot a 10 ms, oscillazioni a 20 ms), Eulero indietro e Tustin restano smorzati anche a 20 ms.

Discreto (DDD): progetto diretto in tempo discreto con Ts=20T_s = 20 ms: risposta ben smorzata e rapida.

Corrente d'armatura sul banco reale: ia=(uRs1−uRs2)/Rshunti_a = (u_{Rs1} - u_{Rs2})/R_{shunt} (tensioni misurate ai capi della resistenza di shunt).

Modello di simulazione e modello reale: nel modello numerico il blocco impianto contiene DAC, driver, motore con riduttore ed encoder; nel modello reale lo stesso blocco usa Analog Output, Analog Input e Encoder Input per la scheda NI PCI-6221. Regolatore, filtro di velocità e pulse2deg restano uguali.

Errori tipici:

  • Dimenticare che l'inerzia del carico entra divisa per N2N^2 in JeqJ_{eq}.
  • Usare Eulero in avanti con TsT_s grande senza verificare lo smorzamento.
  • Non prevedere l'anti-windup: con la saturazione dell'attuatore l'integratore si carica oltre il limite.

Teoria collegata