Change Sample Time during simulation in PLECS Blockset

Hello all,

I’m using PLECS Blockset.
Is there any possibilty to change the ‘Sample time’ in the ‘Discrete state-space options’ during simluation? For my usecase it would be sufficient to have something like a step depending on the simulation time.

Thank you for answering in advance.

Best regards

1 Like

You can change the sample time placing the Discrete State Space component within a Triggered Subsystem and setting the Sample Time parameter to “-1” for an inherited sample time. With this configuration, you can generate a variable frequency trigger pulse, which in turn will vary the effective sample time of the discrete state space system.

Attached is an example in PLECS Blockset and PLECS Standalone. The triggered implementation of the Discrete State Space component is compared against a Discrete State Space component with a fixed sample time and a comparable continuous state space system.

TriggeredDiscreteStateSpace.plecs (20.3 KB)

TriggeredDiscreteStateSpace.slx (27.6 KB)

Thanks a lot!
This solved my issue.