## 5 Reputation

9 years, 115 days

## @Robert Israel   Hi Robert,   ...

@Robert Israel

Hi Robert,

I though that you could help me with this? If do so, that would be very helpful for me and problem I have to solve. I want to solve this in discrete time using probably finite difference method?!

http://www.mapleprimes.com/questions/149499-Applying-Thermostat-Control-To-Heat?rid=465387

## Another appeal...

Hi,

Please, can somebody help me to solve this system considering them as difference equation in discrete time?

I really need to solve them as soon as possible. Thanks in advance! Solution in Matlab is also acceptable for me.

eq1:=C1*diff(T1(t),t)=U12*A1*(T1(t)-T2(t))+U13*A2*(T1(t)-T3(t))+H1(t);
eq2:=C2*diff(T2(t),t)=U21*A1*(T1(t)-T2(t))+U23*A2*(T2(t)-T2(t))+H2(t);

ics:=T1(0)=Ta, T2(0)=Tb;
res:=dsolve({eq1,eq2, ics},params);

## @Preben Alsholm  Hi Preben, I creat...

Hi Preben,

I created a new post 3 weeks ago, but nobody has answered yet. I am just wondering what to do because I should resolve this task soon and then describe results. Then, I am just wondering what I have to do with this?!

Thanks!

## @Preben Alsholm    Hi, I tried...

Hi,

I tried this model of thermostat with some additionals, like capacity and additional heater. Furthermore, I read about dsolve/events. Then, I have a few questions.

1. Since this model is noted withd dsys, I consider this as a system od diff.eq. where the only difference is added heater int second equation, correct? Does it mean that I can fit my equations to this model with some changes? I wonder about that because my system is set for two rooms, but that should not change this system in principle.

2. If I do that, could I define outside temperature and heater activity as functions over time? I tried, but it's reported some error.

3. Is there a way to keep heater active for more time intervals in order to keep constant temperature and get more flatten curve? Is there a way to apply some if or for loop? Now, temperature drops immediately after temperature reaches desired bounds?

4. Is it doable to make this model functionable for two thermostats? Maybe, if I add additional discrete variables?

I read about dsolve/events but document is little bit messy because there are many added information even they are not all related.

## @Preben Alsholm  Hi, I was thinking...

Hi,

I was thinking about these equations last days, so then I got some concerns about it.

I tried again computations in discrete time, but results are pretty inaccurate. Probably, because of very fast growing of exponential functions. Furthermore, it happens that I get very quick increment of temperature because my heaters emit the same amount of heat.

Then, I consider two things about these equations.

1. I definitely need to define H1 and H2 as a more complex functions and then interrupt them to send a large amount of heat in each time interval.

2. Is there a way to set up some control for heaters? For example, I want tempereture in the office between 19 and 20 degrees. And when temperature is above or below these boundaries, heater switches off or on.

I think that these questions are interrelated, so maybe you have some idea how could I set up this. Or if I set up some control, then I don't need such a complex H1 and H2 functions.

## @Preben Alsholm  Yes, I set up the ...

Yes, I set up the time at 24 hours but in seconds.

I tried with timestep=5*60 in Euler moethod, but I obtained very strange graphs, with temperature values of 2*10184 and similar, so I am curious is this correct?!

## @Preben Alsholm  Hi again, I solved...

Hi again,

I solved equations you wrote and I defined T3, H1 and H2 as sinusoidal functions.

You mentioned in previous posts that numerical method is actually solved in discrete time. But, after solving all methods analytical, numerical and Euler, I got pretty same graphs for analytical and Euler method, so I am little bit curious did I get the right results.

One of my main tasks is to solve this system in discretized time intervals, e.g. 5 or 15 minutes and compare with results obtained from analytical solution. Actually, equation I presented below is difference equation get it after differentiation.

T1(t+dt)-T1(t)=U12dt/C1*(T2(t)-T1(t))+U13dt/C2*(T3(t)-T1(t))+H1(t)dt/C1;

Do you have in mind how could I finally solve this task and compare results?

## @Preben Alsholm Preben, you are great! I...

@Preben Alsholm

Preben, you are great! I really appreciate your support because I work this first time, so I hope if would be sufficient also for some other examples.

According to previous post:

1.When I solve analytical solution, I can only obtain separate plots, not both at one.

display({p1,p2}) doesn't work and doesn't report any error?!

2. I assume that I can solve all of these within one file, correct?

3. According to that, sol[1] and sol[2] means solution of the T1 and T2 from analytical method?

4. After I solved the last, I should get solution which compares values from continuos and discrete time?

Sorry if I ask something which is meybe obvious but I only want to be sure that I think the same as you wrote.

Then, I will play with this tomorrow :) Thanks again!

## @Preben Alsholm    Hi, thanks ...

Hi, thanks for help again. Just to clarify someting, I have a few questions.

1. When you say concrete period, then T can be T=15minutes e.g. right? Could I use some other expression instead of sin?

2. As I want to compare results obtained from continuos and discrete time, and compare difference using RC method/constant, should I solve my current system by numerical method because I wonder if I can compare results obtained from different methods?

## @Preben Alsholm  Hi! I figured out ...

