From: dontgive dontgiveeither on
Hi all,

I'd like to know how to store the clock value of simulink. In fact, I'd like to do something like that:

if clock=time1+alpha
out3 = true
out4 = false
end

when the clock value is equal to time1+alpha (alpha is a short time) then my outputs (from the embedded matlab function) turn true for o3 and true for o4. However, it doesn't work

thanks
From: Steven Lord on

"dontgive dontgiveeither" <spursmax(a)hotmail.com> wrote in message
news:i1mi4b$bnl$1(a)fred.mathworks.com...
> Hi all,
>
> I'd like to know how to store the clock value of simulink. In fact, I'd
> like to do something like that:
>
> if clock=time1+alpha
> out3 = true
> out4 = false end
>
> when the clock value is equal to time1+alpha (alpha is a short time) then
> my outputs (from the embedded matlab function) turn true for o3 and true
> for o4. However, it doesn't work

Are you having trouble determining the simulation time? If so, look at the
Clock or Digital Clock sources:

http://www.mathworks.com/access/helpdesk/help/toolbox/simulink/slref/clock.html

http://www.mathworks.com/access/helpdesk/help/toolbox/simulink/slref/digitalclock.html

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com


From: dontgive dontgiveeither on
not exactly, actually I'm using a PWM control and when I have an intersection of the reference and the carrier then I'm storing this time. However, when the clock is equal to this time+alpha then I have the conditions for my outputs. I'm using an Embedded Matlab Function where the clock in an input. However, there is only the condition " clock is equal to this time+alpha " that doesn't work.
From: dontgive dontgiveeither on
no ideas ?
From: dontgive dontgiveeither on
another way of explaining what I'd like to get is:
how can I make a condition concerning the simulation time,
for example, if:
clock = previous value of clock + short-time then I have the conditions for my outputs.
I've tried to sotre the value of the clock into the workspace blocks but it doesnt work and I don't know why. :(