Event generation in the 'scifunc_block_m' block

I would be grateful for someone to help me understand this.

After numerous attempts at trying to configure this block to output events, I’ve come to the following conclusions:

  • Event outputs can only be triggered if there’s an event input; the block cannot independently generate events.
  • You can delay an event output simply by adding the delay to ‘t’ and feeding it to ‘t_evo’.
  • You can trigger the block by feeding an event into it.

Is this correct?

And how do I output events from multiple output ports?

How does the ‘z’ parameter fit into this (see example use in Demonstrations→Xcos→Standard demos→Scilab block)? How would you describe its’ use?

Thank you

You are right about events; they can not be “created” by blocks from scratch. The trick is to loop events from output to input, thus scheduling a future evaluation.

Setting t_evo will schedule an event. You set up an absolute value, so use t to schedule a delay (aka timer) value.

To output multiple events, you write a vector to t_evo; the size should match the count of output event ports.

The z parameter is a discrete state variable; you can write it during state evaluation. You can read it in almost all execution phases.

In the Scilab_block demo, the z state is swapped from 1 to -1 on each event and is the output y=z. The delay between events is random (eg. (5*rand())^2+t).

Thank you David for clearing that up for me.

I have a better idea of how events work with this block now, particularly how to generate multiple events.