[Simulink] How to write Values to Workspace when a Zero Crossing Occurs

2 次查看(过去 30 天)
I have a "continuous" simulation of an object falling into the sea. My customer wants output of ~80 parameters at (say) 0.1 second timesteps, including the timestep AFTER impact. - Which I have successfully done by writing to the workspace with the sample time =0.1, AND a memory block followed by a zero crossing detection in the downs direction to terminate ~0.1 seconds late. HOWEVER, my customer understandably also wants to know the ~80 parameters at the moment of surface impact, even though this is between the timesteps, which I could do by stopping at the sea surface crossing. So far I can see how to do one or the other, but not both in the same simulation. Suggestions? I don't mind having to rearrange the rows of data in Matlab, but I can't see how to extract the additional data at just the zero crossing, and the run time is bad enough without having to run at milliseconds then decimating. I'm new to Simulink, and have not yet tried any blocks that only activate on an "event", except the Stop event. Thanks

回答(1 个)

Bo Yuan
Bo Yuan 2017-8-3
Based on my understanding, you are looking to log simulation data at the zero crossing point including the minor steps of integration. You can refer to this link and try this block for minor step logging.

类别

Help CenterFile Exchange 中查找有关 General Applications 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by