Overview
Comment:The Octave load/save -ascii option is deprecated in favour of -text
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 7dd8c4e86f3ba2ebce468b919790b5f2b638da483018145025a92f66e7342cb3
User & Date: geraint@users.sourceforge.net on 2005-04-26 22:52:26
Other Links: branch diff | manifest | tags
Context
2005-04-26
23:43:35
Reset open switches after update to eliminate overshoots. check-in: aba815b752 user: geraint@users.sourceforge.net tags: origin/master, trunk
22:52:26
The Octave load/save -ascii option is deprecated in favour of -text check-in: 7dd8c4e86f user: geraint@users.sourceforge.net tags: origin/master, trunk
13:06:08
Tidied check-in: a70054eb83 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/abg2connections_m2dat from [a1f5100c16] to [123924ba9b].

22
23
24
25
26
27
28
29
30
31
32

str = save_header_format_string;
save_header_format_string =  ["# Model Transformation Tools\t", ...
			      " -*-octave-*-\n", ...
			      "# Created by abg2connections_m\n", ...
			      str];

save -ascii ${file} ${sys}_connections;

EOF








|



22
23
24
25
26
27
28
29
30
31
32

str = save_header_format_string;
save_header_format_string =  ["# Model Transformation Tools\t", ...
			      " -*-octave-*-\n", ...
			      "# Created by abg2connections_m\n", ...
			      str];

save -text ${file} ${sys}_connections;

EOF

Modified mttroot/mtt/bin/trans/cbg_m2dia from [dbd56a874e] to [ddc0cb4e01].

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
ibg	= ${sys}_ibg;
cbg	= ${name}_cbg;

## get connections data: ${sys}_connections
## structure with two cell arrays: head and tail 
## the index of each array element is the bond index
## the value of each array element is a component name
load -ascii ${sys}_connections.dat;
con	= ${sys}_connections;

nibgbonds = length (fieldnames (ibg.bonds));
ncbgbonds = length (con.head);

## map cbg data to connection data
for [bond, bond_name] = ibg.bonds







|







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
ibg	= ${sys}_ibg;
cbg	= ${name}_cbg;

## get connections data: ${sys}_connections
## structure with two cell arrays: head and tail 
## the index of each array element is the bond index
## the value of each array element is a component name
load -text ${sys}_connections.dat;
con	= ${sys}_connections;

nibgbonds = length (fieldnames (ibg.bonds));
ncbgbonds = length (con.head);

## map cbg data to connection data
for [bond, bond_name] = ibg.bonds

Modified mttroot/mtt/bin/trans/mtt_make_sim from [0eacf885ca] to [39947db7aa].

9
10
11
12
13
14
15




16
17
18
19
20
21
22
# Copyright (C) 2000 by Peter J. Gawthrop

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




## Revision 1.7  2000/05/19 17:47:35  peterg
## Fixed bug in oct version but still needs proper check
##
## Revision 1.6  2000/05/17 17:20:49  peterg
## Fixed bugs with ny>1. Could be made faster by not generating y when
## y_sim >1
##







