Clear Filters
Clear Filters

How to update value when different value is 0 in simulink?

37 views (last 30 days)
Hi everyone,
I am creating a Simulink model to control an asynchronous motor with a current source inverter. I want to simulate a ramp-up by changing the frequency from an initial value to the rated value using a rate limiter. The issue is that I want to update the reference frequency value only when the counter (for selecting switches) reaches 0.
I have tried using the Signal Sample and Hold block as well as a combination of switches and memory blocks, but it is not working. The counter should always change from 0 to 180, but it is not behaving as expected.
Can anyone help with this?

Answers (2)

Divyanshu
Divyanshu on 6 Aug 2024 at 6:18
Edited: Divyanshu on 6 Aug 2024 at 6:19
You can try using triggered subsystems. Add your entire model inside the triggered subsystem block and use the counter as a control signal for triggered subsystem.
When the value of counter changes from 0 to 180 then it will trigger a 'rising' edge and the triggered subsystem would be enabled. Make sure to keep the 'Trigger Type' as 'rising' in the block parameters of 'Trigger' block.
You can refer the following documentation link for more detail on 'Triggered Subsystem':

Piotr Kolodziej
Piotr Kolodziej on 8 Aug 2024 at 14:11
Edited: Piotr Kolodziej on 8 Aug 2024 at 14:12
Hello Divyanshu.
Thanks for help.I noticed that I was wrong. It was not the problem with updating value.
I used clock to create sinus signal wich was reseting the integrator block. The problem was with the clock, after updating the frequency I should reset the clock.
It is impossible to reset the clock so the only way is to use another memory block to update the last clock time value of 180 degrees and substract it from the time of the clock.
However it is easier to do it using Matlab Function.
Screen in attachments.
Thanks for help.

Categories

Find more on Schedule Model Components in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!