Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to pass exogenous input signals to components? #123

Open
YangyangFu opened this issue Oct 27, 2022 · 4 comments
Open

how to pass exogenous input signals to components? #123

YangyangFu opened this issue Oct 27, 2022 · 4 comments

Comments

@YangyangFu
Copy link

For most systems, there will be exogenous input signals as control inputs/disturbances, such as the outdoor air temperature.

Say I have a zone temperature file saved as a csv, and the temperature is sampled every hour. But I have a system, which runs at a time step of 5 min. How can I connect this exogenous temperature to Thermal.PrescribedTemperature, and solve the resulting ODE on a 5-minute basis?

In Modelica, there is a block called TimeTable, which performs auto interpolation between time indexes. Is there any similar block in ModelingToolkitStandardLibrary for this purpose?

@ValentinKaisermayer
Copy link
Contributor

ValentinKaisermayer commented Oct 29, 2022

Unfortunately there is no component to do this at the moment but there should be. Or at least a tutorial to demonstrate a solution to this not uncommon task.

You have two options:

@YangyangFu
Copy link
Author

YangyangFu commented Oct 30, 2022

Thanks a lot for these very helpful suggestions. I will take a look soon.

@baggepinnen
Copy link
Contributor

baggepinnen commented Oct 30, 2022

The easiest way to incorporate data like this is probably to create an interpolation function using any of the interpolators from
https://github.com/PumasAI/DataInterpolations.jl

Have a look at how some of the sources in the standard librsry are implemented, like the sine source


Then change the equation to use the interpolator $int(t)$ instead of $\sin(t)$

@ValentinKaisermayer
Copy link
Contributor

If this is implemented without a discrete update operator or callback, your data has to be somewhat smooth in oder to get correct results. Although, in the library are step sources that seem to work just fine without, so the solvers are already quite good at handling this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants