How do I work with timeseries as input for my model?

5 views (last 30 days)
Hello,
I am quite new to the Simulink and Simscape environment and the work with it.
In my model I want to model a rainwater harvesting system. I have daily based precipitation data and demand (outpur) [d^-1]. Between input and output the water tanks and water treatment units are running on a second based time step.
If I create a normal time series with values every 86400 seconds (one day) Simulink interpolates the data for the time steps inbetween and uses them as input, too. Therefore, I have more incoming rain than intended.
Is there a way to conect those two time steps?
Every help or recommendation is appreciated. Thank you.

Answers (1)

Sebastian Castro
Sebastian Castro on 30 Jan 2015
Hi Joel,
If you're using an Inport block to load the data, there's an "Interpolate data" option that will give you a staircase signal instead of interpolating.
However, why should Simulink's interpolation affect your results? If you are using precipitation data, shouldn't the amount of water falling be accumulated over time with some sort of Integrator block? In that case, it shouldn't really matter whether you sample your signal "too often".
Another thing you can do if you want to avoid additional time steps is to explicitly set the sample time of the input signal to match that of your data. However, I wouldn't necessarily recommend this since you may then have to make the sample times sync up with the rest of your model (depending on what blocks you have).
  1 Comment
Joel
Joel on 12 Feb 2015
Hi Sebastian,
thank you for your answer. I cannot change the sample time since my input is based on daily inputs (mm/d) while the processes in the system are based on seconds (mm/s). Therefore, I do not want the Simscape to use my daily inputs as second based inputs, which would falsify my results.
I was using the block 'from workspace' where I loded my time series data, in which I already modified the data.
I will try your option, though. Getting a staircase signal sounds better.

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!