MATLAB: Dynamically changing sample time for discrete time integrator

discrete-time integratorsample timesimulink

Hello, I am programming a dynamic chemical process which has a changing contact time (which changes the dt in the dC/dt equation). I have used a discrete time integrator with a sample time set to the contact time and this works just as I want it to however as I want the flow rate through the process to be variable and this will change the sample time I need to set. *I want to be able to set the sample time to value calculated else where in the model that changes. Does anyone have any advice for things I could try or know that this is impossible so I can stop trying?
Any extra details needed I will provide happily.

Best Answer

Set the sample time of the discrete time integrator to be inherited and place it inside a triggered subsystem. You will need to make a logic to trigger the triggered subsystem at the right time.
Related Question