Embedded System Control - 22028404 - HANDITO

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Embedded System Control

22028404
Handito Ragil
Digital Controller - Current
C Block Code Simulation Schematic

#define Kpi 0.031560 // P


#define Kii 0.937 // I

double Vc, IL, Vref, duty, Verr, Ierr, Iref;


static double Iref_old=0.0, duty_old=0.0, Ierr_old=0.0;
Vc = in[0];
IL = in[1];
Simulation Waveform
if (t < 0.5) Iref =11;
else Iref = 15; Digital controller
IL Iref

Ierr = Iref - IL; 20

duty = duty_old + Kpi*Ierr-Kpi*Kii*Ierr_old; 𝟎.𝟎𝟑𝟏𝟓𝟔𝟎 𝒛−𝟎.𝟗𝟑𝟕 15

C = Gci (z) =
duty_old=duty; 𝒛−𝟏
Ierr_old=Ierr; 10

out[0]=duty; 5

out[1]=Vref;
0
out[2]=Iref;
0 0.2 0.4 0.6 0.8 1
Time (s)
Digital Controller - Voltage
C Block Code Simulation Schematic
#define Kpv 0.000020972 // P
#define Kiv 0.907 // I

double Vc, IL, Vref, duty, Verr, IL_err, IL_ref;


static double duty_old=0.0, Verr_old=0.0;
Vc = in[0];
IL = in[1];

if (t < 0.5) Vref =140;


Simulation Waveform
else Vref = 170; Digital controller Vc Vref

Verr = Vref - Vc; 180

duty= duty_old+Kpv*Verr-Kpv*Kiv*Verr_old; 𝟎.𝟎𝟎𝟎𝟎𝟐𝟎𝟗𝟕𝟐 𝒛−𝟎.𝟗𝟎𝟕 160

duty_old=duty;
C = Gcv (z) =
𝒛−𝟏 140

Verr_old=Verr;
120

out[0]=duty; 100

out[1]=Vref; 80
out[2]=IL_ref;
0 0.2 0.4 0.6 0.8 1
Time (s)

You might also like