products/sources/formale Sprachen/C/Lyx/images image not shown  

Quellcode-Bibliothek

© Kompilation durch diese Firma

[Weder Korrektheit noch Funktionsfähigkeit der Software werden zugesichert.]

Datei: .project   Sprache: Unknown

class PD is subclass of DTControl

instance variables

-- design parameters
protected k: real;
protected tauD: real;
protected beta: real;

-- variables
protected uD: real;
protected prev_err: real

operations

-- constructor for PD
public PD: real * real * real ==> PD
PD(k_, tauD_, beta_) ==
(
    k := k_;
 tauD := tauD_;
 beta := beta_;
 -- initial values
    uD := 0.0;
 prev_err := 0.0 
);

-- constructor for PD
public PD: real * real ==> PD
PD(k_, tauD_) ==
 PD(k_, tauD_, DEF_BETA);
    
-- default constructor for PD
public PD: () ==> PD
PD() ==
    PD(DEF_K, DEF_TAUD, DEF_BETA);

-- calculates output, based on the error
public Output: real ==> real
Output(err) == 
(
 dcl factor: real :=  1 / (sampletime + tauD * beta);
 uD := factor * (tauD * uD * beta + tauD * k * (err - prev_err) + sampletime * k * err);
 prev_err := err;
 return uD
);

values

-- defaults
DEF_K: real = 0.2;
DEF_TAUD: real = 1.0;
DEF_BETA: real = 0.1;

end PD

[ Verzeichnis aufwärts0.0unsichere Verbindung  Übersetzung europäischer Sprachen durch Browser  ]