Первый запуск в реале. Всякие фиксы
Тесты происходили на двух двигателях и трансе через ЛАТР
This commit is contained in:
@@ -242,57 +242,102 @@ function update_plots(alpha_deg, alpha_rad, t, f, U_phase, U_line, angle_text)
|
||||
thyristor_state(6, i) = 1;
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
%% 2. Определяем, когда тиристоры ФИЗИЧЕСКИ открыты
|
||||
% В схеме без нейтрали тиристоры открываются парами (фаза-фаза)
|
||||
|
||||
% VS1+ (A+): открыт, если есть импульс и положительная полуволна фазы A
|
||||
if thyristor_state(1, i) == 1 && (theta_a_mod >= 0 && theta_a_mod <= pi) && (Ua(i) > Ub(i) && Ua(i) > Uc(i))
|
||||
% Пары тиристоров для линейных напряжений:
|
||||
% Uab: VS1+ (A+) и VS4- (B-)
|
||||
% Uba: VS3+ (B+) и VS2- (A-)
|
||||
% Ubc: VS3+ (B+) и VS6- (C-)
|
||||
% Ucb: VS5+ (C+) и VS4- (B-)
|
||||
% Uca: VS5+ (C+) и VS2- (A-)
|
||||
% Uac: VS1+ (A+) и VS6- (C-)
|
||||
|
||||
% Проверяем каждую пару
|
||||
% Пара A+ и B- (Uab)
|
||||
if thyristor_state(1, i) == 1 && thyristor_state(4, i) == 1 && Ua(i) > Ub(i)
|
||||
thyristor_conducting(1, i) = 1;
|
||||
end
|
||||
|
||||
% VS1- (A-): открыт, если есть импульс и отрицательная полуволна фазы A
|
||||
if thyristor_state(2, i) == 1 && (theta_a_mod >= pi && theta_a_mod <= 2*pi) && (Ua(i) < Ub(i) && Ua(i) < Uc(i))
|
||||
thyristor_conducting(2, i) = 1;
|
||||
end
|
||||
|
||||
% VS2+ (B+): открыт, если есть импульс и положительная полуволна фазы B
|
||||
if thyristor_state(3, i) == 1 && (theta_b_mod >= 0 && theta_b_mod <= pi) && (Ub(i) > Ua(i) && Ub(i) > Uc(i))
|
||||
thyristor_conducting(3, i) = 1;
|
||||
end
|
||||
|
||||
% VS2- (B-): открыт, если есть импульс и отрицательная полуволна фазы B
|
||||
if thyristor_state(4, i) == 1 && (theta_b_mod >= pi && theta_b_mod <= 2*pi) && (Ub(i) < Ua(i) && Ub(i) < Uc(i))
|
||||
thyristor_conducting(4, i) = 1;
|
||||
elseif i > 1 && thyristor_conducting(1, i-1) == 1 && thyristor_conducting(4, i-1) == 1
|
||||
if Ua(i) > Ub(i)
|
||||
thyristor_conducting(1, i) = 1;
|
||||
thyristor_conducting(4, i) = 1;
|
||||
end
|
||||
end
|
||||
|
||||
% VS3+ (C+): открыт, если есть импульс и положительная полуволна фазы C
|
||||
if thyristor_state(5, i) == 1 && (theta_c_mod >= 0 && theta_c_mod <= pi) && (Uc(i) > Ub(i) && Uc(i) > Ua(i))
|
||||
thyristor_conducting(5, i) = 1;
|
||||
% Пара B+ и A- (Uba)
|
||||
if thyristor_state(3, i) == 1 && thyristor_state(2, i) == 1 && Ub(i) > Ua(i)
|
||||
thyristor_conducting(3, i) = 1;
|
||||
thyristor_conducting(2, i) = 1;
|
||||
elseif i > 1 && thyristor_conducting(3, i-1) == 1 && thyristor_conducting(2, i-1) == 1
|
||||
if Ub(i) > Ua(i)
|
||||
thyristor_conducting(3, i) = 1;
|
||||
thyristor_conducting(2, i) = 1;
|
||||
end
|
||||
end
|
||||
|
||||
% VS3- (C-): открыт, если есть импульс и отрицательная полуволна фазы C
|
||||
if thyristor_state(6, i) == 1 && (theta_c_mod >= pi && theta_c_mod <= 2*pi) && (Uc(i) < Ub(i) && Uc(i) < Ua(i))
|
||||
% Пара B+ и C- (Ubc)
|
||||
if thyristor_state(3, i) == 1 && thyristor_state(6, i) == 1 && Ub(i) > Uc(i)
|
||||
thyristor_conducting(3, i) = 1;
|
||||
thyristor_conducting(6, i) = 1;
|
||||
elseif i > 1 && thyristor_conducting(3, i-1) == 1 && thyristor_conducting(6, i-1) == 1
|
||||
if Ub(i) > Uc(i)
|
||||
thyristor_conducting(3, i) = 1;
|
||||
thyristor_conducting(6, i) = 1;
|
||||
end
|
||||
end
|
||||
|
||||
%% 3. Расчет выходных напряжений
|
||||
% Пара C+ и B- (Ucb)
|
||||
if thyristor_state(5, i) == 1 && thyristor_state(4, i) == 1 && Uc(i) > Ub(i)
|
||||
thyristor_conducting(5, i) = 1;
|
||||
thyristor_conducting(4, i) = 1;
|
||||
elseif i > 1 && thyristor_conducting(5, i-1) == 1 && thyristor_conducting(4, i-1) == 1
|
||||
if Uc(i) > Ub(i)
|
||||
thyristor_conducting(5, i) = 1;
|
||||
thyristor_conducting(4, i) = 1;
|
||||
end
|
||||
end
|
||||
|
||||
% Пара C+ и A- (Uca)
|
||||
if thyristor_state(5, i) == 1 && thyristor_state(2, i) == 1 && Uc(i) > Ua(i)
|
||||
thyristor_conducting(5, i) = 1;
|
||||
thyristor_conducting(2, i) = 1;
|
||||
elseif i > 1 && thyristor_conducting(5, i-1) == 1 && thyristor_conducting(2, i-1) == 1
|
||||
if Uc(i) > Ua(i)
|
||||
thyristor_conducting(5, i) = 1;
|
||||
thyristor_conducting(2, i) = 1;
|
||||
end
|
||||
end
|
||||
|
||||
% Пара A+ и C- (Uac)
|
||||
if thyristor_state(1, i) == 1 && thyristor_state(6, i) == 1 && Ua(i) > Uc(i)
|
||||
thyristor_conducting(1, i) = 1;
|
||||
thyristor_conducting(6, i) = 1;
|
||||
elseif i > 1 && thyristor_conducting(1, i-1) == 1 && thyristor_conducting(6, i-1) == 1
|
||||
if Ua(i) > Uc(i)
|
||||
thyristor_conducting(1, i) = 1;
|
||||
thyristor_conducting(6, i) = 1;
|
||||
end
|
||||
end
|
||||
|
||||
%% 3. Расчет выходных напряжений
|
||||
% Фазные выходные напряжения
|
||||
Ua_out = 0;
|
||||
if thyristor_conducting(1, i) || thyristor_conducting(2, i)
|
||||
Ua_out = Ua(i);
|
||||
end
|
||||
|
||||
|
||||
Ub_out = 0;
|
||||
if thyristor_conducting(3, i) || thyristor_conducting(4, i)
|
||||
Ub_out = Ub(i);
|
||||
end
|
||||
|
||||
|
||||
Uc_out = 0;
|
||||
if thyristor_conducting(5, i) || thyristor_conducting(6, i)
|
||||
Uc_out = Uc(i);
|
||||
end
|
||||
|
||||
|
||||
% Линейные выходные напряжения
|
||||
Uab_out(i) = Ua_out - Ub_out;
|
||||
Ubc_out(i) = Ub_out - Uc_out;
|
||||
@@ -313,7 +358,7 @@ function update_plots(alpha_deg, alpha_rad, t, f, U_phase, U_line, angle_text)
|
||||
title('Входные напряжения (сплошные - фазные, пунктир - линейные)');
|
||||
xlabel('Время, с');
|
||||
ylabel('Напряжение, В');
|
||||
legend('Location', 'best');
|
||||
legend('Location', 'west');
|
||||
xlim([0, max(t)]);
|
||||
ylim([-700, 700]);
|
||||
|
||||
@@ -327,7 +372,7 @@ function update_plots(alpha_deg, alpha_rad, t, f, U_phase, U_line, angle_text)
|
||||
title(sprintf('Выходные линейные напряжения (α = %d°)', alpha_deg));
|
||||
xlabel('Время, с');
|
||||
ylabel('Напряжение, В');
|
||||
legend('Location', 'best');
|
||||
legend('Location', 'west');
|
||||
xlim([0, max(t)]);
|
||||
ylim([-700, 700]);
|
||||
|
||||
@@ -338,8 +383,13 @@ function update_plots(alpha_deg, alpha_rad, t, f, U_phase, U_line, angle_text)
|
||||
% Цвета для тиристоров
|
||||
colors = {'r', 'r', 'g', 'g', 'b', 'b'};
|
||||
line_styles = {'-', '--', '-', '--', '-', '--'};
|
||||
names = {'VS1+', 'VS1-', 'VS2+', 'VS2-', 'VS3+', 'VS3-'};
|
||||
% Измененный порядок отрисовки: VS1+, VS1-, VS2+, VS2-, VS3+, VS3-
|
||||
order = [6, 5, 4, 3, 2, 1];
|
||||
|
||||
for k = 1:6
|
||||
for idx = 1:6
|
||||
k = order(idx); % Берем тиристор в нужном порядке
|
||||
|
||||
% Находим интервалы, где подан управляющий импульс
|
||||
state = thyristor_state(k, :);
|
||||
diff_state = diff([0, state, 0]);
|
||||
@@ -348,7 +398,19 @@ function update_plots(alpha_deg, alpha_rad, t, f, U_phase, U_line, angle_text)
|
||||
|
||||
% Рисуем горизонтальные линии для каждого интервала
|
||||
for m = 1:length(start_idx)
|
||||
plot(t(start_idx(m):end_idx(m)), k*ones(1, length(start_idx(m):end_idx(m))), ...
|
||||
plot(t(start_idx(m):end_idx(m)), idx*ones(1, length(start_idx(m):end_idx(m))), ...
|
||||
'Color', colors{k}, 'LineStyle', line_styles{k}, 'LineWidth', 1);
|
||||
end
|
||||
|
||||
% Находим интервалы, где тиристор открыт
|
||||
state = thyristor_conducting(k, :);
|
||||
diff_state = diff([0, state, 0]);
|
||||
start_idx = find(diff_state == 1);
|
||||
end_idx = find(diff_state == -1) - 1;
|
||||
|
||||
% Рисуем горизонтальные линии для каждого интервала
|
||||
for m = 1:length(start_idx)
|
||||
plot(t(start_idx(m):end_idx(m)), idx*ones(1, length(start_idx(m):end_idx(m))), ...
|
||||
'Color', colors{k}, 'LineStyle', line_styles{k}, 'LineWidth', 2);
|
||||
end
|
||||
end
|
||||
@@ -358,15 +420,12 @@ function update_plots(alpha_deg, alpha_rad, t, f, U_phase, U_line, angle_text)
|
||||
ylabel('Тиристор');
|
||||
ylim([0.5, 6.5]);
|
||||
yticks(1:6);
|
||||
yticklabels({'VS1+', 'VS1-', 'VS2+', 'VS2-', 'VS3+', 'VS3-'});
|
||||
yticklabels(names(order));
|
||||
xlim([0, max(t)]);
|
||||
|
||||
% Обновление текста с текущим углом
|
||||
set(angle_text, 'String', sprintf('Угол α = %d°', alpha_deg));
|
||||
|
||||
% Добавление пояснений к тиристорам
|
||||
legend({'Фаза A (+)', 'Фаза A (-)', 'Фаза B (+)', 'Фаза B (-)', ...
|
||||
'Фаза C (+)', 'Фаза C (-)'}, 'Location', 'best');
|
||||
end
|
||||
|
||||
%% Функция обратного вызова для ползунка
|
||||
|
||||
Reference in New Issue
Block a user