reorganized
git-svn-id: http://moon:8086/svn/projects/HendiControl@4 fda53097-d464-4ada-af97-ba876c37ca34
This commit is contained in:
@@ -0,0 +1,15 @@
|
|||||||
|
function [theta, s] = mass(si, dt, C, M, L, P, Td, dTheta)
|
||||||
|
s = si;
|
||||||
|
if ~isstruct(si)
|
||||||
|
alpha = 1.0;
|
||||||
|
if Td > 0
|
||||||
|
alpha = dt/Td;
|
||||||
|
end
|
||||||
|
s = struct('e', 0, 'a', alpha, 'x', 0, 'gain', 0.8);
|
||||||
|
end
|
||||||
|
|
||||||
|
s.e = s.e * (1-((L*(0+dTheta))*dt)/(M*C));
|
||||||
|
s.x = (1-s.a)*s.x + s.gain*s.a*P*dt;
|
||||||
|
s.e = s.e + s.x;
|
||||||
|
theta = s.e/(M*C);
|
||||||
|
endfunction
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
function [theta, s] = mass_eval()
|
||||||
|
|
||||||
|
s_mass = 0;
|
||||||
|
t_amb = 20;
|
||||||
|
dt = 1.0;
|
||||||
|
Td = 10;
|
||||||
|
N = 100;
|
||||||
|
|
||||||
|
P_max = 3000;
|
||||||
|
P = 1000;
|
||||||
|
theta = t_amb;
|
||||||
|
|
||||||
|
|
||||||
|
for n=1:N,
|
||||||
|
duty = mod(n*dt/Td*P_max, P_max);
|
||||||
|
heat = (duty < P);
|
||||||
|
Pp = P_max * heat;
|
||||||
|
[theta, s_mass] = mass(s_mass, dt, 4190, 20, 0.1, Pp, 10, theta-t_amb);
|
||||||
|
theta_(n) = theta;
|
||||||
|
Pp_(n) = Pp;
|
||||||
|
end
|
||||||
|
|
||||||
|
t = (0:N-1)*dt;
|
||||||
|
|
||||||
|
subplot (2,1,1)
|
||||||
|
plot(t, theta_); grid;
|
||||||
|
subplot (2,1,2)
|
||||||
|
plot(t, Pp_); grid;
|
||||||
|
|
||||||
|
endfunction
|
||||||
Reference in New Issue
Block a user