Overview
| Comment: | *** empty log message *** |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | origin/master | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
553ddd76ac749cbc3ce3022390a226c1 |
| User & Date: | gawthrop@users.sourceforge.net on 2000-12-27 16:06:17.000 |
| Other Links: | branch diff | manifest | tags |
Context
|
2000-12-27
| ||
| 16:26:38 | Initial revision check-in: 8eb6e09e9a user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
| 16:06:17 | *** empty log message *** check-in: 553ddd76ac user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
| 16:05:29 | Initial revision check-in: 3a859a6665 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
Changes
Modified mttroot/mtt/bin/trans/awk/lbl2cr.awk
from [3f3d82c505]
to [aa06076c55].
| ︙ | ︙ | |||
8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # Copyright (c) P.J.Gawthrop, 1996. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.8 1998/03/06 09:15:28 peterg ## Ignores SS fields (assumes that if first field is a symbol then other ## field is and SS-style field. ## ## Revision 1.7 1997/04/22 12:50:15 peterg ## New much simpler version -- does not check for multiple crs -- these ## are removed later anyway. | > > > | 8 9 10 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.9 1998/03/08 21:01:40 peterg ## Now does multiple crs ## ## Revision 1.8 1998/03/06 09:15:28 peterg ## Ignores SS fields (assumes that if first field is a symbol then other ## field is and SS-style field. ## ## Revision 1.7 1997/04/22 12:50:15 peterg ## New much simpler version -- does not check for multiple crs -- these ## are removed later anyway. |
| ︙ | ︙ | |||
52 53 54 55 56 57 58 |
}
}
return matched;
}
BEGIN {
| | > | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
}
}
return matched;
}
BEGIN {
comment = "%|#";
cr_delimiter = ";";
not_a_cr = "effort flow state internal external zero none";
is_a_SS = "internal external zero";
numeric = "[0-9]";
symbolic = "\044"; # Ascii $
symbol_count = 0;
symbols = "";
# Include lin cr anyway.
print "lin"
}
{
if ( (match($1,comment)==0) && (NF>=3) ) {
crs = $2
n_crs = split(crs,cr,cr_delimiter);
for (i = 1; i <= n_crs; i++) {
|
| ︙ | ︙ |
Modified mttroot/mtt/bin/trans/awk/lbl2sympar.awk
from [2bb4150078]
to [c5c057bec5].
| ︙ | ︙ | |||
8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # Copyright (c) P.J.Gawthrop, 1996. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.12 1998/07/04 11:09:46 peterg ## Cleaned up - assumes new lbl style for SS ## ## Revision 1.11 1998/05/13 12:39:23 peterg ## Added `unknown' to list od names to avoid ## ## Revision 1.10 1998/03/26 13:03:23 peterg | > > > | 8 9 10 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.13 1998/07/15 09:26:50 peterg ## Reinstated the second column of the sympar file - the system name ## ## Revision 1.12 1998/07/04 11:09:46 peterg ## Cleaned up - assumes new lbl style for SS ## ## Revision 1.11 1998/05/13 12:39:23 peterg ## Added `unknown' to list od names to avoid ## ## Revision 1.10 1998/03/26 13:03:23 peterg |
| ︙ | ︙ | |||
50 51 52 53 54 55 56 |
##
###############################################################
function exact_match(name1, name2) {
return ((match(name1,name2)>0)&&(length(name1)==length(name2)))
| | | | > > > | 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 |
##
###############################################################
function exact_match(name1, name2) {
return ((match(name1,name2)>0)&&(length(name1)==length(name2)))
}
function matches(names, name) {
n_matches = split(names,match_name);
matched = 0;
for (i_matches = 1; i_matches <= n_matches; i_matches++) {
if ( exact_match(name,match_name[i_matches]) ) {
matched = 1;
break;
}
}
return matched;
}
BEGIN {
sys_name = ARGV[1];
comment = "%|#";
var = "[%|#]VAR";
arg_delimiter = ",";
not_an_arg = "effort flow state internal external zero unknown 0 1";
SS_parameter = "internal external zero 0 1";
numeric = "[0-9-]";
symbol_count = 0;
symbols = "";
}
{
if (match($1,var)>0) print $2 "\t" name;
if ( (match($1,comment)==0) && (NF>=3) ) {
n_args = split($3,arg,arg_delimiter);
for (i = 1; i <= n_args; i++) {
first_char = substr(arg[i],1,1);
if ( (matches(not_an_arg,arg[i])==0) \
&& (match(first_char,numeric)==0) \
&& (match(arg[i],"\\$")==0) \
|
| ︙ | ︙ |
Modified mttroot/mtt/bin/trans/awk/tex2doc.awk
from [49e98b86ec]
to [a8fccd0d60].
| ︙ | ︙ | |||
8 9 10 11 12 13 14 15 16 17 18 19 20 | # Copyright (c) P.J.Gawthrop, 1996. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ # Revision 1.1 1996/08/18 20:00:10 peter # Initial revision # ############################################################### | > > > | | | | | | > | | 8 9 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 39 40 41 |
# Copyright (c) P.J.Gawthrop, 1996.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
# Revision 1.2 1997/04/15 11:18:49 peterg
# Uses supertabular package
#
# Revision 1.1 1996/08/18 20:00:10 peter
# Initial revision
#
###############################################################
END{
# split(ARGV[1],a,"_");
# system_name = a[1];
# split(a[2],b,".");
# representation = b[1];
makefile = sprintf("%s_rep.make", $system_name, $representation);
print "\\documentclass[12pt,a4paper]{article}";
printf("\\title{System %s, representation %s}\n", \
system_name, representation)
print "\\author{Generated by MTT}";
print " \\usepackage{epsfig}";
print " \\usepackage{supertabular}";
print "\\begin{document}";
print " \\maketitle";
print" \\input{}", system_nam,e $representation;
print $system_name $representation
print "\\end{document}"
}
|
Modified mttroot/mtt/bin/trans/m/cr2name.m
from [e725813089]
to [27c939caaa].
|
| | | > > > > > > > > > > > > > > > > > > > > > > > > > | | | | 1 2 3 4 5 6 7 8 9 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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
function crname = cr2name(name,RHS_number,LHS_cause,RHS_cause,cr,args,port);
% cr2name - Constructs a string for the cr of a component.
% %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%% Model Transformation Tools %%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Matlab function cr2name
% cr2name(name,RHS_number,LHS_cause,RHS_cause,cr,args);
% Copyright (c) P.J. Gawthrop, 1996.
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2 1996/08/22 18:31:06 peter
% %% Fixed comment bug.
% %%
% %% Revision 1.1 1996/08/22 13:14:39 peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if nargin<7
port=0
end;
if length(args)==0
a_comma = '';
else
a_comma = ',';
end;
if length(cr)==0
cause_name = '';
lp = '';
rp = '';
c_comma = '';
else
cause_name = cause2name(LHS_cause);
lp = '(';
rp = ')';
c_comma = ',';
end
if port == 0
port_name = '';
p_comma = '';
else
port_name = sprintf('%1.0f',port);
p_comma = ',';
end;
crname = sprintf('%s%s%s%s%s%s%s%s%s\t%s', ...
cr,lp, args, a_comma, port_name, p_comma, cause_name, c_comma, ...
varname(name, RHS_number,RHS_cause),rp);
|
Modified mttroot/mtt/bin/trans/m/equation.m
from [4d5bffe3a9]
to [ebd4d7871d].
| ︙ | ︙ | |||
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 39 | % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %% Version control history % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %% $Id$ % %% $Log$ % %% Revision 1.4 1996/09/12 16:42:01 peter % %% Default now out side this function - need to be none for each % %% component. % %% % %% Revision 1.3 1996/09/12 12:03:58 peter % %% Added some error checking. % %% If no constitutive relationship, only add diagonal elementts to % %% default unity output. % %% % %% Revision 1.2 1996/09/10 11:29:47 peter % %% Removed causality & port info when no constitutive relationship. % %% % %% Revision 1.1 1996/09/10 11:11:11 peter % %% Initial revision % %% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Find the number of inports | > > > > > | | 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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.5 1996/12/05 11:26:51 peterg
% %% Null strings now detected with strcmp not length.
% %%
% %% Revision 1.4 1996/09/12 16:42:01 peter
% %% Default now out side this function - need to be none for each
% %% component.
% %%
% %% Revision 1.3 1996/09/12 12:03:58 peter
% %% Added some error checking.
% %% If no constitutive relationship, only add diagonal elementts to
% %% default unity output.
% %%
% %% Revision 1.2 1996/09/10 11:29:47 peter
% %% Removed causality & port info when no constitutive relationship.
% %%
% %% Revision 1.1 1996/09/10 11:11:11 peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
inbonds
incauses
% Find the number of inports
nports = length(inbonds)
% Check some arguments
if length(incauses) ~= nports
error('equation.m: incauses inconsistent with inbonds');
end;
if length(inports) ~= nports
|
| ︙ | ︙ |
Modified mttroot/mtt/bin/trans/m/figfig.m
from [0aee9794f8]
to [a4c7d5628b].
|
| | | | > > > > > < < < < < < | < < < < < < < < < < < < | < | < < < < < | < > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 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 39 40 41 |
function figfig(filename,language)
## Usage: figfig(filename[,language])
## Puts octave figure into fig file (filename.fig)
## If second argument, converts to filename.language using fig2dev
## eg:
## figfig("foo");
## figfig("foo","eps");
## figfig("foo","pdf");
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1 2000/11/03 10:43:10 peterg
## Initial revision
###############################################################
figfilename = sprintf("%s.fig",filename);
eval(sprintf("gset output \"%s\" ",figfilename));
gset term fig color portrait fontsize 16 size 20 10 metric
replot;
gset term x11
gset output
replot;
## Add a box - makes a visible bounding box
fid = fopen(figfilename,"a+");
fprintf(fid,"2 4 0 2 31 7 50 0 -1 0.000 0 0 7 0 0 5\n");
fprintf(fid,"\t9675 5310 9675 270 225 270 225 5310 9675 5310\n");
fclose(fid);
if nargin>1 # Do a ps file
psfilename = sprintf("%s.%s",filename,language);
convert = sprintf("fig2dev -L%s %s > %s", language, figfilename, psfilename)
system(convert);
endif
endfunction
|
Modified mttroot/mtt/bin/trans/m/mtt_euler.m
from [a811a17cef]
to [3653e4fcc1].
|
| | | 1 2 3 4 5 6 7 | function [x] = mtt_euler(x,dx,dt,Nx,open) # Euler update I_open = nozeros(open.*[1:Nx]'); # Indices of open switches x(I_open) = 0.0; # Open switches have zero state I = nozeros(!open.*[1:Nx]'); # Indices of states to update x(I) = x(I) + dx(I)*dt; # Update states except open switches. endfunction; |
Modified mttroot/mtt/bin/trans/m/mtt_sfreq.m
from [9ba3b482f5]
to [22eb1c42b9].
|
| | | > > > | | > | > > | > > > | | > > | > > > | | | < | < < | | > | | < < | 1 2 3 4 5 6 7 8 9 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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
function [w,y,y_theta] = mtt_sfreq(system_name,theta,free);
## usage: [w,y,y_theta] = mtt_sfreq(system_name,theta,free);
##
## Frequency response with name system_name and parameter vector theta
## The order of components in theta is determined in system_numpar.txt:
## y_theta contains the corresponding sensitivity functions
## Assumes system generated by the sBG approach
## Copyright (C) 1999 by Peter J. Gawthrop
## $Id$
## Assumes SISO system
global mtt_n_parameters mtt_parameters # Global "argc argv"
global mtt_w # Frequencies (if not specified in simpar file
N = length(theta);
eval(sprintf("[nx,ny,nu,nz,nyz] = %s_def;", system_name));
if nargin<3
free = 1;
endif
y_theta = [];
if length(free)==0
free=1; # Make the loop happen once to get y and X
endif
[n,m] = size(free);
if m==1
free = free';
endif
eval(sprintf("%s_simpar;", system_name)); # Read the "simulation"
# parameters
if exist("mttwmin") # Compute frequency range
w = logspace(mttwmin,mttwmax,mttwsteps)'; # Frequency range
else # use global mtt_w
w = mtt_w;
endif
y_theta = [];
mtt_n_parameters = 1+N;
mtt_parameters(2:1+N) = theta; # The actual parameters
for i = free
mtt_parameters(1) = i; # Select wich sens. function
eval(sprintf("%s_numpar;", system_name)); # Read the parameters
eval(sprintf("[A,B,C,D,E] = %s_dm;", system_name)); # Evaluate the
# descriptor matrices
fr = dm2fr(A,B,C,D,E,w);
y_theta = [y_theta fr(:,2)]; # Sensitivity frequency response
endfor
y = fr(:,1); # Actual frequency response
endfunction
|
| ︙ | ︙ |
Modified mttroot/mtt/bin/trans/m/psfig.m
from [6bbed01590]
to [e433f0a0b8].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
function psfig(filename)
## Usage: psfig(filename)
## Puts figure into ps file
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.3 1999/09/04 02:23:30 peterg
## Removed mv stuff - now uses gset on actual file
##
## Revision 1.2 1999/06/15 02:05:44 peterg
## Now adds a .ps if not there already
##
## Revision 1.1 1999/03/25 01:35:00 peterg
## Initial revision
##
###############################################################
## Add .ps if not there already
if !index(filename,".") # Is there a .
filename = sprintf("%s.ps",filename);
endif
| > > > < > > > > > > > > | 1 2 3 4 5 6 7 8 9 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 39 40 41 42 43 |
function psfig(filename)
## Usage: psfig(filename)
## Puts figure into ps file
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1 1999/11/30 23:26:21 peterg
## Initial revision
##
## Revision 1.3 1999/09/04 02:23:30 peterg
## Removed mv stuff - now uses gset on actual file
##
## Revision 1.2 1999/06/15 02:05:44 peterg
## Now adds a .ps if not there already
##
## Revision 1.1 1999/03/25 01:35:00 peterg
## Initial revision
##
###############################################################
## Add .ps if not there already
if !index(filename,".") # Is there a .
filename = sprintf("%s.ps",filename);
endif
eval(sprintf("gset output \"%s\" ",filename));
gset linestyle 1 lw 4 # Thicker lines
gset linestyle 2 lw 4 # Thicker lines
gset linestyle 3 lw 4 # Thicker lines
gset linestyle 4 lw 4 # Thicker lines
gset linestyle 5 lw 4 # Thicker lines
gset term postscript eps
replot;
gset term x11
gset output
replot;
endfunction
|
Modified mttroot/mtt/bin/trans/m/replace_name.m
from [d28ce054d4]
to [f5eb963580].
1 2 3 4 5 6 7 8 9 10 | function string_array = replace_name(string_array, new, index); % Replaces a row of a string vector with a string of arbitary length. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ############################################################### | > > > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
function string_array = replace_name(string_array, new, index);
% Replaces a row of a string vector with a string of arbitary length.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1 1998/07/02 12:36:39 peterg
## Initial revision
##
###############################################################
string_array,new,index
[N,M]=size(string_array);
L = length(new);
if index>N
error(["String array has less than ", num2str(index), " rows"]);
end;
|
| ︙ | ︙ |
Modified mttroot/mtt/bin/trans/m/varname.m
from [f43a51e894]
to [ff219e7dd5].
| ︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 | % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %% Version control history % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %% $Id$ % %% $Log$ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | > > > | > > | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1 1996/08/27 08:08:44 peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%bond_name = [name,'_bond'];
%name =sprintf('%s%1.0f_%s', bond_name, index, cause2name(causality));
bond_name = [name,'('];
name =sprintf('%s(%1.0f,%1.0f)', name, index, cause2num(causality));
|
Modified mttroot/mtt/bin/trans/m/write_matrix.m
from [1f41035ec1]
to [ed4ac445d1].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | function write_matrix(matrix,name); % Writes the matrix function file % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %% Version control history % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %% $Id$ % %% $Log$ % %% Revision 1.4 1996/08/15 11:56:11 peter % %% Does complex matrices. % %% % %% Revision 1.3 1996/08/14 19:20:41 peter % %% Fixed output naming bug. % %% % %% Revision 1.2 1996/08/14 08:36:52 peter | > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | function write_matrix(matrix,name); % Writes the matrix function file % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %% Version control history % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %% $Id$ % %% $Log$ % %% Revision 1.5 1998/02/03 08:40:39 peterg % %% Fixed a horrible bug -- changed filename -> filenum % %% % %% Revision 1.4 1996/08/15 11:56:11 peter % %% Does complex matrices. % %% % %% Revision 1.3 1996/08/14 19:20:41 peter % %% Fixed output naming bug. % %% % %% Revision 1.2 1996/08/14 08:36:52 peter |
| ︙ | ︙ | |||
31 32 33 34 35 36 37 | fprintf(filenum, '%s data = %s\n\n', pc, name); fprintf(filenum, 'data = [\n'); [N,M] = size(matrix); for row = 1:N for col = 1:M | | < | | | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
fprintf(filenum, '%s data = %s\n\n', pc, name);
fprintf(filenum, 'data = [\n');
[N,M] = size(matrix);
for row = 1:N
for col = 1:M
value = matrix(row,col);
fprintf(filenum, '%g', real(value));
if is_complex(value)
fprintf(filenum, '+ %g*i', imag(value));
end
if col<M
fprintf(filenum, '\t');
end
end;
fprintf(filenum, '\n');
end;
|
| ︙ | ︙ |