Overview
Comment:Put _switch after update and also at initilisation
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: a4772b8d8259973233c94ce1615d7da164ec07e1feb18991510dc7de155ffbe0
User & Date: gawthrop@users.sourceforge.net on 1998-08-25 12:22:45
Other Links: branch diff | manifest | tags
Context
1998-08-25
12:28:31
Move initila switch to after initial input check-in: 35f7a2218c user: gawthrop@users.sourceforge.net tags: origin/master, trunk
12:22:45
Put _switch after update and also at initilisation check-in: a4772b8d82 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
09:22:34
Correctely recognises port SSs its now easy -- they are in there own
field
check-in: 9bb564d123 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/make_ode2odes from [2110f1bce1] to [9ebd11c214].

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.8  1998/08/11 13:28:03  peterg
## Lowercase mttLAST etc
##
## Revision 1.7  1998/07/30 11:29:54  peterg
## Added implicit integration stuff
##
## Revision 1.6  1998/07/30 10:44:37  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.9  1998/08/15 13:46:59  peterg
## New versions of integration routines
##
## Revision 1.8  1998/08/11 13:28:03  peterg
## Lowercase mttLAST etc
##
## Revision 1.7  1998/07/30 11:29:54  peterg
## Added implicit integration stuff
##
## Revision 1.6  1998/07/30 10:44:37  peterg
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
sympar2global_txt2m $1 >> $1_ode2odes.m

# The rest of the program
cat << EOF >> $1_ode2odes.m

$1_simpar;			# Read in simulation parameters
$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

if mttmethod==1 #Euler
  mttsteps = mttstepfactor;
endif;

if mttmethod>1 #everything else
  mttsteps = 1;
end;


mttddt = mttdt/mttsteps; # The small sample interval

if mttmethod==2 #Linear implicit
  mttAA = $1_smx(MTTx,MTTu,mttdt); # Set up AA= I-Adt matrix - linearised system
end;

#Integration loop
for MTTit = 1:MTTilast
  if mttmethod==3 # nonlinear implicit
    [mttAA] = $1_smx(MTTx,MTTu,mttdt); # Set up AA=I-A*dt  matrix - linearised system
  end;
  if mttmethod>1 # nonlinear implicit
    [mttAAx] = $1_smxx(MTTx,MTTu,MTTx,mttdt); # Set up AAx = AA*x vector - linearised system
  end;

  [MTTu] = $1_input(MTTx,MTTt);# Input
  [MTTx] = $1_switch(MTTx); # Switches

  for MTTjt = 1:mttsteps
    [MTTdx] = $1_ode(MTTx,MTTu,MTTt); # State derivative
    [MTTx] = mtt_update(MTTdx,MTTx,mttAAx,mttAA,mttdt,mttstepfactor,$Nx,mttmethod);
    MTTt = MTTt + mttddt;
  end;



  [MTTy] = $1_odeo(MTTx,MTTu,MTTt);
  mtt_write(MTTt,MTTx,MTTy,$Nx,$Ny);
end;

EOF











|




>
|
|


|
|

|



|




|

|





|


|



|
<






>
>










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
sympar2global_txt2m $1 >> $1_ode2odes.m

# The rest of the program
cat << EOF >> $1_ode2odes.m

$1_simpar;			# Read in simulation parameters
$1_numpar;			# Read in parameters
MTTilast = round(mttlast/mttdt); # Total number of steps

#Initialise
MTTt = 0.0;
[MTTx] = $1_state;	        # Read in initial state
[MTTx] = $1_switch(MTTx);       # Switches
[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

if mttmethod==1			#Euler
  mttsteps = mttstepfactor;
endif;

if mttmethod>1			#everything else
  mttsteps = 1;
end;


mttddt = mttdt/mttsteps;	# The small sample interval

if mttmethod==2			#Linear implicit
  mttAA = $1_smx(MTTx,MTTu,mttdt); # Set up AA= I-Adt matrix - linearised system
end;

#Integration loop
for MTTit = 1:MTTilast
  if mttmethod==3		# nonlinear implicit
    [mttAA] = $1_smx(MTTx,MTTu,mttdt); # Set up AA=I-A*dt  matrix - linearised system
  end;
  if mttmethod>1		# nonlinear implicit
    [mttAAx] = $1_smxx(MTTx,MTTu,MTTx,mttdt); # Set up AAx = AA*x vector - linearised system
  end;

  [MTTu] = $1_input(MTTx,MTTt);	# Input


  for MTTjt = 1:mttsteps
    [MTTdx] = $1_ode(MTTx,MTTu,MTTt); # State derivative
    [MTTx] = mtt_update(MTTdx,MTTx,mttAAx,mttAA,mttdt,mttstepfactor,$Nx,mttmethod);
    MTTt = MTTt + mttddt;
  end;

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

  [MTTy] = $1_odeo(MTTx,MTTu,MTTt);
  mtt_write(MTTt,MTTx,MTTy,$Nx,$Ny);
end;

EOF





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