[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

system of differential equations



Dear list members, 

I am building a greenhouse Trnsys-component in Fortran. I made two different
implementations for solving a system of differential equations. I would like
to have your opinion on what is the best implementation. 
To explain the two implementations. I will give a simplified example set of
differential equations:
dTair / dt = A * Tair + B * Tcover + C
dTcover / dt = D * Tcover + E * Tair + F + G(Tcover)
where G(Tcover) = c1 + c2 * Tcover + c3 * Tcover^2 + c4 * Tcover^3
where A, B, C, D, E, F, c1, c2, c3 and c4 are numbers. 

Implementation 1:
Build three component each solving one equation:
*	Component 1 should contain the line: CALL DIFFEQ(time, A, B * Tcover
+ C, S(index), Tair, dummy)
*	where Tcover is an input and Tair is an output, S(index) is the
value of Tair at the end of the previous timestep
*	Component 2 should contain the line: CALL DIFFEQ(time, D, E * Tair +
F + G, S(index2), Tcover, dummy)
*	where G and Tair are inputs, Tcover is an output, S(index2) is the
value of Tcover at the end of the previous timestep.
*	G depends on Tcover, is it therefore allowed to pass it as the third
argument on the CALL to DIFFEQ ? 
*	Component 3 should contain the line: G = c1 + c2 * Tcover + c3 *
Tcover^2 + c4 * Tcover^3
	where Tcover is an input and G is an output

Implementation 2 (not implemented yet)
Build one component solving the three equations:
Writing the set of equations in matrix format (use courier font if
necessary) gives:
/            \   /         \   /      \   /        \
|  dTair / dt|   |A    B   |   |Tair  |   | C      |
|dTcover / dt| = |E    D+c2| * |Tcover| + | F + c1 |
\            /   \         /   \      /   \        /
in which the G(Tcover) polynomial has been linerealised
by applying a co-ordinate transformation the 2 by 2 matrix can be
diagonalised, which would result in two independent differential equations,
which could be solved by calling the DIFFEQ subroutine twice. After that,
the reverse co-ordinate transformation is performed.

The advantage of creating one component is that the IISiBat user has to
insert only one greenhouse component to the desktop. If several components
have to be inserted the IISiBat user must know exactly how the components
are connected to each other. 

In Trnsys each component corresponds to a physical component in reality. As
a result each component should be able to work without any other components.
In the first implementation the components depend on each other in such a
way that they could not work on their own. This is not in line with the
Trnsys perspective.

I would really appreciate it, if I could receive some feedback. 


With kind regards,

Ruut Brandsma
Modelling specialist
Ecofys b.v
Our Mission "A sustainable energy supply for everyone"
---------------------------------------------
P.O. Box 8408
NL-3503 RK Utrecht
Kanaalweg 16-G
NL- 3526 KL Utrecht
The Netherlands
---------------------------------------------
tel. +31 (0)30 280 84 35
cell.+31 (0)6 1500 22 05
fax +31 (0)30 280 83 01
email R.Brandsma@ecofys.nl
---------------------------------------------
Visit our Homepage!	 		http://www.ecofys.com
Monitor your Energy Usage!		http://www.Enerlyser.com
Make use of Solar Energy!		http://www.BeldeZon.nl
Green energy in Europe		http://www.greenprices.com 
2002: the year of the urban turbine!	http://www.urbanturbines.com 
For a sunny choice:			http://www.mysolar.com