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

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

採用された回答

Atsushi Ueno
Atsushi Ueno 2023 年 10 月 12 日
ヒステリシス動作を 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');

その他の回答 (1 件)

Atsushi Ueno
Atsushi Ueno 2023 年 10 月 12 日
Simulinkならこうです。色を付けた自作のロジックと Relay ブロックを並べました。双方の出力は一致します。
  2 件のコメント
洸太
洸太 2023 年 10 月 13 日
ありがとうございます。
参考になりました。
Dyuman Joshi
Dyuman Joshi 2023 年 10 月 13 日
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.

サインインしてコメントする。

カテゴリ

Help Center および File Exchangeプログラムによるモデル編集 についてさらに検索

Community Treasure Hunt

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

Start Hunting!