Hi! I figured out what was the problem with curves and got the plot finally.

There are two more things which I want to solve.

1. You mention in the previous posts that I could define H1(t). H2(t) and T3(t) as functions.

How can I do that? Do I also need ics for these functions or define them among paramteres?

2. I need to find a way to solve this system of ODE in discrete time. Could you attach me some link where I can find something about it?

Thanks and I hope that you can help me!

## @Preben Alsholm  Hi! Ok, according ...

Hi!

Ok, according to your suggestion, I typed this code:

eq1:=C1*diff(T1(t),t)=U12*(T2(t)-T1(t))+U13*(T3(t)-T1(t))+H1(t);
eq2:=C2*diff(T2(t),t)=U21*(T1(t)-T2(t))+U23*(T3(t)-T2(t))+H2(t);

ics:=T1(0)=Ta, T2(0)=Tb;

params:{C1=25,C2=25,U12=40,U21=40,U13=20,U23=20,Ta=20,Tb=10,H1(t)=4,H2(t)=3,T3(t)=5};

sys:=eval({eq1,eq2,ics},params);

res:=dsolve(sys);

I got some big expressions, but they are now in two rows. Now, when I want to plot this analytical solution, I got this message

> plot(res, [T[1](t), T[2](t)]);
%;
Error, (in plot) two lists or Vectors of numerical values expected

Does somebody know what can be a problem?

I suppose if I want to obtain numerical solution, then is neccessary to write this:

res:=(dsolve(sys), numeric);

Thanks a lot!

## Both solutions...

Hi, again me!

I tried analytical solution and it works, but when I try to execute numeric one, I got this message

Error, (in dsolve/numeric/process_input) missing differential equations and initial or boundary conditions in the first argument: sys

Is that because I defined in params:=T3(t)=25, H1(t)=20, H2(t)=17?

Actually, T3(t) should be paramater, but we have value for each time interval.

And aslo H1(t) and H2(t) are known in first time interval, but they change over time.

I think that should as you suggested in previous message that make them non constant. In that way, is it correct this statement?

ics:=T1(0)=Ta,T2(t)=Tb, H1(0)=Ha, H2(t)=Hb, T3(t)=Tc;

params:={C1.....Tc=25, Ha=32, Hb=28); or

ics:=T1(0)=Ta,T2(t)=Tb;

params:={C1.......H1(t)=32,H2(t)=28,T3(t)=25, t=<0,200>0;

And according to that, is it sufficient to write;

resnum:=dsolve(sys,numeric);

Thanks again!

## Re...

Great! I got some solutions, hopefully correct :)

One more question. I suppose this is a analytical solution.

But if I want numeric method, for example in discretized time then I write:

params:=(C1=23,C2=25,U...) Do I also define H1(t) and H(t) as a parameters?

res:=dsolve({eq1,eq2,ics,params},{T1(t),T2(t)},t=<0,60>, numeric)

Thanks one more time!

Anyway, do you recommend me some book or tutorial for learning Maple?

## This is a point...

Hi! I finally have clear situation.

These are formulas.:

C1*diff(T1(t),t)=U12(T2(t)-T1(t))+U13(T3(t)-T1(t))+H1(t)

C2*diff(T2(t),t)=U21(T1(t)-T2(t))+U23(T3(t)-T2(t))+H2(t)

These equations are set up between two rooms and outside temperature T3.

C1, C2, U12,U13, U21,U23 are parameters. Yes, H1 and H2 should be also parameters, even they are showed as a functions.

T3(t) should be also parameter, because I need to find how temperature T1 and T2 change in t.

So, I wrote these equations in Maple as eq1 and eq2.Then ics:=(T1(0)=Ta, T2(t)=Tb);

unprotect('Ta,Tb');

dsolve:=(eq1,eq2, ics, {T1(t),T2(t)},t:<0,60>);

But I got some error.

Did I miss something? I really need to solve this as quick as possible.

Thanks a lot for help!

## Help with system of diff eq...

Hi my friend,

First, thank you for a quick response and sorry because I disturb you again.
Unfortunately, I am not skilled enough in Maple because I just started with learning, but I plan to improve my knowledge.

Let explain what do I need.
I need to solve these equations where derivation of temperature by time is sum of heat flows of all objects with added heating inside the object.
I have three objects, two inside which have capacity C, heating H and conductivity between them U. Outside object has just temperature value, not any other parameter.
So, the equation is:
Ci*diff(Ti(t),t)=sum(Uij*(Ti(t)-T(j))+Hi(t)

I need to solve this system of diff.equations urgently. So then is:

C1*diff(T1(t),t)=sum(U12*(T1(t)-T2(t))+ H1(t)
C2*diff(T2(t),t)=sum(U12*(T2(t)-T1(t))+ H2(t)

Is this correct?
I suppose that I need to change something when I write equation for temperature between object and outside.

I hope that I clarify everything. If you need something else, please let me know and I will add.
Also, If you know solution, don't write me everything because I want try to solve on my own. Until your help, I will continue to look for solution.

Thanks one more time, I really appreciate that!

 1 2 Page 1 of 2
﻿