リレー回路のシミュレーションについて

9 views (last 30 days)
洸太
洸太 on 12 Oct 2023
Commented: Dyuman Joshi on 13 Oct 2023
リレー回路のシミュレーションで、困っています。
リレーが動作電圧を超えたら動作するようにif文を用いてプログラムをかいてみたのですが、リレーの特性上1度動作電圧を超えると電圧が0になるまで動作する性質があり、どのようなプログラムを書けばいいのか分からずにいます。
分かる方教えていただけますと幸いです。

Accepted Answer

Atsushi Ueno
Atsushi Ueno on 12 Oct 2023
ヒステリシス動作を if 文で表すと例えば下記の様になります。
tm = 0:0.01:3; % 時刻[s](適当に周波数1[Hz]で3秒間)
vt = sin(2 * pi * tm); % 電圧[V](最大電圧を1[V]と仮定)
rl = zeros(size(tm)); % リレーのON/OFF状態[-]
for k = 2:length(tm)
if vt(k) >= 0.8 % 動作電圧(最大電圧の80[%])以上ならリレーをONにする
rl(k) = 1;
elseif vt(k) <= 0 % 復帰電圧(最大電圧の0[%])以下ならリレーをOFFにする
rl(k) = 0;
else % 上記の間ならリレーの状態を保持する
rl(k) = rl(k-1);
end
end
plot(tm,vt,tm,rl,'LineWidth',3);
legend('電圧','リレーON/OFF','Location','southeast');

More Answers (1)

Atsushi Ueno
Atsushi Ueno on 12 Oct 2023
Simulinkならこうです。色を付けた自作のロジックと Relay ブロックを並べました。双方の出力は一致します。
  2 Comments
洸太
洸太 on 13 Oct 2023
ありがとうございます。
参考になりました。
Dyuman Joshi
Dyuman Joshi on 13 Oct 2023
Hello @洸太 , if this answer solved your problem, please consider accepting the answer.
Accepting the answer indicates that your problem has been solved (which can be helpful to other people in future) and it awards the volunteer with reputation points for helping you.
You can accept only 1 answer for a question, but you can vote for as many answers as you want. Voting an answer also provides reputation points.

Sign in to comment.

Categories

Find more on プログラムによるモデル編集 in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!