Having Trouble with enable/delay etc in Simulink

Hi Everyone,
I'll try to explain my problem as clear as I can: when you use an enabled subsystem that contains only a ramp function, the ramp will continue to develop with time even though the output signal of the subsystem will be held at a constant value while the subsystem is disabled. So the next time it is enabled, for instance if your initial value is 0 and you started disabled for 2 seconds leading to an enable situation at t=2, the output of the subsystem will be = 2 instead of 0 that I need. I imagined that changing the states when enabling in enable block to reset would solve my problem but I didn't see any difference. I thought I would need to use delays but the problem is that the enabled and disabled periods are variable and I can't wrap my head around this delay stuff and how to register time for it anyways.
My question is, is there any easier way to do this? any simple block that I don't know about and does the thing I want?
Thanks for your time,
Mike

4 Kommentare

TAB
TAB am 7 Aug. 2012
Sorry mike, but don't think I got your question. This complete line is confusing
if your initial value is 0 and you started disabled for 2 seconds leading to an enable situation at t=2, the output of the subsystem will be = 2 instead of 0
Please simply explain what you are getting currently and what you expect.
Mike
Mike am 7 Aug. 2012
Bearbeitet: Mike am 7 Aug. 2012
Sorry about the confusion, I wish there was a way for me to show you the picture, it'd be much simpler.
OK let me describe it like this; I have a Ramp block with Slope = 1, Start Time = 0, Initial Output = 0. What I'd like to do is to normally use the value of the ramp signal, and when the conditions aren't met hold its value until the conditions are met again.
The way I did this was to include the Ramp block in a subsystem along with an Enable block, and input the condition into the Enable port of this subsystem. However, what I get is not what I want. Let me illustrate more:
Imagine my control signal being a straight line that flips between 0 and 1 each second. So between time 0 and 1 its magnitude is 0, between time 1 and 2 its magnitude is 1, and so on. This is the signal that I feed to the Enable port of the Enabled Subsystem. Now the output signal has a magnitude of 0 from time 0 to 1, which is fine; but at time 1 the magnitude of the output signal starts from 1 instead of 0. My intention was to hold it at 0 until time 1 (because the condition isn't met), and then start from a value of 0 at time 1 and develop a ramp until time 2.
I don't think I can describe it more than this without an actual diagram.
Thanks
shripad
shripad am 16 Okt. 2014
hi mike,
have also faced same problem ( based on what i understood from your question) , the solution might work for you - In enable subsystem block there is input port & Output port. Double click on output port, there are options available to hold or reset the state on output when enable subsystem signal is not correct.(i.e when condition does'nt meet)
Hope this will work for you
Regards, Shripad
Preeti Sar
Preeti Sar am 8 Jul. 2017
Use flip flop to hold the state that enters the enabled subsystem.

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

TAB
TAB am 7 Aug. 2012
Bearbeitet: TAB am 7 Aug. 2012

1 Stimme

As I understood, you want to synchronise the ramp generation with the condition output so that every time condition is enabled (0 to 1), ramp geneartion should re-start from 0.
Enabled subsystem always passes current status of output when it is enabled.
AFAIK, there is no block available directly which can generate resettable/re-startable ramp single depending upon condition.
But you can easily inplement your requirement using Matlab (previously Embedded Matlab) function block or using s-function. See a related Fex submission which can help you in implementing your own block.

1 Kommentar

Mike
Mike am 7 Aug. 2012
Bearbeitet: Mike am 7 Aug. 2012
Thank you very much for your answer TAB. I have to remind you though that I don't want it to go to 0 but to the previous held state, which makes things much more complicated (in the example since the previous held state was 0 I wanted it to go to 0). I already know how to make it go to zero through changing the parameters of the outport in the enabled subsystem. Also, there isn't a fixed frequency for the control signal, completely random, another obstacle.
Nevertheless the Embedded functions hadn't occur to me, I might be able to manage something with it, and anyways you did answer my question that there probably isn't any easy way of doing this with a single block.
Again, thank you for your advice, I'll wait a bit more and if there's no other answer, I'll make this thread solved.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Les Beckham
Les Beckham am 8 Jul. 2017

0 Stimmen

It sounds like you just need an Integrator with your 'enable' signal as the input instead of a Ramp block. When 'enable' is one, the integrator output will be a ramp. When 'enable' is zero, the integrator output will stop at its current value.

Kategorien

Mehr zu Schedule Model Components finden Sie in Hilfe-Center und File Exchange

Produkte

Gefragt:

am 6 Aug. 2012

Beantwortet:

am 8 Jul. 2017

Community Treasure Hunt

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

Start Hunting!

Translated by