Overview
Comment:Updated (-i dassl) residual function to use new DAEFunc (octave-2.1.35).
YZ residual dependency on Ui still requires some work.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: c9686590cef8a6de43dde4d6e2e562dac4bcee9f0cbd72356b62a05ce731f702
User & Date: geraint@users.sourceforge.net on 2001-11-15 06:24:11
Other Links: branch diff | manifest | tags
Context
2002-01-11
03:44:19
Breaks compounds objects into individual components. Eliminates "incorrect object code error" in cbg.ps when component is not causally complete. check-in: 49b14f476c user: geraint@users.sourceforge.net tags: origin/master, trunk
2001-11-15
06:24:11
Updated (-i dassl) residual function to use new DAEFunc (octave-2.1.35).
YZ residual dependency on Ui still requires some work.
check-in: c9686590ce user: geraint@users.sourceforge.net tags: origin/master, trunk
02:56:18
Added DASSL as an option for solution of algebraic equations (-ae dassl).
Requires octave-2.1.35.
check-in: 89dc73cd94 user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/make_ode2odes from [f3196ec53c] to [10ac19653f].

1
2
3
4
5
6
7
8
9
10
11



12
13
14
15
16
17
18
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
    ######################################

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$



## Revision 1.63  2001/08/07 04:39:24  geraint
## Consolidated dassl and residual functions.
##
## Revision 1.62  2001/08/01 22:14:32  geraint
## Bug fix for dassl.
##
## Revision 1.61  2001/08/01 04:06:07  geraint











>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
    ######################################

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.64  2001/08/08 02:15:00  geraint
## Rationalisation of solver code, beginning with algebraic solvers.
##
## Revision 1.63  2001/08/07 04:39:24  geraint
## Consolidated dassl and residual functions.
##
## Revision 1.62  2001/08/01 22:14:32  geraint
## Bug fix for dassl.
##
## Revision 1.61  2001/08/01 04:06:07  geraint
766
767
768
769
770
771
772
773

774
775
776
777
778
779
780

781
782
783
784

785
786
787
788
789
790
791
#endif
}

#ifdef STANDALONE
ColumnVector
Fmtt_residual (const ColumnVector &X,
	      const ColumnVector &DX,
	      double t)

{
#else // !STANDALONE
DEFUN_DLD (mtt_residual, args, , "mtt_residual")
{
    static ColumnVector	X  (MTTNX+MTTNYZ);
    static ColumnVector	DX (MTTNX+MTTNYZ);
    static double      	t;


    X  = args(0).${vector_value} ();
    DX = args(1).${vector_value} ();
    t  = args(2).double_value ();

#endif // STANDALONE

    static ColumnVector residual (MTTNX+MTTNYZ);
    static ColumnVector U (MTTNU+MTTNYZ);
    static ColumnVector u (MTTNU);
    static ColumnVector y (MTTNY,0.0);
    static ColumnVector par (MTTNPAR);







|
>







>




>







769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
#endif
}

#ifdef STANDALONE
ColumnVector
Fmtt_residual (const ColumnVector &X,
	      const ColumnVector &DX,
	      double t,
	      int &ires)
{
#else // !STANDALONE
DEFUN_DLD (mtt_residual, args, , "mtt_residual")
{
    static ColumnVector	X  (MTTNX+MTTNYZ);
    static ColumnVector	DX (MTTNX+MTTNYZ);
    static double      	t;
    static int		&ires;

    X  = args(0).${vector_value} ();
    DX = args(1).${vector_value} ();
    t  = args(2).double_value ();
    ires = static_cast<int>(args(3).double_value ());
#endif // STANDALONE

    static ColumnVector residual (MTTNX+MTTNYZ);
    static ColumnVector U (MTTNU+MTTNYZ);
    static ColumnVector u (MTTNU);
    static ColumnVector y (MTTNY,0.0);
    static ColumnVector par (MTTNPAR);
826
827
828
829
830
831
832

833

















834
835
836
837
838
839
840
    yz = feval ("${sys}_ae", new_args, 1)(0).${vector_value} ();
#endif

    for (register int i = 0; i < MTTNX; i++)
      residual (i) = dx(i) - DX(i);
    
    if (MTTNYZ > 0)

      residual.insert (yz,MTTNX);


















#ifdef STANDALONE
    return residual;
#else // !STANDALONE
    return octave_value (residual);
#endif // STANDALONE
}







>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
    yz = feval ("${sys}_ae", new_args, 1)(0).${vector_value} ();
#endif

    for (register int i = 0; i < MTTNX; i++)
      residual (i) = dx(i) - DX(i);
    
    if (MTTNYZ > 0)
      {
	residual.insert (yz,MTTNX);

	// XXX:
	// DASSL needs residual to be dependent on Ui and Uidot
	// mtt_dassl always sets the initial Ui to zero, so
	// Ui - h*Uidot should equal zero BUT, we don't know h
	static double t_old;
	double step;
	if (t != t_old)
	  {
	    step = t - t_old;
	    t = t_old;
	  }
	else
	  step = t;	
	for (register int i = MTTNX; i < MTTNX+MTTNYZ; i++)
	  residual(i) += X(i) - DX(i)*step;
      }

#ifdef STANDALONE
    return residual;
#else // !STANDALONE
    return octave_value (residual);
#endif // STANDALONE
}

Modified mttroot/mtt/lib/cc/mtt_dassl.cc from [d41dae86e1] to [b9b24f4791].

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

31
32
33
34
35
36
37
#include <octave/toplev.h>
#define VECTOR_VALUE vector_value
#endif  // OCTAVE_DEV


#ifdef STANDALONE
extern ColumnVector
Fmtt_residual (const ColumnVector &X, const ColumnVector &DX, double t);
#endif // STANDALONE


ColumnVector
mtt_residual (const ColumnVector &X, const ColumnVector &DX, double t)
{
#ifdef STANDALONE
  return Fmtt_residual (X, DX, t);
#else // !STANDALONE
  static octave_value_list args, f;
  args(0) = octave_value (X);
  args(1) = octave_value (DX);
  args(2) = octave_value (t);

  f = feval ("mtt_residual", args, 1);
  return f(0).VECTOR_VALUE ();
#endif // STANDALONE
}


#ifdef STANDALONE







|




|


|





>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <octave/toplev.h>
#define VECTOR_VALUE vector_value
#endif  // OCTAVE_DEV


#ifdef STANDALONE
extern ColumnVector
Fmtt_residual (const ColumnVector &X, const ColumnVector &DX, double t, int &ires);
#endif // STANDALONE


ColumnVector
mtt_residual (const ColumnVector &X, const ColumnVector &DX, double t, int &ires)
{
#ifdef STANDALONE
  return Fmtt_residual (X, DX, t, ires);
#else // !STANDALONE
  static octave_value_list args, f;
  args(0) = octave_value (X);
  args(1) = octave_value (DX);
  args(2) = octave_value (t);
  args(3) = octave_value (ires);
  f = feval ("mtt_residual", args, 1);
  return f(0).VECTOR_VALUE ();
#endif // STANDALONE
}


#ifdef STANDALONE


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]