Comments on: Springtime and R2008a https://blogs.mathworks.com/simulink/2008/03/11/springtime-and-r2008a/?s_tid=feedtopost Guy Rouleau is an Application Engineer for MathWorks. He writes here about Simulink and other MathWorks tools used in Model-Based Design. Sat, 04 Feb 2017 19:48:08 +0000 hourly 1 https://wordpress.org/?v=6.2.2 By: karthik https://blogs.mathworks.com/simulink/2008/03/11/springtime-and-r2008a/#comment-262 Fri, 30 May 2008 02:13:04 +0000 https://blogs.mathworks.com/seth/2008/03/11/springtime-and-r2008a/#comment-262 Hi,
In my application i need to send output to CANOE from simulink model on need basis only.
ie
i send the output to the external application when i have data. Otherwise i should not send anything.

I have implemented the logic using stateflow inside a simulink subsystem and using CANOE MATLAB interface simulink library blocks.

Issue:
The issue is that when i dont want to send data the output transmitted out is “Zero”. Which seems correct by all sense.
But as per my specific requirement, i should not transmit anything , not even “Zero”.
If i transmitt “Zero” the CAN bus will wake up to transmitt “Zero”. This is undesiable as we cannot simulate “Sleep mode” since it is always awake.
I would like to know we can do something in the MATLAB end to stop sending “Zero” i.e transmitt nothing when no data is present.

This seems to happen without the interface blocks. ie by default MATLAB sends “zero” when no data is transmitted. This i could see in the scope.
But i dont want “Zero” also to be transmitted out. Is there a way to disable output from the simulink output ports forcibly and then re enabling them back when needed using a .m script?

Please let me know if any clarification is required regarding the issue.
Kindly let me know at the earliest.
Regards
Karthik

]]>
By: Seth https://blogs.mathworks.com/simulink/2008/03/11/springtime-and-r2008a/#comment-108 Sat, 29 Mar 2008 11:52:46 +0000 https://blogs.mathworks.com/seth/2008/03/11/springtime-and-r2008a/#comment-108 @Vijay – thank you for answering Yaw. It’s good to see other MathWorkers on MATLAB Central.

@Yaw – I think Vijay gave some good suggestions. The Buffer block can be tricky to use when combined with a conditional subsystem. I don’t think the memory block is going to meet your needs because it will only capture one sample and hold it for a single step.

]]>
By: Vijay Swaminathan https://blogs.mathworks.com/simulink/2008/03/11/springtime-and-r2008a/#comment-74 Fri, 21 Mar 2008 13:06:32 +0000 https://blogs.mathworks.com/seth/2008/03/11/springtime-and-r2008a/#comment-74 @Yaw,

Two comments before I point you in the rigt direction:

1. Your logic seems to be anti-causal. i.e. How would you know at the stating of a period what the amplitude of the sinusoid is going to be? This will decide your threshold for that time period. If you are collecting this information offline in some other fashion then you’re all set.

2. Just a caution from a signal processing perspective. You said you have a sinusoid with varying amplitudes in each period. This can happen if the gain of your amplifier is drifting. But just as a word of caution, if this indeed happens, you no longer have *one* sinusoid. You can confirm this by taking the fourier transform of you signal. But since you are procesing only one period at a time, you are approximating a sinusoid and therefore okay in short time spans. Just be careful about doing any spectral processing of this signal (you will notice some high frequency components that you do not expect).

Now to you question about buferring. Given that you “know” what the threshold for this period is , you can use for example the “Compare to constant” block in the “Logic and Bit operations” library (under Simulink) to enable/trigger either an “Enabled Subsytem” or a “Trigerred Subsystem” to do you buffering. These blocks may be found under the “Ports and Subsystems” library (under Simulink). You may either use a “Memory” block (Simulink) or the “Buffer” block (Signal Processing blockset)to do the actual bufferring. Check the documentation for more information on “Enabled Subsystems” and “Trigerred Subsystems”. Pay special attention to the options that allow you to keep/reset the outputs and states when these subsytems are not active.These options can greatly affect how your subsystems will behave.

hth,

Vijay

]]>
By: Yaw https://blogs.mathworks.com/simulink/2008/03/11/springtime-and-r2008a/#comment-72 Wed, 19 Mar 2008 20:51:53 +0000 https://blogs.mathworks.com/seth/2008/03/11/springtime-and-r2008a/#comment-72 Seth,
Thanks for starting a Blog on Simulink. Much needed! I have a question on signal buffering and processing in Simulink without a DSP toolbox or Blockset.

Lets say you have a sinusoid for example, of varying amplitudes in every period. Lets look at the first 4 periods of this signal. The positive side max amplitudes are 5, 4, 6, and 3 respectively and the negative sides are
-4,-5,-3 and -5 respectively.

What I want to learn is to buffer the 4 periods as they arrive in based off hit crossings. These crossing thresholds are 10% of the amplitudes in the period of interest. For example the first cycle has 5(max) and (-4)min. So we want to generate the rising edge of a square wave when we cross 0.5(towards the +ve direction or upward)and generate the falling edge when we cross -0.4(towards the +ve direction or upward).

This square wave is then buffered, post processed and the buffer reset for the second period. The process continues until all 4 cycles are processed.

Thanks for your time.
Yaw.

]]>
By: Seth https://blogs.mathworks.com/simulink/2008/03/11/springtime-and-r2008a/#comment-63 Fri, 14 Mar 2008 01:42:52 +0000 https://blogs.mathworks.com/seth/2008/03/11/springtime-and-r2008a/#comment-63 @Joe – I will most definitely be talking about zero crossing detection in general and look at the capabilities of the new adaptive settings. If you have 8a and don’t want to wait, open the Simulink demos:

>> demo simulink

Then, open the second demo called “Double Bouncing Ball: Use of Adaptive Zero Crossing Location”.

]]>
By: Joe https://blogs.mathworks.com/simulink/2008/03/11/springtime-and-r2008a/#comment-62 Thu, 13 Mar 2008 20:08:06 +0000 https://blogs.mathworks.com/seth/2008/03/11/springtime-and-r2008a/#comment-62 Hey Seth!

Looking forward to your upcoming posts. Are you going to highlight the new zero crossing algorithm? I think a discussion about Simulink solvers and/or zero crossing would be GREAT for all users, new and old.

]]>