# Change Sample Time during simulation in PLECS Blockset

**URL:** <https://forum.plexim.com/t/change-sample-time-during-simulation-in-plecs-blockset/732>\
**Category:** PLECS\
**Tags:** blockset, changeable-variable, sample-time\
**Created:** [January 14, 2020, 2:41am UTC](https://forum.plexim.com/t/change-sample-time-during-simulation-in-plecs-blockset/732 "2020-01-14T02:41:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sgra](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@sgra](https://forum.plexim.com/u/sgra)\
**Post date:** [January 14, 2020, 2:41am UTC](https://forum.plexim.com/t/change-sample-time-during-simulation-in-plecs-blockset/732/1 "2020-01-14T02:41:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Bryan\_Lieblick](https://dub1.discourse-cdn.com/flex006/user_avatar/forum.plexim.com/bryan_lieblick/32/10_2.png) [@Bryan\_Lieblick](https://forum.plexim.com/u/Bryan_Lieblick)\
**Post date:** [January 15, 2020, 12:22pm UTC](https://forum.plexim.com/t/change-sample-time-during-simulation-in-plecs-blockset/732/2 "2020-01-15T12:22:10Z")

</div>

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](https://forum.plexim.com/uploads/short-url/s8vmsCt55ylQ71fPiDWYDis3yv.plecs) (20.3 KB)

[TriggeredDiscreteStateSpace.slx](https://forum.plexim.com/uploads/short-url/7Xwz1IrruLNA0mfXXuB7bblD0lf.slx) (27.6 KB)

---

<div class="post-metadata">

**Author:** ![sgra](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@sgra](https://forum.plexim.com/u/sgra)\
**Post date:** [January 16, 2020, 4:36am UTC](https://forum.plexim.com/t/change-sample-time-during-simulation-in-plecs-blockset/732/3 "2020-01-16T04:36:13Z")

</div>

Thanks a lot!  
This solved my issue.
