Using Timer to switch off a switch in Simulink

Hi Everyone,
Hope everyone is surviving the panademic ok. I need some assitance.
I'm using Simulink for modelling and I require a Matlab function to switch on/off a switch. When the switch is 1 its open and vice versa. For my model, when my voltage drops below 0.5 (input to my Matlab function) I want to disconnect my system (switch =0, output of my function) if the voltage drop lasts longer than 2s. I'm trying to implement this using a timer object. Is this preferred method to do this? So far, I'm getting the following error with my code>? "The 'timer' class does not support code generation".

 채택된 답변

Fangjun Jiang
Fangjun Jiang 2020년 3월 16일

1 개 추천

No need or it's hard to do it using MATLAB Function block. Hope this answer gives you a clue.

댓글 수: 1

Hi Fangjun,
That worked, thank you !! I had to do some changing around.
Have an enjoyable day!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Arduino Hardware에 대해 자세히 알아보기

제품

질문:

2020년 3월 16일

댓글:

2020년 3월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by