MATLAB Answers

Connecting two subsystems with input-output

90 views (last 30 days)
Matej Lukac
Matej Lukac on 27 May 2020
Edited: madhan ravi on 29 May 2020
Hello all, I have a big problem that I have no idea how to cope with after several days of research and trying. I have model of two ODEs (see picture) and want to connect them. First starts the first model and I compare output to a constant(3 to be specific), if it is smaller than that, second program starts with the output of the first model as an input. Similarly its output is compared to a constant and if it exceeds it goes back to the first model. I would like the final graph to be something like this: I have tried all possible combination of IF, while, do while, switches, you name it, but no success. It should represent temperature in fridge and please forgive my terrible painting, you get the point.
Is it even possible? If you help, I owe you big time, whatever just to solve this.
Thank you very much


Show 1 older comment
Matej Lukac
Matej Lukac on 29 May 2020
Sure thing, the equation is basically Newtons law of cooling dT/dt = k*ΔT. I aplied it both ways for cooling as well as for heating with reverse temperatures. I am fairly confident my model is ok, but not 100%. Anyways here is my model, the top one is cooling equation and the botton one is heating. Thank you very much for your desire to help you are amazing.
Matej Lukac
Matej Lukac on 29 May 2020
Also this was my initial thought procces, I am aware that it is totally stupid, and I broke many rules but I am just not skilled enough. I also tried to create resettable system, to use switch blocks, while blocks and even relay and memory blocks but nothing seems to work for me. I will just post here to give you the general idea.
madhan ravi
madhan ravi on 29 May 2020
I think you just over complicate the problem. Why not simply use a product block with one input as k and the other as Delta T and the output is T dot? And use this output for comparison?

Sign in to comment.

Answers (0)