>
>
>
>







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Copyright (C) 2000 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.8  2002/04/28 18:41:27  geraint
## Fixed [ 549658 ] awk should be gawk.
## Replaced calls to awk with call to gawk.
##
## Revision 1.7  2000/05/19 17:47:35  peterg
## Fixed bug in oct version but still needs proper check
##
## Revision 1.6  2000/05/17 17:20:49  peterg
## Fixed bugs with ny>1. Could be made faster by not generating y when
## y_sim >1
##
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168

  S = [S;"Save\t"];
  tim = time;

  ## Create the system input file
  t1 = [0:N_u-1]*dt; # Create time vector from zero (to fit u);
  ut = [t1' u'];
  save -ascii $1_input.dat ut 

  ## Create the state file
  xi = [[1:$Nx]' x0]; #'
  save -ascii   $1_state.dat xi

  ## Create the sympar file
  save -ascii   $1_simpar.dat dt

  ## Create the numpar file
  [n_par,m_par] = size(par);
  if m_par==1
    if n_par!=$Npar
      error(sprintf("Number of parameters is %i, should be %i", n_par, $Npar));
    else
      ipar= [[1:$Npar]' par]; #' 
    endif
  elseif m_par==2
    ipar = par;
  else
    error(sprintf("Number of parameter columns is %i, should be 1 or 2", m_par));
  endif;

  if !doing_sensitivities
      save -ascii   $1_numpar.dat ipar 
  endif;

  dtime = time-tim;
  T = [T; num2str(dtime)];

  ## main simulation loop
  n_sim = max(1,n_sens);
  for i_sim=1:n_sim
    i_1 = 2;

    if doing_state
      i_2 = i_1 + n_y - 1;
      i_3 = i_1 + n_y + 1;
      i_4 = i_1 + n_y + $Nx;
    else
      if doing_sensitivities
        i_2 = 1 + 2*n_y;
        ipars = [ipar; [sensitivities(i_sim) 1]];
        save -ascii   $1_numpar.dat ipars 
      else
        i_2 = i_1 + n_y -1;
      endif
    endif;

      if doing_state # Need to cut twice
        command = sprintf("./$1_ode2odes.out< $1_input.dat | cut -f %i-%i,%i-%i | tail -%i;", i_1,i_2,i_3,i_4,n_t);







|



|


|
















|


















|







115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172

  S = [S;"Save\t"];
  tim = time;

  ## Create the system input file
  t1 = [0:N_u-1]*dt; # Create time vector from zero (to fit u);
  ut = [t1' u'];
  save -text $1_input.dat ut 

  ## Create the state file
  xi = [[1:$Nx]' x0]; #'
  save -text   $1_state.dat xi

  ## Create the sympar file
  save -text   $1_simpar.dat dt

  ## Create the numpar file
  [n_par,m_par] = size(par);
  if m_par==1
    if n_par!=$Npar
      error(sprintf("Number of parameters is %i, should be %i", n_par, $Npar));
    else
      ipar= [[1:$Npar]' par]; #' 
    endif
  elseif m_par==2
    ipar = par;
  else
    error(sprintf("Number of parameter columns is %i, should be 1 or 2", m_par));
  endif;

  if !doing_sensitivities
      save -text   $1_numpar.dat ipar 
  endif;

  dtime = time-tim;
  T = [T; num2str(dtime)];

  ## main simulation loop
  n_sim = max(1,n_sens);
  for i_sim=1:n_sim
    i_1 = 2;

    if doing_state
      i_2 = i_1 + n_y - 1;
      i_3 = i_1 + n_y + 1;
      i_4 = i_1 + n_y + $Nx;
    else
      if doing_sensitivities
        i_2 = 1 + 2*n_y;
        ipars = [ipar; [sensitivities(i_sim) 1]];
        save -text   $1_numpar.dat ipars 
      else
        i_2 = i_1 + n_y -1;
      endif
    endif;

      if doing_state # Need to cut twice
        command = sprintf("./$1_ode2odes.out< $1_input.dat | cut -f %i-%i,%i-%i | tail -%i;", i_1,i_2,i_3,i_4,n_t);

Modified mttroot/mtt/bin/trans/octave_ode2odes from [c8132b66e7] to [9934b36f54].

9
10
11
12
13
14
15



16
17
18
19
20
21
22
# Copyright (c) P.J.Gawthrop 1999

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



## Revision 1.4  2001/03/30 15:13:58  gawthrop
## Rationalised simulation modes to each return mtt_data
##
## Revision 1.3  2000/05/19 17:47:56  peterg
## Agument to state
##
## Revision 1.2  2000/05/11 13:43:14  peterg







>
>
>







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Copyright (c) P.J.Gawthrop 1999

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.5  2002/05/07 10:13:48  gawthrop
## Files marked by update as out of sync
##
## Revision 1.4  2001/03/30 15:13:58  gawthrop
## Rationalised simulation modes to each return mtt_data
##
## Revision 1.3  2000/05/19 17:47:56  peterg
## Agument to state
##
## Revision 1.2  2000/05/11 13:43:14  peterg
35
36
37
38
39
40
41
42
43
44
45
  x_0  =  $1_state(par);
  simpar = $1_simpar
  mtt_data = $1_ode2odes(x_0,par,simpar); 
  if is_complex(mtt_data)
    mtt_error("octave_ode2odes: Simulated data is complex - something is wrong!");
    mtt_data = real(mtt_data);
  endif;
  save -ascii $1_odes.dat2 mtt_data
EOF

mtt_error mtt_error.txt







|



38
39
40
41
42
43
44
45
46
47
48
  x_0  =  $1_state(par);
  simpar = $1_simpar
  mtt_data = $1_ode2odes(x_0,par,simpar); 
  if is_complex(mtt_data)
    mtt_error("octave_ode2odes: Simulated data is complex - something is wrong!");
    mtt_data = real(mtt_data);
  endif;
  save -text $1_odes.dat2 mtt_data
EOF

mtt_error mtt_error.txt

Modified mttroot/mtt/bin/trans/ode2odess_m2dat2 from [4e1d5bd33f] to [13554ba921].

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.4  2000/10/17 11:07:59  peterg
## *** empty log message ***
##
## Revision 1.3  1998/05/19 19:27:04  peterg
## Zapped all the parameter stuff
##
## Revision 1.2  1996/09/13 19:40:51  peter







>
>
>







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.1  2000/10/17 12:55:29  peterg
## Initial revision
##
## Revision 1.4  2000/10/17 11:07:59  peterg
## *** empty log message ***
##
## Revision 1.3  1998/05/19 19:27:04  peterg
## Zapped all the parameter stuff
##
## Revision 1.2  1996/09/13 19:40:51  peter
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
for t=T'
  u = $1_input(x,zeros($Ny,1),t,par);
  x = fsolve('f',x);
  y = $1_odeo(x,u,t,par);
  mtt_write(t,x,y,$Nx,$Ny);   # Write it out
end; 

save -ascii $1_odess.dat2 MTT_data

EOF

# Now invoke the standard error handling.
mtt_error mtt_error.txt












|










91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
for t=T'
  u = $1_input(x,zeros($Ny,1),t,par);
  x = fsolve('f',x);
  y = $1_odeo(x,u,t,par);
  mtt_write(t,x,y,$Nx,$Ny);   # Write it out
end; 

save -text $1_odess.dat2 MTT_data

EOF

# Now invoke the standard error handling.
mtt_error mtt_error.txt






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