Overview
Comment:Implicit method now allows for switches via _switchA
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: c6d26e51335778eeb884b6496a2e8eb2a7c7446394840be223cb5c2f6a8e62f5
User & Date: gawthrop@users.sourceforge.net on 1998-09-30 17:41:24
Other Links: branch diff | manifest | tags
Context
1998-10-01
15:46:34
Now generates _switcha.m as well -- needed for implicit integration check-in: 82f51e3de3 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
1998-09-30
17:41:24
Implicit method now allows for switches via _switchA check-in: c6d26e5133 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
1998-09-29
20:09:46
Fixed nyfr and nifr plotting bug check-in: 8e8559691c user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/make_ode2odes from [b393691984] to [82ad21bca8].

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.11  1998/08/25 12:28:31  peterg
## Move initila switch to after initial input
##
## Revision 1.10  1998/08/25 12:22:45  peterg
## Put _switch after update and also at initilisation
##
## Revision 1.9  1998/08/15 13:46:59  peterg











>
>
>







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.12  1998/08/27 08:55:18  peterg
## Mods to integration methods
##
## Revision 1.11  1998/08/25 12:28:31  peterg
## Move initila switch to after initial input
##
## Revision 1.10  1998/08/25 12:22:45  peterg
## Put _switch after update and also at initilisation
##
## Revision 1.9  1998/08/15 13:46:59  peterg
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
$1_numpar;			# Read in parameters
MTTilast = round(mttlast/mttdt); # Total number of steps

#Initialise
MTTt = 0.0;
[MTTx] = $1_state;	        # Read in initial state
[MTTu] = $1_input(MTTx,MTTt);	# Evaluate initial input
[MTTx] = $1_switch(MTTx);       # Switches
[MTTy] = $1_odeo(MTTx,MTTu,MTTt); # Evaluate initial output
mtt_write(MTTt,MTTx,MTTy,$Nx,$Ny); # And write them

[mttAA]  = zero_matrix($Nx);	# Zero the A matrix
[mttAAx] = zero_vector($Nx);	# Zero the AAx vector



  if mttmethod==1		# Euler
    MTTddt = mttdt/mttstepfactor; # The small sample interval
  endif;

#Integration loop
for MTTit = 1:MTTilast
  [MTTu] = $1_input(MTTx,MTTt);	# Input

  if mttmethod==1		# Euler
    for MTTjt = 1:mttstepfactor
      [MTTdx] = $1_ode(MTTx,MTTu,MTTt); # State derivative
      [MTTx] = mtt_euler(MTTx,MTTdx,MTTddt,$Nx); # Euler update
      MTTt = MTTt + MTTddt;
    endfor;
  endif;
  if mttmethod==2		# Implicit 
    [MTTdx] = $1_ode(MTTx,MTTu,MTTt); # State derivative
    [mttAA,mttAAx] = $1_smx(MTTx,MTTu,mttdt);	# (I-Adt) and (I-Adt)x

    [MTTx] = mtt_implicit(MTTx,MTTdx,mttAA,mttAAx,mttdt,$Nx); # Implicit update
    MTTt = MTTt + mttdt;
  endif;

  [MTTx] = $1_switch(MTTx);	# Switches

  [MTTy] = $1_odeo(MTTx,MTTu,MTTt);







<





>
>



















>







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
$1_numpar;			# Read in parameters
MTTilast = round(mttlast/mttdt); # Total number of steps

#Initialise
MTTt = 0.0;
[MTTx] = $1_state;	        # Read in initial state
[MTTu] = $1_input(MTTx,MTTt);	# Evaluate initial input

[MTTy] = $1_odeo(MTTx,MTTu,MTTt); # Evaluate initial output
mtt_write(MTTt,MTTx,MTTy,$Nx,$Ny); # And write them

[mttAA]  = zero_matrix($Nx);	# Zero the A matrix
[mttAAx] = zero_vector($Nx);	# Zero the AAx vector

[MTTx] = $1_switch(MTTx);       # Switches

  if mttmethod==1		# Euler
    MTTddt = mttdt/mttstepfactor; # The small sample interval
  endif;

#Integration loop
for MTTit = 1:MTTilast
  [MTTu] = $1_input(MTTx,MTTt);	# Input

  if mttmethod==1		# Euler
    for MTTjt = 1:mttstepfactor
      [MTTdx] = $1_ode(MTTx,MTTu,MTTt); # State derivative
      [MTTx] = mtt_euler(MTTx,MTTdx,MTTddt,$Nx); # Euler update
      MTTt = MTTt + MTTddt;
    endfor;
  endif;
  if mttmethod==2		# Implicit 
    [MTTdx] = $1_ode(MTTx,MTTu,MTTt); # State derivative
    [mttAA,mttAAx] = $1_smx(MTTx,MTTu,mttdt);	# (I-Adt) and (I-Adt)x
    [mttAA] = $1_switchA(mttAA,MTTx);	# Switches
    [MTTx] = mtt_implicit(MTTx,MTTdx,mttAA,mttAAx,mttdt,$Nx); # Implicit update
    MTTt = MTTt + mttdt;
  endif;

  [MTTx] = $1_switch(MTTx);	# Switches

  [MTTy] = $1_odeo(MTTx,MTTu,MTTt);


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