Overview
Comment:Removed the argument passing stuff .
Replaced by the simpar.m method.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: f27a8a929c0c6050a2105f1e5ea7d0eacad461509b98d19de2bc359824d5e6a1
User & Date: gawthrop@users.sourceforge.net on 1998-02-25 18:02:39
Other Links: branch diff | manifest | tags
Context
1998-02-25
18:03:49
Removed the argument reading bits. check-in: a89d7bde33 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
18:02:39
Removed the argument passing stuff .
Replaced by the simpar.m method.
check-in: f27a8a929c user: gawthrop@users.sourceforge.net tags: origin/master, trunk
16:59:56
Corrected enthalpy-entropy conversion -- use temp on the entropy side. check-in: 6416f81956 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/ode2odes_m from [d50dd84d7a] to [4c330c5fba].

11
12
13
14
15
16
17



18
19
20
21
22
23
24
# Copyright (c) P.J.Gawthrop, 1996.

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



# Revision 1.10  1997/01/07  09:16:03  peterg
# Added step_factor parameter - gives that number of integration steps
# per sample.
#
## Revision 1.9  1997/01/06 21:36:44  peterg
## Fixed bug mtt_error --> mtt_error.txt
## Replaced lsode by Euler integration.







>
>
>







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.11  1997/08/29 07:56:54  peterg
## Minor updates
##
# Revision 1.10  1997/01/07  09:16:03  peterg
# Added step_factor parameter - gives that number of integration steps
# per sample.
#
## Revision 1.9  1997/01/06 21:36:44  peterg
## Fixed bug mtt_error --> mtt_error.txt
## Replaced lsode by Euler integration.
46
47
48
49
50
51
52


53

54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71







72
73
74
75
76
77
78
79
80
81
82
83
84

85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
##
## Revision 1.1  1996/08/15 11:56:38  peter
## Initial revision
##
###############################################################

echo Creating $1_odes.m


rm -f ode2odes_m.log


if [ "$2" = "" ]; 
then
  PARAMS='T=[0:0.1:10]; x0=zeros(nx,1);'
  echo Using default parameter $PARAMS
  echo $PARAMS>$1_args.m
else
  PARAMS=$2;
fi

# PARAMS="$PARAMS ;"


$MATRIX << EOF > ode2odes_m.log 2>mtt_error.txt

  step_factor = 1; %Set up default step factor
  %Read in parameters
  $1_numpar;








  [nx,ny,nu,nz,nyz] = $1_def;
  t=0;	%Just in case it appears in the parameter list.

  $PARAMS

  %Defaults
  if exist('T')==0
    T=[0:0.1:10]
  end;

  if exist('x0')==0
    x0 = zeros(nx,1);

  end;

  [n,m]=size(T);
  if m>n
    T=T';
  end;

if nx>0
%  x = lsode('$1_ode', x0, T);

%Euler integration
  x = x0;
  X=[];
  dt = (T(2)-T(1))/step_factor;

  for t=T'
    X = [X x];
    ts = t;
    for i=1:step_factor
      dx = $1_ode(x,ts);
      ts = ts + dt;
      x = x + dx*dt;
    end;
  end;

  X = X';







>
>

>

|
|
|
|
|
|
|
|






<

|
>
>
>
>
>
>
>




<



|


|
|
>
|










|

|




|







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74

75
76
77
78
79
80
81
82
83
84
85
86
87

88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
##
## Revision 1.1  1996/08/15 11:56:38  peter
## Initial revision
##
###############################################################

echo Creating $1_odes.m
echo Creating $1_odeso.m

rm -f ode2odes_m.log
rm -f mtt_error.txt

#if [ "$2" = "" ]; 
#then
#  PARAMS='T=[0:0.1:10]; x0=zeros(nx,1);'
#  echo Using default parameter $PARAMS
#  echo $PARAMS>$1_args.m
#else
#  PARAMS=$2;
#fi

# PARAMS="$PARAMS ;"


$MATRIX << EOF > ode2odes_m.log 2>mtt_error.txt


  %Read in parameters
  $1_numpar; 
 
  %Read in state
  x = $1_state

  %Read in simulation parameters
  $1_simpar
  T = [0:DT:LAST]

  [nx,ny,nu,nz,nyz] = $1_def;
  t=0;	%Just in case it appears in the parameter list.



  %Defaults
  if exist('T')==0
    T=[0:1:100]
  end;

 % if exist('x0')==0
 %   % x0 = zeros(nx,1);
 %   x0 = x;
 %  end;

  [n,m]=size(T);
  if m>n
    T=T';
  end;

if nx>0
%  x = lsode('$1_ode', x0, T);

%Euler integration
%  x = x0;
  X=[];
  dt = (T(2)-T(1))/STEPFACTOR;

  for t=T'
    X = [X x];
    ts = t;
    for i=1:STEPFACTOR
      dx = $1_ode(x,ts);
      ts = ts + dt;
      x = x + dx*dt;
    end;
  end;

  X = X';


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